@linimin/pi-letscook 0.1.54 → 0.1.56
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/CHANGELOG.md +3 -2
- package/README.md +15 -17
- package/extensions/completion/driver.ts +44 -110
- package/extensions/completion/index.ts +54 -89
- package/extensions/completion/prompt-surfaces.ts +65 -380
- package/extensions/completion/proposal.ts +5 -65
- package/extensions/completion/role-runner.ts +4 -311
- package/extensions/completion/state-store.ts +212 -5
- package/extensions/completion/transcription.ts +0 -8
- package/extensions/completion/types.ts +0 -114
- package/package.json +15 -4
- package/scripts/active-slice-contract-test.sh +61 -6
- package/scripts/context-proposal-test.sh +33 -29
- package/scripts/legacy-cleanup-test.sh +11 -0
- package/scripts/refocus-test.sh +10 -11
- package/scripts/release-check.sh +15 -12
- package/scripts/role-runner-contract-test.sh +1 -2
- package/scripts/rubric-contract-test.sh +0 -1
- package/scripts/smoke-test.sh +24 -13
- package/skills/cook-handoff-boundary/SKILL.md +64 -0
- package/extensions/completion/input-routing.ts +0 -819
- package/scripts/cook-trigger-routing-test.sh +0 -1122
package/scripts/smoke-test.sh
CHANGED
|
@@ -51,6 +51,7 @@ ROOT="$TMPDIR/repo"
|
|
|
51
51
|
KICKOFF_PROMPT="$TMPDIR/kickoff-prompt.txt"
|
|
52
52
|
RESUME_PROMPT="$TMPDIR/resume-prompt.txt"
|
|
53
53
|
ORDINARY_SYSTEM_REMINDER="$TMPDIR/ordinary-system-reminder.txt"
|
|
54
|
+
ORDINARY_HANDOFF_REMINDER="$TMPDIR/ordinary-handoff-reminder.txt"
|
|
54
55
|
UNCLEAR_ROUTING_SNAPSHOT="$TMPDIR/active-unclear-routing.json"
|
|
55
56
|
UNCLEAR_CHOOSER_SNAPSHOT="$TMPDIR/unexpected-existing-workflow-chooser.json"
|
|
56
57
|
ORDINARY_AUTO_RESUME_PROMPT="$TMPDIR/ordinary-auto-resume-prompt.txt"
|
|
@@ -60,14 +61,11 @@ INLINE_REJECTION_PROPOSAL_SNAPSHOT="$TMPDIR/inline-arg-proposal.json"
|
|
|
60
61
|
INLINE_REJECTION_CHOOSER_SNAPSHOT="$TMPDIR/inline-arg-chooser.json"
|
|
61
62
|
BOOTSTRAP_SESSION="$TMPDIR/session-smoke-bootstrap.jsonl"
|
|
62
63
|
BOOTSTRAP_DISCUSSION=$'Mission: Exercise smoke-test bootstrap.\nScope:\n- Materialize the canonical completion control-plane files.\n- Keep the smoke test on supported /cook startup behavior.\nConstraints:\n- Keep startup proposal confirmation approval-only.\nAcceptance:\n- Scaffold canonical files and kickoff prompts for the smoke fixture.'
|
|
63
|
-
INLINE_HINT_ANALYST_OUTPUT='{"mission":"Smoke-test inline hint startup mission.","scope":["Materialize the canonical completion control-plane files."],"constraints":["Keep startup proposal confirmation approval-only."],"acceptance":["Scaffold canonical files and kickoff prompts for the smoke fixture."],"task_type":"completion-workflow","evaluation_profile":"completion-rubric-v1","confidence":0.91}'
|
|
64
64
|
|
|
65
65
|
mkdir -p "$ROOT"
|
|
66
66
|
cd "$ROOT"
|
|
67
67
|
git init -q
|
|
68
68
|
|
|
69
|
-
PI_COMPLETION_CONTEXT_PROPOSAL_ACTION=cancel \
|
|
70
|
-
PI_COMPLETION_CONTEXT_PROPOSAL_ANALYST_OUTPUT="$INLINE_HINT_ANALYST_OUTPUT" \
|
|
71
69
|
PI_COMPLETION_SKIP_DRIVER_KICKOFF=1 \
|
|
72
70
|
PI_COMPLETION_TEST_ACTIVE_WORKFLOW_ROUTING_PATH="$INLINE_REJECTION_ROUTING_SNAPSHOT" \
|
|
73
71
|
PI_COMPLETION_TEST_CONTEXT_PROPOSAL_PATH="$INLINE_REJECTION_PROPOSAL_SNAPSHOT" \
|
|
@@ -76,20 +74,19 @@ pi -e "$PKG_ROOT" -p "/cook smoke-test mission" \
|
|
|
76
74
|
>"$TMPDIR/pi-completion-smoke-inline-arg.out" 2>"$TMPDIR/pi-completion-smoke-inline-arg.err"
|
|
77
75
|
|
|
78
76
|
python3 - "$TMPDIR/pi-completion-smoke-inline-arg.out" "$TMPDIR/pi-completion-smoke-inline-arg.err" "$INLINE_REJECTION_ROUTING_SNAPSHOT" "$INLINE_REJECTION_PROPOSAL_SNAPSHOT" "$INLINE_REJECTION_CHOOSER_SNAPSHOT" <<'PY'
|
|
79
|
-
import json
|
|
80
77
|
import sys
|
|
81
78
|
from pathlib import Path
|
|
82
79
|
|
|
83
80
|
output = Path(sys.argv[1]).read_text() + Path(sys.argv[2]).read_text()
|
|
84
81
|
routing = Path(sys.argv[3])
|
|
85
|
-
proposal =
|
|
82
|
+
proposal = Path(sys.argv[4])
|
|
86
83
|
chooser = Path(sys.argv[5])
|
|
87
84
|
|
|
88
|
-
assert not Path('.agent').exists(), 'startup /cook
|
|
89
|
-
assert not routing.exists(), 'startup /cook
|
|
90
|
-
assert proposal
|
|
91
|
-
assert not chooser.exists(), 'startup /cook
|
|
92
|
-
assert '
|
|
85
|
+
assert not Path('.agent').exists(), 'startup /cook inline-args rejection should leave canonical state untouched'
|
|
86
|
+
assert not routing.exists(), 'startup /cook inline-args rejection should not open active-workflow routing before a workflow exists'
|
|
87
|
+
assert not proposal.exists(), 'startup /cook inline-args rejection should not emit a startup-brief proposal snapshot'
|
|
88
|
+
assert not chooser.exists(), 'startup /cook inline-args rejection should not open the existing-workflow chooser before a workflow exists'
|
|
89
|
+
assert '/cook no longer accepts inline arguments.' in output, 'startup /cook inline-args rejection should explain the bare-only entry contract'
|
|
93
90
|
PY
|
|
94
91
|
|
|
95
92
|
write_session "$BOOTSTRAP_SESSION" "$ROOT" "$BOOTSTRAP_DISCUSSION"
|
|
@@ -105,6 +102,7 @@ for file in .agent/profile.json .agent/state.json .agent/plan.json .agent/active
|
|
|
105
102
|
[[ -f "$file" ]] || { echo "missing canonical bootstrap file: $file" >&2; exit 1; }
|
|
106
103
|
done
|
|
107
104
|
|
|
105
|
+
git ls-files --error-unmatch .agent/README.md .agent/mission.md .agent/profile.json .agent/verify_completion_stop.sh .agent/verify_completion_control_plane.sh >/dev/null
|
|
108
106
|
bash .agent/verify_completion_control_plane.sh >/dev/null
|
|
109
107
|
bash .agent/verify_completion_stop.sh >/dev/null
|
|
110
108
|
|
|
@@ -133,6 +131,13 @@ assert active['task_type'] == expected_task_type, 'active-slice.json task_type m
|
|
|
133
131
|
assert active['evaluation_profile'] == expected_eval_profile, 'active-slice.json evaluation_profile mismatch after bootstrap'
|
|
134
132
|
assert active['implementation_surfaces'] == [], 'active-slice.json should scaffold empty implementation_surfaces'
|
|
135
133
|
assert active['verification_commands'] == [], 'active-slice.json should scaffold empty verification_commands'
|
|
134
|
+
brief = state['advisory_startup_brief']
|
|
135
|
+
assert brief['kind'] == 'startup_brief', 'state.json should preserve the confirmed startup brief as advisory intake'
|
|
136
|
+
assert brief['mission'] == state['mission_anchor'], 'advisory startup brief mission should match the canonical mission anchor after bootstrap'
|
|
137
|
+
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'
|
|
138
|
+
assert brief['constraints'] == ['Keep startup proposal confirmation approval-only.'], 'advisory startup brief should preserve constraints'
|
|
139
|
+
assert brief['acceptance'] == ['Scaffold canonical files and kickoff prompts for the smoke fixture.'], 'advisory startup brief should preserve acceptance'
|
|
140
|
+
assert brief['notes'] == ['No additional operator notes were derived from recent discussion.'], 'advisory startup brief should still preserve operator-note structure when no explicit notes exist'
|
|
136
141
|
assert evidence['artifact_type'] == 'completion-verification-evidence', 'verification-evidence.json artifact_type mismatch after bootstrap'
|
|
137
142
|
assert evidence['subject_type'] == 'none', 'verification-evidence.json should scaffold idle subject_type'
|
|
138
143
|
assert evidence['verification_commands'] == [], 'verification-evidence.json should scaffold empty verification_commands'
|
|
@@ -142,23 +147,29 @@ assert f'- task_type: {expected_task_type}' in kickoff, 'kickoff prompt missing
|
|
|
142
147
|
assert f'- evaluation_profile: {expected_eval_profile}' in kickoff, 'kickoff prompt missing canonical evaluation_profile'
|
|
143
148
|
PY
|
|
144
149
|
|
|
145
|
-
rm -f "$ORDINARY_SYSTEM_REMINDER" "$ORDINARY_AUTO_RESUME_PROMPT"
|
|
150
|
+
rm -f "$ORDINARY_SYSTEM_REMINDER" "$ORDINARY_HANDOFF_REMINDER" "$ORDINARY_AUTO_RESUME_PROMPT"
|
|
146
151
|
PI_COMPLETION_SKIP_DRIVER_KICKOFF=1 \
|
|
147
152
|
PI_COMPLETION_TEST_SYSTEM_REMINDER_PATH="$ORDINARY_SYSTEM_REMINDER" \
|
|
153
|
+
PI_COMPLETION_TEST_COOK_HANDOFF_REMINDER_PATH="$ORDINARY_HANDOFF_REMINDER" \
|
|
148
154
|
PI_COMPLETION_TEST_AUTO_CONTINUE_ON_SESSION_START=1 \
|
|
149
155
|
PI_COMPLETION_TEST_AUTO_CONTINUE_PROMPT_PATH="$ORDINARY_AUTO_RESUME_PROMPT" \
|
|
150
156
|
pi -e "$PKG_ROOT" -p "Summarize the repo briefly." \
|
|
151
157
|
>"$TMPDIR/pi-completion-smoke-ordinary.out" 2>"$TMPDIR/pi-completion-smoke-ordinary.err"
|
|
152
158
|
|
|
153
|
-
python3 - "$TMPDIR/pi-completion-smoke-ordinary.out" "$TMPDIR/pi-completion-smoke-ordinary.err" "$ORDINARY_SYSTEM_REMINDER" "$ORDINARY_AUTO_RESUME_PROMPT" <<'PY'
|
|
159
|
+
python3 - "$TMPDIR/pi-completion-smoke-ordinary.out" "$TMPDIR/pi-completion-smoke-ordinary.err" "$ORDINARY_SYSTEM_REMINDER" "$ORDINARY_HANDOFF_REMINDER" "$ORDINARY_AUTO_RESUME_PROMPT" <<'PY'
|
|
154
160
|
import sys
|
|
155
161
|
from pathlib import Path
|
|
156
162
|
|
|
157
163
|
output = Path(sys.argv[1]).read_text() + Path(sys.argv[2]).read_text()
|
|
158
164
|
reminder = Path(sys.argv[3])
|
|
159
|
-
|
|
165
|
+
handoff = Path(sys.argv[4])
|
|
166
|
+
auto_resume = Path(sys.argv[5])
|
|
160
167
|
|
|
161
168
|
assert not reminder.exists(), 'ordinary non-/cook turn should not inject completion reminder solely from canonical state'
|
|
169
|
+
assert handoff.exists(), 'ordinary non-/cook turn should inject the /cook handoff boundary reminder'
|
|
170
|
+
handoff_text = handoff.read_text()
|
|
171
|
+
assert '/cook is the only explicit entrypoint into long-running completion workflow.' in handoff_text, 'ordinary handoff reminder should preserve the explicit /cook workflow boundary'
|
|
172
|
+
assert 'stop short of long-running implementation and tell the user to run /cook.' in handoff_text, 'ordinary handoff reminder should require primary-agent handoff before implementation'
|
|
162
173
|
assert not auto_resume.exists(), 'ordinary non-/cook turn should not queue auto-resume before /cook activation'
|
|
163
174
|
assert 'Skipped completion workflow auto-resume prompt (test mode)' not in output, 'ordinary non-/cook turn should not attempt auto-resume'
|
|
164
175
|
PY
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cook-handoff-boundary
|
|
3
|
+
description: Ordinary-chat boundary contract for deciding when a task has matured enough that the primary agent must stop short of long-running implementation and hand the user off to `/cook`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /cook Handoff Boundary
|
|
7
|
+
|
|
8
|
+
Load or summarize this contract when the primary agent is operating in ordinary main chat before the user has explicitly entered `/cook`.
|
|
9
|
+
|
|
10
|
+
This skill governs the boundary between:
|
|
11
|
+
|
|
12
|
+
- ordinary main-chat discussion, clarification, and proposal work
|
|
13
|
+
- explicit transition into long-running completion workflow through `/cook`
|
|
14
|
+
|
|
15
|
+
## Core Contract
|
|
16
|
+
|
|
17
|
+
- Ordinary chat may be used to clarify requirements, discuss tradeoffs, and propose implementation approaches.
|
|
18
|
+
- `/cook` is the only explicit entrypoint into long-running completion workflow.
|
|
19
|
+
- When the primary agent judges that a task has matured into completion-workflow scope, it must stop short of implementation and direct the user to `/cook`.
|
|
20
|
+
|
|
21
|
+
## When To Hand Off To `/cook`
|
|
22
|
+
|
|
23
|
+
The primary agent should consider `/cook` handoff appropriate when one or more of the following are true:
|
|
24
|
+
|
|
25
|
+
- the user has clearly shifted from exploration into implementation intent
|
|
26
|
+
- the agent has just produced a concrete plan or proposal whose natural next step would be implementation
|
|
27
|
+
- the task spans multiple files, steps, or verification surfaces
|
|
28
|
+
- the task needs resumability, review, audit, or canonical workflow state
|
|
29
|
+
- the task is better treated as a long-running repo mission than a one-off answer or tiny fix
|
|
30
|
+
|
|
31
|
+
## Required Handoff Behavior
|
|
32
|
+
|
|
33
|
+
When the task is judged ready for completion workflow, the primary agent must:
|
|
34
|
+
|
|
35
|
+
- stop before long-running implementation
|
|
36
|
+
- not edit tracked product files in ordinary chat for that workflow-level task
|
|
37
|
+
- tell the user to run `/cook`
|
|
38
|
+
- explain that `/cook` will derive a startup brief from recent discussion and ask for confirmation before workflow start
|
|
39
|
+
|
|
40
|
+
Suggested wording:
|
|
41
|
+
|
|
42
|
+
> This task is now mature enough for the `/cook` workflow. If you want me to start implementation, run `/cook`. I’ll use our recent discussion to generate a startup brief for confirmation before the workflow begins.
|
|
43
|
+
|
|
44
|
+
A short recap may include mission, scope, or acceptance, but that recap must not be presented as canonical plan state.
|
|
45
|
+
|
|
46
|
+
## Forbidden Behaviors
|
|
47
|
+
|
|
48
|
+
Once the task is judged ready for completion workflow, the primary agent must not:
|
|
49
|
+
|
|
50
|
+
- directly begin long-running implementation in ordinary chat
|
|
51
|
+
- modify tracked product files as part of that workflow-level task
|
|
52
|
+
- act as though `/cook` had already been invoked
|
|
53
|
+
- silently rewrite ordinary-chat discussion into active workflow state
|
|
54
|
+
|
|
55
|
+
## Relationship To `completion-protocol`
|
|
56
|
+
|
|
57
|
+
This skill is only about pre-`/cook` ordinary-chat handoff behavior.
|
|
58
|
+
|
|
59
|
+
After the user explicitly enters `/cook`, the separate `completion-protocol` skill governs:
|
|
60
|
+
|
|
61
|
+
- canonical `.agent/**` workflow state
|
|
62
|
+
- workflow-driver behavior
|
|
63
|
+
- mandatory completion-role dispatch
|
|
64
|
+
- review, audit, and stop-wave rules
|