Is your coding agent reading the memory you wrote?

●1 ●6 ●17
calendar_today • schedule4 min read

I maintain Selvedge. This article was prepared with AI assistance and checked against the released Selvedge v0.3.17 package from PyPI (tag v0.3.17, commit 3b67b8f) and the repository's main branch at commit 66c51d3.

I saved one decision, read it back six ways, and got nothing from two of them. The record never moved. The reads that missed it had opened a different, empty database.

This is a reproduction, not an incident report. I installed Selvedge v0.3.17 from PyPI in a fresh virtual environment, pointed HOME at a throwaway directory, and logged one invented decision from a project root:

selvedge init
selvedge log src/billing/charge.py::retry_charge reject \
  --reasoning "Rejected automatic retries inside retry_charge; went with a single attempt plus an idempotency key, because a retry after a timeout can charge a customer twice." \
  --constraint "A payment request must never be submitted twice for one order." \
  --stale-when "the payment provider offers server-side idempotent retries" \
  --agent synthetic-demo

(--agent only sets an attribution label.) Then I asked for that record from different places.

One record, six reads

From src/billing, a subdirectory of the project, selvedge prior-attempts src/billing/charge.py::retry_charge --json returned the record.

From an unrelated directory, the same lookup (without --json) printed "No prior attempts found" and exited 0. By the end of the run, the throwaway home directory held a new per-user database with zero events.

From that same unrelated directory with SELVEDGE_DB=/path/to/demo-app/.selvedge/selvedge.db set, the command returned the record with the same ID.

With the same variable set, the Python package returned the same ID:

from selvedge import SelvedgeStorage, get_db_path

store = SelvedgeStorage(get_db_path(read_only=True))
blame = store.get_blame("src/billing/charge.py::retry_charge")
print(blame["id"] if blame else "not found in this store")

Finally, a small test script started selvedge-server over stdio and called its prior_attempts tool. With SELVEDGE_DB set, it returned the same ID. Without it, from the unrelated directory, it returned an empty list.

Every read that found the database returned one ID. The two misses weren't missing data; they were the wrong file.

Why the empty answer happened

Selvedge stores decisions in local SQLite. In v0.3.17, the CLI and the MCP server both find that database with get_db_path, which the package also exports. It checks three places, in order:

  1. the SELVEDGE_DB environment variable;
  2. an existing .selvedge/selvedge.db file, searched for upward from the current directory;
  3. the per-user fallback ~/.selvedge/selvedge.db.

The subdirectory read found the project file by searching upward. The unrelated directory had no project file above it, so the read fell through to the per-user path.

The tool didn't hide this. A normal lookup that falls back writes a warning to stderr, once per process, unless SELVEDGE_QUIET is set. Both the CLI miss and the MCP miss printed it. On its own, get_db_path(read_only=True) stays silent and creates nothing. But opening that path with SelvedgeStorage, as the snippet above does, still creates the per-user directory and an empty database, with no warning. In a fresh home directory without SELVEDGE_DB, the snippet printed "not found in this store". selvedge doctor reports the resolved path and which step matched: "via walked up from CWD to project .selvedge/" from the project root, and "via global fallback (~/.selvedge/)" with status WARN from the unrelated directory. That doctor run still exited 0, so a script that checks only exit codes won't notice.

An MCP server makes this easier to miss. A client starts the server with whatever working directory and environment the client chooses, and whether you see the server's stderr depends on the client. The README says to set SELVEDGE_DB in the server configuration when the client starts outside your project.

Checking your own setup, with or without Selvedge

None of this is specific to one tool. Any file-based memory, whether a decisions folder, a JSON file or a SQLite database, is located by each process for itself. So, before trusting an empty answer, find out how your tool picks its file. Usually it's some mix of explicit path, project discovery and a per-user default.

Then ask the question from where the reader actually runs. A check in your terminal describes your terminal, not an agent client or a CI job with its own directory and environment. For processes you don't launch yourself, set the path explicitly rather than relying on discovery.

When a lookup comes back empty, read it as "nothing in this store," not "nothing was ever decided." And once, after any change to clients or configuration, write a test record through one route and read it through the others, comparing IDs rather than text. Matching text could be a copy; a matching ID means the same record.

What's on main, and not released

PR #76, merged into main as commit 66c51d3 on October 17, 2026 (PT), reworks Selvedge's architecture plan. It describes MCP as "one route to the core, not a prerequisite for using it," and plans a small local core shared by the library, CLI, MCP and optional integrations. The PR also adds a regression check that saves and retrieves a record across isolated Python processes, and rewords the bundled prompt to present CLI and MCP as routes to the same store.

None of this is in v0.3.17, and the architecture document says the phases add no release dates. It notes that the current package still installs MCP dependencies, and that making them optional needs a separate compatibility assessment. It lists compact review presentation, native GitHub validation and an editor integration as future work.

What this run doesn't show

  • It's synthetic: one invented record, one machine, Python 3.13 and a throwaway home directory. The CLI's PyPI update check was turned off, and telemetry was never enabled.
  • No agent client was tested. The MCP route used a test script built on the mcp Python client, so check your own client's configuration, launch directory and activation separately.
  • Selvedge stores what a person or agent explicitly saves. It doesn't verify that the reasoning is true, and it doesn't guarantee that an agent will consult it.
  • Pinning the path makes routes agree on a file. It doesn't create records nobody saved.

Want more #ai & #opensource deep dives?

Join 6,098+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

1 Comment

0 votes

More Posts

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Your AI Doesn't Just Write Tests. It Runs Them Too.

Kevin Martinez - May 12

MCP Is the USB-C of AI. So Why Are You Plugging Everything In?

Ken W. Algerverified - Jun 10

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17
chevron_left
1.1k Points • 24 Badges
Southern California, USA • linkedin.com/in/masondelan
9Posts
1Comments
4Connections
Applied Data Science M.S. | Statistics & Data Science B.S.

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!