/ashlr-parallelize
Spawn N parallel sub-agents — one per file — each applying the same task instruction. Merges results into a unified report.
Spawn one sub-agent per file, all running the same task in parallel, then merge their outputs.
Usage
<task>— the instruction to apply to each file (quoted string or unquoted phrase ending before the first file path).<file1> [file2] ...— one or more file paths (contain/or.or start with__).--code— optional flag. When present, useashlr:ashlr:code(sonnet) agents instead of the defaultashlr:ashlr:explore(haiku) agents. Use--codewhen the task requires edits; omit for read-only analysis.
Examples
In the first example, "explain what this module exports" is the shared task
prompt. servers/_pid-alive.ts and servers/_run-with-timeout.ts are separate
file arguments, so two agents each apply that prompt to one file. The third
example adds --code to select agents that can make the requested edits.
Steps
-
Parse
$ARGUMENTS:- Detect
--codeflag (remove from argument list before further parsing). - Determine
subagent_type:ashlr:ashlr:codeif--code, elseashlr:ashlr:explore. - Split remaining tokens: file-path-like tokens (contain
/,., or start with__) → file list; everything before the first file path → task string. - If no files are found, error: "No files specified. Usage: /ashlr-parallelize
<task><file1>[file2] ..." - If task string is empty, error: "No task specified. Usage: /ashlr-parallelize
<task><file1>[file2] ..."
- Detect
-
For each file, construct an agent prompt:
-
Spawn all agents in parallel via the Agent tool — one per file — each with
subagent_typeas determined in step 1. -
Wait for all agents to complete.
-
Print merged report:
Illustrative output
For the first invocation above, an illustrative merged report might look like
this when run from this repository. The task, file paths, agent count, output,
and citations are example values; actual agent wording can vary, and line
numbers can change as the files evolve. The footer shows the default explore
agent type; with --code, it would show ashlr:ashlr:code instead.
Reuses agent definitions from agents/ashlr-explore.md (default) and agents/ashlr-code.md (--code).