Page typeNative integration RunnabilityRunnable locally OutcomeDENY → PASS ModesDeterministic + live

Claude proposes a violating write. Mneme blocks it before disk.

A Claude Agent SDK app tries to add PostgreSQL to a project that uses SQLite. Mneme gives Claude that rule before work starts, blocks the bad Write, and lets it retry with SQLite.

Native integration

One hook. One blocked write. One compliant retry.

Before Claude starts, Mneme shares the relevant rule. Before a file changes, it checks the proposed Write, Edit, or MultiEdit.

Decision at stake

store_001. Use SQLite for local storage. A PostgreSQL dependency must not reach the project through a file write.

claude agent sdk + mneme · pre-tool write trace
  1. 01 Decision

    Mneme injects the project's storage decision before Claude starts.

    store_001 · Use SQLite for local storageUserPromptSubmit
  2. 02 Agent change

    Claude proposes a file write that imports PostgreSQL.

    Write db.py · import psycopg2Claude Agent SDK
  3. 03 Mneme

    The pre-tool hook blocks the write and returns the decision reason to Claude.

    DENY [store_001] · psycopg2 forbidden · write withheldPreToolUse + Mneme
    DENY
  4. 04 Retry

    Claude revises the file with SQLite and the same hook allows it.

    Write db.py · import sqlite3 · Result: PASSPreToolUse + Mneme
    PASS
Deterministic mode needs no API key · live mode uses Claude Agent SDK

Run it yourself

Run the deterministic proof or live session

The example is bundled with the Mneme repository. Deterministic mode needs no API key; --live runs the real Claude Agent SDK loop.

git clone https://github.com/MnemeHQ/mneme
cd mneme/examples/claude-agent-sdk
python run.py

# Optional: run the live Claude Agent SDK workflow
python run.py --live

The browser transcript is a readable summary of this flow; the repository example is the executable proof.

What happened

Claude starts with the right rule.

Mneme adds the relevant project decision to the task before work begins.

Writes are checked before they land.

Mneme checks supported file changes and returns a clear allow or block.

What it cannot check stays visible.

Shell commands sit outside this gate, so whole-file checks and CI remain the backstop.

Common questions

Is this a live Claude Agent SDK integration?

Yes. The repository example includes deterministic mode and a --live mode using the native MnemeAgentSdk adapter.

Which tools does Mneme gate?

The shipped adapter checks Write, Edit, and MultiEdit before execution. Shell commands are not reconstructed reliably enough to claim as covered.

What happens after a denial?

In strict mode, the decision reason is returned to Claude so it can revise the proposal. The corrected SQLite write is checked again and allowed.

Put the gate before the tool call.

Use the native adapter when your Claude Agent SDK workflow needs architectural decisions enforced before file mutations land.

pipx install "mneme-hq>=0.5.1"
Python 3.11+ · MIT licensed