capn

persistent, self-invalidating discovery memory for coding agents

TLDR

Initialize project memory and agent session-start hooks
$ capn init --git```

**Ask** for a previously charted answer
Chart a hard-won discovery with backing files
$ capn chart "[question]" --files [src/a.ts,src/b.ts] --details "[notes]"
List charted entries or prune stale ones
$ capn prune```

**Remove** one entry or bust all charts for a file
capn bust [path/to/file]```Print the session context note (used by hooks)
$ capn context
# SYNOPSIScapn command [options] [args]# DESCRIPTIONcapn (package capn-hook) gives coding agents disposable, local memory of codebase discoveries. After an expensive search, the agent charts a short question plus the files that answer it. capn ask returns those files (as JSONL) if the chart still matches; if any backing file changed, the entry is deleted automatically before it can mislead.capn init creates .capn/, a QMD search index, and SessionStart hooks for Claude Code and Codex that inject capn context (ask first, chart after hard discoveries). Recall uses semantic hybrid search by default (--no-embedding for BM25-only). The chart is gitignored and local to the working copy.# PARAMETERSinit [--git] [--embedding|--no-embedding]
Create .capn/, index, hooks; optional post-commit prune hook
ask question
Return relevant chart hits after pruning; exit 1 on miss
chart question --files a,b [--details text]
Save a discovery with content hashes of backing files
unchart id / bust path / prune / list
Delete one entry, all entries for a file, all stale entries, or list charts
context
Print the ask-first charting contract for agent hooks
# CAVEATSDefault embedding path downloads models on first use (hundreds of MB to ~2GB). Charts are local and disposable—never a substitute for reading current source. Misses intentionally exit non-zero.# SEE ALSO[rg](/man/rg)(1), [claude](/man/claude)(1)# RESOURCES