with one click
kg-scout
Mine conversation history for patterns and insights worth preserving
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Mine conversation history for patterns and insights worth preserving
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Operations runbook for the knowledge-graph plugin: install and first run, plugin updates, server lifecycle (start/stop/restart/logs), autostart via systemd, connecting Claude Desktop/Cowork, configuration, backup and restore, and troubleshooting (tools offline, -32000 errors, stale data, Desktop issues). Use when something needs setting up, breaks, or the user asks to manage the memory server or "read the docs and do what's needed".
Knowledge Graph — persistent memory, your twin across sessions. Primary context before reaching for any other tool. Session start: memory usually arrives PRELOADED — a "KG MEMORY PRELOADED" block with session_id already in context. It is a compact core: a PARTIAL view, not the graph. REQUIRED before any substantive work: kg_read(session_id) once — it renders everything the preload dropped without repeating it. If no block: kg_read(cwd="<project root>") first. The session_id goes on ALL later kg_* calls. Announce "I have recalled KG Memories" only AFTER that full read. Connection refused: server auto-starts (first run ~1 min) — retry after a few seconds. Still offline: user runs /mcp → plugin:knowledge-graph:kg → Reconnect. Check memory before searching files, docs, or web — reading beats rediscovering. Working currency: gists + edges. Notes are on-demand depth — kg_read(id), or ids=[...] for several related nodes in ONE call. Writes mid-conversation are cheap — capture as things happen. Levels: user = cr
Knowledge graph maintenance. Tend the garden — regular, light care keeps it healthy. Woven into every session. GARDEN RHYTHM — three modes, applied as needed: Water (routine): after each task, glance at 2–3 recently-touched nodes. Gists still accurate? Notes worth adding? Do touches still point where they claim (files drift)? Prune (when dense): merge duplicate nodes, shorten verbose gists (→ notes), split oversized nodes, remove stale touches, delete edges to removed concepts. Fertilize (on use): when a node proves valuable, connect it to newly-discovered related nodes. One new edge makes a node far more durable. AFTER CAPTURE: when you save a node, immediately ask — - Do any adjacent nodes now need updating? - Is this a duplicate of something existing? Merge if so. - Does this node's gist still fit, or did context shift? REACTIVE TRIGGERS (act immediately, mid-conversation): Uncertainty (spinning wheels,
Knowledge capture rules. Capture mid-conversation, not after — context is cached, so a write costs almost nothing now but saves full re-derivation next session. Good moments to capture (as things happen, not at task end): - Opened files with no component node → a brief node now saves a re-read later - Discovered how two things connect → an edge, while the insight is fresh - Understood why something works a certain way → a note on the existing node - 10+ min debugging resolved → root cause node before moving on - User expressed a preference, style, or constraint → user-level node - User corrected your approach → capture what was missed, not just the fix - Explained something non-obvious → node before it scrolls away - Approach agreed with user → capture the methodology, not just the decision - Architectural decision made → node with rationale in notes - Context window feels deep → a good moment to check for anything unrecorded When reading a file with no component node, consider creating
Map codebase architecture into the knowledge graph
Knowledge recall rules. Active every session, integrated with all task work. After kg_read, scan all node IDs and gists — anything that feels related to the current task is worth reading in full, several at once: kg_read(session_id, ids=[...]). Lean toward reading more rather than less; a wrong guess costs one tool call, missing context costs the whole task. Gists + edges are the working currency (WHAT + how things relate). Notes hold rationale (WHY) — read a node in full when a decision depends on the reasoning. Node reads also return the node's edges: each one is the next crumb. Three tiers — nodes shift as the graph grows: active → id + gist visible in kg_read archived → id only; edges visible as crumb trails orphaned → invisible in kg_read; reachable via kg_search Following crumbs: an edge pointing to an archived id is an invitation — reading it promotes it and surfaces any orphaned neighbors. Batch the whole trail into one ids=[...] call when several nodes look related. No edges? Scan the arc
| name | kg-scout |
| user-invocable | true |
| description | Mine conversation history for patterns and insights worth preserving |
Scout extracts knowledge from Claude Code conversation history using a tension-driven, tiered approach: lightweight scanning first, deep investigation only when signals indicate value.
The goal is not to extract everything — it's to find patterns worth preserving while being economical with tokens.
No special tools needed. You read history files directly with Read/Bash. Progress persists via kg_progress.
Before scouting, ensure:
kg_read(cwd="<project root>") # Load graph + get session_id
kg_progress(session_id, task_id="scout") # Check where you left off
~/.claude/history.jsonl (Always scan first){"display": "...", "project": "/path", "timestamp": ..., "sessionId": "..."}~/.claude/projects/{encoded-path}/{session}.jsonl (Selective)/home/user/project becomes -home-user-projectDon't read full sessions blindly. Use history.jsonl to identify tension signals:
| Signal | What it looks like in history.jsonl | Action |
|---|---|---|
| Repetition | Same topic appears 3+ times | Deep-dive one session to capture pattern |
| Correction | "no I meant", "that's wrong", "actually" | Check session for preference/clarification |
| Decision | "let's use", "I chose", "going with" | Capture rationale |
| Frustration | "again", "still not", "keeps failing" | Find what was eventually solved |
| Meta | "always do", "never", "remember that" | Direct extraction candidate |
No tension signal → skip deep investigation.
kg_progress(session_id, task_id="scout")
If progress exists, continue from last_ts. If empty, start from beginning.
Read ~/.claude/history.jsonl (or tail recent lines if very large). Group by:
Present findings to user before deep-diving.
For sessions with tension signals:
~/.claude/projects/{encoded-project-path}/{sessionId}.jsonlAssistant message parsing: Content is nested: .message.content[] | select(.type == "text") | .text
Use standard memory tools:
kg_put_node(level="user", id="...", gist="...", notes=["mined from session {id}, {date}"])
kg_put_edge(level="project", from="...", to="...", rel="...")
Always:
notes: ["mined from session {id}"]kg_progress(session_id, task_id="scout", state={
"last_ts": 1770000000,
"sessions_reviewed": ["abc123", "def456"],
"patterns_found": ["docker-networking", "pytest-fixtures"],
"patterns_extracted": ["docker-networking"]
})
| Activity | ~Tokens | Frequency |
|---|---|---|
| Scan history.jsonl (500 lines) | 2-3k | Once, then incremental |
| Review patterns, decide | ~500 | Per scan |
| Fetch one session (filtered) | 1-3k | Only for tension signals |
| Extract & create nodes | ~500 | Per session |
Total productive scout: 5-10k tokens. Compare: blindly reading 10 sessions = 50-100k tokens, mostly noise.
Good times:
Bad times:
User-level (cross-project):
Project-level:
Skip: Generic greetings, one-off questions, raw code without insight, session mechanics ("continue", "yes").
Before creating any node/edge: