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

No-Code Persistent Memory System for Claude Using Notion and MCP
Tools

No-Code Persistent Memory System for Claude Using Notion and MCP

A radiologist built a 'Cognitive Hub' in Notion that Claude reads and writes to through MCP, creating a structured knowledge base with a routing table to load only relevant information per conversation. The system has grown to 70+ pages after a month of daily use.

OpenClawRadar
Smriti: A Git-like system for managing LLM reasoning state to prevent conversation drift
Tools

Smriti: A Git-like system for managing LLM reasoning state to prevent conversation drift

Smriti is an open-source tool that lets developers save, restore, branch, and compare reasoning states in LLM conversations to prevent drift. It treats interactions as state rather than chat history, allowing clean rollbacks and alternative exploration without contamination.

OpenClawRadar
ETL-D MCP Server: Deterministic CSV Parsing for Claude to Prevent Financial Hallucinations
Tools

ETL-D MCP Server: Deterministic CSV Parsing for Claude to Prevent Financial Hallucinations

A developer built ETL-D, an open-source MCP server for Claude Desktop that processes CSVs in three deterministic layers to prevent decimal point hallucinations in financial data. It uses Python parsers for known formats, achieves ~70ms response times with 0 LLM calls for 200 parallel requests, and only uses LLMs as a fallback for high-entropy text.

OpenClawRadar
Prime Agent: A Self-Improving RLM Coding Harness with Persistent REPL and Agent CRUD
Tools

Prime Agent: A Self-Improving RLM Coding Harness with Persistent REPL and Agent CRUD

Prime Agent is an open-source coding harness built on a persistent IPython kernel and a Recursive Language Model, letting agents manage their own context and sub-agents.

OpenClawRadar