@punks/cli 3.1.9 → 3.1.11
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/dist/BASELINE_CHANGELOG.md +67 -0
- package/dist/CHANGELOG.md +48 -0
- package/dist/data/subagents/manifest.mjs +11 -6
- package/dist/index.js +32 -29
- package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +5 -0
- package/dist/skills/agnostic/docs/writing-great-skills/GLOSSARY.md +69 -0
- package/dist/skills/agnostic/docs/writing-great-skills/SKILL.md +63 -0
- package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +1 -1
- package/dist/skills/agnostic/planning/create-plan/SKILL.md +19 -7
- package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +19 -0
- package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +27 -10
- package/dist/skills/agnostic/planning/implement-spec/SKILL.md +6 -2
- package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +22 -6
- package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +12 -0
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +10 -2
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +10 -1
- package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +2 -0
- package/dist/skills/agnostic/quality/autoreview/SKILL.md +11 -2
- package/dist/skills/agnostic/quality/review/SKILL.md +16 -11
- package/dist/skills/frameworks/effect/effect-service-design/LICENSE +21 -0
- package/dist/skills/frameworks/effect/effect-service-design/SKILL.md +124 -0
- package/dist/skills/frameworks/effect/effect-service-design/references/AUDIT.md +98 -0
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/.gitignore +29 -0
- package/dist/skills/languages/python/python-backend-structure/SKILL.md +91 -0
- package/dist/skills/languages/python/python-backend-structure/agents/openai.yaml +4 -0
- package/dist/skills/languages/python/python-design-patterns/SKILL.md +93 -69
- package/dist/skills/languages/python/python-project-structure/SKILL.md +4 -247
- package/dist/skills/phases/delivery-phase/SKILL.md +13 -4
- package/dist/skills/phases/delivery-phase/phases/closeout.md +3 -0
- package/dist/skills/phases/delivery-phase/phases/debug.md +8 -1
- package/dist/skills/phases/delivery-phase/phases/implement.md +11 -2
- package/dist/skills/phases/delivery-phase/phases/review.md +50 -29
- package/dist/skills/phases/delivery-phase/phases/router.md +56 -36
- package/dist/skills/phases/delivery-phase/references/artifact-state.md +8 -2
- package/dist/skills/phases/delivery-phase/references/phase-handoff.md +60 -10
- package/dist/skills/phases/finder-phase/references/root-routing.md +6 -1
- package/dist/skills/phases/review-phase/REFERENCE.md +83 -145
- package/dist/skills/phases/review-phase/SKILL.md +41 -45
- package/dist/skills/phases/review-phase/agents/openai.yaml +2 -0
- package/dist/skills/phases/review-phase/references/durable-report.md +172 -0
- package/dist/skills/phases/review-phase/references/state-graph.md +69 -0
- package/dist/skills/phases/review-phase/references/targets.md +156 -0
- package/dist/skills/phases/review-phase/scripts/review-contract.mjs +819 -0
- package/package.json +9 -63
|
@@ -1,252 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: python-project-structure
|
|
3
|
-
description:
|
|
3
|
+
description: Deprecated compatibility alias for python-backend-structure.
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
#
|
|
7
|
+
# Deprecated
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## When to Use This Skill
|
|
11
|
-
|
|
12
|
-
- Starting a new Python project from scratch
|
|
13
|
-
- Reorganizing an existing codebase for clarity
|
|
14
|
-
- Defining module public APIs with `__all__`
|
|
15
|
-
- Deciding between flat and nested directory structures
|
|
16
|
-
- Determining test file placement strategies
|
|
17
|
-
- Creating reusable library packages
|
|
18
|
-
|
|
19
|
-
## Core Concepts
|
|
20
|
-
|
|
21
|
-
### 1. Module Cohesion
|
|
22
|
-
|
|
23
|
-
Group related code that changes together. A module should have a single, clear purpose.
|
|
24
|
-
|
|
25
|
-
### 2. Explicit Interfaces
|
|
26
|
-
|
|
27
|
-
Define what's public with `__all__`. Everything not listed is an internal implementation detail.
|
|
28
|
-
|
|
29
|
-
### 3. Flat Hierarchies
|
|
30
|
-
|
|
31
|
-
Prefer shallow directory structures. Add depth only for genuine sub-domains.
|
|
32
|
-
|
|
33
|
-
### 4. Consistent Conventions
|
|
34
|
-
|
|
35
|
-
Apply naming and organization patterns uniformly across the project.
|
|
36
|
-
|
|
37
|
-
## Quick Start
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
myproject/
|
|
41
|
-
├── src/
|
|
42
|
-
│ └── myproject/
|
|
43
|
-
│ ├── __init__.py
|
|
44
|
-
│ ├── services/
|
|
45
|
-
│ ├── models/
|
|
46
|
-
│ └── api/
|
|
47
|
-
├── tests/
|
|
48
|
-
├── pyproject.toml
|
|
49
|
-
└── README.md
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Fundamental Patterns
|
|
53
|
-
|
|
54
|
-
### Pattern 1: One Concept Per File
|
|
55
|
-
|
|
56
|
-
Each file should focus on a single concept or closely related set of functions. Consider splitting when a file:
|
|
57
|
-
|
|
58
|
-
- Handles multiple unrelated responsibilities
|
|
59
|
-
- Grows beyond 300-500 lines (varies by complexity)
|
|
60
|
-
- Contains classes that change for different reasons
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
# Good: Focused files
|
|
64
|
-
# user_service.py - User business logic
|
|
65
|
-
# user_repository.py - User data access
|
|
66
|
-
# user_models.py - User data structures
|
|
67
|
-
|
|
68
|
-
# Avoid: Kitchen sink files
|
|
69
|
-
# user.py - Contains service, repository, models, utilities...
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Pattern 2: Explicit Public APIs with `__all__`
|
|
73
|
-
|
|
74
|
-
Define the public interface for every module. Unlisted members are internal implementation details.
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
# mypackage/services/__init__.py
|
|
78
|
-
from .user_service import UserService
|
|
79
|
-
from .order_service import OrderService
|
|
80
|
-
from .exceptions import ServiceError, ValidationError
|
|
81
|
-
|
|
82
|
-
__all__ = [
|
|
83
|
-
"UserService",
|
|
84
|
-
"OrderService",
|
|
85
|
-
"ServiceError",
|
|
86
|
-
"ValidationError",
|
|
87
|
-
]
|
|
88
|
-
|
|
89
|
-
# Internal helpers remain private by omission
|
|
90
|
-
# from .internal_helpers import _validate_input # Not exported
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Pattern 3: Flat Directory Structure
|
|
94
|
-
|
|
95
|
-
Prefer minimal nesting. Deep hierarchies make imports verbose and navigation difficult.
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
# Preferred: Flat structure
|
|
99
|
-
project/
|
|
100
|
-
├── api/
|
|
101
|
-
│ ├── routes.py
|
|
102
|
-
│ └── middleware.py
|
|
103
|
-
├── services/
|
|
104
|
-
│ ├── user_service.py
|
|
105
|
-
│ └── order_service.py
|
|
106
|
-
├── models/
|
|
107
|
-
│ ├── user.py
|
|
108
|
-
│ └── order.py
|
|
109
|
-
└── utils/
|
|
110
|
-
└── validation.py
|
|
111
|
-
|
|
112
|
-
# Avoid: Deep nesting
|
|
113
|
-
project/core/internal/services/impl/user/
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Add sub-packages only when there's a genuine sub-domain requiring isolation.
|
|
117
|
-
|
|
118
|
-
### Pattern 4: Test File Organization
|
|
119
|
-
|
|
120
|
-
Choose one approach and apply it consistently throughout the project.
|
|
121
|
-
|
|
122
|
-
**Option A: Colocated Tests**
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
src/
|
|
126
|
-
├── user_service.py
|
|
127
|
-
├── test_user_service.py
|
|
128
|
-
├── order_service.py
|
|
129
|
-
└── test_order_service.py
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Benefits: Tests live next to the code they verify. Easy to see coverage gaps.
|
|
133
|
-
|
|
134
|
-
**Option B: Parallel Test Directory**
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
src/
|
|
138
|
-
├── services/
|
|
139
|
-
│ ├── user_service.py
|
|
140
|
-
│ └── order_service.py
|
|
141
|
-
tests/
|
|
142
|
-
├── services/
|
|
143
|
-
│ ├── test_user_service.py
|
|
144
|
-
│ └── test_order_service.py
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Benefits: Clean separation between production and test code. Standard for larger projects.
|
|
148
|
-
|
|
149
|
-
## Advanced Patterns
|
|
150
|
-
|
|
151
|
-
### Pattern 5: Package Initialization
|
|
152
|
-
|
|
153
|
-
Use `__init__.py` to provide a clean public interface for package consumers.
|
|
154
|
-
|
|
155
|
-
```python
|
|
156
|
-
# mypackage/__init__.py
|
|
157
|
-
"""MyPackage - A library for doing useful things."""
|
|
158
|
-
|
|
159
|
-
from .core import MainClass, HelperClass
|
|
160
|
-
from .exceptions import PackageError, ConfigError
|
|
161
|
-
from .config import Settings
|
|
162
|
-
|
|
163
|
-
__all__ = [
|
|
164
|
-
"MainClass",
|
|
165
|
-
"HelperClass",
|
|
166
|
-
"PackageError",
|
|
167
|
-
"ConfigError",
|
|
168
|
-
"Settings",
|
|
169
|
-
]
|
|
170
|
-
|
|
171
|
-
__version__ = "1.0.0"
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Consumers can then import directly from the package:
|
|
175
|
-
|
|
176
|
-
```python
|
|
177
|
-
from mypackage import MainClass, Settings
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Pattern 6: Layered Architecture
|
|
181
|
-
|
|
182
|
-
Organize code by architectural layer for clear separation of concerns.
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
myapp/
|
|
186
|
-
├── api/ # HTTP handlers, request/response
|
|
187
|
-
│ ├── routes/
|
|
188
|
-
│ └── middleware/
|
|
189
|
-
├── services/ # Business logic
|
|
190
|
-
├── repositories/ # Data access
|
|
191
|
-
├── models/ # Domain entities
|
|
192
|
-
├── schemas/ # API schemas (Pydantic)
|
|
193
|
-
└── config/ # Configuration
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Each layer should only depend on layers below it, never above.
|
|
197
|
-
|
|
198
|
-
### Pattern 7: Domain-Driven Structure
|
|
199
|
-
|
|
200
|
-
For complex applications, organize by business domain rather than technical layer.
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
ecommerce/
|
|
204
|
-
├── users/
|
|
205
|
-
│ ├── models.py
|
|
206
|
-
│ ├── services.py
|
|
207
|
-
│ ├── repository.py
|
|
208
|
-
│ └── api.py
|
|
209
|
-
├── orders/
|
|
210
|
-
│ ├── models.py
|
|
211
|
-
│ ├── services.py
|
|
212
|
-
│ ├── repository.py
|
|
213
|
-
│ └── api.py
|
|
214
|
-
└── shared/
|
|
215
|
-
├── database.py
|
|
216
|
-
└── exceptions.py
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## File and Module Naming
|
|
220
|
-
|
|
221
|
-
### Conventions
|
|
222
|
-
|
|
223
|
-
- Use `snake_case` for all file and module names: `user_repository.py`
|
|
224
|
-
- Avoid abbreviations that obscure meaning: `user_repository.py` not `usr_repo.py`
|
|
225
|
-
- Match class names to file names: `UserService` in `user_service.py`
|
|
226
|
-
|
|
227
|
-
### Import Style
|
|
228
|
-
|
|
229
|
-
Use absolute imports for clarity and reliability:
|
|
230
|
-
|
|
231
|
-
```python
|
|
232
|
-
# Preferred: Absolute imports
|
|
233
|
-
from myproject.services import UserService
|
|
234
|
-
from myproject.models import User
|
|
235
|
-
|
|
236
|
-
# Avoid: Relative imports
|
|
237
|
-
from ..services import UserService
|
|
238
|
-
from . import models
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
Relative imports can break when modules are moved or reorganized.
|
|
242
|
-
|
|
243
|
-
## Best Practices Summary
|
|
244
|
-
|
|
245
|
-
1. **Keep files focused** - One concept per file, consider splitting at 300-500 lines (varies by complexity)
|
|
246
|
-
2. **Define `__all__` explicitly** - Make public interfaces clear
|
|
247
|
-
3. **Prefer flat structures** - Add depth only for genuine sub-domains
|
|
248
|
-
4. **Use absolute imports** - More reliable and clearer
|
|
249
|
-
5. **Be consistent** - Apply patterns uniformly across the project
|
|
250
|
-
6. **Match names to content** - File names should describe their purpose
|
|
251
|
-
7. **Separate concerns** - Keep layers distinct and dependencies flowing one direction
|
|
252
|
-
8. **Document your structure** - Include a README explaining the organization
|
|
9
|
+
Use `$python-backend-structure`. This old skill ID remains only as a compatibility redirect and contains no architecture guidance.
|
|
@@ -11,7 +11,8 @@ disable-model-invocation: true
|
|
|
11
11
|
`delivery-phase` is a reusable phase router.
|
|
12
12
|
|
|
13
13
|
1. Read [phases/router.md](phases/router.md).
|
|
14
|
-
2. Inspect only enough issue, spec, plan, notes, diff, review,
|
|
14
|
+
2. Inspect only enough issue, spec, plan, notes, diff, retained review, durable
|
|
15
|
+
handoff, validation, and docs state to choose the current gate.
|
|
15
16
|
3. If approved artifact links or UI Evidence links are present, carry them as routing evidence.
|
|
16
17
|
4. Load exactly one phase file from `phases/`.
|
|
17
18
|
5. Complete that phase, write the phase outcome, then stop or re-enter `delivery-phase` to route again.
|
|
@@ -32,7 +33,8 @@ Completion of one phase does not imply loading the rest of the chain.
|
|
|
32
33
|
- [phases/backlog.md](phases/backlog.md): verify or project the agent-ready spec into delivery backlog items.
|
|
33
34
|
- [phases/plan.md](phases/plan.md): create or repair the execution-ready plan.
|
|
34
35
|
- [phases/implement.md](phases/implement.md): execute the accepted plan.
|
|
35
|
-
- [phases/review.md](phases/review.md):
|
|
36
|
+
- [phases/review.md](phases/review.md): prepare the explicit review handoff or
|
|
37
|
+
classify findings from a retained report.
|
|
36
38
|
- [phases/debug.md](phases/debug.md): investigate runtime-evidence failures.
|
|
37
39
|
- [phases/docs-ingest.md](phases/docs-ingest.md): ingest docs-affecting changes or record a no-op.
|
|
38
40
|
- [phases/closeout.md](phases/closeout.md): finish stack, tracker, PR, validation, and final report state.
|
|
@@ -42,8 +44,15 @@ Completion of one phase does not imply loading the rest of the chain.
|
|
|
42
44
|
- Do not read phase files other than `router.md` until the router selects them.
|
|
43
45
|
- Do not activate child skills at delivery start.
|
|
44
46
|
- Reuse fresh matching artifacts before loading creation skills.
|
|
45
|
-
- A phase may delegate to `create-spec`, `write-backlog`, `create-plan`,
|
|
46
|
-
-
|
|
47
|
+
- A phase may delegate to `create-spec`, `write-backlog`, `create-plan`,
|
|
48
|
+
`implement-spec`, `debugging-phase`, `docs-ingest-phase`, or `stack` only from
|
|
49
|
+
its own phase file.
|
|
50
|
+
- `review-phase` is user-invoked. Only below the three-pass budget may delivery
|
|
51
|
+
persist `review_due` and return the exact `$review-phase` invocation context,
|
|
52
|
+
then delivery stops. It never invokes that skill itself.
|
|
53
|
+
- After a phase completes, write enough state for future resume. Review-triggered
|
|
54
|
+
repair uses the idempotent fields in
|
|
55
|
+
[references/phase-handoff.md](references/phase-handoff.md).
|
|
47
56
|
|
|
48
57
|
## Stop Conditions
|
|
49
58
|
|
|
@@ -9,6 +9,9 @@ docs ingest or no-op, and validation are complete.
|
|
|
9
9
|
- Report phase path actually taken; do not imply skipped phases ran.
|
|
10
10
|
- Report validation commands, browser checks, smoke tests, or manual scenarios.
|
|
11
11
|
- Report review result and whether findings remain.
|
|
12
|
+
- When fix 3 occurred, require `clean_handoff` linking immutable review-3 report,
|
|
13
|
+
final changes, passing focused validation, and clean status. Do not require a
|
|
14
|
+
fourth review.
|
|
12
15
|
- Report debugging result or explicit skip reason.
|
|
13
16
|
- Report docs ingest result or explicit no-op reason.
|
|
14
17
|
- For UI changes, verify the PR body, PR comment, or PR-ready handoff includes durable before/after `UI Evidence` links.
|
|
@@ -16,6 +16,13 @@ Load `debugging-phase` only after this phase is selected.
|
|
|
16
16
|
- Speculative parallel fixes are not allowed.
|
|
17
17
|
- If the bug is broader than delivery scope, capture debt or open a separate
|
|
18
18
|
debugging goal.
|
|
19
|
+
- Preserve review lineage, `review_count`, `repair_count`, and the opening
|
|
20
|
+
`review_run_id` through the repair.
|
|
21
|
+
- After an ordinary fix with `review_count < 3`, stale the preceding report and
|
|
22
|
+
enter `review_due`.
|
|
23
|
+
- After debug fix 3 (`review_count = 3`, `repair_count = 3`), enter
|
|
24
|
+
`focused_validation`. Failure resumes `debug_active` in epoch 3 without a
|
|
25
|
+
counter change; passing records `clean_handoff`. Fix 3 never opens review 4.
|
|
19
26
|
|
|
20
27
|
## Completion State
|
|
21
28
|
|
|
@@ -25,6 +32,6 @@ Write or verify:
|
|
|
25
32
|
- root cause or narrowed hypothesis
|
|
26
33
|
- fix or explicit blocker
|
|
27
34
|
- rerun validation
|
|
28
|
-
-
|
|
35
|
+
- resulting state and preserved counter evidence
|
|
29
36
|
|
|
30
37
|
Then stop or re-enter `delivery-phase` for routing.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Implement Phase
|
|
2
2
|
|
|
3
3
|
Use this phase when an accepted plan exists and implementation work remains, or
|
|
4
|
-
when review
|
|
4
|
+
when a retained review opened `repair_active` for in-scope non-runtime blockers.
|
|
5
5
|
|
|
6
6
|
## Delegate
|
|
7
7
|
|
|
@@ -18,6 +18,14 @@ Load `implement-spec` only after this phase is selected.
|
|
|
18
18
|
- Parent orchestration owns shared notes and final validation evidence.
|
|
19
19
|
- For UI work, require `implement-spec` to carry durable before/after links through `UI Evidence Links`; use `repo-asset-management` only through that evidence contract.
|
|
20
20
|
- If runtime evidence appears during validation, finish the phase handoff and route to debug.
|
|
21
|
+
- Preserve review lineage, `review_count`, `repair_count`, and the opening
|
|
22
|
+
`review_run_id` through the repair.
|
|
23
|
+
- After an ordinary repair with `review_count < 3`, stale the preceding report
|
|
24
|
+
and enter `review_due` with the changed target identity.
|
|
25
|
+
- After fix 3 (`review_count = 3`, `repair_count = 3`), enter
|
|
26
|
+
`focused_validation`. Run only the focused validation required by accepted
|
|
27
|
+
evidence. Failure remains `repair_active` in epoch 3; passing records
|
|
28
|
+
`clean_handoff`. Fix 3 never opens review 4.
|
|
21
29
|
|
|
22
30
|
## Completion State
|
|
23
31
|
|
|
@@ -28,6 +36,7 @@ Write or verify:
|
|
|
28
36
|
- validation commands and results
|
|
29
37
|
- UI Evidence links for changed user-visible surfaces, or explicit no-op reason
|
|
30
38
|
- remaining blockers or follow-up debt
|
|
31
|
-
-
|
|
39
|
+
- resulting state: `review_due`, `debug_active`, `focused_validation`,
|
|
40
|
+
`clean_handoff`, or blocked
|
|
32
41
|
|
|
33
42
|
Then stop or re-enter `delivery-phase` for routing.
|
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
# Review Phase
|
|
2
2
|
|
|
3
|
-
Use
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
Use after implementation or whenever delivery has `review_due` for a stale or
|
|
4
|
+
missing retained review.
|
|
5
|
+
|
|
6
|
+
## Prepare Explicit Review
|
|
7
|
+
|
|
8
|
+
1. Validate accepted bounds and normalize a supported Git/diff target without
|
|
9
|
+
mutating it. Unsupported targets or invalid bounds enter `review_failed`
|
|
10
|
+
with exact evidence, no report, and no counter change.
|
|
11
|
+
2. Keep that result in memory and recover `review_count` from unique valid retained passes for the
|
|
12
|
+
delivery lineage and reconcile the handoff projection.
|
|
13
|
+
3. If recovered `review_count >= 3`, return `review_budget_exhausted` with exact
|
|
14
|
+
current-route evidence. This is a zero-write no-op: do not persist
|
|
15
|
+
`review_due` or mutate any handoff, counter, or delivery status.
|
|
16
|
+
4. Only when recovered `review_count < 3`, persist `review_due` with the valid
|
|
17
|
+
normalized target and exact explicit `$review-phase` invocation
|
|
18
|
+
context defined in the phase-handoff reference. Do not preallocate an ordinal
|
|
19
|
+
or derive `review_run_id` yet.
|
|
20
|
+
5. Return that invocation context and stop. Only an explicit operator invocation
|
|
21
|
+
of `$review-phase` consumes it, preallocates ordinal `review_count + 1`, fixes
|
|
22
|
+
`review_run_id`, and enters `review_running`.
|
|
23
|
+
|
|
24
|
+
For `report_retention_pending`, return an explicit `$review-phase` resume context
|
|
25
|
+
with the existing run id, local report identity, and fresh target/source hashes,
|
|
26
|
+
then stop. The explicit review invocation resumes retention without rerunning
|
|
27
|
+
lenses.
|
|
28
|
+
|
|
29
|
+
## Route Retained Findings
|
|
30
|
+
|
|
31
|
+
After the retained report establishes the completed ordinal:
|
|
32
|
+
|
|
33
|
+
1. Runtime evidence routes primarily to debugging.
|
|
34
|
+
2. Otherwise, an in-scope non-runtime blocker routes primarily to implementation.
|
|
35
|
+
3. Otherwise, broad architecture debt routes to debt follow-up.
|
|
36
|
+
4. Otherwise, route to docs ingest or closeout by documentation completeness.
|
|
37
|
+
|
|
38
|
+
Architecture debt may remain a secondary follow-up beside debugging or
|
|
39
|
+
implementation. Opening either repair route is one atomic durable handoff write
|
|
40
|
+
of active state, route, `repair_count = review_count`, and idempotency
|
|
41
|
+
`review_run_id`. Reject a mismatched or already-consumed repair ordinal.
|
|
42
|
+
Complete the transition only after that write. Resume an already-recorded run
|
|
43
|
+
directly without another increment.
|
|
44
|
+
|
|
45
|
+
## Completion
|
|
46
|
+
|
|
47
|
+
Before review, completion is a durable `review_due` handoff plus exact explicit
|
|
48
|
+
invocation context and a stop. After review returns `review_routed`, completion
|
|
49
|
+
records report path, report SHA-256, report commit SHA, verified retained ref,
|
|
50
|
+
lineage, run id, recovered/projected counts, stable finding ids, primary route,
|
|
51
|
+
secondary debt route when present, and resulting state. Then stop or re-enter
|
|
52
|
+
delivery routing.
|
|
@@ -1,48 +1,68 @@
|
|
|
1
1
|
# Router Phase
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Choose one next phase from durable artifacts. Review counters and active repair
|
|
4
|
+
state take precedence over inferred artifact order.
|
|
5
5
|
|
|
6
|
-
## Inputs
|
|
6
|
+
## Inputs
|
|
7
7
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
- entry intent and accepted goal bounds
|
|
9
|
+
- matching spec, backlog projection, plan, implementation notes, and validation
|
|
10
|
+
- retained review reports plus durable phase handoff
|
|
11
|
+
- current diff/target and governing source hashes
|
|
12
|
+
- docs, stack, tracker, and PR state when relevant
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## Route
|
|
14
15
|
|
|
15
|
-
1.
|
|
16
|
-
2.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
1. Stop on unclear goal bounds and ask one concrete question.
|
|
17
|
+
2. For durable `review_due`, load [review.md](review.md). It first validates
|
|
18
|
+
accepted bounds and normalizes a supported target. A rejection enters
|
|
19
|
+
`review_failed` even when a persisted counter is 3. Only after those checks
|
|
20
|
+
may it recover `review_count` and evaluate the budget in memory. Exhaustion
|
|
21
|
+
returns `review_budget_exhausted` with zero handoff or status writes. A count
|
|
22
|
+
below 3 persists `review_due` and returns the exact explicit `$review-phase`
|
|
23
|
+
invocation context. Then stop. Delivery never enters `review_running` itself.
|
|
24
|
+
3. For `report_retention_pending`, load [review.md](review.md) only to return the
|
|
25
|
+
exact explicit `$review-phase` resume context, then stop. A fresh local report
|
|
26
|
+
resumes without rerunning lenses. Stop on terminal `review_failed` with its
|
|
27
|
+
exact evidence.
|
|
28
|
+
4. Otherwise recover review state by `review_lineage_id`: read the highest valid
|
|
29
|
+
retained ordinal, reconcile the handoff `review_count` projection, then assess
|
|
30
|
+
target and source freshness separately.
|
|
31
|
+
5. Route a fresh retained `review_routed` report through [review.md](review.md)
|
|
32
|
+
when no durable route handoff exists yet.
|
|
33
|
+
6. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
|
|
34
|
+
or `repair_active` through [implement.md](implement.md). A recorded
|
|
35
|
+
`review_run_id` cannot increment `repair_count` again.
|
|
36
|
+
7. Route `focused_validation` to its recorded implementation or debugging owner.
|
|
37
|
+
Passing becomes `clean_handoff`; failure remains repair epoch 3.
|
|
38
|
+
8. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
|
|
39
|
+
otherwise [closeout.md](closeout.md).
|
|
40
|
+
9. If no matching agent-ready `SPEC.md` exists, or it is stale,
|
|
41
|
+
contradictory, or incomplete, load [spec.md](spec.md).
|
|
42
|
+
10. If the verified post-spec backlog projection is missing or stale, load
|
|
43
|
+
[backlog.md](backlog.md).
|
|
44
|
+
11. If no execution-ready matching plan exists, or it lacks dependencies, owned
|
|
45
|
+
paths, validation gates, or wave boundaries, load [plan.md](plan.md).
|
|
46
|
+
12. If accepted plan work is incomplete, load [implement.md](implement.md).
|
|
47
|
+
13. If implementation exists and its retained review is missing or stale, load
|
|
48
|
+
[review.md](review.md). That phase validates accepted bounds and normalizes a
|
|
49
|
+
supported target before any delivery-budget evaluation, then returns either
|
|
50
|
+
`review_failed`, `review_budget_exhausted`, or the exact explicit
|
|
51
|
+
`$review-phase` invocation context and stops.
|
|
52
|
+
14. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
|
|
53
|
+
otherwise [closeout.md](closeout.md).
|
|
27
54
|
|
|
28
|
-
|
|
55
|
+
Only an explicitly new delivery goal with materially changed accepted bounds
|
|
56
|
+
creates a new lineage and resets review/repair counters. Same-goal bounds
|
|
57
|
+
revision, resume, rebase, commit, retry, and handoff preserve them.
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
gate. When requested, route only the requested phase and stop after writing its
|
|
32
|
-
phase handoff. On resume, an agent-ready `SPEC.md` proceeds directly to the next
|
|
33
|
-
applicable phase; no reviewed or approved status is required.
|
|
59
|
+
## HITL And Resume
|
|
34
60
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
skills. Verify artifact freshness; do not re-run a phase only because
|
|
39
|
-
`delivery-phase` did not run it.
|
|
61
|
+
A HITL checkpoint is explicit user control. Run only the requested phase and
|
|
62
|
+
stop after its handoff. Earlier phases may have completed through direct skills;
|
|
63
|
+
reuse fresh matching artifacts rather than rerunning them.
|
|
40
64
|
|
|
41
65
|
## Output
|
|
42
66
|
|
|
43
|
-
Report
|
|
44
|
-
|
|
45
|
-
- selected phase
|
|
46
|
-
- evidence that selected it
|
|
47
|
-
- child skill or phase file to load next
|
|
48
|
-
- blocker question if no phase can be selected safely
|
|
67
|
+
Report the selected state and phase, the durable evidence that selected it, the
|
|
68
|
+
next file or child skill, and any exact blocker.
|
|
@@ -30,8 +30,14 @@ Use this reference when deciding whether a phase is complete enough to skip.
|
|
|
30
30
|
|
|
31
31
|
## Review Complete
|
|
32
32
|
|
|
33
|
-
-
|
|
34
|
-
|
|
33
|
+
- A fresh immutable report matches the delivery lineage, accepted bounds,
|
|
34
|
+
normalized target, governing source hashes, and latest implementation state.
|
|
35
|
+
- Its commit exists on a verified retained ref; a local report alone is pending.
|
|
36
|
+
- The highest valid retained ordinal is authoritative and the handoff
|
|
37
|
+
`review_count` is its reconciled projection.
|
|
38
|
+
- Findings are routed by stable ids. Review itself entered no repair state.
|
|
39
|
+
- After fix 3, `clean_handoff` supersedes the normal fresh-review requirement
|
|
40
|
+
and links report 3, final changes, focused validation, and clean status.
|
|
35
41
|
|
|
36
42
|
## Debug Complete
|
|
37
43
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Phase Handoff
|
|
2
2
|
|
|
3
|
-
Each phase
|
|
4
|
-
resume without guessing.
|
|
3
|
+
Each phase leaves enough durable state for resume without guessing.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Base Shape
|
|
7
6
|
|
|
8
7
|
```text
|
|
9
8
|
Phase:
|
|
@@ -17,11 +16,62 @@ Next suggested route:
|
|
|
17
16
|
Blockers:
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
State only what ran. Prefer durable artifact paths/links. Carry approved
|
|
20
|
+
artifacts and UI evidence. Give every skip an exact no-op reason. Honor explicit
|
|
21
|
+
HITL stops.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
## Review And Repair Projection
|
|
24
|
+
|
|
25
|
+
For a delivery goal with review activity, also persist:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
delivery_goal_identity:
|
|
29
|
+
accepted_bounds_identity:
|
|
30
|
+
accepted_bounds_hash:
|
|
31
|
+
review_lineage_id:
|
|
32
|
+
review_run_id:
|
|
33
|
+
state: review_due | review_running | report_retention_pending | review_routed | debug_active | repair_active | focused_validation | clean_handoff
|
|
34
|
+
primary_route:
|
|
35
|
+
review_count:
|
|
36
|
+
repair_count:
|
|
37
|
+
authoritative_report_path:
|
|
38
|
+
authoritative_report_commit:
|
|
39
|
+
verified_retained_ref:
|
|
40
|
+
stable_finding_ids:
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`review_count` is a projection of the highest valid retained report ordinal for
|
|
44
|
+
the lineage. Reconcile it on resume. An opening repair transition atomically
|
|
45
|
+
writes active state, primary route, `repair_count = review_count`, and
|
|
46
|
+
idempotency `review_run_id`; complete the transition only after the write. A
|
|
47
|
+
recorded run id resumes its state without increment or guard fallthrough.
|
|
48
|
+
|
|
49
|
+
## Explicit Review Invocation Context
|
|
50
|
+
|
|
51
|
+
Delivery persists this block for `review_due` and returns it unchanged before
|
|
52
|
+
stopping:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
explicit_operator_invocation_required: true
|
|
56
|
+
review_invocation_skill: $review-phase
|
|
57
|
+
review_invocation_mode: delivery
|
|
58
|
+
delivery_goal_identity:
|
|
59
|
+
accepted_bounds_identity:
|
|
60
|
+
accepted_bounds_hash:
|
|
61
|
+
review_lineage_id:
|
|
62
|
+
recovered_review_count:
|
|
63
|
+
current_route:
|
|
64
|
+
normalized_target:
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The `review_due` handoff leaves `review_run_id` unset. Only the explicit operator
|
|
68
|
+
invocation consumes this context, preallocates the next ordinal, fixes the run
|
|
69
|
+
id, and enters `review_running`.
|
|
70
|
+
|
|
71
|
+
For `report_retention_pending`, the explicit resume context additionally carries
|
|
72
|
+
the existing `review_run_id`, ordinal, local report path and SHA-256, target hash,
|
|
73
|
+
source hashes, and intended retained ref. Delivery returns it and stops; the
|
|
74
|
+
operator invokes `$review-phase` to retry retention without rerunning lenses.
|
|
75
|
+
|
|
76
|
+
After fix 3, `clean_handoff` is final authority. Link immutable review 3, final
|
|
77
|
+
changes, the same passing focused validation, and clean status.
|