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.10.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 causal-memory 0.10.0
File Size Uploaded
causal_memory-0.10.0.tar.gz 535.4 kB Details

Built distributions (wheels)

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

Total release size: 24.8 MB

Release files / causal_memory-0.10.0.tar.gz

Download URL causal_memory-0.10.0.tar.gz
Size 535.4 kB
Tags Source
SHA-256 checksum
How to use checksums
94c2b6ab0917552bb5000d3a3b246d062e236d91c890dab3884f46c319fed73f
BLAKE2b-256 checksum
How to use checksums
8fef827daeeb06cd6db475b598aab3bfd07e0646ddd4370a5ad26f348a927e0f
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 Oct 16, 2026.

Transparency log

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

Download URL causal_memory-0.10.0-cp39-abi3-win_amd64.whl
Size 5.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e3a18bd82a6e484e5b3a467b1c53fcfb22ffc1594589deb6c2a2a96326525adc
BLAKE2b-256 checksum
How to use checksums
c65cbe9d37ca409e37b7347a1c5e0afcefe1650aab43cbbc997b663e71fe6649
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 Oct 16, 2026.

Transparency log

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

Download URL causal_memory-0.10.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 7.8 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
af1e0c1ee6fd8f51efd5ffbe4e7e53dfb9667097c608c94ba8e5a60c330f6033
BLAKE2b-256 checksum
How to use checksums
179f3aab18b7a4cdcac75ccecef40c657273faf2179d39fde16c3d175e352a47
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 Oct 16, 2026.

Transparency log

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

Download URL causal_memory-0.10.0-cp39-abi3-macosx_11_0_arm64.whl
Size 5.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2cfa43025e4a009d538f31f15f9a3a934d094fbb8123e2e9b797ed256d9c85cd
BLAKE2b-256 checksum
How to use checksums
f7807856f6ad899e096fdf69b0d55735cbdeb0c165c768ec7d9bc78639cefa98
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 Oct 16, 2026.

Transparency log

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

Download URL causal_memory-0.10.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 5.5 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
59ec18920a20adbd63ef00ae2182fe16b734ba8db23289f38a85751ecb3d57f5
BLAKE2b-256 checksum
How to use checksums
4390bc024eab1b6fc09f0e68fd490197cd845ec1e2985b53debfd29b29acb695
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 Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

5 release files

0.9.3

5 release files

0.9.2

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