Agent skill · alirezarezvani
memory-engineering
Use when designing, reviewing, or paying for an agent memory system — adding memory to an agent, choosing between long-context / RAG / graph / agentic memory, auditing what a CLAUDE.md or memory directory actually holds, deciding what to keep and what to expire, or when a memory store keeps growing and nobody has said what leaves it. Prices the write path, picks which cost to pay, classifies records as facts / skills / logs, and refuses a design that has no forgetting policy.
What it needs
About 4k tokens when loaded.
What this skill does
Memory Engineering — engineer the forgetting, not just the remembering Portability: 4 stdlib scripts, no APIs/LLM calls/network. They measure and gate; you decide. What this does Anyone can give an agent memory: vector store, pipe in the history, retrieve top-k. That works until the history outgrows the context window, the write path costs more than every query it serves, and the store fills with stale state nobody removes. Memory is not a bucket — it is a system with a metabolism. The shift: a storer optimizes what a system remembers; a memory engineer optimizes what it forgets. The problem was never that an agent forgets — it is that it never forgets on purpose. The four lenses Lens Question The finding that hurts --- --- --- Stanford What does remembering cost? Construction energy exceeds total query energy across 300 queries. The tuned half is the smaller half. Microsoft What is worth keeping? More raw memory can make an agent worse. Keep facts and skills; drop the events. Anthropic Who controls what it keeps? A wrong memory does not fail once — it persists into every future session that reads it. Nvidia Where does it hit hardware? It is all KV cache in HBM. Construction is prefill-heavy and stalls the query a user is waiting on. Workflow Step 1 reports the construction/query split, cost per correct answer, and amortization — if construction dominates, cut construction tokens before touching retrieval. Step 2 names the cost the winning family makes you pay. Step 3 classifies records FACT / SKILL / LOG / PROSE (LOG-HEAVY = archiving events; PROSE-HEAVY = docs, not memory). Step 4 is the gate: F1 (explicit forgetting rule) and F4 (contradictions surfaced, never auto-merged) are blocking. Retrofitting forgetting onto two years of records is a migration nobody does; auto-merging disagreeing memories destroys the evidence the conflict existed. Step 5 has no script — prove each pass by hand, then automate. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills alirezarezvani/memory-engineering--524614