thepopebot: Command for Claude Code

.claude/commands/optimize-claudemd.md

optimize-claudemd is a command for Claude Code from stephengpope/thepopebot. It costs 14 tokens per session (707 once invoked), scanned A, original, MIT.

A command that examines CLAUDE.md instruction files, which tell Claude how to work in a code repository, and creates an improvement plan. It analyzes their contents, history, and whether they still match the codebase.

In plain words
What is it for?
Use it to locate CLAUDE.md files, check when they were last changed, compare them with recent code changes, and produce a documentation-improvement task list.
Why use it?
It helps find outdated, missing, duplicated, or misplaced project instructions without changing any files.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions CLAUDE.md.

This is stephengpope/thepopebot's own configuration. It tells Claude Code how to work on thepopebot itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything thepopebot configures →

About the project

The Pope Bot is an app for configuring an autonomous AI agent that can chat, run coding work, and operate continuously through connected language models and coding agents. People use it for questions, code changes, background development jobs, and live browser-based coding sessions. Its catalogue add-ons extend the bot with commands, skills, and operating instructions.

stephengpope/thepopebot · 1,860 stars · on GitHub · skool.com

Reuse

Borrowing it

Nothing to install: this file belongs to stephengpope/thepopebot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/stephengpope/thepopebot/main/.claude/commands/optimize-claudemd.md
Clone the repo
git clone --depth 1 https://github.com/stephengpope/thepopebot

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 optimize-claudemd

README.md
[![agentmods](https://agentmods.dev/badge/commands/stephengpope/thepopebot/optimize-claudemd/github.svg)](https://agentmods.dev/commands/stephengpope/thepopebot/optimize-claudemd)
Your own site
<a href="https://agentmods.dev/commands/stephengpope/thepopebot/optimize-claudemd"><img src="https://agentmods.dev/badge/commands/stephengpope/thepopebot/optimize-claudemd/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 optimize-claudemd

Your own site · 80×15
<a href="https://agentmods.dev/commands/stephengpope/thepopebot/optimize-claudemd"><img src="https://agentmods.dev/badge/commands/stephengpope/thepopebot/optimize-claudemd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 707 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.00014 $0.00707
Opus 5 $0.00007 $0.00353
Sonnet 5 $0.00003 $0.00141
Haiku 4.5 $0.00001 $0.00071

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

Security

Grade A, and why

optimize-claudemd 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 9d 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.

.claude/commands/optimize-claudemd.md · 52 lines

How it starts

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

Enter plan mode first. Do NOT edit any files — this command only produces an analysis and a todo list. The user will decide what to implement.

Follow these steps IN ORDER. The sequence matters — you must understand what's changed in the codebase before you can judge what the CLAUDE.md files should contain.

Step 1 — Discover all CLAUDE.md files and their ages

Find every CLAUDE.md file in the project. For each one, read its full contents and use git to find when it was last modified.

Special case — templates/: This directory should only have two CLAUDE.md-related files. templates/CLAUDE.md guides Claude when working on template files in this package's source code. templates/CLAUDE.md.template (or similar .template extension) gets scaffolded into end-user projects and should be designed for a Claude session working inside their project, not this repo. Flag any other CLAUDE.md files in the templates tree as unnecessary.

Step 2 — Detect codebase changes and identify gaps

This is the most important step. For each CLAUDE.md file, use git to figure out what code has changed in its relevant scope since it was last modified. The goal is a clear picture of what's new, changed, or removed.

What to look for:

  • New directories, modules, API routes, server actions, or endpoints not documented anywhere
  • Changed or new package.json exports that affect how code is imported
  • Schema changes (new tables, columns, relationships)
  • Architectural shifts (new patterns, deprecated approaches, refactored modules)
  • Deleted or moved files that are still referenced in CLAUDE.md
  • New patterns or conventions that Claude would get wrong without guidance

For each gap, apply the litmus test: "Would Claude make mistakes without knowing this?" If yes, it's high priority.

Step 3 — Audit existing content against best practices

NOW evaluate each CLAUDE.md for quality — informed by what you learned in Step 2.

Root CLAUDE.md

Size budget: under 200 lines. Count current lines and flag if over budget.

Read the full file on GitHub · 52 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. 9d ago First seen · 52 lines · 14 tokens per session scan A aba2ad001f5c

Subscribe to this mod's changes

optimize-claudemd is a command published in the GitHub repository stephengpope/thepopebot (1,860 stars, last pushed 3mo ago), licensed MIT. It adds 14 tokens to every session and 707 once invoked, about $0.0001 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.