reflect
Long-term memory for AI coding agents — correct once, never again.
reflect captures every correction and design decision your AI assistant makes, indexes them into a hybrid GraphRAG + BM25 knowledge base, and auto-recalls the relevant ones at the start of every new session — automatically, before the first token of your prompt is generated.
Works across Claude Code, Codex CLI, and GitHub Copilot — same engine, same KB, three harnesses.
📖 Full documentation: stevengonsalvez.github.io/ainb-reflect-memory. Install per harness (Claude Code, Codex, Copilot, Hermes), architecture, CLI and hook reference, and an interactive memory browser demo.
Why
If you've used AI coding assistants for more than a week, you've corrected the same mistake twice. Maybe ten times. The assistant doesn't remember that:
- Your team uses Bun, not Node, for that one repo
- The Postgres migration in your project must run before the seed
- That third-party library has a footgun you discovered last month
- "When I ask you to delete files, also clean the imports"
The context window forgets the moment the session ends. reflect fixes that by capturing corrections as structured learnings, indexing them into a searchable knowledge base, and recalling the relevant ones at the start of every new session — so a fix you make once is a fix you never have to make again.
Install
The engine lives at the repo root — install it with uv and the [graph] extra (pulls the full GraphRAG + vector stack). reflect embeds on the CPU, so pin the CPU torch build with --torch-backend cpu — it skips ~4GB of CUDA wheels the GPU build would drag in:
uv tool install --upgrade --torch-backend cpu \
'git+https://github.com/stevengonsalvez/ainb-reflect-memory.git[graph]'
Verify with reflect --version.
On a GPU box that wants CUDA torch? Drop --torch-backend cpu (or set it to auto). Everything else is identical.
error: unexpected argument '--torch-backend' (or a bare Usage: line)? Your uv predates the flag (needs ≥ 0.6). Either uv self update, or use the env-var form — same effect:
UV_TORCH_BACKEND=cpu uv tool install --upgrade \
'git+https://github.com/stevengonsalvez/ainb-reflect-memory.git[graph]'
Quickstart
reflect init # one-time: create the KB (honors $GLOBAL_LEARNINGS_PATH)
reflect add ./my-solution.md # capture a learning (optional --entities sidecar)
reflect search "how did we fix the tokio panic" # hybrid GraphRAG + BM25 recall
Memory browser (web UI)
reflect serve launches a local web app to browse, search, graph, and curate your knowledge base — no cloud, no auth, loopback only.
reflect serve # http://127.0.0.1:8377 (KB: $GLOBAL_LEARNINGS_PATH or ~/.learnings)
reflect serve --port 8942 # pick a port
reflect serve --repo /path/to/kb # browse a specific KB
Open the printed URL in a browser on the same machine. Curation is live and edits your local markdown (soft archive/restore, confidence edits, compression queueing); run reflect reindex afterward to refresh semantic search. Loopback only — there is no authentication, so do not bind a public interface. To reach it across your tailnet, front it with tailscale serve --bg --https 8942 http://127.0.0.1:8942.

Full guide: docs/reflect-serve.md.
Plugin (Claude Code)
The plugin (hooks + skills) that wires reflect into your agent harness lives under plugin/. Install it from this repo's marketplace:
claude plugin marketplace add stevengonsalvez/ainb-reflect-memory
claude plugin install reflect@ainb-reflect-memory
See plugin/README.md for the lifecycle hooks, sub-skills, and the Codex / Copilot adapters. (ainb reflect bootstrap installs the engine + prints system-tool steps in one shot.)
How it works
reflect runs a capture → index → recall loop: