@gtrabanco/pi-agentic-workflow 0.13.3 → 0.14.0
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/README.md +3 -9
- package/dist/runtime.d.ts +45 -0
- package/dist/runtime.js +62 -0
- package/package.json +3 -2
- package/skills/audit-docs/SKILL.md +6 -5
- package/skills/audit-pr/SKILL.md +1 -1
- package/skills/audit-pr/references/PORTABILITY.md +1 -1
- package/skills/execute-phase/SKILL.md +207 -116
- package/skills/execute-phase/references/DESCOPE.md +22 -18
- package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
- package/skills/execute-phase/references/FOLDING.md +34 -47
- package/skills/execute-phase/references/PREFLIGHT.md +103 -114
- package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
- package/skills/init-workspace/SKILL.md +35 -5
- package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +5 -5
- package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +15 -8
- package/skills/init-workspace/references/PORTABILITY.md +1 -1
- package/skills/init-workspace/references/UPGRADE.md +17 -7
- package/skills/log-session/SKILL.md +4 -3
- package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
- package/skills/pre-execution-review/references/LEDGERS.md +39 -39
- package/skills/pre-execution-review/references/POLICY.md +1 -0
- package/skills/review-change/SKILL.md +1 -1
- package/skills/review-change/references/PORTABILITY.md +1 -1
- package/skills/unit-lane/SKILL.md +154 -0
- package/skills/unit-lane/references/DESIGN.md +35 -0
- package/skills/unit-lane/references/DOCS.md +36 -0
- package/skills/unit-lane/references/EVIDENCE.md +34 -0
- package/skills/unit-lane/references/IMPLEMENT.md +45 -0
- package/skills/unit-lane/references/PLAN.md +38 -0
- package/skills/unit-lane/references/RELEASE.md +45 -0
- package/skills/unit-lane/references/RESEARCH.md +37 -0
- package/skills/unit-lane/references/REVIEW.md +45 -0
- package/skills/unit-lane/references/STEPS.md +23 -0
- package/skills/unit-lane/references/TESTS.md +32 -0
- package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
- package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
- package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
- package/skills/design-feature/SKILL.md +0 -231
- package/skills/design-feature/references/INTERVIEW.md +0 -74
- package/skills/design-feature/references/PORTABILITY.md +0 -15
- package/skills/design-feature/references/REPAIR.md +0 -88
- package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
- package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
- package/skills/evidence-grounding/SKILL.md +0 -174
- package/skills/evidence-grounding/references/DELEGATION.md +0 -131
- package/skills/evidence-grounding/references/READINESS.md +0 -130
- package/skills/evidence-grounding/references/ROWS.md +0 -93
- package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
- package/skills/execute-phase/references/CLOSEOUT.md +0 -77
- package/skills/execute-phase/references/HANDOFF.md +0 -21
- package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
- package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
- package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
- package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
- package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
- package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
- package/skills/generate-docs/SKILL.md +0 -145
- package/skills/generate-docs/references/ADAPTERS.md +0 -15
- package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
- package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
- package/skills/implementation-discovery/SKILL.md +0 -209
- package/skills/plan-feature/SKILL.md +0 -208
- package/skills/plan-feature/references/ROUTING.md +0 -155
- package/skills/plan-feature-from-issue/SKILL.md +0 -162
- package/skills/plan-feature-scaffold/SKILL.md +0 -112
- package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
- package/skills/plan-fix/SKILL.md +0 -161
- package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
- package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
- package/skills/planning-preflight/SKILL.md +0 -130
- package/skills/replan-findings/SKILL.md +0 -131
- package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
- package/skills/review-plan/SKILL.md +0 -154
- package/skills/review-plan/references/CHECKS.md +0 -111
- package/skills/review-plan/references/ENG-CHECKS.md +0 -30
- package/skills/review-plan/references/OUTPUT.md +0 -166
- package/skills/review-spec/SKILL.md +0 -145
- package/skills/review-spec/references/CHECKS.md +0 -108
- package/skills/review-spec/references/OUTPUT.md +0 -160
- package/skills/ship-roadmap/SKILL.md +0 -120
- package/skills/ship-roadmap/references/ADVANCE.md +0 -117
- package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
- package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
- package/skills/ship-roadmap/references/FOUNDING.md +0 -101
- package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
- package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
- package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
- package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
- package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
- package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
## The evidence row contract
|
|
2
|
-
|
|
3
|
-
The row is the unit of grounding. One row per material claim or obligation,
|
|
4
|
-
columns in this exact order:
|
|
5
|
-
|
|
6
|
-
```text
|
|
7
|
-
claim-or-obligation | authority-kind | source-and-location | observed-revision |
|
|
8
|
-
freshness | status: proven|decision|unknown | owner-or-next-evidence
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Plan-stage table — one declared extension
|
|
12
|
-
|
|
13
|
-
The Plan-stage evidence table (`planning-evidence.md`, or the XS/S embed) is the
|
|
14
|
-
row above with exactly two changes, declared here and nowhere else: a prefixed
|
|
15
|
-
stable `id` column (`PE-001`, … — renumbering is a replan, not an edit) and one
|
|
16
|
-
extension column, `affected-decision-or-obligation` (the frozen decision,
|
|
17
|
-
obligation, or acceptance row the claim resolves), inserted after
|
|
18
|
-
`observed-revision`. Full Plan-stage header order:
|
|
19
|
-
|
|
20
|
-
```text
|
|
21
|
-
id | claim-or-obligation | authority-kind | source-and-location | observed-revision | affected-decision-or-obligation | freshness | status | owner-or-next-evidence
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Closed vocabularies
|
|
25
|
-
|
|
26
|
-
`authority-kind` — exactly one:
|
|
27
|
-
|
|
28
|
-
| Value | Means | Acceptable `source-and-location` |
|
|
29
|
-
|---|---|---|
|
|
30
|
-
| `repository` | observed in tracked source, config, or a generated artifact | `path:line` or `path` + symbol/test name |
|
|
31
|
-
| `document` | a project doc, template, SPEC, roadmap or fix-index row, or fetched external documentation | `path:section`, or the URL plus access date for a fetched source (`https://… (fetched YYYY-MM-DD)`) |
|
|
32
|
-
| `ledger` | a frozen Normalized Repository State fact/decision, or an accepted architectural decision | `REPOSITORY_STATE.md` row ID (`F0nn`/`AD-nnn`) |
|
|
33
|
-
| `forge` | an issue, PR, review, or CI record | absolute issue/PR URL |
|
|
34
|
-
| `user` | an explicit user decision recorded this unit or in `decisions.md` | dated `decisions.md` / SPEC `## Amendments` row |
|
|
35
|
-
| `derived` | a conclusion computed from rows above by a stated rule | the rule plus its input row ids |
|
|
36
|
-
|
|
37
|
-
`status` — exactly one:
|
|
38
|
-
|
|
39
|
-
- `proven` — the cited source was actually read and answers the claim.
|
|
40
|
-
- `decision` — a human/ledger authority fixed it; no further evidence exists or
|
|
41
|
-
is needed. Cite the `user` or `ledger` row.
|
|
42
|
-
- `unknown` — not established. **Required:** `owner-or-next-evidence` names who
|
|
43
|
-
closes it and what evidence would close it. An `unknown` may stay open only if
|
|
44
|
-
the artifact states the consequence of it staying open.
|
|
45
|
-
|
|
46
|
-
`freshness` — exactly one:
|
|
47
|
-
|
|
48
|
-
- `current` — read at the revision the artifact will be bound to.
|
|
49
|
-
- `drifted` — the cited source changed after the row was written; re-read before
|
|
50
|
-
readiness.
|
|
51
|
-
- `stale` — the cited source no longer exists or no longer says this.
|
|
52
|
-
- `not-applicable` — `status: decision` rows that cannot drift.
|
|
53
|
-
|
|
54
|
-
A `drifted` or `stale` row is not evidence. It must be re-acquired (step 2) or
|
|
55
|
-
demoted to `unknown` with an owner; carrying it into a draft is how a plausible
|
|
56
|
-
but false rationale gets written.
|
|
57
|
-
|
|
58
|
-
### Bounded question set
|
|
59
|
-
|
|
60
|
-
Ask these, in order, once per inventory item. This is the whole set — do not
|
|
61
|
-
grow it into an open-ended research brief.
|
|
62
|
-
|
|
63
|
-
1. What must be true for this claim/obligation to hold?
|
|
64
|
-
2. Which authority kind can prove it, and where does that authority live here?
|
|
65
|
-
3. What did I actually observe there (`source-and-location`, `observed-revision`)?
|
|
66
|
-
4. Does anything in the repository, roadmap, or ledger contradict it?
|
|
67
|
-
5. If it cannot be answered: who owns the unknown, and what single next read
|
|
68
|
-
would answer it?
|
|
69
|
-
|
|
70
|
-
Questions 1–5 map onto the columns. A question already answered by a frozen
|
|
71
|
-
ledger row is not re-asked — cite the row.
|
|
72
|
-
|
|
73
|
-
### Where the rows are frozen
|
|
74
|
-
|
|
75
|
-
Rows survive compaction, so they must land in the artifact the reviewer reads —
|
|
76
|
-
never in chat history.
|
|
77
|
-
|
|
78
|
-
| Authoring stage | Frozen home | Bound by |
|
|
79
|
-
|---|---|---|
|
|
80
|
-
| Product half (`design-feature`, issue-derived design) | the SPEC's Product half plus `decisions.md` for non-obvious calls | the SPEC snapshot via `spec-product-v1` |
|
|
81
|
-
| Engineering half (`plan-feature*`, `plan-fix`) | `planning-evidence.md` for M/L units; `### Planning evidence` inside the SPEC for XS/S | the Plan snapshot (kind `planning-evidence`) |
|
|
82
|
-
|
|
83
|
-
Compaction rules: keep the conclusion row, drop raw search output, discarded
|
|
84
|
-
hypotheses, and narrative. One row per claim, no prose padding, no transcripts.
|
|
85
|
-
The table is an argument index, not a work log — a reviewer must be able to
|
|
86
|
-
audit each row against its `source-and-location` in one read.
|
|
87
|
-
|
|
88
|
-
### Fix units
|
|
89
|
-
|
|
90
|
-
A fix has no Product half (D6). Its rows cover: the reproduction, the root cause
|
|
91
|
-
with code evidence, the regression scope, the rollback path, and the affected
|
|
92
|
-
invariant or use case. Each remains a row with the same vocabulary — a missing
|
|
93
|
-
reproduction row is `unknown`, not "probably this".
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
## Whole-unit execution and portability
|
|
2
|
-
|
|
3
|
-
The normal omitted-phase command is already the batch:
|
|
4
|
-
|
|
5
|
-
```text
|
|
6
|
-
/execute-phase <NN>
|
|
7
|
-
/execute-phase --fix <n>
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
It selects every unfinished phase, gates and commits each one, skips
|
|
11
|
-
intermediate review stops, opens the PR, then recommends the manual
|
|
12
|
-
`/review-change` → `/fold-findings` (only on `REVIEW-FAIL`) → re-run
|
|
13
|
-
`/review-change` path. An explicit `P<n>` keeps the
|
|
14
|
-
atomic/manual path.
|
|
15
|
-
|
|
16
|
-
### Fresh-context driver (recommended for cheap models)
|
|
17
|
-
|
|
18
|
-
When the host has subagents or headless invocation, the unit-loop conductor
|
|
19
|
-
uses one fresh worker per phase and carries only `ACCEPTANCE.md`, the phase task
|
|
20
|
-
slice, and compact receipts. An external driver may implement the same contract:
|
|
21
|
-
|
|
22
|
-
1. Call `workflow-status` and choose the next unfinished phase.
|
|
23
|
-
2. Invoke `/execute-phase <unit> P<n>` on the cheap tool-capable tier.
|
|
24
|
-
3. Repeat `CONTINUE`; route `READY_FOR_REVIEW` to `/review-change`, then
|
|
25
|
-
`/fold-findings` (only on `REVIEW-FAIL`), then re-run `/review-change`, on
|
|
26
|
-
the required review/fold tiers.
|
|
27
|
-
4. Stop on `NEEDS_INPUT`, `HALT`, repeated unchanged evidence, or the declared
|
|
28
|
-
attempt budget.
|
|
29
|
-
|
|
30
|
-
The protocol and envelope repair loop live in
|
|
31
|
-
`docs/workflow/ORCHESTRATION.md`. The user still starts one driver run; fresh
|
|
32
|
-
contexts are an implementation detail.
|
|
33
|
-
|
|
34
|
-
### Inline fallback
|
|
35
|
-
|
|
36
|
-
A host without fresh-worker primitives executes the same queue inline. After
|
|
37
|
-
each phase it reduces state to `progress.md`'s unit-loop receipt and never
|
|
38
|
-
re-reads prior raw context. This is less context-efficient but behaviorally
|
|
39
|
-
equivalent. A user who wants maximum control may pass explicit phases manually.
|
|
40
|
-
|
|
41
|
-
### Model routing
|
|
42
|
-
|
|
43
|
-
- Planning and acceptance freezing use the strongest available model.
|
|
44
|
-
- Mechanical phase execution may use a cheaper tool-capable model.
|
|
45
|
-
- Review is never weaker than the writer and should use a different family
|
|
46
|
-
where practical.
|
|
47
|
-
- A subtle security/logic fold uses the strongest required tier even when
|
|
48
|
-
surrounding mechanical folds are cheap.
|
|
49
|
-
- Cap parallel workers below the provider's concurrency limit; on 429 reduce
|
|
50
|
-
fan-out rather than retrying at the same concurrency.
|
|
51
|
-
|
|
52
|
-
### Missing platform features
|
|
53
|
-
|
|
54
|
-
- No slash menu → open the named `SKILL.md` and follow it literally.
|
|
55
|
-
- No model tiers → select tiers manually using the rules above.
|
|
56
|
-
- No subagents/headless runs → use the inline fallback.
|
|
57
|
-
- No external driver → the built-in omitted-phase loop remains available.
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
## Implementation guidance (single-pass & per-phase)
|
|
2
|
-
|
|
3
|
-
**Tests first where they pay.** For core/domain and orchestration phases, write
|
|
4
|
-
the phase's acceptance/integration tests first (red), then implement to green —
|
|
5
|
-
the SPEC's dev scenarios are the test list, so its failure modes get exercised,
|
|
6
|
-
not just documented. UI and adapter glue may test after implementation.
|
|
7
|
-
|
|
8
|
-
Map each change to the project's layers per its architecture doc; build inner layers first, outer last:
|
|
9
|
-
|
|
10
|
-
1. **Persistence/schema** (if any) — update where defined, generate migrations with the project's tooling, never hand-edit generated output.
|
|
11
|
-
2. **Core/domain** — no outer-layer imports; use the project's value objects/rules.
|
|
12
|
-
3. **Orchestration/use-case** — inject dependencies, idempotent if re-callable, typed errors.
|
|
13
|
-
4. **Adapters** — implement the project's ports; never leak raw external errors inward.
|
|
14
|
-
5. **Controller/endpoint** — map errors to responses; webhooks: verify signature, enqueue, return fast.
|
|
15
|
-
6. **UI** (if any) — follow the design-system/i18n/accessibility docs; no hardcoded strings.
|
|
16
|
-
7. **Tests** — whatever wasn't written first (see above): light mocks of the project's interfaces; test orchestration, not adapters.
|
|
17
|
-
|
|
18
|
-
## Completion checklist (single-pass)
|
|
19
|
-
|
|
20
|
-
Write `docs/features/<NN>-<slug>/CHECKLIST.md`: schema migration applied (if any) · core layer has no outer imports · orchestration idempotent + typed errors · adapters implement ports · tests pass · type-check/lint green · UI strings localized (if UI) · domain value-object rules respected · user-facing limitations disclosed · new deps pinned. Note any decisions not captured in the SPEC.
|
|
21
|
-
|
|
22
|
-
## Review checkpoint & finishing a unit
|
|
23
|
-
|
|
24
|
-
**Independent final review is mandatory — every unit gets one before merge.**
|
|
25
|
-
Recommend the mandatory `/review-change` → `/fold-findings` (only on
|
|
26
|
-
`REVIEW-FAIL`) → re-run `/review-change` path because it preserves fresh review
|
|
27
|
-
contexts while handling bounded corrections; direct `review-change` remains the
|
|
28
|
-
manual entry. Review
|
|
29
|
-
runs in its own turn (hand-off, not composed): a skill's model and
|
|
30
|
-
effort are fixed at turn start, so invoking `review-change` from here would run it at
|
|
31
|
-
execute-phase's `sonnet`/`medium` rather than its own `opus`/`high` — under-powering
|
|
32
|
-
the review. So **suggest** it; don't compose it. (General rule: across a model/effort
|
|
33
|
-
boundary, hand off; don't compose.) On agents without per-skill model config the same
|
|
34
|
-
rule holds by hand: run the review as a **separate, fresh invocation** on your
|
|
35
|
-
strongest model — never inline in the implementation run.
|
|
36
|
-
|
|
37
|
-
**Cadence.** Explicit-phase feature mode: after each completed phase, the closing block
|
|
38
|
-
**recommends** the hand-off whenever a *Review checkpoint trigger* fires
|
|
39
|
-
(layer boundary, accumulation, or sensitivity — see above), naming which one —
|
|
40
|
-
a suggestion the user may skip to keep executing phases. Whole-unit mode records
|
|
41
|
-
triggers and continues without intermediate hand-offs; the skill never blocks
|
|
42
|
-
on an intermediate review. What is **never optional** is the end: every
|
|
43
|
-
unit gets one `review-change` pass before merge (single-pass and `--fix`
|
|
44
|
-
included — they have no intermediate phases, so the end review is their only
|
|
45
|
-
one).
|
|
46
|
-
|
|
47
|
-
**Finishing a unit (single-pass, `--fix`, or a feature's final phase): the last step
|
|
48
|
-
is always an open PR.** Mark the unit `done`, commit the flip, push, and `gh pr create`
|
|
49
|
-
(see the mode steps above) — regardless of the review/audit still to come. Then hand
|
|
50
|
-
off to `/review-change` (the mandatory end review) → `/fold-findings` (only
|
|
51
|
-
on `REVIEW-FAIL`) → re-run `/review-change`, which feeds `audit-pr`
|
|
52
|
-
(the merge gate).
|
|
53
|
-
|
|
54
|
-
**Adversarial pass at that mandatory end review.** `review-change` evaluates its
|
|
55
|
-
own recommendation checklist there (`L`/sensitive change, reviewer not the
|
|
56
|
-
fleet's strongest or weaker than the author, or a single model family on a
|
|
57
|
-
`≥M` change) and — only when a box fires — recommends `--adversarial N`
|
|
58
|
-
(N=2 default, N=3 on a security/auth surface or a single-family fleet) instead
|
|
59
|
-
of its default single-reviewer pass. This is evaluated once, at that mandatory
|
|
60
|
-
end review; it does not change the trigger-based checkpoint cadence above.
|
|
61
|
-
|
|
62
|
-
Checkpoint hand-off (print it — every invocation ends by suggesting the next
|
|
63
|
-
step; when a trigger fires, the review is the recommendation, continuing is a
|
|
64
|
-
listed alternative — the user picks):
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
Phase <N> done and committed. Review checkpoint (recommended) — <trigger name> fired: <one-line reason>.
|
|
68
|
-
→ Next: /review-change — it reviews the branch at its own model/effort
|
|
69
|
-
· skip the checkpoint → /execute-phase <NN> <next phase> (the mandatory end review still covers everything)
|
|
70
|
-
· findings (if you review) → fold fix-now into the branch; independent work stays a proposal until user triage; then re-review
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
`<trigger name>` is one of `layer boundary`, `accumulation`, or `sensitivity`
|
|
74
|
-
(see *Review checkpoint triggers*); `<one-line reason>` cites the evidence
|
|
75
|
-
(e.g. "next phase declares `api`, this one was `domain`", "612 lines / 11
|
|
76
|
-
files since `a1b2c3d`", "phase touched auth middleware"). No trigger fired?
|
|
77
|
-
Omit the checkpoint line entirely and go straight to naming the next phase.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
## Phase handoff record (`progress.md` — fixed schema)
|
|
2
|
-
|
|
3
|
-
Every phase ends by APPENDING one entry to the unit's `progress.md`. Feature
|
|
4
|
-
mode: the file `plan-feature-scaffold` created. Phased XS/S single-pass and
|
|
5
|
-
`--fix` units: create `progress.md` beside the SPEC on P1 (the SPEC's
|
|
6
|
-
checkboxes stay the task ledger; this file is the **handoff channel**).
|
|
7
|
-
Fixed schema — all five lines present, `none` is valid, free prose is not:
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
## P<k> — <YYYY-MM-DD>
|
|
11
|
-
- Done: <the phase's delivered tasks, one line>
|
|
12
|
-
- Remains: <in-unit work still open, or none>
|
|
13
|
-
- Gotchas: <surprises, workarounds, or decisions the NEXT phase must know, or none>
|
|
14
|
-
- Files: <paths touched>
|
|
15
|
-
- Next: P<k+1> — <its title> | unit finished
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
The entry rides the phase commit (no sha in the entry — the carrying commit is
|
|
19
|
-
the phase sha; `git log` resolves it). The next phase starts in a fresh
|
|
20
|
-
conversation and reads only `SPEC.md`, its phase's `TASKS.md` section (or SPEC
|
|
21
|
-
`## Phases`), and `progress.md`. Never rely on prior-session memory.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
## Opportunistic finding policy
|
|
2
|
-
|
|
3
|
-
Use this only for genuinely out-of-scope work discovered while implementing the
|
|
4
|
-
current unit. Missing acceptance, correctness, security, accessibility, required
|
|
5
|
-
UX/error behavior, or a phase task remains current-unit work — fix/replan/decide
|
|
6
|
-
inside the unit; it is never a proposal or issue.
|
|
7
|
-
|
|
8
|
-
### Closed decision ladder
|
|
9
|
-
|
|
10
|
-
Evaluate rows in order; every box in a selected row must pass. Estimates include
|
|
11
|
-
tests and docs.
|
|
12
|
-
|
|
13
|
-
| Decision | Pass only if every box is true | Action |
|
|
14
|
-
|---|---|---|
|
|
15
|
-
| **Autofix** | ≤15 lines; ≤2 files; files already touched; low risk; no public API/schema/migration/dependency/permission/architecture/user-visible change; objective unchanged | Fix in the current phase commit and run its gate. |
|
|
16
|
-
| **Opportunistic Fix** | ≤40 lines; ≤3 files; files touched or directly covered by the phase test; supports touched behavior/consistency; low risk; no public API/schema/migration/dependency/permission/architecture/acceptance change; objective unchanged | Fix in the phase commit, add focused behavior coverage, run the gate. |
|
|
17
|
-
| **Proposal** | Either fix row fails, evidence is uncertain, work is independent, or product/risk judgment is needed | Do not edit or create an issue. Record a compact proposal with evidence and trigger for explicit user batch triage. |
|
|
18
|
-
|
|
19
|
-
`≤` is inclusive. Check Opportunistic Fix even after a non-size Autofix failure.
|
|
20
|
-
More than 40 lines/3 files is a Proposal unless it is current-unit work, in
|
|
21
|
-
which case it is `replan-in-unit` and stays on the same branch/PR.
|
|
22
|
-
|
|
23
|
-
### Record before acting
|
|
24
|
-
|
|
25
|
-
Append one row to `decisions.md` before editing/recording:
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
| Date | Finding | Evidence | Estimate | Risk | Local files | Decision | Why | Trigger | Record |
|
|
29
|
-
|---|---|---|---|---|---|---|---|---|---|
|
|
30
|
-
| <date> | <finding> | <file:line/command> | <lines/files> | <low/med/high> | <yes/no + paths> | <Autofix/Opportunistic Fix/Proposal> | <boxes> | <when to reconsider> | <commit sha|proposal> |
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
For a Proposal, `Record` stays `proposal`; no forge operation runs. Batch the
|
|
34
|
-
proposal in the unit's final report. Only an explicit user invocation of
|
|
35
|
-
`triage-issue`/the project's backlog intake may create tracked work, where it
|
|
36
|
-
must dedupe against existing issues first.
|
|
37
|
-
|
|
38
|
-
### Guardrails
|
|
39
|
-
|
|
40
|
-
- No automatic `gh issue create` or equivalent from execution, review, fold,
|
|
41
|
-
audit, or their loops.
|
|
42
|
-
- Never use Proposal to move unfinished SPEC/task scope out of the unit.
|
|
43
|
-
- An uncertain classification becomes Proposal and may stop for user judgment;
|
|
44
|
-
it never authorizes adjacent edits.
|
|
45
|
-
- `known-issues.md` records blockers, not a substitute backlog.
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
## Whole-unit execution loop
|
|
2
|
-
|
|
3
|
-
This route runs only when the user omitted `P<n>`. One user invocation advances
|
|
4
|
-
every remaining planned phase; phase boundaries still own scope, gates,
|
|
5
|
-
documentation, and commits.
|
|
6
|
-
|
|
7
|
-
### Dispatch
|
|
8
|
-
|
|
9
|
-
- `execute-phase <NN>` → all remaining feature phases.
|
|
10
|
-
- `execute-phase --fix <n>` → all remaining fix phases.
|
|
11
|
-
- An explicit `P<n>` never loads this route and executes exactly one phase.
|
|
12
|
-
- Default `--max-attempts 3` limits repair attempts for the same unchanged gate
|
|
13
|
-
failure inside one phase. A positive user value overrides it.
|
|
14
|
-
|
|
15
|
-
### Queue
|
|
16
|
-
|
|
17
|
-
Read the unit ledger once and select unfinished phases in ascending order. A
|
|
18
|
-
phase is unfinished when any task is unticked or its evidence/commit is absent.
|
|
19
|
-
Reconcile ticks against repository evidence before selection; contradictory
|
|
20
|
-
state with no unique next phase returns `AMBIGUOUS` and stops.
|
|
21
|
-
|
|
22
|
-
Materialize the queue before work as explicit phase IDs (`P2, P3, P4`), never
|
|
23
|
-
an empty array, ellipsis, or template placeholder. Every terminal report names
|
|
24
|
-
the phases actually attempted/completed.
|
|
25
|
-
|
|
26
|
-
The final `Hardening & PR`/close-out phase remains last. Never run it while an
|
|
27
|
-
earlier phase is unfinished.
|
|
28
|
-
|
|
29
|
-
### Loop — one transaction per phase
|
|
30
|
-
|
|
31
|
-
For each queued phase:
|
|
32
|
-
|
|
33
|
-
1. Recompute the frozen `ACCEPTANCE.md` blob and compare it with the acceptance
|
|
34
|
-
receipt. Mismatch/missing → `ACCEPTANCE GATE BLOCKED`; no edits.
|
|
35
|
-
2. Run phase-lint, architectural-invariant, dependency/own-status fast paths,
|
|
36
|
-
and the selected mode workflow for this phase. A fail-closed gate ends the
|
|
37
|
-
whole invocation with its existing fixed block.
|
|
38
|
-
3. Prefer a fresh worker context when the host supports subagents/headless
|
|
39
|
-
workers; give it only `ACCEPTANCE.md`, `SPEC.md`, this phase's tasks, the last
|
|
40
|
-
`progress.md` receipt, and the selected workflow contracts. The conductor
|
|
41
|
-
keeps receipts, never raw source context. Without that primitive, execute
|
|
42
|
-
inline and apply the same input cap.
|
|
43
|
-
4. Implement the phase, run its exact validators and normal project gate, update
|
|
44
|
-
unit docs, and commit. Never commit red and never weaken a validator.
|
|
45
|
-
5. On a red gate, feed back only the failing command, exit status, failing test
|
|
46
|
-
names, and smallest relevant output. Repair the same phase and retry. Same
|
|
47
|
-
failure with no diff twice, or `--max-attempts` exhausted, stops:
|
|
48
|
-
|
|
49
|
-
```text
|
|
50
|
-
UNIT LOOP — <unit> BLOCKED at <P<n>>
|
|
51
|
-
Reason: <NO-PROGRESS|ATTEMPT-BUDGET> · Attempts: <n>
|
|
52
|
-
Last validator: <command> → <exit/status + compact failure>
|
|
53
|
-
Preserved: no red commit; acceptance blob <sha> unchanged
|
|
54
|
-
|
|
55
|
-
→ Next: inspect the named blocker, then re-run /execute-phase <unit>
|
|
56
|
-
· architecture/product decision required → resolve it before resuming
|
|
57
|
-
· continue atomically → /execute-phase <unit> <P<n>>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
6. Before the commit append a compact cycle receipt to `progress.md`:
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
## Unit-loop receipt — <P<n>>
|
|
64
|
-
- Commit: pending · Gate: <command> (exit 0) · Acceptance blob: <sha>
|
|
65
|
-
- Next: <P<n+1>|close-out|none> · Attempts: <n>
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Commit it with the phase, then replace `pending` with the resulting SHA in
|
|
69
|
-
the next phase's reconciliation note (never amend an already-published
|
|
70
|
-
commit only to self-reference it). Reduce working state to the receipt.
|
|
71
|
-
7. Do **not** stop for intermediate review checkpoint triggers. Record any
|
|
72
|
-
trigger in the receipt for final risk selection; the mandatory independent
|
|
73
|
-
end review covers the frozen final candidate once.
|
|
74
|
-
|
|
75
|
-
### Terminal
|
|
76
|
-
|
|
77
|
-
When the last implementation phase is green, run the existing close-out phase:
|
|
78
|
-
mark done, push, open/link the PR, and leave the branch remote-current. Then:
|
|
79
|
-
|
|
80
|
-
```text
|
|
81
|
-
UNIT LOOP — <unit> COMPLETE
|
|
82
|
-
Phases: <n> · Commits: <sha list> · Acceptance: <blob> · Gate: PASS
|
|
83
|
-
PR: <url>
|
|
84
|
-
|
|
85
|
-
→ Next: /review-change on the changed HEAD — the mandatory end review (fold-findings only after a REVIEW-FAIL)
|
|
86
|
-
· findings → /fold-findings (only on a REVIEW-FAIL), then re-run /review-change — triage or replan unresolved findings
|
|
87
|
-
· merge gate after REVIEW-PASS → /audit-pr
|
|
88
|
-
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
## Feature mode workflow
|
|
2
|
-
|
|
3
|
-
**Atomic feature phase** — `docs/features/<NN>-<slug>/`. An explicit `P<n>`
|
|
4
|
-
runs this once; whole-unit mode calls it once per remaining phase.
|
|
5
|
-
|
|
6
|
-
1. Verify branch (create if on `main`). **P1 only:** if the planning artifacts
|
|
7
|
-
(`docs/features/<NN>-<slug>/`) are still uncommitted, commit them first on the
|
|
8
|
-
feature branch — `git add docs/features/<NN>-<slug> && git commit -m "docs(<NN>-<slug>): planning artifacts"` —
|
|
9
|
-
so planning history stays separate from implementation.
|
|
10
|
-
2. Read `progress.md` first (the phase handoff record — fixed schema above;
|
|
11
|
-
the last entry's `Remains:`/`Gotchas:` lines are the previous phase's
|
|
12
|
-
message to you), then `SPEC.md` + the requested phase's `TASKS.md`
|
|
13
|
-
section. That is the whole handoff — never rely on session memory from a
|
|
14
|
-
previous phase, and honor the *Context budget* for everything beyond
|
|
15
|
-
these files.
|
|
16
|
-
3. Implement only that phase (see *Implementation guidance*).
|
|
17
|
-
4. Run the gate (type-check, tests, build). **If red:** fix within the phase's
|
|
18
|
-
scope and re-run — never commit red. If the failure can't be fixed within
|
|
19
|
-
this phase's scope, record it in `known-issues.md`, leave the work
|
|
20
|
-
uncommitted, and stop with a clear report.
|
|
21
|
-
5. Update the per-phase docs.
|
|
22
|
-
6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"` — one commit per phase, conventional format. Run this; don't just describe what should be committed.
|
|
23
|
-
7. **Explicit-phase mode only:** check the review checkpoint triggers and make
|
|
24
|
-
the existing non-blocking recommendation when one fires. Whole-unit mode
|
|
25
|
-
records the trigger in its phase receipt and continues; it never interrupts
|
|
26
|
-
for an intermediate review. The end review stays mandatory.
|
|
27
|
-
|
|
28
|
-
**Resuming an interrupted phase (stated contract — any agent must honor it).**
|
|
29
|
-
If, on entry, the unit branch already carries dirty files or commits belonging
|
|
30
|
-
to the requested phase (a prior run died mid-turn — e.g. the driver process
|
|
31
|
-
restarted), do **not** restart the phase from scratch: reconcile against
|
|
32
|
-
`TASKS.md` first — verify each ticked task's evidence actually exists (code
|
|
33
|
-
path / test present), untick any tick without evidence, then continue from the
|
|
34
|
-
first unticked task. Idempotent re-entry is the contract `workflow-status`'s
|
|
35
|
-
crash-recovery verdict `RESUMABLE` relies on. If the ledger contradicts the
|
|
36
|
-
commits in a way that has no unique next task, stop and report instead of
|
|
37
|
-
guessing (that is its `AMBIGUOUS` verdict — a human decides).
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
## Fix mode workflow
|
|
2
|
-
|
|
3
|
-
**`--fix`** — `docs/fix/<n>-<topic>/`, template `docs/fix/_TEMPLATE/SPEC.md`,
|
|
4
|
-
index `docs/fix/README.md`. A phased fix runs every remaining phase when `P<k>`
|
|
5
|
-
is omitted and one phase when it is explicit. The final `Hardening & PR` phase
|
|
6
|
-
runs close-out (steps 7–9) after prior phases are green; legacy SPECs run once.
|
|
7
|
-
|
|
8
|
-
1. Verify the issue exists (`gh issue view <n>`); if it doesn't, create it
|
|
9
|
-
(`gh issue create --template fix.yml --body-file <path>`, body from the SPEC
|
|
10
|
-
written to a Markdown file — per the Markdown rule above).
|
|
11
|
-
2. **If `docs/fix/<n>-<topic>/SPEC.md` already exists (e.g. from `plan-fix`), use it — do not re-draft.** Otherwise copy the template, fill every section, and register the entry in `docs/fix/README.md`.
|
|
12
|
-
3. Verify branch (`fix/<n>-<topic>`).
|
|
13
|
-
4. Implement the fix (no separate planning artifacts; the SPEC and its `## Phases` ledger are enough).
|
|
14
|
-
5. Run the gate.
|
|
15
|
-
6. Stage and commit: `git add <changed files>` then `git commit -m "fix(<scope>): <summary>"`. An explicit implementation phase **STOPs here — no push, no PR**; whole-unit mode continues to the next phase.
|
|
16
|
-
7. **Mark done + open the PR — always (the close-out; in a phased SPEC these
|
|
17
|
-
are the final `Hardening & PR` phase's tasks).** Set the
|
|
18
|
-
`docs/fix/README.md` entry's status to `done` (built, not yet merged), commit,
|
|
19
|
-
`git push`, then open the PR with the body written to a Markdown file (per the
|
|
20
|
-
Markdown rule above): `gh pr create --base main --title "fix(<scope>): <summary>" --body-file <path>`
|
|
21
|
-
(the body includes `Closes #<n>`). Run the commands. Then, with the returned URL: **print it in the chat**,
|
|
22
|
-
set the `docs/fix/README.md` entry to `done · [#<pr>](<pr-url>)`, commit
|
|
23
|
-
(`docs: link PR #<n>`), and push again. A fix **never ends branch-only** —
|
|
24
|
-
it always leaves an open, chat-linked PR.
|
|
25
|
-
8. **Mandatory review hand-off** → `/review-change`, then `audit-pr` as the merge gate.
|
|
26
|
-
Print the next step. **Keep the fix-index entry** until the PR is actually merged
|
|
27
|
-
(don't drop issue tracking early; the merge gate also blocks on pending docs).
|
|
28
|
-
9. **After merge only:** remove the `docs/fix/README.md` entry (or archive it to the
|
|
29
|
-
project's fix history per its convention) — never before the merge.
|
|
30
|
-
|
|
31
|
-
**Resuming an interrupted phase (stated contract — any agent must honor it).**
|
|
32
|
-
If, on entry, the fix branch already carries dirty files or commits belonging
|
|
33
|
-
to the requested phase (a prior run died mid-turn — e.g. the driver process
|
|
34
|
-
restarted), do **not** restart the phase from scratch: reconcile against the
|
|
35
|
-
SPEC's `## Phases` checkboxes first — verify each ticked task's evidence
|
|
36
|
-
actually exists (code path / test present), untick any tick without evidence,
|
|
37
|
-
then continue from the first unticked task. Idempotent re-entry is the contract
|
|
38
|
-
`workflow-status`'s crash-recovery verdict `RESUMABLE` relies on. If the ledger
|
|
39
|
-
contradicts the commits in a way that has no unique next task, stop and report
|
|
40
|
-
instead of guessing (that is its `AMBIGUOUS` verdict — a human decides).
|
|
41
|
-
|
|
42
|
-
(The `Depends on:` check for fixes is the same Dependency gate above — it runs
|
|
43
|
-
before step 1, transitively, and blocks unless `--force`.)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
## Legacy mode workflow
|
|
2
|
-
|
|
3
|
-
**Legacy single-pass** — a SPEC **without** a `## Phases` section (drafted
|
|
4
|
-
before `plan-feature-scaffold` 1.8.0 / `plan-fix` 2.1.0) runs the whole unit
|
|
5
|
-
end-to-end in **one pass**. This is the fallback shared by small-feature and
|
|
6
|
-
`--fix` modes; a SPEC that carries `## Phases` never runs it.
|
|
7
|
-
|
|
8
|
-
1. Verify branch.
|
|
9
|
-
2. Read `SPEC.md` (+ `DECISIONS.md` if present) and the docs its documentation map points to.
|
|
10
|
-
3. If the SPEC is ambiguous on scope / edge cases / UI, ask first — one question at a time, nothing it already answers.
|
|
11
|
-
4. Implement end-to-end (see *Implementation guidance*).
|
|
12
|
-
5. Run the gate; write `CHECKLIST.md` (below).
|
|
13
|
-
6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"`.
|
|
14
|
-
7. **Mark done + open the PR — always (the close-out).** Flip the roadmap
|
|
15
|
-
row to `done` (it's *built*; merge state lives in the forge, not the status —
|
|
16
|
-
see *Marking done*), commit that flip, then `git push` and open the PR
|
|
17
|
-
(body written to a file as Markdown, per the Markdown rule above):
|
|
18
|
-
`gh pr create --base main --title "<type>(<scope>): <summary>" --body-file <path>`
|
|
19
|
-
(put `Closes #<n>` in that body when issue-born). Then, with the URL `gh pr create`
|
|
20
|
-
returned: **print it in the chat**, update the roadmap row to
|
|
21
|
-
`done · [#<pr>](<pr-url>)`, commit (`docs: link PR #<n>`), and push again —
|
|
22
|
-
the link commit rides the same open PR. A single-pass unit **never ends
|
|
23
|
-
branch-only** — it always leaves an open, chat-linked PR, regardless of the
|
|
24
|
-
review/audit still to come.
|
|
25
|
-
8. **Mandatory review hand-off** → `/review-change` (the required final quality step;
|
|
26
|
-
see *Review checkpoint*), then `audit-pr` as the merge gate. Print the next step.
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
## Small/phased mode workflow
|
|
2
|
-
|
|
3
|
-
**Phased single-pass units — the default for small (XS/S) feature SPECs.**
|
|
4
|
-
Every current XS/S feature SPEC carries `## Phases` (**≥ 2 phases**; final =
|
|
5
|
-
`Hardening & PR`). `execute-phase <NN>` runs every remaining phase; explicit
|
|
6
|
-
`P<k>` runs one. The SPEC's checkboxes are the execution ledger (there is no
|
|
7
|
-
`TASKS.md`): tick each task with evidence.
|
|
8
|
-
|
|
9
|
-
**Resuming an interrupted phase (stated contract — any agent must honor it).**
|
|
10
|
-
If, on entry, the unit branch already carries dirty files or commits belonging
|
|
11
|
-
to the requested phase (a prior run died mid-turn — e.g. the driver process
|
|
12
|
-
restarted), do **not** restart the phase from scratch: reconcile against the
|
|
13
|
-
SPEC's checkboxes first — verify each ticked task's evidence actually exists
|
|
14
|
-
(code path / test present), untick any tick without evidence, then continue
|
|
15
|
-
from the first unticked task. Idempotent re-entry is the contract
|
|
16
|
-
`workflow-status`'s crash-recovery verdict `RESUMABLE` relies on. If the ledger
|
|
17
|
-
contradicts the commits in a way that has no unique next task, stop and report
|
|
18
|
-
instead of guessing (that is its `AMBIGUOUS` verdict — a human decides).
|
|
19
|
-
|
|
20
|
-
Each phase appends its handoff entry to a `progress.md` beside the SPEC
|
|
21
|
-
(created on P1 — see *Phase handoff record*). An implementation phase runs the
|
|
22
|
-
per-phase steps below. Explicit-phase mode **STOPs after the phase commit — no
|
|
23
|
-
push, no PR** (the turn contract's box 5 "unit not finished" rule); unit-loop
|
|
24
|
-
mode continues. The final `Hardening & PR` phase runs close-out after every
|
|
25
|
-
prior phase is green; its pre-written tasks ARE the close-out chain.
|
|
26
|
-
|
|
27
|
-
Per-phase steps (implementation phases only):
|
|
28
|
-
|
|
29
|
-
1. Verify branch.
|
|
30
|
-
2. Read `SPEC.md` (+ `DECISIONS.md` if present) and the docs its documentation map points to.
|
|
31
|
-
3. If the SPEC is ambiguous on scope / edge cases / UI, ask first — one question at a time, nothing it already answers.
|
|
32
|
-
4. Implement end-to-end (see *Implementation guidance*).
|
|
33
|
-
5. Run the gate; write `CHECKLIST.md` (below).
|
|
34
|
-
6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"`. **STOP** — no push, no PR until the final phase.
|
|
35
|
-
|
|
36
|
-
A SPEC **without** `## Phases` (drafted before those versions) runs the
|
|
37
|
-
**legacy single-pass flow** unchanged, end-to-end in one pass — see
|
|
38
|
-
[legacy workflow](WORKFLOWS_LEGACY.md).
|