Long-term memory for AI-coded codebases. | selvedge<br>Skip to content selvedge
Long-term memory for AI-coded codebases.
A local MCP server. AI coding agents (Claude Code, Cursor, Copilot) call it<br>as they work to log the why behind every change — captured live,<br>in the same context that produced it. Stays in a SQLite file under<br>.selvedge/ next to your code.
pip install selvedge<br>Quickstart GitHub Why Selvedge?
The problem<br>Section titled “The problem”
Six months ago, your AI agent added a column called user_tier_v2. You don’t know why.<br>git blame points to a commit from claude-code with a generated message that says<br>“Update schema.” The session that made the change is long gone — and so is the prompt<br>that produced it.
With Selvedge, you run this instead:
selvedge blame payments.amount surfaces the reasoning the agent<br>recorded for a change — the why, captured live, right in the terminal.
That reasoning was captured by the agent in the moment — written into Selvedge from<br>the same context that produced the change. Not inferred from the diff afterward by a<br>second LLM. Not a hand-typed commit message.
It also reads back out: Selvedge exports its history as Agent Trace<br>records, so the why travels into whatever observability or audit tooling already speaks<br>that format.
What Selvedge does, in three lines<br>Section titled “What Selvedge does, in three lines”
Captures the why, live<br>AI agents call Selvedge’s MCP tools while they work — log_change records what they<br>changed and why , in the same context window that produced the change.
Tracks entities, not lines<br>Attribution is at the thing you actually search for: users.email, env/STRIPE_SECRET_KEY,<br>api/v1/checkout, deps/stripe. Prefix queries work everywhere.
Stays local, stays simple<br>Zero deps beyond MCP + Click + Rich. SQLite under .selvedge/ next to your code.<br>No accounts, no servers, no telemetry.
And it reads back: before editing an entity, your agent calls prior_attempts<br>to see what was already tried and reverted — active memory, so it doesn’t repeat a mistake the<br>team already undid.
Quickstart<br>Section titled “Quickstart”
Three commands. The third one is interactive — it detects which AI tools are on your<br>machine (Claude Code, Cursor, Copilot) and wires Selvedge into each one’s config. Every<br>modified file gets a .bak written before any change reaches disk.
Terminal windowpip install selvedge
cd your-project
selvedge setup
That’s it. Open a second terminal and run selvedge watch to live-tail events as your<br>agent makes them. Then start asking your codebase questions:
Terminal windowselvedge blame payments.amount # what changed last and why
selvedge history --entity users --since 30d # all changes to users in 30 days
selvedge changeset add-stripe-billing # all events for a feature
selvedge search "stripe" # full-text search
Full quickstart → · CLI reference → · MCP tool reference →
Add it to your editor<br>Section titled “Add it to your editor”
selvedge setup already wires the editors it finds. To add the selvedge-server<br>MCP server to one yourself, every editor below has a step-by-step page:
Each page’s config runs the server with uvx, so it works without a global install — just have uv on your machine. Prefer pip? pip install selvedge and point your editor at the selvedge-server command.
Cursor Paste the MCP config, or run selvedge setup.<br>VS Code A .vscode/mcp.json block.<br>Claude Code claude mcp add, or the plugin marketplace.<br>Cline The autonomous VS Code agent.<br>Windsurf Cascade MCP config.<br>Continue config.yaml mcpServers block.
Who it’s for<br>Section titled “Who it’s for”
Teams running long-term, AI-coded codebases. When the project is big enough that<br>someone will touch it again in twelve months, three years — but most of it was written<br>by an agent whose context evaporated the day each PR shipped. git blame tells you<br>what changed. Selvedge tells you why — even after the agent session, the prompt,<br>the developer who asked for it, and the model version are all long gone.
Solo developers using Claude Code on everyday projects. Side projects, weekend<br>builds, the small internal tool you keep poking at. You don’t need enterprise governance<br>— you just need to remember why you (or your agent) did the thing you did yesterday,<br>last week, last sprint.
If you’ve ever come back to your own AI-built project and thought “what was this for<br>again?”, Selvedge is the missing piece.
Where Selvedge fits<br>Section titled “Where Selvedge fits”
AI agents call Selvedge as they work. Selvedge captures the why into a durable,<br>queryable store and emits it back out as Agent Trace records, observability metadata,<br>and compliance artifacts.
Selvedge does not replace git (line-level what/when), PR review tools (review-time<br>quality), agent observability (LLM call traces), or general-purpose code-host AI<br>features. It sits between them — the provenance-as-first-class-citizen layer that<br>everything else references.
See the comparison table →
Listings<br>Section titled...