ashlr

/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

/ashlr-parallelize <task> <file1> [file2] [file3] ... [--code]
  • <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, use ashlr:ashlr:code (sonnet) agents instead of the default ashlr:ashlr:explore (haiku) agents. Use --code when the task requires edits; omit for read-only analysis.

Examples

/ashlr-parallelize "explain what this module exports" servers/_pid-alive.ts servers/_run-with-timeout.ts
/ashlr-parallelize "find all TODO comments and summarize them" hooks/pretooluse-read.ts hooks/pretooluse-bash.ts
/ashlr-parallelize --code "add JSDoc to all exported functions" servers/read-server.ts servers/grep-server.ts

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

  1. Parse $ARGUMENTS:

    • Detect --code flag (remove from argument list before further parsing).
    • Determine subagent_type: ashlr:ashlr:code if --code, else ashlr: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] ..."
  2. For each file, construct an agent prompt:

    Task: <task>
    
    File: <file_path>
    
    Focus exclusively on this file. Do not read other files unless they are direct imports needed to answer the task. Keep your response under 300 words. Cite file:line for every claim.
  3. Spawn all agents in parallel via the Agent tool — one per file — each with subagent_type as determined in step 1.

  4. Wait for all agents to complete.

  5. Print merged report:

    ## /ashlr-parallelize — <N> agents · task: <task>
    
    ### <file1>
    <agent 1 output>
    
    ### <file2>
    <agent 2 output>
    
    ---
    Agents: <N> · subagent_type: <type> · files: <list>

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.

## /ashlr-parallelize — 2 agents · task: explain what this module exports

### servers/_pid-alive.ts
Exports `pidAlive`, which checks whether a process is alive (servers/_pid-alive.ts:18).

### servers/_run-with-timeout.ts
Exports the `RunWithTimeoutOptions` interface (servers/_run-with-timeout.ts:76), the `RunWithTimeoutResult` interface (servers/_run-with-timeout.ts:93), and `runWithTimeout` to run a subprocess with a timeout (servers/_run-with-timeout.ts:142).

---
Agents: 2 · subagent_type: ashlr:ashlr:explore · files: servers/_pid-alive.ts, servers/_run-with-timeout.ts

Reuses agent definitions from agents/ashlr-explore.md (default) and agents/ashlr-code.md (--code).

On this page