@sublang/playbook 10.0.0 → 11.0.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 CHANGED
@@ -63,7 +63,7 @@ playbook
63
63
  Type a task, enter `/code <task>` for implementation, or enter
64
64
  `/decide <question>` for an independently proposed and reviewed decision.
65
65
 
66
- On first launch, Playbook writes its config to `${XDG_CONFIG_HOME:-$HOME/.config}/playbook/playbook.config.yaml`.
66
+ On first launch, Playbook writes its config to `${SPEX_HOME:-$HOME/.spex}/playbook/playbook.config.yaml`. A config left at the former `${XDG_CONFIG_HOME:-$HOME/.config}/playbook/playbook.config.yaml` is moved there on the next launch, unless a relative primary locator would change targets; that case is rejected unchanged with absolute replacements.
67
67
 
68
68
  The same config, compiled Captain, enabled playbooks, stable players, and
69
69
  nested calls power headless turns. Both front ends create the same durable
package/docs/cli.md CHANGED
@@ -188,7 +188,7 @@ The former positional `<from>`, `resume`, `--player`, `--captain`,
188
188
  `--option`, `--cwd`, `--last`, run-only `--config`, and top-level `run:`
189
189
  config are removed from `playbook run`. Enable a registry under `playbooks`,
190
190
  declare provider agents once under top-level `players`, bind every local role
191
- under `playbooks.<id>.roles`, tune compatible model and effort in a `--with`
191
+ under `playbooks.<id>.roles`, tune compatible model, effort, and fast mode in a `--with`
192
192
  overlay, invoke the effective `/command`, and run from the working directory
193
193
  you want agents to use. Legacy `playbooks.<id>.players` blocks are rejected and
194
194
  are not auto-migrated because choosing equal or distinct new player IDs chooses
@@ -231,12 +231,13 @@ module's directory is a git repository, add `node_modules/` to its
231
231
 
232
232
  ### Continuing a Captain session
233
233
 
234
- Interactive and headless commands write the same logical-session records under
235
- `${XDG_STATE_HOME:-$HOME/.local/state}/playbook/sessions/`. A fresh interactive
236
- child persists turn zero before printing `playbook: session <id>` and opening
237
- Boss input; a fresh headless turn returns the same kind of ID in `--json`.
238
- After the current writer exits or explicitly hands off, either presentation
239
- can reopen either origin:
234
+ Interactive and headless commands write the same logical-session records in
235
+ the configured [`sessions` directory](configuration.md#session-storage), whose
236
+ default is `${XDG_STATE_HOME:-$HOME/.local/state}/playbook/sessions/`. A fresh
237
+ interactive child persists turn zero before printing `playbook: session <id>`
238
+ and opening Boss input; a fresh headless turn returns the same kind of ID in
239
+ `--json`. After the current writer exits or explicitly hands off, either
240
+ presentation can reopen either origin:
240
241
 
241
242
  ```sh
242
243
  # Reopen the newest session stored for this working directory headlessly:
@@ -265,13 +266,56 @@ competing front end fails closed instead of forking the history.
265
266
  An ordinary reopen reads current config and any opening `--with` fragments,
266
267
  projects them to the stored catalog and player roster, and requires the stored
267
268
  role bindings plus every structural setting to remain exact. Compatible
268
- current `model` and `effort` selections apply to the next call, including an
269
- explicit boolean `false` provider-default reset. The retained provider token
270
- is never silently replaced by a fresh conversation if that selection is not
271
- supported
269
+ current `model`, `effort`, and optional `fastMode` settings apply to the next
270
+ call. Boolean `false` explicitly resets model or effort to the provider
271
+ default, but `fastMode: false` is a literal disabled request; omission selects
272
+ the fast-mode provider default or inherits the player value at a role binding.
273
+ The retained provider token is never silently replaced by a fresh conversation
274
+ if a requested setting is not supported
272
275
  ([[playbook-cli-22](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-22)],
273
276
  [DR-032](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/032-explicit-roles-session-players.md)).
274
277
 
278
+ ### Following replay history
279
+
280
+ Beside each `<session-id>.json` manifest, both front ends tee every observed
281
+ host record in order to `<session-id>.records.jsonl`. Each complete line is a
282
+ version-1 envelope with a writer-assigned sequence contiguous from `1`, the
283
+ opaque record, and an optional local playbook role where the trace establishes
284
+ one unambiguously. The stream is a mode-`0600` regular non-symlink file inside
285
+ the private sessions directory. Readers consume only the complete
286
+ newline-terminated prefix; a final partial line is not presented as a record.
287
+
288
+ The replay projection recursively removes provider `resumeToken` fields and
289
+ string-valued `resume` selections while preserving `resume: false`. It is
290
+ therefore useful for following and presentation, but it cannot resume an agent
291
+ conversation and does not replace the private canonical manifest. External
292
+ hosts can follow this stream without taking the writer lease through the
293
+ published [`@sublang/playbook/session-store`
294
+ facade](embedding.md#sharing-the-cli-session-store).
295
+
296
+ Streams are unbounded in this version: neither front end prunes them, and
297
+ retention remains tied to the deferred session-deletion policy. Removing
298
+ provider credentials does not make the remaining replay content non-sensitive;
299
+ protect the prompts, replies, tool calls, events, and timestamps it contains as
300
+ sensitive session data.
301
+
302
+ Replay recording is fail-soft after the canonical session lease is valid. If
303
+ initialization, sanitization, append, repair, publication synchronization, or a
304
+ checkpoint fails, recording stops for that lease without changing the agent
305
+ turn, durable session settlement, reply, or exit outcome. The headless command
306
+ attempts this warning once on stderr:
307
+
308
+ ```text
309
+ playbook run: warning: replay history for session "<session-id>" may be incomplete; recording has stopped
310
+ ```
311
+
312
+ The interactive child instead presents one Captain status with the same
313
+ `warning: replay history ...` text and writes no raw stderr diagnostic. A later
314
+ lease gets its own warning only if its replay writer independently becomes
315
+ incomplete. The public facade emits no warning; an embedding host decides how
316
+ to present the `incomplete` status it receives
317
+ ([[playbook-cli-84](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-84)]).
318
+
275
319
  ### Reconciling possible repository effects
276
320
 
277
321
  For each governed player call, Playbook records a Git baseline before the call
@@ -307,8 +351,9 @@ playbook run --session 4f2c0000-0000-4000-8000-000000009ab1 --discard-uncertain
307
351
  ```
308
352
 
309
353
  Retry reads no input and reuses the byte-exact recorded turn and its exact
310
- attempted Captain, player, and per-role model/effort selections; current config
311
- cannot retune that attempt, and retry may duplicate external effects. Discard
354
+ attempted Captain, player, and per-role model, effort, and fast-mode settings;
355
+ current config cannot retune that attempt, and retry may duplicate external
356
+ effects. Discard
312
357
  reads no input and runs no model: it restores the exact prior settled boundary,
313
358
  or deletes a never-settled fresh session, while abandoning the attempted work.
314
359
  An interrupted interactive turn uses the same uncertain record and is
@@ -4,22 +4,35 @@
4
4
  # Configuring agents
5
5
 
6
6
  Fresh launches and ordinary reopens read one config at
7
- `${XDG_CONFIG_HOME:-$HOME/.config}/playbook/playbook.config.yaml`. The
7
+ `${SPEX_HOME:-$HOME/.spex}/playbook/playbook.config.yaml`. The
8
8
  first launch seeds it from the bundled starter and prints the path;
9
9
  later launches reuse it untouched.
10
10
 
11
+ On the first launching command after upgrading Playbook, it moves a config from the
12
+ former `${XDG_CONFIG_HOME:-$HOME/.config}/playbook/playbook.config.yaml` path
13
+ when the canonical path is absent. The one-time move preserves bytes and
14
+ permissions and leaves no compatibility alias, so running an older Spex host
15
+ afterward could seed a second file at the former path.
16
+
17
+ The current guard rejects relocation when a legacy relative `sessions` value
18
+ or relative filesystem `playbooks.<id>.from` would resolve differently below
19
+ the new directory. It leaves the former file unchanged and names every
20
+ target-preserving absolute replacement. Apply those replacements and retry;
21
+ Playbook does not rewrite the user-authored file.
22
+
11
23
  ```sh
12
- $EDITOR "${XDG_CONFIG_HOME:-$HOME/.config}/playbook/playbook.config.yaml"
24
+ $EDITOR "${SPEX_HOME:-$HOME/.spex}/playbook/playbook.config.yaml"
13
25
  ```
14
26
 
15
27
  ## Anatomy
16
28
 
17
29
  The config is top-level (no `config:` wrapper): a `captain` agent, one flat
18
30
  `players` map of stable Captain-session agents, a `playbooks` map of enabled
19
- workflows and their explicit role bindings, and optional `layout` /
20
- `notifications` / `theme`. The Captain runs hidden control and judge calls and
21
- writes the replies you see in the Captain pane or on headless stdout. The three
22
- presentation fields apply only to interactive tmux; headless runs ignore them.
31
+ workflows and their explicit role bindings, an optional `sessions` storage
32
+ locator, and optional `layout` / `notifications` / `theme`. The Captain runs
33
+ hidden control and judge calls and writes the replies you see in the Captain
34
+ pane or on headless stdout. The three presentation fields apply only to
35
+ interactive tmux; headless runs ignore them.
23
36
 
24
37
  A **role** is local to a playbook artifact: CODE's `coder` and REVIEW's `coder`
25
38
  have the same semantic name but remain separate declarations. A **player** is
@@ -29,11 +42,12 @@ names, nesting, and ancestry never infer a binding.
29
42
 
30
43
  Each `captain` or `players.<player-id>` value is either an adapter shorthand
31
44
  (`claude`, `codex`) or a block carrying that agent's own `adapter`, `model`,
32
- `effort`, `instruction`, and `permissions`. Settings are inline per stable
33
- agent ([DR-021](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/021-inline-agent-settings.md)). Dots in a
34
- player ID are literal characters, not YAML hierarchy. Other adapter IDs pass
35
- through to `tmux-play` with a warning because `playbook` cannot preflight their
36
- auth.
45
+ `effort`, `fastMode`, `instruction`, and `permissions`. Settings are inline per
46
+ stable agent
47
+ ([DR-021](https://github.com/sublang-ai/playbook/blob/main/specs/decisions/021-inline-agent-settings.md)).
48
+ Dots in a player ID are literal characters, not YAML hierarchy. Other adapter
49
+ IDs pass through to `tmux-play` with a warning because `playbook` cannot
50
+ preflight their auth.
37
51
 
38
52
  Within a `playbooks.<id>` block, `from` (the registry module), `command` (an
39
53
  optional slash-command override), and `roles` are launcher-owned; every other
@@ -41,34 +55,35 @@ key is that playbook's option slice. Every manifest role must be present
41
55
  exactly once. The launcher injects the rest — you do not write host wiring by
42
56
  hand.
43
57
 
44
- The seeded config runs the stable Coder player on Claude Opus 4.8 1m and the
45
- stable Reviewer player on GPT-5.5:
58
+ The seeded config runs the stable Coder player on GPT-5.6 Sol with fast mode
59
+ enabled and the stable Reviewer player on Claude Opus 5:
46
60
 
47
61
  ```yaml
48
62
  captain:
49
63
  adapter: claude
50
- model: claude-opus-4-8
64
+ model: claude-opus-5
51
65
  effort: high
52
66
  permissions:
53
67
  mode: auto # protected auto mode for the Claude Captain
54
68
 
55
69
  players:
56
70
  dev.coder:
57
- adapter: claude
58
- model: claude-opus-4-8[1m]
59
- effort: xhigh
60
- permissions:
61
- mode: auto # protected auto mode for the Claude Coder
62
-
63
- dev.reviewer:
64
71
  adapter: codex
65
- model: gpt-5.5
66
- effort: xhigh
72
+ model: gpt-5.6-sol
73
+ effort: ultra
74
+ fastMode: true
67
75
  permissions:
68
76
  mode: auto
69
77
  writablePaths:
70
78
  - .git # allow git metadata writes under Codex auto mode
71
79
 
80
+ dev.reviewer:
81
+ adapter: claude
82
+ model: claude-opus-5
83
+ effort: xhigh
84
+ permissions:
85
+ mode: auto # protected auto mode for the Claude Reviewer
86
+
72
87
  playbooks:
73
88
  code:
74
89
  from: '@sublang/playbook/code/registry'
@@ -104,21 +119,26 @@ roles:
104
119
  coder: dev.coder
105
120
  ```
106
121
 
107
- Use a block to override only that role invocation's model or effort:
122
+ Use a block to override only that role invocation's model, effort, or fast
123
+ mode:
108
124
 
109
125
  ```yaml
110
126
  roles:
111
127
  coder:
112
128
  player: dev.coder
113
- model: claude-opus-4-8[1m]
129
+ model: gpt-5.6-sol
114
130
  effort: false # explicitly reset to this provider's default
131
+ fastMode: false # literal disabled request, not a default sentinel
115
132
  ```
116
133
 
117
- Omitting `model` or `effort` inherits that player's top-level default. The
118
- boolean `false` is different: it selects the provider default explicitly, so a
119
- resumed conversation cannot accidentally retain an earlier selection. A role
120
- binding cannot override adapter, instruction, permissions, workspace, or tool
121
- posture; those define the stable player envelope.
134
+ Omitting any override inherits that player's top-level default. For `model`
135
+ and `effort`, boolean `false` selects the provider default explicitly, so a
136
+ resumed conversation cannot accidentally retain an earlier selection. For
137
+ `fastMode`, `false` is a literal request to disable fast mode; omitting the
138
+ top-level setting selects the provider default. A present fast-mode boolean is
139
+ accepted only for adapters Cligent reports as supporting it. A role binding
140
+ cannot override adapter, instruction, permissions, workspace, or tool posture;
141
+ those define the stable player envelope.
122
142
 
123
143
  ## Sharing, isolation, and concurrency
124
144
 
@@ -136,9 +156,9 @@ second top-level player and change only its binding:
136
156
  ```yaml
137
157
  players:
138
158
  review.coder:
139
- adapter: claude
140
- model: claude-opus-4-8[1m]
141
- effort: xhigh
159
+ adapter: codex
160
+ model: gpt-5.6-sol
161
+ effort: ultra
142
162
 
143
163
  playbooks:
144
164
  review:
@@ -183,8 +203,9 @@ playbook run --with fast-lineup.yaml "/code implement the approved change"
183
203
  # fast-lineup.yaml — retune the shared Coder; nothing is written back.
184
204
  players:
185
205
  dev.coder:
186
- model: claude-opus-4-8
206
+ model: gpt-5.6-sol
187
207
  effort: medium
208
+ fastMode: false
188
209
  ```
189
210
 
190
211
  Fragments merge into the agent block rather than replacing it, so
@@ -207,9 +228,37 @@ The global file is never modified, and `--with` is not forwarded to
207
228
  Overlays apply when creating a fresh session and as current-config input for a
208
229
  compatible ordinary reopen. A selected session keeps its stored catalog,
209
230
  player roster, role bindings, adapter, instruction, permissions, and working
210
- directory; only model and effort may change. The next call reapplies both
211
- complete selections. An uncertain retry accepts no tuning overlay and uses the
212
- exact attempted selections already stored with that turn.
231
+ directory; only model, effort, and fast mode may change. The next call reapplies
232
+ both complete model and effort selections and the optional effective fast-mode
233
+ boolean. An uncertain retry accepts no tuning overlay and uses the exact
234
+ attempted settings already stored with that turn.
235
+
236
+ ## Session storage
237
+
238
+ Both front ends select canonical session manifests and write replay streams in
239
+ one directory, where external hosts may keep their own sidecars too. Set the
240
+ optional top-level `sessions` key to move that shared store:
241
+
242
+ ```yaml
243
+ sessions: ./state/playbook-sessions
244
+ ```
245
+
246
+ The value must be a nonempty filesystem path. When the key is absent, the
247
+ directory is
248
+ `${XDG_STATE_HOME:-$HOME/.local/state}/playbook/sessions`. An absolute path is
249
+ used as given; `~` and `~/...` expand from the home directory, while `~user`
250
+ is rejected. Every other value, including a bare relative path such as the one
251
+ above, resolves against the primary config file's directory rather than the
252
+ invocation directory. A `sessions` value in a `--with` overlay replaces the
253
+ primary value, with later overlays winning.
254
+
255
+ Launch validates that the resolved path can serve as the mode-`0700`, real,
256
+ non-symlink session store before selecting a record or starting agent work and
257
+ fails closed when it cannot. The non-launching `playbook --list` command still
258
+ validates the locator's syntax but does not inspect that directory's filesystem
259
+ usability. The resolved locator is launch configuration only: it never enters
260
+ a persisted structural or execution projection
261
+ ([[playbook-cli-78](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-78)]).
213
262
 
214
263
  ## Durable shared configuration
215
264
 
@@ -223,9 +272,9 @@ public UUID. Presentation-only fields are inert headlessly.
223
272
  An ordinary reopen reads current config and opening overlays, but first
224
273
  projects them to the stored playbooks and referenced players. An unrelated new
225
274
  entry cannot enter or invalidate the session. Structural drift fails closed;
226
- compatible model or effort changes apply on the next provider call. Legacy
227
- record, shell, runtime-snapshot, and trace schemas are rejected rather than
228
- having role or player identity guessed.
275
+ compatible model, effort, or fast-mode changes apply on the next provider
276
+ call. Legacy record, shell, runtime-snapshot, and trace schemas are rejected
277
+ rather than having role or player identity guessed.
229
278
 
230
279
  ## External playbooks
231
280
 
package/docs/embedding.md CHANGED
@@ -220,6 +220,94 @@ capability functions never enter Boss-visible status text or configured
220
220
  options. Because trace observers do receive opaque resume tokens, persisted
221
221
  traces should be protected as sensitive data.
222
222
 
223
+ ## Sharing the CLI session store
224
+
225
+ An external host that needs the CLI's canonical session validation and
226
+ token-free replay format can use the narrow, semver-stable
227
+ `@sublang/playbook/session-store` facade. It shares the CLI's private store and
228
+ validators by construction but exposes no canonical manifest, snapshot,
229
+ provider credential, effect ledger, recovery operation, or turn-lifecycle
230
+ operation:
231
+
232
+ ```ts
233
+ import {
234
+ defaultSessionsDir,
235
+ openSessionStore,
236
+ } from '@sublang/playbook/session-store';
237
+
238
+ const store = openSessionStore(defaultSessionsDir());
239
+ const { sessions, skipped } = await store.list();
240
+
241
+ const sessionId = sessions[0]?.sessionId;
242
+ if (sessionId !== undefined) {
243
+ const summary = await store.read(sessionId);
244
+ console.log(summary.sessionId, summary.state, summary.cwd);
245
+
246
+ const first = await store.readStream(sessionId);
247
+ const next = await store.readStream(sessionId, {
248
+ afterSeq: first.lastReadableSeq,
249
+ });
250
+ console.log(next.entries, skipped);
251
+ }
252
+ ```
253
+
254
+ `list()` reports valid summaries and separately reports skipped canonical
255
+ manifests with their validation or cutover reason. A summary has exactly
256
+ `schemaVersion`, `sessionId`, `state`, `cwd`, and `updatedAt`. A lease-free
257
+ `readStream()` returns complete envelopes and `lastReadableSeq` only: it makes
258
+ no claim that another process has durably checkpointed the observed bytes or
259
+ that its live writer remains complete. An absent stream reads as empty, and
260
+ acquiring its lease does not require a manifest; only `read()` requires a
261
+ canonical session summary. Pass an absolute path to `openSessionStore()` when
262
+ using a directory other than the environment-derived default.
263
+
264
+ Writing requires the one exclusive session lease. The writer assigns envelope
265
+ version and sequence, serializes overlapping appends in invocation order, and
266
+ strips provider resume credentials from every accepted record:
267
+
268
+ ```ts
269
+ const lease = await store.acquire(
270
+ '4f2c0000-0000-4000-8000-000000009ab1',
271
+ );
272
+ try {
273
+ await lease.append({ type: 'host_notice', message: 'attached' });
274
+ const status = lease.streamStatus();
275
+ console.log(status);
276
+ if (status.lastReadableSeq !== null) {
277
+ const replay = await lease.readStream();
278
+ console.log(replay.lastReadableSeq, replay.lastDurableSeq);
279
+ }
280
+ } finally {
281
+ const finalStatus = await lease.release();
282
+ console.log(finalStatus);
283
+ }
284
+ ```
285
+
286
+ `streamStatus()` synchronously returns the current live status. If initialization
287
+ could not establish a trustworthy whole-stream boundary, it returns
288
+ `{ lastReadableSeq: null, lastDurableSeq: null, incomplete: true }`, and
289
+ `lease.readStream()` rejects rather than return partial history.
290
+ An `append()` suppressed before release by either unavailable initialization or
291
+ a numeric incomplete latch resolves `undefined` without recording the supplied
292
+ record, so fulfillment alone does not prove persistence.
293
+
294
+ Always release a successfully acquired lease. `release()` closes append
295
+ admission, drains earlier appends, attempts the final checkpoint, retires the
296
+ lease, and returns the final `lastReadableSeq`, `lastDurableSeq`, and
297
+ `incomplete` status. A replay initialization failure reports unavailable null
298
+ boundaries; a later sanitization, repair, or persistence failure latches
299
+ numeric `incomplete` status. Either state suppresses later replay work on that
300
+ lease and remains isolated from canonical session lifecycle work. The facade
301
+ writes no warning to stdout or stderr; the embedding host owns any presentation
302
+ of that status.
303
+
304
+ For control flow, a missing canonical manifest from `read()` uses
305
+ `Error.code === 'PLAYBOOK_SESSION_NOT_FOUND'`, and a competing live or foreign
306
+ lease uses `Error.code === 'PLAYBOOK_SESSION_LEASE_ACTIVE'`. Do not match error
307
+ messages or assume those codes for malformed input, unsafe storage, an
308
+ indeterminate owner probe, or another storage failure
309
+ ([[playbook-cli-73](https://github.com/sublang-ai/playbook/blob/main/specs/packages/playbook-cli.md#playbook-cli-73)]).
310
+
223
311
  See
224
312
  [`code.playbook.test.ts`](https://github.com/sublang-ai/playbook/blob/main/reference/sdlc/code.playbook/code.playbook.test.ts)
225
313
  for the full range of port shapes (classifier, judge, abort, interrupt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublang/playbook",
3
- "version": "10.0.0",
3
+ "version": "11.0.0",
4
4
  "type": "module",
5
5
  "description": "Composable XState v5 playbook runtime with compiled Captain, CODE, REVIEW, and DECIDE workflows driven by GEARS specs.",
6
6
  "license": "Apache-2.0",
@@ -67,12 +67,15 @@
67
67
  "reference/sdlc/code.playbook/playbook-captain.ts",
68
68
  "reference/sdlc/code.playbook/playbook-captain.js",
69
69
  "reference/sdlc/code.playbook/playbook-captain.d.ts",
70
+ "reference/sdlc/code.playbook/session-store.js",
71
+ "reference/sdlc/code.playbook/session-store.d.ts",
70
72
  "reference/sdlc/code.playbook/code.gears.md",
71
73
  "reference/sdlc/code.playbook/playbook.config.template.yaml",
72
74
  "reference/sdlc/code.playbook/bin/playbook.js",
73
75
  "reference/sdlc/code.playbook/bin/launch-config.js",
74
76
  "reference/sdlc/code.playbook/bin/run.js",
75
77
  "reference/sdlc/code.playbook/bin/interactive-session.js",
78
+ "reference/sdlc/code.playbook/bin/replay-observer.js",
76
79
  "reference/sdlc/code.playbook/bin/session-store.js",
77
80
  "reference/sdlc/code.playbook/bin/provision.js",
78
81
  "reference/sdlc/code.playbook/bin/adapter-sdk.js",
@@ -127,6 +130,10 @@
127
130
  "types": "./reference/sdlc/code.playbook/playbook-captain.d.ts",
128
131
  "default": "./reference/sdlc/code.playbook/playbook-captain.js"
129
132
  },
133
+ "./session-store": {
134
+ "types": "./reference/sdlc/code.playbook/session-store.d.ts",
135
+ "default": "./reference/sdlc/code.playbook/session-store.js"
136
+ },
130
137
  "./slc/*": "./slc/*",
131
138
  "./review/playbook": {
132
139
  "types": "./reference/sdlc/review.playbook/review.playbook.d.ts",
@@ -158,7 +165,7 @@
158
165
  "provenance": true
159
166
  },
160
167
  "dependencies": {
161
- "@sublang/cligent": "^0.23.0",
168
+ "@sublang/cligent": "^0.24.0",
162
169
  "@sublang/spex": "^3.0.0",
163
170
  "p-queue": "^9.3.1",
164
171
  "xstate": "^5.19.4",
@@ -8,35 +8,44 @@ Roles:
8
8
 
9
9
  - Coder
10
10
 
11
- The caller supplies the coding intent including any specific context.
11
+ The caller supplies a coding request together with any relevant context.
12
12
 
13
- A coding intent follows either one direct implementation phase or an IR sequence consisting of a new-IR phase and one phase for each IR task.
13
+ A new coding intent follows either one direct implementation phase or an IR sequence consisting of a new-IR phase followed by one phase for each IR task.
14
+ An existing IR follows one IR-task phase for each remaining unfinished task, starting with its next unfinished task.
14
15
  Each phase ends with one new Coder commit (owned by `code`).
15
16
  After each `code`-owned commit, Captain shall call the `review` playbook and wait until it passes with no unsettled findings.
16
17
  Playbook `review` owns every review round and every review-fix commit.
17
- Do not amend any reviewed commit.
18
+ Do not rewrite any existing commit.
18
19
 
19
20
  When `review` passes a direct implementation phase, `code` is complete.
20
21
  When `review` passes a new IR or a nonfinal IR-task phase, Captain shall continue with the next unfinished IR-task phase.
21
22
  When `review` passes the final IR-task phase, `code` is complete.
22
- When `review` returns an authored abort or failure, or a terminal result that does not prove exact approval, `code` shall start no further phase and shall report the failure and the last `code`-owned commit to its caller.
23
+ When `review` returns an authored abort or failure, or a terminal result that does not establish that the supplied scope was evaluated with no unsettled findings, `code` shall start no further phase and shall report the failure and the last `code`-owned commit to its caller.
23
24
  When the nested `review` call fails outside that authored result contract, `code` shall park as failed and retain the control-plane error instead of reporting an authored review outcome.
24
25
 
25
26
  At the start of the first phase, Captain shall relay to Coder the complete caller input and any relevant run results in quotes (`>`), along with the following instruction:
26
27
 
27
28
  ```markdown
28
- Assess whether the coding intent can be completed well in one commit.
29
- If yes, implement and test it, update the affected specs, and ensure @specs/map.md remains accurate.
30
- Otherwise, decompose it into tasks sized to exactly one commit each, add a new IR under @specs/intents, and do not implement any IR task in this phase.
29
+ First determine whether the coding request starts a new coding intent or continues an existing IR with unfinished work.
30
+ If the request may continue an existing IR but does not identify it unambiguously, ask Boss before changing files.
31
+
32
+ For a new coding intent, assess whether it can be completed well in one commit.
33
+ If it can, implement and test it, update the affected specs, and ensure @specs/map.md remains accurate.
34
+ If it cannot, decompose it into tasks sized to exactly one commit each, add a new IR under @specs/intents, and do not implement any IR task in this phase.
31
35
  Plan affected spec updates before, with, or after their corresponding code changes, either as standalone IR tasks or as explicit work within related tasks.
32
36
 
37
+ For an existing IR, read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
38
+ Do not implement a later task in this phase.
39
+ Mark the IR's progress and deliverables when relevant.
40
+ If the IR will be finished after this phase, double-check that all acceptance criteria are met.
41
+
33
42
  Consult @specs/map.md for relevant context and @specs/meta.md for spec requirements, if needed.
34
43
  ```
35
44
 
36
- At the start of every IR-task phase, Captain shall relay to Coder the exact next task and any relevant run results in quotes (`>`), along with the following instruction:
45
+ At the start of every later IR-task phase, Captain shall relay to Coder the original caller input, the IR identity, and any relevant run results in quotes (`>`), along with the following instruction:
37
46
 
38
47
  ```markdown
39
- Read IR-<#> and implement exactly the next unfinished task, including corresponding tests or specs if any.
48
+ Read the identified IR and implement exactly its next unfinished task, including corresponding tests or specs if any.
40
49
  Do not implement a later task in this phase.
41
50
  Mark the IR's progress and deliverables when relevant.
42
51
  If the IR will be finished after this phase, double-check that all acceptance criteria are met.
@@ -45,18 +54,29 @@ If the IR will be finished after this phase, double-check that all acceptance cr
45
54
  At the start of *every* phase, Captain shall append the following instruction:
46
55
 
47
56
  ```markdown
57
+ Keep to the original intent and follow what it asks.
48
58
  Do not re-run tests or builds whose inputs have not changed since any previous reported run.
49
59
  Make the phase's minimal changes and then one new commit, following @specs/packages/git.md; never amend an existing commit.
50
60
  Make the commit message explain concisely what changed and why, including relevant verification.
51
- Coder is <coder-llm>; format the model token in conventional human form.
61
+ Identify every new commit you make.
62
+ Coder is <coder-llm>.
52
63
  ```
53
64
 
54
- After the first phase (either direct implementation or a new-IR phase), Captain shall call playbook `review` and input the following in quotes (`>`):
65
+ Every new-intent phase has two semantic outcomes: direct implementation and new IR; the new-IR outcome identifies the created IR.
66
+ Every IR-task phase, including the first phase for an existing IR, identifies the IR and the implemented task, and has two semantic outcomes: more tasks and final task.
67
+ The first phase therefore has four semantic outcomes — direct implementation, new IR, more tasks, and final task — plus the Boss question when the continued IR is ambiguous.
68
+ Each semantic outcome requires affirmative support in Coder's result, but no phase transition shall depend on a fixed presentation format of Coder's reply.
69
+ Captain shall use the repository-effect receipt as the authoritative identity of the phase's new commit.
70
+
71
+ At the end of every phase, Captain shall call playbook `review` and input the following in quotes (`>`):
55
72
 
56
- > Initial intent: \<caller-input\>
73
+ > Original intent: \<caller-input\>
74
+ > Review scope: the commit \<code-commit\> from this coding phase and its resulting repository state.
57
75
  > Coder output: \<coder-output\>
58
76
 
59
- After every IR-task phase, Captain shall call playbook `review` and input the following in quotes (`>`):
77
+ For an IR-task phase, Captain shall additionally input the following in quotes (`>`):
60
78
 
61
- > IR task: \<ir-task\>
62
- > Coder output: \<coder-output\>
79
+ > Current IR task: \<ir-task\>
80
+
81
+ A nested `review` passes the phase only when its result applies to that supplied review scope, returns the exact evaluated repository revision, and affirmatively establishes that no unsettled findings remain.
82
+ On successful completion, `code` returns the exact last `code`-owned commit, the exact final evaluated repository revision, and the fact that every phase's review passed with no unsettled findings.