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.
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.
store_001. Use SQLite for local storage. A PostgreSQL dependency must not reach the project through a file write.
-
01 Decision
Mneme injects the project's storage decision before Claude starts.
store_001 · Use SQLite for local storageUserPromptSubmit -
02 Agent change
Claude proposes a file write that imports PostgreSQL.
Write db.py · import psycopg2Claude Agent SDK -
03 MnemeDENY
The pre-tool hook blocks the write and returns the decision reason to Claude.
DENY [store_001] · psycopg2 forbidden · write withheldPreToolUse + Mneme -
04 RetryPASS
Claude revises the file with SQLite and the same hook allows it.
Write db.py · import sqlite3 · Result: PASSPreToolUse + Mneme
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
Mneme adds the relevant project decision to the task before work begins.
Mneme checks supported file changes and returns a clear allow or block.
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"