Hook-time
block · warn · allowPre-check rules fire before an Edit, Write, or Bash call. Post-check rules warn after. Evaluated from disk on every tool invocation — no context-window cost.
A RETE rules engine that enforces project conventions from disk — outside the LLM context window. Rules fire the same in token nine hundred thousand as they do in token eight hundred.
A rule is a small refusal the project keeps making, even after it has forgotten the conversation in which it was first imagined.
Pre-check rules fire before an Edit, Write, or Bash call. Post-check rules warn after. Evaluated from disk on every tool invocation — no context-window cost.
Whole-tree scan against every rule tagged
audit: true. Per-rule hit counts with file
and line locations. Trend snapshots track debt over time.
A markdown file re-injected at every SessionStart and UserPromptSubmit. CLAUDE.md fades; this does not.
Three heuristic tools compare what the project says (CLAUDE.md, auto-memory, ADR decisions) against what the rules actually enforce. No LLM call — Jaccard overlap.
Install from source, run init in your project,
and the hooks are wired. Rules fire from disk on every tool
call — no daemon, no socket, no shared state. Every invocation
is a fresh process that reads, evaluates, and exits.
Works with Claude Code and Gemini CLI. Exposes MCP tools to any MCP-capable client.
# install cargo install --path . phr-mcp install # user-scope MCP # wire into a project cd ~/Git/my-project phr-mcp init --packs llm,rust # hooks + starter rules # use phr-mcp audit # sweep existing debt phr-mcp trend # debt over time phr-mcp claude-md-drift # uncovered CLAUDE.md bullets phr-mcp memory-drift # uncovered auto-memory entries phr-mcp wiki-drift # uncovered ADR decisions phr-mcp decision new my-slug # scaffold an ADR page
A long-form essay on the engine, the RETE algorithm, and the design intent behind moving guidance out of conversation context. With diagrams.
A visual reference of every default rule — LLM-behavior nudges, Rust enforcement, Rhai script hygiene — with rationale and worked examples from the field.