
Selvedge
Long-term memory for AI-coded codebases that captures the why behind every change
Gallery
About Selvedge
Selvedge is a local Model Context Protocol server that gives an AI-coded project something it usually lacks, a long-term memory. When a coding agent such as Claude Code, Cursor, or Copilot edits a file, Selvedge records not just what changed but the reasoning behind the change, so the thinking behind the code survives long after the chat window has closed. It runs entirely on your own machine and stores everything in a small SQLite database kept in a .selvedge folder inside the repository. There's no account to create and no server to trust, the memory simply lives beside the code it describes.
The problem it goes after is familiar to anyone building with heavy AI assistance. Across a single session an agent makes dozens of small decisions, then that context quietly disappears when the conversation ends. Months later a developer, or a different agent, opens the same file and has no idea why a value was hardcoded, why one approach was dropped in favor of another, or what was already attempted and rolled back. Version control captures that a line changed and who committed it, but it almost never captures the intent. Comments drift out of date, and commit messages compress a whole afternoon of reasoning into a single terse line. The why is the first thing lost and the hardest to reconstruct, because by the time anyone needs it the person or the model that held it has usually moved on to something else.
Selvedge closes that gap by capturing the reasoning while it's still fresh. During a session the agent calls a log_change tool and writes down the intent behind an edit at the moment it makes it, rather than reconstructing a plausible story afterward. Because the note is created inside the agent's own reasoning, it reflects the real decision instead of a tidy summary written for an audience. Each entry ties the rationale to the specific edit it explains, so the record grows naturally as the work happens. Selvedge also writes an automatic .bak backup before a modification lands, which means a risky change can be inspected against its previous state or reverted without digging through history.
Retrieval is organized around the code itself instead of raw line numbers. You can follow an entity such as users.email or env/STRIPE_SECRET_KEY and see every decision that ever touched it, even as the surrounding file is rewritten around it. A handful of focused query tools cover the questions that come up in practice, with a blame view for who changed something and why, a history view for how a piece evolved over time, a changeset view for what moved together in one pass, and a full-text search across the entire log. An agent can even ask what it already tried on a given problem and avoid walking back into a dead end it hit last week.
Because it speaks the Model Context Protocol, Selvedge isn't tied to a single assistant. Any agent that supports MCP can log to it and query it, so a project isn't locked into whichever tool happened to write the code first. The same shared log is readable whether the next session runs in Claude Code, Cursor, or another MCP-aware client, and a human can read it too. That turns the memory into a common surface the whole toolchain writes to, rather than a private cache trapped inside one vendor's context window.
It fits solo builders and small teams who lean on AI agents day to day and want the reasoning to stick around, and it's a natural fit for long-lived codebases where the people reading the code later are rarely the ones who wrote it. What sets Selvedge apart is the timing of the capture. Plenty of tools summarize a diff after the fact or index your files so you can search them, which is useful but always reconstructed. Selvedge records the why at the exact moment the decision is made, from inside the agent's workflow, which is precisely the part that normally evaporates. It's framed for the way AI writes code now, in long autonomous stretches where a human never reviews every step, which is exactly when an unexplained decision is most likely to slip through unnoticed and cause confusion weeks later.
Selvedge is open source under the MIT license and installs with a single pip command, so trying it on one repository costs almost nothing. Everything stays local by design, which keeps the memory next to your code and avoids sending your reasoning or your source to a service you don't control. That posture makes it low-risk to adopt and easy to remove if it doesn't earn its place. For a team that has quietly handed a lot of decisions to AI, it's a way to keep the record those decisions leave behind. Adoption stays incremental, since one agent can start logging on a single repository without changing how anyone else works, and the log keeps its value even if you later switch which assistant you use.
Key Features
- Live reasoning capture during edits
- Local SQLite memory store
- Entity-level change tracking
- Blame, history, and changeset queries
- Full-text search across changes
- Model Context Protocol server
Pros & Cons
What we like
- Captures the why behind changes, not just the diff
- Runs locally with no account or server
- Open source under a permissive MIT license
- Works with any MCP-aware coding agent
Room for improvement
- Agents must actually call the logging tool for value
- Younger project with a smaller community
- Command-line and MCP setup, not a polished UI
- Value builds over time rather than immediately
Frequently Asked Questions
What is Selvedge?
Is Selvedge free?
How is Selvedge different from git?
Who is Selvedge for?
Best For
Featured in
Alternatives to Selvedge
View all1Lookup
Real-time data verification API for phone, email, IP, and domain validation to fight fraud

Codedex
A gamified, story-driven platform that teaches Python, web dev, and more like an RPG quest
Hack2hire
Practice real SDE interview questions from top tech companies with expert worked solutions
Cloudflare Pages
Free Jamstack hosting on Cloudflares edge with unlimited bandwidth and tight integration with Workers.
Reviews (6)
Decent with some rough edges
Selvedge solves a real problem for me without making a fuss about it. Got real value out of captures the why behind changes, not just the diff. The interface stays out of my way, which I appreciate. It would be a five if not for value builds over time rather than immediately. Worth it for what I get out of it.
Genuinely impressed
Three months of Selvedge later, here is what holds up. The open source under a permissive mit license is more useful than I expected. Performance has been steady even when I lean on it hard. Worth it for what I get out of it.
Genuinely impressed
Three months of Selvedge later, here is what holds up. Support actually answered when I had a question, which surprised me. Performance has been steady even when I lean on it hard. Worth it for what I get out of it.
It just works
Started using Selvedge casually, now it is pinned in my dock. Support actually answered when I had a question, which surprised me. It fits well for preserving the reasoning behind ai-written code. No regrets so far.
Two months in, no regrets
Came to Selvedge after getting frustrated with what I had before. Got real value out of runs locally with no account or server. Mostly using it for auditing why a specific value or setting changed. It earns its place in my stack.
Solid daily driver
Found Selvedge on a Show HN thread and I am glad I clicked. Their take on blame, history, and changeset queries is genuinely good. Support actually answered when I had a question, which surprised me. Found it works best for preserving the reasoning behind ai-written code. Hard to imagine going back to my old setup.
