Skip to main content

Core Memory banner

Apache-2.0 License PyPI version PostgreSQL 15+

Durable, auditable memory for AI agents.
Every event kept verbatim in PostgreSQL, read by a model you choose and related by a judge, so agents recall what was said and what still holds.

Quickstart · Features · Supported Providers · Contributing

Core Memory

Give your AI agents memory that keeps the record straight. Core Memory 2 is a self-hosted memory engine, rewritten from the ground up in Rust. It turns any stream of source events into durable, auditable memory in PostgreSQL: chat messages, documents, CRM record changes and an agent's tool calls. Run it as a command, as an HTTP service, or inside your own database.

Most memory layers summarize what they are given and keep the summary. Core Memory keeps the original. The full text of every event is the memory. What models add is structure on top of that text, never a rewrite in its place.

Keep every event, exactly: Each event is admitted with its exact bytes and a stable identity, cut into deterministic chunks, and committed in one transaction. Offer it again and the answer is replay, never a duplicate.

Read by the model you choose: A model gives each chunk a type from your vocabulary and marks where its entities, actions and outcomes are, as ranges of the chunk's own text. Nothing the model writes is stored in place of the source.

Related by a judge: A judge model says how each new memory relates to the ones near it in time, and to the ones its source names: what caused what, what replaced what, and what cannot both hold. It answers in the arrows of Mark Burgess's Semantic Spacetime. A replacement is written only after a second read gives it again, and a contradiction keeps both sides.

Recall what still holds: recall returns the stored text that holds your words, verbatim. With it comes what replaced that text, what disputes it and what the judge's arrows lead to. All of it comes from the same tables, with no second store.


Quick Start

Install the command. Each wheel carries the compiled engine for Linux or macOS, so no Rust toolchain is needed:

uv tool install core-memory     # or: pipx install core-memory
core-memory --version           # core-memory 2.1.0

Start PostgreSQL 15 or newer:

docker run -d --name core-memory-pg -e POSTGRES_PASSWORD=secret \
    -p 127.0.0.1:5432:5432 postgres:18
export CORE_MEMORY_DATABASE_URL=postgresql://postgres:secret@127.0.0.1:5432/postgres

Store the example events and recall from them:

git clone https://github.com/JohnnyFiv3r/Core-Memory
cd Core-Memory/examples/quickstart

core-memory migrate                            # create the core_memory schema
core-memory scope add acme --workspace demo    # allow events for scope "acme"
core-memory ingest --input events.jsonl        # one typed outcome per event
core-memory recall phased cutover              # the stored text that holds those words

That stores four events: two Slack messages, a Salesforce opportunity and a planning doc. The recall returns the two that mention the phased cutover, word for word.

To have a model read what is stored, add a [reader] and a [[binding]] to core-memory.toml. Then let the scope send its text to that model:

core-memory scope allow acme --binding small   # consent, for this scope and this model's host
core-memory read run                           # read what is due now, then stop

See the full guide for:

  • the HTTP service;
  • model providers, including your ChatGPT plan;
  • tool calls, the judge, recall and erasure;
  • running the engine inside your own database.

Features

Verbatim memory: The full chunk text is the memory. The engine writes no summaries, gists or framing text in its place. What a model reads in a chunk is stored as a type and as byte ranges of the chunk itself. The one exception is a tool call: beside its full text, the engine keeps two short lines a model wrote about it.

Stable identity: An event is known by its scope, source, external ID and revision, never by its position or ingest order. Event and chunk IDs are derived from that key under each workspace's secret key, so they are the same on every replay and reveal nothing about what they name.

Typed outcomes, never guesses: Every event gets one of accepted, replay, identity_conflict, checkpoint_conflict, refused or busy. Input that could be read two ways is refused, not interpreted. busy means keep the event and send it again.

Consent before any model call: A scope's text goes to a model only after that scope allows the model's destination. Every call is permitted in the same transaction that reads the text, and held to the binding's daily budget if it has one. Its receipt is committed before anything is sent.

Models you choose: Anthropic, OpenAI, OpenAI-compatible servers such as a local model, or OpenAI's models on your own ChatGPT Plus or Pro plan. Any of them can be the reader, the tool reader or the judge.

Tool calls as memory: An agent's tool call is stored whole. Before a model reads it, fixed rules shorten it. The model writes two short lines about it: what the call did and what came of it.

Judged, never inferred: No relationship is made from similarity, chronology or shared keys alone. Code only chooses what the judge is shown, and it chooses by time and by what a source names. Every pair the judge sees gets a verdict, and "cannot tell" is never a no.

Recall with provenance: Every match comes back with its event key and its time, and says where that time came from. It also says whether the match is still current and whether another statement disputes it.

Erasure that reaches everything: Erasing a message removes its text and everything derived from it, in one transaction. Its ID stays as a tombstone, and the erasure is written to a journal.

Built to live in your database: The engine uses one PostgreSQL schema. Row security is on for every table, and the engine's own role is least-privilege. Hosts govern it through SQL functions. Rows commit in a fixed order, so a reader that pages through them never misses one.

Authenticated HTTP service: Per-token scope grants, readiness and health checks, and an OpenAPI 3.1 document.

Export everything: Events, chunks, reads, tool outcomes, verdicts, edges, name links and erasures, as core_memory.record.v2 JSON Lines.

Measured with live models: 104 messages were written to mislead a reader or a judge. Over three runs, the reader got 193 of 201 answers right and the judge 86 to 87 of 87. See the evaluations.


Supported Providers and Hosts

Model providers

Provider provider Paid with Guide
Anthropic anthropic An API key Reading with a model
OpenAI openai An API key Reading with a model
OpenAI-compatible servers (a local model, a gateway) openai-compatible Your own server Reading with a model
OpenAI on your ChatGPT plan openai-chatgpt Your Plus or Pro plan Using your ChatGPT plan

Ways to run it

Host How Guide
Command line core-memory ingest, read run, recall, erase and export Try it
HTTP service core-memory serve: POST /v1/events, POST /v1/recall, GET /v1/openapi.json Over HTTP
Inside your own PostgreSQL The engine owns one core_memory schema. Your system governs it through SQL functions and reads its tables, or two read views, through grants and policies of its own, with no copy to keep in step. Running inside another system's database

flowchart LR
    S[Source events] --> A[Admit<br/>identity, chunks, facets]
    A --> P[(PostgreSQL<br/>core_memory)]
    P --> R[Reader<br/>type and spans]
    P --> T[Tool reader<br/>action and outcome]
    P --> J[Judge<br/>arrows between memories]
    R --> P
    T --> P
    J --> P
    P --> Q[Recall and export]

How It Works

Core Memory keeps its writes deterministic and puts every model call behind a gate. Each event follows the same path:

Admit: An event arrives from the command, the HTTP service or a reader that tails a source. The engine checks its identity before cutting it into chunks, so a change to the chunker never looks like a conflict. It then cuts the text into chunks that reproduce it byte for byte and attaches deterministic facets. The event, its chunks, their text and its beads commit in one transaction, and only while the scope is active.

Read: With a reader configured, each chunk is queued for a model. The model picks one type from your vocabulary, or abstains and says why. It also quotes the chunk's entities, actions and outcomes. Each quote is kept only as the byte range where it was found, so a quote that is not in the chunk is dropped. With a tool reader configured, each tool call goes to a model that writes what the call did and what came of it.

Judge: With a judge configured, each new memory is shown beside the memories near it in time, from every scope of the workspace that allows it, and beside the ones its source names as what it replies to, belongs under or is a revision of, however long ago they were. The judge answers each pair with an arrow, with none, or with "cannot tell". A memory stays current until a later statement replaces or withdraws it. Such a chain never branches, and a contradiction ends neither side. Finding related pairs across the whole store, beyond what the judge reads in time order, is a host's work and not the engine's: memoriesQL does it.

Recall: Recall uses PostgreSQL's full-text search over the stored text and makes no model call. A match that was replaced is answered by its successor. Disputed statements are marked, and the judge's arrows are followed up to two steps.

Erase: Erasing removes a message's text and everything derived from it in one transaction. The message's ID stays as a tombstone, so links to it never dangle and the same message is refused if it is offered again.

Core Concepts

SourceEvent One thing a source said or changed: a message, a document revision, a record change or a tool call. It is known by (scope, source_ns, external_id, revision) and stored with its exact bytes.

Scope and Workspace A scope is one connection to one source, such as one Slack workspace or one agent harness. Events are admitted only for a scope that is enrolled and active. A workspace is a set of scopes that belong together. Its secret key is what event and chunk IDs are derived from.

Chunk and Bead A chunk is a deterministic piece of an event's text, and the chunks of an event concatenate back to it exactly. A bead is a unit of memory: a chunk, a tool call as a whole, or a group the judge made of memories that are parts of one.

Destination and Consent A destination is where a model call sends text, taken from the binding's endpoint and never written by hand. A binding paid by one person's ChatGPT plan is a destination of its own. Consent is given per scope and per destination, and only through a governance function.

Permit and Receipt Every model call is permitted first. The permit checks that the scope is active and has allowed the destination, and that the day's budget is not spent. It then reads the text and commits a receipt naming the destination and what was sent. A refusal sends nothing. Receipts, queues and logs hold IDs, counts and problem codes, never text.

Verdict, Edge and Arrow A verdict is recorded for every pair the judge was shown, whatever it said. An edge records an arrow from one memory to another. Arrows come from a fixed directory of four types: leadsto, contains, express and near. Edges have no weight and are never changed.

Learn more in the architecture docs.


Recall Example

Request

core-memory recall phased cutover

Or over HTTP, with a token that may recall from the scope:

curl -s localhost:7600/v1/recall -H "Authorization: Bearer $TOKEN" \
    -d '{"query": "phased cutover", "scopes": ["acme"]}'

Response

This is the real answer for the Quick Start's events. The IDs are the ones the engine derived for them.

{
  "found": "matched",
  "beads": [
    {
      "bead_id": "73ceb7ed-819d-8b25-bbf4-5d75246c2737",
      "kind": "chunk",
      "event": {
        "event_id": "cf46e316-4904-8189-b529-b79110b490d1",
        "key": {
          "scope": "acme",
          "source_ns": "slack/T01",
          "external_id": "C042/1730000001.000100"
        }
      },
      "time_at": "2026-10-20T15:02:11Z",
      "time_basis": "source",
      "via": "match",
      "rank": 0.1,
      "current": true,
      "disputed": false,
      "chunks": [
        {
          "chunk_id": "73ceb7ed-819d-8b25-bbf4-5d75246c2737",
          "ordinal": 0,
          "text": "Billing migration: we're going with the phased cutover. Big bang is too risky with the ledger export as slow as it is."
        }
      ]
    },
    {
      "bead_id": "b2415cab-a7e2-8027-a6dc-8dfb56042f9a",
      "kind": "chunk",
      "event": {
        "event_id": "0b0c1451-1eb8-856f-aa04-b0f5471114b7",
        "key": {
          "scope": "acme",
          "source_ns": "docs/drive",
          "external_id": "cutover-plan.md",
          "revision": "v3"
        }
      },
      "time_at": "2026-10-21T00:00:00Z",
      "time_basis": "source_bucket",
      "via": "match",
      "rank": 0.05,
      "current": true,
      "disputed": false,
      "chunks": [
        {
          "chunk_id": "b2415cab-a7e2-8027-a6dc-8dfb56042f9a",
          "ordinal": 0,
          "text": "# Billing cutover plan\n\nPhase one moves read traffic to the new ledger on November 3.\n\nPhase two moves writes once the export runs in under an hour. Owner: OPS-412.\n"
        }
      ]
    }
  ],
  "arrows": [],
  "linked_omitted": 0
}

With a judge configured, the answer carries what the judge said:

  • arrows lists the judge's arrows between the beads returned.
  • A match that a later statement replaced is answered by that statement.
  • disputed marks a statement that another current statement contradicts.

Documentation

Repo Map

crates/
├── core-memory-contract/         SourceEvent, outcomes, IDs and records
├── core-memory-chunker/          deterministic, lossless chunking
├── core-memory-core/             the pipeline, and the Store and ModelTransport traits
├── core-memory-store-postgres/   the PostgreSQL store, its schema and migrations
├── core-memory-source-jsonl/     SourceEvents read from JSON Lines
├── core-memory-model-http/       what the model transports share
├── core-memory-model-anthropic/  Anthropic
├── core-memory-model-openai/     OpenAI and OpenAI-compatible servers
├── core-memory-model-chatgpt/    OpenAI on your ChatGPT plan
├── core-memory-sidecar/          the core-memory command and HTTP service
└── core-memory/                  facade re-exporting the above

Other useful folders:

  • examples/ the quickstart's events and config
  • eval/ the live-model evaluations and their results
  • fixtures/ golden exports the tests compare against
  • docs/ the guide, the architecture and what became of 1.x
  • scripts/ the crate layering check CI runs

Useful docs:

Guide Architecture What became of 1.x Releasing


Contributing

To build the command from source you need Rust 1.89 or newer:

git clone https://github.com/JohnnyFiv3r/Core-Memory.git
cd Core-Memory
cargo build --release      # the command is target/release/core-memory

The checks CI runs:

cargo fmt --all
cargo +1.99 clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace                 # tests that need no database
python3 scripts/check_layering.py

Tests that touch the store run against a real PostgreSQL server. Each test creates and drops its own database:

export CORE_MEMORY_TEST_DATABASE_URL=postgresql://postgres:secret@127.0.0.1:5432/postgres
cargo test --workspace --all-features

Maintainers

Core Memory is maintained by:

John Inniger (@JohnnyFiv3r) Chris Dedow (@chrisdedow)

For bugs and feature requests, please open an issue. For anything else related to the project, feel free to reach out to the maintainers directly.


Looking for Core Memory 1.x?

The Python implementation is frozen at 1.1.2. Its code is on the v1.x branch, and it stays on PyPI:

pip install "core-memory<2"

1.x gets security fixes only, made on v1.x. What became of 1.x goes through each 1.x module and says what 2.0 kept, replaced, dropped or left to the host.


Inspiration

Inspired in part by Steve Yegge's writing on beads and memory systems: https://github.com/steveyegge/beads

The judge's relationships are the arrows of Mark Burgess's Semantic Spacetime, as his SSTorytime names them: https://github.com/markburgess/sstorytime


Apache-2.0 License · Code of Conduct · Releases

Metadata

Release files for core-memory 2.1.0

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

Source distribution (sdist)

Source distribution for core-memory 2.1.0
File Size Uploaded Provenance Actions
core_memory-2.1.0.tar.gz 514.3 kB With provenance Details for core_memory-2.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for core-memory 2.1.0
File Actions
core_memory-2.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for core_memory-2.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
core_memory-2.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for core_memory-2.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
core_memory-2.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for core_memory-2.1.0-py3-none-macosx_11_0_arm64.whl
core_memory-2.1.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for core_memory-2.1.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 20.8 MB

Release files / core_memory-2.1.0.tar.gz

Download URL core_memory-2.1.0.tar.gz
Size 514.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e0d0b71b224f314a40bcca98febbd78a69c8e121daf80417ed5fbe8dff38381a
BLAKE2b-256 checksum
How to use checksums
1da58dedcbe0fb9e00cb786d5dd00308161dcc444acb1df501f2f72fa9fc6051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / core_memory-2.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL core_memory-2.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0f2aeb2733a344dfa8596a09ef4cd0e17653d87d32ae666812b27bd306dfb18b
BLAKE2b-256 checksum
How to use checksums
1265d27aadd1f524ce1fa7b13b118d6d6b46b0e4310fc6dd4b28db23eaf8aec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / core_memory-2.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL core_memory-2.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b32d79fad523cab370614584325c69a2b712d20b3c19220ff0910aa6fe6d5318
BLAKE2b-256 checksum
How to use checksums
8fca0faebc79d5f9daae94deafac6216f9ab65d125feb9e7b26d3fd53940a6fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / core_memory-2.1.0-py3-none-macosx_11_0_arm64.whl

Download URL core_memory-2.1.0-py3-none-macosx_11_0_arm64.whl
Size 4.9 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e3d827751cbcb71d3569c3a7736be141249bd7028e76c9f4d4974d6c0af66f5f
BLAKE2b-256 checksum
How to use checksums
7c30011fa40537c2056c821ddf0b8372ed9e95ec00b6b339a7b0d810c53d3508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / core_memory-2.1.0-py3-none-macosx_10_12_x86_64.whl

Download URL core_memory-2.1.0-py3-none-macosx_10_12_x86_64.whl
Size 5.1 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5d3bf6dcf1c9aaffeecb2b3e8ccc70c1cfab946ab6b829e49fc9fe48dc4be9f4
BLAKE2b-256 checksum
How to use checksums
376fd2574df0aca43ec319763c278eac228917906f0cf16da46e14ba06579aa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for core-memory 2.1.0

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for core_memory-2.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

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

2.1.0 This release

5 release files Full 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