agentsys 5.3.4 → 5.3.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.
Files changed (74) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +8 -0
  4. package/bin/cli.js +40 -28
  5. package/lib/adapter-transforms.js +3 -3
  6. package/package.json +1 -1
  7. package/site/content.json +32 -8
  8. package/.cursor/commands/audit-project-agents.md +0 -454
  9. package/.cursor/commands/audit-project-github.md +0 -141
  10. package/.cursor/commands/audit-project.md +0 -330
  11. package/.cursor/commands/consult.md +0 -417
  12. package/.cursor/commands/debate.md +0 -381
  13. package/.cursor/commands/delivery-approval.md +0 -334
  14. package/.cursor/commands/deslop.md +0 -142
  15. package/.cursor/commands/drift-detect.md +0 -259
  16. package/.cursor/commands/enhance.md +0 -172
  17. package/.cursor/commands/learn.md +0 -165
  18. package/.cursor/commands/next-task.md +0 -519
  19. package/.cursor/commands/perf.md +0 -464
  20. package/.cursor/commands/repo-map.md +0 -124
  21. package/.cursor/commands/ship-ci-review-loop.md +0 -468
  22. package/.cursor/commands/ship-deployment.md +0 -348
  23. package/.cursor/commands/ship-error-handling.md +0 -265
  24. package/.cursor/commands/ship.md +0 -517
  25. package/.cursor/commands/sync-docs.md +0 -171
  26. package/.cursor/commands/web-ctl.md +0 -101
  27. package/.cursor/skills/consult/SKILL.md +0 -425
  28. package/.cursor/skills/debate/SKILL.md +0 -316
  29. package/.cursor/skills/deslop/SKILL.md +0 -204
  30. package/.cursor/skills/discover-tasks/SKILL.md +0 -297
  31. package/.cursor/skills/drift-analysis/SKILL.md +0 -324
  32. package/.cursor/skills/enhance-agent-prompts/SKILL.md +0 -277
  33. package/.cursor/skills/enhance-claude-memory/SKILL.md +0 -387
  34. package/.cursor/skills/enhance-cross-file/SKILL.md +0 -110
  35. package/.cursor/skills/enhance-docs/SKILL.md +0 -298
  36. package/.cursor/skills/enhance-hooks/SKILL.md +0 -554
  37. package/.cursor/skills/enhance-orchestrator/SKILL.md +0 -255
  38. package/.cursor/skills/enhance-plugins/SKILL.md +0 -319
  39. package/.cursor/skills/enhance-prompts/SKILL.md +0 -340
  40. package/.cursor/skills/enhance-skills/SKILL.md +0 -436
  41. package/.cursor/skills/learn/SKILL.md +0 -349
  42. package/.cursor/skills/orchestrate-review/SKILL.md +0 -260
  43. package/.cursor/skills/perf-analyzer/SKILL.md +0 -37
  44. package/.cursor/skills/perf-baseline-manager/SKILL.md +0 -30
  45. package/.cursor/skills/perf-benchmarker/SKILL.md +0 -52
  46. package/.cursor/skills/perf-code-paths/SKILL.md +0 -32
  47. package/.cursor/skills/perf-investigation-logger/SKILL.md +0 -41
  48. package/.cursor/skills/perf-profiler/SKILL.md +0 -42
  49. package/.cursor/skills/perf-theory-gatherer/SKILL.md +0 -35
  50. package/.cursor/skills/perf-theory-tester/SKILL.md +0 -36
  51. package/.cursor/skills/repo-mapping/SKILL.md +0 -83
  52. package/.cursor/skills/sync-docs/SKILL.md +0 -351
  53. package/.cursor/skills/validate-delivery/SKILL.md +0 -186
  54. package/.cursor/skills/web-auth/SKILL.md +0 -177
  55. package/.cursor/skills/web-browse/SKILL.md +0 -516
  56. package/.kiro/steering/audit-project-agents.md +0 -459
  57. package/.kiro/steering/audit-project-github.md +0 -146
  58. package/.kiro/steering/audit-project.md +0 -330
  59. package/.kiro/steering/consult.md +0 -422
  60. package/.kiro/steering/debate.md +0 -386
  61. package/.kiro/steering/delivery-approval.md +0 -339
  62. package/.kiro/steering/deslop.md +0 -149
  63. package/.kiro/steering/drift-detect.md +0 -264
  64. package/.kiro/steering/enhance.md +0 -177
  65. package/.kiro/steering/learn.md +0 -166
  66. package/.kiro/steering/next-task.md +0 -481
  67. package/.kiro/steering/perf.md +0 -469
  68. package/.kiro/steering/repo-map.md +0 -126
  69. package/.kiro/steering/ship-ci-review-loop.md +0 -473
  70. package/.kiro/steering/ship-deployment.md +0 -353
  71. package/.kiro/steering/ship-error-handling.md +0 -270
  72. package/.kiro/steering/ship.md +0 -522
  73. package/.kiro/steering/sync-docs.md +0 -178
  74. package/.kiro/steering/web-ctl.md +0 -106
@@ -1,519 +0,0 @@
1
-
2
- # /next-task - Master Workflow Orchestrator
3
-
4
- Discover what to work on next and execute the complete implementation workflow.
5
-
6
- ---
7
-
8
- <no-shortcuts-policy>
9
- ## No Shortcuts Policy
10
-
11
- This workflow exists because each step serves a purpose. Taking shortcuts defeats the purpose of automation.
12
-
13
- | Step | Purpose | What Happens If Skipped |
14
- |------|---------|------------------------|
15
- | Worktree creation | Parallel task isolation | Conflicts, lost work |
16
- | Review loop (5 iterations, stall-safe) | Catches bugs humans miss | Bugs ship to production |
17
- | 3-minute CI wait | Auto-reviewers need time | Miss critical feedback |
18
- | Address all PR comments | Quality gate | Merge blocked, trust lost |
19
-
20
- ### Enforcement Rules
21
-
22
- 1. Every step is mandatory - not suggestions, not guidelines, requirements
23
- 2. Use the specified agents - do not substitute with manual commands
24
- 3. Output verification blocks - prove each step completed
25
- 4. If you think a step is unnecessary, review the "What Happens If Skipped" column above
26
-
27
- ### Forbidden Shortcuts
28
-
29
- - `git checkout -b` or `git branch` instead of `worktree-manager` agent
30
- - Single CI check instead of monitoring loop
31
- - Rationalizing skips ("it's faster", "not needed this time")
32
- </no-shortcuts-policy>
33
-
34
- ---
35
-
36
- ## Workflow Overview
37
-
38
- **Phases 1-6 (User Interaction):**
39
- 1. Policy Selection
40
- 2. Task Discovery
41
- 3. Worktree Setup
42
- 4. Exploration
43
- 5. Planning
44
- 6. User Approval
45
-
46
- **Phases 7-12 (Autonomous):**
47
- 7. Implementation
48
- 8. Pre-Review Gates
49
- 9. Review Loop
50
- 10. Delivery Validation
51
- 11. Docs Update
52
- 12. `ship`
53
-
54
- **Human interaction points (ONLY THESE):**
55
- 1. Policy selection via checkboxes
56
- 2. Task selection from ranked list
57
- 3. Plan approval (EnterPlanMode/ExitPlanMode)
58
-
59
- <workflow-gates>
60
- ## Workflow Gates
61
-
62
- Each phase must complete before the next starts:
63
-
64
- | Gate | Requirement |
65
- |------|-------------|
66
- | Implementation | Agent completes all plan steps |
67
- | Pre-Review | deslop-agent + test-coverage-checker (parallel) |
68
- | Review Loop | Must approve (no open issues or override) |
69
- | Delivery | Tests pass, build passes |
70
- | Docs | Documentation updated |
71
- | Ship | Explicit `ship` invocation (plugin command) |
72
-
73
- **Forbidden actions for agents:**
74
- - No agent may create PRs or push to remote (only ship)
75
- - No agent may skip Phase 9, delivery-validator, or docs update
76
- </workflow-gates>
77
-
78
- ## Arguments
79
-
80
- Parse from $ARGUMENTS:
81
- - `--status`: Show current workflow state and exit
82
- - `--resume [task/branch/worktree]`: Continue from last checkpoint
83
- - `--abort`: Cancel workflow and cleanup
84
- - `--implement`: Skip to implementation after task selection
85
- - `[filter]`: Task filter (bug, feature, security, test)
86
-
87
- ### Resume Syntax
88
-
89
- ```
90
- /next-task --resume # Resume active worktree (if only one)
91
- /next-task --resume 123 # Resume by task ID
92
- /next-task --resume feature/my-task-123 # Resume by branch name
93
- /next-task --resume ../worktrees/my-task-123 # Resume by worktree path
94
- ```
95
-
96
- ## Default Behavior (No Arguments)
97
-
98
- 1. Goes to Phase 1: Policy Selection
99
- 2. Policy selector checks for existing tasks in `{stateDir}/tasks.json`
100
- 3. If existing tasks found, **ASKS USER** what to do
101
- 4. Then continues with normal policy configuration
102
-
103
- The workflow never auto-resumes. It always asks first.
104
-
105
- <opencode-constraint>
106
- ## OpenCode Label Limit
107
-
108
- All AskUserQuestion option labels must be ≤30 characters. Put details in `description`, not `label`.
109
- </opencode-constraint>
110
-
111
- ## State Management
112
-
113
- Uses `lib/state/workflow-state.js` for all state operations:
114
-
115
- | File | Location | Purpose |
116
- |------|----------|---------|
117
- | `tasks.json` | Main repo `{stateDir}/` | Active task registry |
118
- | `flow.json` | Worktree `{stateDir}/` | Workflow progress |
119
-
120
- Key functions:
121
- - `workflowState.startPhase(phase)` - Begin a phase
122
- - `workflowState.completePhase(result)` - Complete and advance
123
- - `workflowState.updateFlow(updates)` - Partial state updates
124
- - `workflowState.hasActiveTask()` - Check for existing work
125
- - `workflowState.canResume()` - Check if resumable
126
-
127
- ## Pre-flight: Handle Arguments
128
-
129
- ```javascript
130
-
131
-
132
- const pluginRoot = getPluginRoot('next-task');
133
- );
134
- const args = '$ARGUMENTS'.split(' ').filter(Boolean);
135
-
136
- // No flags → Phase 1 (Policy Selection asks about existing tasks)
137
- if (args.length === 0) {
138
- console.log("Starting Phase 1 (Policy Selection)");
139
- }
140
-
141
- // Handle --status, --abort, --resume via workflowState functions
142
- if (args.includes('--status')) {
143
- const summary = workflowState.getFlowSummary();
144
- console.log(summary ? `Phase: ${summary.phase} | Task: ${summary.task}` : "No active workflow.");
145
- return;
146
- }
147
-
148
- if (args.includes('--abort')) {
149
- workflowState.abortWorkflow('User requested abort');
150
- return;
151
- }
152
-
153
- if (args.includes('--resume')) {
154
- // Use lib functions to find worktree and resume from last phase
155
- const flow = workflowState.readFlow();
156
- if (flow && workflowState.canResume()) {
157
- console.log(`Resuming from phase: ${flow.phase}`);
158
- }
159
- }
160
- ```
161
-
162
- <phase-1>
163
- ## Phase 1: Policy Selection
164
-
165
- No agent needed. Use AskUserQuestion tool with ALL 3 questions from `lib/sources/policy-questions.js`.
166
-
167
- **MANDATORY - Ask ALL 3 Questions:**
168
-
169
- | # | Header | Question | Options |
170
- |---|--------|----------|---------|
171
- | 1 | Source | Where should I look for tasks? | GitHub Issues, GitHub Projects, GitLab Issues, Local tasks.md, Custom, Other (+ cached if exists) |
172
- | 2 | Priority | What type of tasks to prioritize? | All, Bugs, Security, Features |
173
- | 3 | Stop Point | How far should I take this task? | Merged, PR Created, Implemented, Deployed, Production |
174
-
175
- **Forbidden Actions:**
176
- - Skipping any of the 3 questions
177
- - Inventing your own questions instead of using the exact ones above
178
- - Proceeding to Phase 2 without all 3 answers
179
-
180
- ```javascript
181
- // Reference implementation - use ALL questions
182
- );
183
- const { questions, cachedPreference } = sources.getPolicyQuestions();
184
- // questions array contains all 3 questions above
185
- AskUserQuestion({ questions }); // Pass all 3 questions
186
-
187
- // Handle GitHub Projects follow-up
188
- if (sources.needsProjectFollowUp(responses.source)) {
189
- const projectQs = sources.getProjectQuestions();
190
- const projectResponses = await AskUserQuestion(projectQs);
191
- responses.project = {
192
- number: projectResponses['Project Number'],
193
- owner: projectResponses['Project Owner']
194
- };
195
- }
196
-
197
- const policy = sources.parseAndCachePolicy(responses);
198
- workflowState.updateFlow({ policy, phase: 'task-discovery' });
199
- ```
200
- </phase-1>
201
-
202
- <phase-2>
203
- ## Phase 2: Task Discovery
204
-
205
- **Agent**: `task-discoverer` (sonnet)
206
-
207
- ```javascript
208
- workflowState.startPhase('task-discovery');
209
- Invoke the task-discoverer agent
210
- ```
211
- </phase-2>
212
-
213
- <phase-3>
214
- ## Phase 3: Worktree Setup
215
-
216
- **Blocking gate** - Cannot proceed to Phase 4 without completing this.
217
-
218
- Spawn: `worktree-manager` (haiku)
219
-
220
- ```javascript
221
- workflowState.startPhase('worktree-setup');
222
-
223
- // Required - use this agent, not manual git commands
224
- const worktreeResult = Invoke the worktree-manager agent
225
-
226
- // Verification - mandatory before proceeding
227
- if (!worktreeResult.worktreePath) {
228
- throw new Error('[BLOCKED] Worktree creation failed - STOP');
229
- }
230
- console.log(`[VERIFIED] Worktree: ${worktreeResult.worktreePath}`);
231
- ```
232
-
233
- ### Forbidden Actions for Phase 3
234
- - `git checkout -b <branch>` (use worktree-manager agent)
235
- - `git branch <branch>` (use worktree-manager agent)
236
- - Proceeding to Phase 4 without worktree verification output
237
- - Skipping worktree "because branching is faster"
238
- </phase-3>
239
-
240
- <phase-4>
241
- ## Phase 4: Exploration
242
-
243
- **Agent**: `exploration-agent` (opus)
244
-
245
- ```javascript
246
- workflowState.startPhase('exploration');
247
- Invoke the exploration-agent agent
248
- ```
249
- </phase-4>
250
-
251
- <phase-5>
252
- ## Phase 5: Planning
253
-
254
- **Agent**: `planning-agent` (opus)
255
-
256
- ```javascript
257
- workflowState.startPhase('planning');
258
- const planOutput = Invoke the planning-agent agent
259
- ```
260
- </phase-5>
261
-
262
- <phase-6>
263
- ## Phase 6: User Approval (Plan Mode)
264
-
265
- **Last human interaction point.** Present plan via EnterPlanMode/ExitPlanMode.
266
-
267
- ```javascript
268
- EnterPlanMode();
269
- // User reviews and approves via ExitPlanMode
270
- workflowState.completePhase({ planApproved: true, plan });
271
- ```
272
- </phase-6>
273
-
274
- <phase-7>
275
- ## Phase 7: Implementation
276
-
277
- **Agent**: `implementation-agent` (opus)
278
-
279
- ```javascript
280
- workflowState.startPhase('implementation');
281
- Invoke the implementation-agent agent
282
- // → SubagentStop hook triggers pre-review gates
283
- ```
284
- </phase-7>
285
-
286
- <phase-8>
287
- ## Phase 8: Pre-Review Gates
288
-
289
- **Agents** (parallel): `deslop-agent` + `test-coverage-checker` (sonnet)
290
-
291
- ```javascript
292
- workflowState.startPhase('pre-review-gates');
293
-
294
- // Helper to parse deslop structured output
295
- function parseDeslop(output) {
296
- const match = output.match(/=== DESLOP_RESULT ===[\s\S]*?({[\s\S]*?})[\s\S]*?=== END_RESULT ===/);
297
- return match ? JSON.parse(match[1]) : { fixes: [] };
298
- }
299
-
300
- // Run deslop and test-coverage in parallel
301
- const [deslopResult, coverageResult] = await Promise.all([
302
- Task({
303
- subagent_type: "deslop-agent",
304
- prompt: `Scan for AI slop patterns.
305
- Mode: apply
306
- Scope: diff
307
- Thoroughness: normal
308
-
309
- Return structured results between === DESLOP_RESULT === markers.`
310
- }),
311
- Task({ subagent_type: "test-coverage-checker", prompt: `Validate test coverage.` })
312
- ]);
313
-
314
- // If fixes found, spawn simple-fixer
315
- const deslop = parseDeslop(deslopResult);
316
- if (deslop.fixes && deslop.fixes.length > 0) {
317
- Invoke the simple-fixer agent
318
- }
319
-
320
- const gatesPassed = (deslop.fixes?.length || 0) === 0;
321
- workflowState.completePhase({ passed: gatesPassed, deslopFixes: deslop.fixes?.length || 0, coverageResult });
322
- ```
323
- </phase-8>
324
-
325
- <phase-9>
326
- ## Phase 9: Review Loop
327
-
328
- **Blocking gate** - Must run iterations before delivery validation.
329
-
330
- ```javascript
331
- workflowState.startPhase('review-loop');
332
- ```
333
-
334
- **CRITICAL**: You MUST spawn multiple parallel reviewer agents. Do NOT use a single generic reviewer.
335
-
336
- ### Step 1: Get Changed Files
337
-
338
- ```bash
339
- git diff --name-only main...HEAD
340
- ```
341
-
342
- ### Step 2: Detect Signals for Conditional Specialists
343
-
344
- Based on changed files, detect which additional specialists are needed:
345
-
346
- | Signal | Pattern | Specialist |
347
- |--------|---------|------------|
348
- | hasDb | `/(db\|migrations?\|schema\|prisma\|sql)/i` | database specialist |
349
- | hasApi | `/(api\|routes?\|controllers?\|handlers?)/i` | api designer |
350
- | hasFrontend | `/\.(tsx\|jsx\|vue\|svelte)$/` | frontend specialist |
351
- | hasBackend | `/(server\|backend\|services?\|domain)/i` | backend specialist |
352
- | hasDevops | `/(\.github\/workflows\|Dockerfile\|k8s\|terraform)/i` | devops reviewer |
353
- | needsArchitecture | 20+ changed files | architecture reviewer |
354
-
355
- ### Step 3: Spawn ALL Reviewer Agents in Parallel
356
-
357
- **MANDATORY**: Spawn these 4 core reviewers (ALWAYS) + any conditional specialists detected above.
358
-
359
- ```javascript
360
- // 4 CORE REVIEWERS - ALWAYS SPAWN ALL 4 IN PARALLEL
361
- const coreReviewers = [
362
- { role: 'code quality reviewer', focus: 'Style, best practices, bugs, error handling, duplication' },
363
- { role: 'security reviewer', focus: 'Auth flaws, input validation, injection, secrets exposure' },
364
- { role: 'performance reviewer', focus: 'N+1 queries, blocking ops, hot path issues, memory leaks' },
365
- { role: 'test coverage reviewer', focus: 'Missing tests, edge cases, test quality, mock appropriateness' }
366
- ];
367
-
368
- // Spawn ALL 4 core reviewers in parallel using Task tool
369
- const reviewResults = await Promise.all([
370
- Task({ subagent_type: 'general-purpose', model: 'sonnet',
371
- prompt: `You are a code quality reviewer. Review these files: ${files.join(', ')}
372
- Focus: Style and consistency, Best practices, Bugs and logic errors, Error handling, Maintainability, Duplication
373
- Return findings as JSON array with: file, line, severity (critical/high/medium/low), description, suggestion` }),
374
- Task({ subagent_type: 'general-purpose', model: 'sonnet',
375
- prompt: `You are a security reviewer. Review these files: ${files.join(', ')}
376
- Focus: Auth/authz flaws, Input validation, Injection risks, Secrets exposure, Insecure defaults
377
- Return findings as JSON array with: file, line, severity (critical/high/medium/low), description, suggestion` }),
378
- Task({ subagent_type: 'general-purpose', model: 'sonnet',
379
- prompt: `You are a performance reviewer. Review these files: ${files.join(', ')}
380
- Focus: N+1 queries, Blocking operations, Hot path inefficiencies, Memory leaks
381
- Return findings as JSON array with: file, line, severity (critical/high/medium/low), description, suggestion` }),
382
- Task({ subagent_type: 'general-purpose', model: 'sonnet',
383
- prompt: `You are a test coverage reviewer. Review these files: ${files.join(', ')}
384
- Focus: Missing tests, Edge case coverage, Test quality, Integration needs, Mock appropriateness
385
- Return findings as JSON array with: file, line, severity (critical/high/medium/low), description, suggestion` })
386
- ]);
387
-
388
- // Add conditional specialists based on signals (spawn in parallel with appropriate prompts)
389
- ```
390
-
391
- ### Step 4: Aggregate Findings
392
-
393
- Combine all reviewer findings, deduplicate by file+line+description, group by severity.
394
-
395
- ### Step 5: Fix Issues (severity order: critical -> high -> medium -> low)
396
-
397
- For each finding, use Edit tool to apply the suggested fix. Commit after each batch.
398
-
399
- ### Step 6: Iterate Until Clean (max 5 iterations)
400
-
401
- Repeat steps 3-5 until:
402
- - `openCount === 0` (all issues resolved) -> approved
403
- - Same findings hash for 2 consecutive iterations (stall detected) -> blocked
404
- - 5 iterations reached (hard limit) -> blocked
405
-
406
- ### Review Iteration Rules
407
- - MUST run at least 1 full iteration with ALL 4 core reviewers
408
- - Do NOT use a single generic reviewer - spawn all specialists in parallel
409
- - MUST continue while `openCount > 0`. Only stop on: openCount===0, stall detection, or 5-iteration hard limit
410
- - Do not skip directly to delivery validation
411
- - Do not claim "review passed" without spawning the reviewer agents
412
-
413
- ### Verification Output (MANDATORY)
414
-
415
- After review loop completes, output:
416
- ```
417
- [VERIFIED] Review Loop Complete
418
- - Iterations: N
419
- - Core reviewers spawned: code-quality, security, performance, test-coverage
420
- - Conditional specialists: [list any that were added]
421
- - Findings resolved: X critical, Y high, Z medium
422
- - Status: approved | blocked
423
- ```
424
-
425
- Then advance the workflow state:
426
- ```javascript
427
- workflowState.completePhase({ approved, iterations, remaining });
428
- ```
429
- </phase-9>
430
-
431
- <phase-10>
432
- ## Phase 10: Delivery Validation
433
-
434
- **Agent**: `delivery-validator` (sonnet)
435
-
436
- ```javascript
437
- workflowState.startPhase('delivery-validation');
438
- const result = Invoke the delivery-validator agent
439
- if (!result.approved) {
440
- workflowState.failPhase(result.reason, { fixInstructions: result.fixInstructions });
441
- return; // Retries from implementation
442
- }
443
- ```
444
- </phase-10>
445
-
446
- <phase-11>
447
- ## Phase 11: Docs Update
448
-
449
- **Agent**: `sync-docs-agent` (sonnet)
450
-
451
- Uses the unified sync-docs agent from the sync-docs plugin with `before-pr` scope.
452
-
453
- ```javascript
454
- workflowState.startPhase('docs-update');
455
-
456
- // Helper to parse sync-docs structured output
457
- function parseSyncDocsResult(output) {
458
- const match = output.match(/=== SYNC_DOCS_RESULT ===[\s\S]*?({[\s\S]*?})[\s\S]*?=== END_RESULT ===/);
459
- return match ? JSON.parse(match[1]) : { issues: [], fixes: [], changelog: { status: 'ok' } };
460
- }
461
-
462
- // Run sync-docs with before-pr scope
463
- const syncResult = Invoke the sync-docs-agent agent
464
-
465
- // Parse results from === SYNC_DOCS_RESULT === markers
466
- const result = parseSyncDocsResult(syncResult);
467
-
468
- // If fixes are needed, spawn simple-fixer
469
- if (result.fixes && result.fixes.length > 0) {
470
- Invoke the simple-fixer agent
471
- }
472
-
473
- workflowState.completePhase({ docsUpdated: true, fixesApplied: result.fixes?.length || 0 });
474
- ```
475
- </phase-11>
476
-
477
- <phase-12>
478
- ## Phase 12: Handoff to ship
479
-
480
- After docs update (sync-docs-agent) completes, invoke `ship` explicitly:
481
-
482
- ```javascript
483
- workflowState.startPhase('shipping');
484
- console.log(`Task #${state.task.id} passed all validation. Invoking ship...`);
485
- const stateDir = workflowState.getStateDir(); // Returns platform-aware state directory
486
- await Skill({ name: "ship", args: `--state-file "${stateDir}/flow.json"` });
487
- ```
488
-
489
- **ship responsibilities:**
490
- - Create PR, push branch
491
- - Monitor CI and review comments
492
- - Merge when approved
493
- - Cleanup worktree and tasks.json
494
- </phase-12>
495
-
496
- ## Error Handling
497
-
498
- ```javascript
499
- try {
500
- // ... workflow phases ...
501
- } catch (error) {
502
- workflowState.failPhase(error.message);
503
- console.log(`Workflow failed. Use --resume to retry or --abort to cancel.`);
504
- }
505
- ```
506
-
507
- ## Success Criteria
508
-
509
- - Policy selection via checkboxes
510
- - Two-file state management (tasks.json + flow.json)
511
- - Resume by task ID, branch, or worktree path
512
- - Worktree isolation for parallel workflows
513
- - Opus for complex tasks (explore, plan, implement)
514
- - Sonnet for validation tasks (review, delivery)
515
- - Haiku for simple tasks (worktree)
516
- - Fully autonomous after plan approval
517
- - Explicit ship handoff for PR workflow
518
-
519
- Begin workflow now.