Selvedge

Selvedge

Long-term memory for AI-coded codebases that captures the why behind every change

Open Source
4.2 (6 reviews)

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?
Selvedge is a local MCP server that acts as long-term memory for AI-coded projects. When an agent edits a file it records the reasoning behind the change, and that context is stored in a SQLite database inside your repository so it survives after the session ends.
Is Selvedge free?
Yes. It's open source under the MIT license and installs with a single pip command. Everything runs locally, so there's no subscription and nothing to pay for.
How is Selvedge different from git?
Git records that a line changed and who committed it, but rarely why. Selvedge captures the intent behind a change at the moment it's made, from inside the agent's own reasoning, and lets you query it by code entity rather than by line number.
Who is Selvedge for?
Solo developers and small teams building with AI coding agents who want the reasoning behind their code to stick around. It's especially useful on long-lived projects where whoever reads the code later did not write it.

Best For

Preserving the reasoning behind AI-written codeOnboarding to a codebase you did not writeRecalling approaches an agent already tried and revertedAuditing why a specific value or setting changed

Featured in

Alternatives to Selvedge

View all

Reviews (6)

O
Obinna Martin Verified

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.

5/5/2026 15 found this helpful
S
Soren Okafor

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.

5/30/2026 4 found this helpful
K
Kabir Svensson Verified

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.

4/26/2026 4 found this helpful
M
Mateo Han

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.

3/28/2026 4 found this helpful
M
Mateo Davis Verified

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.

3/20/2026 3 found this helpful
E
Emerson Cruz

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.

4/3/2026