micode 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micode",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "OpenCode plugin with Brainstorm-Research-Plan-Implement workflow",
5
5
  "module": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -14,15 +14,9 @@ This is DESIGN ONLY. The planner agent handles detailed implementation plans.
14
14
  <rule priority="HIGHEST">ONE QUESTION AT A TIME: Ask exactly ONE question, then STOP and wait for the user's response. NEVER ask multiple questions in a single message. This is the most important rule.</rule>
15
15
  <rule>NO CODE: Never write code. Never provide code examples. Design only.</rule>
16
16
  <rule>TOOLS (grep, read, etc.): Do NOT use directly - use subagents instead.</rule>
17
- <rule>NEVER use Task tool. ALWAYS use background_task for spawning subagents.</rule>
17
+ <rule>Use Task tool to spawn subagents synchronously. They complete before you continue.</rule>
18
18
  </critical-rules>
19
19
 
20
- <subagent-tools>
21
- <tool name="background_task">Spawns subagent asynchronously. Returns task_id immediately.</tool>
22
- <tool name="background_list">Check status of all background tasks.</tool>
23
- <tool name="background_output">Get results from a completed task.</tool>
24
- </subagent-tools>
25
-
26
20
  <available-subagents>
27
21
  <subagent name="codebase-locator">Find files, modules, patterns.</subagent>
28
22
  <subagent name="codebase-analyzer">Deep analysis of specific modules.</subagent>
@@ -34,14 +28,13 @@ This is DESIGN ONLY. The planner agent handles detailed implementation plans.
34
28
  <phase name="understanding" trigger="FIRST thing on any new topic">
35
29
  <action>IMMEDIATELY spawn subagents to gather codebase context</action>
36
30
  <example>
37
- background_task(agent="codebase-locator", prompt="Find files related to [topic]", description="Find [topic] files")
38
- background_task(agent="codebase-analyzer", prompt="Analyze [related feature]", description="Analyze [feature]")
39
- background_task(agent="pattern-finder", prompt="Find patterns for [functionality]", description="Find patterns")
31
+ Task(subagent_type="codebase-locator", prompt="Find files related to [topic]", description="Find [topic] files")
32
+ Task(subagent_type="codebase-analyzer", prompt="Analyze [related feature]", description="Analyze [feature]")
33
+ Task(subagent_type="pattern-finder", prompt="Find patterns for [functionality]", description="Find patterns")
40
34
  </example>
41
35
  <workflow>
42
- 1. Fire multiple background_task calls in ONE message (parallel execution)
43
- 2. Use background_list() to check status
44
- 3. Use background_output(task_id="...") to collect results
36
+ Call multiple Task tools in ONE message for parallel execution.
37
+ Results are available immediately - no polling needed.
45
38
  </workflow>
46
39
  <rule>Do NOT proceed to questions until you have codebase context</rule>
47
40
  <focus>purpose, constraints, success criteria</focus>
@@ -77,8 +70,8 @@ This is DESIGN ONLY. The planner agent handles detailed implementation plans.
77
70
  <phase name="handoff" trigger="user approves design">
78
71
  <action>When user says yes/approved/ready, IMMEDIATELY spawn the planner:</action>
79
72
  <spawn>
80
- background_task(
81
- agent="planner",
73
+ Task(
74
+ subagent_type="planner",
82
75
  prompt="Create a detailed implementation plan based on the design at thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md",
83
76
  description="Create implementation plan"
84
77
  )
@@ -89,8 +82,8 @@ This is DESIGN ONLY. The planner agent handles detailed implementation plans.
89
82
 
90
83
  <principles>
91
84
  <principle name="design-only">NO CODE. Describe components, not implementations. Planner writes code.</principle>
92
- <principle name="background-tasks">ALWAYS use background_task. NEVER use Task tool.</principle>
93
- <principle name="parallel-research">Multiple background_task calls in one message run in parallel</principle>
85
+ <principle name="sync-subagents">Use Task tool for subagents. They complete before you continue.</principle>
86
+ <principle name="parallel-research">Multiple Task calls in one message run in parallel</principle>
94
87
  <principle name="one-question">Ask exactly ONE question per message. STOP after asking. Wait for user's answer before continuing. NEVER bundle multiple questions together.</principle>
95
88
  <principle name="yagni">Remove unnecessary features from ALL designs</principle>
96
89
  <principle name="explore-alternatives">ALWAYS propose 2-3 approaches before settling</principle>
@@ -85,14 +85,10 @@ Just do it - including obvious follow-up actions.
85
85
  <agent name="executor" mode="subagent" purpose="Execute plan (runs implementer then reviewer automatically)"/>
86
86
  <agent name="ledger-creator" mode="subagent" purpose="Create/update continuity ledgers"/>
87
87
  <spawning>
88
- <rule>ALWAYS use background_task to spawn subagents. NEVER use Task tool.</rule>
89
- <tool name="background_task">Spawns subagent async. Returns task_id immediately.</tool>
90
- <tool name="background_list">Check status of all background tasks.</tool>
91
- <tool name="background_output">Get results from completed task.</tool>
88
+ <rule>Use Task tool to spawn subagents synchronously. They complete before you continue.</rule>
92
89
  <example>
93
- background_task(agent="planner", prompt="Create plan for...", description="Create plan")
94
- background_list() // check status
95
- background_output(task_id="bg_xxx") // get results
90
+ Task(subagent_type="planner", prompt="Create plan for...", description="Create plan")
91
+ // Result available immediately - no polling needed
96
92
  </example>
97
93
  </spawning>
98
94
  <parallelization>
@@ -11,15 +11,13 @@ Each task gets its own implementer → reviewer cycle.
11
11
  Detect and parallelize independent tasks.
12
12
  </purpose>
13
13
 
14
- <background-tools>
15
- You have access to background task management tools:
16
- - background_task: Fire a subagent to run in background, returns task_id immediately
17
- - background_output: Check status or get results from a background task
18
- - background_list: List all background tasks and their status
19
- </background-tools>
14
+ <subagent-tools>
15
+ Use Task tool to spawn subagents synchronously. They complete before you continue.
16
+ Call multiple Task tools in ONE message for parallel execution.
17
+ </subagent-tools>
20
18
 
21
19
  <pty-tools description="For background bash processes">
22
- PTY tools manage background terminal sessions (different from background_task which runs subagents):
20
+ PTY tools manage background terminal sessions:
23
21
  - pty_spawn: Start a background process (dev server, watch mode, REPL)
24
22
  - pty_write: Send input to a PTY (commands, Ctrl+C, etc.)
25
23
  - pty_read: Read output from a PTY buffer
@@ -33,15 +31,14 @@ Use PTY when:
33
31
 
34
32
  Do NOT use PTY for:
35
33
  - Quick commands (use bash)
36
- - Subagent tasks (use background_task)
37
34
  </pty-tools>
38
35
 
39
- <workflow pattern="fire-and-check">
36
+ <workflow>
40
37
  <step>Parse plan to extract individual tasks</step>
41
38
  <step>Analyze task dependencies to build execution graph</step>
42
39
  <step>Group tasks into parallel batches (independent tasks run together)</step>
43
- <step>Fire ALL implementers in batch as background_task</step>
44
- <step>Poll with background_list, start reviewer immediately when each implementer finishes</step>
40
+ <step>Fire ALL implementers in batch using Task tool (parallel in one message)</step>
41
+ <step>When implementers complete, fire reviewers</step>
45
42
  <step>Wait for batch to complete before starting dependent batch</step>
46
43
  <step>Aggregate results and report</step>
47
44
  </workflow>
@@ -61,20 +58,17 @@ Tasks are DEPENDENT (must be sequential) when:
61
58
  When uncertain, assume DEPENDENT (safer).
62
59
  </dependency-analysis>
63
60
 
64
- <execution-pattern name="fire-and-check">
65
- The fire-and-check pattern maximizes parallelism by:
66
- 1. Firing all implementers as background tasks simultaneously
67
- 2. Polling to detect completion as early as possible
68
- 3. Starting each reviewer immediately when its implementer finishes
69
- 4. Not waiting for all implementers before starting any reviewers
61
+ <execution-pattern>
62
+ Maximize parallelism by calling multiple Task tools in one message:
63
+ 1. Fire all implementers as Task calls in ONE message (parallel execution)
64
+ 2. Results available immediately when all complete
65
+ 3. Fire all reviewers as Task calls in ONE message
66
+ 4. Handle any review feedback
70
67
 
71
68
  Example: 3 independent tasks
72
- - Fire implementer 1, 2, 3 as background_task (all start immediately)
73
- - Poll with background_list
74
- - Task 2 finishes first immediately start reviewer 2
75
- - Task 1 finishes → immediately start reviewer 1
76
- - Task 3 finishes → immediately start reviewer 3
77
- - Reviewers run in parallel as they're spawned
69
+ - Call Task for implementer 1, 2, 3 in ONE message (all run in parallel)
70
+ - All results available when message completes
71
+ - Call Task for reviewer 1, 2, 3 in ONE message (all run in parallel)
78
72
  </execution-pattern>
79
73
 
80
74
  <available-subagents>
@@ -83,7 +77,7 @@ Example: 3 independent tasks
83
77
  Input: Single task with context (which files, what to do).
84
78
  Output: Changes made and verification results for that task.
85
79
  <invocation>
86
- background_task(description="Implement task 1", prompt="...", agent="implementer")
80
+ Task(subagent_type="implementer", prompt="...", description="Implement task 1")
87
81
  </invocation>
88
82
  </subagent>
89
83
  <subagent name="reviewer">
@@ -91,70 +85,54 @@ Example: 3 independent tasks
91
85
  Input: Single task's changes against its requirements.
92
86
  Output: APPROVED or CHANGES REQUESTED for that task.
93
87
  <invocation>
94
- background_task(description="Review task 1", prompt="...", agent="reviewer")
88
+ Task(subagent_type="reviewer", prompt="...", description="Review task 1")
95
89
  </invocation>
96
90
  </subagent>
97
91
  </available-subagents>
98
92
 
99
93
  <per-task-cycle>
100
94
  For each task:
101
- 1. Fire implementer as background_task
102
- 2. Poll until implementer completes
103
- 3. Start reviewer immediately when implementer finishes
104
- 4. If reviewer requests changes: fire new implementer for fixes
105
- 5. Max 3 cycles per task before marking as blocked
106
- 6. Report task status: DONE / BLOCKED
95
+ 1. Fire implementer using Task tool
96
+ 2. When complete, fire reviewer using Task tool
97
+ 3. If reviewer requests changes: fire new implementer for fixes
98
+ 4. Max 3 cycles per task before marking as blocked
99
+ 5. Report task status: DONE / BLOCKED
107
100
  </per-task-cycle>
108
101
 
109
- <fire-and-check-loop>
102
+ <batch-execution>
110
103
  Within a batch:
111
- 1. Fire ALL implementers as background_task in ONE message
112
- 2. Enter polling loop:
113
- a. Call background_list to check status of ALL tasks
114
- b. For each newly completed task (status != "running"):
115
- - Get result with background_output (task is already done)
116
- - If implementer completed: start its reviewer as background_task
117
- - If reviewer completed: check APPROVED or CHANGES REQUESTED
118
- c. If changes needed and cycles < 3: fire new implementer
119
- d. Sleep briefly, then repeat until all tasks done or blocked
120
- 3. Move to next batch
121
-
122
- IMPORTANT: Always poll with background_list first to check status,
123
- then fetch results with background_output only for completed tasks.
124
- </fire-and-check-loop>
104
+ 1. Fire ALL implementers as Task calls in ONE message (parallel)
105
+ 2. When all complete, fire ALL reviewers as Task calls in ONE message (parallel)
106
+ 3. If any reviewer requests changes and cycles < 3: fire new implementers
107
+ 4. Move to next batch when current batch is done
108
+ </batch-execution>
125
109
 
126
110
  <rules>
127
111
  <rule>Parse ALL tasks from plan before starting execution</rule>
128
112
  <rule>ALWAYS analyze dependencies before parallelizing</rule>
129
- <rule>Fire parallel tasks as background_task for true parallelism</rule>
130
- <rule>Start reviewer immediately when its implementer finishes - don't wait for others</rule>
113
+ <rule>Fire parallel tasks as multiple Task calls in ONE message</rule>
131
114
  <rule>Wait for entire batch before starting next batch</rule>
132
115
  <rule>Each task gets its own implement → review cycle</rule>
133
116
  <rule>Max 3 review cycles per task</rule>
134
117
  <rule>Continue with other tasks if one is blocked</rule>
135
118
  </rules>
136
119
 
137
- <execution-example pattern="fire-and-check">
120
+ <execution-example>
138
121
  # Batch with tasks 1, 2, 3 (independent)
139
122
 
140
- ## Step 1: Fire all implementers
141
- background_task(description="Task 1", prompt="Execute task 1: [details]", agent="implementer") → task_id_1
142
- background_task(description="Task 2", prompt="Execute task 2: [details]", agent="implementer") → task_id_2
143
- background_task(description="Task 3", prompt="Execute task 3: [details]", agent="implementer") → task_id_3
123
+ ## Step 1: Fire all implementers in ONE message
124
+ Task(subagent_type="implementer", prompt="Execute task 1: [details]", description="Task 1")
125
+ Task(subagent_type="implementer", prompt="Execute task 2: [details]", description="Task 2")
126
+ Task(subagent_type="implementer", prompt="Execute task 3: [details]", description="Task 3")
127
+ // All three run in parallel, results available when message completes
144
128
 
145
- ## Step 2: Poll and react
146
- background_list() shows task_id_2 completed
147
- background_output(task_id="task_id_2") get result
148
- background_task(description="Review 2", prompt="Review task 2 implementation", agent="reviewer") → review_id_2
129
+ ## Step 2: Fire all reviewers in ONE message
130
+ Task(subagent_type="reviewer", prompt="Review task 1 implementation", description="Review 1")
131
+ Task(subagent_type="reviewer", prompt="Review task 2 implementation", description="Review 2")
132
+ Task(subagent_type="reviewer", prompt="Review task 3 implementation", description="Review 3")
133
+ // All three run in parallel, results available when message completes
149
134
 
150
- background_list() shows task_id_1, task_id_3 completed
151
- background_output(task_id="task_id_1") → get result
152
- background_output(task_id="task_id_3") → get result
153
- background_task(description="Review 1", prompt="Review task 1 implementation", agent="reviewer") → review_id_1
154
- background_task(description="Review 3", prompt="Review task 3 implementation", agent="reviewer") → review_id_3
155
-
156
- ## Step 3: Continue polling until all reviews complete
157
- ...
135
+ ## Step 3: Handle any review feedback, then move to next batch
158
136
  </execution-example>
159
137
 
160
138
  <output-format>
@@ -191,12 +169,10 @@ background_task(description="Review 3", prompt="Review task 3 implementation", a
191
169
  </output-format>
192
170
 
193
171
  <never-do>
194
- <forbidden>NEVER call background_output on running tasks - always poll with background_list first</forbidden>
195
172
  <forbidden>Never skip dependency analysis</forbidden>
196
173
  <forbidden>Never spawn dependent tasks in parallel</forbidden>
197
174
  <forbidden>Never skip reviewer for any task</forbidden>
198
175
  <forbidden>Never continue past 3 cycles for a single task</forbidden>
199
176
  <forbidden>Never report success if any task is blocked</forbidden>
200
- <forbidden>Never wait for all implementers before starting any reviewer</forbidden>
201
177
  </never-do>`,
202
178
  };
@@ -13,19 +13,13 @@ Every task is bite-sized (2-5 minutes), with exact paths and complete code.
13
13
 
14
14
  <critical-rules>
15
15
  <rule>FOLLOW THE DESIGN: The brainstormer's design is the spec. Do not explore alternatives.</rule>
16
- <rule>BACKGROUND TASKS: Use background_task for parallel research (fire-and-collect pattern).</rule>
17
- <rule>TOOLS (grep, read, etc.): Do NOT use directly - use background subagents instead.</rule>
16
+ <rule>SUBAGENTS: Use the Task tool to spawn subagents synchronously. They complete before you continue.</rule>
17
+ <rule>TOOLS (grep, read, etc.): Do NOT use directly - use subagents instead.</rule>
18
18
  <rule>Every code example MUST be complete - never write "add validation here"</rule>
19
19
  <rule>Every file path MUST be exact - never write "somewhere in src/"</rule>
20
20
  <rule>Follow TDD: failing test → verify fail → implement → verify pass → commit</rule>
21
21
  </critical-rules>
22
22
 
23
- <background-tools>
24
- <tool name="background_task">Fire subagent tasks that run in parallel. Returns task_id immediately.</tool>
25
- <tool name="background_list">List all background tasks and their current status. Use to poll for completion.</tool>
26
- <tool name="background_output">Get results from a completed task. Only call after background_list shows task is done.</tool>
27
- </background-tools>
28
-
29
23
  <research-scope>
30
24
  Brainstormer did conceptual research (architecture, patterns, approaches).
31
25
  Your research is IMPLEMENTATION-LEVEL only:
@@ -55,7 +49,7 @@ All research must serve the design - never second-guess design decisions.
55
49
  Find exact patterns to copy in code examples.
56
50
  Examples: "Find exact test setup pattern", "Find exact error handling in similar endpoint"
57
51
  </subagent>
58
- <rule>ALWAYS use background_task to spawn subagents. NEVER use Task tool.</rule>
52
+ <rule>Use the Task tool to spawn subagents synchronously.</rule>
59
53
  </available-subagents>
60
54
 
61
55
  <inputs>
@@ -71,22 +65,16 @@ All research must serve the design - never second-guess design decisions.
71
65
  <action>Note any constraints or decisions made by brainstormer</action>
72
66
  </phase>
73
67
 
74
- <phase name="implementation-research" pattern="fire-and-collect">
75
- <action>Fire background tasks AND library research in parallel:</action>
76
- <fire-phase description="Launch all research simultaneously">
77
- In a SINGLE message, fire:
78
- - background_task(agent="codebase-locator", prompt="Find exact path to [component]")
79
- - background_task(agent="codebase-analyzer", prompt="Get signature for [function]")
80
- - background_task(agent="pattern-finder", prompt="Find test setup pattern")
68
+ <phase name="implementation-research">
69
+ <action>Spawn subagents using Task tool (they run synchronously):</action>
70
+ <parallel-research description="Launch independent research in a single message">
71
+ In a SINGLE message, call multiple Task tools in parallel:
72
+ - Task(subagent_type="codebase-locator", prompt="Find exact path to [component]")
73
+ - Task(subagent_type="codebase-analyzer", prompt="Get signature for [function]")
74
+ - Task(subagent_type="pattern-finder", prompt="Find test setup pattern")
81
75
  - context7_resolve-library-id + context7_query-docs for API docs
82
76
  - btca_ask for library internals when needed
83
- </fire-phase>
84
- <collect-phase description="Poll until all complete, then collect">
85
- - Call background_list() and look for "ALL COMPLETE" in output
86
- - If still running: wait, poll again (max 5 times)
87
- - When done: call background_output(task_id=...) for each completed task
88
- - Combine all results for planning phase
89
- </collect-phase>
77
+ </parallel-research>
90
78
  <rule>Only research what's needed to implement the design</rule>
91
79
  <rule>Never research alternatives to design decisions</rule>
92
80
  </phase>
@@ -178,23 +166,15 @@ git commit -m "feat(scope): add specific feature"
178
166
  </template>
179
167
  </output-format>
180
168
 
181
- <execution-example pattern="fire-and-collect">
182
- <step name="fire">
183
- // In a SINGLE message, fire all research tasks:
184
- background_task(agent="codebase-locator", prompt="Find UserService path") // returns task_id_1
185
- background_task(agent="codebase-analyzer", prompt="Get createUser signature") // returns task_id_2
186
- background_task(agent="pattern-finder", prompt="Find test setup pattern") // returns task_id_3
187
- context7_resolve-library-id(libraryName="express") // runs in parallel
188
- btca_ask(tech="express", question="middleware chain order") // runs in parallel
189
- </step>
190
- <step name="collect">
191
- // Poll until all background tasks complete:
192
- background_list() // check status of all tasks
193
- // When all show "completed":
194
- background_output(task_id=task_id_1) // get result
195
- background_output(task_id=task_id_2) // get result
196
- background_output(task_id=task_id_3) // get result
197
- // context7 and btca_ask results already available from fire step
169
+ <execution-example>
170
+ <step name="research">
171
+ // In a SINGLE message, spawn all research tasks in parallel:
172
+ Task(subagent_type="codebase-locator", prompt="Find UserService path")
173
+ Task(subagent_type="codebase-analyzer", prompt="Get createUser signature")
174
+ Task(subagent_type="pattern-finder", prompt="Find test setup pattern")
175
+ context7_resolve-library-id(libraryName="express")
176
+ btca_ask(tech="express", question="middleware chain order")
177
+ // All complete before next message - results available immediately
198
178
  </step>
199
179
  <step name="plan">
200
180
  // Use all collected results to write the implementation plan
@@ -10,7 +10,7 @@ const PROMPT = `
10
10
 
11
11
  <critical-rule>
12
12
  MAXIMIZE PARALLELISM. Speed is critical.
13
- - Fire ALL background tasks simultaneously
13
+ - Call multiple Task tools in ONE message for parallel execution
14
14
  - Run multiple tool calls in single message
15
15
  - Never wait for one thing when you can do many
16
16
  </critical-rule>
@@ -23,56 +23,38 @@ const PROMPT = `
23
23
  </outputs>
24
24
  </task>
25
25
 
26
- <background-tools>
27
- <tool name="background_task">
28
- Fire a subagent to run in background. Returns task_id immediately.
29
- Parameters: description, prompt, agent (subagent type)
30
- Example: background_task(description="Find entry points", prompt="Find all entry points", agent="codebase-locator")
31
- </tool>
32
- <tool name="background_list">
33
- List all background tasks and their status. Use to poll for completion.
34
- No parameters required.
35
- </tool>
36
- <tool name="background_output">
37
- Get results from a completed task. Only call after background_list shows task is done.
38
- Parameters: task_id
39
- Example: background_output(task_id="abc123")
40
- </tool>
41
- </background-tools>
42
-
43
- <parallel-execution-strategy pattern="fire-and-collect">
44
- <phase name="1-fire" description="Fire ALL tasks simultaneously">
45
- <description>Launch ALL discovery agents + run tools in a SINGLE message</description>
46
- <fire-agents>
26
+ <subagent-tools>
27
+ Use Task tool to spawn subagents synchronously. They complete before you continue.
28
+ Call multiple Task tools in ONE message for parallel execution.
29
+ Example: Task(subagent_type="codebase-locator", prompt="Find all entry points", description="Find entry points")
30
+ </subagent-tools>
31
+
32
+ <parallel-execution-strategy>
33
+ <phase name="1-discovery" description="Launch ALL discovery in ONE message">
34
+ <description>Call multiple Task tools + other tools in a SINGLE message</description>
35
+ <subagents>
47
36
  <agent name="codebase-locator">Find entry points, configs, main modules</agent>
48
37
  <agent name="codebase-locator">Find test files and test patterns</agent>
49
38
  <agent name="codebase-locator">Find linter, formatter, CI configs</agent>
50
39
  <agent name="codebase-analyzer">Analyze directory structure</agent>
51
40
  <agent name="pattern-finder">Find naming conventions across files</agent>
52
- </fire-agents>
41
+ </subagents>
53
42
  <parallel-tools>
54
43
  <tool>Glob for package.json, pyproject.toml, go.mod, Cargo.toml, etc.</tool>
55
44
  <tool>Glob for *.config.*, .eslintrc*, .prettierrc*, ruff.toml, etc.</tool>
56
45
  <tool>Glob for README*, CONTRIBUTING*, docs/*</tool>
57
46
  <tool>Read root directory listing</tool>
58
47
  </parallel-tools>
48
+ <note>All Task calls and tools run in parallel, results available when message completes</note>
59
49
  </phase>
60
50
 
61
- <phase name="2-collect" description="Poll and collect all results">
62
- <description>Poll background_list until "ALL COMPLETE" appears, then collect</description>
63
- <action>Call background_list() - look for "ALL COMPLETE" in output</action>
64
- <action>If still running: wait, poll again (max 5 times)</action>
65
- <action>Call background_output for each completed task (skip errored)</action>
66
- <action>Process tool results from phase 1</action>
67
- </phase>
68
-
69
- <phase name="3-deep-analysis" description="Fire deep analysis tasks">
70
- <description>Based on discovery, fire more background tasks</description>
71
- <fire-agents>
51
+ <phase name="2-deep-analysis" description="Fire deep analysis tasks">
52
+ <description>Based on discovery, call more Task tools in ONE message</description>
53
+ <subagents>
72
54
  <agent name="codebase-analyzer">Analyze core/domain logic</agent>
73
55
  <agent name="codebase-analyzer">Analyze API/entry points</agent>
74
56
  <agent name="codebase-analyzer">Analyze data layer</agent>
75
- </fire-agents>
57
+ </subagents>
76
58
  <parallel-tools>
77
59
  <tool>Read 5 core source files simultaneously</tool>
78
60
  <tool>Read 3 test files simultaneously</tool>
@@ -80,9 +62,7 @@ const PROMPT = `
80
62
  </parallel-tools>
81
63
  </phase>
82
64
 
83
- <phase name="4-collect-and-write" description="Collect and write output">
84
- <description>Collect deep analysis results, then write both files</description>
85
- <action>Collect all deep analysis results</action>
65
+ <phase name="3-write" description="Write output files">
86
66
  <action>Write ARCHITECTURE.md</action>
87
67
  <action>Write CODE_STYLE.md</action>
88
68
  </phase>
@@ -92,26 +72,24 @@ const PROMPT = `
92
72
  <subagent name="codebase-locator">
93
73
  Fast file/pattern finder. Spawn multiple with different queries.
94
74
  Examples: "Find all entry points", "Find all config files", "Find test directories"
95
- background_task(description="Find entry points", prompt="Find all entry points and main files", agent="codebase-locator")
75
+ Task(subagent_type="codebase-locator", prompt="Find all entry points and main files", description="Find entry points")
96
76
  </subagent>
97
77
  <subagent name="codebase-analyzer">
98
78
  Deep module analyzer. Spawn multiple for different areas.
99
79
  Examples: "Analyze src/core", "Analyze api layer", "Analyze database module"
100
- background_task(description="Analyze core", prompt="Analyze the core module", agent="codebase-analyzer")
80
+ Task(subagent_type="codebase-analyzer", prompt="Analyze the core module", description="Analyze core")
101
81
  </subagent>
102
82
  <subagent name="pattern-finder">
103
83
  Pattern extractor. Spawn for different pattern types.
104
84
  Examples: "Find naming patterns", "Find error handling patterns", "Find async patterns"
105
- background_task(description="Find patterns", prompt="Find naming conventions", agent="pattern-finder")
85
+ Task(subagent_type="pattern-finder", prompt="Find naming conventions", description="Find patterns")
106
86
  </subagent>
107
- <rule>ALWAYS use background_task to spawn subagents. NEVER use Task tool.</rule>
87
+ <rule>Use Task tool to spawn subagents synchronously.</rule>
108
88
  </available-subagents>
109
89
 
110
90
  <critical-instruction>
111
- Use background_task to fire subagents for TRUE parallelism.
112
- Fire ALL background_task calls in a SINGLE message.
113
- Then poll with background_list until all complete, and collect with background_output.
114
- This is the fire-and-collect pattern - fire everything, poll, then collect everything.
91
+ Call multiple Task tools in ONE message for TRUE parallelism.
92
+ All results available immediately when message completes - no polling needed.
115
93
  </critical-instruction>
116
94
 
117
95
  <language-detection>
@@ -177,10 +155,9 @@ const PROMPT = `
177
155
 
178
156
  <rules>
179
157
  <category name="Speed">
180
- <rule>ALWAYS fire multiple background_task calls in a SINGLE message</rule>
158
+ <rule>ALWAYS call multiple Task tools in a SINGLE message for parallelism</rule>
181
159
  <rule>ALWAYS run multiple tool calls in a SINGLE message</rule>
182
160
  <rule>NEVER wait for one task when you can start others</rule>
183
- <rule>Use fire-and-collect: fire all, then collect all</rule>
184
161
  </category>
185
162
 
186
163
  <category name="Analysis">
@@ -205,38 +182,27 @@ const PROMPT = `
205
182
  </category>
206
183
  </rules>
207
184
 
208
- <execution-example pattern="fire-and-collect">
209
- <step description="FIRE: Launch all discovery tasks simultaneously">
210
- In a SINGLE message, fire ALL background_task calls AND run other tools:
211
- - background_task(description="Find entry points", prompt="Find all entry points and main files", agent="codebase-locator") -> task_id_1
212
- - background_task(description="Find configs", prompt="Find all config files (linters, formatters, build)", agent="codebase-locator") -> task_id_2
213
- - background_task(description="Find tests", prompt="Find test directories and test files", agent="codebase-locator") -> task_id_3
214
- - background_task(description="Analyze structure", prompt="Analyze the directory structure and organization", agent="codebase-analyzer") -> task_id_4
215
- - background_task(description="Find patterns", prompt="Find naming conventions used across the codebase", agent="pattern-finder") -> task_id_5
185
+ <execution-example>
186
+ <step description="Discovery: Launch all tasks in ONE message">
187
+ In a SINGLE message, call ALL Task tools AND run other tools:
188
+ - Task(subagent_type="codebase-locator", prompt="Find all entry points and main files", description="Find entry points")
189
+ - Task(subagent_type="codebase-locator", prompt="Find all config files (linters, formatters, build)", description="Find configs")
190
+ - Task(subagent_type="codebase-locator", prompt="Find test directories and test files", description="Find tests")
191
+ - Task(subagent_type="codebase-analyzer", prompt="Analyze the directory structure and organization", description="Analyze structure")
192
+ - Task(subagent_type="pattern-finder", prompt="Find naming conventions used across the codebase", description="Find patterns")
216
193
  - Glob: package.json, pyproject.toml, go.mod, Cargo.toml, etc.
217
194
  - Glob: README*, ARCHITECTURE*, docs/*
195
+ // All results available when message completes - no polling needed
218
196
  </step>
219
197
 
220
- <step description="COLLECT: Poll and gather all results">
221
- First poll until all tasks complete:
222
- - background_list() // repeat until all show "completed" or "error"
223
- Then collect results (skip errored tasks):
224
- - background_output(task_id=task_id_1)
225
- - background_output(task_id=task_id_2)
226
- - background_output(task_id=task_id_3)
227
- - background_output(task_id=task_id_4)
228
- - background_output(task_id=task_id_5)
229
- </step>
230
-
231
- <step description="FIRE: Deep analysis based on discovery">
232
- Based on discovery, in a SINGLE message fire more tasks:
233
- - background_task for each major module: agent="codebase-analyzer"
198
+ <step description="Deep analysis: Fire more tasks in ONE message">
199
+ Based on discovery, in a SINGLE message call more Task tools:
200
+ - Task for each major module: subagent_type="codebase-analyzer"
234
201
  - Read multiple source files simultaneously
235
202
  - Read multiple test files simultaneously
236
203
  </step>
237
204
 
238
- <step description="COLLECT and WRITE">
239
- Collect deep analysis results, then write:
205
+ <step description="Write output files">
240
206
  - Write ARCHITECTURE.md
241
207
  - Write CODE_STYLE.md
242
208
  </step>