@sublang/playbook 0.4.2 → 0.6.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.
@@ -15,8 +15,9 @@ Players:
15
15
 
16
16
  When Boss gives a coding intent, Captain shall relay it to Coder along with the following prompt:
17
17
  > Assess whether this can be completed in a single commit, following best practices.
18
- > If yes, implement and test, updating both code and specs; otherwise, decompose into tasks as a new IR under @specs/iterations.
19
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; ensure @specs/map.md reflects the changes.
18
+ > If yes, implement and test, updating both code and specs; otherwise, decompose into tasks as a new IR under @specs/iterations and stop without implementing any IR task.
19
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
20
+ > Ensure @specs/map.md reflects the changes.
20
21
  > Do not commit.
21
22
  The resulting changes are Initial Changes.
22
23
 
@@ -49,11 +50,11 @@ When an IR is done, Captain shall prompt Coder:
49
50
  > The set should be complete and coherent.
50
51
  > Avoid implementation specifics.
51
52
  > Avoid redundant spec items.
52
- > Consult @specs/map.md for relevant context and update it to reflect your changes.
53
+ > Ensure @specs/map.md reflects the changes.
53
54
  ## Reviewer
54
55
 
55
56
  For each finding in a review round, Coder either addresses it with changes or challenges it with a rebuttal.
56
- Any code change to address findings starts a new round of review, no matter if some findings are also rebutted.
57
+ Any code change to address findings starts a new round of review, even if some findings are also rebutted.
57
58
  Rounds continue until Reviewer raises no findings.
58
59
 
59
60
  ### CODE-5
@@ -64,12 +65,15 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
64
65
  > Verify any affected spec items are:
65
66
  >
66
67
  > - Complete & coherent: sufficient for you to reimplement code.
67
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
68
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
68
69
  > - Minimal: essential and concise; every item earns its place; also check with other items.
70
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
69
71
  >
70
72
  > Flag anything missing, redundant, over-specified, or under-specified.
71
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
73
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
74
+ > Verify @specs/map.md reflects the changes.
72
75
  > If the change is ready to commit or push, don't raise nitpicks.
76
+ > Do not edit files or commit; report findings only.
73
77
 
74
78
  ### CODE-6
75
79
 
@@ -78,8 +82,10 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
78
82
  > Refer to the commit message.
79
83
  > Flag any issues or improvements (numbered; no duplication).
80
84
  > Think thoroughly — don't just approve or reject.
81
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
85
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
86
+ > Verify @specs/map.md reflects the changes.
82
87
  > If the change is ready to commit or push, don't raise nitpicks.
88
+ > Do not edit files or commit; report findings only.
83
89
 
84
90
  ### CODE-7
85
91
 
@@ -89,14 +95,17 @@ When Committer commits Initial Changes from a Boss coding intent involving chang
89
95
  > Verify any affected spec items are:
90
96
  >
91
97
  > - Complete & coherent: sufficient for you to reimplement code.
92
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
98
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
93
99
  > - Minimal: essential and concise; every item earns its place; also check with other items.
100
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
94
101
  >
95
102
  > Flag anything missing, redundant, over-specified, or under-specified.
96
103
  > Flag any issues or improvements (numbered; no duplication).
97
104
  > Think thoroughly — don't just approve or reject.
98
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
105
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
106
+ > Verify @specs/map.md reflects the changes.
99
107
  > If the change is ready to commit or push, don't raise nitpicks.
108
+ > Do not edit files or commit; report findings only.
100
109
 
101
110
  ### CODE-8
102
111
 
@@ -106,12 +115,15 @@ When Committer commits Initial Changes from an IR task involving changes only in
106
115
  > Verify any affected spec items are:
107
116
  >
108
117
  > - Complete & coherent: sufficient for you to reimplement code.
109
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
118
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
110
119
  > - Minimal: essential and concise; every item earns its place; also check with other items.
120
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
111
121
  >
112
122
  > Flag anything missing, redundant, over-specified, or under-specified.
113
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
123
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
124
+ > Verify @specs/map.md reflects the changes.
114
125
  > If the change is ready to commit or push, don't raise nitpicks.
126
+ > Do not edit files or commit; report findings only.
115
127
 
116
128
  ### CODE-9
117
129
 
@@ -120,8 +132,10 @@ When Committer commits Initial Changes from an IR task involving changes only ou
120
132
  > Refer to the commit message.
121
133
  > Flag any issues or improvements (numbered; no duplication).
122
134
  > Think thoroughly — don't just approve or reject.
123
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
135
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
136
+ > Verify @specs/map.md reflects the changes.
124
137
  > If the change is ready to commit or push, don't raise nitpicks.
138
+ > Do not edit files or commit; report findings only.
125
139
 
126
140
  ### CODE-10
127
141
 
@@ -131,105 +145,125 @@ When Committer commits Initial Changes from an IR task involving changes both in
131
145
  > Verify any affected spec items are:
132
146
  >
133
147
  > - Complete & coherent: sufficient for you to reimplement code.
134
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
148
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
135
149
  > - Minimal: essential and concise; every item earns its place; also check with other items.
150
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
136
151
  >
137
152
  > Flag anything missing, redundant, over-specified, or under-specified.
138
153
  > Flag any issues or improvements (numbered; no duplication).
139
154
  > Think thoroughly — don't just approve or reject.
140
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
155
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
156
+ > Verify @specs/map.md reflects the changes.
141
157
  > If the change is ready to commit or push, don't raise nitpicks.
158
+ > Do not edit files or commit; report findings only.
142
159
 
143
160
  ### CODE-11
144
161
 
145
162
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes only in @specs/user/, @specs/dev/, or @specs/test/ without raising rebuttals, Captain shall prompt Reviewer to begin a review round:
146
- > Review the unstaged/untracked changes.
163
+ > Review the unstaged and untracked changes in the context of the staged changes.
147
164
  > Understand the intent.
148
165
  > Verify any affected spec items are:
149
166
  >
150
167
  > - Complete & coherent: sufficient for you to reimplement code.
151
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
168
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
152
169
  > - Minimal: essential and concise; every item earns its place; also check with other items.
170
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
153
171
  >
154
172
  > Flag anything missing, redundant, over-specified, or under-specified.
155
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
173
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
174
+ > Verify @specs/map.md reflects the changes.
156
175
  > If the change is ready to commit or push, don't raise nitpicks.
176
+ > Do not edit files or commit; report findings only.
157
177
 
158
178
  ### CODE-12
159
179
 
160
180
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes only outside @specs/user/, @specs/dev/, and @specs/test/ without raising rebuttals, Captain shall prompt Reviewer to begin a review round:
161
- > Review the unstaged/untracked changes.
181
+ > Review the unstaged and untracked changes in the context of the staged changes.
162
182
  > Understand the intent.
163
183
  > Flag any issues or improvements (numbered; no duplication).
164
184
  > Think thoroughly — don't just approve or reject.
165
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
185
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
186
+ > Verify @specs/map.md reflects the changes.
166
187
  > If the change is ready to commit or push, don't raise nitpicks.
188
+ > Do not edit files or commit; report findings only.
167
189
 
168
190
  ### CODE-13
169
191
 
170
192
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes both in and outside @specs/user/, @specs/dev/, and @specs/test/ without raising rebuttals, Captain shall prompt Reviewer to begin a review round:
171
- > Review the unstaged/untracked changes.
193
+ > Review the unstaged and untracked changes in the context of the staged changes.
172
194
  > Understand the intent.
173
195
  > Verify any affected spec items are:
174
196
  >
175
197
  > - Complete & coherent: sufficient for you to reimplement code.
176
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
198
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
177
199
  > - Minimal: essential and concise; every item earns its place; also check with other items.
200
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
178
201
  >
179
202
  > Flag anything missing, redundant, over-specified, or under-specified.
180
203
  > Flag any issues or improvements (numbered; no duplication).
181
204
  > Think thoroughly — don't just approve or reject.
182
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
205
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
206
+ > Verify @specs/map.md reflects the changes.
183
207
  > If the change is ready to commit or push, don't raise nitpicks.
208
+ > Do not edit files or commit; report findings only.
184
209
 
185
210
  ### CODE-14
186
211
 
187
212
  When Coder raises rebuttals without making code changes, Captain shall relay them to Reviewer along with the following prompt:
188
213
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
214
+ > Do not edit files or commit; report findings only.
189
215
 
190
216
  ### CODE-15
191
217
 
192
218
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes only in @specs/user/, @specs/dev/, or @specs/test/ and also raises rebuttals, Captain shall prompt Reviewer to begin a review round and relay the rebuttals along with the following prompt:
193
- > Review the unstaged/untracked changes.
219
+ > Review the unstaged and untracked changes in the context of the staged changes.
194
220
  > Understand the intent.
195
221
  > Verify any affected spec items are:
196
222
  >
197
223
  > - Complete & coherent: sufficient for you to reimplement code.
198
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
224
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
199
225
  > - Minimal: essential and concise; every item earns its place; also check with other items.
226
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
200
227
  >
201
228
  > Flag anything missing, redundant, over-specified, or under-specified.
202
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
229
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
230
+ > Verify @specs/map.md reflects the changes.
203
231
  > If the change is ready to commit or push, don't raise nitpicks.
232
+ > Do not edit files or commit; report findings only.
204
233
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
205
234
 
206
235
  ### CODE-16
207
236
 
208
237
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes only outside @specs/user/, @specs/dev/, and @specs/test/ and also raises rebuttals, Captain shall prompt Reviewer to begin a review round and relay the rebuttals along with the following prompt:
209
- > Review the unstaged/untracked changes.
238
+ > Review the unstaged and untracked changes in the context of the staged changes.
210
239
  > Understand the intent.
211
240
  > Flag any issues or improvements (numbered; no duplication).
212
241
  > Think thoroughly — don't just approve or reject.
213
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
242
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
243
+ > Verify @specs/map.md reflects the changes.
214
244
  > If the change is ready to commit or push, don't raise nitpicks.
245
+ > Do not edit files or commit; report findings only.
215
246
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
216
247
 
217
248
  ### CODE-17
218
249
 
219
250
  When Coder makes unreviewed changes (outside of any Initial Changes) involving changes both in and outside @specs/user/, @specs/dev/, and @specs/test/ and also raises rebuttals, Captain shall prompt Reviewer to begin a review round and relay the rebuttals along with the following prompt:
220
- > Review the unstaged/untracked changes.
251
+ > Review the unstaged and untracked changes in the context of the staged changes.
221
252
  > Understand the intent.
222
253
  > Verify any affected spec items are:
223
254
  >
224
255
  > - Complete & coherent: sufficient for you to reimplement code.
225
- > - Right level: user requirements (in @specs/user) or behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
256
+ > - Right level: user requirements (in @specs/user) or system behavior (in @specs/dev), not implementation specifics; integration/system testing (in @specs/test), not unit testing.
226
257
  > - Minimal: essential and concise; every item earns its place; also check with other items.
258
+ > - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
227
259
  >
228
260
  > Flag anything missing, redundant, over-specified, or under-specified.
229
261
  > Flag any issues or improvements (numbered; no duplication).
230
262
  > Think thoroughly — don't just approve or reject.
231
- > Consult @specs/map.md or @specs/meta.md for relevant context if needed; verify @specs/map.md reflects the changes.
263
+ > For context discovery, @specs/map.md indexes all spec files and @specs/meta.md describes the spec format.
264
+ > Verify @specs/map.md reflects the changes.
232
265
  > If the change is ready to commit or push, don't raise nitpicks.
266
+ > Do not edit files or commit; report findings only.
233
267
  > For each rebuttal below, challenge or accept it, with strong reasoning, solid evidence, and comprehensive thinking.
234
268
 
235
269
  ## Committer
@@ -238,6 +272,7 @@ When Coder makes unreviewed changes (outside of any Initial Changes) involving c
238
272
 
239
273
  When Coder makes any Initial Changes and Reviewer has not played since the last commit, Captain shall prompt Committer:
240
274
  > Make a commit of the changes that belong in the repo, following @specs/dev/git.md (reread if necessary).
275
+ > Write concisely.
241
276
  > Coder is <coder-llm>.
242
277
  > Format the `Co-authored-by` `<model>` token as the conventional human form of the substituted id (e.g., `claude-opus-4-7` → `Claude-Opus-4.7`, `gpt-5.5` → `GPT-5.5`).
243
278
 
@@ -247,6 +282,7 @@ Result guard: `needsBossInput` — Committing requires additional Boss input or
247
282
 
248
283
  When Coder makes any Initial Changes and Reviewer has played since the last commit, or Reviewer raises no findings on uncommitted changes and Coder has played since the last commit, Captain shall prompt Committer:
249
284
  > Make a commit of the changes that belong in the repo, following @specs/dev/git.md (reread if necessary).
285
+ > Write concisely.
250
286
  > Coder is <coder-llm>; Reviewer is <reviewer-llm>.
251
287
  > Format the `Co-authored-by` `<model>` token as the conventional human form of the substituted id (e.g., `claude-opus-4-7` → `Claude-Opus-4.7`, `gpt-5.5` → `GPT-5.5`).
252
288
 
@@ -22,6 +22,16 @@ export interface PlaybookRuntime {
22
22
  dispose(): Promise<void>;
23
23
  }
24
24
  export type CodePlaybookOptions = CodingInput;
25
+ declare function normalizeErrorCompact(err: unknown): {
26
+ name: string;
27
+ message: string;
28
+ } | undefined;
29
+ declare function normalizeErrorFull(err: unknown): {
30
+ name: string;
31
+ message: string;
32
+ stack?: string;
33
+ } | undefined;
34
+ declare function normalizeEventForTelemetry(event: unknown): unknown;
25
35
  declare function composePlayerPrompt(input: CaptainInput): string;
26
36
  declare function resolvePlayerId(input: CaptainInput): string;
27
37
  declare function adjudicate(input: CaptainInput, finalText: string, ports: PlaybookPorts, signal: AbortSignal): Promise<CaptainOutput>;
@@ -39,8 +49,9 @@ interface PendingBossQuestionForStatus {
39
49
  question: string;
40
50
  }
41
51
  declare function pendingBossQuestionFromContext(context: Record<string, unknown>): PendingBossQuestionForStatus | undefined;
42
- declare function formatAwaitBossReplyEntry(context: Record<string, unknown>): string;
43
- declare function formatStateEntry(stateId: string, context?: Record<string, unknown>): string | undefined;
52
+ declare function formatAwaitBossReplyQuestion(context: Record<string, unknown>): string;
53
+ declare function formatAwaitBossReplyMarker(context: Record<string, unknown>): string;
54
+ declare function formatStateEntry(stateId: string): string | undefined;
44
55
  declare function formatTransition(event: unknown): string | undefined;
45
56
  declare function formatClassification(eventType: string): string;
46
57
  declare function stateTelemetryPayload(from: unknown, to: string, event: unknown, context: Record<string, unknown>): Record<string, unknown>;
@@ -53,11 +64,16 @@ export declare const _internal: {
53
64
  STATE_LABELS: Readonly<Record<string, string>>;
54
65
  stateMetadata: ReadonlyMap<string, StateMetadata>;
55
66
  pendingBossQuestionFromContext: typeof pendingBossQuestionFromContext;
56
- formatAwaitBossReplyEntry: typeof formatAwaitBossReplyEntry;
67
+ formatAwaitBossReplyQuestion: typeof formatAwaitBossReplyQuestion;
68
+ formatAwaitBossReplyMarker: typeof formatAwaitBossReplyMarker;
57
69
  formatStateEntry: typeof formatStateEntry;
58
70
  formatTransition: typeof formatTransition;
59
71
  formatClassification: typeof formatClassification;
60
72
  stateTelemetryPayload: typeof stateTelemetryPayload;
73
+ normalizeErrorCompact: typeof normalizeErrorCompact;
74
+ normalizeErrorFull: typeof normalizeErrorFull;
75
+ normalizeEventForTelemetry: typeof normalizeEventForTelemetry;
76
+ VERBATIM_PAYLOAD_FIELDS: ReadonlySet<string>;
61
77
  };
62
78
  export default function createPlaybookRuntime(options: CodePlaybookOptions): PlaybookRuntime;
63
79
  export {};