@linimin/pi-letscook 0.1.67 → 0.1.68

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.
@@ -16,17 +16,17 @@ from pathlib import Path
16
16
  checks = {
17
17
  "README.md": [
18
18
  "You can still implement directly in ordinary chat when you do not need workflow state.",
19
- "When you explicitly run `/cook`, it first checks for a fresh explicit primary-agent startup-plan preview.",
19
+ "When you explicitly run `/cook`, it always 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.",
20
20
  "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.",
21
- "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.",
21
+ "Optional preview capsules in ordinary chat are advisory only. `/cook` does not directly consume them as approval-ready workflow state; it synthesizes a fresh startup plan in the `/cook` entry.",
22
22
  ],
23
23
  "CHANGELOG.md": [
24
- "rewrote `/cook` startup around an approved startup plan that is captured under `.agent/startup-plan.json` / `.agent/startup-plan.md` after Start instead of leaving startup intent only as advisory intake in `state.json`",
25
- "kept `/cook` confirm-first while handing the approved startup plan to `completion-regrounder`, which now derives canonical slices from repo truth instead of treating startup intake like an implementation-ready first-slice contract",
24
+ "simplified `/cook` startup sourcing so workflow proposals now come only from same-entry primary-agent startup-plan synthesis",
25
+ "stopped `/cook` from directly adopting old preview capsules or falling back to transcript-derived startup proposals",
26
26
  ],
27
27
  "extensions/completion/prompt-surfaces.ts": [
28
28
  '"If the user explicitly runs /cook, the extension should call a primary-agent startup-plan synthesis step from the current task context, show Start/Cancel confirmation in the same /cook entry, and only write the approved plan into .agent after Start."',
29
- '"When /cook starts, the approved startup plan should be written into .agent and then handed to completion-regrounder so canonical slices can be derived from repo truth."',
29
+ '"Do not expect /cook to infer or guess startup intent from recent discussion alone, and do not expect /cook to directly reuse an old preview capsule; /cook should always synthesize the startup plan fresh in the same entry from current task context."',
30
30
  '"In ordinary chat, do not load or follow completion-protocol, and do not call completion_role."',
31
31
  ],
32
32
  "extensions/completion/index.ts": [
@@ -40,6 +40,7 @@ checks = {
40
40
  "skills/cook-handoff-boundary/SKILL.md": [
41
41
  '- load or follow `completion-protocol` while still in ordinary chat',
42
42
  '- call `completion_role` before the user has explicitly entered `/cook`',
43
+ '- `/cook` should always synthesize the startup plan fresh in the same entry from current task context',
43
44
  ],
44
45
  "skills/completion-protocol/SKILL.md": [
45
46
  'Load this skill only after the user explicitly enters `/cook` and you are operating inside the `completion` workflow as the workflow driver or a completion role.',
@@ -51,6 +52,7 @@ forbidden = {
51
52
  "README.md": [
52
53
  "asks the primary agent to prepare one in the main chat and leaves canonical state unchanged until you rerun /cook",
53
54
  "Explicit `/cook` capsules are the required startup intake for new-workflow, next-round, and replacement entry.",
55
+ "When you explicitly run `/cook`, it first checks for a fresh explicit primary-agent startup-plan preview.",
54
56
  ],
55
57
  "extensions/completion/prompt-surfaces.ts": [
56
58
  '"If the user explicitly asks to enter /cook workflow, generate one fresh ```cook_handoff``` capsule in ordinary chat from the primary-agent view of the task, then tell the user to run /cook."',
@@ -30,9 +30,9 @@ assertIncludes('extensions/completion/role-runner.ts', 'const transcription = ex
30
30
  assertIncludes('extensions/completion/role-runner.ts', 'env: { ...process.env, PI_COMPLETION_ROLE: params.role },');
31
31
  assertIncludes('extensions/completion/role-runner.ts', 'async function runContextProposalAnalystSubprocess(');
32
32
  assertIncludes('extensions/completion/role-runner.ts', 'export async function analyzeContextProposalWithAgent(');
33
- assertIncludes('extensions/completion/index.ts', 'import { analyzeContextProposalWithAgent, runCompletionRole } from "./role-runner";');
33
+ assertIncludes('extensions/completion/index.ts', 'import { runCompletionRole } from "./role-runner";');
34
34
  assertIncludes('extensions/completion/index.ts', 'const result = await runCompletionRole({');
35
- assertIncludes('extensions/completion/index.ts', 'await analyzeContextProposalWithAgent({');
35
+ assertNotIncludes('extensions/completion/index.ts', 'analyzeContextProposalWithAgent');
36
36
  assertNotIncludes('extensions/completion/index.ts', 'const systemPromptTemp = await writeTempFile(runCwd, "pi-cook-proposal-analyst-", CONTEXT_PROPOSAL_ANALYST_SYSTEM_PROMPT);');
37
37
  assertNotIncludes('extensions/completion/index.ts', 'const invocation = getPiInvocation(args);');
38
38
  assertNotIncludes('extensions/completion/index.ts', 'async function loadAgentDefinition(');
@@ -103,13 +103,12 @@ INLINE_REJECTION_ROUTING_SNAPSHOT="$TMPDIR/inline-arg-routing.json"
103
103
  INLINE_REJECTION_PROPOSAL_SNAPSHOT="$TMPDIR/inline-arg-proposal.json"
104
104
  INLINE_REJECTION_CHOOSER_SNAPSHOT="$TMPDIR/inline-arg-chooser.json"
105
105
  BOOTSTRAP_SESSION="$TMPDIR/session-smoke-bootstrap.jsonl"
106
- BOOTSTRAP_MESSAGES="$(python3 - <<'PY'
106
+ BOOTSTRAP_DISCUSSION=$'Please prepare the packaged smoke-test bootstrap path and tell me when it is ready for /cook.'
107
+ GENERATED_HANDOFF="$(python3 - <<'PY'
107
108
  import json
108
109
  capsule = {
109
110
  "kind": "cook_handoff",
110
111
  "source": "primary_agent",
111
- "captured_at": "2026-01-01T00:00:02.000Z",
112
- "source_turn_id": "m0002",
113
112
  "mission": "Exercise smoke-test bootstrap.",
114
113
  "scope": [
115
114
  "Materialize the canonical completion control-plane files.",
@@ -123,7 +122,7 @@ capsule = {
123
122
  "Keep scripts/smoke-test.sh and kickoff-prompt coverage truthful for packaged bootstrap."
124
123
  ],
125
124
  "risks": [
126
- "Smoke-test bootstrap should stay anchored to the fresh explicit startup-plan preview."
125
+ "Smoke-test bootstrap should stay anchored to same-entry primary-agent startup-plan synthesis."
127
126
  ],
128
127
  "notes": [
129
128
  "Keep the smoke fixture aligned with the shipped startup-plan-driven startup contract."
@@ -145,11 +144,7 @@ capsule = {
145
144
  "evaluation_profile": "completion-rubric-v1",
146
145
  "why_cook_now": "The startup plan is concrete enough to bootstrap canonical workflow files."
147
146
  }
148
- messages = [
149
- {"role": "user", "content": "Please prepare the packaged smoke-test bootstrap path and tell me when it is ready for /cook."},
150
- {"role": "assistant", "content": "This bootstrap path is ready for /cook. Run /cook to confirm the startup plan.\n\n```cook_handoff\n" + json.dumps(capsule, ensure_ascii=False, indent=2) + "\n```"},
151
- ]
152
- print(json.dumps(messages, ensure_ascii=False))
147
+ print("```cook_handoff\n" + json.dumps(capsule, ensure_ascii=False, indent=2) + "\n```")
153
148
  PY
154
149
  )"
155
150
 
@@ -180,10 +175,10 @@ assert not chooser.exists(), 'startup /cook inline-args rejection should not ope
180
175
  assert '/cook no longer accepts inline arguments.' in output, 'startup /cook inline-args rejection should explain the bare-only entry contract'
181
176
  PY
182
177
 
183
- write_session_messages "$BOOTSTRAP_SESSION" "$ROOT" "$BOOTSTRAP_MESSAGES"
178
+ write_session "$BOOTSTRAP_SESSION" "$ROOT" "$BOOTSTRAP_DISCUSSION"
184
179
 
185
180
  PI_COMPLETION_CONTEXT_PROPOSAL_ACTION=accept \
186
- PI_COMPLETION_DISABLE_CONTEXT_PROPOSAL_ANALYST=1 \
181
+ PI_COMPLETION_PRIMARY_HANDOFF_OUTPUT="$GENERATED_HANDOFF" \
187
182
  PI_COMPLETION_SKIP_DRIVER_KICKOFF=1 \
188
183
  PI_COMPLETION_TEST_DRIVER_PROMPT_PATH="$KICKOFF_PROMPT" \
189
184
  pi --session "$BOOTSTRAP_SESSION" -e "$PKG_ROOT" -p "/cook" \
@@ -226,13 +221,13 @@ assert active['implementation_surfaces'] == [], 'active-slice.json should scaffo
226
221
  assert active['verification_commands'] == [], 'active-slice.json should scaffold empty verification_commands'
227
222
  brief = state['advisory_startup_brief']
228
223
  assert brief['kind'] == 'startup_brief', 'state.json should preserve the confirmed startup brief as advisory intake'
229
- assert brief['source'] == 'primary_agent_handoff', 'smoke bootstrap should record the explicit handoff source in advisory intake'
224
+ assert brief['source'] == 'deferred_primary_agent_handoff', 'smoke bootstrap should record same-entry primary-agent synthesis in advisory intake'
230
225
  assert brief['mission'] == state['mission_anchor'], 'advisory startup brief mission should match the canonical mission anchor after bootstrap'
231
226
  assert brief['scope'] == ['Materialize the canonical completion control-plane files.', 'Keep the smoke test on supported /cook startup behavior.'], 'advisory startup brief should preserve scope items'
232
227
  assert brief['constraints'] == ['Keep startup proposal confirmation approval-only.'], 'advisory startup brief should preserve constraints'
233
228
  assert startup_plan['artifact_type'] == 'completion-startup-plan', 'startup-plan.json should persist the approved startup plan canonically'
234
229
  assert startup_plan['mission_anchor'] == state['mission_anchor'], 'startup-plan.json mission anchor should match canonical workflow state'
235
- assert startup_plan['source'] == 'primary_agent_handoff', 'startup-plan.json should preserve the primary-agent startup source'
230
+ assert startup_plan['source'] == 'deferred_primary_agent_handoff', 'startup-plan.json should preserve the same-entry primary-agent startup source'
236
231
  assert startup_plan['scope'] == brief['scope'], 'startup-plan.json should preserve approved scope items'
237
232
  assert startup_plan['constraints'] == brief['constraints'], 'startup-plan.json should preserve approved constraints'
238
233
  assert startup_plan['planned_surfaces'] == ['.agent/README.md', 'scripts/smoke-test.sh'], 'startup-plan.json should preserve planned surfaces derived from startup hints'
@@ -243,7 +238,7 @@ assert brief['acceptance'] == [
243
238
  'Scaffold .agent/profile.json, .agent/state.json, .agent/plan.json, .agent/active-slice.json, and .agent/verification-evidence.json for the smoke fixture.',
244
239
  'Keep scripts/smoke-test.sh and kickoff-prompt coverage truthful for packaged bootstrap.'
245
240
  ], 'advisory startup brief should preserve acceptance'
246
- assert brief['risks'] == ['Smoke-test bootstrap should stay anchored to the fresh explicit startup-plan preview.'], 'advisory startup brief should preserve startup-plan risks'
241
+ assert brief['risks'] == ['Smoke-test bootstrap should stay anchored to same-entry primary-agent startup-plan synthesis.'], 'advisory startup brief should preserve startup-plan risks'
247
242
  assert 'First slice goal: Scaffold canonical completion files and verify the packaged startup contract.' in brief['notes'], 'advisory startup brief should preserve the first_slice_goal in notes'
248
243
  assert 'Verification commands: npm run smoke-test' in brief['notes'], 'advisory startup brief should preserve verification_commands in notes'
249
244
  assert evidence['artifact_type'] == 'completion-verification-evidence', 'verification-evidence.json artifact_type mismatch after bootstrap'
@@ -314,10 +309,10 @@ assert f'- task_type: {expected_task_type}' in resume, 'resume prompt missing ca
314
309
  assert f'- evaluation_profile: {expected_eval_profile}' in resume, 'resume prompt missing canonical evaluation_profile'
315
310
  assert routing['mode'] == 'bare', 'active bare /cook should snapshot bare routing mode'
316
311
  assert routing['action'] == 'continue', 'no-discussion active bare /cook should resume from canonical state without a concrete replacement mission'
317
- assert routing['reason'] == 'missing_explicit_handoff', 'no-discussion active bare /cook should explain that resume happened because no fresh explicit handoff existed'
312
+ assert routing['reason'] == 'no_generated_startup_plan', 'no-discussion active bare /cook should explain that resume happened because no synthesized replacement startup plan existed'
318
313
  assert routing['currentMissionAnchor'] == state['mission_anchor'], 'resume routing snapshot should keep the current mission anchor'
319
314
  assert routing['proposedMissionAnchor'] is None, 'no-discussion active bare /cook should not propose a replacement mission'
320
- assert not chooser_path.exists(), 'active bare /cook resume should not open the chooser without a fresh explicit handoff'
315
+ assert not chooser_path.exists(), 'active bare /cook resume should not open the chooser without a synthesized replacement startup plan'
321
316
  PY
322
317
 
323
318
  PI_COMPLETION_SKIP_DRIVER_KICKOFF=1 \
@@ -58,15 +58,15 @@ But even in those cases:
58
58
 
59
59
  If the user explicitly runs or clearly chooses `/cook` workflow mode, the system behavior should be:
60
60
 
61
- 1. check for a fresh explicit primary-agent `cook_handoff` preview when one already exists
62
- 2. if none exists, call a primary-agent startup-plan synthesis step immediately from the current task context
63
- 3. use that startup plan to show Start / Cancel confirmation in the same `/cook` entry
64
- 4. after Start, write the approved startup plan into `.agent/startup-plan.json` / `.agent/startup-plan.md`, then let `completion-regrounder` derive canonical slices from repo truth
61
+ 1. call a primary-agent startup-plan synthesis step immediately from the current task context
62
+ 2. use that synthesized startup plan to show Start / Cancel confirmation in the same `/cook` entry
63
+ 3. after Start, write the approved startup plan into `.agent/startup-plan.json` / `.agent/startup-plan.md`, then let `completion-regrounder` derive canonical slices from repo truth
65
64
 
66
65
  That means:
67
66
 
68
67
  - `/cook` must not infer or guess canonical slices from recent discussion alone
69
- - `/cook` should use primary-agent-authored startup-plan data
68
+ - `/cook` should always synthesize the startup plan fresh in the same entry from current task context
69
+ - `/cook` should not directly reuse an old preview capsule as canonical or approval-ready workflow state
70
70
  - `/cook` should not require a manual rerun just to consume a startup plan it can synthesize immediately from the primary-agent view
71
71
 
72
72
  ## Optional Preview Behavior
@@ -106,7 +106,7 @@ Notes:
106
106
 
107
107
  - `constraints` may be replaced or supplemented by `non_goals` when clearer.
108
108
  - `first_slice_goal`, `first_slice_non_goals`, `implementation_surfaces`, `verification_commands`, and `why_this_slice_first` are optional sequencing hints. They help `completion-regrounder` split slices later when they are already obvious, but the approved startup plan may still be startable without them.
109
- - Any capsule is startup intake for `/cook` only. It is not canonical `.agent/**` state, not active-slice state, and not a second repo contract source.
109
+ - Any capsule is advisory preview only. It is not canonical `.agent/**` state, not active-slice state, not a second repo contract source, and not something `/cook` should directly reuse without same-entry primary-agent synthesis.
110
110
 
111
111
  Suggested wording:
112
112
 
@@ -127,6 +127,7 @@ When the user does explicitly choose `/cook`, the system must not:
127
127
 
128
128
  - let `/cook` invent canonical slices from recent discussion alone
129
129
  - let `/cook` replace missing startup-plan data with generic transcript guessing
130
+ - let `/cook` directly consume an old preview capsule instead of rerunning same-entry primary-agent startup-plan synthesis
130
131
  - require a second `/cook` invocation when same-entry primary-agent startup-plan synthesis is possible
131
132
 
132
133
  ## Relationship To `completion-protocol`