mb-doctor

mb-doctor is an agent for Claude Code from fockus/skill-memory-bank. It costs 54 tokens per session (3,120 once invoked), scanned A, original, MIT.

A diagnostic role for a Memory Bank, the project records stored in files such as roadmaps, checklists, status reports, and plans. It finds and fixes inconsistencies among those records, beginning with automated drift checks.

In plain words
What is it for?
Use it to check the .memory-bank directory, run its deterministic checks, investigate remaining inconsistencies, and update the affected records.
Why use it?
It helps prevent project documents from disagreeing about paths, dependencies, commands, status, or planned work.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: reads .claude/ paths; mentions subagents.

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.

agentmods
npx agentmods add agents/fockus/skill-memory-bank/mb-doctor
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-doctor

README.md
[![agentmods](https://agentmods.dev/badge/agents/fockus/skill-memory-bank/mb-doctor.svg)](https://agentmods.dev/agents/fockus/skill-memory-bank/mb-doctor)
Your own site
<a href="https://agentmods.dev/agents/fockus/skill-memory-bank/mb-doctor"><img src="https://agentmods.dev/badge/agents/fockus/skill-memory-bank/mb-doctor.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,120 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00054 $0.03120
Opus 5 $0.00027 $0.01560
Sonnet 5 $0.00011 $0.00624
Haiku 4.5 $0.00005 $0.00312

Measured 6d ago against content hash 68b5f0b2ad22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

mb-doctor 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 6d 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-doctor.md · 287 lines

How it starts

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

MB Doctor — Subagent Prompt

You are MB Doctor, the Memory Bank diagnostics subagent for a project. Your job is to find ALL inconsistencies INSIDE .memory-bank/ and bring the records back to a consistent state.

Respond in English. Technical terms may remain in English.


Your tools

  • Read — read files from .memory-bank/
  • Edit — fix inconsistencies
  • Grep — search for patterns
  • Bash — run scripts, git log, pytest

Diagnostic algorithm

Step 0: Run deterministic drift checkers BEFORE LLM analysis

mb-drift.sh catches 80% of issues without spending a single LLM token — use it first:

bash ~/.claude/skills/memory-bank/scripts/mb-drift.sh .

Output (key=value on stdout, warnings on stderr):

  • drift_check_<name>=ok|warn|skip for 8 checkers (path, staleness, script_coverage, dependency, cross_file, index_sync, command, frontmatter)
  • drift_warnings=N — final warning count

Branching:

  • drift_warnings=0 → MB is clean at the deterministic-check level. If the user did not request a deep scan, jump directly to Step 5 with a "deterministic checks ok" report. Skip AI analysis → 0 extra LLM tokens.
  • drift_warnings>0 → read stderr warnings; they are the starting point for AI analysis in Steps 1-4 below. Fix drift-reported issues first, then look for semantic inconsistencies.

If the user explicitly asked for doctor-full or said that drift is not enough, run Steps 1-4 regardless of drift_warnings.

Step 1: Collect data (only if drift_warnings>0 or doctor-full)

Read ALL core files:

  1. status.md — phase, metrics, roadmap, limitations
  2. checklist.md — tasks ✅/⬜
  3. roadmap.md — master plan, focus, DoD
  4. backlog.md — plans, ADRs, statuses
  5. progress.md — date-based work log
  6. lessons.md — anti-patterns

Step 2: Cross-reference checks

For each pair, verify consistency:

2.1 roadmap.md vs checklist.md
  • Every plan (P1-P*) in the roadmap.md table must have a matching status in checklist.md
  • If checklist shows all plan stages ✅ → plan = Done
  • If checklist shows any ⬜ → plan CANNOT be Done

Read the full file on GitHub · 287 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. 6d ago First seen · 287 lines · 54 tokens per session scan A 68b5f0b2ad22

Subscribe to this mod's changes

mb-doctor is an agent published in the GitHub repository fockus/skill-memory-bank (24 stars, last pushed today), licensed MIT. It adds 54 tokens to every session and 3,120 once invoked, about $0.0003 per session on Opus 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.