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.
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.
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:
- It listens -- picks up decisions, corrections, and preferences from your conversations
- It retrieves -- injects relevant beliefs before the agent responds to each prompt
- 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.
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
- Getting Started: Installation -- Workflow
- Reference: Commands -- Obsidian Integration -- Privacy
- Technical: Architecture -- Benchmarks -- Case Studies
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5998d09721d1c53a5874ee900c55f7b0d17dc65c083aa83602f34456dda153fb
|
|
| MD5 |
25d1c27bdd661921aa6582e069afcb75
|
|
| BLAKE2b-256 |
a00536edd6a2b14958b884707caad491866bb5d8ac1108635dd5e93235212cfa
|
Provenance
The following attestation bundles were made for agentmemory_rrs-3.0.1.tar.gz:
Publisher:
publish.yml on robot-rocket-science/agentmemory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmemory_rrs-3.0.1.tar.gz -
Subject digest:
5998d09721d1c53a5874ee900c55f7b0d17dc65c083aa83602f34456dda153fb - Sigstore transparency entry: 1342719842
- Sigstore integration time:
-
Permalink:
robot-rocket-science/agentmemory@c26328fe127dbcc71f18e5739b691d04528799a3 -
Branch / Tag:
refs/tags/v3.0.1 - Owner: https://github.com/robot-rocket-science
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c26328fe127dbcc71f18e5739b691d04528799a3 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d301939a5df834805ea59643af5ef249bc6d55e75c1ee491acf72e16690a421
|
|
| MD5 |
c9bed337bc76a7d348e900affd336a04
|
|
| BLAKE2b-256 |
a22fefdfb38bc31f192f337f2bbe75fa586bad1022775bebb7437ec398a3ed98
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmemory_rrs-3.0.1-py3-none-any.whl -
Subject digest:
9d301939a5df834805ea59643af5ef249bc6d55e75c1ee491acf72e16690a421 - Sigstore transparency entry: 1342719853
- Sigstore integration time:
-
Permalink:
robot-rocket-science/agentmemory@c26328fe127dbcc71f18e5739b691d04528799a3 -
Branch / Tag:
refs/tags/v3.0.1 - Owner: https://github.com/robot-rocket-science
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c26328fe127dbcc71f18e5739b691d04528799a3 -
Trigger Event:
push
-
Statement type: