@gtrabanco/pi-agentic-workflow 0.13.3 → 0.15.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.
Files changed (118) hide show
  1. package/README.md +3 -9
  2. package/dist/conductor/closeout.d.ts +18 -0
  3. package/dist/conductor/closeout.js +24 -0
  4. package/dist/conductor/decide.d.ts +25 -0
  5. package/dist/conductor/decide.js +104 -0
  6. package/dist/conductor/index.d.ts +16 -0
  7. package/dist/conductor/index.js +15 -0
  8. package/dist/conductor/invoke.d.ts +15 -0
  9. package/dist/conductor/invoke.js +59 -0
  10. package/dist/conductor/loop.d.ts +25 -0
  11. package/dist/conductor/loop.js +236 -0
  12. package/dist/conductor/sensor.d.ts +12 -0
  13. package/dist/conductor/sensor.js +150 -0
  14. package/dist/conductor/snapshot.d.ts +13 -0
  15. package/dist/conductor/snapshot.js +60 -0
  16. package/dist/conductor/types.d.ts +248 -0
  17. package/dist/conductor/types.js +47 -0
  18. package/dist/conductor/urgency.d.ts +16 -0
  19. package/dist/conductor/urgency.js +70 -0
  20. package/dist/config/merge.js +21 -1
  21. package/dist/config/schema.js +45 -2
  22. package/dist/config/types.d.ts +22 -0
  23. package/dist/config/types.js +7 -0
  24. package/dist/extension/conductor-command.d.ts +23 -0
  25. package/dist/extension/conductor-command.js +93 -0
  26. package/dist/extension/factory.js +6 -1
  27. package/dist/routing/types.d.ts +2 -0
  28. package/dist/routing/types.js +2 -0
  29. package/dist/runtime.d.ts +45 -0
  30. package/dist/runtime.js +62 -0
  31. package/package.json +4 -2
  32. package/skills/audit-docs/SKILL.md +6 -5
  33. package/skills/audit-pr/SKILL.md +1 -1
  34. package/skills/audit-pr/references/PORTABILITY.md +1 -1
  35. package/skills/execute-phase/SKILL.md +207 -116
  36. package/skills/execute-phase/references/DESCOPE.md +22 -18
  37. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
  38. package/skills/execute-phase/references/FOLDING.md +34 -47
  39. package/skills/execute-phase/references/PREFLIGHT.md +103 -114
  40. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
  41. package/skills/init-workspace/SKILL.md +35 -5
  42. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +5 -5
  43. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +15 -8
  44. package/skills/init-workspace/references/PORTABILITY.md +1 -1
  45. package/skills/init-workspace/references/UPGRADE.md +17 -7
  46. package/skills/log-session/SKILL.md +4 -3
  47. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
  48. package/skills/pre-execution-review/references/LEDGERS.md +39 -39
  49. package/skills/pre-execution-review/references/POLICY.md +1 -0
  50. package/skills/review-change/SKILL.md +1 -1
  51. package/skills/review-change/references/PORTABILITY.md +1 -1
  52. package/skills/unit-lane/SKILL.md +154 -0
  53. package/skills/unit-lane/references/DESIGN.md +35 -0
  54. package/skills/unit-lane/references/DOCS.md +36 -0
  55. package/skills/unit-lane/references/EVIDENCE.md +34 -0
  56. package/skills/unit-lane/references/IMPLEMENT.md +45 -0
  57. package/skills/unit-lane/references/PLAN.md +38 -0
  58. package/skills/unit-lane/references/RELEASE.md +45 -0
  59. package/skills/unit-lane/references/RESEARCH.md +37 -0
  60. package/skills/unit-lane/references/REVIEW.md +45 -0
  61. package/skills/unit-lane/references/STEPS.md +23 -0
  62. package/skills/unit-lane/references/TESTS.md +32 -0
  63. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
  64. package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
  65. package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
  66. package/skills/design-feature/SKILL.md +0 -231
  67. package/skills/design-feature/references/INTERVIEW.md +0 -74
  68. package/skills/design-feature/references/PORTABILITY.md +0 -15
  69. package/skills/design-feature/references/REPAIR.md +0 -88
  70. package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
  71. package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
  72. package/skills/evidence-grounding/SKILL.md +0 -174
  73. package/skills/evidence-grounding/references/DELEGATION.md +0 -131
  74. package/skills/evidence-grounding/references/READINESS.md +0 -130
  75. package/skills/evidence-grounding/references/ROWS.md +0 -93
  76. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
  77. package/skills/execute-phase/references/CLOSEOUT.md +0 -77
  78. package/skills/execute-phase/references/HANDOFF.md +0 -21
  79. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
  80. package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
  81. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
  82. package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
  83. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
  84. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
  85. package/skills/generate-docs/SKILL.md +0 -145
  86. package/skills/generate-docs/references/ADAPTERS.md +0 -15
  87. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
  88. package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
  89. package/skills/implementation-discovery/SKILL.md +0 -209
  90. package/skills/plan-feature/SKILL.md +0 -208
  91. package/skills/plan-feature/references/ROUTING.md +0 -155
  92. package/skills/plan-feature-from-issue/SKILL.md +0 -162
  93. package/skills/plan-feature-scaffold/SKILL.md +0 -112
  94. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
  95. package/skills/plan-fix/SKILL.md +0 -161
  96. package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
  97. package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
  98. package/skills/planning-preflight/SKILL.md +0 -130
  99. package/skills/replan-findings/SKILL.md +0 -131
  100. package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
  101. package/skills/review-plan/SKILL.md +0 -154
  102. package/skills/review-plan/references/CHECKS.md +0 -111
  103. package/skills/review-plan/references/ENG-CHECKS.md +0 -30
  104. package/skills/review-plan/references/OUTPUT.md +0 -166
  105. package/skills/review-spec/SKILL.md +0 -145
  106. package/skills/review-spec/references/CHECKS.md +0 -108
  107. package/skills/review-spec/references/OUTPUT.md +0 -160
  108. package/skills/ship-roadmap/SKILL.md +0 -120
  109. package/skills/ship-roadmap/references/ADVANCE.md +0 -117
  110. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
  111. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
  112. package/skills/ship-roadmap/references/FOUNDING.md +0 -101
  113. package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
  114. package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
  115. package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
  116. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
  117. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
  118. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
@@ -1,89 +1,86 @@
1
- ## Review checkpoint triggers (feature mode)
1
+ ## Review checkpoint triggers
2
2
 
3
3
  The recommended, skippable checkpoint fires on **what accumulated since the
4
- last checkpoint**, not on a phase count — a phase-counter cadence re-miscalibrates
5
- whenever phase size changes (see `#77`). After each phase commit, check all
6
- three; recommend the checkpoint (naming which trigger fired) the moment any
7
- one does:
8
-
9
- 1. **Layer boundary** — the phase about to start declares a different
10
- `Layer:` (the phase-lint enum) than the phase just committed. The just-closed
11
- layer is a coherent reviewable unit.
4
+ last checkpoint**, not on a step count — a step-counter cadence re-miscalibrates
5
+ whenever step size changes. After each step commit, check all three; recommend
6
+ the checkpoint (naming which trigger fired) the moment any one does:
7
+
8
+ 1. **Layer boundary** — the step about to start declares a different `Layer:`
9
+ (the phase-lint enum) than the step just committed. The just-closed layer is
10
+ a coherent reviewable unit.
12
11
  2. **Accumulation** — the unreviewed diff since the last-reviewed marker
13
12
  exceeds **> 400 changed lines (insertions + deletions) OR > 8 changed
14
- files**, measured with `git diff --stat <baseline>..HEAD`. Covers a long run
15
- of small same-layer phases the layer-boundary trigger would miss.
16
- 3. **Sensitivity** — the phase just committed touches auth, payments,
13
+ files**, measured with `git diff --stat <baseline>..HEAD`.
14
+ 3. **Sensitivity** — the step just committed touches auth, payments,
17
15
  destructive migrations, secrets, or CI config → recommend an **immediate**
18
- checkpoint on closing it, regardless of the other two triggers. This is a
19
- **single-reviewer** recommendation and does not change `review-change`'s
20
- own once-per-unit adversarial cadence (`skills/review-change/SKILL.md`
21
- "Cadence — once per unit") — the two are independent mechanisms.
22
-
23
- **Last-reviewed marker.** Home: `progress.md`'s header line
24
- `Last reviewed: <sha>`. Sole writer: `execute-phase` — stamped with the
25
- just-committed phase's sha immediately after a checkpoint is taken (review
26
- happens in a separate turn, so this skill records the marker at the start of
27
- the *next* phase it executes, using the sha the user confirmed was reviewed).
28
- If the marker is absent (unit's first checkpoint, or a legacy `progress.md`
29
- predating this rule), the baseline is `git merge-base <default-branch> HEAD` —
30
- never treat a missing marker as a blocker or crash condition.
16
+ checkpoint on closing it. This is a single-reviewer recommendation and does
17
+ not change `review-change`'s own once-per-unit adversarial cadence — the two
18
+ are independent mechanisms.
19
+
20
+ **Last-reviewed marker.** Home: the unit doc's Evidence section header line
21
+ `Last reviewed: <sha>`. Sole writer: `execute-phase` — stamped after a checkpoint
22
+ is taken (the next step records the sha the user confirmed was reviewed). If
23
+ absent (unit's first checkpoint), the baseline is
24
+ `git merge-base <default-branch> HEAD` — never treat a missing marker as a
25
+ blocker or crash condition.
31
26
 
32
27
  ## Allowed & forbidden (fixed lists — no interpretation)
33
28
 
34
- **Allowed changes in a phase:**
35
- - The phase's own tasks (from `TASKS.md`, or the SPEC for single-pass/fix)
36
- - Tests for the behavior this phase adds or alters
37
- - The per-phase doc updates listed in the completion gate below
29
+ **Allowed changes in a step:**
30
+ - The step's own tasks (from the unit doc's `Tasks` section)
31
+ - Tests for the behavior this step adds or alters
32
+ - The per-step doc updates listed in the step completion gate below
38
33
  - The smallest refactor strictly required to land a task (state why in the commit)
39
34
  - An `Autofix` or `Opportunistic Fix` that passes every box in the
40
35
  *Opportunistic finding policy* below
41
36
 
42
37
  **Forbidden — never, even if it "would help":**
43
- - New abstractions beyond what the SPEC names (an interface with one
44
- implementation is a violation)
45
- - New dependencies not justified in the SPEC
46
- - Public API / contract changes the SPEC doesn't name
38
+ - New abstractions beyond what the unit doc's Acceptance criteria name
39
+ - New dependencies not justified in the unit doc
40
+ - Public API / contract changes the unit doc doesn't name
47
41
  - Architecture changes (layers, boundaries, patterns)
48
42
  - Refactoring unrelated code
49
- - Building future phases or features early
43
+ - Building future steps or features early
50
44
  - Folding a discovered finding into the branch before it passes the
51
45
  *Opportunistic finding policy*
52
- - Creating an issue that descopes a SPEC acceptance criterion or phase task
53
- without a user-approved, dated `## Amendments` entry (see *Descope guard*
54
- under *Issue policy* below) — an issue may never be the first record of a
55
- descope
46
+ - Creating an issue that descopes an acceptance criterion without explicit user
47
+ approval and a dated `## References` entry (see *Descope guard* below)
48
+ — an issue may never be the first record of a descope
56
49
 
57
50
  Something forbidden looks necessary → stop, record it in `decisions.md` or
58
51
  `known-issues.md`, and surface it — never do it silently.
59
52
 
60
- ## Gate-run mark
53
+ ## Step completion gate
61
54
 
62
- The phase completion gate records a `GATE-RAN` mark at the head it ran and
63
- consumes an identical-head green mark instead of re-running. The mark's shape,
64
- ownership, and reuse rule are declared in `LEDGERS.md` (§gate-ran@1).
55
+ The step completion gate verifies that Evidence rows are complete for the
56
+ step's acceptance criteria, the unit doc is committed clean, and the diff guard
57
+ (if applicable) passed. The mark's shape, ownership, and reuse rule are
58
+ declared in `LEDGERS.md` (§gate-ran@1).
65
59
 
66
- ```text
60
+ ```
67
61
  GATE-RAN | HEAD <40-hex sha> | <cmds> | exit <code>
68
62
  ```
69
63
 
70
- - **Record**: whoever runs the project gate records a mark at the head the gate
71
- actually ran. A green run is recorded; a red run is also recorded (exit code
72
- ≠ 0 is evidence, not silence).
73
- - **Consume**: any skill may consume a green run only at the identical HEAD. A
74
- changed head ⇒ re-run the gate.
75
- - **Recorder column-sets**: `execute-phase:gate-ran-marks` (executor phase gates)
76
- and `review-change:review-gate-ran-marks` (reviewer gate runs) are declared in
77
- the `review-findings` truth-class row's owner cell.
64
+ - **Record**: whoever runs the gate records a mark at the head the gate
65
+ actually ran (green or red). A red run (exit code ≠ 0) is recorded as
66
+ evidence, not silence.
67
+ - **Consume**: any skill may consume a green run only at the identical HEAD.
68
+ A changed head ⇒ re-run the gate.
69
+ - **Recorder column-sets**: `execute-phase:gate-ran-marks` (executor steps)
70
+ and `review-change:review-gate-ran-marks` (reviewer steps) are declared in
71
+ the Evidence truth-class row's owner cell.
78
72
 
79
- ## Phase completion gate — pass only if (every box, every phase)
73
+ ## Step completion gate — pass only if (every box, every step)
80
74
 
81
75
  ```
82
76
  ✓ Verification gate green — type-check + tests + build actually RUN (paste exit
83
77
  status), never assumed
84
- ✓ Every task of this phase checked off in TASKS.md, each mapped to evidence
85
- (code path or test name)
86
- ✓ Tests updated/added for every behavior this phase changed
78
+ ✓ Every task of this step checked off in the unit doc's `Tasks` section, each
79
+ mapped to an Evidence row (code path or test name)
80
+ ✓ Tests updated/added for every behavior this step changed
81
+ ✓ Tests-first red run recorded (core/domain + orchestration steps, n/a for
82
+ test-after UI/adapter steps) — the failing first run's command, exit status,
83
+ and failing test names are in the unit doc's `Progress` log
87
84
  ✓ No TODO/FIXME/HACK markers left in the diff
88
85
  ✓ No duplicated logic (reuse the existing helper — cite it if one existed)
89
86
  ✓ No dead code introduced (unused imports, functions, unreachable branches)
@@ -91,30 +88,23 @@ GATE-RAN | HEAD <40-hex sha> | <cmds> | exit <code>
91
88
  consumers)
92
89
  ✓ Architecture doc respected (dependency directions, layer boundaries)
93
90
  ✓ Architectural invariants preserved or backed by an explicit recorded decision
94
- ✓ Docs updated — at minimum verify each of: TASKS.md (checkboxes),
95
- progress.md (one handoff entry in the fixed schema — Done / Remains /
96
- Gotchas / Files / Next), testing.md, known-issues.md, decisions.md (if any
97
- decision was taken), SPEC.md (only if scope/acceptance changed — with the
98
- change logged), docs/CAPABILITIES.md (only if this phase introduced a new
99
- cross-cutting subsystem, role, or permission — append the row, additive,
100
- never rewrite existing ones; explicitly n/a when the project has no
101
- inventory file)
102
- ✓ Docs COMMITTED with the phase — after the phase commit,
103
- `git status --porcelain -- docs/` returns nothing. Doc updates ride the
104
- phase commit (same `git add`), never sit uncommitted "for later"
91
+ ✓ Evidence rows complete for the step's ACs — unit doc committed clean
92
+ (one dated `YYYY-MM-DD HH:MM` Progress entry, all Evidence rows current)
93
+ ✓ Docs COMMITTED with the step — the unit doc carries all required sections
94
+ (Tasks, Evidence, Progress, References); no orphan files remain
105
95
  ```
106
96
 
107
- A phase that cannot tick every box is **not done**: fix within the phase's
108
- scope, or record the blocker in `known-issues.md`, leave the work uncommitted,
109
- and stop with a clear report. Never commit red; never tick a box you didn't
110
- verify.
97
+ A step that cannot tick every box is **not done**: fix within the step's
98
+ scope, or record the blocker in the unit doc's `Progress` log, leave the
99
+ work uncommitted, and stop with a clear report. Never commit red; never tick
100
+ a box you didn't verify.
111
101
 
112
102
  ## Branch
113
103
 
114
104
  | Mode | Format |
115
105
  |------|--------|
116
- | feature / single-pass | `feat/<NN>-<slug>` |
117
- | `--fix` | `fix/<issue-number>-<topic>` |
106
+ | unit step | `feat/<NN-slug>` |
107
+ | fix unit | `fix/<issue-number>-<topic>` |
118
108
 
119
109
  Read the SPEC's `Branch` field; create with `git switch -c <name>`. If absent/ambiguous, ask. Never commit, amend, or force-push on `main`.
120
110
 
@@ -133,6 +123,8 @@ planned work, and inference never prove implementation. A present ledger whose
133
123
  status is `draft`, `contradicted`, or `resolved` stops implementation and routes
134
124
  to discovery or resolution first. If no ledger exists, inspect the repository
135
125
  directly and record `n/a: no normalized repository state`; NRS is optional.
126
+ Unit doc evidence rows (Evidence, Progress) are the single source of truth
127
+ for step completion — no separate ACCEPTANCE.md, progress.md, or TASKS.md.
136
128
 
137
129
  ## Architectural invariants
138
130
 
@@ -140,7 +132,7 @@ Before any edit, discover the optional project invariant document declared in
140
132
  the documentation map (normally
141
133
  `docs/architecture/ARCHITECTURAL_INVARIANTS.md`). If absent, record
142
134
  `n/a: no project invariants declared` and continue. For every applicable rule,
143
- cite its ID and repository evidence and classify the phase as `preserves`,
135
+ cite its ID and repository evidence and classify the step as `preserves`,
144
136
  `violates`, `introduces`, or `changes`. Use frozen NRS facts when present, but
145
137
  the repository remains authoritative and conflicting evidence routes to the
146
138
  resolver.
@@ -151,16 +143,16 @@ project's declared authority. A decision record alone is not sufficient: the
151
143
  declared authority must apply the decision to the invariant document, and the
152
144
  resulting rule must be re-evaluated and evidenced as `preserves` before the
153
145
  phase can resume. The executor does not edit the invariant document itself.
154
- Do not alter the SPEC or tests to make the phase pass, and do not convert the
155
- decision into phase work. Return exactly:
146
+ Do not alter the unit doc or tests to make the step pass, and do not convert
147
+ the decision into step work. Return exactly:
156
148
 
157
149
  ```
158
- ARCHITECTURAL INVARIANT GATE — <NN|fix n> <P<k>|single-pass> BLOCKED
150
+ ARCHITECTURAL INVARIANT GATE — <NN-slug> <P<k>> BLOCKED
159
151
  Invariant: <ID> — <violates|introduces|changes>
160
152
  Evidence: <repository path:line or command result>
161
153
  Decision required: <project-declared architectural authority>
162
154
 
163
- → Next: <decision path> — record the explicit architectural decision, then re-run this phase
155
+ → Next: <decision path> — record the explicit architectural decision, then re-run this step
164
156
  · evidence conflict → /resolve-repository-state — reconcile the frozen fact first
165
157
  · no invariant document → record n/a and continue only when no other rule applies
166
158
  ```
@@ -10,21 +10,20 @@ own turn (e.g. no slash-command menu, or an agent that folds without leaving
10
10
  its current context).
11
11
 
12
12
  When `review-change` findings (fix-now) or `audit-pr` blockers are folded back
13
- into a branch that already has an open PR, the fold is complete **only** when
14
- every step below ran — fixing the code and stopping is the classic way findings
15
- end up "solved" locally but absent from the merged PR:
13
+ into a unit branch that already has an open PR, the fold is complete **only**
14
+ when every step below ran — fixing the code and stopping is the classic way
15
+ findings end up "solved" locally but absent from the merged PR:
16
16
 
17
17
  ```
18
18
  ✓ Fixes implemented (scope: only the routed findings — nothing extra)
19
19
  ✓ Gate RUN and green (exit codes pasted)
20
20
  ✓ Never edit an existing test's expectation to match behaviour — a setup
21
21
  repair keeps assertions at least as strong and never touches expectations
22
- ✓ Per-phase / unit docs updated where the finding touched them
23
- (known-issues.md entry resolved? progress.md notes the fold)
24
- ✓ Each folded finding's row in the unit's `review-findings.md` ledger (if one
25
- exists — the ledger is optional; a unit with no fix-now findings has none)
26
- flipped `folded: no → yes` — the one and only ledger state transition,
27
- `ledger-ownership@1` / `fold-findings:folded-flag` is the sole writer
22
+ ✓ Evidence rows updated where the finding touched them (the finding's row
23
+ in the unit doc's Evidence ledger flipped `folded: no → yes` — the one and
24
+ only state transition, `ledger-ownership@1` / `fold-findings:folded-flag`
25
+ is the sole writer)
26
+ ✓ Progress log advanced with a dated entry noting the fold
28
27
  ✓ `git add` + `git commit` RUN (sha pasted) — e.g.
29
28
  `fix(<scope>): fold review findings — <summary>`
30
29
  ✓ `git push` RUN (PR is open → every commit pushes immediately)
@@ -35,48 +34,36 @@ Then hand back to the gate that sent you (`/review-change` re-review, or
35
34
  `/audit-pr` re-audit). Never report findings as resolved while any box is
36
35
  unchecked — an unpushed fix does not exist for CI, the reviewer, or the merge.
37
36
 
38
- ## Gate-run mark (P4)
39
-
40
- A `GATE-RAN` mark is appended to the unit's `review-findings.md` ledger at the
41
- head the gate actually ran. The mark's shape and ownership rule are declared in
42
- `LEDGERS.md` (§gate-ran@1). A green run is recorded; a red run is also recorded.
43
- The identical-head reuse rule is documented in `EXECUTION_CONTRACT.md` (§gate-ran).
44
-
45
- Final-phase / single-pass / fix hand-off:
37
+ ## Closing recommendation (printed after step or unit complete)
46
38
 
47
39
  ```
48
- <unit> implemented, gate green, marked done.
49
- PR opened: <FULL PR URL — always printed here; not every agent shows open PRs>
50
- Roadmap/fix-index row: done · #<n> (linked and pushed)
51
- → Next: /review-change on the changed HEAD (the mandatory end review)
52
- · REVIEW-FAIL → /fold-findings (only on a REVIEW-FAIL), then re-run /review-change (unresolved findings go to triage/replan)
53
- · clean → /audit-pr (merge gate) → human merges
54
- · findings → fold fix-now into this PR; independent work remains a proposal until user triage; re-review
55
- · docs site declared (documentation map has a `Docs site` block) →
56
- /generate-docs <unit> — document what this unit changed; the generated
57
- pages ride this same PR (commit + push them before the merge gate)
58
- ```
40
+ ✓ Step executed, Evidence rows updated, Progress log advanced
41
+ ✓ Gate green (or red-gate repaired within --max-attempts)
42
+ ✓ Unit doc committed clean
59
43
 
60
- The `/generate-docs` line appears **only** when the project's documentation
61
- map declares a `Docs site` block — never suggest it otherwise (a project
62
- without a docs site has nowhere to publish).
44
+ → Next: /unit-lane <NN-slug> — the conductor continues
45
+ · all steps done → /review-change (mandatory end review)
46
+ · REVIEW-FAIL → /fold-findings repairs them; a fresh /review-change follows the fold
47
+ · merge gate after REVIEW-PASS → /audit-pr
48
+ ```
63
49
 
64
- This never auto-merges. Explicit `P<n>` stops after one phase; omitted-phase
65
- mode gates and commits every remaining phase before the same final review.
50
+ No auto-merge. Explicit `P<k>` stops after one step; omitted-step mode gates
51
+ and commits every remaining step before the same final review.
52
+ ## Gate-run marks (gate-ran@1)
66
53
 
67
- ### Marking done (status semantics)
54
+ Every verification gate this cycle runs records a `GATE-RAN` mark in the unit
55
+ doc's Evidence section at the head it actually ran:
56
+ `GATE-RAN | HEAD <40-hex sha> | <cmds> | exit <code>`. A green run is recorded;
57
+ a red run is also recorded (exit code ≠ 0 is evidence, not silence). Any skill
58
+ may consume a green mark only at the identical HEAD — a changed head re-runs
59
+ the gate. The recorders are `execute-phase:gate-ran-marks` and
60
+ `review-change:review-gate-ran-marks` (the shape and ownership live in
61
+ `pre-execution-review`'s `LEDGERS.md`, §gate-ran@1).
68
62
 
69
- A unit flips to **`done` when its last step runs — opening the PR — even though it
70
- isn't merged yet.** `done` means *built and PR-open*; merge state lives in the forge
71
- (the open/merged PR), not in the status. **A `done` row always carries its PR
72
- reference** — `done · [#<pr>](<pr-url>)` — added right after `gh pr create`
73
- returns the URL (follow-up `docs: link PR #<n>` commit on the same branch);
74
- `done` without a PR link is the tell-tale of an unfinished close-out. The flip is a doc change, so it rides the
75
- PR-bound commit (never a lone commit on the default branch). **Never merge with docs
76
- still pending, and never drop the issue / fix-index entry before merge** — those are
77
- `audit-pr`'s gates, not removed at done-time.
63
+ ## Finishing the unit — the last step is always an open PR
78
64
 
79
- **One phase = one worker context when available.** Whole-unit mode is one user
80
- invocation, not one growing raw context: subagent/headless hosts use a fresh
81
- worker per phase; inline-only hosts reduce state to compact receipts. Explicit
82
- phase invocation remains the strict fresh-conversation fallback.
65
+ When the final triaged step closes: mark the unit done, push the branch, and
66
+ open the PR with `gh pr create` (per the project's Workflow conventions) —
67
+ regardless of the review still to come. The PR body carries the unit doc's
68
+ Evidence section as its verification record and closes the unit's tracked
69
+ issues via `Closes #N`.