Mneme: A PreToolUse Hook That Blocks Claude Code Edits Violating Architecture Decisions

✍️ OpenClawRadar📅 Published: May 4, 2026🔗 Source
Mneme: A PreToolUse Hook That Blocks Claude Code Edits Violating Architecture Decisions
Ad

Marcus Dillavou built Mneme, a PreToolUse hook that intercepts Claude Code edits and checks them against a recorded architecture decisions file before they hit disk. The goal: prevent banned libraries, rejected patterns, and forgotten conventions from reappearing in new files.

Installation

pip install mneme
python scripts/install_claude_code.py

This writes the hook entry into .claude/settings.json and installs four slash commands:

  • /mneme-check — run a violation check
  • /mneme-context — pull context for current file
  • /mneme-record — record a new decision
  • /mneme-review — review existing decisions
Ad

How It Works

When Claude attempts an edit, Mneme compares the operation against keyword-indexed decisions. If a violation is detected, the hook blocks the operation and returns the decision ID as feedback. Claude sees the restriction, understands why, and adjusts its output — no manual override needed.

The hook fails open: if Mneme isn't on PATH or times out, it exits 0 and Claude Code proceeds normally. It only blocks when mneme check actually returns a violation verdict.

Edge Cases

Retrieval is keyword-based, so scope of decisions matters. The author is actively looking for real-world feedback on whether the hook fires correctly in production projects.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also