Save an AI coding agent's hard won discovery about where code lives so future sessions can recall it instantly.
Cut down repeated token heavy codebase exploration across coding agent sessions.
Automatically invalidate saved answers the moment their backing files change or disappear.
| cyrusnuevodia/capn-hook | fayazara/pdfstudio | pablogdcr/daily-crumple | |
|---|---|---|---|
| Stars | 88 | 89 | 87 |
| Language | TypeScript | TypeScript | TypeScript |
| Setup difficulty | — | easy | moderate |
| Complexity | — | 2/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
cap'n hook, usually called capn, gives AI coding agents like Claude Code or Codex a kind of persistent memory about a codebase. Normally, when an AI assistant spends time figuring out where something lives in a project, such as which file handles payment webhooks, that knowledge disappears once the session ends. The next time someone asks a similar question, the agent has to search the whole codebase again from scratch. Capn saves that hard won answer so it can be recalled instantly instead. The tool works through a simple three step loop. Before searching, the agent asks capn a question in plain language, and if a matching saved answer exists, capn returns the exact files that answer it right away. If there is no match, the agent explores the codebase as usual and then saves what it learned, listing the specific files involved and any helpful notes, such as a line number or a tricky detail. Each saved file is fingerprinted using a hash, so capn can tell later if that file has changed. This is the key trick behind the memory staying trustworthy: if a file backing a saved answer ever changes or is deleted, that answer is automatically deleted too, rather than being edited or left stale. So an agent either gets a valid, still true answer, or it gets nothing and falls back to exploring again, which is exactly what would have happened without the tool. According to the project's own testing across sixty real developer questions on five existing open source codebases, using capn's saved answers cut token usage by about seventy seven percent compared to searching cold, with every answer still correct. Setup is done through a command line tool installed with npm or Bun. Running one setup command adds a hook that tells the coding agent, at the start of every session, to check capn before searching and to save discoveries afterward. Saved answers are stored as small local markdown files that a person can also open and read directly, and the whole memory folder is excluded from version control by default, so it stays local to each developer's own working copy.
cap'n hook gives coding agents like Claude Code persistent memory of where things live in a codebase, saving discoveries as hash verified answers that self delete when the underlying files change.
Mainly TypeScript. The stack also includes TypeScript, Node.js, Bun.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.