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