.pi/agent/skills/context-scan/SKILL.md
Scan recent Claude session logs for missed insights (fallback when Stop hook fails). This skill should be used when the user says "context scan", "scan sessions", "check old sessions", "find missed insights", or wants to recover insights from sessions where the Stop hook did not fire. Also used by hourly cron to automatically sweep for uncaptured knowledge.
npx skillsauth add popoffvg/dotfiles context-scanInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scan recent Claude Code session logs for insights the Stop hook may have missed.
/context scan — last hour
/context scan 3h — last 3 hours
/context scan 1d — last day
Read insights_root from ~/.claude/memory-keeper.local.md YAML frontmatter.
~/.claude/projects/ subdirectories*.jsonl files modified within the time windowsessionId from first record)<insights_root>/.scanned_sessionsFor each unscanned JSONL:
type is "user" or "assistant"message.content string, skip <command, <system, <local prefixesmessage.content array (block.type == "text")For each session, identify distinct topics worth remembering. For each:
insight | agent_edit | task | none~/.claude/projects/<encoded-path>/ last path segmentClassifications:
insight: completed work — how things work, patterns, gotchas, decisionsagent_edit: AI behavior changes — hooks, prompts, skills, plugin configtask: ONLY unstarted intentions (not completed work)none: routine, skip## <Keyword-rich title, 3-7 words> — YYYY-MM-DD HH:MM
<Lead: direct statement of what this is and why it matters. 1-3 sentences.
Include concrete identifiers: file paths, function names, config keys.
No preamble. Write for someone with zero memory of this session.>
### Subsection (only when topic has multiple distinct aspects)
<Details>
Heading = the search key. Must be findable months later:
RocksDB WAL mode: disable for unit test speedDatabase optimization, Fixed performance issueLead = complete picture. Self-contained, no preamble:
RocksDB in WAL journal mode acquires a file lock that prevents parallel test processes from opening the same DB. Disable WAL with \db.pragma("journal_mode = DELETE")` in test setup.`We found that the database was causing issues because...Before saving each entry, read the target file:
Save locations:
insight → <insights_root>/<repo>/insights.md (or _tasks/<slug>/notes.md if active task in _tasks/pending.md)agent_edit → <insights_root>/claude-config/behavior.mdtask → <insights_root>/_tasks/pending.mdAppend each processed session filename to <insights_root>/.scanned_sessions.
Eval checklist:
Test inputs:
Can change: log parsing strategy, time window parsing, insight extraction criteria, deduplication Cannot change: insights_root config requirement, session log location, fallback nature (supplements Stop hook) Min sessions before eval: 5 Runs per experiment: 3
tools
Improve a whole CLAUDE.local.md — the private, per-project rules captured from user corrections. Wraps each conditional rule in a <task-relevant> block so it only surfaces for matching work, merges duplicates, generalizes one-off facts, drops stale entries, and routes raw project facts to engram. Use when the user says "improve claude.local", "clean up the local rules", "claude.local is bloated", or after the Stop hook has appended many rules.
testing
WM pipeline and conventions shared across all phases. Agents must read this before spec, impl, or verify work.
development
One entry point for spec writing, implementation, and bug fixing. Default is new (write spec → grill loop → produce notes → author TODO bodies). Other subcommands: verify (audit), revise (sync to shipped), prototype (settle a decision), code-map (diagram), impl (execute one TODO), fix (analyze cause, correct thoughts, fix behavior), help (this page). Invoke as /code <subcommand>.
development
Red-Green-Refactor cycle for bug fixes. Before fixing a bug, first write a failing test that reproduces it (Red), then make the minimal change to pass (Green), then clean up the code (Refactor). Use on any bug fix, error correction, failing test repair, or when user says "fix this bug".