Skip to main content

CausalOS

The causal memory layer for AI agents.

In 2025, a Replit agent deleted an entire production database during a code freeze — then fabricated status reports claiming the data was gone forever.

The agent had no memory of what its past actions had caused.

CausalOS fixes this.

pip install causal-os

🧱 Quick Start

Lead with the disaster. CausalOS captures the "why" behind failures so they don't happen twice.

from causal_memory import CausalMemory
from causal_memory.models import ActionType, Severity
from causal_memory.guard import CausalGuard, CausalBlockException

memory = CausalMemory()

# Session 1: Agent causes disaster. CausalOS records it.
memory.record(
    action_type=ActionType.DB_DELETE,
    action_detail="DELETE FROM users WHERE status='test'",
    intent="Clean up test data",
    outcome="CRITICAL: Deleted 47,000 production users. status flag misconfigured.",
    severity=Severity.CRITICAL
)

# Session 2: New agent, same mistake incoming. CausalGuard blocks it.
guard = CausalGuard(memory, mode="block")

try:
    with guard.check(ActionType.DB_DELETE, "DELETE FROM users WHERE env='test'"):
        # This code never runs
        db.execute("DELETE FROM users...")  
except CausalBlockException as e:
    print(f"Blocked. Similar action caused CRITICAL failure in {e.incidents[0].session_id}")

🛡️ Why not Mem0 or Zep?

Mem0 / Zep CausalOS
Stores Facts, entities, chat history Action → Outcome chains
Query "What does the user prefer?" "Has this action caused damage before?"
Risk scoring No Yes (deterministic, no LLM)
Guard / block No Yes
Use together? Yes Yes — CausalOS wraps them

📊 CLI Audit

Audit your agent's institutional memory with the built-in CLI.

causal-os view --db causal.db

Output:

🌲 Causal Graph (causal.db)
📁 Session: 8f2a1b9c
   DB_DELETE: DELETE FROM users WHERE status='test'
   → CRITICAL: Deleted 47,000 production users.
   ↳ Downstream: Site outage (CRITICAL)
📁 Session: a7b3e21d
   API_CALL: POST /v1/billing/reset
   → Success: Billing cycle reset.

🚀 Roadmap

  • CrewAI integration
  • Shared causal pool (opt-in, anonymized) — agents learn from each other's failures
  • causal-os serve — local REST API for any language
  • MCP server for Claude Code and Cursor

📜 License

MIT

Metadata

Release files for causal-os 0.1.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-os 0.1.2
File Size Uploaded
causal_os-0.1.2.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for causal-os 0.1.2
File Interpreter ABI Platform
causal_os-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / causal_os-0.1.2.tar.gz

Download URL causal_os-0.1.2.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d4efe58875a2086c312980f5b45ddc18426e1158e0ea51d87cc2860597ef7be3
BLAKE2b-256 checksum
How to use checksums
c1729f2b4f6c47947cf4f396389ff4a8b71c46c805fdd35d3094bafbf8bc30e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / causal_os-0.1.2-py3-none-any.whl

Download URL causal_os-0.1.2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39b07bf871367cc991d8858e37f168ce03c3ebb2e68e869fa1b889d71236a55b
BLAKE2b-256 checksum
How to use checksums
050dca9a4228c379c56cb997f8fb0e34c908f21716c5656845ad5efce433a013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 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