@nklisch/pi-agile-workflow 0.15.3 → 0.16.1
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/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +8 -0
- package/docs/ARCHITECTURE.md +97 -57
- package/docs/SPEC.md +53 -2
- package/docs/VISION.md +24 -8
- package/package.json +1 -1
- package/scripts/tests/convert-content-integrity.test.sh +4 -4
- package/scripts/tests/convert-review-weight.test.sh +61 -0
- package/scripts/work-view.sh +1 -1
- package/skills/autopilot/SKILL.md +103 -71
- package/skills/convert/SKILL.md +28 -8
- package/skills/epic-design/SKILL.md +19 -70
- package/skills/feature-design/SKILL.md +18 -57
- package/skills/fix/SKILL.md +52 -34
- package/skills/implement/SKILL.md +61 -50
- package/skills/implement-orchestrator/SKILL.md +274 -587
- package/skills/perf-design/SKILL.md +11 -12
- package/skills/principles/SKILL.md +120 -378
- package/skills/principles/references/advisory-review.md +69 -0
- package/skills/principles/references/code-design.md +107 -0
- package/skills/principles/references/models.md +42 -63
- package/skills/prose-author/SKILL.md +9 -4
- package/skills/refactor-design/SKILL.md +3 -4
- package/skills/review/SKILL.md +132 -46
- package/work-view/crates/cli/.work-view-version +1 -1
- package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
- package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
- package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
- package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
|
@@ -67,8 +67,8 @@ Pick the **top 3-5** entry points most likely to dominate runtime. Heuristics:
|
|
|
67
67
|
on critical user paths, called per-request or per-event, high call count from
|
|
68
68
|
logs/tests, known historically slow, contain nested loops or I/O.
|
|
69
69
|
|
|
70
|
-
If confidence is low
|
|
71
|
-
|
|
70
|
+
If confidence is low, apply `principles/SKILL.md` Part III. Candidate selection
|
|
71
|
+
is normally reversible: choose the best-supported paths and log the rationale.
|
|
72
72
|
|
|
73
73
|
**Cap the scan.** Never profile every function in the codebase.
|
|
74
74
|
|
|
@@ -112,14 +112,13 @@ drafting features. Iterate over the target set:
|
|
|
112
112
|
|
|
113
113
|
1. Read the feature; skip if not `[perf]`-tagged or not at `stage: drafting`
|
|
114
114
|
2. Light ground (foundation docs + AGENTS.md / CLAUDE.md + existing benchmarks)
|
|
115
|
-
3.
|
|
116
|
-
scenario
|
|
117
|
-
"acceptable memory or layout tradeoff for speed?"). Use structured question tool.
|
|
115
|
+
3. Use the structured question tool for strategic performance ambiguities such
|
|
116
|
+
as target scenario, success threshold, hardware, or resource trade-offs.
|
|
118
117
|
4. Capture answers under `## Design decisions` in the feature body
|
|
119
118
|
5. Do NOT design or advance stage
|
|
120
119
|
6. Commit per feature: `perf-design --only-questions: <id>`
|
|
121
120
|
|
|
122
|
-
Requires interactive mode; refuse
|
|
121
|
+
Requires interactive mode; refuse under autopilot. Otherwise defer question and advisory policy to `principles/SKILL.md` Parts III–IV.
|
|
123
122
|
|
|
124
123
|
## The optimization hierarchy
|
|
125
124
|
|
|
@@ -173,12 +172,12 @@ Read `.work/active/features/<id>.md`. Confirm:
|
|
|
173
172
|
- `stage: drafting`
|
|
174
173
|
- `tags` includes `perf`
|
|
175
174
|
|
|
176
|
-
The brief should describe the
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
The brief should describe the performance problem and target. If it is vague,
|
|
176
|
+
apply `principles/SKILL.md` Part III: infer and log reversible benchmark details,
|
|
177
|
+
but use strategic questions in interactive mode when the workload or success
|
|
178
|
+
threshold changes product direction or an external performance contract. Under
|
|
179
|
+
autopilot, choose the best-supported measurable scenario; halt only when no
|
|
180
|
+
scenario matching the brief can be measured.
|
|
182
181
|
|
|
183
182
|
### Phase 2: Ground yourself
|
|
184
183
|
|
|
@@ -23,209 +23,32 @@ Each principle has guidance for design time and implementation time.
|
|
|
23
23
|
|
|
24
24
|
# Part I — Code-Design Principles
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**Ports** are interfaces defined in the domain layer that describe what the domain needs (a database, a file store, an HTTP client, a clock). **Adapters** are infrastructure implementations of those interfaces.
|
|
31
|
-
|
|
32
|
-
### At design time
|
|
33
|
-
|
|
34
|
-
- Identify every external dependency the feature touches (DB, filesystem, HTTP, queues, time, randomness)
|
|
35
|
-
- Define an interface (port) for each one in the domain layer
|
|
36
|
-
- Infrastructure modules implement those interfaces
|
|
37
|
-
- The domain function signature takes the port as a parameter or receives it via dependency injection — it never imports the adapter directly
|
|
38
|
-
|
|
39
|
-
**Example structure:**
|
|
40
|
-
```
|
|
41
|
-
src/
|
|
42
|
-
domain/
|
|
43
|
-
user.ts # core logic — imports only domain types and ports
|
|
44
|
-
ports.ts # UserRepository interface, EmailSender interface
|
|
45
|
-
infrastructure/
|
|
46
|
-
db/user-repo.ts # implements UserRepository using Drizzle
|
|
47
|
-
email/smtp.ts # implements EmailSender using nodemailer
|
|
48
|
-
app/
|
|
49
|
-
wire.ts # assembles: new UserService(new DbUserRepo(), new SmtpEmailSender())
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Design checklist:**
|
|
53
|
-
- [ ] Every external dependency has an interface in the domain layer
|
|
54
|
-
- [ ] No `import { db }` or `import { fs }` in domain modules
|
|
55
|
-
- [ ] Infrastructure modules are only referenced in composition roots (wire-up / entry points)
|
|
56
|
-
|
|
57
|
-
### At implementation time
|
|
58
|
-
|
|
59
|
-
When implementing domain logic, enforce the boundary: domain code receives infrastructure as a typed parameter, never imports it directly.
|
|
60
|
-
|
|
61
|
-
**Good:**
|
|
62
|
-
```typescript
|
|
63
|
-
// domain/user-service.ts
|
|
64
|
-
export function createUser(repo: UserRepository, email: string): Promise<User> {
|
|
65
|
-
return repo.insert({ email })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// app/wire.ts (entry point)
|
|
69
|
-
import { createUser } from '../domain/user-service'
|
|
70
|
-
import { DrizzleUserRepo } from '../infrastructure/db/user-repo'
|
|
71
|
-
const repo = new DrizzleUserRepo(db)
|
|
72
|
-
app.post('/users', (c) => createUser(repo, c.req.body.email))
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Bad:**
|
|
76
|
-
```typescript
|
|
77
|
-
// domain/user-service.ts
|
|
78
|
-
import { db } from '../infrastructure/db' // NEVER — domain imports infra
|
|
26
|
+
These four invariants stay active during design and implementation. Load
|
|
27
|
+
[references/code-design.md](references/code-design.md) when concrete mechanics,
|
|
28
|
+
checklists, or examples are needed.
|
|
79
29
|
|
|
80
|
-
|
|
81
|
-
return db.insert(users).values({ email })
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
If you find yourself needing to import infrastructure into domain, that's the signal to add a port interface instead.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 2. Single Source of Truth (Data-Driven Extensibility)
|
|
90
|
-
|
|
91
|
-
When a concept can have multiple variants that may grow over time (roles, statuses, event types, providers, feature flags), define that set of variants **once** as a data structure. All logic — types, validation, routing, display — derives from that single definition.
|
|
92
|
-
|
|
93
|
-
### At design time
|
|
30
|
+
## 1. Ports & Adapters
|
|
94
31
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
**Example structure:**
|
|
100
|
-
```typescript
|
|
101
|
-
// Defined once
|
|
102
|
-
const ROLES = ['admin', 'editor', 'viewer'] as const
|
|
103
|
-
type Role = typeof ROLES[number]
|
|
104
|
-
|
|
105
|
-
// Or richer: a config map where behavior flows from data
|
|
106
|
-
const ROLE_CONFIG = {
|
|
107
|
-
admin: { level: 2, label: 'Admin' },
|
|
108
|
-
editor: { level: 1, label: 'Editor' },
|
|
109
|
-
viewer: { level: 0, label: 'Viewer' },
|
|
110
|
-
} satisfies Record<string, RoleConfig>
|
|
111
|
-
type Role = keyof typeof ROLE_CONFIG
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Design checklist:**
|
|
115
|
-
- [ ] Extensible sets of variants are defined as a single authoritative constant/schema
|
|
116
|
-
- [ ] Downstream types are derived from the registry (not duplicated)
|
|
117
|
-
- [ ] Adding a new variant requires changing only the registry definition
|
|
32
|
+
Domain logic stays independent of databases, filesystems, HTTP, time,
|
|
33
|
+
randomness, and other infrastructure. The domain defines the ports it needs;
|
|
34
|
+
adapters implement them, and composition roots wire the two together.
|
|
118
35
|
|
|
119
|
-
|
|
36
|
+
## 2. Single Source of Truth
|
|
120
37
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
**Good:**
|
|
124
|
-
```typescript
|
|
125
|
-
const ROLE_CONFIG = {
|
|
126
|
-
admin: { level: 2, canDelete: true },
|
|
127
|
-
editor: { level: 1, canDelete: false },
|
|
128
|
-
viewer: { level: 0, canDelete: false },
|
|
129
|
-
} as const satisfies Record<string, RoleConfig>
|
|
130
|
-
|
|
131
|
-
type Role = keyof typeof ROLE_CONFIG
|
|
132
|
-
const ROLES = Object.keys(ROLE_CONFIG) as Role[]
|
|
133
|
-
const RoleSchema = z.enum(ROLES as [Role, ...Role[]])
|
|
134
|
-
|
|
135
|
-
// Adding 'owner' role = one change, in one place
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**Bad:**
|
|
139
|
-
```typescript
|
|
140
|
-
type Role = 'admin' | 'editor' | 'viewer' // defined here
|
|
141
|
-
const roles = ['admin', 'editor', 'viewer'] // re-enumerated here
|
|
142
|
-
const RoleSchema = z.enum(['admin', 'editor', 'viewer']) // again here
|
|
143
|
-
switch (role) {
|
|
144
|
-
case 'admin': ... // and again here
|
|
145
|
-
case 'editor': ...
|
|
146
|
-
case 'viewer': ...
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
38
|
+
Growing variant sets have one authoritative typed registry. Types, validation,
|
|
39
|
+
routing, and display derive from it rather than re-enumerating the variants.
|
|
151
40
|
|
|
152
41
|
## 3. Generated Contracts
|
|
153
42
|
|
|
154
|
-
|
|
43
|
+
Boundary types derive from the schema, router, database model, or a generation
|
|
44
|
+
step. Consumers import or infer that contract instead of maintaining hand-written
|
|
45
|
+
copies.
|
|
155
46
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
**Common approaches by boundary type:**
|
|
159
|
-
- **HTTP API → client**: OpenAPI schema → generated client types (openapi-typescript, orval)
|
|
160
|
-
- **tRPC router → client**: router type is the contract, shared directly
|
|
161
|
-
- **Database schema → app types**: Drizzle/Prisma inferred types, not hand-written interfaces
|
|
162
|
-
- **GraphQL schema → types**: codegen from SDL
|
|
163
|
-
|
|
164
|
-
- Identify every cross-boundary interface in the feature
|
|
165
|
-
- For each one, choose a single source of truth (schema file, router definition, DB schema)
|
|
166
|
-
- Design the generation step into the build pipeline — not a manual step
|
|
167
|
-
- Consumers import generated types, not hand-written duplicates
|
|
168
|
-
|
|
169
|
-
**Design checklist:**
|
|
170
|
-
- [ ] Every client-facing contract has a designated source of truth
|
|
171
|
-
- [ ] A generation step is identified (codegen tool, shared type import, inferred type)
|
|
172
|
-
- [ ] No hand-written types that mirror types defined elsewhere
|
|
173
|
-
|
|
174
|
-
### At implementation time
|
|
175
|
-
|
|
176
|
-
Do not hand-write types that are derivable from a schema, router, or database definition. Import or generate them.
|
|
177
|
-
|
|
178
|
-
**Good:**
|
|
179
|
-
```typescript
|
|
180
|
-
import type { AppRouter } from '../../server/router'
|
|
181
|
-
// type-safe from the source
|
|
182
|
-
|
|
183
|
-
const { data } = useQuery<InferSelectModel<typeof users>>( ... )
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**Bad:**
|
|
187
|
-
```typescript
|
|
188
|
-
// Hand-written duplicate of what Drizzle already knows
|
|
189
|
-
interface User {
|
|
190
|
-
id: number
|
|
191
|
-
email: string
|
|
192
|
-
createdAt: Date
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
If a generated type needs extending, use `type MyType = GeneratedType & { extra: string }` — extend the source of truth, don't replace it.
|
|
47
|
+
## 4. Fail Fast
|
|
197
48
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
Catch bad data at the door, not three calls deep where the stack trace is useless. Validate inputs at the entry point of every function or system boundary.
|
|
203
|
-
|
|
204
|
-
- At system boundaries (HTTP handlers, CLI args, external API responses, config files): parse with Zod or equivalent before any logic runs
|
|
205
|
-
- At internal function boundaries: assert preconditions at the top of the function — guard clauses, not nested ifs
|
|
206
|
-
- Prefer `throw`/`return early` over propagating bad state deep into call chains
|
|
207
|
-
- Errors should be loud and specific at the point of violation — "expected positive number, got -3" beats a cryptic null reference five layers down
|
|
208
|
-
|
|
209
|
-
**Good:**
|
|
210
|
-
```typescript
|
|
211
|
-
function processOrder(input: unknown) {
|
|
212
|
-
const order = OrderSchema.parse(input) // throws immediately if invalid
|
|
213
|
-
return computeTotal(order)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function applyDiscount(order: Order, pct: number) {
|
|
217
|
-
if (pct < 0 || pct > 1) throw new Error(`Invalid discount: ${pct}`)
|
|
218
|
-
// ... rest of logic
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
**Bad:**
|
|
223
|
-
```typescript
|
|
224
|
-
function processOrder(input: any) {
|
|
225
|
-
// passes raw input through, blows up 5 calls deep
|
|
226
|
-
return computeTotal(input)
|
|
227
|
-
}
|
|
228
|
-
```
|
|
49
|
+
Validate unknown input at system boundaries and assert internal preconditions at
|
|
50
|
+
function entry. Reject invalid state early with specific errors instead of
|
|
51
|
+
letting it fail deep in the call chain.
|
|
229
52
|
|
|
230
53
|
---
|
|
231
54
|
|
|
@@ -420,43 +243,37 @@ auditable later.
|
|
|
420
243
|
|
|
421
244
|
---
|
|
422
245
|
|
|
423
|
-
# Part III — Caller Awareness
|
|
246
|
+
# Part III — Caller Awareness and Question Policy
|
|
247
|
+
|
|
248
|
+
**The normal rule is consequence-based, not mode-based.** Resolve routine,
|
|
249
|
+
reversible decisions with judgment and record the rationale in the item body.
|
|
250
|
+
Use the structured question tool only when the answer sets product direction,
|
|
251
|
+
materially changes user-facing behavior or an external contract, or commits the
|
|
252
|
+
project to an expensive choice that is difficult to reverse. Existing `## Design decisions` and foundation
|
|
253
|
+
docs are inputs; do not re-ask what they already settle.
|
|
424
254
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
asking the user is fine and often helpful.
|
|
255
|
+
Interactive mode permits those strategic questions. An active autopilot driver
|
|
256
|
+
never asks them: use available evidence and choose the least irreversible sound
|
|
257
|
+
option, logging the decision. Ordinary ambiguity must not halt the queue.
|
|
429
258
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
strongest signal. If no active autopilot driver exists, you are interactive.
|
|
259
|
+
Autopilot mode is binary and detectable. It is on when this skill was delegated
|
|
260
|
+
by an explicit autopilot invocation, an active autopilot harness goal, or a
|
|
261
|
+
prompt clearly continuing/draining that scope. An autopilot caller note is the
|
|
262
|
+
strongest signal. If no active driver exists, the invocation is interactive.
|
|
435
263
|
|
|
436
264
|
## What does NOT count as autopilot
|
|
437
265
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
- **
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
completes, blocks, or is interrupted, subsequent direct skill invocations are
|
|
450
|
-
interactive again.
|
|
451
|
-
|
|
452
|
-
When a user types `/agile-workflow:feature-design <id>` (or any other
|
|
453
|
-
design/implement/review skill) directly, they want a collaborator at the
|
|
454
|
-
checkpoints. Use `structured question tool` unless the direct prompt also makes clear it
|
|
455
|
-
is part of an active autopilot goal.
|
|
456
|
-
|
|
457
|
-
The disambiguation test: *"Is an active autopilot queue goal currently driving
|
|
458
|
-
this skill?"* If you cannot point to that active driver or caller note, you are
|
|
459
|
-
interactive.
|
|
266
|
+
- **General harness "auto mode"** — a reminder to work autonomously changes
|
|
267
|
+
conversational posture, but does not create an autopilot queue goal.
|
|
268
|
+
- **An earlier "just decide" instruction** — it applies to that decision, not a
|
|
269
|
+
later explicit skill invocation.
|
|
270
|
+
- **A completed, blocked, or interrupted autopilot run** — later direct skill
|
|
271
|
+
invocations are interactive again.
|
|
272
|
+
|
|
273
|
+
A direct `/agile-workflow:feature-design <id>` (or other design, implement, or
|
|
274
|
+
review skill) is interactive unless its prompt clearly belongs to an active
|
|
275
|
+
autopilot driver. The disambiguation test is: *"Can I point to the active
|
|
276
|
+
autopilot goal or caller note driving this invocation?"*
|
|
460
277
|
|
|
461
278
|
## What still warrants a hard halt (autopilot or not)
|
|
462
279
|
|
|
@@ -465,171 +282,96 @@ interactive.
|
|
|
465
282
|
- `depends_on` cycle detected when writing items
|
|
466
283
|
- Genuinely contradictory state the skill cannot recover from
|
|
467
284
|
|
|
468
|
-
Everything else
|
|
469
|
-
|
|
470
|
-
can review later.
|
|
285
|
+
Everything else resolves through evidence and judgment under autopilot. Prefer
|
|
286
|
+
the simpler, more reversible option and log why.
|
|
471
287
|
|
|
472
288
|
## Worked examples (autopilot mode)
|
|
473
289
|
|
|
474
290
|
| Situation | Judgment-mode action |
|
|
475
291
|
|---|---|
|
|
476
|
-
| Two architectural options both look valid | Pick the one with fewer moving parts; log
|
|
477
|
-
| Brief is vague, several plausible interpretations | Pick the one most consistent with foundation docs; log under `## Design decisions
|
|
478
|
-
| Multiple candidate items at a stage and no id was passed | Pick most recent by `updated:`; the next iteration picks the next |
|
|
479
|
-
| Wrong-tag invocation routed to you by mistake | Log a misroute note
|
|
480
|
-
| Empty diff during review after trying ranges | Advance to `done` with a "No diff found" note
|
|
481
|
-
| Item at unexpected stage |
|
|
292
|
+
| Two architectural options both look valid | Pick the one with fewer moving parts; log the rationale. |
|
|
293
|
+
| Brief is vague, several plausible interpretations | Pick the one most consistent with foundation docs; log under `## Design decisions`. |
|
|
294
|
+
| Multiple candidate items at a stage and no id was passed | Pick most recent by `updated:`; the next iteration picks the next. |
|
|
295
|
+
| Wrong-tag invocation routed to you by mistake | Log a misroute note; return without advancing. |
|
|
296
|
+
| Empty diff during review after trying ranges | Advance to `done` with a "No diff found" note. |
|
|
297
|
+
| Item at unexpected stage | Choose the recoverable transition and log it. |
|
|
482
298
|
|
|
483
|
-
##
|
|
299
|
+
## Explicit alignment mode
|
|
484
300
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
301
|
+
`--only-questions` is unchanged: it is an explicit, interactive-only alignment
|
|
302
|
+
pass that captures answers under `## Design decisions`, does not design, and
|
|
303
|
+
does not advance stage. Refuse it when autopilot is the active driver. Inside
|
|
304
|
+
that mode, surface the target's meaningful strategic ambiguities even when a
|
|
305
|
+
normal design pass would resolve a reversible point autonomously.
|
|
490
306
|
|
|
491
307
|
## Skills this applies to
|
|
492
308
|
|
|
493
|
-
|
|
494
|
-
`perf-design`, `implement`, `implement-orchestrator`, `review
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
decision points.
|
|
499
|
-
|
|
500
|
-
User-invocable-only skills (`convert`, `epicize`, `ideate`, `bold-refactor`,
|
|
501
|
-
`release-deploy`) can stay interactive-first — autopilot doesn't call them.
|
|
309
|
+
This policy governs `feature-design`, `epic-design`, `refactor-design`,
|
|
310
|
+
`perf-design`, `implement`, `implement-orchestrator`, and `review`, plus the
|
|
311
|
+
cross-plugin research orchestrator when routed from autopilot. Interactive-only
|
|
312
|
+
skills may remain workshop-oriented, but should still avoid questions whose
|
|
313
|
+
answers are routine and reversible.
|
|
502
314
|
|
|
503
315
|
---
|
|
504
316
|
|
|
505
|
-
# Part IV —
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
[references/
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
`
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
- End of an autopilot run, after the scoped queue appears drained and before
|
|
564
|
-
reporting `complete`: run a final `peer-review` loop when a different model
|
|
565
|
-
class is available; otherwise use the freshest reviewer role available,
|
|
566
|
-
labeling it cross-model only if spawned with a different model class. Fix or
|
|
567
|
-
file accepted findings before completion.
|
|
568
|
-
- Completed substantial artifacts, or explicit user requests for review: use
|
|
569
|
-
`peer-review` only when the full iterative loop is appropriate.
|
|
570
|
-
|
|
571
|
-
Designs and reviews are both evaluated in a fixed **two-phase order**
|
|
572
|
-
(full mechanics in [references/models.md](references/models.md) §6):
|
|
573
|
-
|
|
574
|
-
1. **Phase 1 — Completeness / Complementary / Advisory.** Augmentation, not
|
|
575
|
-
judgment. Ask a different-class peer what is missing, what alternatives
|
|
576
|
-
strengthen it, and what questions/risks should be weighed. The loop shape
|
|
577
|
-
depends on the artifact: **designs (open)** get a **single pass** before
|
|
578
|
-
decisions lock; **reviews (complete artifact)** get a **multi-step
|
|
579
|
-
convergence loop to nits** — the ideal is the full `peer-review` loop
|
|
580
|
-
(≥3 passes, stop on nits, cap ~5) when `peer-review` is available.
|
|
581
|
-
2. **Phase 2 — Adversarial.** Attack posture. Ask a **different** peer
|
|
582
|
-
(ideally a different class than Phase 1, per the 2-class rule) what is
|
|
583
|
-
broken, contradictory, built on a false assumption, or will fail in
|
|
584
|
-
operation. For reviews this is the same convergence loop in the attack
|
|
585
|
-
posture; for designs it is a focused adversarial pass. Verify concrete
|
|
586
|
-
claims before accepting.
|
|
587
|
-
|
|
588
|
-
Never reverse the phases and never skip Phase 1 to jump straight to attack. For
|
|
589
|
-
autopilot-driven design work, the default peer ask is **augmentation before
|
|
590
|
-
decisions are locked**, not validation after the host has already decided.
|
|
591
|
-
|
|
592
|
-
Design-time advisory peer failures are non-blocking under autopilot. If the
|
|
593
|
-
peer wrapper is missing, the executable cannot be resolved, the invocation
|
|
594
|
-
fails, or the call would use the same model class, continue with host judgment
|
|
595
|
-
and log the reason briefly. A top-tier reasoning peer still running after only
|
|
596
|
-
a few minutes is not a failure. Do not halt the queue for an advisory review
|
|
597
|
-
failure.
|
|
598
|
-
|
|
599
|
-
The final autopilot completion review is stricter: it must succeed through a
|
|
600
|
-
different-model `peer-review` loop, a generic sub-agent prompted as a
|
|
601
|
-
fresh-context reviewer (cross-model when the caller selects a different model
|
|
602
|
-
class, otherwise same-harness), or another supported fresh-context fallback
|
|
603
|
-
before the run reports `complete`. For deep/complex scope that means clearing
|
|
604
|
-
through at least one cross-class pass per phase in §6 where two classes are
|
|
605
|
-
available; if the selected final-review path fails, the run is blocked on final
|
|
606
|
-
review rather than complete.
|
|
607
|
-
|
|
608
|
-
When invoked, summarize the result in the item body without dumping transcripts:
|
|
609
|
-
|
|
610
|
-
```markdown
|
|
611
|
-
## Other agent review
|
|
612
|
-
- Invoked because: <large/risky/deep-complex/autopilot/no prior alignment>
|
|
613
|
-
- Scope: <single peer | two-class — list classes>
|
|
614
|
-
- Reviewer (Phase 1 — advisory/completeness): <class, if known>
|
|
615
|
-
- Gaps / missing requirements / alternatives considered:
|
|
616
|
-
- <summary>
|
|
617
|
-
- Reviewer (Phase 2 — adversarial): <class, if known; different from Phase 1>
|
|
618
|
-
- Broken assumptions / failure modes / rejected points:
|
|
619
|
-
- <summary>
|
|
620
|
-
- Accepted:
|
|
621
|
-
- <decision or adjustment> (phase N)
|
|
622
|
-
- Rejected:
|
|
623
|
-
- <point> — <reason> (phase N)
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
If only one peer class was available (or only one phase was warranted by scope),
|
|
627
|
-
fill only the phase that ran and note the other was skipped and why.
|
|
628
|
-
|
|
629
|
-
Limit autopilot to one advisory pass per item per design stage. Do not run a
|
|
630
|
-
multi-pass `peer-review` loop inside routine autopilot design unless the user or
|
|
631
|
-
project instructions explicitly require it. The final completion review at the
|
|
632
|
-
end of autopilot is separate from these design-time advisory passes.
|
|
317
|
+
# Part IV — Risk-Driven Advisory Review
|
|
318
|
+
|
|
319
|
+
Advisory review is selected by risk in both direct and autopilot design modes;
|
|
320
|
+
it is not a stage transition and is never triggered merely because autopilot is
|
|
321
|
+
active. Small, low-risk work skips it. Uncertain or risky work gains independent
|
|
322
|
+
scrutiny, while deep or complex work may use multiple model classes. Load
|
|
323
|
+
[references/advisory-review.md](references/advisory-review.md) for scope defaults,
|
|
324
|
+
two-phase mechanics, and the item-body record format. Model classes, host-peer
|
|
325
|
+
pairing, and concrete mechanism flags remain in
|
|
326
|
+
[references/models.md](references/models.md).
|
|
327
|
+
|
|
328
|
+
## `review_weight`
|
|
329
|
+
|
|
330
|
+
`review_weight` is the canonical caller/project control consumed by review and
|
|
331
|
+
autopilot. Allowed values are `none | light | standard | thorough | maximum`;
|
|
332
|
+
the default is `standard`. It expresses the intended breadth and depth of
|
|
333
|
+
**independent** review, while the agent derives the exact topology from artifact
|
|
334
|
+
risk, item tier, scope, and available model classes:
|
|
335
|
+
|
|
336
|
+
- `none` — explicitly opt out of independent review. Implementation
|
|
337
|
+
verification and acceptance evidence remain mandatory.
|
|
338
|
+
- `light` — minimize ceremony while preserving focused scrutiny where risk
|
|
339
|
+
clearly warrants it.
|
|
340
|
+
- `standard` — balanced, risk-driven independent review.
|
|
341
|
+
- `thorough` — increase fresh-context breadth and depth for meaningful risk.
|
|
342
|
+
- `maximum` — permit multi-model, multi-pass complementary-then-adversarial
|
|
343
|
+
review for features and epics, with stories escalating dynamically by risk.
|
|
344
|
+
|
|
345
|
+
The levels are intent and ceilings, not fixed reviewer or pass counts. Explicit
|
|
346
|
+
caller and project policy takes precedence; record the effective weight and any
|
|
347
|
+
degradation. Configuration schema and foundation-doc wiring are follow-up work
|
|
348
|
+
for their owning stories.
|
|
349
|
+
|
|
350
|
+
## Load-bearing invariants
|
|
351
|
+
|
|
352
|
+
- **Different-class labeling:** call a pass cross-model only when the reviewer is
|
|
353
|
+
known to be a different model class from the host. Otherwise label it
|
|
354
|
+
fresh-context. Different-class review is valuable for independent blind spots,
|
|
355
|
+
not greater authority.
|
|
356
|
+
- **Fresh-context semantics:** when independent review is warranted and a
|
|
357
|
+
different class is unavailable, use the strongest suitable fresh-context
|
|
358
|
+
reviewer available. Do not present inline self-review as independent.
|
|
359
|
+
- **Two-phase order:** completeness / complementary / advisory comes before
|
|
360
|
+
adversarial attack. Never reverse the order or skip directly to attack.
|
|
361
|
+
- **Non-blocking design:** unavailable or failed design-time advisory review does
|
|
362
|
+
not block direct or autopilot design. Continue with judgment and record the
|
|
363
|
+
reason. A slow top-tier reviewer is not a failure until its appropriately
|
|
364
|
+
sized timeout or mechanism reports failure.
|
|
365
|
+
- **Strict completion:** final autopilot completion must clear a successful
|
|
366
|
+
review path and resolve or file accepted findings. At weights `light` through
|
|
367
|
+
`maximum`, that path must use a supported fresh-context reviewer; if it fails,
|
|
368
|
+
the run is blocked rather than complete. At explicit weight `none`, documented
|
|
369
|
+
implementation verification and acceptance evidence satisfy the path without
|
|
370
|
+
independent review.
|
|
371
|
+
|
|
372
|
+
User instructions and project-level review/egress rules override defaults. Do
|
|
373
|
+
not invoke an external peer mechanism when policy prohibits it. `--only-questions`
|
|
374
|
+
is user alignment and therefore skips advisory review.
|
|
633
375
|
|
|
634
376
|
---
|
|
635
377
|
|