memory-engineering
O que ela faz
Esta skill ajuda a desenhar a memória de agentes de IA, comparando opções e verificando quanto a memória custa e o que deve manter ou descartar. Ela é para engenheiros que criam agentes que precisam lembrar coisas ao longo do tempo.
Quando usar
- ✓Quando você está adicionando memória a um agente de IA e quer escolher um desenho.
- ✓Quando o armazenamento de memória de um agente não para de crescer e você precisa de regras para expirar itens.
- ✓Quando você quer estimar o custo de um desenho de memória antes de construí-lo.
Link da skill
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/memory-engineering/skills/memory-engineering/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Quero ajuda para decidir o que meu agente deve esquecer, já que a memória dele não para de crescer.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente mede o custo de um desenho de memória, revisa o que vale a pena manter e verifica se existe uma política de esquecimento, usando scripts auxiliares. Os scripts não fazem chamadas de rede nem de modelos.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
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
# 1 - Price it first. Never quote a quality number without a cost number.
python scripts/memory_cost_profiler.py --print-sample-spec > workload.json
python scripts/memory_cost_profiler.py --spec workload.json
# 2 - Pick which cost to pay. No "best" verdict; on a tie it asks, exit 2.
python scripts/memory_architecture_picker.py --constraints workload.json
# 3 - Audit what the store actually holds (skip if greenfield).
python scripts/memory_density_auditor.py --dir ~/.claude/memory
# 4 - Gate on forgetting. Exit 4 is a stop, not a suggestion.
python scripts/forgetting_policy_linter.py --policy design.json
# 5 - No command. Prove each pass by hand before scheduling it.
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. Run it once
against real history and ask whether it changed a decision. If not, scheduling
it only makes noise. Ship order: forgetting_policy_design.md §7.
Hard rules
- Never quote accuracy without cost per correct answer.
- Never return a "best" memory system — name the cost the choice makes you pay.
- Never auto-merge contradictions. The system surfaces; the human decides.
- Never call a design done without a forgetting rule. No evaluated system provides one by default.
- Never schedule a pass not yet run by hand.
- Report findings as findings. A non-zero exit is a result to surface, not an error to swallow.
- Attribute every number with its confidence level. Vendor customer figures are testimonials, not benchmarks.
Scripts
| Script | Role | Exit codes |
|---|---|---|
scripts/memory_cost_profiler.py |
Construction vs query split, cost per correct answer, amortization, co-location warning | 0 · 2 finding · 3 bad input |
scripts/memory_architecture_picker.py |
Scores 4 families, disqualifies, names the cost, refuses to pick on a tie | 0 · 2 ambiguous · 3 bad input · 4 none viable |
scripts/memory_density_auditor.py |
FACT/SKILL/LOG/PROSE, duplicates, staleness, density (--dir or --jsonl) |
0 dense · 2 finding · 3 bad input |
scripts/forgetting_policy_linter.py |
The gate: 8 checks, F1 and F4 blocking | 0 PASS · 2 CONDITIONAL · 4 FAIL |
All support --output json and --sample (no input file needed).
References and assets
references/memory_cost_canon.md— construction dominance, energy per correct answer, the four families, ten recommendations (7 sources)references/what_to_keep.md— PlugM
Perguntas frequentes
Por que um agente deveria esquecer?
Memórias antigas ou erradas podem persistir em sessões futuras e piorar o agente, então esquecer de propósito o mantém confiável.
Ela chama algum modelo de IA?
Não. Os scripts apenas medem e verificam, e as decisões finais são suas.
Quais opções ela compara?
Contexto longo, recuperação com banco vetorial, memória em grafo e memória agêntica.
Detalhes
Descrição original do autor
Use before adding memory to an agent or when a memory store keeps growing (long context vs RAG vs graph vs agentic memory, what to expire). Prices the design with memory_cost_profiler.py and refuses one without a forgetting policy via forgetting_policy_linter.py.
Popularidade
- Estrelas no GitHub
- 29 mil
- Posição no ranking
- #9567
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
agent-launcher-orchestrator
29 milAjuda seu agente a planejar, criar, testar e agendar um agente gerenciado do Claude na sua própria conta, passo a passo, a partir de um objetivo claro.
grade-iterate
29 milPermite que seu agente avalie o trabalho de um agente de IA gerenciado com base em uma rubrica e o melhore em um número fixo de rodadas, para que ele nunca entre em loop infinito.
interview
29 milPermite que seu agente entreviste você sobre uma ideia de agente de IA e transforme suas respostas em um plano de construção simples antes de qualquer lançamento.
run-without-you
29 milAjuda seu agente a configurar um agente gerenciado de IA para rodar em um agendamento ou quando um evento acontecer, com o horário do cron verificado antes do lançamento.
Skills parecidas
add-model-provider
394 milPermite que seu agente conecte um novo provedor de modelos de IA ao OpenClaw com comandos seguros, guarde as chaves de API com segurança e faça um teste ao vivo.
acp-router
394 milAjuda seu agente a enviar uma tarefa a um assistente de programação, como Claude Code ou Cursor, pelo OpenClaw, para que o trabalho rode nessa ferramenta.
browser-automation
394 milEnsina seu agente a controlar páginas web passo a passo, incluindo logins, abas e recuperação quando uma página para de responder.