convez.ai
SkillAutomaçãoIntermediário
adedayoagarau

Agent Memory

adedayoagarau/agent_memory

Memória durável em disco para agentes Claude com markdown local

Ver no GitHub
InicialPluginScore · de 0 a 100

Camada de memória persistente baseada em arquivos para agentes Claude, usando markdown armazenado localmente. Implementa visualização, criação, edição e limpeza de memórias sem necessidade de banco de dados vetorial ou embeddings.

Instalação

$npx convez-ai adedayoagarau/agent_memory

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
1
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 7 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Agentes que precisam lembrar contexto entre sessões
  • Assistentes com histórico de preferências e fatos do usuário
  • Automação que mantém estado persistente sem infraestrutura complexa

Veredito

Solução prática e minimalista para persistência de memória em agentes Claude. Bem testada (22/22 testes unitários) com segurança contra path traversal, ideal para quem quer evitar overhead de vetores ou bancos de dados.

README

A tradução para o português deste README ainda está na fila.

agent-memory-demo

A minimal, file-backed memory layer for a Claude-powered agent, built per the technical article. No vector DB, no embeddings — just markdown files on disk managed through Anthropic's beta memory tool.

Files

  • memory_backend.py — LocalFilesystemMemoryTool, a subclass of BetaAbstractMemoryTool that implements view/create/str_replace/insert/ delete/rename against ./memory/memories, with path-traversal guards.
  • system_prompt.py — persona + memory operating rules (what to store, when to read, when to supersede).
  • agent.py — terminal chat loop using client.beta.messages.tool_runner. Commands: /quit, /memory_view, /memory_clear.
  • memory_defrag.py — librarian pass that audits /memories for stale or contradictory files and deletes them.
  • test_backend.py — 22 unit tests exercising every backend command plus path-traversal and root-deletion guards. No API calls.
  • test_persistence.py — simulates two sessions hitting the same memory root and verifies files (including a superseded fact) survive across a fresh backend instance. No API calls.
  • test_live.py — full end-to-end run: session 1 gives the agent durable facts, session 2 starts with a fresh message list and asks questions only answerable from memory. Requires ANTHROPIC_API_KEY.

Setup

pip install "anthropic>=0.87.0"
export ANTHROPIC_API_KEY="sk-ant-..."

Run the agent

python agent.py

Then try a session like:

You: Hi, I'm Adedayo, a content designer. Please keep replies short.
You: My active project is memory-layer-guide.
You: /quit

Restart, and:

You: What do you remember about me?

The agent should view /memories before replying and surface your name, role, preferences, and active project.

Run the tests

python test_backend.py       # 22 unit tests, no API needed
python test_persistence.py   # 2-session simulation, no API needed
python test_live.py          # full live test, requires ANTHROPIC_API_KEY

Test results from this build

  • test_backend.py: 22/22 PASS
  • test_persistence.py: 7/7 PASS (file layout, nested dirs, superseding an older fact, cross-session reads)
  • test_live.py: not executed in the build environment because this sandbox has no ANTHROPIC_API_KEY and the Messages API rejects OAuth tokens. Run it locally to verify end-to-end.

Notes

  • The memory tool is part of Anthropic's context-management-2025-06-27 beta. If the beta header or tool type changes, update agent.py and memory_defrag.py accordingly.
  • LocalFilesystemMemoryTool._validate_path is the security boundary. Every test that matters (traversal with .., paths outside /memories, deleting the root) is in test_backend.py.
  • Stale memory is worse than missing memory. Run memory_defrag.py periodically, or schedule it.
Ver o original no GitHub

Bom para

Relacionados