Skip to main content
Glama

AgentLedger

Git-style version control, cryptographic receipts, and cascading rollbacks for multi-agent shared memory.

CI Python MCP Compatible License: MIT Good First Issues

AgentLedger Demo

Terminal demo — Provenance Firewall catch + BFS domino quarantine (zero API keys)

pip install -e ".[dev]" && agentledger demo

Why AgentLedger?

Multi-agent teams share memory. One hallucinated scrape can become a quote, a proposal, and a CRM dispatch — cascading memory poisoning without a clear rollback path.

AgentLedger puts a Provenance Firewall in front of every write and a Causal Lineage Graph behind every read so you can quarantine the poison root and every derived decision.

Mechanism

Behavior

Cryptographic Receipts

Facts must cite a registered artifact SHA-256 or they never land

Confidence Half-Life Decay

C(t) = C0 · exp(-(ln 2 / half_life) · elapsed_hours)

Cascading Rollback (BFS)

Walk causal_read_hashes → mark the chain QUARANTINED


Related MCP server: projectmem

Lifecycle

flowchart LR
    A[Agent Tool Output] --> B[Artifact Hasher<br/>SHA-256]
    B --> C[Provenance Firewall]
    C -->|VALIDATED| D[Merkle Commit]
    D --> E[Main State DAG]
    E --> F[Downstream Causal Reads]
    F -.->|causal_read_hashes| D
    C -->|UNVERIFIED_RECEIPT / LOW_CONFIDENCE| X[Blocked]

Comparison

Feature

AgentLedger

Mem0 / Zep

Raw Redis / JSON

Cryptographic Receipts

✅

❌

❌

Confidence Half-Life Decay

✅

⚠️ partial

❌

Cascading Rollback (BFS)

✅

❌

❌

Model Context Protocol (MCP)

✅

❌

❌

Embedded Zero-Cloud (SQLite)

✅

❌

⚠️ DIY


30-Second Quickstart

git clone https://github.com/ratharo-gitty/agentledger.git
cd agentledger
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
agentledger demo

Use the high-level API in tools and agent hops:

from agentledger import ledger


@ledger.watch(key="acme::budget")
def scrape_budget():
    return "Verified budget: $500,000"


with ledger.agent("bot-pricer"):
    budget = ledger.get("acme::budget")  # tracks causal read
    ledger.set("acme::quote", 75000)  # links lineage automatically
{
  "mcpServers": {
    "agentledger": {
      "command": "agentledger",
      "args": ["mcp"],
      "env": {
        "AGENTLEDGER_DB": ".agentledger/ledger.db"
      }
    }
  }
}

After pip install -e ., point command at the absolute path to the agentledger binary if Cursor does not inherit your venv PATH.

{
  "mcpServers": {
    "agentledger": {
      "command": "agentledger",
      "args": ["mcp"],
      "env": {
        "AGENTLEDGER_DB": "/absolute/path/to/your/project/.agentledger/ledger.db"
      }
    }
  }
}
from agentledger import AgentLedgerEngine, MemoryFact, EvidenceAnchor, SourceType

engine = AgentLedgerEngine(".agentledger/ledger.db")
sha = engine.register_artifact("scrape: acme tier=Growth")
fact = MemoryFact(
    namespace="acme_corp",
    entity_key="tier",
    value="Growth",
    initial_confidence=0.92,
    evidence=EvidenceAnchor(
        source_type=SourceType.TOOL_STDOUT,
        source_uri="tool://scraper",
        raw_artifact_sha256=sha,
        excerpt="tier=Growth",
    ),
)
commit = engine.commit(agent_id="researcher", facts=[fact])
facts, causal = engine.read_facts(namespace="acme_corp")

MCP tools: ledger_register_evidence · ledger_read · ledger_commit · ledger_blame · ledger_revert_cascade


CLI

Command

Purpose

agentledger demo

Self-contained 4-bot GTM simulation (firewall + domino rollback)

agentledger seed

Sample multi-agent commits for local exploration

agentledger log

Rich table of commits, causal parents, decayed confidence

agentledger blame <key>

Full provenance receipt panel

agentledger revert <hash>

Prefix-aware BFS cascade quarantine

agentledger mcp

Start the FastMCP stdio server


Develop

pip install -e ".[dev]"
pytest -v
ruff check .
agentledger demo

See CONTRIBUTING.md and GOOD_FIRST_ISSUES.md for contributor on-ramps (CrewAI, LangGraph, Postgres, DAG visualizer, and more).


License

MIT

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Hosted memory for coding agents, exposing commit_mem, recall, and status over stdio. Each write carries provenance, contradictions surface as inspectable state changes, and a bad run can be rolled back from a snapshot.
    11
    1
    Business Source 1.1
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI coding agents to persist project memory across sessions by compiling decisions, progress, and pitfalls into git-linked, evidence-backed entries. It lets clients add, query, inject, scan for stale, check assertions on, and compute ROI of those memories over stdio.
    17 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Exposes repo-native, self-verifying memory to coding agents over stdio MCP, letting them recall ranked past decisions, record new claims with verifiable receipts, and check the health and stats of stored memory. Keeps agent context honest by surfacing memories whose evidence no longer holds.
    6 npm
    MIT