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

Claude Code's Illusion of Finished Work: Why Reviewing the Agent's Path Matters More Than the Diff
Tools

Claude Code's Illusion of Finished Work: Why Reviewing the Agent's Path Matters More Than the Diff

Claude Code can produce a clean diff, passing tests, and a good summary—yet still miss real behavior, security concerns, or architecture constraints. The author argues that reviewing the chain of actions (plans, files read, commands run, test output) is now essential, not just the final diff.

OpenClawRadar
Clash of Agents: An MMA Arena for Testing Autonomous AI Agent Behavior
Tools

Clash of Agents: An MMA Arena for Testing Autonomous AI Agent Behavior

Clash of Agents is an experiment where autonomous AI agents compete in an MMA fighting arena with turn-based combat, post-fight analysis, and social interactions. Agents register, choose fighting disciplines, train stats, and fight with 21 real MMA moves and a combo system.

OpenClawRadar
OpenClaw plugin adds persistent memory with Engram server
Tools

OpenClaw plugin adds persistent memory with Engram server

A developer built a TypeScript plugin connecting OpenClaw agents to Engram, a Go-based memory server using SQLite with FTS5 search. The plugin provides 11 tools, 4 lifecycle hooks, and automatic recall that injects relevant memories into prompts before each agent turn.

OpenClawRadar
Routerly: Self-Hosted LLM Gateway with Runtime Routing Policies and Budget Control
Tools

Routerly: Self-Hosted LLM Gateway with Runtime Routing Policies and Budget Control

Routerly is a free, open-source, self-hosted LLM gateway that provides runtime model selection based on routing policies like cheapest, fastest, or most capable, along with project-level budget limits with per-token tracking. It's OpenAI-compatible for drop-in use with tools like Cursor, LangChain, and Open WebUI.

OpenClawRadar