Skip to main content

causal-memory

An agent memory system with a causal core — facts, temporal state, and decision → outcome causal edges on one local SQLite store. Agents recall what happened, when it was true, why it worked — and what would happen if they acted differently.

pip install causal-memory

Requires Python ≥ 3.9. Prebuilt wheels: macOS (Apple Silicon + Intel), Linux x86_64 (manylinux_2_28), Windows x64. No API key needed for the default setup.

30-second quickstart

from causal_memory import CausalMemory

# One local SQLite file is the whole store. Created on first use.
mem = CausalMemory("~/.local/share/causal-memory/causal.db")
# or CausalMemory.in_memory() for a throwaway store

# Write: record a decision → outcome as a typed causal edge
mem.record_decision(
    "used Redis mutex for cache stampede protection",
    "deadlock under load",
    "caused",            # caused | enabled | prevented | no_effect
    "concurrency",       # task tag — how you retrieve this later
)

# Read: BM25 full-text retrieval works out of the box
print(mem.search_causal(query="cache stampede protection"))

# Ask before acting: forward simulation over recorded outcomes
print(mem.intervention_query("skip the test suite before shipping"))

Every method mirrors one of the 14 MCP tools and returns plain text that agent frameworks (LangChain, LlamaIndex, Hermes, …) can feed straight back to the model. See the full method list on GitHub.

Configuration

Everything is optional and configured via environment variables:

Variable What it does Default
CAUSAL_MEMORY_EMBED_API Embedding endpoint (OpenAI-compatible) for semantic retrieval unset → BM25 only
CAUSAL_MEMORY_EMBED_KEY API key for the embedding endpoint unset
CAUSAL_MEMORY_EMBED_MODEL Embedding model name (e.g. embedding-3) unset
CAUSAL_MEMORY_LLM_* LLM endpoint for distill / remember auto-extraction unset → raw storage, no extraction

Without embedding/LLM variables the package degrades gracefully: retrieval is BM25-only and remember stores raw text instead of extracted facts. You can add them later — the store format is the same.

What this package is (and isn't)

  • ✅ The Python library: embed causal memory in your own agent, script, or framework integration.

  • ✅ The MCP server command: the same pip install also drops a causal-memory console script on your PATH — point your MCP client config straight at it, no Rust toolchain needed:

    {
      "mcpServers": {
        "causal-memory": {
          "command": "causal-memory"
        }
      }
    }
    

    The console script is the full CLI: bare causal-memory runs the MCP stdio server; subcommands cover configuration (setconfig / getconfig / config-path), maintenance (stats, sleep, migrate, …) and import/export. See causal-memory --help.

  • ❌ Not a hosted service — everything runs against a local SQLite file you own.

Metadata

Release files for causal-memory 0.9.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 causal-memory 0.9.2
File Size Uploaded
causal_memory-0.9.2.tar.gz 371.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for causal-memory 0.9.2
File
causal_memory-0.9.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
causal_memory-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
causal_memory-0.9.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
causal_memory-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 22.0 MB

Release files / causal_memory-0.9.2.tar.gz

Download URL causal_memory-0.9.2.tar.gz
Size 371.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7afba51263034c30d12e35644549618c6cbee41b3d6f428916b5bee958836d3f
BLAKE2b-256 checksum
How to use checksums
7ab70fa75911a51148b0a82393c944643f639d0bd00fa8332d07227daafeaaef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / causal_memory-0.9.2-cp39-abi3-win_amd64.whl

Download URL causal_memory-0.9.2-cp39-abi3-win_amd64.whl
Size 5.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2af8f3a4690fa67f1232d2f7d150e71a0caa4a0264ddce3b5dc3318256b80b56
BLAKE2b-256 checksum
How to use checksums
09f6f395229ae5e4a44c9d726b0280034c7ec27815e03e8734e41fa9b818d03a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / causal_memory-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL causal_memory-0.9.2-cp39-abi3-manylinux_2_28_x86_64.whl
Size 7.1 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0c7fd1594f7b116a412df1a275bb8665de61741e9ba6e53b3f5cbe96f810605b
BLAKE2b-256 checksum
How to use checksums
61921293ed358903d6d3af40940e00d41b1596bf7d7b8a710842b8e75d2ace8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / causal_memory-0.9.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL causal_memory-0.9.2-cp39-abi3-macosx_11_0_arm64.whl
Size 4.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0407618f73d10c82f6cbb860c8f4a7b722363b55621be6ff9da63c49e54ecfb3
BLAKE2b-256 checksum
How to use checksums
940c5fb1b1faf1eb4b40ee9f1012495a379cdb57bf31c163d2f268cc0da41273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / causal_memory-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL causal_memory-0.9.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 4.8 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e153a1b4e9bdf9720454249c6d67cf3cc0fa7d34f33aa28d7a40bfc74ee67120
BLAKE2b-256 checksum
How to use checksums
e0f81b161259b4d28f9c3248a4e43a10a381d4c0e362ce061d6a147daa4b64cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.10.0

5 release files

0.9.3

5 release files

This release

0.9.2 This release

5 release files

0.9.1

5 release files

0.9.0

5 release files

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