specsmd 0.0.0-dev.50 → 0.0.0-dev.51

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.
@@ -17,9 +17,10 @@ You are the **Builder Agent** for FIRE (Fast Intent-Run Engineering).
17
17
  When routed from Orchestrator or user invokes this agent:
18
18
 
19
19
  1. Read `.specs-fire/state.yaml` for current state
20
- 2. Determine mode:
20
+ 2. Scan file system for intents/work-items not in state (reconcile)
21
+ 3. Determine mode:
21
22
  - **Active run exists** → Resume execution
22
- - **Pending work items** → Start next work item
23
+ - **Pending work items** → Plan run scope, then execute
23
24
  - **No work items** → Route back to Planner
24
25
 
25
26
  ---
@@ -28,6 +29,7 @@ When routed from Orchestrator or user invokes this agent:
28
29
 
29
30
  | Command | Skill | Description |
30
31
  |---------|-------|-------------|
32
+ | `plan` | `skills/run-plan/SKILL.md` | Plan run scope (discover work, suggest groupings) |
31
33
  | `run`, `execute` | `skills/run-execute/SKILL.md` | Execute a work item run |
32
34
  | `walkthrough` | `skills/walkthrough-generate/SKILL.md` | Generate implementation walkthrough |
33
35
  | `status` | `skills/run-status/SKILL.md` | Show current run status |
@@ -85,12 +87,22 @@ For: Security features, payments, core architecture.
85
87
 
86
88
  ## Run Lifecycle
87
89
 
90
+ A run can contain one or multiple work items based on user's scope preference:
91
+
88
92
  ```yaml
89
93
  run:
90
94
  id: run-001
91
- work_item: login-endpoint
92
- intent: user-auth
93
- mode: confirm
95
+ scope: batch # single | batch | wide
96
+ work_items:
97
+ - id: login-endpoint
98
+ intent: user-auth
99
+ mode: autopilot
100
+ status: completed
101
+ - id: session-management
102
+ intent: user-auth
103
+ mode: autopilot
104
+ status: in_progress
105
+ current_item: session-management
94
106
  status: in_progress # pending | in_progress | completed | failed
95
107
  started: 2026-01-19T10:00:00Z
96
108
  completed: null
@@ -99,6 +111,11 @@ run:
99
111
  decisions: []
100
112
  ```
101
113
 
114
+ **Scope types:**
115
+ - `single` — One work item per run (most controlled)
116
+ - `batch` — Multiple items of same mode grouped together
117
+ - `wide` — All compatible items in one run (fastest)
118
+
102
119
  ---
103
120
 
104
121
  ## File Tracking
@@ -0,0 +1,287 @@
1
+ # Skill: Run Plan
2
+
3
+ Plan the scope of a run by discovering available work items and suggesting groupings.
4
+
5
+ ---
6
+
7
+ ## Trigger
8
+
9
+ - After work-item decomposition completes
10
+ - User wants to start execution
11
+ - Pending work items exist
12
+
13
+ ---
14
+
15
+ ## Degrees of Freedom
16
+
17
+ **MEDIUM** — Present smart grouping suggestions but let user choose scope.
18
+
19
+ ---
20
+
21
+ ## Workflow
22
+
23
+ ```xml
24
+ <skill name="run-plan">
25
+
26
+ <mandate>
27
+ DISCOVER all available work - both in state.yaml AND file system.
28
+ SUGGEST smart groupings based on mode, dependencies, and user history.
29
+ LEARN from user choices to improve future recommendations.
30
+ NEVER force a scope - always let user choose.
31
+ </mandate>
32
+
33
+ <step n="1" title="Discover Available Work">
34
+ <action>Read state.yaml for known intents and work items</action>
35
+ <action>Scan .specs-fire/intents/ for intent briefs not in state</action>
36
+ <action>Scan .specs-fire/intents/*/work-items/ for work items not in state</action>
37
+
38
+ <reconcile>
39
+ <check if="file exists but not in state">
40
+ <action>Parse file frontmatter for metadata</action>
41
+ <action>Add to state.yaml as pending</action>
42
+ <output>Discovered: {item} from {intent} (not in state)</output>
43
+ </check>
44
+ <check if="in state but file missing">
45
+ <output>Warning: {item} in state but file not found</output>
46
+ </check>
47
+ </reconcile>
48
+ </step>
49
+
50
+ <step n="2" title="Collect Pending Work Items">
51
+ <action>Filter work items with status == pending</action>
52
+ <action>Group by intent</action>
53
+ <action>Note mode (after autonomy_bias applied) for each</action>
54
+ <action>Identify dependencies within and across intents</action>
55
+
56
+ <check if="no pending work items">
57
+ <output>
58
+ No pending work items found.
59
+
60
+ Create a new intent? [Y/n]
61
+ </output>
62
+ <check if="response == y">
63
+ <route-to>planner-agent (intent-capture)</route-to>
64
+ </check>
65
+ <stop/>
66
+ </check>
67
+ </step>
68
+
69
+ <step n="3" title="Analyze Groupings">
70
+ <action>Read workspace.autonomy_bias from state.yaml</action>
71
+ <action>Read workspace.run_scope_preference from state.yaml (if exists)</action>
72
+
73
+ <grouping-rules>
74
+ <rule>Same mode items CAN be batched together</rule>
75
+ <rule>Items with dependencies CANNOT be in same batch</rule>
76
+ <rule>Cross-intent batching allowed if items are independent</rule>
77
+ <rule>Validate mode items should generally run alone</rule>
78
+ </grouping-rules>
79
+
80
+ <generate-options>
81
+ <option name="single">
82
+ Each work item in its own run
83
+ Total runs: {count of pending items}
84
+ </option>
85
+
86
+ <option name="batch">
87
+ Group by mode (autopilot together, confirm together)
88
+ Respect dependencies
89
+ Total runs: {count of mode groups}
90
+ </option>
91
+
92
+ <option name="wide">
93
+ All compatible items in one run
94
+ Only separate if dependencies require it
95
+ Total runs: {minimum possible}
96
+ </option>
97
+ </generate-options>
98
+ </step>
99
+
100
+ <step n="4" title="Present Options">
101
+ <action>Determine recommended option based on:</action>
102
+ <substep>autonomy_bias (autonomous→wide, controlled→single)</substep>
103
+ <substep>run_scope_preference (user's historical choice)</substep>
104
+ <substep>Number of pending items (few items→single is fine)</substep>
105
+
106
+ <output>
107
+ ## Run Planning
108
+
109
+ **Found**: {count} pending work items across {intent_count} intent(s)
110
+
111
+ {for each intent with pending items}
112
+ **{intent.title}**:
113
+ {for each pending item}
114
+ - {item.title} ({item.mode})
115
+ {/for}
116
+ {/for}
117
+
118
+ ---
119
+
120
+ **How would you like to execute?**
121
+
122
+ **[1] One at a time** — {single_count} separate runs
123
+ Most controlled, review after each
124
+
125
+ **[2] Batch by mode** — {batch_count} runs {if recommended}(Recommended){/if}
126
+ {for each batch}
127
+ Run {n}: {item_names} ({mode})
128
+ {/for}
129
+
130
+ **[3] All together** — {wide_count} run(s)
131
+ Fastest, minimal interruption
132
+
133
+ Choose [1/2/3]:
134
+ </output>
135
+ </step>
136
+
137
+ <step n="5" title="Process Choice">
138
+ <check if="response == 1">
139
+ <set>run_scope = single</set>
140
+ <set>work_items_for_run = [first_pending_item]</set>
141
+ </check>
142
+ <check if="response == 2">
143
+ <set>run_scope = batch</set>
144
+ <set>work_items_for_run = first_batch_items</set>
145
+ </check>
146
+ <check if="response == 3">
147
+ <set>run_scope = wide</set>
148
+ <set>work_items_for_run = all_compatible_items</set>
149
+ </check>
150
+ </step>
151
+
152
+ <step n="6" title="Learn Preference">
153
+ <action>Update workspace.run_scope_preference in state.yaml</action>
154
+ <action>Add to workspace.run_scope_history (keep last 10)</action>
155
+
156
+ <history-entry>
157
+ choice: {run_scope}
158
+ items_count: {count}
159
+ timestamp: {now}
160
+ </history-entry>
161
+
162
+ <note>
163
+ After 3+ consistent choices, start pre-selecting that option
164
+ and ask "Proceed with {preference}? [Y/n/change]" instead
165
+ </note>
166
+ </step>
167
+
168
+ <step n="7" title="Confirm Run">
169
+ <output>
170
+ Starting run with {count} work item(s):
171
+
172
+ {for each item in work_items_for_run}
173
+ - {item.title} ({item.mode})
174
+ {/for}
175
+
176
+ {if run_scope == batch or wide}
177
+ Items will execute sequentially within this run.
178
+ {if any item is confirm or validate}
179
+ Checkpoints will pause for approval as needed.
180
+ {/if}
181
+ {/if}
182
+
183
+ ---
184
+
185
+ Begin execution? [Y/n]
186
+ </output>
187
+ <check if="response == y">
188
+ <invoke-skill args="work_items_for_run">run-execute</invoke-skill>
189
+ </check>
190
+ </step>
191
+
192
+ </skill>
193
+ ```
194
+
195
+ ---
196
+
197
+ ## State Schema Updates
198
+
199
+ **workspace section additions**:
200
+ ```yaml
201
+ workspace:
202
+ # ... existing fields ...
203
+ run_scope_preference: batch # single | batch | wide (learned)
204
+ run_scope_history:
205
+ - choice: batch
206
+ items_count: 4
207
+ timestamp: 2026-01-19T10:00:00Z
208
+ ```
209
+
210
+ **active_run with multi-item support**:
211
+ ```yaml
212
+ active_run:
213
+ id: run-001
214
+ scope: batch # single | batch | wide
215
+ work_items:
216
+ - id: 01-stats-data-model
217
+ intent: session-stats
218
+ mode: autopilot
219
+ status: completed
220
+ - id: 02-stats-api-endpoint
221
+ intent: session-stats
222
+ mode: autopilot
223
+ status: in_progress
224
+ current_item: 02-stats-api-endpoint
225
+ started: 2026-01-19T10:00:00Z
226
+ ```
227
+
228
+ ---
229
+
230
+ ## File Discovery Logic
231
+
232
+ ```
233
+ .specs-fire/
234
+ ├── intents/
235
+ │ ├── user-auth/
236
+ │ │ ├── brief.md ← Parse frontmatter for intent metadata
237
+ │ │ └── work-items/
238
+ │ │ ├── login-endpoint.md ← Parse for work item metadata
239
+ │ │ └── session-mgmt.md
240
+ │ └── analytics/
241
+ │ ├── brief.md
242
+ │ └── work-items/
243
+ │ └── dashboard.md
244
+ ```
245
+
246
+ **Frontmatter parsing**:
247
+ - Extract `id`, `title`, `status` from YAML frontmatter
248
+ - If status missing, default to `pending`
249
+ - If in file but not state.yaml, add to state
250
+
251
+ ---
252
+
253
+ ## Grouping Algorithm
254
+
255
+ ```
256
+ 1. Collect all pending items with their modes
257
+ 2. Build dependency graph
258
+ 3. For "batch" option:
259
+ - Group by mode
260
+ - Within each mode group, check dependencies
261
+ - Split if dependency exists within group
262
+ 4. For "wide" option:
263
+ - Start with all items in one group
264
+ - Split only where dependencies require
265
+ 5. Return groupings with run counts
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Recommendation Logic
271
+
272
+ ```
273
+ IF run_scope_history has 3+ same choices:
274
+ pre_selected = most_common_choice
275
+
276
+ ELSE IF autonomy_bias == autonomous:
277
+ recommended = wide
278
+
279
+ ELSE IF autonomy_bias == controlled:
280
+ recommended = single
281
+
282
+ ELSE: # balanced
283
+ IF pending_count <= 2:
284
+ recommended = single
285
+ ELSE:
286
+ recommended = batch
287
+ ```
@@ -16,8 +16,11 @@ Analyze project state and route user to the appropriate agent.
16
16
  ```xml
17
17
  <skill name="route">
18
18
 
19
- <step n="1" title="Read State">
19
+ <step n="1" title="Discover and Read State">
20
20
  <action>Read .specs-fire/state.yaml</action>
21
+ <action>Scan .specs-fire/intents/ for briefs not in state</action>
22
+ <action>Scan .specs-fire/intents/*/work-items/ for items not in state</action>
23
+ <action>Reconcile: add discovered items to state as pending</action>
21
24
  <action>Parse current project state</action>
22
25
  </step>
23
26
 
@@ -25,30 +28,25 @@ Analyze project state and route user to the appropriate agent.
25
28
  <check if="active_run exists and status == in_progress">
26
29
  <output>
27
30
  Resuming active run: {active_run.id}
28
- Work item: {active_run.work_item}
29
- Mode: {active_run.mode}
31
+ Scope: {active_run.scope}
32
+ Current item: {active_run.current_item}
33
+ Progress: {completed_count}/{total_count} items
30
34
  </output>
31
- <route-to>builder-agent</route-to>
35
+ <route-to>builder-agent (run-execute)</route-to>
32
36
  <stop/>
33
37
  </check>
34
38
  </step>
35
39
 
36
40
  <step n="3" title="Check Pending Work Items">
37
- <action>Find work items with status == pending</action>
41
+ <action>Find work items with status == pending across all intents</action>
38
42
  <check if="pending work items exist">
39
43
  <output>
40
- Ready to execute: {next_work_item.title}
41
- Complexity: {next_work_item.complexity}
42
- Mode: {next_work_item.mode}
44
+ **{pending_count} pending work items** found across {intent_count} intent(s).
43
45
 
44
- Start execution? [Y/n/skip]
46
+ Plan run scope and start execution? [Y/n]
45
47
  </output>
46
48
  <check if="response == y">
47
- <route-to>builder-agent</route-to>
48
- </check>
49
- <check if="response == skip">
50
- <action>Mark work item as skipped</action>
51
- <action>Re-evaluate next work item</action>
49
+ <route-to>builder-agent (run-plan)</route-to>
52
50
  </check>
53
51
  <stop/>
54
52
  </check>
@@ -94,15 +92,15 @@ Analyze project state and route user to the appropriate agent.
94
92
  ## Routing Decision Tree
95
93
 
96
94
  ```
97
- state.yaml
95
+ state.yaml + file system scan
98
96
 
99
- ├── active_run? ──────────────> Builder (resume)
97
+ ├── active_run? ──────────────> Builder (run-execute, resume)
100
98
 
101
- ├── pending work items? ──────> Builder (execute)
99
+ ├── pending work items? ──────> Builder (run-plan, then execute)
102
100
 
103
- ├── intent without work items? > Planner (decompose)
101
+ ├── intent without work items? > Planner (work-item-decompose)
104
102
 
105
- └── no active intents ────────> Planner (capture)
103
+ └── no active intents ────────> Planner (intent-capture)
106
104
  ```
107
105
 
108
106
  ---
@@ -119,8 +117,7 @@ context:
119
117
  **To Builder:**
120
118
  ```yaml
121
119
  context:
122
- action: execute | resume
123
- work_item_id: {work item to execute}
120
+ action: run-plan | run-execute | resume
121
+ pending_items: [{list of pending work items}] # for run-plan
124
122
  run_id: {if resuming}
125
- mode: autopilot | confirm | validate
126
123
  ```
@@ -139,14 +139,14 @@ Break an intent into discrete, executable work items.
139
139
 
140
140
  <step n="8" title="Transition">
141
141
  <output>
142
- {count} work items created for "{intent-title}".
142
+ **{count} work items created** for "{intent-title}".
143
143
 
144
- First work item: {first-item.title} ({first-item.mode})
144
+ ---
145
145
 
146
- Start execution? [Y/n]
146
+ Ready to plan execution scope? [Y/n]
147
147
  </output>
148
148
  <check if="response == y">
149
- <route-to>builder-agent</route-to>
149
+ <route-to>builder-agent (run-plan)</route-to>
150
150
  </check>
151
151
  </step>
152
152
 
@@ -27,6 +27,8 @@ state:
27
27
  - type: "greenfield | brownfield"
28
28
  - structure: "monolith | monorepo | multi-part"
29
29
  - autonomy_bias: "autonomous | balanced | controlled"
30
+ - run_scope_preference: "single | batch | wide (learned from history)"
31
+ - run_scope_history: "List of recent scope choices for learning"
30
32
  - scanned_at: "ISO 8601 timestamp (brownfield)"
31
33
  - parts: "List of project parts (monorepo)"
32
34
  intents:
@@ -36,7 +38,9 @@ state:
36
38
  - work_items: "List of work items"
37
39
  active_run:
38
40
  - id: "Current run ID"
39
- - work_item: "Work item being executed"
41
+ - scope: "single | batch | wide"
42
+ - work_items: "List of work items in this run"
43
+ - current_item: "Work item currently being executed"
40
44
  - started: "ISO 8601 timestamp"
41
45
 
42
46
  # Data Conventions
@@ -129,3 +133,22 @@ autonomy_bias:
129
133
  low: confirm # shifted up
130
134
  medium: validate # shifted up
131
135
  high: validate
136
+
137
+ # Run Scope - How many work items to execute in a single run
138
+ # Learned from user choices, stored in workspace.run_scope_preference
139
+ run_scope:
140
+ single:
141
+ description: "One work item per run, most controlled"
142
+ grouping: "Each item in its own run"
143
+ batch:
144
+ description: "Group items by mode, respect dependencies"
145
+ grouping: "Autopilot together, confirm together, etc."
146
+ wide:
147
+ description: "Maximum items per run, minimal interruption"
148
+ grouping: "All compatible items together"
149
+
150
+ # Run scope history entry format
151
+ run_scope_history_entry:
152
+ choice: "single | batch | wide"
153
+ items_count: "Number of items in the run"
154
+ timestamp: "ISO 8601 timestamp"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specsmd",
3
- "version": "0.0.0-dev.50",
3
+ "version": "0.0.0-dev.51",
4
4
  "description": "Multi-agent orchestration system for AI-native software development. Delivers AI-DLC, Agile, and custom SDLC flows as markdown-based agent systems.",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {