@dtlabs/ai-toolkit 0.13.0 → 0.14.0

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.
@@ -5,12 +5,9 @@ argument-hint: <path-to-feature.md> [--force]
5
5
 
6
6
  # Implement Feature
7
7
 
8
- Orchestrates the full feature delivery pipeline by invoking three sequential workflow phases
9
- (`pm-phase1`, `pm-phase2`, `pm-phase3`), handling approval gates in the main loop between
10
- each phase, and recording the real token consumption at the end.
8
+ Runs documentation and work breakdown through the deterministic Node workflow host, then implementation through the FTR-018 task executor. Approval gates remain in the main loop.
11
9
 
12
- Each workflow phase runs as a real subagent boundary, ensuring worker agents are dispatched
13
- with their declared `model:` frontmatter honoured and producing accurate per-agent `usage` data.
10
+ Workflows are JavaScript assets, never agent types. Do not pass pm-phase1/2/3 or am-phase1/2 to agentType, subagent_type, or --agent. Use the workflow CLI below. Resolve the absolute Claude executable path as described in docs/task-executor-bootstrap.md.
14
11
 
15
12
  ---
16
13
 
@@ -58,53 +55,13 @@ Before starting the pipeline, verify that every pipeline agent is installed and
58
55
 
59
56
  ## Step 1 — Invoke pm-phase1 (Documentation Phase)
60
57
 
61
- ### Step 1a — Tier 1 dispatch guard (AC-06, AC-07, AC-20)
62
-
63
- Before dispatching, resolve and verify the pm-phase1 orchestrator:
64
-
65
- ```bash
66
- ai-toolkit agents resolve \
67
- --project . \
68
- --id gaia.orchestrator.feature.phase1 \
69
- --require-verified
70
- ```
71
-
72
- If exit non-zero → **HARD STOP**: report the error, do not dispatch pm-phase1.
73
-
74
- Store the resolution record fields: `nativeName`, `sha256` (definitionHash), `scope` (resolutionScope), `toolkitVersion`.
75
-
76
- Open the dispatch ledger entry (fail-closed):
77
-
78
- ```bash
79
- ai-toolkit ledger open \
80
- --prefix {PREFIX} \
81
- --agent pm-phase1:dispatch \
82
- --phase phase3 \
83
- --dir {LEDGER_DIR} \
84
- --metadata-json '{"agentId":"gaia.orchestrator.feature.phase1","nativeAgentName":"{nativeName}","platform":"claude","toolkitVersion":"{toolkitVersion}","resolutionScope":"{scope}","definitionHash":"{sha256}"}'
85
- ```
86
-
87
- If exit non-zero → **HARD STOP** (fail-closed): do not dispatch.
88
-
89
- ### Step 1b — Invoke pm-phase1 using verified nativeName
90
-
91
- Invoke the workflow using ONLY the resolved `nativeName` (never a hardcoded name):
92
-
93
- ```
94
- subagent_type: {nativeName}
95
- prompt: <path-to-feature.md>
96
- ```
97
-
98
- Wait for the workflow to complete. Do NOT proceed until it returns.
99
-
100
- After the workflow returns, close the dispatch ledger entry:
58
+ Run directly via the shell tool:
101
59
 
102
60
  ```bash
103
- ai-toolkit ledger close \
104
- --prefix {PREFIX} --agent pm-phase1:dispatch --dir {LEDGER_DIR}
61
+ ai-toolkit workflow run pm-phase1 --project . --claude-path "{ABSOLUTE_CLAUDE_EXE}" -- "<path-to-feature.md>" [--force]
105
62
  ```
106
63
 
107
- If ledger close fails → **HARD STOP**: report the error and do not continue.
64
+ The host verifies the installed workflow and each worker and owns all ledger transitions. Do not manually open/close its entries. Nonzero exit is a HARD STOP: do not present the next gate or report successful completion. Parse stdout as JSON only on exit 0. Never dispatch the workflow as a subagent.
108
65
 
109
66
  Extract from the result:
110
67
  - `prefix` — feature prefix (e.g. `FTR-009`)
@@ -174,40 +131,15 @@ If the file is missing or incomplete, write it again before proceeding.
174
131
 
175
132
  ## Step 3 — Invoke pm-phase2 (Work Breakdown Phase)
176
133
 
177
- ### Step 3a — Tier 1 dispatch guard
178
-
179
- Resolve and verify pm-phase2:
134
+ Run directly via the shell tool:
180
135
 
181
136
  ```bash
182
- ai-toolkit agents resolve \
183
- --project . \
184
- --id gaia.orchestrator.feature.phase2 \
185
- --require-verified
137
+ ai-toolkit workflow run pm-phase2 --project . --claude-path "{ABSOLUTE_CLAUDE_EXE}" -- "<path-to-feature.md>"
186
138
  ```
187
139
 
188
- If exit non-zero → **HARD STOP**: do not dispatch pm-phase2.
189
-
190
- Open the dispatch ledger entry (fail-closed):
191
-
192
- ```bash
193
- ai-toolkit ledger open \
194
- --prefix {PREFIX} \
195
- --agent pm-phase2:dispatch \
196
- --phase phase3 \
197
- --dir {LEDGER_DIR} \
198
- --metadata-json '{"agentId":"gaia.orchestrator.feature.phase2","nativeAgentName":"{nativeName}","platform":"claude","toolkitVersion":"{toolkitVersion}","resolutionScope":"{scope}","definitionHash":"{sha256}"}'
199
- ```
200
-
201
- If exit non-zero → **HARD STOP** (fail-closed).
202
-
203
- ### Step 3b — Invoke pm-phase2 using verified nativeName
204
-
205
- ```
206
- subagent_type: {nativeName}
207
- prompt: <path-to-feature.md>
208
- ```
140
+ The host verifies the installed workflow and each worker and owns all ledger transitions. Do not manually open/close its entries. Nonzero exit is a HARD STOP: do not present the next gate or report successful completion. Parse stdout as JSON only on exit 0. Never dispatch the workflow as a subagent.
209
141
 
210
- Wait for the workflow to complete. Extract from the result:
142
+ Extract from the result:
211
143
  - `user_stories` — number of User Stories
212
144
  - `total_tasks` — total task count
213
145
  - `domain_breakdown` — tasks per domain
@@ -216,15 +148,6 @@ Wait for the workflow to complete. Extract from the result:
216
148
  - `agent_estimate` — agent parallel estimate
217
149
  - `token_ledger` — per-agent token data from phase 2
218
150
 
219
- Close the dispatch ledger entry after the workflow returns:
220
-
221
- ```bash
222
- ai-toolkit ledger close \
223
- --prefix {PREFIX} --agent pm-phase2:dispatch --dir {LEDGER_DIR}
224
- ```
225
-
226
- If ledger close fails → **HARD STOP**: report the error. Do not continue to Gate 2. The error is not swallowed (AC-22).
227
-
228
151
  ---
229
152
 
230
153
  ## Step 4 — Present Gate 2 (HARD STOP — present in main loop)
@@ -276,7 +199,7 @@ Read back `{PREFIX}-Approvals.md` and verify Gate 2 ✅ is present before contin
276
199
 
277
200
  ## Step 5 — Create feature branch
278
201
 
279
- Before invoking pm-phase3, create the feature branch:
202
+ Before launching the task executor, create the feature branch:
280
203
 
281
204
  ```bash
282
205
  git checkout -b feature/{PREFIX}-{short-slug}
@@ -290,102 +213,88 @@ git checkout feature/{PREFIX}-{short-slug}
290
213
 
291
214
  ---
292
215
 
293
- ## Step 6 — Invoke pm-phase3 (Implementation Phase)
216
+ ## Step 6 — Launch the task executor (Implementation Phase)
294
217
 
295
218
  Pre-condition check: read `{PREFIX}-Approvals.md` and verify BOTH Gate 1 ✅ and Gate 2 ✅.
296
219
  If either is missing, return to the missing gate.
297
220
 
298
- ### Step 6a — Tier 1 dispatch guard (Gate 2 post-approval, AC-06, AC-07, AC-08)
221
+ Implementation is no longer dispatched as a subagent from this skill. There is no
222
+ pm-phase3 workflow, no Tier-1 dispatch guard, and no `pm-phase3:dispatch` ledger entry for
223
+ this step — none of that applies once implementation runs as an external process instead of
224
+ an in-chat subagent. Once Gate 2 is approved, this skill's job is limited to presenting or
225
+ launching **one explicit `task-executor` start command**; the executor process itself then
226
+ owns the repo, plans, executes, checkpoints and resumes tasks deterministically, independent
227
+ of this chat.
228
+
229
+ **No subagent orchestrates the run, and no assistant or agent involvement is required for
230
+ each task transition once the run has started.** This is a deliberate behavioral change from
231
+ the retired pm-phase3 grouping model: previously an assistant-driven subagent had to be
232
+ present for the whole implementation phase; now a single durable command launch is enough,
233
+ and the run may keep going, checkpointing and resuming, even after this conversation ends.
234
+
235
+ ### Step 6a — Present or launch the executor start command
299
236
 
300
- After Gate 2 approval, resolve and verify pm-phase3 with `--require-verified`. Only a `verified` status permits dispatch:
237
+ Build the start command:
301
238
 
302
239
  ```bash
303
- ai-toolkit agents resolve \
240
+ ai-toolkit executor start \
304
241
  --project . \
305
- --id gaia.orchestrator.feature.phase3 \
306
- --require-verified
242
+ --feature <path-to-feature.md> \
243
+ --max-concurrency 1 \
244
+ --claude-path <resolved-claude-cli-path> \
245
+ --task-timeout-ms <task-timeout-ms, e.g. 900000> \
246
+ --agent-budget-usd <per-agent budget in USD, e.g. 5.00>
307
247
  ```
308
248
 
309
- If exit non-zero → **HARD STOP** (AC-08): pm-phase3 is absent or tampered. Report the error with remediation instructions:
249
+ Placeholders:
250
+ - `<path-to-feature.md>` — the feature.md path passed to this skill
251
+ - `<resolved-claude-cli-path>` — the Claude CLI executable path on this host; ask the user if unknown
252
+ - `<task-timeout-ms>` and `<agent-budget-usd>` — must be supplied explicitly; there is no hidden default timeout or spend
310
253
 
311
- ```
312
- ⛔ HARD STOP — pm-phase3 cannot be dispatched.
313
-
314
- Remediation:
315
- 1. Run: ai-toolkit agents resolve --project . --id gaia.orchestrator.feature.phase3
316
- 2. Check the status field in the output for the failure reason.
317
- 3. Re-install the toolkit if the status is not-installed or hash-mismatch.
318
- 4. Contact the toolkit team if the issue persists.
254
+ **If the host's ordinary terminal capability can launch a durable external command**, launch
255
+ it directly through that capability so the process persists independently of this chat.
319
256
 
320
- Do NOT use an alternative workflow name or any fallback. This pipeline requires verified agents.
321
- ```
257
+ **If the host cannot launch a durable external command, show the exact command above for the
258
+ user to run themselves in a terminal.** Do not attempt to fake a durable launch by running it
259
+ as a blocking in-chat command — the run must be able to outlive this conversation.
322
260
 
323
- Do NOT use any alternative workflow name or fallback.
261
+ In both cases, capture (or ask the user to report back) the `run-id` printed by `start` — it
262
+ is required for every subsequent `status`, `diagnose`, `stop`, `reconcile`, `resume`, and
263
+ `replan` call; there is no implicit last-run selection.
324
264
 
325
- Open the dispatch ledger entry (fail-closed):
265
+ Tell the user that implementation has been launched and that progress and cost can be
266
+ checked at any time with:
326
267
 
327
268
  ```bash
328
- ai-toolkit ledger open \
329
- --prefix {PREFIX} \
330
- --agent pm-phase3:dispatch \
331
- --phase phase3 \
332
- --dir {LEDGER_DIR} \
333
- --metadata-json '{"agentId":"gaia.orchestrator.feature.phase3","nativeAgentName":"{nativeName}","platform":"claude","toolkitVersion":"{toolkitVersion}","resolutionScope":"{scope}","definitionHash":"{sha256}"}'
269
+ ai-toolkit executor status --run-id {run_id} --format json
334
270
  ```
335
271
 
336
- If exit non-zero → **HARD STOP** (fail-closed): do not dispatch.
337
-
338
- ### Step 6b — Invoke pm-phase3 using verified nativeName
272
+ Do not block this skill on the run reaching a terminal state — proceed to Step 7 with
273
+ whatever the latest `status` reports at this point. No fallback to the retired pm-phase3
274
+ grouping model is permitted.
339
275
 
340
- Invoke the workflow using ONLY the resolved `nativeName` (never a hardcoded name):
341
-
342
- ```
343
- subagent_type: {nativeName}
344
- prompt: <path-to-feature.md> --branch feature/{PREFIX}-{short-slug}
345
- ```
346
-
347
- Wait for the workflow to complete. Capture its full result, including the `<usage>` block
348
- (format: `subagent_tokens: N`). Extract from the result:
349
- - `pr_url` — the created pull request URL
350
- - `token_ledger` — all per-agent token data from phase 3
351
- - `issues_summary` — escalation and issues counts
352
-
353
- If `issues_summary.escalations > 0`, report the escalation details to the user.
354
-
355
- **If pm-phase3 returned an error or escalation:** mark the dispatch ledger entry failed before stopping:
356
-
357
- ```bash
358
- ai-toolkit ledger fail \
359
- --prefix {PREFIX} --agent pm-phase3:dispatch \
360
- --error "pm-phase3 returned an error or escalation" \
361
- --dir {LEDGER_DIR}
362
- ```
276
+ ---
363
277
 
364
- If `ledger fail` itself exits non-zero → **HARD STOP** (AC-22): report both the original workflow error and the ledger failure. The error is NOT swallowed.
278
+ ## Step 7 — Complete Token Estimate file
365
279
 
366
- **On successful completion:** close the dispatch ledger entry:
280
+ Phases 1 and 2 return JSON token_ledger entries from measured worker subprocess usage. They do not return a workflow subagent usage block. Missing measurements stay unavailable. For phase 3 use the executor:
367
281
 
368
282
  ```bash
369
- ai-toolkit ledger close \
370
- --prefix {PREFIX} --agent pm-phase3:dispatch --dir {LEDGER_DIR}
283
+ ai-toolkit executor status --run-id {run_id} --format json
371
284
  ```
372
285
 
373
- If ledger close fails → **HARD STOP** (AC-22): report the error. The pipeline does not silently swallow ledger failures after dispatch returns.
374
-
375
- ---
286
+ Read the run's total actual tokens/cost and duration from that ledger-sourced summary. If the
287
+ run has not yet reached a terminal state (it may still be executing or may outlive this
288
+ chat), treat its actuals as **not yet available** for this pass — apply the same
289
+ null-compatibility rule below, and note in the file that the run is still in progress and the
290
+ row should be refreshed with a later `status` call.
376
291
 
377
- ## Step 7 — Complete Token Estimate file
378
-
379
- From the `<usage>` block of the pm-phase3 result, read:
380
- - `subagent_tokens` — total tokens consumed by the pm-phase3 workflow
381
- - `duration_ms` — wall-clock duration of pm-phase3
382
-
383
- Read `{PREFIX}-Token-Estimate.md`. Append the orchestrator row and grand total:
292
+ Read `{PREFIX}-Token-Estimate.md`. Append the executor run row and grand total:
384
293
 
385
294
  > **Null-compatibility — actuals reading and cost calculation:** Treat a token value of `null`, `0`, or `not_available` as **data unavailable** — never as a real, observable zero consumption. Render unavailable values as `—` in the Actual tokens and Actual cost columns; exclude them from sums, averages, and grand totals. Preventing resume clobber and legacy misinterpretation requires that no unavailable measurement is coerced into a real zero.
386
295
 
387
296
  ```markdown
388
- | pm-phase3 (orchestrator) | — | sonnet | 80,000 (estimated) | {subagent_tokens} (actual) | ±{delta} | {duration} |
297
+ | task-executor (run {run_id}) | — | — | 80,000 (estimated) | {ledger_actual_tokens} (actual) | ±{delta} | {ledger_duration} |
389
298
 
390
299
  ---
391
300
 
@@ -393,8 +302,8 @@ Read `{PREFIX}-Token-Estimate.md`. Append the orchestrator row and grand total:
393
302
 
394
303
  | Agent | Task / Scope | Model | Est. tokens | Actual tokens | Delta | Est. cost ($) | Actual cost ($) | Duration |
395
304
  |-------|-------------|-------|------------|---------------|-------|--------------|----------------|----------|
396
- {one row per entry in token_ledger — from phase 1, 2, and 3; for any entry where actual tokens is null, 0, or not_available show — in Actual tokens and Actual cost and exclude that row from totals}
397
- | pm-phase3 (orchestrator) | — | sonnet | 80,000 | {subagent_tokens} | ±{delta} | $0.4320 | ${actual_cost} | {duration} |
305
+ {one row per entry in token_ledger from phase 1 and 2, plus per-task ledger entries recorded by the executor run for phase 3; for any entry where actual tokens is null, 0, or not_available show — in Actual tokens and Actual cost and exclude that row from totals}
306
+ | task-executor (run {run_id}) | — | — | 80,000 | {ledger_actual_tokens} | ±{delta} | $0.4320 | ${ledger_actual_cost} | {ledger_duration} |
398
307
 
399
308
  ## Estimation accuracy by agent type
400
309
 
@@ -412,9 +321,9 @@ Read `{PREFIX}-Token-Estimate.md`. Append the orchestrator row and grand total:
412
321
  ```
413
322
 
414
323
  > Per-agent values marked *(proportional)* are estimated distributions of the phase total.
415
- > Phase totals and grand total are exact measurements from workflow subagent_tokens.
324
+ > Phase 1/2 actuals come from worker usage in token_ledger; implementation actuals come from the task executor ledger. Missing measurements remain unavailable.
416
325
 
417
- If the Token Estimate file does not exist (pm-phase3 failed before writing it), create it
326
+ If the Token Estimate file does not exist (a prior phase failed before writing it), create it
418
327
  from scratch using the data available in the token_ledger.
419
328
 
420
329
  ---
@@ -424,8 +333,14 @@ from scratch using the data available in the token_ledger.
424
333
  After writing the token file, report:
425
334
 
426
335
  ```
427
- Feature pipeline complete.
336
+ Feature pipeline complete through implementation launch.
428
337
  Token estimate + actuals → {PREFIX}-Token-Estimate.md
429
338
  Effort estimate + actuals → {PREFIX}-Effort-Estimate.md
430
- Pull Request → {pr_url}
339
+ Implementation run → run-id {run_id} (check with `ai-toolkit executor status --run-id {run_id}`)
431
340
  ```
341
+
342
+ Unlike the retired pm-phase3 model, this skill does not itself produce a pull request: the
343
+ executor's scope is task execution, checkpointing and branch integration, not PR creation.
344
+ Once `executor status` reports the run has reached a terminal, fully-integrated state, open
345
+ the pull request the same way you would for any other finished branch (e.g. `gh pr create`,
346
+ or the toolkit's own `/pr-description` skill).