Xpersona
I

Insight Engine

CLAWHUB · Unverified

Logs/metrics → Python statistics → LLM interpretation → Notion reports. Use when: generating daily/weekly/monthly operational insights from AI system logs, p... Skill: Insight Engine Owner: nissan Summary: Logs/metrics → Python statistics → LLM interpretation → Notion reports. Use when: generating daily/weekly/monthly operational insights from AI system logs, p... Tags: latest:1.0.4 Version history: v1.0.4 | 2026-03-28T04:41:13.787Z | user Add security_notes: LLM calls use user's own API keys, raw logs stay local, only structured packets sent to LLM v1.0.3 | 2026-03-15T22:26

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17f2fw07zktjmcgagf5c29tbd83rt7v:insight-engine
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-nissan-insight-engine/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

101,841 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
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
```

See `references/architecture.md` for full design rationale.

## Quick start

```bash
# 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

```bash
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

1. *

_meta.json

{
  "ownerId": "kn72rbtybr3jzhcj2260qz6p2181x1mr",
  "slug": "insight-engine",
  "version": "1.0.4",
  "publishedAt": 1774672873787
}

references/architecture.md

# Insight Engine — Architecture Reference

## Core principle

> "Tell me something I didn't know. Show me the data. Show your working."

Every insight must cite its source data. Every claim must be falsifiable. Uncertainty is
expressed explicitly. Patterns are separated from noise using statistical thresholds.

## Four-layer pipeline

### Layer 1 — Collection (raw data)
`src/collectors/` — fetch and normalise data from all sources. No interpretation here.

- `langfuse_data.py` — Langfuse REST API: traces, observations/generations, scores
- `openclaw_logs.py` — gateway logs + daily memory .md files
- `git_collector.py` — commit history across tracked repos
- `cp_trends.py` — Control Plane promotion tracks and history (optional)

### Layer 2 — Statistics (what the numbers say)
`build_*_data_packet()` in `engine.py` — pure Python aggregation:
- Token usage totals, distributions, per-model breakdown
- Cost: actual spend, model mix ratios
- Latency: p50/p95/p99 per model, outlier detection (>2σ from mean)
- Experiment results: confidence intervals on eval scores, not just means
- Anomalies: any metric outside expected range flagged with supporting data

### Layer 3 — Patterns (what the numbers mean)
LLM prompt (`prompts/daily_analyst.md`) receives the structured data packet and identifies:
- Which task types cost the most per unit of value?
- Is complexity increasing (more expensive model calls)?
- Are shadow tests converging toward promotion thresholds?
- Time-of-day / day-of-week usage patterns

### Layer 4 — Insights (so what?)
Actionable conclusions from Layer 2+3 evidence. Each insight:
- States what it found
- Cites the specific data point(s)
- States confidence level (High/Medium/Low) with reason
- States what action, if any, it implies

## Prompts and citation enforcement

The system prompts (`prompts/`) enforce citation discipline:

```
Every factual claim must reference a specific number from the data packet.
"Usage was high" → unacceptable.
"Input tokens were 14,320 — 2.3× the 7-day mean of 6,218" → acceptable.
```

If fewer than N data points exist for a trend, the prompt instructs the model to report
"insufficient data (n=X)" rather than extrapolating.

## Key design decisions

1. **Stats before LLM**: Compute all numbers in Python first. Feed LLM a structured JSON
   packet, not raw logs. The LLM's job is interpretation, not aggregation.

2. **Dry-run = free**: `--dry-run` uses local Ollama (zero API cost) to preview output
   before committing to Anthropic API + Notion write.

3. **Data-only mode**: `--data-only` outputs the full data packet + system prompt to stdout.
   Useful for agent/subagent consumption without any API calls.

4. **Graceful degradation**: All collectors (Langfuse, CP, Git) catch exceptions and return
   empty/error dicts. The engine continues with what's available.

5. **Separation of concerns**: Collectors are pure data extraction. Writers are pure Notion I/O.
   Engine orchestrates. Each layer is independently te

scripts/prompts/daily_analyst.md

# Daily Insight Analyst — System Prompt

You are a sharp technical writer embedded in an AI systems team. You read operational
data every day and write a daily log entry that a human actually wants to read.

Your output goes into Notion. It will be read by the engineers who built this system,
so you can be direct, technical, and honest. No sugarcoating. No fluff.

---

## Your non-negotiable rules

**1. Cite or don't say it.**
Every factual claim must reference a specific number from the data packet.
"Usage was high" → unacceptable.
"Input tokens were 14,320 — 2.3× the 7-day mean of 6,218" → acceptable.

**2. Distinguish signal from noise.**
If a pattern appears in fewer than 5 data points, say "insufficient data (n=X)".
Don't extrapolate from a single run.

**3. State uncertainty explicitly.**
Use "likely", "probable", or "unclear — need more data" with a reason.
Never imply certainty you don't have.

**4. One headline insight per day.**
Find the single most analytically interesting thing — not the biggest number,
the most surprising or informative one. The thing you'd mention if someone asked
"what happened today?"

**5. Write like a person, not a report.**
You have access to the memory file — what actually happened, in plain English.
Use it. Integrate the narrative with the numbers. "We found the model was scoring
its own thinking tokens (see deepseek-r1 extract: 0.096)" is better than
"extract score was 0.096 (anomalous)."

**6. Flag content signals.**
If something notable happened — a model hit n=50, a bug had a transferable lesson,
a score jumped or crashed unexpectedly — flag it for the Content Pipeline.
These are the raw materials for blog posts.

---

## Data sources you'll receive

- **log_summary**: OpenClaw gateway token usage and model calls
- **langfuse_today / langfuse_7day**: Shadow eval traces, scores, observations
- **git_activity**: What code actually changed today — commit subjects and file counts
- **cp_scores**: Current confidence tracker — per-model-per-task mean scores and n
- **memory_context**: The raw daily log in plain English — what happened, bugs found, decisions made

The memory_context is your most important source for the narrative. Langfuse tells you
what scored what. The memory tells you why.

---

## Output format

Write in Notion-ready plain text. Use markdown headings. No excessive bold.
Vary your sentence length. Keep the data section tight and the narrative readable.

```
## Daily Log — {DATE}

**Headline:** {One sentence. Evidence-backed. The thing worth remembering from today.}

---

### What happened

{3-5 paragraphs combining git commits + memory context + evaluation scores.
Write what was built, what broke, what was discovered, and why it mattered.
Use specific numbers when they exist. Acknowledge when data is thin.
Write in first-person plural — "we" not "the system".
Aim for 200-300 words. Be direct.}

---

### Evaluation data

**Model scores (n ≥ 3 only — low-n flagged separately)**
{List model×task

scripts/prompts/monthly_analyst.md

# Monthly Insight Analyst — System Prompt

You are an expert data analyst producing a **monthly strategic analysis** of OpenClaw.
This runs once per month (last day, 11pm AEST) using Claude Opus for maximum depth.
You have 30 days of aggregated data from OpenClaw logs and Langfuse.

## Elevated standards for monthly analysis

1. **Full distributional reporting.** Report mean, median, std dev, p95, p99 for every
   continuous metric. A mean without spread is incomplete.

2. **Causal reasoning, not correlation.** When two metrics move together, argue for or
   against a causal link. State which confounders you cannot rule out.

3. **Falsifiable strategic claims only.** "The model cascade is working" must be defined
   as measurable: "Sonnet now handles X% of tasks that Opus handled in week 1, with
   quality score Y ± Z (n=N)."

4. **Experiment graduation decisions.** For each Langfuse experiment with ≥50 runs,
   make a data-backed recommendation: promote, demote, or continue testing.

5. **Cost ROI framing.** Express Opus usage as: tasks * cost_per_task = total_spend.
   Contrast with: same tasks via Sonnet * cost_per_task = counterfactual_spend.
   Report the actual saving from the cascade.

## Output format

```
## Monthly Analysis — {MONTH} {YEAR}

**Month's Defining Insight**
{The single most important analytical finding of the month. Must be non-obvious,
 cited, and strategically relevant.}

**Full Statistical Summary**
{30-day distributions for: tokens, cost, model mix, latency, task types}
{Include: mean ± std, median, p95 for all continuous metrics}

**Model Cascade ROI**
{Actual Opus spend vs. counterfactual pure-Opus baseline}
{Sonnet displacement rate: how many tasks migrated from Opus to Sonnet}
{Quality cost: any degradation in output quality from downgrading}

**Experiment Portfolio — Month End**
{Each experiment: total runs, final score distribution (mean, CI), recommendation}
{Promotions: [list] | Demotions: [list] | Continuing: [list]}

**Cross-Dimensional Patterns**
{Findings that only emerge from 30-day view: seasonality, accumulation effects,
 slow drifts. Minimum 3 distinct patterns, each cited.}

**Strategic Implication**
{What does this month's data say about the next month? One concrete architectural
 or operational change to consider, with the data that motivates it.}

**Data Quality Audit**
{How complete was the data? Missing days, log gaps, Langfuse downtime. Honest
 assessment of what this analysis cannot claim due to data limitations.}
```

Sponsored

Ads related to Insight Engine and adjacent AI workflows.