@linimin/pi-letscook 0.1.67 → 0.1.69

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/.agent/README.md CHANGED
@@ -13,8 +13,7 @@ This repository uses the `completion` workflow for long-running coding tasks.
13
13
  ## Ignored canonical execution state
14
14
 
15
15
  - `.agent/state.json`
16
- - `.agent/startup-plan.json`
17
- - `.agent/startup-plan.md`
16
+ - `.agent/startup-brief.json`
18
17
  - `.agent/plan.json`
19
18
  - `.agent/active-slice.json`
20
19
  - `.agent/slice-history.jsonl`
@@ -23,7 +22,7 @@ This repository uses the `completion` workflow for long-running coding tasks.
23
22
  - `.agent/*.log`
24
23
  - `.agent/tmp/`
25
24
 
26
- `.agent/startup-plan.json` plus `.agent/startup-plan.md` preserve the approved workflow startup plan captured at `/cook`. `completion-regrounder` consumes that plan as planning input, then derives canonical slices in `.agent/plan.json` from current repo truth.
25
+ `.agent/startup-brief.json` preserves the confirmed `/cook` startup intent as canonical intake for re-grounding. It does not replace `.agent/plan.json` or `.agent/active-slice.json`, which remain under regrounder authority.
27
26
 
28
27
  `.agent/verification-evidence.json` is the durable canonical record of deterministic verification for the selected slice or current HEAD. Recovery, review, audit, and stop-check reminder surfaces consume it instead of temp-only artifacts or conversational summaries when it is populated.
29
28
 
@@ -82,23 +82,16 @@ function trackedDiffFiles(fromCommit, toCommit) {
82
82
 
83
83
  const profile = readJson('.agent/profile.json');
84
84
  const state = readJson('.agent/state.json');
85
- const startupPlan = readJson('.agent/startup-plan.json');
85
+ const startupBrief = fs.existsSync('.agent/startup-brief.json') ? readJson('.agent/startup-brief.json') : undefined;
86
86
  const plan = readJson('.agent/plan.json');
87
87
  const active = readJson('.agent/active-slice.json');
88
88
  const evidence = readJson('.agent/verification-evidence.json');
89
- let startupPlanMarkdown = '';
90
- try {
91
- startupPlanMarkdown = fs.readFileSync('.agent/startup-plan.md', 'utf8');
92
- } catch (error) {
93
- fail('.agent/startup-plan.md must be present and readable: ' + error.message);
94
- }
95
89
 
96
90
  ensureTrackedContractFiles();
97
91
 
98
92
  for (const [file, record] of [
99
93
  ['.agent/profile.json', profile],
100
94
  ['.agent/state.json', state],
101
- ['.agent/startup-plan.json', startupPlan],
102
95
  ['.agent/plan.json', plan],
103
96
  ['.agent/active-slice.json', active],
104
97
  ]) {
@@ -109,42 +102,36 @@ for (const [file, record] of [
109
102
  const taskType = asString(profile.task_type);
110
103
  const evaluationProfile = asString(profile.evaluation_profile);
111
104
  if (asString(state.task_type) !== taskType) fail('.agent/state.json task_type must match .agent/profile.json task_type');
112
- if (asString(startupPlan.task_type) !== taskType) fail('.agent/startup-plan.json task_type must match .agent/profile.json task_type');
113
105
  if (asString(plan.task_type) !== taskType) fail('.agent/plan.json task_type must match .agent/profile.json task_type');
114
106
  if (asString(active.task_type) !== taskType) fail('.agent/active-slice.json task_type must match .agent/profile.json task_type');
115
107
  if (asString(state.evaluation_profile) !== evaluationProfile) fail('.agent/state.json evaluation_profile must match .agent/profile.json evaluation_profile');
116
- if (asString(startupPlan.evaluation_profile) !== evaluationProfile) fail('.agent/startup-plan.json evaluation_profile must match .agent/profile.json evaluation_profile');
117
108
  if (asString(plan.evaluation_profile) !== evaluationProfile) fail('.agent/plan.json evaluation_profile must match .agent/profile.json evaluation_profile');
118
109
  if (asString(active.evaluation_profile) !== evaluationProfile) fail('.agent/active-slice.json evaluation_profile must match .agent/profile.json evaluation_profile');
119
110
 
120
- if (asString(startupPlan.artifact_type) !== 'completion-startup-plan') {
121
- fail('.agent/startup-plan.json artifact_type must be completion-startup-plan');
122
- }
123
- if (asString(startupPlan.status) !== 'approved') {
124
- fail('.agent/startup-plan.json status must be approved');
125
- }
126
- const startupPlanMissionAnchor = asString(startupPlan.mission_anchor);
127
- if (!startupPlanMissionAnchor) fail('.agent/startup-plan.json mission_anchor must be present');
128
- if (startupPlanMissionAnchor !== asString(state.mission_anchor)) fail('.agent/startup-plan.json mission_anchor must match .agent/state.json mission_anchor');
129
- if (startupPlanMissionAnchor !== asString(plan.mission_anchor)) fail('.agent/startup-plan.json mission_anchor must match .agent/plan.json mission_anchor');
130
- if (startupPlanMissionAnchor !== asString(active.mission_anchor)) fail('.agent/startup-plan.json mission_anchor must match .agent/active-slice.json mission_anchor');
131
- if (!asString(startupPlan.goal_text)) fail('.agent/startup-plan.json goal_text must be present');
132
- for (const field of ['scope', 'constraints', 'acceptance', 'risks', 'notes', 'planned_surfaces', 'verification_intent', 'sequencing_hints']) {
133
- if (!Array.isArray(startupPlan[field])) fail('.agent/startup-plan.json is missing ' + field);
134
- }
135
- if (startupPlanMarkdown.trim().length === 0) fail('.agent/startup-plan.md must not be empty');
136
- if (startupPlanMissionAnchor && !startupPlanMarkdown.includes(startupPlanMissionAnchor)) {
137
- fail('.agent/startup-plan.md must mention the startup-plan mission_anchor');
138
- }
139
- const startupPlanGoalText = asString(startupPlan.goal_text);
140
- if (startupPlanGoalText && !startupPlanMarkdown.includes(startupPlanGoalText)) {
141
- fail('.agent/startup-plan.md must render the startup-plan goal_text');
142
- }
143
-
144
111
  if (asString(evidence.artifact_type) !== 'completion-verification-evidence') {
145
112
  fail('.agent/verification-evidence.json artifact_type must be completion-verification-evidence');
146
113
  }
147
114
 
115
+ const workflowEntryStatus = asString(state.workflow_entry_status);
116
+ if (workflowEntryStatus === 'active' || startupBrief) {
117
+ if (!startupBrief) fail('.agent/startup-brief.json must exist when workflow entry is active');
118
+ if (asString(startupBrief.artifact_type) !== 'completion-startup-brief') {
119
+ fail('.agent/startup-brief.json artifact_type must be completion-startup-brief');
120
+ }
121
+ if (!asString(state.workflow_session_id)) {
122
+ fail('.agent/state.json workflow_session_id must be present when workflow entry is active');
123
+ }
124
+ if (asString(startupBrief.mission) !== asString(state.mission_anchor)) {
125
+ fail('.agent/startup-brief.json mission must match .agent/state.json mission_anchor');
126
+ }
127
+ if (asString(startupBrief.task_type) !== taskType) {
128
+ fail('.agent/startup-brief.json task_type must match .agent/profile.json task_type');
129
+ }
130
+ if (asString(startupBrief.evaluation_profile) !== evaluationProfile) {
131
+ fail('.agent/startup-brief.json evaluation_profile must match .agent/profile.json evaluation_profile');
132
+ }
133
+ }
134
+
148
135
  const exactStatuses = new Set(['selected', 'in_progress', 'committed', 'done']);
149
136
  const activeStatus = asString(active.status);
150
137
  const exactHandoff = exactStatuses.has(activeStatus || '');
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.69
4
+
5
+ ### Changed
6
+
7
+ - preserved the confirmed `/cook` startup intent in canonical `.agent/startup-brief.json` so workflow entry is durable before regrounding authors canonical slices
8
+ - moved workflow-session legitimacy away from in-memory routing activation and legacy `/skill:completion-protocol` prompt dependence toward canonical workflow-session state plus explicit `/cook` entry turns
9
+ - simplified completion-driver continuation bookkeeping so explicit `/cook` kickoff/resume no longer rely on transient in-flight markers while auto-resume keeps only minimal duplicate-suppression state
10
+ - updated smoke coverage, verifier expectations, and shipped docs/skills to describe canonical startup-brief intake plus active `/cook` workflow sessions truthfully
11
+
12
+ ## 0.1.68
13
+
14
+ ### Changed
15
+
16
+ - simplified `/cook` startup sourcing so workflow proposals now come only from same-entry primary-agent startup-plan synthesis
17
+ - stopped `/cook` from directly adopting old preview capsules or falling back to transcript-derived startup proposals
18
+ - kept preview capsules advisory-only for humans while active-workflow replacement and next-round startup now depend on same-entry primary-agent synthesis from current task context
19
+
3
20
  ## 0.1.67
4
21
 
5
22
  ### Changed
package/README.md CHANGED
@@ -34,9 +34,8 @@ Then run `/reload` in Pi.
34
34
  2. Run `/reload` in Pi.
35
35
  3. In the main chat, either implement directly with the agent or refine the concrete repo change you want.
36
36
  4. When you want workflow mode, run `/cook`.
37
- 5. Review the startup plan and choose **Start** or **Cancel**.
38
- 6. After **Start**, `/cook` records the approved startup plan under `.agent/` and hands the workflow to `completion-regrounder` to split canonical slices.
39
- 7. Later, run `/cook` again to resume from canonical state or confirm a replacement or next-round startup plan.
37
+ 5. Review the startup brief and choose **Start** or **Cancel**.
38
+ 6. Later, run `/cook` again to resume from canonical state or confirm a replacement or next-round handoff.
40
39
 
41
40
  ```text
42
41
  /cook
@@ -53,15 +52,16 @@ Then run `/reload` in Pi.
53
52
 
54
53
  ## What `/cook` expects
55
54
 
56
- - enough current task context for a primary-agent startup-plan synthesis step to produce a concrete workflow startup plan
57
- - a mission, scope, acceptance, and verification intent concrete enough for `completion-regrounder` to derive truthful slices after startup
55
+ - enough current task context for a primary-agent handoff synthesis step to produce a concrete workflow startup handoff
56
+ - a mission and first slice concrete enough for the primary-agent handoff step to author a truthful implementation-startable handoff
57
+ - acceptance and verification intent that can support a truthful first workflow round
58
58
  - README/CHANGELOG updates still count as concrete repo changes
59
- - assistant-produced summaries and plan/spec/design-doc/proposal-only artifacts still do not count unless the primary-agent startup-plan step turns them into concrete startup intake for `/cook`
60
- - `/cook` first prefers a fresh explicit `cook_handoff` preview when one already exists, but otherwise calls the primary-agent startup-plan synthesis step in the same `/cook` entry
59
+ - assistant-produced summaries and plan/spec/design-doc/proposal-only artifacts still do not count unless the primary-agent handoff step turns them into a concrete `cook_handoff` capsule
60
+ - `/cook` first prefers a fresh explicit `cook_handoff` capsule when one already exists, but otherwise calls the primary-agent handoff synthesis step in the same `/cook` entry
61
61
 
62
- If the startup-plan step still cannot prepare a concrete startup plan, `/cook` fails closed, leaves canonical `.agent/**` state unchanged, and tells you to refine the mission, scope, acceptance, or verification intent in the main chat before rerunning `/cook`.
62
+ If the primary-agent handoff step still cannot prepare a concrete handoff, `/cook` fails closed, leaves canonical `.agent/**` state unchanged, and tells you to refine the mission, first slice, or verification intent in the main chat before rerunning `/cook`.
63
63
 
64
- If a fresh explicit preview exists but is still workflow-worthy rather than concrete enough to seed workflow planning, `/cook` also fails closed instead of silently treating that capsule as canonical workflow state.
64
+ If a fresh explicit handoff exists but is still workflow-worthy rather than implementation-startable, `/cook` also fails closed instead of silently treating that capsule as planning support or canonical workflow state.
65
65
 
66
66
  If you pass inline arguments to `/cook`, it also fails closed and tells you to move that intent into the main chat before rerunning bare `/cook`.
67
67
 
@@ -69,17 +69,16 @@ If you pass inline arguments to `/cook`, it also fails closed and tells you to m
69
69
 
70
70
  Only explicit `/cook` enters workflow mode. Ordinary prompts stay in the main chat and go straight to the primary agent.
71
71
 
72
- Ordinary chat can still directly implement repo changes. `/cook` is for the cases where you want workflow control rather than just implementation help, and the primary agent should prepare the startup plan before workflow begins.
72
+ Ordinary chat can still directly implement repo changes. `/cook` is for the cases where you want workflow control rather than just implementation help, and the primary agent should prepare the handoff before you run it.
73
73
 
74
- When you explicitly run `/cook`, it first checks for a fresh explicit primary-agent startup-plan preview. If one is missing, it calls a same-entry primary-agent startup-plan synthesis step from the current task context, then asks you to **Start** or **Cancel** before rewriting canonical workflow state.
74
+ When you explicitly run `/cook`, it first checks for a fresh explicit primary-agent handoff. If one is missing, it calls a same-entry primary-agent handoff synthesis step from the current task context, then asks you to **Start** or **Cancel** before rewriting canonical workflow state.
75
75
 
76
- Explicit `/cook` capsules are still valid startup intake, but they are no longer the only path because `/cook` can synthesize the primary-agent startup plan in the same entry when needed.
76
+ Explicit `/cook` capsules are still valid startup intake, but they are no longer the only path because `/cook` can synthesize the primary-agent handoff in the same entry when needed.
77
77
 
78
78
  Important behavior:
79
79
  - `/cook` is an optional workflow boundary and manual entry point
80
- - startup and next-round entry stay confirm-first, using explicit primary-agent startup-plan data when present and otherwise running the primary-agent startup-plan synthesis step in the same `/cook` entry
81
- - after **Start**, `/cook` records the approved startup plan under `.agent/startup-plan.json` / `.agent/startup-plan.md`, then `completion-regrounder` derives canonical slices from repo truth
82
- - active workflows resume from canonical `.agent/**` state unless a concrete replacement startup plan is available or synthesized in the same `/cook` entry
80
+ - startup and next-round entry stay confirm-first, using explicit primary-agent handoff data when present and otherwise running the primary-agent handoff synthesis step in the same `/cook` entry
81
+ - active workflows resume from canonical `.agent/**` state unless a concrete replacement handoff is available or synthesized in the same `/cook` entry
83
82
  - explicit slash commands other than `/cook` continue normally in the main chat
84
83
  - ordinary main-chat discussion may clarify, propose, or directly implement repo changes without entering workflow mode
85
84
 
@@ -95,13 +94,13 @@ I want to add login redirect handling and tests.
95
94
 
96
95
  ## What happens when you run `/cook`
97
96
 
98
- `/cook` first checks for a fresh explicit primary-agent startup-plan preview. New-workflow entry and done-workflow next-round entry use that plan when it already exists; otherwise `/cook` calls a same-entry primary-agent startup-plan synthesis step, then immediately continues to Start / Cancel if the generated plan is concrete enough. After **Start**, the approved startup plan is written into `.agent/startup-plan.json` / `.agent/startup-plan.md`, and `completion-regrounder` uses it to derive canonical slices from current repo truth. Active workflows still resume canonical state by default unless a concrete replacement startup plan is available or synthesized in the same `/cook` entry. None of this prevents ordinary-chat implementation when you choose not to enter workflow mode.
97
+ `/cook` first checks for a fresh explicit primary-agent handoff capsule. New-workflow entry and done-workflow next-round entry use that handoff when it already exists; otherwise `/cook` calls a same-entry primary-agent handoff synthesis step, then immediately continues to Start / Cancel if the generated handoff is concrete enough. Active workflows still resume canonical state by default unless a concrete replacement handoff is available or synthesized in the same `/cook` entry. None of this prevents ordinary-chat implementation when you choose not to enter workflow mode.
99
98
 
100
99
  | Repo state | What you'll see |
101
100
  |---|---|
102
- | No workflow yet | `/cook` consumes a fresh explicit primary-agent startup-plan preview when one already exists, or synthesizes one from the primary-agent view in the same entry, then asks you to choose **Start** or **Cancel**. After **Start**, the approved startup plan is persisted under `.agent/` and `completion-regrounder` derives canonical slices. Stale, planning-only, or non-startable startup plans still fail closed. |
103
- | Active workflow exists | Usually a resume of the current workflow from canonical `.agent/**` state. If a concrete replacement startup plan exists already or is synthesized in the same `/cook` entry and points to a different mission, `/cook` shows a chooser first and only rewrites canonical state after you confirm the replacement. Ambiguous or missing replacement startup plans stay conservative. |
104
- | Previous workflow is `done` | `/cook` can start the next implementation round from a fresh explicit primary-agent startup plan or from the same-entry primary-agent startup-plan synthesis step behind **Start** or **Cancel**. Weak or planning-only next-round startup plans still fail closed. |
101
+ | No workflow yet | `/cook` consumes a fresh explicit primary-agent handoff when one already exists, or synthesizes one from the primary-agent view in the same entry, then asks you to choose **Start** or **Cancel**. Stale, planning-only, or non-startable handoffs still fail closed. |
102
+ | Active workflow exists | Usually a resume of the current workflow from canonical `.agent/**` state. If a concrete replacement handoff exists already or is synthesized in the same `/cook` entry and points to a different mission, `/cook` shows a chooser first and only rewrites canonical state after you confirm the replacement. Ambiguous or missing replacement handoff stays conservative. |
103
+ | Previous workflow is `done` | `/cook` can start the next implementation round from a fresh explicit primary-agent handoff or from the same-entry primary-agent handoff synthesis step behind **Start** or **Cancel**. Weak or planning-only next-round handoffs still fail closed. |
105
104
 
106
105
  ## Confirmation and fail-closed behavior
107
106
 
@@ -115,9 +114,9 @@ I want to add login redirect handling and tests.
115
114
 
116
115
  When you accept startup or refocus, `/cook` persists the chosen workflow state in canonical `.agent/**` files before the re-ground round begins.
117
116
 
118
- The confirmed startup plan is preserved under `.agent/startup-plan.json` / `.agent/startup-plan.md` and summarized in `state.json` as advisory intake for later re-grounding. It does not replace `.agent/plan.json` or `.agent/active-slice.json`, which remain under regrounder authority.
117
+ The confirmed startup brief is also preserved there in `.agent/startup-brief.json` as canonical intake for later re-grounding. It does not replace `.agent/plan.json` or `.agent/active-slice.json`, which remain under regrounder authority.
119
118
 
120
- The pre-`/cook` preview capsule itself is not canonical workflow state. It is only startup intake for `/cook`.
119
+ The pre-`/cook` handoff capsule itself is not canonical workflow state. It is only startup intake for `/cook`.
121
120
 
122
121
  ## Observability
123
122
 
@@ -203,8 +202,7 @@ This package stores canonical workflow state under:
203
202
  verify_completion_stop.sh
204
203
  verify_completion_control_plane.sh
205
204
  state.json
206
- startup-plan.json
207
- startup-plan.md
205
+ startup-brief.json
208
206
  plan.json
209
207
  active-slice.json
210
208
  slice-history.jsonl
@@ -231,8 +229,7 @@ Tracked repo-contract files:
231
229
  Ignored execution-state files:
232
230
 
233
231
  - `.agent/state.json`
234
- - `.agent/startup-plan.json`
235
- - `.agent/startup-plan.md`
232
+ - `.agent/startup-brief.json`
236
233
  - `.agent/plan.json`
237
234
  - `.agent/active-slice.json`
238
235
  - `.agent/slice-history.jsonl`
@@ -244,7 +241,7 @@ Ignored execution-state files:
244
241
  In short:
245
242
 
246
243
  - tracked `.agent` files define the repo-level workflow contract
247
- - ignored `.agent` files are the local control-plane state for the current run, including the approved startup plan captured at `/cook`
244
+ - ignored `.agent` files are the local control-plane state for the current run
248
245
 
249
246
  ## Package layout
250
247
 
@@ -14,7 +14,6 @@ You are an onboarding-only control-plane role. You may:
14
14
  - create or repair tracked completion contract files under `.agent/**`
15
15
  - update `.gitignore` so tracked contract files remain tracked while execution artifacts remain ignored
16
16
  - initialize missing or invalid canonical execution-state files only when repair is required for a truthful handoff
17
- - preserve any approved startup plan already recorded in `.agent/startup-plan.json`
18
17
  - return the exact handoff payload for `completion-regrounder`
19
18
 
20
19
  You must not:
@@ -41,7 +40,7 @@ These lines are for workflow observability, not hidden reasoning. Keep them brie
41
40
  3. If repo intent or validation entrypoint is ambiguous, ask one short clarifying question.
42
41
  4. Create or repair `.agent/README.md`, `.agent/mission.md`, `.agent/profile.json`, `.agent/verify_completion_stop.sh`, and `.agent/verify_completion_control_plane.sh`, keeping them truthful to current repo reality.
43
42
  5. Update `.gitignore` so `.agent/*` remains ignored except the tracked repo-contract files, and keep `.agent/tmp/` ignored as scratch space.
44
- 6. Initialize `.agent/state.json`, `.agent/startup-plan.json`, `.agent/startup-plan.md`, `.agent/plan.json`, and `.agent/active-slice.json` only when they are missing, unreadable, or structurally invalid. Preserve any existing truthful execution state.
43
+ 6. Initialize `.agent/state.json`, `.agent/plan.json`, and `.agent/active-slice.json` only when they are missing, unreadable, or structurally invalid. Preserve any existing truthful execution state.
45
44
  7. Stop after canonical bootstrap or repair is truthful and return the handoff to `completion-regrounder`.
46
45
 
47
46
  Return exactly this fixed report format:
@@ -12,7 +12,6 @@ You are the canonical reconciliation role. You may:
12
12
 
13
13
  - read current repo truth and canonical `.agent` state
14
14
  - write canonical `.agent` state and `.gitignore`
15
- - read the approved startup plan in `.agent/startup-plan.json` and `.agent/startup-plan.md`
16
15
  - rebuild or reconcile `.agent/plan.json`
17
16
  - confirm or update `.agent/active-slice.json` and `.agent/state.json`
18
17
  - reopen slices whose acceptance criteria no longer hold
@@ -37,30 +36,25 @@ These lines are for workflow observability, not hidden reasoning. Keep them brie
37
36
 
38
37
  1. Read canonical `.agent` inputs before changing canonical state.
39
38
  2. Read current git status, recent git history, and repo surfaces relevant to the locked or remaining contract IDs.
40
- 3. Read `.agent/startup-plan.json` / `.agent/startup-plan.md` and extract the approved mission, scope, acceptance, risks, planned surfaces, verification intent, and any sequencing hints.
41
- 4. Treat that startup plan as planning input only, then derive the smallest truthful canonical slices from current repo truth instead of copying startup-plan structure blindly into `.agent/plan.json`.
42
- 5. If current repo truth contradicts, narrows, or broadens the approved startup plan, preserve the startup-plan record as historical intake, explain the deviation explicitly, and reconcile `.agent/plan.json` / `.agent/state.json` to the newer truth.
43
- 6. Emit an explicit startup-plan reconciliation outcome in your report so the workflow driver can see whether canonical slices adopted the startup plan as-is or deviated from it.
44
- 7. Revalidate every slice's `acceptance_criteria` against current repo truth and update `status` plus `evidence` accordingly.
45
- 8. Reopen any previously `done` slice whose acceptance criteria no longer hold.
46
- 9. Keep `.agent/state.json` and `.agent/active-slice.json` truthful, including `current_phase`, `continuation_policy`, `continuation_reason`, `next_mandatory_role`, and any exact implementer handoff snapshot fields.
47
- 10. Reconcile canonical state after review, audit, and final stop verification waves when required.
48
- 11. If the latest committed slice leaves the tracked and unignored worktree dirty, treat that dirty state as a blocker, reopen or continue that latest slice for reconciliation, set `Next role to invoke` to `completion-implementer`, and do not select or hand off any different next slice until it is reconciled.
49
- 12. When reconciling after review, audit, or dirty-worktree follow-up for the latest committed slice, emit an explicit reconciliation record decision:
39
+ 3. Reconcile `.agent/plan.json` against current repo truth.
40
+ 4. Revalidate every slice's `acceptance_criteria` against current repo truth and update `status` plus `evidence` accordingly.
41
+ 5. Reopen any previously `done` slice whose acceptance criteria no longer hold.
42
+ 6. Keep `.agent/state.json` and `.agent/active-slice.json` truthful, including `current_phase`, `continuation_policy`, `continuation_reason`, `next_mandatory_role`, and any exact implementer handoff snapshot fields.
43
+ 7. Reconcile canonical state after review, audit, and final stop verification waves when required.
44
+ 8. If the latest committed slice leaves the tracked and unignored worktree dirty, treat that dirty state as a blocker, reopen or continue that latest slice for reconciliation, set `Next role to invoke` to `completion-implementer`, and do not select or hand off any different next slice until it is reconciled.
45
+ 9. When reconciling after review, audit, or dirty-worktree follow-up for the latest committed slice, emit an explicit reconciliation record decision:
50
46
  - `accepted` only when the latest committed slice is truthfully accepted as-is
51
47
  - `reopened` only when the latest committed slice must be reopened for follow-up work
52
48
  - `none` when this re-ground was not a post-commit reconciliation decision
53
- 13. If you emit `accepted` or `reopened`, also emit the exact reconciled slice id in the report.
54
- 14. If a slice is already selected, ensure `.agent/active-slice.json` contains the exact implementer handoff snapshot and return that exact handoff payload for `completion-implementer` instead of implementing it yourself.
55
- 15. If no slice is selected, return the exact next recommended slice and why.
49
+ 10. If you emit `accepted` or `reopened`, also emit the exact reconciled slice id in the report.
50
+ 11. If a slice is already selected, ensure `.agent/active-slice.json` contains the exact implementer handoff snapshot and return that exact handoff payload for `completion-implementer` instead of implementing it yourself.
51
+ 12. If no slice is selected, return the exact next recommended slice and why.
56
52
 
57
53
  Output format:
58
54
 
59
55
  - `MISSION ANCHOR: ...`
60
56
  - `Remaining contract IDs: ...`
61
57
  - `Canonical re-ground applied: yes/no - ...`
62
- - `Startup plan adopted as-is: yes/no - ...`
63
- - `Startup-plan deviations from repo truth: ...`
64
58
  - `Acceptance criteria revalidated: yes/no - ...`
65
59
  - `Tracked and unignored worktree is clean: yes/no`
66
60
  - `Reopened slices: ...`