简介
Insight Engine
原始描述
Logs/metrics → Python statistics → LLM interpretation → Notion reports. Use when: generating daily/weekly/monthly operational insights from AI system logs, p...
通过你的 Agent 添加
安装目录:insight-engine/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: insight-engine version: 1.0.4 metadata: { "openclaw": { "emoji": "🔬", "requires": { "bins": ["python3", "ollama"], "env": ["ANTHROPIC_API_KEY", "NOTION_API_KEY"] }, "primaryEnv": "ANTHROPIC_API_KEY", "network": { "outbound": true, "reason": "Calls Anthropic API for statistical interpretation of pre-computed data. Writes reports to Notion API. Raw data analysis is local Python — no raw logs leave the machine." }, "security_notes": "All LLM API calls are made using the user's own API keys to providers they have accounts with. Notion writes go to the user's own Notion workspace. Raw operational data (logs, traces) is analysed locally in Python before a structured summary packet is sent to the LLM — no raw logs are transmitted." } } description: "Logs/metrics → Python statistics → LLM interpretation → Notion reports. Use when: generating daily/weekly/monthly operational insights from AI system logs, producing data-driven Notion reports from Langfuse traces and gateway logs, setting up a cron-based insight pipeline, building a citation-enforcing analyst that refuses to make claims without specific data. Pattern: collect raw data → compute stats in Python → feed structured packet to LLM → write to Notion."
Last used: 2026-03-24 Memory references: 18 Status: Active
insight-engine
Data-driven insights from operational logs: collect → stats → LLM interpretation → Notion.
Architecture
collect (Python stats only)
├── Langfuse OTEL traces/scores/observations
├── OpenClaw/gateway logs
├── Git activity
└── Control plane scores
↓
build_*_data_packet() ← all stats computed in Python before LLM call
↓
call_claude(system_prompt, structured_json) ← LLM interprets, doesn't compute
↓
write_*_reflection() → Notion
collect (Python stats only)
├── Langfuse OTEL traces/scores/observations
├── OpenClaw/gateway logs
├── Git activity
└── Control plane scores
↓
build_*_data_packet() ← all stats computed in Python before LLM call
↓
call_claude(system_prompt, structured_json) ← LLM interprets, doesn't compute
↓
write_*_reflection() → Notion
See references/architecture.md for full design rationale.
Quick start
# Install deps
pip install anthropic requests pyyaml
# Configure
cp scripts/config/analyst.yaml.example config/analyst.yaml
# Edit config/analyst.yaml — set langfuse URL, notion IDs, model choices
# Dry run (local Ollama, no Notion write)
python3 scripts/src/engine.py --mode daily --dry-run
# Print data packet + prompt to stdout (for agent consumption, no API calls)
python3 scripts/src/engine.py --mode daily --data-only
# Live run
python3 scripts/src/engine.py --mode daily
python3 scripts/src/engine.py --mode weekly
python3 scripts/src/engine.py --mode monthly
Required env vars
ANTHROPIC_API_KEY=sk-ant-... # Anthropic API key
NOTION_API_KEY=secret_... # Notion integration token
LANGFUSE_BASE_URL=http://localhost:3100 # Langfuse server URL
LANGFUSE_PUBLIC_KEY=pk-lf-... # Langfuse public key
LANGFUSE_SECRET_KEY=sk-lf-... # Langfuse secret key
NOTION_ROOT_PAGE_ID=<uuid> # Root Notion page for reports
NOTION_DAILY_DB_ID=<uuid> # Notion database for daily entries
# Install deps
pip install anthropic requests pyyaml
# Configure
cp scripts/config/analyst.yaml.example config/analyst.yaml
# Edit config/analyst.yaml — set langfuse URL, notion IDs, model choices
# Dry run (local Ollama, no Notion write)
python3 scripts/src/engine.py --mode daily --dry-run
# Print data packet + prompt to stdout (for agent consumption, no API calls)
python3 scripts/src/engine.py --mode daily --data-only
# Live run
python3 scripts/src/engine.py --mode daily
python3 scripts/src/engine.py --mode weekly
python3 scripts/src/engine.py --mode monthly
ANTHROPIC_API_KEY=sk-ant-... # Anthropic API key
NOTION_API_KEY=secret_... # Notion integration token
LANGFUSE_BASE_URL=http://localhost:3100 # Langfuse server URL
LANGFUSE_PUBLIC_KEY=pk-lf-... # Langfuse public key
LANGFUSE_SECRET_KEY=sk-lf-... # Langfuse secret key
NOTION_ROOT_PAGE_ID=<uuid> # Root Notion page for reports
NOTION_DAILY_DB_ID=<uuid> # Notion database for daily entries
Or configure in config/analyst.yaml.
Key design principles
- Stats before LLM — Python computes all numbers. The LLM interprets, doesn't aggregate.
- Citation-enforcing prompts — System prompts require every claim to cite a specific number.
- No hallucinated trends —
< 7 data points → report "insufficient data (n=X)"
- Dry-run mode — Uses local Ollama (free) to preview output; skip Notion write.
- Data-only mode — Outputs the full data packet + prompts for agent/subagent use.
Cron setup (LaunchAgent example)
<!-- ~/Library/LaunchAgents/com.yourname.insight-engine-daily.plist -->
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key><integer>23</integer>
<key>Minute</key><integer>0</integer>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python3</string>
<string>/path/to/insight-engine/scripts/src/engine.py</string>
<string>--mode</string><string>daily</string>
</array>
Extending to new data sources
< 7 data points → report "insufficient data (n=X)"<!-- ~/Library/LaunchAgents/com.yourname.insight-engine-daily.plist -->
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key><integer>23</integer>
<key>Minute</key><integer>0</integer>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python3</string>
<string>/path/to/insight-engine/scripts/src/engine.py</string>
<string>--mode</string><string>daily</string>
</array>
Extending to new data sources
Add a collector in scripts/src/collectors/:
- Create
my_source.pywith afetch_*()function returning a plain dict - Import and call it in
build_daily_data_packet()inengine.py - Reference the new key in
prompts/daily_analyst.mdunder "Data sources"
See also
references/architecture.md — full design rationale and layer descriptions
scripts/prompts/daily_analyst.md — system prompt with citation rules
scripts/config/analyst.yaml.example — config template
references/architecture.md — full design rationale and layer descriptionsscripts/prompts/daily_analyst.md — system prompt with citation rulesscripts/config/analyst.yaml.example — config template正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。