docs

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 grows

Install 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 only

Supported hook events

EventWhat happensCost
sessionStartSave git HEAD as marker. Inject knowledge digest into agent context.Free
postToolUseAppend file change to capture log.<10ms
post-commitMark session as dirty (no extraction yet).Free
stopCollect diff, extract knowledge via LLM, store in pending/.~1 Haiku call

Extraction

At session end, the capture handler:

  1. Collects the full session diff: committed + uncommitted + untracked changes
  2. Reads the capture log (file change events)
  3. Reads existing knowledge index (to avoid duplicates)
  4. Sends everything to a lightweight LLM (Haiku) with a focused extraction prompt
  5. Validates returned items against the knowledge schema
  6. 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
  ✓ Deleted

Comparison: manual vs auto capture

Manual (_capture.md rule)Auto (hooks)
Agent overhead3-5 tool calls per capture0 tool calls
ReliabilityDepends on agent complianceAlways fires (hook-based)
QualitySlightly more detailedHigh signal, slightly less detailed
CostUses main model1 Haiku call (~$0.001)