Auto Capture
Zero-overhead knowledge extraction from every agent session.
How it works
Capture hooks integrate with your AI agent's lifecycle. No extra tool calls, no agent overhead — knowledge extraction happens externally.
Session start → marker saved, knowledge digest injected
↓
During work → file changes logged (<10ms per event)
↓
Session end → diff collected → LLM extracts knowledge → pending/
↓
Human review → accept or reject → knowledge growsInstall hooks
agents hooks install # all detected platforms
agents hooks install --agent claude # Claude Code only
agents hooks install --agent cursor # Cursor only
agents hooks install --agent git # git post-commit onlySupported hook events
| Event | What happens | Cost |
|---|---|---|
sessionStart | Save git HEAD as marker. Inject knowledge digest into agent context. | Free |
postToolUse | Append file change to capture log. | <10ms |
post-commit | Mark session as dirty (no extraction yet). | Free |
stop | Collect diff, extract knowledge via LLM, store in pending/. | ~1 Haiku call |
Extraction
At session end, the capture handler:
- Collects the full session diff: committed + uncommitted + untracked changes
- Reads the capture log (file change events)
- Reads existing knowledge index (to avoid duplicates)
- Sends everything to a lightweight LLM (Haiku) with a focused extraction prompt
- Validates returned items against the knowledge schema
- Stores valid items in
knowledge/pending/
Quality gate
The extraction prompt has strict criteria. An item is only extracted when:
- A new developer would benefit from knowing it
- It cannot be derived by reading current code alone
- It's not already in the knowledge index
- It represents a decision with rejected alternatives, non-obvious convention, surprising bug, or reusable pattern
Review workflow
$ agents capture list
[pending] lesson/invisible-runtime-failure
"detect_runtimes returns empty list instead of error on missing config"
[pending] pattern/error-isolation-boundary
"Each operation catches independently, never propagates to caller"
$ agents capture accept invisible-runtime-failure
✓ Moved to knowledge/lessons/
$ agents capture reject error-isolation-boundary
✓ DeletedComparison: manual vs auto capture
| Manual (_capture.md rule) | Auto (hooks) | |
|---|---|---|
| Agent overhead | 3-5 tool calls per capture | 0 tool calls |
| Reliability | Depends on agent compliance | Always fires (hook-based) |
| Quality | Slightly more detailed | High signal, slightly less detailed |
| Cost | Uses main model | 1 Haiku call (~$0.001) |