doctor

doctor is a command for coding agents from frenzymath/Archon. It costs 9 tokens per session (2,318 once invoked), scanned C, original, Apache-2.0.

A diagnostic and maintenance command for Lean 4 projects. Lean 4 is a programming language and proof assistant, while Lake is its build tool.

In plain words
What is it for?
Use it for full or environment-only checks, read-only migration checks, or to list and optionally remove stale files.
Why use it?
It helps identify missing tools, environment problems, old installations, and stale files when a Lean project is not working correctly.

Command

Part of the lean4 plugin — 1 skill, 11 commands, 4 agents, 3 hooks 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/frenzymath/archon/doctor
Clone the repo
git clone --depth 1 https://github.com/frenzymath/Archon

Or install lean4, the plugin that ships this one along with the rest of its 1 skill, 11 commands, 4 agents, 3 hooks.

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 doctor

README.md
[![agentmods](https://agentmods.dev/badge/commands/frenzymath/archon/doctor.svg)](https://agentmods.dev/commands/frenzymath/archon/doctor)
Your own site
<a href="https://agentmods.dev/commands/frenzymath/archon/doctor"><img src="https://agentmods.dev/badge/commands/frenzymath/archon/doctor.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,318 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00009 $0.02318
Opus 5 $0.00005 $0.01159
Sonnet 5 $0.00002 $0.00464
Haiku 4.5 $0.00001 $0.00232

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

Security

Grade C, and why

doctor scanned grade C with 1 finding 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 5d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Default: Report findings, show `rm -rf` commands, do NOT execute
src/archon/.archon-src/skills/lean4/commands/doctor.md · 281 lines

How it starts

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

Lean4 Doctor

Diagnostics, troubleshooting, and migration assistance for the Lean4 plugin.

Usage

/lean4:doctor                    # Full diagnostic (plugin + workspace)
/lean4:doctor env                # Environment only
/lean4:doctor migrate            # Detect legacy installs (read-only)
/lean4:doctor migrate --global   # Include user-level ~/.claude scan
/lean4:doctor cleanup            # Show stale files + removal commands
/lean4:doctor cleanup --apply    # Actually remove stale files

Inputs

Arg Required Description
mode No env, migrate, cleanup, or full (default)
--global No Include user-level paths (~/); migrate only
--apply No Execute removals; cleanup only

Actions

1. Environment Check

Tool Check Required
lean lean --version Yes
lake lake --version Yes
python3 python3 --version For scripts
git git --version For commits
rg rg --version Optional (faster search)

Environment variables: LEAN4_PLUGIN_ROOT, LEAN4_SCRIPTS, LEAN4_REFS, LEAN4_PYTHON_BIN

1b. MCP Tools

Check Detection Status
Lean LSP MCP lean_goal tool available in this session Optional (sub-second feedback)
✓ … available or ⚠ … unavailable — see INSTALLATION.md

2. Plugin Check

Verify structure and permissions:

plugins/lean4/
├── .claude-plugin/plugin.json
├── commands/     (*.md command files)
├── hooks/        (executable .sh)
├── skills/lean4/ (SKILL.md + references/)
├── agents/       (4 files)
└── lib/scripts/  (12 files, executable)

3. Project Check

  • lakefile.lean and lean-toolchain present
  • lake build passes
  • Sorry count reported

4. Migration Detection (read-only)

Detects legacy v3 artifacts without making changes.

Legacy plugin installs:

~/.claude/plugins/lean4-theorem-proving/
~/.claude/plugins/lean4-subagents/
~/.claude/plugins/lean4-memories/

Read the full file on GitHub · 281 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. 5d ago First seen · 281 lines · 9 tokens per session scan C 6379e132920b

Subscribe to this mod's changes

doctor is a command published in the GitHub repository frenzymath/Archon (214 stars, last pushed 19d ago), licensed Apache-2.0. It adds 9 tokens to every session and 2,318 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.