{"slug": "show-hn-selvedge-long-term-memory-for-ai-coded-codebases", "title": "Show HN: Selvedge – long-term memory for AI-coded codebases", "summary": "Selvedge, a new open-source tool, provides long-term memory for AI-coded codebases by capturing the reasoning behind code changes made by AI agents like Claude Code, Cursor, and Copilot. It stores the 'why' in a local SQLite file, enabling developers to query past decisions and avoid repeated mistakes. The tool addresses the problem of lost context when AI agents generate code without preserving their rationale.", "body_md": "Captures the why, live\n\nAI agents call Selvedge’s MCP tools while they work — `log_change`\n\nrecords what they\nchanged and **why**, in the same context window that produced the change.\n\nLong-term memory for AI-coded codebases.\n\nA local MCP server. AI coding agents (Claude Code, Cursor, Copilot) call it\nas they work to log the *why* behind every change — captured live,\nin the same context that produced it. Stays in a SQLite file under\n`.selvedge/`\n\nnext to your code.\n\n```\npip install selvedge\n```\n\nSix months ago, your AI agent added a column called `user_tier_v2`\n\n. You don’t know why.\n`git blame`\n\npoints to a commit from `claude-code`\n\nwith a generated message that says\n“Update schema.” The session that made the change is long gone — and so is the prompt\nthat produced it.\n\nWith Selvedge, you run this instead:\n\nThat reasoning was **captured by the agent in the moment** — written into Selvedge from\nthe same context that produced the change. Not inferred from the diff afterward by a\nsecond LLM. Not a hand-typed commit message.\n\nIt also reads back out: Selvedge exports its history as [Agent Trace](/compare/agent-trace/)\nrecords, so the *why* travels into whatever observability or audit tooling already speaks\nthat format.\n\nCaptures the why, live\n\nAI agents call Selvedge’s MCP tools while they work — `log_change`\n\nrecords what they\nchanged and **why**, in the same context window that produced the change.\n\nTracks entities, not lines\n\nAttribution is at the *thing you actually search for*: `users.email`\n\n, `env/STRIPE_SECRET_KEY`\n\n,\n`api/v1/checkout`\n\n, `deps/stripe`\n\n. Prefix queries work everywhere.\n\nStays local, stays simple\n\nZero deps beyond MCP + Click + Rich. SQLite under `.selvedge/`\n\nnext to your code.\nNo accounts, no servers, no telemetry.\n\nAnd it reads back: before editing an entity, your agent calls [ prior_attempts](/prompt-block/)\nto see what was already tried and reverted — active memory, so it doesn’t repeat a mistake the\nteam already undid.\n\nThree commands. The third one is interactive — it detects which AI tools are on your\nmachine (Claude Code, Cursor, Copilot) and wires Selvedge into each one’s config. Every\nmodified file gets a `.bak`\n\nwritten before any change reaches disk.\n\nThat’s it. Open a second terminal and run `selvedge watch`\n\nto live-tail events as your\nagent makes them. Then start asking your codebase questions:\n\n[Full quickstart →](/start/quickstart/) · [CLI reference →](/reference/cli/) · [MCP tool reference →](/reference/mcp-tools/)\n\n`selvedge setup`\n\nalready wires the editors it finds. To add the `selvedge-server`\n\nMCP server to one yourself, every editor below has a step-by-step page:\n\nEach 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.\n\n**Teams running long-term, AI-coded codebases.** When the project is big enough that\nsomeone will touch it again in twelve months, three years — but most of it was written\nby an agent whose context evaporated the day each PR shipped. `git blame`\n\ntells you\n*what* changed. Selvedge tells you *why* — even after the agent session, the prompt,\nthe developer who asked for it, and the model version are all long gone.\n\n**Solo developers using Claude Code on everyday projects.** Side projects, weekend\nbuilds, the small internal tool you keep poking at. You don’t need enterprise governance\n— you just need to remember why you (or your agent) did the thing you did yesterday,\nlast week, last sprint.\n\nIf you’ve ever come back to your own AI-built project and thought “what was this *for*\nagain?”, Selvedge is the missing piece.\n\nAI agents call Selvedge as they work. Selvedge captures the *why* into a durable,\nqueryable store and emits it back out as Agent Trace records, observability metadata,\nand compliance artifacts.\n\nSelvedge does **not** replace `git`\n\n(line-level what/when), PR review tools (review-time\nquality), agent observability (LLM call traces), or general-purpose code-host AI\nfeatures. It sits between them — the provenance-as-first-class-citizen layer that\neverything else references.\n\nSelvedge is open source (MIT) and lives in four directories beyond GitHub.\n\nPyPI\n\n[pypi.org/project/selvedge](https://pypi.org/project/selvedge/) — `pip install selvedge`\n\nSmithery\n\n[smithery.ai/server/masondelan/selvedge](https://smithery.ai/server/masondelan/selvedge) — MCP catalog\n\nGlama\n\n[glama.ai/mcp/servers/masondelan/selvedge](https://glama.ai/mcp/servers/masondelan/selvedge) — MCP directory\n\nmcpservers.org\n\n[mcpservers.org/servers/masondelan/selvedge](https://mcpservers.org/servers/masondelan/selvedge) — MCP directory\n\nGitHub\n\n[github.com/masondelan/selvedge](https://github.com/masondelan/selvedge) — source, issues, releases", "url": "https://wpnews.pro/news/show-hn-selvedge-long-term-memory-for-ai-coded-codebases", "canonical_source": "https://selvedge.sh/", "published_at": "2026-07-10 01:10:57+00:00", "updated_at": "2026-07-10 01:36:55.850614+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "ai-infrastructure"], "entities": ["Selvedge", "Claude Code", "Cursor", "Copilot", "MCP"], "alternates": {"html": "https://wpnews.pro/news/show-hn-selvedge-long-term-memory-for-ai-coded-codebases", "markdown": "https://wpnews.pro/news/show-hn-selvedge-long-term-memory-for-ai-coded-codebases.md", "text": "https://wpnews.pro/news/show-hn-selvedge-long-term-memory-for-ai-coded-codebases.txt", "jsonld": "https://wpnews.pro/news/show-hn-selvedge-long-term-memory-for-ai-coded-codebases.jsonld"}}