Skip to main content

Persistent memory for AI coding agents. Correct once, remembered forever. Every design decision validated by experiment before shipping to production.

Project description

agentmemory

Correct your AI agent once. It remembers forever.

License: MIT PyPI Python 3.12+


You tell your AI agent "use uv, not pip." It says "got it." Next session, it reaches for pip. You correct it again. And again. And again.

agentmemory makes the next correction your last. It captures what matters from your conversations -- corrections, decisions, preferences -- stores them locally, and injects them into every future session. Silently. Automatically. You stop repeating yourself.

pip install agentmemory-rrs
agentmemory setup

Restart Claude Code. In any project: /mem:onboard .

That's it. Three commands. Your agent now remembers permanently.

Comic: user says 'no implementation, we're in research.' Agent says 'got it!' Next session: 'Ready to implement?' User: 'I TOLD YOU. TWICE.' Agent: '...three times, actually!'


What It Actually Does

Here's a real example. You type push the release to github. Before the agent sees your message, agentmemory's hook fires and runs a 7-layer search in ~50ms:

Layer 0: Structural analysis    -> task type: deployment, target: github
Layer 1: FTS5 full-text search  -> 4 hits (publish script, CI checks, remote config)
Layer 2: Entity expansion       -> "github" links to 3 beliefs about repo setup
Layer 3: Action-context         -> "push to github" triggers activation condition
Layer 4: Supersession check     -> old remote URL excluded (superseded)
Layer 5: Recent observations    -> correction from 2 days ago about publish script
Layer 6: Cross-project scopes   -> checks shared infra beliefs

The agent receives this context injection alongside your message:

== OPERATIONAL STATE ==
[!] GitHub account renamed (changed 2d ago)

== STANDING CONSTRAINTS ==
- NEVER use git push github directly. Use scripts/publish-to-github.sh
- Pre-push hook scans for PII; direct push bypasses safety checks
- To release with tag: bash scripts/publish-to-github.sh --tag vX.Y.Z

== BACKGROUND ==
- Remote 'github' points to git@github.com:robot-rocket-science/agentmemory.git

Without agentmemory, the agent runs git push github main and bypasses every safety check. With it, the agent already knows. You said nothing.


What It Remembers

You say It stores
"Use uv, not pip" Permanent rule. Injected every session.
"The endpoint moved to /v2" Correction. Replaces the old belief.
"I prefer terse commits" Preference. Shapes behavior silently.

Beliefs accumulate over time. Each one carries a Bayesian confidence score that strengthens when the belief proves useful and fades when it doesn't. After a few weeks:

/mem:stats
Beliefs: 312 (18 locked, 294 learned)
Sessions: 47
Corrections surfaced this session: 3
Last locked: "never commit .env files" (4 weeks ago)

Your Data Stays Yours

  • 100% local. SQLite on your machine. No network calls in the retrieval pipeline.
  • No cloud, no accounts. No server, no signup, no telemetry by default.
  • No GPU or vector database. Runs on any machine that runs Python.

What Happens After Install

You don't need to learn commands. agentmemory works in the background:

  1. It listens -- picks up decisions, corrections, and preferences from your conversations
  2. It retrieves -- injects relevant beliefs before the agent responds to each prompt
  3. It learns -- beliefs that help get stronger; beliefs that don't, fade

To explicitly lock a permanent rule:

/mem:lock "always use uv, never poetry"

For deeper exploration:

Command What it does
/mem:search <query> Find specific memories
/mem:lock <rule> Create a permanent rule
/mem:wonder <topic> Deep parallel research across the memory graph
/mem:reason <question> Test a hypothesis against stored evidence
/mem:stats See what's in memory

Full command reference: docs/COMMANDS.md.


Emergent Behavior

These weren't planned features. They emerged from persistent memory + reasoning tools.

The agent audited its own memory and found a bug

user    Clean up the config file, I think agentmemory handles this now.

agent   [searches memory, compares against config]
        Found 2 redundant items. But also: this locked belief about
        your server setup is stale -- it references infrastructure
        you removed. Every session is getting incorrect instructions.

user    Fix it.

agent   [corrects the belief, supersedes the old one]
        Done. Want to lock the updated version?

The system caught its own error because it had enough accumulated context to notice the inconsistency. More examples and a full session transcript showing wonder + reason in action.


Under the Hood

Conversations are broken into individual beliefs stored in a local SQLite database. Retrieval uses full-text search, graph traversal, and vocabulary bridging -- no embeddings, no vector database, no external API calls.

98 experiments drove every design decision. 954 tests. 5 academic benchmarks. Architecture details: docs/ARCHITECTURE.md.

Knowledge graph visualization showing thousands of interconnected beliefs built up over weeks of use

The knowledge graph after a few weeks of daily use. Each dot is a belief. Lines are relationships (supports, contradicts, supersedes).


Compatibility

Currently supports Claude Code via MCP (Model Context Protocol). The architecture is agent-agnostic -- any MCP-compatible client can use agentmemory as a memory backend.


Documentation

Development

git clone https://github.com/robot-rocket-science/agentmemory.git
cd agentmemory
uv sync --all-groups
uv run pytest tests/ -x -q

Contributions welcome. See CONTRIBUTING.md.

Citation

@software{agentmemory2026,
  author    = {robotrocketscience},
  title     = {agentmemory: Persistent Memory for AI Coding Agents},
  year      = {2026},
  url       = {https://github.com/robot-rocket-science/agentmemory},
  license   = {MIT}
}

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentmemory_rrs-3.0.1.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentmemory_rrs-3.0.1-py3-none-any.whl (201.0 kB view details)

Uploaded Python 3

File details

Details for the file agentmemory_rrs-3.0.1.tar.gz.

File metadata

  • Download URL: agentmemory_rrs-3.0.1.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentmemory_rrs-3.0.1.tar.gz
Algorithm Hash digest
SHA256 5998d09721d1c53a5874ee900c55f7b0d17dc65c083aa83602f34456dda153fb
MD5 25d1c27bdd661921aa6582e069afcb75
BLAKE2b-256 a00536edd6a2b14958b884707caad491866bb5d8ac1108635dd5e93235212cfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmemory_rrs-3.0.1.tar.gz:

Publisher: publish.yml on robot-rocket-science/agentmemory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentmemory_rrs-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: agentmemory_rrs-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 201.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentmemory_rrs-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d301939a5df834805ea59643af5ef249bc6d55e75c1ee491acf72e16690a421
MD5 c9bed337bc76a7d348e900affd336a04
BLAKE2b-256 a22fefdfb38bc31f192f337f2bbe75fa586bad1022775bebb7437ec398a3ed98

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmemory_rrs-3.0.1-py3-none-any.whl:

Publisher: publish.yml on robot-rocket-science/agentmemory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page