@nklisch/pi-agile-workflow 0.15.3 → 0.16.3
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 +117 -65
- package/docs/PRINCIPLES.md +84 -18
- package/docs/SPEC.md +70 -2
- package/docs/VISION.md +33 -12
- package/hooks/scripts/prompt-context.py +7 -1
- package/hooks/scripts/test_prompt_context.py +16 -0
- 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 +138 -91
- package/skills/convert/SKILL.md +55 -11
- package/skills/epic-design/SKILL.md +37 -70
- package/skills/feature-design/SKILL.md +52 -68
- package/skills/fix/SKILL.md +52 -34
- package/skills/gate-cruft/SKILL.md +69 -24
- package/skills/gate-docs/SKILL.md +12 -5
- package/skills/gate-patterns/SKILL.md +7 -3
- package/skills/gate-refactor/SKILL.md +18 -6
- package/skills/gate-security/SKILL.md +16 -7
- package/skills/gate-tests/SKILL.md +86 -71
- package/skills/implement/SKILL.md +79 -58
- package/skills/implement-orchestrator/SKILL.md +274 -587
- package/skills/perf-design/SKILL.md +11 -12
- package/skills/principles/SKILL.md +175 -379
- package/skills/principles/references/advisory-review.md +76 -0
- package/skills/principles/references/code-design.md +164 -0
- package/skills/principles/references/models.md +42 -63
- package/skills/prose-author/SKILL.md +9 -4
- package/skills/refactor-design/SKILL.md +26 -17
- package/skills/review/SKILL.md +169 -64
- package/skills/review/references/substrate-side-effects.md +17 -10
- package/skills/scope/SKILL.md +20 -7
- 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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Advisory Review Mechanics
|
|
2
|
+
|
|
3
|
+
The detailed companion to the risk-driven invariants in
|
|
4
|
+
`principles/SKILL.md` Part IV. Model classes, host-to-peer pairing, and concrete
|
|
5
|
+
peer mechanism flags remain in [models.md](models.md).
|
|
6
|
+
|
|
7
|
+
## Review weight and scope defaults
|
|
8
|
+
|
|
9
|
+
Start from the effective `review_weight` in Part IV (`standard` when unset), then
|
|
10
|
+
adapt to risk. `light` narrows independent breadth, `thorough` raises
|
|
11
|
+
fresh-context scrutiny, and `maximum` permits multi-class multi-pass depth;
|
|
12
|
+
`none` skips this independent-review table without skipping implementation
|
|
13
|
+
verification or acceptance evidence. These are ceilings and intent, never fixed
|
|
14
|
+
reviewer or pass counts.
|
|
15
|
+
|
|
16
|
+
Apply the scope defaults below in both direct and autopilot design modes.
|
|
17
|
+
Explicit caller and project review rules override them.
|
|
18
|
+
|
|
19
|
+
| Scope and risk | Default |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Small, low-risk | Skip advisory review. |
|
|
22
|
+
| Small or medium with material uncertainty | Optionally run one focused different-class pass. |
|
|
23
|
+
| Large, risky, or architectural, without prior `--only-questions` / `## Design decisions` alignment | Run one focused different-class pass when available. |
|
|
24
|
+
| Deep or complex | Use two different model classes across the two phases when available. |
|
|
25
|
+
| Completed feature or epic in a deep review lane | Use a fresh-context lens review; prefer different-class, otherwise strongest same-harness fresh context. |
|
|
26
|
+
| Final autopilot completion | Run the required fresh-context completion path described in Part IV. |
|
|
27
|
+
|
|
28
|
+
Stories normally fast-advance on recorded green verification, but risk can
|
|
29
|
+
escalate them. Use a full iterative review loop for a completed substantial
|
|
30
|
+
artifact or explicit review request only when that depth is warranted.
|
|
31
|
+
|
|
32
|
+
## Two-phase mechanics
|
|
33
|
+
|
|
34
|
+
Always run completeness before attack:
|
|
35
|
+
|
|
36
|
+
1. **Completeness / complementary / advisory.** Ask what is missing, which
|
|
37
|
+
alternatives strengthen the artifact, and which questions or risks deserve
|
|
38
|
+
weight. An open design gets one pass before decisions lock. A complete
|
|
39
|
+
artifact can iterate until substantive findings stabilize; when a dedicated
|
|
40
|
+
iterative mechanism exists, converge to nits and cap the loop at roughly five
|
|
41
|
+
passes rather than chasing perfection.
|
|
42
|
+
2. **Adversarial.** After Phase 1, ask what is broken, contradictory, based on a
|
|
43
|
+
false assumption, or likely to fail in operation. Open designs get a focused
|
|
44
|
+
attack pass; completed artifacts may use the same bounded convergence shape.
|
|
45
|
+
Verify concrete claims before accepting them.
|
|
46
|
+
|
|
47
|
+
The receiving/orchestrating agent owns the verdict on every returned finding.
|
|
48
|
+
Apply Part IV's material-risk threshold in repository context; do not inherit a
|
|
49
|
+
reviewer's severity label. Fix or activate only current-cycle blockers, park
|
|
50
|
+
valid lower-priority concerns in the unbound backlog, and reject unsupported
|
|
51
|
+
claims with a reason.
|
|
52
|
+
|
|
53
|
+
For deep or complex work, use a different model class for Phase 2 than Phase 1
|
|
54
|
+
when two classes are available. Their disagreement is evidence to investigate,
|
|
55
|
+
not a vote. For routine design, do not turn a focused advisory pass into a
|
|
56
|
+
multi-pass review loop.
|
|
57
|
+
|
|
58
|
+
## Recording the result
|
|
59
|
+
|
|
60
|
+
Summarize evidence and decisions in the item body; never paste transcripts:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
## Other agent review
|
|
64
|
+
- Invoked because: <risk or uncertainty>
|
|
65
|
+
- Phase 1 — advisory/completeness: <reviewer class and useful gaps>
|
|
66
|
+
- Phase 2 — adversarial: <reviewer class and failure modes>
|
|
67
|
+
- Fixed/active blockers: <material current-cycle risks and disposition>
|
|
68
|
+
- Parked: <valid lower-priority concerns and risk rationale>
|
|
69
|
+
- Rejected: <points and reasons with phase>
|
|
70
|
+
- Skipped/degraded: <phase and reason, if any>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If only one phase or class was warranted or reachable, record that fact. Limit
|
|
74
|
+
normal design to one advisory pass per item per design stage. The final
|
|
75
|
+
autopilot completion review is separate and follows the stricter completion
|
|
76
|
+
invariant in Part IV.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Code-Design Mechanics
|
|
2
|
+
|
|
3
|
+
The detailed companion to the load-bearing code-design capsule in
|
|
4
|
+
`principles/SKILL.md` Part I. Load this when a design or implementation needs
|
|
5
|
+
concrete boundary guidance, checklists, or examples.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
1. [Ports & Adapters](#1-ports--adapters)
|
|
10
|
+
2. [Single Source of Truth](#2-single-source-of-truth)
|
|
11
|
+
3. [Generated Contracts](#3-generated-contracts)
|
|
12
|
+
4. [Fail Fast—Where It Matters](#4-fail-fastwhere-it-matters)
|
|
13
|
+
5. [Code Economy](#5-code-economy)
|
|
14
|
+
6. [Tests Earn Their Keep](#6-tests-earn-their-keep)
|
|
15
|
+
7. [Leave It Simpler](#7-leave-it-simpler)
|
|
16
|
+
|
|
17
|
+
## 1. Ports & Adapters
|
|
18
|
+
|
|
19
|
+
At design time, identify every database, filesystem, HTTP, queue, clock, and
|
|
20
|
+
randomness dependency. Define the interface the domain needs in the domain
|
|
21
|
+
layer; implement it in infrastructure; wire the adapter only at a composition
|
|
22
|
+
root. Domain functions receive ports as typed parameters and never import
|
|
23
|
+
adapters directly.
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
src/
|
|
27
|
+
domain/ports.ts # UserRepository, EmailSender
|
|
28
|
+
domain/user-service.ts # imports ports, not infrastructure
|
|
29
|
+
infrastructure/db.ts # implements UserRepository
|
|
30
|
+
app/wire.ts # assembles domain + adapters
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// Domain
|
|
35
|
+
export function createUser(repo: UserRepository, email: string) {
|
|
36
|
+
return repo.insert({ email })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Composition root
|
|
40
|
+
const repo = new DrizzleUserRepo(db)
|
|
41
|
+
app.post('/users', (c) => createUser(repo, c.req.body.email))
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Checklist:
|
|
45
|
+
- Every external dependency has a domain-owned interface.
|
|
46
|
+
- Domain modules do not import databases, filesystems, or transport adapters.
|
|
47
|
+
- Infrastructure is referenced only from composition roots.
|
|
48
|
+
|
|
49
|
+
## 2. Single Source of Truth
|
|
50
|
+
|
|
51
|
+
When a variant set can grow, define one typed registry and derive types,
|
|
52
|
+
validation, routing, and display from it. Do not repeat unions or literals in
|
|
53
|
+
consumers.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const ROLE_CONFIG = {
|
|
57
|
+
admin: { level: 2, canDelete: true },
|
|
58
|
+
editor: { level: 1, canDelete: false },
|
|
59
|
+
viewer: { level: 0, canDelete: false },
|
|
60
|
+
} as const satisfies Record<string, RoleConfig>
|
|
61
|
+
|
|
62
|
+
type Role = keyof typeof ROLE_CONFIG
|
|
63
|
+
const ROLES = Object.keys(ROLE_CONFIG) as Role[]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Checklist:
|
|
67
|
+
- One authoritative constant or schema owns the variants.
|
|
68
|
+
- Downstream types and behavior derive from that registry.
|
|
69
|
+
- Adding a variant changes the registry, not a collection of switches and
|
|
70
|
+
validators.
|
|
71
|
+
|
|
72
|
+
## 3. Generated Contracts
|
|
73
|
+
|
|
74
|
+
Choose one source for each system boundary and derive consumers from it:
|
|
75
|
+
|
|
76
|
+
- HTTP API: OpenAPI schema to generated client.
|
|
77
|
+
- Typed router: share or infer the router contract.
|
|
78
|
+
- Database: infer application types from the schema.
|
|
79
|
+
- GraphQL: generate types from SDL.
|
|
80
|
+
|
|
81
|
+
Build generation into the normal pipeline. Consumers import generated or
|
|
82
|
+
inferred types rather than maintaining mirrors. Extend a generated type with
|
|
83
|
+
intersection/composition when needed; do not replace it with a hand copy.
|
|
84
|
+
|
|
85
|
+
Checklist:
|
|
86
|
+
- Every cross-boundary interface names its source of truth.
|
|
87
|
+
- Generation or inference is part of the build path.
|
|
88
|
+
- No hand-written type mirrors a schema, router, or database definition.
|
|
89
|
+
|
|
90
|
+
## 4. Fail Fast—Where It Matters
|
|
91
|
+
|
|
92
|
+
Validate untrusted input and required external contracts at system boundaries
|
|
93
|
+
before domain logic runs. Add internal guards when a violated precondition is
|
|
94
|
+
plausible and consequential; do not turn every helper into a defensive boundary.
|
|
95
|
+
The project decides how much invariant enforcement, edge handling, and
|
|
96
|
+
determinism it actually needs.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
function processOrder(input: unknown) {
|
|
100
|
+
const order = OrderSchema.parse(input)
|
|
101
|
+
return computeTotal(order)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function applyDiscount(order: Order, pct: number) {
|
|
105
|
+
if (pct < 0 || pct > 1) throw new Error(`Invalid discount: ${pct}`)
|
|
106
|
+
// ...
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Boundary examples include HTTP handlers, CLI arguments, external API responses,
|
|
111
|
+
and configuration files. Internal checks should report the violated
|
|
112
|
+
precondition and received value whenever that is safe.
|
|
113
|
+
|
|
114
|
+
Checklist:
|
|
115
|
+
- Validate real trust boundaries and explicit contracts.
|
|
116
|
+
- Match defensive rigor to failure consequences and project scope.
|
|
117
|
+
- Do not add checks, retries, invariants, or determinism only because a more
|
|
118
|
+
general system might need them.
|
|
119
|
+
|
|
120
|
+
## 5. Code Economy
|
|
121
|
+
|
|
122
|
+
Prefer the shortest clear expression of the project's actual requirements.
|
|
123
|
+
Every abstraction, option, layer, fallback, and branch creates maintenance cost;
|
|
124
|
+
it must earn that cost in current scope rather than a hypothetical future.
|
|
125
|
+
Terse does not mean cryptic: optimize for fewer concepts, then fewer lines.
|
|
126
|
+
|
|
127
|
+
Checklist:
|
|
128
|
+
- Choose the direct solution before a configurable framework.
|
|
129
|
+
- Avoid extension points without a current second use or committed need.
|
|
130
|
+
- Delete incidental machinery made obsolete by the change.
|
|
131
|
+
|
|
132
|
+
## 6. Tests Earn Their Keep
|
|
133
|
+
|
|
134
|
+
Automated tests are maintained code. Prioritize stable public interfaces,
|
|
135
|
+
important cross-component seams, high-consequence behavior, and regression tests
|
|
136
|
+
for real bugs. Unit tests belong around genuinely complex logic where isolated
|
|
137
|
+
examples add confidence; simple wrappers and implementation details usually do
|
|
138
|
+
not need their own tests.
|
|
139
|
+
|
|
140
|
+
Checklist:
|
|
141
|
+
- Name the interface, risk, or regression each test protects.
|
|
142
|
+
- Prefer a useful interface test over several implementation-bound unit tests.
|
|
143
|
+
- Do not chase line coverage or enumerate every possible surface by default.
|
|
144
|
+
- Remove duplicate, tautological, brittle, or low-value tests when they no
|
|
145
|
+
longer justify upkeep.
|
|
146
|
+
|
|
147
|
+
## 7. Leave It Simpler
|
|
148
|
+
|
|
149
|
+
Treat elimination as part of feature work, not a separate activity reserved for
|
|
150
|
+
refactors. During exploration and design, identify code, tests, checks,
|
|
151
|
+
abstractions, compatibility paths, and configuration that the proposed feature
|
|
152
|
+
can make unnecessary. During implementation, perform safe cohesive cleanup in
|
|
153
|
+
the touched area and create explicit cleanup/refactor stories for larger work.
|
|
154
|
+
|
|
155
|
+
Question whole systems as well as local fragments. Removing behavior,
|
|
156
|
+
guarantees, validation, determinism, compatibility, or safety is a product
|
|
157
|
+
choice: explain the trade-off and ask the user rather than silently weakening
|
|
158
|
+
it.
|
|
159
|
+
|
|
160
|
+
Checklist:
|
|
161
|
+
- Record what the feature can delete or consolidate.
|
|
162
|
+
- Prefer deletion and inlining before extraction or another abstraction.
|
|
163
|
+
- Leave touched code simpler unless doing so would blur scope or alter behavior.
|
|
164
|
+
- Park broader opportunities; ask before reducing meaningful guarantees.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Model Selection & Decision Matrix
|
|
2
2
|
|
|
3
3
|
> The concrete model-layer companion to the **model-agnostic** dispatch and
|
|
4
|
-
> cross-model policy in `principles/SKILL.md`
|
|
4
|
+
> cross-model policy in `principles/SKILL.md` Part IV and the
|
|
5
5
|
> "different model class" decision points across the plugin. In-skill prose is
|
|
6
6
|
> deliberately written in capability/role terms; **this file is where those
|
|
7
7
|
> capabilities map to actual models and `peeragent` flags.** Load it whenever a
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
> "use a different model class".
|
|
10
10
|
|
|
11
11
|
Model generations move fast — the *families and classes* below are the durable
|
|
12
|
-
abstraction; specific
|
|
13
|
-
GLM-5.2) are
|
|
12
|
+
abstraction; specific versions and names (for example Claude Fable, GPT-5.6
|
|
13
|
+
Luna/Terra/Sol, GPT-5.x-Codex, Gemini 3.5, and GLM-5.2) are current resolutions
|
|
14
|
+
of each class as of writing. Always resolve
|
|
14
15
|
the concrete model against current sources when the choice is load-bearing.
|
|
15
16
|
|
|
16
17
|
## Contents
|
|
@@ -51,11 +52,26 @@ the in-skill prose names; this is what they mean.
|
|
|
51
52
|
## 2. Model-family cards
|
|
52
53
|
|
|
53
54
|
**Claude (Anthropic)** — `--agent claude`
|
|
54
|
-
- Tiers
|
|
55
|
-
(strong coding + speed; 1M beta), `haiku` (fast, near-frontier, cheap).
|
|
55
|
+
- Tiers include `opus`, `sonnet`, `haiku`, and Claude Fable where available.
|
|
56
56
|
- Effort: `high | xhigh` (default `xhigh`).
|
|
57
|
-
-
|
|
58
|
-
|
|
57
|
+
- Recommendations: Opus for deep review/adversarial work, Sonnet for primary
|
|
58
|
+
work and scouting, Haiku for cheap leaf fan-out. Fable is a strong but
|
|
59
|
+
expensive design, orchestration, and review choice; it can implement, but its
|
|
60
|
+
cost usually makes another capable worker preferable.
|
|
61
|
+
|
|
62
|
+
**GPT-5.6 (OpenAI; host-native where available)**
|
|
63
|
+
- **Luna** is the recommended implementation workhorse: medium thinking for
|
|
64
|
+
simple/routine work, scaling through xhigh for fairly complicated work short
|
|
65
|
+
of the hardest tier.
|
|
66
|
+
- **Terra** remains a situational middle pick. Current practitioner preference
|
|
67
|
+
often favors Sol at low thinking as the bridge above Luna rather than treating
|
|
68
|
+
Terra as a mandatory rung.
|
|
69
|
+
- **Sol** is preferred for design, review, and complex/large implementation. Low
|
|
70
|
+
thinking bridges above Luna; raise thinking for the hardest architecture,
|
|
71
|
+
review, and coding work.
|
|
72
|
+
- These are recommendations, not fixed capability facts. Discover current host
|
|
73
|
+
availability before selection. Luna, Terra, Sol, and Codex share OpenAI
|
|
74
|
+
lineage, so switching among them is not cross-model evidence.
|
|
59
75
|
|
|
60
76
|
**Codex (OpenAI)** — `--agent codex`
|
|
61
77
|
- Current class: GPT-5.x-Codex (model auto-selected; no `--model` flag).
|
|
@@ -83,9 +99,9 @@ the in-skill prose names; this is what they mean.
|
|
|
83
99
|
|
|
84
100
|
| Role | Needs (capability) | Primary models |
|
|
85
101
|
|---|---|---|
|
|
86
|
-
| Primary worker | write fidelity, agentic stamina | Sonnet-class / Codex high / GLM-5.2 high |
|
|
87
|
-
| Scanner/scout (deep read-only fan-out) | domain inspection, evidence, scoped artifacts | Haiku /
|
|
88
|
-
| Deep reviewer | reasoning depth, fresh context |
|
|
102
|
+
| Primary worker | write fidelity, agentic stamina | GPT-5.6 Luna medium→xhigh / Sonnet-class / Codex high / GLM-5.2 high; Sol for complex/large implementation |
|
|
103
|
+
| Scanner/scout (deep read-only fan-out) | domain inspection, evidence, scoped artifacts | Haiku / Luna or Sonnet for volume; Sol/Opus/Codex xhigh/GLM xhigh for subtle gates |
|
|
104
|
+
| Deep reviewer | reasoning depth, fresh context | GPT-5.6 Sol / Claude Fable or Opus / Codex xhigh / GLM-5.2 xhigh |
|
|
89
105
|
| Advisory peer (Phase 1) | blind-spot diversity, augmentation | a **different class** than the host |
|
|
90
106
|
| Adversarial peer (Phase 2) | blind-spot diversity, attack posture | a **different class** than host + than Phase 1 |
|
|
91
107
|
|
|
@@ -98,67 +114,30 @@ diversity**, and for deep work use **two distinct peer classes** (§5).
|
|
|
98
114
|
|
|
99
115
|
| Host class | Valid peer classes (any different class) |
|
|
100
116
|
|---|---|
|
|
101
|
-
| Claude |
|
|
102
|
-
| Codex | claude
|
|
103
|
-
| Gemini | claude
|
|
104
|
-
| Z.AI GLM | claude
|
|
117
|
+
| Claude (including Fable) | openai · gemini · zai |
|
|
118
|
+
| OpenAI (GPT-5.6 or Codex) | claude · gemini · zai |
|
|
119
|
+
| Gemini | claude · openai · zai |
|
|
120
|
+
| Z.AI GLM | claude · openai · gemini |
|
|
105
121
|
|
|
106
122
|
When the natural pair is unavailable, fall through to the next class; never
|
|
107
|
-
peer
|
|
123
|
+
peer within the host lineage and call it cross-model. A same-lineage reviewer
|
|
124
|
+
may still provide fresh context when labeled accurately.
|
|
108
125
|
|
|
109
126
|
## 5. Multi-class review for deep/complex work
|
|
110
127
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
themselves signal (re-read both before deciding).
|
|
117
|
-
|
|
118
|
-
Concretely: pair the two peers across the two review phases in §6 — one class
|
|
119
|
-
runs the **advisory** pass, a *different* class runs the **adversarial** pass.
|
|
120
|
-
That realizes the 2-class rule through the phase ordering and maximizes both
|
|
121
|
-
augmentation diversity and adversarial independence. For routine/small work a
|
|
122
|
-
single peer (or none) remains correct — this escalation is for deep/complex
|
|
123
|
-
scope only.
|
|
128
|
+
The risk and `review_weight` policy lives in
|
|
129
|
+
[advisory-review.md](advisory-review.md). At model-selection time, when that
|
|
130
|
+
policy calls for two classes, choose two distinct training lineages that also
|
|
131
|
+
differ from the host where availability permits. Pair one with each phase;
|
|
132
|
+
disagreement is evidence to investigate, not a vote.
|
|
124
133
|
|
|
125
134
|
## 6. Two-phase design review: advisory then adversarial
|
|
126
135
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
artifact is a design (open) or a review (complete)**:
|
|
133
|
-
|
|
134
|
-
**Phase 1 — Completeness / Complementary / Advisory.** Augmentation, not
|
|
135
|
-
judgment. Ask what is missing, what alternatives strengthen it, and what
|
|
136
|
-
questions/risks should be weighed.
|
|
137
|
-
- *Design (open artifact, before decisions lock)*: **a single pass.** You don't
|
|
138
|
-
iterate an open design to convergence. The host chooses and records rationale.
|
|
139
|
-
This is the default autopilot design-time peer ask.
|
|
140
|
-
- *Review (complete artifact — feature/epic/out-of-band review)*: **a multi-step
|
|
141
|
-
convergence loop**, not a single ask — the artifact is complete, so iterate
|
|
142
|
-
until findings stabilize. The ideal is the full `peer-review` convergence loop
|
|
143
|
-
(≥3 review→refine passes, continue while substantive issues surface, stop on
|
|
144
|
-
nits, cap ~5); run that loop in the advisory/complementary posture when
|
|
145
|
-
`peer-review` is available. When only a single peer pass is available, run as
|
|
146
|
-
many rounds as the mechanism allows and say it did not reach full convergence.
|
|
147
|
-
|
|
148
|
-
**Phase 2 — Adversarial (after Phase 1 converges or, for designs, completes).**
|
|
149
|
-
Attack posture. Ask a **different** reviewer (ideally a different class than
|
|
150
|
-
Phase 1, per the 2-class rule in §5) what is broken, contradictory, built on a
|
|
151
|
-
false assumption, or will fail in operation. For reviews this is the same
|
|
152
|
-
`peer-review`-style convergence loop applied in the attack posture; for designs
|
|
153
|
-
it is a focused adversarial pass. Verify concrete claims against code/foundation
|
|
154
|
-
docs before accepting or rejecting.
|
|
155
|
-
|
|
156
|
-
Record both phases in the item body under `## Other agent review`, labeling each
|
|
157
|
-
finding's phase, the reviewer class, and (for reviews) how far the convergence
|
|
158
|
-
loop ran (converged on nits / hit cap / single pass only). Peer failures in
|
|
159
|
-
either phase are non-blocking (fall back to a fresh same-class sub-agent); the
|
|
160
|
-
final autopilot completion review must still clear through at least one
|
|
161
|
-
cross-class pass.
|
|
136
|
+
The phase order, artifact-specific loop shapes, ceilings, and recording format
|
|
137
|
+
live in [advisory-review.md](advisory-review.md). This model-layer reference adds
|
|
138
|
+
one constraint: when two classes are selected, Phase 2 should differ from both
|
|
139
|
+
the host and Phase 1 where the available class set permits it. Never label an
|
|
140
|
+
unknown or same-class reviewer cross-model.
|
|
162
141
|
|
|
163
142
|
## 7. peeragent invocation cheatsheet
|
|
164
143
|
|
|
@@ -160,10 +160,15 @@ fan-out. Do not route prose features to `/agile-workflow:implement-orchestrator`
|
|
|
160
160
|
(agent-spawning + worktrees) just because they exceed a line count; the
|
|
161
161
|
orchestrator's value is parallel coordination, which prose work does not need.
|
|
162
162
|
|
|
163
|
-
For a large deliverable,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
For a large deliverable, inline `implement` is the **write** stride and the
|
|
164
|
+
review lane is a genuine **revise/coherence** pass — never a rubber stamp. For a
|
|
165
|
+
small deliverable, the same review may be light, but it still evaluates the work.
|
|
166
|
+
In both cases, `/agile-workflow:implement` continues through that review lane to
|
|
167
|
+
`done` by default in one invocation, forwarding the effective review weight, or
|
|
168
|
+
returns with a documented bounce or blocker. Even when policy skips independent
|
|
169
|
+
review, closure still requires green verification and acceptance evidence. The
|
|
170
|
+
lane stops at `review` only when the caller explicitly requests `stop-at-review`
|
|
171
|
+
(or the project convention sets that boundary).
|
|
167
172
|
|
|
168
173
|
## Output
|
|
169
174
|
|
|
@@ -143,14 +143,13 @@ drafting features. Iterate over the target set:
|
|
|
143
143
|
3. Read-first map of the feature's area; use one exploratory sub-agent only if the
|
|
144
144
|
area is still unclear. Include `.agents/skills/refactor-conventions/` as
|
|
145
145
|
context when present.
|
|
146
|
-
4.
|
|
147
|
-
|
|
148
|
-
strategy when atomic?"). Use structured question tool.
|
|
146
|
+
4. Use the structured question tool for refactor-specific strategic ambiguities
|
|
147
|
+
such as API compatibility, migration shape, or rollback strategy.
|
|
149
148
|
5. Capture answers under `## Design decisions` in the feature body
|
|
150
149
|
6. Do NOT design or advance stage — let the design family pick up later
|
|
151
150
|
7. Commit per feature: `refactor-design --only-questions: <id>`
|
|
152
151
|
|
|
153
|
-
Requires interactive mode; refuse
|
|
152
|
+
Requires interactive mode; refuse under autopilot. Otherwise defer question and advisory policy to `principles/SKILL.md` Parts III–IV.
|
|
154
153
|
|
|
155
154
|
## Workflow — per-feature mode
|
|
156
155
|
|
|
@@ -196,8 +195,8 @@ across the lenses below and skip exploratory fanout. If one area is unclear, use
|
|
|
196
195
|
focused exploratory sub-agent. Use parallel exploratory sub-agents only when the lenses need separate
|
|
197
196
|
attention across a medium/large target.
|
|
198
197
|
|
|
199
|
-
The first
|
|
200
|
-
refactor-conventions catalog exists. The catalog adds a
|
|
198
|
+
The first five scan axes are mandatory. Run them even when a project-specific
|
|
199
|
+
refactor-conventions catalog exists. The catalog adds a sixth scan axis; it
|
|
201
200
|
does not narrow or disable the default refactor judgment.
|
|
202
201
|
|
|
203
202
|
- Use the host's generic/general-purpose subagent prompted with the scanner
|
|
@@ -208,28 +207,35 @@ does not narrow or disable the default refactor judgment.
|
|
|
208
207
|
deployment-provided read-only role only if it is already available; otherwise
|
|
209
208
|
keep the host-local scan fallback.
|
|
210
209
|
|
|
211
|
-
1. **
|
|
210
|
+
1. **Elimination First** — "Before proposing extraction or a new abstraction,
|
|
211
|
+
find code, tests, checks, wrappers, options, compatibility paths, and files
|
|
212
|
+
that can be deleted, inlined, merged, or made unnecessary. Include whole
|
|
213
|
+
subsystems whose maintenance cost may exceed their current value, but mark
|
|
214
|
+
any removal that changes behavior or guarantees as a user decision rather
|
|
215
|
+
than a pure refactor."
|
|
216
|
+
|
|
217
|
+
2. **Code Smells** — "Find code that smells off in <area>. Look for: duplicated
|
|
212
218
|
logic across files; long files (>500 lines); deep nesting (>4 levels); god
|
|
213
219
|
functions (>100 lines doing multiple distinct things); god modules (>15
|
|
214
220
|
methods or multiple responsibilities); leaky abstractions (consumers reaching
|
|
215
221
|
past a module's public API). Report each with file:line and a one-line
|
|
216
222
|
explanation."
|
|
217
223
|
|
|
218
|
-
|
|
224
|
+
3. **Missing Abstractions** — "Find places where multiple modules implement
|
|
219
225
|
similar logic that could be extracted. Report each with file:line references
|
|
220
226
|
and which modules would benefit."
|
|
221
227
|
|
|
222
|
-
|
|
228
|
+
4. **Pattern Violations & Naming Inconsistencies** — "Read
|
|
223
229
|
`.agents/skills/patterns/*.md` and legacy `.claude/skills/patterns/*.md` if
|
|
224
230
|
they exist. Find code that deviates from established patterns. Report
|
|
225
231
|
naming inconsistencies — same concept named differently across modules. Report
|
|
226
232
|
each with file:line."
|
|
227
233
|
|
|
228
|
-
|
|
234
|
+
5. **Dead Weight** — "Find dead code: unused exports (cross-check against grep
|
|
229
235
|
for importers), commented-out blocks, TODO/FIXME where the work is clearly
|
|
230
236
|
already done, files with very few callers. Report each with file:line."
|
|
231
237
|
|
|
232
|
-
|
|
238
|
+
6. **Project Refactor Conventions** — Run only when
|
|
233
239
|
`.agents/skills/refactor-conventions/` exists. "Read
|
|
234
240
|
`.agents/skills/refactor-conventions/SKILL.md`, its referenced rule files,
|
|
235
241
|
and the `## Refactor Style Conventions` section in AGENTS.md if present.
|
|
@@ -246,7 +252,7 @@ findings.
|
|
|
246
252
|
### Phase 4: Categorize findings
|
|
247
253
|
|
|
248
254
|
Sort the findings into:
|
|
249
|
-
- **High value** —
|
|
255
|
+
- **High value** — eliminates code or concepts, reduces duplication, consolidates
|
|
250
256
|
similar code, or corrects convention drift that materially improves module
|
|
251
257
|
boundaries or repeated project workflow
|
|
252
258
|
- **Medium value** — improves consistency, aligns with established patterns
|
|
@@ -263,14 +269,15 @@ run summary.
|
|
|
263
269
|
|
|
264
270
|
For each step, specify:
|
|
265
271
|
- **Step name and value tier** (High / Medium / Low)
|
|
266
|
-
- **Source lens**: code smell / missing abstraction / pattern drift /
|
|
272
|
+
- **Source lens**: elimination / code smell / missing abstraction / pattern drift /
|
|
267
273
|
dead weight / refactor convention `<rule>` (if applicable)
|
|
268
274
|
- **Files affected**: paths
|
|
269
275
|
- **Current state**: actual code showing what exists now
|
|
270
276
|
- **Target state**: exact code showing what it should look like after
|
|
271
277
|
- **Implementation notes**: how to get from current to target; non-obvious considerations
|
|
272
|
-
- **Acceptance criteria**:
|
|
273
|
-
check
|
|
278
|
+
- **Acceptance criteria**: relevant verification passes plus a specific
|
|
279
|
+
structural/behavioral check; add or retain tests only where they protect an
|
|
280
|
+
important interface, complex unit, or regression
|
|
274
281
|
- **Risk**: Low / Medium / High — what could go wrong
|
|
275
282
|
- **Rollback**: how to revert this step if it breaks something
|
|
276
283
|
|
|
@@ -309,7 +316,7 @@ Append to the feature file's body:
|
|
|
309
316
|
### Step 1: <name>
|
|
310
317
|
**Priority**: High/Medium/Low
|
|
311
318
|
**Risk**: Low/Medium/High
|
|
312
|
-
**Source Lens**: code smell / missing abstraction / pattern drift / dead weight / refactor convention `<rule>`
|
|
319
|
+
**Source Lens**: elimination / code smell / missing abstraction / pattern drift / dead weight / refactor convention `<rule>`
|
|
313
320
|
**Files**: `src/path/file.ext`, ...
|
|
314
321
|
**Story**: `<story-id>` (if spawned)
|
|
315
322
|
|
|
@@ -370,7 +377,9 @@ In conversation:
|
|
|
370
377
|
add — escalate via `/agile-workflow:scope` instead.
|
|
371
378
|
- Each step is self-contained and committable in isolation. Multi-step PRs lose the
|
|
372
379
|
ability to roll back individual steps.
|
|
373
|
-
- Specify
|
|
380
|
+
- Specify proportionate verification for every step. Do not require a new unit
|
|
381
|
+
test for simple structural edits when build, type, integration, or existing
|
|
382
|
+
interface evidence is more useful.
|
|
374
383
|
- Prioritize measurable improvements (less duplication, clearer boundaries) over
|
|
375
384
|
aesthetic preferences. Beauty that doesn't reduce complexity isn't worth the risk.
|
|
376
385
|
- Project-specific refactor conventions extend the defaults; they never replace
|