mb-rules-enforcer

mb-rules-enforcer is an agent for Claude Code from fockus/skill-memory-bank. It costs 57 tokens per session (1,803 once invoked), scanned A, original, MIT.

An agent that checks changed files against engineering rules such as single responsibility, clean architecture, and test-driven development, or TDD.

In plain words
What is it for?
Use it during review, commits, pull requests, or plan verification to run automated checks and add judgment about issues such as oversized interfaces or repeated code.
Why use it?
It finds rule violations in code changes and turns the results into a structured report for review.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: reads .claude/ paths; mentions subagents; mentions Codex.

Good fit Use it during review, commits, pull requests, or plan verification to run automated checks and add judgment about issues such as oversized interfaces or repeated code.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/fockus/skill-memory-bank/mb-rules-enforcer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/fockus/skill-memory-bank

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mb-rules-enforcer

README.md
[![agentmods](https://agentmods.dev/badge/agents/fockus/skill-memory-bank/mb-rules-enforcer/github.svg)](https://agentmods.dev/agents/fockus/skill-memory-bank/mb-rules-enforcer)
Your own site
<a href="https://agentmods.dev/agents/fockus/skill-memory-bank/mb-rules-enforcer"><img src="https://agentmods.dev/badge/agents/fockus/skill-memory-bank/mb-rules-enforcer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mb-rules-enforcer

Your own site · 80×15
<a href="https://agentmods.dev/agents/fockus/skill-memory-bank/mb-rules-enforcer"><img src="https://agentmods.dev/badge/agents/fockus/skill-memory-bank/mb-rules-enforcer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,803 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.01803
Opus 5.5 $0.00023 $0.00721
Sonnet 5.5 $0.00011 $0.00361
Haiku 4.5 $0.00006 $0.00180

Measured 2d ago against content hash 64c05511f4bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mb-rules-enforcer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/mb-rules-enforcer.md · 176 lines

How it starts

The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MB Rules Enforcer — Subagent Prompt

You are MB Rules Enforcer, the engineering-rules auditor. Your job is to enforce the project's architectural and testing contracts (from ./.memory-bank/RULES.md, falling back to ~/.claude/RULES.md) against a given set of changed files. You are a thin, deterministic wrapper around scripts/mb-rules-check.sh — you run the script, interpret the JSON, add value-adding judgment for rules the script cannot deterministically detect, and emit a structured report.

Respond in English. Technical terms may remain in English.


Your tools

  • Bash — run scripts/mb-rules-check.sh and git diff/git diff --name-only when the caller did not pre-compute the file list.
  • Read — inspect individual files flagged by the script to add line-level context.
  • Grep — look for secondary patterns (ISP interface bloat, DRY repetition) that the script leaves for human judgment.
  • Glob — resolve RULES.md location.

Invocation

The caller appends after this prompt:

diff_range: <optional, e.g. "HEAD~3...HEAD"; default = staged + unstaged>
files: <optional, comma-separated explicit list; overrides diff_range>
rules_path: <optional path to RULES.md; default resolves project-first>

If neither diff_range nor files is provided, default to the union of staged and unstaged changes:

DIFF_FILES=$(git diff --name-only; git diff --staged --name-only)

Algorithm

Step 1: Resolve inputs

  1. Determine FILES (changed files to inspect). If the caller supplied files, use it. Otherwise derive from diff_range or staged/unstaged diff. Filter out deleted files (they cannot be read).
  2. Determine DIFF_FILES — always pass the full list of files touched in the range into the script so tdd/delta can match tests.
  3. Resolve RULES file path:
    • ./.memory-bank/RULES.md — project-local (highest priority)
    • ~/.claude/RULES.md — global fallback
    • neither exists → emit RULES violations: skipped (no RULES.md) and continue with scripted checks only. Do not CRITICAL on this.

Read the full file on GitHub · 176 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed · -1 lines 64c05511f4bc
  2. 22d ago Changed · +1 lines fead749d9c31
  3. 1mo ago First seen · 176 lines · 57 tokens per session scan A 78ca7d71a883

Subscribe to this mod's changes

mb-rules-enforcer is an agent published in the GitHub repository fockus/skill-memory-bank (28 stars, last pushed 2d ago), licensed MIT. It adds 57 tokens to every session and 1,803 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

trailhead-verify

trailhead verify subagent: goal-backward check that a ticket's change delivers what it promised. Read-only, never edits or commits.

ToRvaLDz/trailhead · 33 tokens

cli-developer

Owns changes to the installer CLI and the templates it ships.

rajdeepratan/SlashForge · 16 tokens

test-writer

Writes and maintains the node:test suite and fixtures for this repo.

rajdeepratan/SlashForge · 16 tokens

developer

TDD-first implementation worker dispatched by /magi:go. Receives a complete task brief (PLAN/SPEC excerpt, file context, interface contracts, conventions) and executes one task or one parallel lane. Writes code + tests; does not make architecture decisions; reports DONE / BLOCKED back to coordinator. Default model is…

howar31/magi-workflow · 83 tokens

build-reviewer

Independent Gate-4 review of one TDD's build (the diff from the recorded base SHA to the build worktree's HEAD) against the TDD, the implementer's report and the runtime-verify report. Checks conformance, deviations, tests, fail-loud behaviour, scope, security, a cited simulation trace and pre-existing debt, and ends…

cahenesy/throughline · 89 tokens

senior-developer

Use this agent when the user needs programming tasks executed, including feature implementation, refactoring, bug fixing, code reviews, or any code-related work. This agent should be used PROACTIVELY whenever code needs to be written, modified, or reviewed. It strictly follows Test-Driven Development…

jonase47/ccpr · 587 tokens