memory-doctor

A diagnostic command for checking Architecture Decision Records (ADRs), which are documents that record important technical choices. It looks across project design documents for conflicting, repeated, or outdated decisions.

In plain words
What is it for?
Use it to review decision records, find conflicts and duplicates, and identify decisions that have been replaced.
Why use it?
It helps prevent teams from following contradictory or obsolete design choices as the project changes.

Command

Part of the plan-cascade plugin — 7 skills, 33 commands shipped together

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 commands/taoidle/plan-cascade/memory-doctor
Clone the repo
git clone --depth 1 https://github.com/Taoidle/plan-cascade

Or install plan-cascade, the plugin that ships this one along with the rest of its 7 skills, 33 commands.

Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 972 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 $0.00035 $0.00972
Opus 5 $0.00017 $0.00486
Sonnet 5 $0.00007 $0.00194
Haiku 4.5 $0.00003 $0.00097

Measured 3d ago against content hash d0b9d358f63a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-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 3d 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.

commands/memory-doctor.md · 113 lines

How it starts

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

Memory Doctor — 决策健康诊断

You are running a full diagnosis on all Architecture Decision Records (ADRs) across the project's design documents.

Step 1: Collect and Diagnose All Decisions

CRITICAL: Use Bash to run the memory doctor script in full diagnosis mode:

uv run python "${CLAUDE_PLUGIN_ROOT}/skills/hybrid-ralph/scripts/memory-doctor.py" \
  --mode full \
  --project-root "$(pwd)"

This script collects all decisions from every design_doc.json in the project (root, worktrees, feature directories) and uses LLM to detect conflicts, superseded entries, and semantic duplicates.

Exit code handling:

  • Exit 0: No issues found, or no decisions to check — display "No issues found" and stop here
  • Exit 1: Diagnosis issues found — proceed to Step 2
  • Exit 2 (or script crash/traceback): Infrastructure error. Common causes:
    • No API key configured — tell the user to set ANTHROPIC_API_KEY, OPENAI_API_KEY, or DEEPSEEK_API_KEY
    • No design_doc.json files found in the project
    • Display the error message and stop here

Step 2: Display Diagnosis Report

Display the full diagnosis report from Step 1 output. The report groups findings by type:

  • 🔴 CONFLICT: Contradictory decisions on the same concern
  • 🟠 SUPERSEDED: A newer decision covers the scope of an older one
  • 🟡 DUPLICATE: Semantically identical decisions with different wording

Step 3: Interactive Resolution

CRITICAL: For each diagnosis finding, use AskUserQuestion to let the user choose an action:

For CONFLICT findings:

  • Deprecate — Mark the older decision as deprecated (recommended)
  • Skip — Keep both decisions as-is

For SUPERSEDED findings:

  • Deprecate — Mark the superseded decision as deprecated (recommended)
  • Skip — Keep both decisions as-is

For DUPLICATE findings:

  • Merge — Keep one decision, remove the duplicate (recommended)
  • Skip — Keep both decisions as-is

Present each finding with its explanation and suggestion from the diagnosis report. Example question:

Read the full file on GitHub · 113 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. 3d ago First seen · 113 lines · 35 tokens per session scan A d0b9d358f63a

Subscribe to this mod's changes

memory-doctor is a command published in the GitHub repository Taoidle/plan-cascade (131 stars, last pushed 5mo ago), licensed MIT. It adds 35 tokens to every session and 972 once invoked, about $0.0002 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.