No slash command · from Agent Flow
Collapses multiple inputs (from runs, files, or inline data) into one digest (markdown or JSON) using a single agent. Best for synthesizing many results into one report.
Ships in Agent Flow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Make it visible: the moment you start, say so in one line (skill + run-id) so it's clear an Agent Flow run is happening;
/agentflow:boardthen lists every run on disk — the audit trail.
Portable bundle. To use this skill in another project, copy:
${CLAUDE_PLUGIN_ROOT}/skills/reduce/(this folder: SKILL.md + defaults.md)${CLAUDE_PLUGIN_ROOT}/dist/(common.js,state/reduce.js) — shared framework${CLAUDE_PLUGIN_ROOT}/dist/hook/continue.js— generalized Stop hook- the Stop hook is wired automatically by the plugin (hooks/hooks.json)
You are the orchestrator of a /agentflow:reduce run. Job:
Single-step primitive: no fan-out, no per-item parallelism. /agentflow:reduce is the "fold" of the toolkit — N in, 1 out.
/agentflow:reduce --inputs <descriptors.json> --prompt "<digest instructions>" \
[--output-format markdown|json] [--model haiku|sonnet|opus] [--run-id NAME] [--no-auto-continue]
--inputs is a JSON array of input descriptors:
[
{"source": "run", "cmd": "foreach", "run_id": "…"},
{"source": "file", "path": "./extra-data.json"},
{"source": "inline", "data": {"note": "…"}}
]
--prompt (alias --task-prompt) is the synthesis instruction; --output-format defaults to
markdown. If neither --inputs nor --prompt is given → stop with a clear message.
Read ${CLAUDE_PLUGIN_ROOT}/skills/reduce/defaults.md (YAML frontmatter). Use defaults when CLI/spec do not provide a value.
Override priority (high → low): CLI flag > defaults.md > the state helper's built-in fallback.
--inputs (a descriptors file) and --prompt are present.run-id is missing: derive reduce-<8 char hash> from the inputs descriptor + prompt.Validate inputs:
source in {run, file, inline}, with the right field (run_id, path, data).run inputs: verify the referenced state exists (run node "${CLAUDE_PLUGIN_ROOT}/dist/state/<cmd>.js" status <run-id>). Warn if the upstream run has failed items but proceed (the digest agent will see them as result: null).Threshold guardrail (autonomous invocation only): after resolving inputs, count the total result objects (sum of done items across run inputs + length of file inputs + length of inline inputs). If total < min_inputs (default 5) AND this is an autonomous invocation, STOP and use AskUserQuestion:
"Only total inputs to reduce. For this size, summarizing inline in chat is usually faster than running /agentflow:reduce (which dispatches an agent and writes a file). Proceed with /agentflow:reduce?" Options: inline (cancel /agentflow:reduce, summarize directly in chat) | proceed (continue with /agentflow:reduce)
If the user typed /agentflow:reduce explicitly → skip the guardrail.
Write the inputs descriptor to .agentflow/reduce/<run-id>/inputs-spec.json (the parsed list). Then:
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" init <run-id> \
--inputs .agentflow/reduce/<run-id>/inputs-spec.json \
--task-prompt "<task-prompt>" \
--model <model> --output-format <markdown|json> \
--max-auto-continues <N> \
[--auto-continue|--no-auto-continue] \
[--force]
If the run-id exists without --force: ask the user resume (re-dispatch the agent if not done) or reset (start over). DO NOT overwrite without confirmation.
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" materialize <run-id> \
--out .agentflow/reduce/<run-id>/inputs.json
This walks every input descriptor and produces a single JSON the agent will read. Run-typed inputs only include items with status == done (others appear with result: null).
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" start <run-id>
Launch ONE Agent (no fan-out). The prompt is self-contained:
subagent_type: from config (default general-purpose)model: from config if not inherit, otherwise omitteddescription: reduce:<run-id>prompt:
.agentflow/reduce/<run-id>/inputs.json (read this with the Read tool)./<run-id>.<md|json> — a visible file in the workspace root (extension
matches output_format), so the digest is easy to find and commit instead of being buried under
.agentflow/. Only the internal materialized inputs live under .agentflow/reduce/<run-id>/. Pick a
descriptive --run-id (Step 2) so the filename reads well — e.g. audit-digest → audit-digest.md.Write tool. The file MUST be ONLY the digest — no preamble, no markdown fence around the whole thing (markdown content inside is fine for format: markdown)."format: json: the file MUST be valid JSON, no prose, no fence."OK <bytes-written>. Nothing else."6a. Budget: the Agent return includes a <usage>total_tokens: N ...</usage> block. Record it:
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" budget-add <run-id> \
--tokens <total_tokens_from_agent_usage> \
--model <model_from_config> \
--event-type agent_dispatch
6b. Commit
If the agent returned OK and the output file exists:
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" complete <run-id> \
--output-path ./<run-id>.<md|json>
Otherwise:
node "${CLAUDE_PLUGIN_ROOT}/dist/state/reduce.js" fail <run-id> --error "<short reason>"
If auto_continue == true and we failed mid-way (no output file), the Stop hook will re-trigger the next turn — re-dispatch from Step 4. The auto_continues cap (default 5) bounds the retry budget.
Print a one-liner: run-id, status, output_pointer (the visible ./<run-id>.<ext> file), byte size of the digest, model used. If format: markdown, optionally Read the first 30 lines and show them inline so the user does not have to open the file.
A Stop hook (${CLAUDE_PLUGIN_ROOT}/dist/hook/continue.js) scans .agentflow/reduce/ (alongside other primitives). For /agentflow:reduce, "residual work" = status in {"pending", "in_progress"} AND auto_continues < max_auto_continues. If you are re-activated by the hook with a /agentflow:reduce run-id:
status == in_progress and the output file is absent → re-dispatch (Step 5).complete (Step 6).start/complete/fail. The agent only writes the output file.inputs.json is built at init; if upstream runs change, the user must call --force to rebuild.complete is called, or it stays failed. Half-written outputs are discarded by complete (it requires the file to exist)./agentflow:reduce with the same run-id without --force resumes (re-dispatches if needed).# inputs.json: [{"source":"run","cmd":"foreach","run_id":"review-cs"}]
/agentflow:reduce --inputs inputs.json --model opus --output-format markdown \
--prompt "Group findings by severity. Top-5 hotspot files. Recurring patterns."
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub alesaiani/agentflow --plugin agentflow23 skills in this plugin
/auditDeep code-audit recipe: discover files in a target → review each (LLM, cached) → partition by
component → executive digest with hotspots and recurring patterns. A layer-3 recipe over /agentflow:pipe
(the 6-stage pipeline and caching are detailed in the body).
USE when the user asks to "review / audit / find bugs across" a folder, repo, or glob and wants a
persisted, structured report — and the target is large enough (≥ ~10 files) that per-file parallelism
plus a digest beats reading inline.
DON'T use for a few named files (read them inline), exploratory questions ("what does this do?"), or
generic per-item work that isn't a code review (→ /agentflow:foreach).
Not a `/`-menu command — it's the shipped `workflows/audit/` recipe: reach it by asking ("audit src
for bugs"), or run it directly with `/agentflow:run-workflow workflows/audit/WORKFLOW.md`.
/boardWorkspace dashboard: lists every active framework run across all primitives, highlights blockers (stuck items, exhausted auto-continue caps), shows cumulative cost, and suggests the next action. The natural command to run after re-opening Claude Code in a workspace with in-flight runs, or whenever the user wants a one-shot overview of "what's going on".
USE this skill when:
- the user has just (re)opened the workspace and wants to know what is in flight;
- the user says "what's going on", "show me everything", "any active runs", "where are we", "any pipelines running";
- the user wants a one-shot health check + suggested next action.
DON'T use this to inspect a specific run in depth (use `/agentflow:inspect show <id>` or `tree <id>`), or
to modify state (board is read-only). Explicit: `/agentflow:board` or `/agentflow:board --json`.