explain

A command that creates a single interactive HTML explainer about a codebase topic. It coordinates exploration, lesson planning, authoring, and assembly into an index.html file.

In plain words
What is it for?
Use it to explain how a system or feature works, run a full explainer workflow, or revise an existing explainer module.
Why use it?
It provides a repeatable path from a technical question to a browser-openable teaching page, using existing deep-dive context when available.

Command

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/josix/agent-flow/explain
Clone the repo
git clone --depth 1 https://github.com/josix/agent-flow
Per session 44 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,808 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 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.00044 $0.01808
Opus 5 $0.00022 $0.00904
Sonnet 5 $0.00009 $0.00362
Haiku 4.5 $0.00004 $0.00181

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

Security

Grade B, and why

explain scanned grade B 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 yesterday.

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.

Asks the agent to reveal its instructionsmediumSystem prompt leakage

Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.

$PHASE2_OUTPUT Instructions:
commands/explain.md · 199 lines

How it starts

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

Explain Command

Generate an interactive HTML explainer for a codebase topic. Riko gathers the relevant code scope, Senku designs a 3–5 screen teaching arc, Speedwagon authors the module brief and HTML fragment, and the assembler concatenates everything into explain-out/index.html — a file you can open directly in a browser.

Requires .claude/deep-dive.local.md (run /deep-dive first). The graphify knowledge graph (graphify-out/graph.json) is used if present; absent it degrades gracefully.

Argument Parsing

$ARGUMENTS is the raw argument string passed to this command.

  • If $ARGUMENTS is empty → print usage error and stop:
    Usage: /agent-flow:explain <topic>
    Example: /agent-flow:explain how does orchestration work
    Run /deep-dive first if you haven't already.
    
  • If $ARGUMENTS starts with --reviserevise mode: extract the slug from the argument (e.g. --revise orchestration-pipeline) and skip Phase 1–2 if the brief exists.
  • Otherwise → normal mode: $ARGUMENTS is the full topic string.

Slug derivation (compute once, use throughout all phases):

slug=$(echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-40)

Precondition Checks

Run these checks before dispatching any agents:

if [[ ! -f ".claude/deep-dive.local.md" ]]; then
  echo "Error: .claude/deep-dive.local.md not found."
  echo "Run /deep-dive first to build the codebase context."
  exit 1
fi

if [[ ! -f "graphify-out/graph.json" ]]; then
  echo "Note: graphify-out/graph.json not found. Continuing in degraded mode (no graph context)."
fi

Phase 1 — Scope (Riko)

Dispatch Riko with this prompt template, substituting $ARGUMENTS for TOPIC and the actual content of .claude/deep-dive.local.md for DEEP_DIVE_CONTEXT:

TOPIC: $ARGUMENTS

You are gathering code scope for a topic explainer. Your output will be consumed by
Senku (curriculum design) and Speedwagon (HTML authoring) — keep it structured.

Steps:
1. Read .claude/deep-dive.local.md for architecture context.
2. If graphify-out/graph.json exists, query for nodes related to the topic.
3. Identify 3–8 file:line refs directly relevant to the topic (concrete functions,
   types, or config values — not just filenames).
4. Identify 2–4 graph node names (or write "graph: unavailable" if graph absent).
5. Extract 3–6 key terminology terms specific to this topic.

Return structured markdown in exactly this format:

## Scope Bundle: $ARGUMENTS

### File References
- <file>:<start>-<end>  — <one-line description>
...

### Graph Nodes
- <node-name>
...  (or: graph: unavailable)

### Key Terminology
- <term>: <definition>
...

Read the full file on GitHub · 199 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. yesterday First seen · 199 lines · 44 tokens per session scan B c49edb9f0b48

Subscribe to this mod's changes

explain is a command published in the GitHub repository josix/agent-flow (7 stars, last pushed 17d ago), licensed MIT. It adds 44 tokens to every session and 1,808 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (asks the agent to reveal its instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.