Skip to main content

Memory you can verify — a trust layer between an AI coding agent and its own past: per-hit staleness verdicts, claim-level use attribution, measured effectiveness, episodic run-state. MCP-native, local-first, MIT, no cloud.

Project description

bettermemory: memory that is checked before it is believed

PyPI CI Python 3.11-3.14 MIT

Claude forgets you. Every session starts from zero: the stack you explained yesterday, the deploy quirk you debugged last week, the "we use uv, not pip" you have now said eleven times.

bettermemory gives Claude Code — or any MCP client — memory that survives the session and distrusts itself on your behalf. Every stored fact is a claim that has to keep earning belief: checked against the filesystem and git before the model relies on it, tracked when it shapes an answer, curated when the evidence says it rotted. You operate none of it. The agent does.

Install

Paste this into your agent:

Install bettermemory as my memory server: read https://github.com/0Mattias/bettermemory and follow the "For agents" section of the README.

That's the whole install. Prefer to do it yourself? Two commands:

uv tool install bettermemory
bettermemory init --client claude-code   # or claude-desktop / cursor / continue / cline

Restart the client and you're done. Want proof before wiring anything up? uvx bettermemory try runs a 60-second offline demo in a throwaway store: it writes a memory citing a file, deletes the file, and shows the next search flag the memory as stale.

What that feels like

Three weeks ago, mid-session:

> for the record: staging deploys go through Fly now, the Render
  setup is dead

⏺ Stored: "Staging deploys via fly deploy --config fly.staging.toml;
  the old Render service is decommissioned." (projects:acme)

Today, brand-new session, no context given:

> staging is 404ing after every deploy. ideas?

⏺ You have a stored note that staging deploys through Fly and Render
  is gone — last verified 3 weeks and 41 commits ago, so checking it
  before relying on it… fly.staging.toml still exists, but its
  internal_port changed on Monday. That's the 404: the app listens
  on 8080, the config still says 3000.

> fix it

⏺ Fixed. Re-verified the memory too, so the next session inherits it
  fresh instead of re-checking.

(Illustrative transcript.) Two things happened that a raw session cannot do: it remembered across a three-week gap, and it distrusted itself exactly enough to catch that the world had moved since.

Why this one

  • It knows when it might be wrong. Every hit carries a staleness verdict built from calendar age, the file paths it cites, and the commits landed since it was last confirmed.
  • It stays out of your context. Nothing is auto-injected; retrieval is a deliberate tool call, announced when it shapes an answer.
  • It refuses to hoard. Transient state, secret-shaped tokens, and near-duplicates bounce at write time; claims about you stage for your confirmation.
  • It's your data, on your disk. One markdown file per memory — greppable, hand-editable, git-syncable. No database, no cloud, no account. MIT.
  • It proves it's helping. A built-in eval reports how often memory actually shaped a reply. Numbers, not vibes — published.

For agents

You were likely handed this link with "set this up." Steps are idempotent and safe to re-run:

  1. uv tool install bettermemory — or pipx install bettermemory, or pip install bettermemory into a venv. Python 3.11–3.14.
  2. bettermemory init --client claude-code — likewise claude-desktop, cursor, continue, cline. For any other MCP host, plain bettermemory init prints the canonical mcpServers JSON snippet plus known config locations.
  3. bettermemory doctor — exit 0 means correctly wired; every failed check prints a one-line fix.
  4. Have the user restart the client so the server loads, then confirm by asking the model "what memory tools do you have?"

Your operating contract — tool signatures, retrieval discipline, write gates — is docs/api.md; the server's instructions block delivers the core policy automatically. For the long-form policy in your system prompt: bettermemory init --with-addendum. Migrating from Claude Code's built-in auto-memory: bettermemory ingest imports those files once.

Everything else

You shouldn't need it, but it's all written down: mechanics, storage format, the full tool surface, CLI, configuration, and limitations in docs/internals.md; per-client setup in docs/clients.md and docs/installation.md; eval methodology in docs/eval.md; postmortems in docs/incidents/; release history in CHANGELOG.md; dev setup and the compatibility contract in CONTRIBUTING.md.

MIT licensed — see LICENSE.

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

bettermemory-3.24.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

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

bettermemory-3.24.0-py3-none-any.whl (745.4 kB view details)

Uploaded Python 3

File details

Details for the file bettermemory-3.24.0.tar.gz.

File metadata

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

File hashes

Hashes for bettermemory-3.24.0.tar.gz
Algorithm Hash digest
SHA256 010786dc880639d4d3dfef74e5a6356f3e7e2bdeb7317fe0b41fc7d29690c96e
MD5 cea46f63aafb1bb7e666da69c05aa381
BLAKE2b-256 fa61cdb16bae3347bf516731e0b9d7918f9a5141e8dd14dcbd194e2a8fb71ca0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bettermemory-3.24.0.tar.gz:

Publisher: release.yml on 0Mattias/bettermemory

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

File details

Details for the file bettermemory-3.24.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for bettermemory-3.24.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74d8780399d2c7ee4bb3ef478acf81a7ef8680dd0c27d18501ced0e5e291a0a3
MD5 75ff4bc3d8418253f77ce8470eaf9001
BLAKE2b-256 1a6a8b15cee6fdab4cbd2c9bd99de37e6bc916bd43cecd727c3a267bc66f9117

See more details on using hashes here.

Provenance

The following attestation bundles were made for bettermemory-3.24.0-py3-none-any.whl:

Publisher: release.yml on 0Mattias/bettermemory

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