# Show HN: Selvedge – long-term memory for AI-coded codebases

> Source: <https://selvedge.sh/>
> Published: 2026-07-10 01:10:57+00:00

Captures the why, live

AI agents call Selvedge’s MCP tools while they work — `log_change`

records what they
changed and **why**, in the same context window that produced the change.

Long-term memory for AI-coded codebases.

A local MCP server. AI coding agents (Claude Code, Cursor, Copilot) call it
as they work to log the *why* behind every change — captured live,
in the same context that produced it. Stays in a SQLite file under
`.selvedge/`

next to your code.

```
pip install selvedge
```

Six months ago, your AI agent added a column called `user_tier_v2`

. You don’t know why.
`git blame`

points to a commit from `claude-code`

with a generated message that says
“Update schema.” The session that made the change is long gone — and so is the prompt
that produced it.

With Selvedge, you run this instead:

That reasoning was **captured by the agent in the moment** — written into Selvedge from
the same context that produced the change. Not inferred from the diff afterward by a
second LLM. Not a hand-typed commit message.

It also reads back out: Selvedge exports its history as [Agent Trace](/compare/agent-trace/)
records, so the *why* travels into whatever observability or audit tooling already speaks
that format.

Captures the why, live

AI agents call Selvedge’s MCP tools while they work — `log_change`

records what they
changed and **why**, in the same context window that produced the change.

Tracks entities, not lines

Attribution is at the *thing you actually search for*: `users.email`

, `env/STRIPE_SECRET_KEY`

,
`api/v1/checkout`

, `deps/stripe`

. Prefix queries work everywhere.

Stays local, stays simple

Zero deps beyond MCP + Click + Rich. SQLite under `.selvedge/`

next to your code.
No accounts, no servers, no telemetry.

And it reads back: before editing an entity, your agent calls [ prior_attempts](/prompt-block/)
to see what was already tried and reverted — active memory, so it doesn’t repeat a mistake the
team already undid.

Three commands. The third one is interactive — it detects which AI tools are on your
machine (Claude Code, Cursor, Copilot) and wires Selvedge into each one’s config. Every
modified file gets a `.bak`

written before any change reaches disk.

That’s it. Open a second terminal and run `selvedge watch`

to live-tail events as your
agent makes them. Then start asking your codebase questions:

[Full quickstart →](/start/quickstart/) · [CLI reference →](/reference/cli/) · [MCP tool reference →](/reference/mcp-tools/)

`selvedge setup`

already wires the editors it finds. To add the `selvedge-server`

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.

**Teams running long-term, AI-coded codebases.** When the project is big enough that
someone will touch it again in twelve months, three years — but most of it was written
by an agent whose context evaporated the day each PR shipped. `git blame`

tells you
*what* changed. Selvedge tells you *why* — even after the agent session, the prompt,
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
builds, the small internal tool you keep poking at. You don’t need enterprise governance
— you just need to remember why you (or your agent) did the thing you did yesterday,
last week, last sprint.

If you’ve ever come back to your own AI-built project and thought “what was this *for*
again?”, Selvedge is the missing piece.

AI agents call Selvedge as they work. Selvedge captures the *why* into a durable,
queryable store and emits it back out as Agent Trace records, observability metadata,
and compliance artifacts.

Selvedge does **not** replace `git`

(line-level what/when), PR review tools (review-time
quality), agent observability (LLM call traces), or general-purpose code-host AI
features. It sits between them — the provenance-as-first-class-citizen layer that
everything else references.

Selvedge is open source (MIT) and lives in four directories beyond GitHub.

PyPI

[pypi.org/project/selvedge](https://pypi.org/project/selvedge/) — `pip install selvedge`

Smithery

[smithery.ai/server/masondelan/selvedge](https://smithery.ai/server/masondelan/selvedge) — MCP catalog

Glama

[glama.ai/mcp/servers/masondelan/selvedge](https://glama.ai/mcp/servers/masondelan/selvedge) — MCP directory

mcpservers.org

[mcpservers.org/servers/masondelan/selvedge](https://mcpservers.org/servers/masondelan/selvedge) — MCP directory

GitHub

[github.com/masondelan/selvedge](https://github.com/masondelan/selvedge) — source, issues, releases
