dev-memory V2 cut startup context 93%
dev-memory gives an AI persistent memory across sessions by teaching it how to use that memory up front. But those teaching instructions are context, and context has a price.
So how big was that price in V1?
738 lines — the author's ~7K tokens — loaded at startup. auto-context.md states it is "included in every session," so that cost was paid before the first user turn.
And that was just the cost to begin.
A fixed ~7K-token bill paid up front is bad enough. Worse, V1's read guidance implied a cost that grew as the memory store grew, so the model didn't just start expensive — it threatened to get worse at scale.
V2's fix came in two moves.
One file, memory-instructions.md, now loads at startup instead of four — the author's ~500 tokens. It states the rules and nothing more.
But shrinking the contract alone doesn't fix growth.
The contract forbids reading memory-store.yaml directly. Instead it delegates to the memory-retrieval sub-agent, which absorbs the full file in its own context and returns only matches (~200 tokens).
That's a context sink — and it changes the math.
The growing memory-store.yaml is only ever read inside the sub-agent's separate context. The main session sees just the 37-line contract — so the growth problem isn't made smaller, it's designed away.
Which lands the payoff.
~7K → ~500 tokens is a ~93% cut. And because the fixed contract is all the main session loads, that cost holds constant as memory scales. Less context loaded, more memory available.
A real, shipped change — here's what carried the win.
Same 3 operations as before: delegate reads, append writes, direct work-log reads. Nothing was removed — the growing cost was just moved into a sub-agent's context. That's the generalizable pattern.
Delegate growth to a sub-agent; keep the main session's cost fixed.
Shipped · v2.0.0
Source repo: ramparte/amplifier-collection-dev-memory (confirmed via git remote -v). HEAD commit 69c3629 "feat: compact context from ~7K to ~500 tokens (v2.0)", 2026-04-13.
Research performed:
git show 0a9529d:behaviors/dev-memory.yaml — 4 context.include filesgit show 0a9529d:context/$f | wc -l — 160 + 89 + 310 + 179 = 738 lineswc -l context/memory-instructions.md — 37 lines (single file)cat context/memory-instructions.md; cat agents/memory-retrieval.mdgrep -rin constant bundle.md — "Constant token usage even with 1000+ memories"git show 69c3629 -- behaviors/dev-memory.yaml — 1.0.0 → 2.0.0git log --format='%an <%ae>' | sort | uniq -cGaps / estimates: The ~7K (V1) and ~500 (V2) token figures are the author's stated estimates from the commit message and behavior description, not independently reproducible token counts; a naive chars/4 estimate gives V1 ~4,300 and V2 ~270 tokens. The ~93% ratio holds under both. The ~200-token per-read figure is stated in the source files, not measured here. The commit rounds the V2 file to "~40 lines"; measured is 37.
Primary contributor: Sam Schillace — sole author (by name) on all 4 commits, including the v2.0 compression commit 69c3629.