/ashlr-spawn
Spawn a named delegation pattern as one or more sub-agents. Patterns defined in _spawn-patterns.json.
Spawn a named delegation pattern using _spawn-patterns.json.
Patterns available
triage-issues— classify open issues by severity / label / age (haiku, batch)refactor-files— apply a described refactor across a file list (sonnet, parallel-per-file)codebase-explain— explain a codebase area with key files + flow (haiku, tiered)pr-review-sweep— review all changed files in a PR (sonnet, parallel-per-file-changed)parallel-test-fix— fix failing tests across multiple files (sonnet, parallel-per-file)
Argument convention
- First positional token after
/ashlr-spawnis the pattern name. - Everything after the pattern name is the args string, passed verbatim to the prompt template as
{{args}}. - For file-fanout patterns (
refactor-files,parallel-test-fix), additional tokens that look like file paths (contain/or.) are collected into{{files}}; the remaining tokens form{{args}}.
Examples:
Steps
-
Parse
$ARGUMENTS:- Extract the pattern name (first token).
- Collect remaining tokens: file-path-like tokens →
{{files}}; everything else →{{args}}.
-
Read
commands/_spawn-patterns.json(path:${CLAUDE_PLUGIN_ROOT}/commands/_spawn-patterns.json). If the file is missing, error: "_spawn-patterns.json not found — run from the plugin root." -
Look up the pattern. If not found, print: "Unknown pattern
<name>. Available: triage-issues, refactor-files, codebase-explain, pr-review-sweep, parallel-test-fix" and stop. -
Render the
prompt_templateby substituting{{args}}and{{files}}with the parsed values (empty string if not provided). -
Apply
fanout_strategy:batch— spawn one Agent withsubagent_typefrom the pattern, passing the rendered prompt.parallel-per-file— spawn one Agent per file in{{files}}, each with the same rendered prompt focused on that single file. Collect results.parallel-per-file-changed— usegit diff --name-only origin/main...HEADto get the changed file list, then spawn one Agent per file.tiered— spawn Phase 1ashlr:ashlr:exploreagent, then pass its output to Phase 2ashlr:ashlr:codeagent for deeper analysis.
-
Wait for all agents to complete.
-
Print a merged report:
- Header:
## /ashlr-spawn <pattern> — <N> agent(s) completed - One section per agent output (for multi-agent fanouts, titled by file name).
- Footer: total agents spawned, pattern used, fanout strategy.
- Header:
If $ARGUMENTS is empty, print the patterns list and stop.