Skip to main content

agent-memory

Notes for a coding agent, kept in the project, still there in the next chat.

You say "don't touch payments" once. Or the test command is py -3. Or yesterday's bug was a stale lock. The next chat in the same repo can search that back. The notes are a file on disk. Nothing is uploaded. There is no account.

Looking for bugs in real use. Unusual cases can still be unstable: a hand-edited notes file, a link where .agent-memory should be, an editor config that isn't plain JSON.

This does not read the repo and decide what to remember. A note exists because memory_save was called. It also does not trim diffs or logs. Different job.

Python 3.9 or newer. No packages required. MIT.

what you get

Four tools. The editor calls them. There is no chat window of ours.

memory_save stores one note and returns its id. A tag is optional, a short word like payments or tests.

memory_search looks for those words in the text and the tag. At most 8 hits, newest first. Words, not embeddings. No model, no vector database.

memory_list returns the latest notes. 20 if you don't pass a limit.

memory_forget deletes one note by id. A missing id is an error the agent can read. The process keeps running.

From a terminal, same store:

py -3 agent_memory.py save "do not touch the payments folder" --tag payments
py -3 agent_memory.py search payments

That session, on this machine:

save, then search payments

The file it wrote:

.agent-memory/notes.jsonl

One JSON object per line. id, text, tag, created. Open it in an editor if you don't trust the tool.

how it stays running

You don't start the server. The editor does, over stdin and stdout, the usual MCP shape. Cursor, VS Code, Claude Code, Claude Desktop, and Codex all talk to the same process. Only the config file is different.

Stdout is JSON only. Debug goes to stderr. The empty lists those editors ask for (prompts/list, resources/list, resources/templates/list) get an empty answer, so they don't mark the server dead. The protocol version the client sent is the one we send back.

Once it's hooked up, the agent is told to save a fact the next chat would otherwise have to hear again, to search before asking the repo the same question twice, and to leave tokens out. You don't paste the warning into every new chat.

The notes for a project live here:

.agent-memory/
  notes.jsonl

setup --write, and the first save, add .agent-memory/ to .gitignore if that line isn't already there. The rest of a gitignore you wrote stays. If you want the notes in git, delete that line yourself.

A save is written to a temp file and renamed into place. A crash mid-write doesn't leave a half line for the next search to choke on.

A path outside the project is an error. So is a link sitting on .agent-memory or on the notes file. One of those pointed at src/ and the next save wrote notes.jsonl in there. The tool does not follow it.

secrets

A note that looks like a secret is refused and not written.

  • a GitHub token, ghp_ or github_pat_, with a real run of characters after it
  • an OpenAI-style key, sk- plus a run of characters that includes a digit. sk-learn and a word like sk-projection are notes
  • a line that looks like a .env assignment of a token, password, or secret (DB_PASSWORD=hunter2, export API_TOKEN=...)

A normal sentence that says the word "password" is fine. "ask-the reviewer" is fine too. The check is the shape of a secret, not the English word. The error that comes back does not repeat the secret.

install

On Windows, python from the store is a stub and sits there doing nothing. Use py -3. If your python actually runs, the snippet on that machine still uses py -3 on purpose.

py -3 -m pip install local-agent-memory
agent-memory --version

PyPI already has another project under agentmemory, so the install name here is local-agent-memory. The command is still agent-memory.

From a checkout of this repo, py -3 -m pip install -e . is the same program. Without installing, py -3 agent_memory.py from this folder works too. The editor config points at that file. If you move the checkout, run setup again.

Tests, if you want them:

py -3 -m unittest discover -s tests

hook it up

Run it from the project. That's the folder that gets the .gitignore line. VS Code and Claude Code also write their config into that folder. Cursor, Claude Desktop, and Codex use the user config instead.

Print the snippet. Nothing is written yet.

py -3 agent_memory.py setup
py -3 agent_memory.py setup vscode
py -3 agent_memory.py setup claude
py -3 agent_memory.py setup claude-desktop
py -3 agent_memory.py setup codex

Merge it into the file the editor already has. Other servers stay. Codex is toml, so --write appends one block and will not add a second one.

py -3 agent_memory.py setup cursor --write
py -3 agent_memory.py setup vscode --write
py -3 agent_memory.py setup claude --write
py -3 agent_memory.py setup claude-desktop --write
py -3 agent_memory.py setup codex --write

Where that goes:

  • Cursor: %USERPROFILE%\.cursor\mcp.json, key mcpServers
  • VS Code: .vscode/mcp.json in this folder, key servers, type stdio
  • Claude Code: .mcp.json in this folder, key mcpServers
  • Claude Desktop: %APPDATA%\Claude\claude_desktop_config.json
  • Codex: %USERPROFILE%\.codex\config.toml, a [mcp_servers.agent-memory] block

Restart the editor after. It does not always pick up a config that's already open. Then the tools show up as memory_save, memory_search, memory_list, memory_forget. If they don't, restart once more. Don't run agent_memory.py mcp yourself unless you're debugging the pipe.

Cursor's snippet looks like this. The path is wherever you left the file.

{
  "mcpServers": {
    "agent-memory": {
      "command": "py",
      "args": ["-3", "W:\\Projects\\agent-memory\\agent_memory.py", "mcp"]
    }
  }
}

limits

One note is cut at 2000 characters. The reply says it was cut.

500 notes in one project, then a new save is refused until you forget one.

Search returns at most 8.

The store is the folder the editor started in, or a folder you passed that is inside it.

not in this version

Pictures, voice, one memory for every project on the machine, search by meaning, a website, an account, sync between computers. Those wait until the four tools are actually getting used.

No network call. Unplugging the cable doesn't change save or search. There is no port to bind.

Metadata

Release files for local-agent-memory 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for local-agent-memory 1.0.2
File Size Uploaded Provenance Actions
local_agent_memory-1.0.2.tar.gz 24.4 kB Without provenance Details for local_agent_memory-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for local-agent-memory 1.0.2
File Interpreter ABI Platform Actions
local_agent_memory-1.0.2-py3-none-any.whl Python 3 none any Details for local_agent_memory-1.0.2-py3-none-any.whl

Total release size: 40.4 kB

Release files / local_agent_memory-1.0.2.tar.gz

Download URL local_agent_memory-1.0.2.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8b045b2d7bff030e8e95bea58bcdc3245a7db8eb40fc594dc694bf3d848eaea7
BLAKE2b-256 checksum
How to use checksums
9fd0a9df8509cd12b4884f06c06a6cc7ba7fb72af8e89672a02835242601a162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / local_agent_memory-1.0.2-py3-none-any.whl

Download URL local_agent_memory-1.0.2-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c4eaf8b00394ce7818e5564fd50e7838de6b3aba0dc0664f4de8e7f18163ca3
BLAKE2b-256 checksum
How to use checksums
6c30d7c7defd29e1228febd50ff7d74e0bc40e2ba4e7b93c011947c436d9a5b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for local-agent-memory 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page