Your coding agent forgets everything between sessions
Why MCP needs a context layer, not another connector.
Every Monday morning I open my editor, start a coding agent, and watch it discover the same repository for the twentieth time.
It lists files. It greps for a function. It reads three whole files to find thirty relevant lines. Then I explain — again — why the auth layer works the way it does, which command actually runs the tests, and why we don't touch that one module.
The agent is not the problem. The interface is. MCP gave agents hands: filesystem, GitHub, browser, databases. It did not give them memory, and it did not teach them to read less.
The missing layer
The MCP ecosystem is no longer small. The official registry lists roughly 47,000 active servers; the TypeScript and Python SDKs see hundreds of millions of downloads a month. Most of that supply is connectors — a tool for every API.
Connectors answer "can the agent access this system?" They do not answer:
What does this project already know? Which 30 lines answer this question? What did we decide last week, and why? What should the next session pick up?
That is a different layer. I built ctxkeeper for it.
Two primitives: brief and pack
project_brief is the first call of a session. It returns a token-budgeted summary: stack, run/test commands, files to read first, git state, open TODOs, decisions, gotchas, recent work, and structure. One call replaces the exploratory phase.
context_pack is the call before a focused change. You give it a concrete question — "where is the OAuth token refreshed?" — and it returns only the relevant code windows, with path:line citations, plus any matching project memories. The output has a token budget.
Around those two, there is durable memory: remember, recall, todo, log_work, forget. Decisions and gotchas stop living in yesterday's chat.
Design choices worth arguing about
Append-only JSONL, not SQLite. Every write is an event (memory.add, todo.set, worklog.add). Reads replay the log. There are no native build steps, a crash is unlikely to corrupt the store, multiple clients can append without overwriting each other, and archiving is reversible. The cost is that the log will eventually need compaction.
Memory as a retrieval bridge. A Chinese question rarely appears verbatim in English code. Matching memories contribute file paths and identifiers such as refreshToken as extra search terms, which are then used to locate the code window. It is a small trick that makes cross-language retrieval work without embeddings.
Never truncate a code block mid-line. Each file gets a share of the budget. If the block does not fit, use the single best window; if that still does not fit, skip the file and say so. Half a function is worse than no function.
Read-only by construction. No arbitrary shell. The only subprocess is fixed-argument git. Sensitive files are excluded from search, and high-confidence credential shapes are redacted from output. The store is still plain text, so the README says plainly: do not save secrets.
Lexical retrieval in v0.1. No vector database, no embedding API. This is a deliberate trade-off: zero install friction and full offline operation, at the cost of missing paraphrases. The roadmap is an optional local embedding backend with lexical fallback, not a replacement.
What I measured
On the project itself — 17 source files, ~2.9k LOC, Windows 11, Node 22.23:
project_brief(cache hit): ~10 ms, 0.5–1.2k tokenscontext_pack: ~8–10 ms, ~1.0k tokens, 2–4 cited windows- Reading
src/store.tsdirectly: ~3.5–4k tokens
This is a pipeline check on a small repo, not a benchmark. The gap grows with file size, which is the point: the pack returns the lines around the answer, not the 430-line file.
What is still missing
- Retrieval is lexical. Paraphrases can miss.
- Scans are capped at 6,000 files / 24 MB.
- The event log does not compact itself yet.
- No team sync, encryption, or permissions.
- Memory quality depends on write quality: short titles, concrete content, file paths.
The repo has 11 end-to-end tests over real stdio, CI on Node 20 and 22, and an MIT license. If the problem resonates, try it on one repository for a week and tell me what broke.
Try it: clone the repo or point your MCP client at npx -y github:Coisini-cyber/ctxkeeper-mcp.