一键导入
decompose
Recursively decompose a task into sub-plans with dependency ordering, then execute in topological waves
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Recursively decompose a task into sub-plans with dependency ordering, then execute in topological waves
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Debug issues using E2E tests, log analysis, and dev server management
Query ClickHouse observability logs over HTTP API
Iterate on bug hypotheses using Playwright repro scripts, structured logs, and source code analysis
Address unresolved inline diff comments and mark them resolved
Run a long task across multiple agent contexts using breadcrumb progress files
Orchestrate multiple agents programmatically using anvil-repl
| name | decompose |
| description | Recursively decompose a task into sub-plans with dependency ordering, then execute in topological waves |
| user-invocable | true |
Break a complex task into sub-plans with explicit dependencies, then execute them in topological waves using anvil-repl. Every agent — root or child — runs this same algorithm.
decompose(plan_path):
1. Read the plan file
2. If I can implement this directly → do it, write .result.md, done
3. Otherwise → decompose into sub-plans with a dependency table
4. Compute topological waves from the dependency graph
5. Execute wave by wave (full parallelism within each wave)
6. Summarize results
Given the user's task in $ARGUMENTS:
$ARGUMENTS is a path to an existing .md file → use it directly (you're a child executing a sub-plan)plans/<task-slug>/readme.md with the task descriptionRead the plan file. If you're a child with dependencies, also read the dependency table from your parent's readme.md and load any .result.md files for your upstream dependencies. These give you context about what prior tasks produced.
Base case check: Can you implement this task directly in a single agent context? Consider:
If yes → implement it directly, then write your result (see "Writing Results" below). You're done.
If no → proceed to decomposition.
Create numbered sub-plan files in the same directory as your plan:
<plan-dir>/
readme.md # Your plan + dependency table
01-setup-database.md # Sub-plan
02-auth-module.md # Sub-plan
03-api-endpoints.md # Sub-plan (depends on 01, 02)
Each sub-plan file should describe what needs to happen, not how. Include enough context for an independent agent to understand the goal, constraints, and expected outputs.
Then add a dependency table to your readme.md:
## Dependencies
| Sub-Plan | Depends On | Status |
|----------|-----------|--------|
| 01-setup-database | — | pending |
| 02-auth-module | — | pending |
| 03-api-endpoints | 01-setup-database, 02-auth-module | blocked |
Status values:
pending — ready to execute (no unmet dependencies)in-progress — currently being executedcompleted — finished successfullyblocked — waiting on incomplete dependenciesfailed — execution failedA sub-plan is blocked when any dependency has not completed. When all dependencies complete, update it to pending.
Read the dependency table you just wrote. Determine which tasks can run in parallel by reasoning about the dependency graph:
anvil-repl script that spawns the wave's tasks in parallel:The slash command must be the first thing in the prompt. Claude Code only auto-expands skills into
<command-name>tags when the/commandappears at the start of the message. If buried mid-sentence, the agent must make an extra Skill tool call to load the skill content.
anvil-repl <<'ANVIL_REPL'
const results = await Promise.all([
anvil.spawn({ prompt: "/anvil:decompose plans/my-task/01-setup-database.md" }),
anvil.spawn({ prompt: "/anvil:decompose plans/my-task/02-auth-module.md" }),
]);
return results.map((r, i) => `Task ${i + 1}: ${r.slice(0, 200)}`).join("\n");
ANVIL_REPL
Between waves, use your normal tools (Read/Edit/Write) to:
.result.md files for each completed taskreadme.mdblocked → pending for tasks whose deps all completed)Repeat for each subsequent wave until all tasks are done or blocked by failures.
Important: Do NOT write file-parsing, topological-sorting, or status-update code in the REPL. You can read and reason about the dependency table yourself. The REPL is only for anvil.spawn() calls with Promise.all.
When you finish (either by implementing directly or after orchestrating sub-plans), write a .result.md file summarizing what was accomplished. If you're a child agent, this file is how your parent and downstream siblings learn what you produced.
The result file should include:
If implementing directly (base case): write <plan-dir>/<your-plan-name>.result.md as a sibling to the sub-plan file that was assigned to you. The parent orchestrator handles writing this for children spawned via anvil-repl, but if you are the root agent implementing directly, write it yourself.
If you decomposed: your result is the summary of all sub-task results.
When a child agent is spawned on a sub-plan, it discovers its own context:
readme.md to find the dependency table.result.md files for those dependencies (they exist because the parent only spawns you after your deps complete)This means children are self-orienting — the orchestrator doesn't need to pass context explicitly.
If a child decides its sub-plan needs further breakdown, it creates a subdirectory:
<plan-dir>/
readme.md
01-setup-database.md
02-auth-module/ # Child decomposed further
readme.md # Its own dependency table
01-password-hashing.md
02-session-management.md
03-middleware.md
03-api-endpoints.md
The child replaces its .md file with a directory of the same name (minus extension), creates its own readme.md with a dependency table, and runs the same wave-based execution. The recursion is natural.
failed in the dependency table and log the errorblocked — they are not executed.md files. Results are .result.md files. Children read their own context from the filesystem.readme.md. No race conditions.