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.3

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.3
File Size Uploaded
causal_memory-0.9.3.tar.gz 439.2 kB Details

Built distributions (wheels)

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

Total release size: 24.1 MB

Release files / causal_memory-0.9.3.tar.gz

Download URL causal_memory-0.9.3.tar.gz
Size 439.2 kB
Tags Source
SHA-256 checksum
How to use checksums
25770dc694fc590015c2efee9c979755d7f4aa7260bb8af6459e27b4d1347631
BLAKE2b-256 checksum
How to use checksums
67f7d91ad72e6f07d1b846423fa60d9b527c6b347e38d74f9ca7d480a8781042
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 Sep 7, 2026.

Transparency log

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

Download URL causal_memory-0.9.3-cp39-abi3-win_amd64.whl
Size 5.7 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e5cf5c770dea7a1306739b98dafafbd79bfa81827557a833ef89bc8e303cdff4
BLAKE2b-256 checksum
How to use checksums
d1cfc0da9c9f9d38476721b2de1604bb2a2755bf226defdb872f606386328b00
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 Sep 7, 2026.

Transparency log

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

Download URL causal_memory-0.9.3-cp39-abi3-manylinux_2_28_x86_64.whl
Size 7.7 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
f9a8badb902662f1829270ae737b29ca7fffe4e5840057aa42db2d08a3ec0b1a
BLAKE2b-256 checksum
How to use checksums
269fa4b73291a6fdf32e7ec8d1353d641b645b21bf274a6381ac2e7faf650fe3
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 Sep 7, 2026.

Transparency log

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

Download URL causal_memory-0.9.3-cp39-abi3-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cec7e41b72723590e51ebd7868cd028056f625118448fe2aa76040d4078348a5
BLAKE2b-256 checksum
How to use checksums
b4a205c0ae831a31818f62e51ccaaec38e444b2f4acd2dc1470039073e443ee0
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 Sep 7, 2026.

Transparency log

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

Download URL causal_memory-0.9.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 5.3 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
31c2afaa48cb925c4e5d83a19b4aeaec4b1e81894393a4ea6bb85a10bfebd252
BLAKE2b-256 checksum
How to use checksums
ed6da61ce95368250fceab5926fb6d3fec9560253823c683dbbc0bc86f249d55
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 Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.10.0

5 release files

This release

0.9.3 This release

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