ytdb-slate 0.19.0 → 0.21.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  Approved update notes for Slate releases appear here.
4
4
 
5
+ ## [0.21.0]
6
+
7
+ The `threads` tool now lists the worker threads of the current session by default. The new `parentSession` parameter lists the threads of the newest earlier session. After a Slate handoff, `pi --continue` now opens the new session instead of the earlier session. Use pi 1.6.0 or later.
8
+
9
+ https://github.com/JetBrains/ytdb-slate/releases/tag/v0.21.0
10
+
11
+ ## [0.20.0]
12
+
13
+ Slate now uses a default `contextBudget` of 400,000 tokens for every provider. Sessions with a provider other than Anthropic can run longer before a handoff to a new session. The `threads` tool now returns short pages and uses less context. Native notifications on Windows now find Windows PowerShell under a different Start menu name. Use pi 1.6.0 or later.
14
+
15
+ https://github.com/JetBrains/ytdb-slate/releases/tag/v0.20.0
16
+
5
17
  ## [0.19.0]
6
18
 
7
19
  Slate now recommends Sol 6.2 for most worker tasks, Astra 6.2 for design reviews, and Fable 5.2 to diagnose repeated implementation failures. Use pi 1.5.2 or later. Check your model list before updating. Slate now sends worker output to OpenAI for summaries by default. You can keep Anthropic Sonnet 5.5 in `router.compressor.models`.
package/README.md CHANGED
@@ -17,7 +17,7 @@ Slate comes from the [YouTrackDB](https://github.com/JetBrains/youtrackdb) team,
17
17
 
18
18
  ## Quick start
19
19
 
20
- Use pi 1.5.2 or later. Older pi can load Slate but is unsupported. Slate has no runtime version warning. Install and authenticate [pi](https://pi.dev/docs/latest/quickstart), then pin Slate in your project:
20
+ Use pi 1.6.0 or later. Older pi can load Slate but is unsupported. Slate has no runtime version warning. Install and authenticate [pi](https://pi.dev/docs/latest/quickstart), then pin Slate in your project:
21
21
 
22
22
  ```bash
23
23
  pi install -l npm:ytdb-slate@<version>
@@ -67,7 +67,7 @@ The project must be trusted before Slate reads this file. Start a new session af
67
67
  | `requestThrottle.baseWaitMs` | number | `1000` | Base delay before a blocked request rechecks capacity. The value must be a whole number from 1 through 60000. A positive minimum prevents a repeated zero-delay loop. |
68
68
  | `requestThrottle.jitterMs` | number | `1000` | Uniform random extra delay from zero through this inclusive bound before a blocked request rechecks. The value must be a whole number from 0 through 60000. Admission is approximately fair. It is not first-in-first-out and does not promise a bounded wait. |
69
69
  | `maxConcurrent` | number | `8` | Maximum concurrent worker actions per manager. Accepts positive safe integers only. Invalid input warns and selects 8. Excess actions wait for a slot. Every action has its own thread. See the worker-limit guidance below and `docs/design-principles.md` §5. |
70
- | `contextBudget` | number \| object | `256000` (Anthropic models: `400000`) | Absolute orchestrator context budget (tokens) at which Slate auto-pauses and prepares a fresh-session handoff — semantics, defaults, per-model overrides, and rationale in [`docs/context-budget.md`](context-budget.md). |
70
+ | `contextBudget` | number \| object | `400000` | Sets the orchestrator's pause threshold in tokens. Slate lowers the threshold when the model's context window requires it. See [Orchestrator context budget](context-budget.md) for the handoff and per-model overrides. |
71
71
  | `orchestratorPromptDocs` | string[] | `[]` | Markdown files whose paths follow the source rules above and whose **contents** are appended to the orchestrator system prompt. |
72
72
  | `workerPromptDocs` | string[] | `[]` | Markdown files whose **contents** are appended to every worker-thread system prompt. |
73
73
  | `workflow.draftPRs` | boolean | `false` | Enable one draft pull request for the whole change on one branch. See [pr-publishing.md](pr-publishing.md) § One draft pull request and § Creation. |
@@ -381,9 +381,13 @@ A native failure does not stop other channels.
381
381
  | --- | --- | --- |
382
382
  | Linux | `notify-send` from an absolute search-path directory outside the project and `node_modules`. A desktop display and a user notification service must be available in pi's environment. | 5,000 milliseconds |
383
383
  | macOS | `/usr/bin/osascript` uses the user's notification service. Check the notification permission for the sender on your machine. | 5,000 milliseconds |
384
- | Windows | Windows PowerShell 5.1 at the system path. Slate uses the first case-insensitive exact-name Windows PowerShell entry in the Start applications folder for its registered application identity. | 10,000 milliseconds |
384
+ | Windows | Windows PowerShell 5.1 at the system path. Slate needs a registered entry in the Start applications folder. | 10,000 milliseconds |
385
385
 
386
- Windows uses the system's Start entry, not a universal application identifier.
386
+ Slate selects the first entry named `Windows PowerShell`, ignoring case.
387
+ If no entry has that name, Slate compares each entry's registered application identity with one fixed value.
388
+ That value is the identity Windows registers for the system Windows PowerShell executable.
389
+ Slate selects the first match.
390
+ Slate does not inspect shortcut targets.
387
391
  The Start applications folder is the application list that `Get-StartApps` enumerates.
388
392
  The production helper reads that folder directly and disables PowerShell module auto-loading.
389
393
 
@@ -17,7 +17,7 @@ For example, 40% of the `anthropic/claude-sonnet-5-5` window is 400,000 tokens.
17
17
  For `openai/gpt-6.1-sol`, 40% is 108,800 tokens.
18
18
  An absolute budget states the token count directly.
19
19
 
20
- ## The OpenAI pricing cliff
20
+ ## OpenAI long-context pricing
21
21
 
22
22
  For `openai/gpt-6.1-sol`, a request above 272,000 input tokens uses long-context
23
23
  rates for the full request. The input and cache rates double.
@@ -32,18 +32,14 @@ The registered rates in dollars per million tokens are:
32
32
  | Cache write | 2.50 | 5 |
33
33
 
34
34
  An agent loop resends the conversation on each turn.
35
- While the conversation stays above 272,000 input tokens, each request uses
36
- the long-context rates. The purpose of the built-in default budget is to
37
- pause the orchestrator before a request crosses this boundary.
35
+ A prompt cache hit can lower the cost of reused input tokens.
36
+ Cached tokens still count toward the pricing boundary and the context window.
38
37
 
39
- ## Defaults
38
+ ## Default
40
39
 
41
- - **256,000** — the built-in default, ≈16K under the 272K boundary
42
- so the pause turn and the handoff brief itself stay on
43
- short-context rates.
44
- - **`anthropic/.*` → 400,000** — a built-in override for Anthropic
45
- models, preserving continuity with the previous 40%-of-1M default
46
- on flagship Claude.
40
+ The built-in budget is **400,000 tokens** for every provider.
41
+ The [clamp](#the-clamp) can lower the effective budget for smaller windows.
42
+ The budget is a pause threshold, not a price limit.
47
43
 
48
44
  ## Configuration
49
45
 
@@ -60,38 +56,32 @@ or an object:
60
56
  ```json
61
57
  {
62
58
  "contextBudget": {
63
- "tokens": 256000,
59
+ "tokens": 350000,
64
60
  "overrides": [
65
- { "match": "openai/gpt-6\\.1-sol", "tokens": 240000 },
66
- { "match": "anthropic/.*", "tokens": 400000 }
61
+ { "match": "openai/gpt-6\\.1-sol", "tokens": 240000 }
67
62
  ]
68
63
  }
69
64
  }
70
65
  ```
71
66
 
72
- Each override's `match` is an anchored regex tested against the full
73
- `provider/id` spec. The FIRST matching override wins, in config
74
- order. Precedence overall: user override → user scalar (`tokens`) →
75
- built-in `anthropic/.*` rule → built-in default. Invalid input is
76
- warned about and never silently changes behavior; what applies
77
- afterwards depends on where the damage is:
67
+ Each override's `match` is a regular expression that matches the full
68
+ `provider/id` value. Slate uses the first matching override in file order.
69
+ Without a match, Slate uses `tokens` if set, or the built-in default.
70
+ Slate warns about invalid input:
78
71
 
79
72
  - An invalid WHOLE value (bad number, wrong type) is treated as if
80
73
  `contextBudget` were unset: legacy percent mode if
81
- `pauseThresholdPercent` is configured, built-in budget defaults
82
- otherwise.
83
- - An invalid `tokens` inside an otherwise valid object is dropped —
84
- the object still opts into budget mode, so the built-in defaults
85
- fill the scalar layer.
86
- - An invalid override entry is skipped — the next layer of the
87
- precedence chain applies.
74
+ `pauseThresholdPercent` is configured, or the built-in budget otherwise.
75
+ - Slate drops an invalid `tokens` value from an otherwise valid object.
76
+ The object still selects budget mode.
77
+ - Slate skips an invalid override entry.
88
78
 
89
79
  Legacy note: `pauseThresholdPercent` is deprecated; it keeps its
90
80
  exact old semantics only when it is set AND `contextBudget` is
91
81
  absent or entirely invalid — an invalid budget sanitizes to absent
92
82
  and never disables the percent. A PARTIALLY invalid object (e.g.
93
83
  `{"tokens": -1}`) remains a valid budget object: budget mode with
94
- built-in defaults, percent ignored.
84
+ the built-in budget, percent ignored.
95
85
 
96
86
  ## The clamp
97
87
 
@@ -113,16 +103,20 @@ immediately but mid-session settings-file edits do not. If the settings reader
113
103
  fails, Slate keeps its fallback of 16,384. The formula and half-window floor
114
104
  above remain unchanged.
115
105
 
116
- | Context window | Effective budget |
106
+ With the built-in budget and the default compaction reserve:
107
+
108
+ | Context window (tokens) | Effective budget (tokens) |
117
109
  | --- | --- |
118
- | 200K | 150,848 |
119
- | 272K | 222,848 |
120
- | 400K | 256,000 (default binds) |
121
- | 1M (Anthropic) | 400,000 |
110
+ | 200,000 | 150,848 |
111
+ | 272,000 | 222,848 |
112
+ | 400,000 | 350,848 |
113
+ | 1,000,000 | 400,000 |
122
114
 
123
- Rationale: the clamp guarantees the pause fires before pi's
124
- auto-compaction and leaves room to write the handoff brief; the
125
- half-window floor keeps small-window models usable.
115
+ The clamp subtracts a 32,768-token margin from Pi's compaction threshold
116
+ (the context window minus the reserve). The half-window floor can reduce
117
+ this margin. With a large reserve, the floor can put the pause threshold
118
+ above Pi's compaction threshold. Slate can cancel the first threshold
119
+ compaction and pause instead. This does not guarantee room for the brief.
126
120
 
127
121
  ## Writing-reminder cadence
128
122
 
@@ -203,28 +197,28 @@ characters. Tool names use 64 characters. Descriptions use 140 characters.
203
197
 
204
198
  | fixture | paths | portable characters | lines |
205
199
  | --- | ---: | ---: | ---: |
206
- | shipped logical section | 0 | 3,803 | 9 |
207
- | trusted shipped-default doctrine | 5 | 8,611 | 72 |
200
+ | shipped logical section | 0 | 4,528 | 9 |
201
+ | trusted shipped-default doctrine | 5 | 9,336 | 72 |
208
202
  | untrusted doctrine without a home configuration file | 4 | 2,711 | 33 |
209
- | draft pull requests, shipped policy | 6 | 8,681 | 73 |
210
- | capped workers, shipped policy | 5 | 9,958 | 82 |
211
- | draft plus capped workers | 6 | 10,028 | 83 |
212
- | deferred issues plus capped workers | 5 | 10,032 | 83 |
213
- | routing recommendations plus capped workers | 5 | 10,011 | 83 |
214
- | draft plus deferred issues and capped workers | 6 | 10,102 | 84 |
215
- | draft plus routing recommendations and capped workers | 6 | 10,077 | 84 |
216
- | deferred issues plus routing recommendations and capped workers | 5 | 10,085 | 84 |
217
- | canonical maximal baseline with all workflow options | 6 | 10,151 | 85 |
218
- | maximal baseline with an open change | 6 | 10,349 | 86 |
219
- | maximal baseline with source and legacy root log | 6 | 10,579 | 88 |
220
- | dogfood `.pi/slate.json` and its two extension units | 6 | 9,276 | 84 |
203
+ | draft pull requests, shipped policy | 6 | 9,406 | 73 |
204
+ | capped workers, shipped policy | 5 | 10,683 | 82 |
205
+ | draft plus capped workers | 6 | 10,753 | 83 |
206
+ | deferred issues plus capped workers | 5 | 10,757 | 83 |
207
+ | routing recommendations plus capped workers | 5 | 10,736 | 83 |
208
+ | draft plus deferred issues and capped workers | 6 | 10,827 | 84 |
209
+ | draft plus routing recommendations and capped workers | 6 | 10,802 | 84 |
210
+ | deferred issues plus routing recommendations and capped workers | 5 | 10,810 | 84 |
211
+ | canonical maximal baseline with all workflow options | 6 | 10,876 | 85 |
212
+ | maximal baseline with an open change | 6 | 11,074 | 86 |
213
+ | maximal baseline with source and legacy root log | 6 | 11,304 | 88 |
214
+ | dogfood `.pi/slate.json` and its two extension units | 6 | 10,001 | 84 |
221
215
  | runtime boundary plus draft and capped workers, source and legacy log | 6 | 26,053 | 86 |
222
216
  | runtime boundary plus draft and deferred issues, source and legacy log | 6 | 26,127 | 87 |
223
217
  | runtime boundary plus routing recommendations, source and legacy log | 5 | 26,036 | 86 |
224
218
  | runtime boundary plus deferred issues and routing recommendations, source and legacy log | 5 | 26,110 | 87 |
225
219
  | runtime boundary plus draft and routing recommendations, source and legacy log | 6 | 26,102 | 87 |
226
220
  | same boundary composition plus deferred issues | 6 | 26,176 | 88 |
227
- | valid shipped policy plus 88 capped worker tools, source and legacy log | 6 | 28,253 | 171 |
221
+ | valid shipped policy plus 88 capped worker tools, source and legacy log | 6 | 28,978 | 171 |
228
222
 
229
223
  An untrusted session with an empty home `slate.json` receives the same doctrine
230
224
  as the trusted shipped-default fixture above. It includes routing and writing
@@ -235,7 +229,7 @@ project preferences can.
235
229
  The canonical maximal baseline uses all four default logical models, all
236
230
  three workflow options, and the fixed capped worker roster. Its largest variant
237
231
  has an open change, one direct source folder, and a legacy root log. Its
238
- five-percent requirement is `ceil(10,579 × 1.05) = 11,108`.
232
+ five-percent requirement is `ceil(11,304 × 1.05) = 11,870`.
239
233
  The 26,300 whole-doctrine ceiling exceeds it. The table pins all eight
240
234
  combinations of the three workflow options with the capped worker roster. The
241
235
  dogfood row reads the actual project configuration. A change to `.pi/slate.json` requires a fresh render.
@@ -252,8 +246,8 @@ the first value beyond the ceiling.
252
246
 
253
247
  The over-cap counterfactual uses a valid shipped logical policy and one supported
254
248
  worker-extension unit with 88 capped tools. It also includes an open change,
255
- its source, and the legacy root log. Its 28,253 portable characters exceed
256
- the whole-doctrine ceiling by 1,953. The check therefore detects whole-doctrine
249
+ its source, and the legacy root log. Its 28,978 portable characters exceed
250
+ the whole-doctrine ceiling by 2,678. The check therefore detects whole-doctrine
257
251
  growth without using a retired model-row shape or an assumed per-tool increment.
258
252
  Worker-extension doctrine has no runtime size cap, so the fixture reaches the
259
253
  whole-doctrine guard rather than failing logical-policy validation first.
@@ -268,8 +262,8 @@ Check the phase-row table with `test/workflow-context-budget.test.ts`.
268
262
  The logical-section limits remain 19,400 characters and 105 lines. The
269
263
  all-tail limit remains 24,600 characters. The whole-doctrine ceiling is 26,300 characters.
270
264
 
271
- The shipped model policy section has a separate limit of 3,994 portable
272
- characters and 9 lines. The character limit is the measured 3,803 characters
265
+ The shipped model policy section has a separate limit of 4,755 portable
266
+ characters and 9 lines. The character limit is the measured 4,528 characters
273
267
  plus five percent reserve, rounded up. The line limit has no reserve.
274
268
  A fifth default model needs a new user approval. A higher limit requires a new user
275
269
  approval.
@@ -516,26 +510,20 @@ compression request uses a context window of at least 1,050,000 tokens, as
516
510
 
517
511
  ## Accepted limitations
518
512
 
519
- - When context is near the 256,000-token default, one turn that adds more
520
- than 16,000 tokens can cross 272,000 input tokens and incur long-context rates.
521
- This applies to `openai/gpt-6.1-sol` after the `modelOverrides` step in
522
- § "Using GPT-6.1 Sol's full 1.05M window" if the default budget stays.
523
- With the default compaction reserve, the clamp keeps that budget at 256,000.
524
- With the registered 272,000-token window, the clamp instead gives 222,848,
525
- so this limitation does not apply there. Override to 240,000 to increase
526
- the margin.
527
- - The 32K margin in the clamp covers typical turns, not extreme
528
- single-turn ingestion (several parallel large file reads) — hand
529
- off earlier or set a lower override when running tier-priced
530
- models hard.
531
- - The pause-fires-before-compaction guarantee holds for single-turn
532
- ingestion under 32,768 tokens — and only where the margin branch
533
- of the clamp binds (context window ≥ ~98K with the default
534
- 16,384-token reserve); on smaller, floor-clamped windows the
535
- pre-compaction margin is narrower. Beyond the margin a pass-through
536
- compaction can land in the same cycle and the handoff brief is
537
- written from compacted context — episodes and thread state survive
538
- on disk, so handoff still functions.
513
+ - If the effective pause threshold exceeds the active model's pricing
514
+ boundary, a request can use the higher rates before Slate pauses.
515
+ This can happen with an expanded window or a larger registered window.
516
+ For example, Pi registers `openai-codex/gpt-6.1-sol` with a 500,000-token
517
+ window. With the default reserve, the built-in pause threshold is 400,000
518
+ tokens, above the pricing boundary of 272,000 input tokens.
519
+ To leave more room before the boundary, set a lower budget, such as
520
+ 240,000 tokens. Match the override to the active `provider/id`.
521
+ The example override matches only `openai/gpt-6.1-sol`.
522
+ One large turn can still cross the pricing boundary before the pause.
523
+ - A large turn can cross both the pause and compaction thresholds.
524
+ If Slate has already paused, Pi can compact the context before the
525
+ orchestrator writes the handoff brief. Episodes and thread state remain
526
+ on disk.
539
527
  - The doctrine sizes above cover the stated fixtures only. A project that
540
528
  injects `doctrineExtraPath` or `orchestratorPromptDocs` pays for those on top.
541
529
  A larger worker-extension roster also adds context beyond the representative
@@ -581,42 +569,42 @@ reads. Any subset fits because removing ranges cannot increase union size.
581
569
 
582
570
  | Phase | Publishing | Plan | Required bytes | Estimated tokens | Byte limit | Token limit | Conditional maximum bytes | Estimated tokens | Byte limit | Token limit |
583
571
  | --- | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
584
- | 1. Research | off | ordinary | 75714 | 18929 | 76835 | 19209 | 144697 | 36175 | 145471 | 36368 |
585
- | 1. Research | off | nested | 90999 | 22750 | 129137 | 32285 | 159982 | 39996 | 197773 | 49444 |
586
- | 1. Research | on | ordinary | 87226 | 21807 | 92700 | 23175 | 156209 | 39053 | 161336 | 40334 |
587
- | 1. Research | on | nested | 102511 | 25628 | 145981 | 36496 | 171494 | 42874 | 214617 | 53655 |
588
- | 2. Risk assessment | off | ordinary | 112107 | 28027 | 114401 | 28601 | 181090 | 45273 | 183038 | 45760 |
589
- | 2. Risk assessment | off | nested | 127392 | 31848 | 167682 | 41921 | 196375 | 49094 | 236319 | 59080 |
590
- | 2. Risk assessment | on | ordinary | 123619 | 30905 | 131245 | 32812 | 192602 | 48151 | 199882 | 49971 |
591
- | 2. Risk assessment | on | nested | 138904 | 34726 | 184526 | 46132 | 207887 | 51972 | 253163 | 63291 |
592
- | 3. Design validation | off | ordinary | 112107 | 28027 | 114401 | 28601 | 181090 | 45273 | 183038 | 45760 |
593
- | 3. Design validation | off | nested | 127392 | 31848 | 167682 | 41921 | 196375 | 49094 | 236319 | 59080 |
594
- | 3. Design validation | on | ordinary | 123619 | 30905 | 131245 | 32812 | 192602 | 48151 | 199882 | 49971 |
595
- | 3. Design validation | on | nested | 138904 | 34726 | 184526 | 46132 | 207887 | 51972 | 253163 | 63291 |
596
- | 4. Focus reconfirmation | off | ordinary | 112107 | 28027 | 114401 | 28601 | 181090 | 45273 | 183038 | 45760 |
597
- | 4. Focus reconfirmation | off | nested | 127392 | 31848 | 167682 | 41921 | 196375 | 49094 | 236319 | 59080 |
598
- | 4. Focus reconfirmation | on | ordinary | 123619 | 30905 | 131245 | 32812 | 192602 | 48151 | 199882 | 49971 |
599
- | 4. Focus reconfirmation | on | nested | 138904 | 34726 | 184526 | 46132 | 207887 | 51972 | 253163 | 63291 |
600
- | 5. Adversarial design review | off | ordinary | 135022 | 33756 | 138753 | 34689 | 231789 | 57948 | 236562 | 59141 |
601
- | 5. Adversarial design review | off | nested | 150307 | 37577 | 192034 | 48009 | 247074 | 61769 | 289844 | 72461 |
602
- | 5. Adversarial design review | on | ordinary | 146534 | 36634 | 155597 | 38900 | 243301 | 60826 | 253406 | 63352 |
603
- | 5. Adversarial design review | on | nested | 161819 | 40455 | 208878 | 52220 | 258586 | 64647 | 306688 | 76672 |
604
- | 6. Final design approval | off | ordinary | 135022 | 33756 | 138753 | 34689 | 231789 | 57948 | 236562 | 59141 |
605
- | 6. Final design approval | off | nested | 150307 | 37577 | 192034 | 48009 | 247074 | 61769 | 289844 | 72461 |
606
- | 6. Final design approval | on | ordinary | 146534 | 36634 | 155597 | 38900 | 243301 | 60826 | 253406 | 63352 |
607
- | 6. Final design approval | on | nested | 161819 | 40455 | 208878 | 52220 | 258586 | 64647 | 306688 | 76672 |
608
- | 7. Track loop | off | ordinary | 158217 | 39555 | 163384 | 40846 | 259621 | 64906 | 302924 | 75731 |
609
- | 7. Track loop | off | nested | 173502 | 43376 | 216665 | 54167 | 259621 | 64906 | 302924 | 75731 |
610
- | 7. Track loop | on | ordinary | 169729 | 42433 | 180228 | 45057 | 271133 | 67784 | 319769 | 79943 |
611
- | 7. Track loop | on | nested | 185014 | 46254 | 233509 | 58378 | 271133 | 67784 | 319769 | 79943 |
612
- | 8. Final acceptance | off | ordinary | 158217 | 39555 | 163384 | 40846 | 259621 | 64906 | 302924 | 75731 |
613
- | 8. Final acceptance | off | nested | 173502 | 43376 | 216665 | 54167 | 259621 | 64906 | 302924 | 75731 |
614
- | 8. Final acceptance | on | ordinary | 169729 | 42433 | 180228 | 45057 | 271133 | 67784 | 319769 | 79943 |
615
- | 8. Final acceptance | on | nested | 185014 | 46254 | 233509 | 58378 | 271133 | 67784 | 319769 | 79943 |
616
- | 9. Delivery | off | ordinary | 158217 | 39555 | 163384 | 40846 | 259621 | 64906 | 302924 | 75731 |
617
- | 9. Delivery | off | nested | 173502 | 43376 | 216665 | 54167 | 259621 | 64906 | 302924 | 75731 |
618
- | 9. Delivery | on | ordinary | 169729 | 42433 | 180228 | 45057 | 271133 | 67784 | 319769 | 79943 |
619
- | 9. Delivery | on | nested | 185014 | 46254 | 233509 | 58378 | 271133 | 67784 | 319769 | 79943 |
572
+ | 1. Research | off | ordinary | 76439 | 19110 | 76835 | 19209 | 145422 | 36356 | 145471 | 36368 |
573
+ | 1. Research | off | nested | 91724 | 22931 | 129137 | 32285 | 160707 | 40177 | 197773 | 49444 |
574
+ | 1. Research | on | ordinary | 87951 | 21988 | 92700 | 23175 | 156934 | 39234 | 161336 | 40334 |
575
+ | 1. Research | on | nested | 103236 | 25809 | 145981 | 36496 | 172219 | 43055 | 214617 | 53655 |
576
+ | 2. Risk assessment | off | ordinary | 112832 | 28208 | 114401 | 28601 | 181815 | 45454 | 183038 | 45760 |
577
+ | 2. Risk assessment | off | nested | 128117 | 32030 | 167682 | 41921 | 197100 | 49275 | 236319 | 59080 |
578
+ | 2. Risk assessment | on | ordinary | 124344 | 31086 | 131245 | 32812 | 193327 | 48332 | 199882 | 49971 |
579
+ | 2. Risk assessment | on | nested | 139629 | 34908 | 184526 | 46132 | 208612 | 52153 | 253163 | 63291 |
580
+ | 3. Design validation | off | ordinary | 112832 | 28208 | 114401 | 28601 | 181815 | 45454 | 183038 | 45760 |
581
+ | 3. Design validation | off | nested | 128117 | 32030 | 167682 | 41921 | 197100 | 49275 | 236319 | 59080 |
582
+ | 3. Design validation | on | ordinary | 124344 | 31086 | 131245 | 32812 | 193327 | 48332 | 199882 | 49971 |
583
+ | 3. Design validation | on | nested | 139629 | 34908 | 184526 | 46132 | 208612 | 52153 | 253163 | 63291 |
584
+ | 4. Focus reconfirmation | off | ordinary | 112832 | 28208 | 114401 | 28601 | 181815 | 45454 | 183038 | 45760 |
585
+ | 4. Focus reconfirmation | off | nested | 128117 | 32030 | 167682 | 41921 | 197100 | 49275 | 236319 | 59080 |
586
+ | 4. Focus reconfirmation | on | ordinary | 124344 | 31086 | 131245 | 32812 | 193327 | 48332 | 199882 | 49971 |
587
+ | 4. Focus reconfirmation | on | nested | 139629 | 34908 | 184526 | 46132 | 208612 | 52153 | 253163 | 63291 |
588
+ | 5. Adversarial design review | off | ordinary | 135747 | 33937 | 138753 | 34689 | 232514 | 58129 | 236562 | 59141 |
589
+ | 5. Adversarial design review | off | nested | 151032 | 37758 | 192034 | 48009 | 247799 | 61950 | 289844 | 72461 |
590
+ | 5. Adversarial design review | on | ordinary | 147259 | 36815 | 155597 | 38900 | 244026 | 61007 | 253406 | 63352 |
591
+ | 5. Adversarial design review | on | nested | 162544 | 40636 | 208878 | 52220 | 259311 | 64828 | 306688 | 76672 |
592
+ | 6. Final design approval | off | ordinary | 135747 | 33937 | 138753 | 34689 | 232514 | 58129 | 236562 | 59141 |
593
+ | 6. Final design approval | off | nested | 151032 | 37758 | 192034 | 48009 | 247799 | 61950 | 289844 | 72461 |
594
+ | 6. Final design approval | on | ordinary | 147259 | 36815 | 155597 | 38900 | 244026 | 61007 | 253406 | 63352 |
595
+ | 6. Final design approval | on | nested | 162544 | 40636 | 208878 | 52220 | 259311 | 64828 | 306688 | 76672 |
596
+ | 7. Track loop | off | ordinary | 158942 | 39736 | 163384 | 40846 | 260346 | 65087 | 302924 | 75731 |
597
+ | 7. Track loop | off | nested | 174227 | 43557 | 216665 | 54167 | 260346 | 65087 | 302924 | 75731 |
598
+ | 7. Track loop | on | ordinary | 170454 | 42614 | 180228 | 45057 | 271858 | 67965 | 319769 | 79943 |
599
+ | 7. Track loop | on | nested | 185739 | 46435 | 233509 | 58378 | 271858 | 67965 | 319769 | 79943 |
600
+ | 8. Final acceptance | off | ordinary | 158942 | 39736 | 163384 | 40846 | 260346 | 65087 | 302924 | 75731 |
601
+ | 8. Final acceptance | off | nested | 174227 | 43557 | 216665 | 54167 | 260346 | 65087 | 302924 | 75731 |
602
+ | 8. Final acceptance | on | ordinary | 170454 | 42614 | 180228 | 45057 | 271858 | 67965 | 319769 | 79943 |
603
+ | 8. Final acceptance | on | nested | 185739 | 46435 | 233509 | 58378 | 271858 | 67965 | 319769 | 79943 |
604
+ | 9. Delivery | off | ordinary | 158942 | 39736 | 163384 | 40846 | 260346 | 65087 | 302924 | 75731 |
605
+ | 9. Delivery | off | nested | 174227 | 43557 | 216665 | 54167 | 260346 | 65087 | 302924 | 75731 |
606
+ | 9. Delivery | on | ordinary | 170454 | 42614 | 180228 | 45057 | 271858 | 67965 | 319769 | 79943 |
607
+ | 9. Delivery | on | nested | 185739 | 46435 | 233509 | 58378 | 271858 | 67965 | 319769 | 79943 |
620
608
 
621
609
  Conditional sets have the following whole-document costs. Early notes cost
622
610
  zero extra after required notes enter phase 7. Unusual prose costs zero extra
@@ -100,8 +100,10 @@ Luna uses these cautions in order:
100
100
  2. `Do not use Luna to handle complex texts.`
101
101
  3. `May shorten long file paths in tool calls. Give the full path and require a read-back of the edited lines.`
102
102
  4. `May undo its own checked writes before it ends. Check the final file state after every record task.`
103
- 5. `For an append, anchor one single-block edit on the exact current last line, then read back the tail.`
103
+ 5. `For an append outside a research log or implementer report, anchor one single-block edit on the exact current last line, then read back the tail.`
104
104
  6. `May report state outside the task scope incorrectly. Verify such a claim before acting on it.`
105
+ 7. `May change apostrophe or backslash characters, or omit text, when it stages supplied text. Its own comparison with the staged file cannot detect this. Require a quoted heredoc or the file-writing tool, a stated line count and a read-back against the task text.`
106
+ 8. `For an append with cat, name exactly one source file in the command.`
105
107
 
106
108
  Sol uses these cautions in order:
107
109
 
@@ -109,6 +111,8 @@ Sol uses these cautions in order:
109
111
  2. `Broad searches can return text from excluded private paths. State path limits in the task and use path-limited commands.`
110
112
  3. `For cross-runtime process and networking fixes, verify exit, slot ownership and silent output on every supported runtime before closing the repair.`
111
113
  4. `When shortening text to fit a size budget, may drop or weaken duties. Require a duty-by-duty comparison of the text before and after the cut.`
114
+ 5. `As reviewer or fix gate, may judge runtime behavior from source reading alone. When a run is available, name it in the task and require a reproduced run for each blocker or major runtime claim.`
115
+ 6. `For verify-then-edit work, may edit first or accept a related passing check as proof. Require the measured evidence for each claim before the edit.`
112
116
 
113
117
  Flash uses this caution: `Do not use as a reviewer. It relies too much on passing tests and exact-size assertions. Verify source citations and distinguish proposed behavior from existing behavior.`
114
118
 
@@ -388,7 +392,7 @@ for an unknown or ambiguous route. Main recovery stays available during handoff
388
392
  pause. An unresolved stop keeps worker dispatch paused while brief writing waits
389
393
  for the user choice.
390
394
 
391
- Pi 1.5.2 model and effort switches are session-only unless the caller explicitly
395
+ Pi 1.6.0 model and effort switches are session-only unless the caller explicitly
392
396
  requests persistence. Slate retains shared saved-default ownership and its
393
397
  compatibility restoration guard. The guard covers explicit persistence and
394
398
  hosts that persist switches. A restoration failure is visible and can leave the
@@ -37,7 +37,7 @@ Main recovery sends hidden `slate-failover` instructions with a unique `details.
37
37
  Only the matching message start produces the continuation status, at most once.
38
38
  Aborted, cancelled, replaced, or paused attempts produce no such status.
39
39
  The acknowledgement does not itself prove recovery success or release recovery ownership.
40
- Pi 1.5.2's ordinary extension send returns no delivery promise.
40
+ Pi 1.6.0's ordinary extension send returns no delivery promise.
41
41
  A deferred preparation failure can escape extension observation.
42
42
  Remote procedure call (RPC) mode can suppress that late caller error.
43
43
  Slate does not claim all-mode detection of a continuation that never starts.
@@ -2,12 +2,13 @@
2
2
  * Auto-pause + handoff: context-budget discipline for the orchestrator.
3
3
  *
4
4
  * Monitoring: after every turn, when orchestrator mode is on and context
5
- * usage crosses the absolute token budget (contextBudget; built-in defaults
6
- * 256k tokens, 400k for anthropic/* models, clamped so the pause always
7
- * lands with brief-writing room below pi's own compaction point), the store
8
- * is paused — orchestrator worker dispatches remain available, while new user
9
- * prompts are refused by the input hook — and the orchestrator is steered to
10
- * prepare a handoff brief for the user. Threshold auto-compactions are intercepted the same way
5
+ * usage reaches the absolute token budget, Slate pauses the orchestrator.
6
+ * The built-in budget is 400,000 tokens for every model. The clamp subtracts
7
+ * the compaction reserve and a margin from the window. A large reserve can
8
+ * make the half-window floor put the pause threshold above Pi's compaction threshold.
9
+ * Orchestrator worker dispatches remain available, but the input hook
10
+ * refuses new user prompts. Slate asks the orchestrator to prepare a handoff
11
+ * brief for the user. Threshold auto-compactions are intercepted the same way
11
12
  * (session_before_compact → pause + cancel); once paused they pass through
12
13
  * as the escape valve. The DEPRECATED pauseThresholdPercent keeps its exact
13
14
  * legacy percent behavior (compaction untouched) when set WITHOUT
@@ -29,8 +30,10 @@
29
30
  * the orchestrator's base model, unlike a failover fallback.
30
31
  */
31
32
 
32
- import { existsSync, readFileSync } from "node:fs";
33
- import { join } from "node:path";
33
+ import { randomUUID } from "node:crypto";
34
+ import { closeSync, existsSync, fstatSync, openSync, readFileSync, statSync, unlinkSync, writeFileSync } from "node:fs";
35
+ import { dirname, join } from "node:path";
36
+ import { setTimeout as delay } from "node:timers/promises";
34
37
  import {
35
38
  CONFIG_DIR_NAME,
36
39
  getAgentDir,
@@ -57,11 +60,7 @@ import {
57
60
 
58
61
  /** Legacy percent mode only (DEPRECATED pauseThresholdPercent without contextBudget). */
59
62
  const DEFAULT_PAUSE_THRESHOLD_PERCENT = 40;
60
- /** Budget-mode default for models without a configured or built-in override. */
61
- const DEFAULT_CONTEXT_BUDGET_TOKENS = 256_000;
62
- /** Built-in override: anthropic/* models get a larger default budget. */
63
- const ANTHROPIC_DEFAULT_BUDGET_TOKENS = 400_000;
64
- const ANTHROPIC_MODEL_RE = /^anthropic\/.*/;
63
+ const DEFAULT_CONTEXT_BUDGET_TOKENS = 400_000;
65
64
  /**
66
65
  * Head-room subtracted (together with pi's compaction reserveTokens) from the
67
66
  * context window when clamping the budget: the pause must land with enough
@@ -210,8 +209,8 @@ function budgetModeActive(config: SlateConfig): boolean {
210
209
  }
211
210
 
212
211
  /**
213
- * Resolve the budget for one "provider/id" spec. Lattice: first matching
214
- * user override → user scalar → built-in anthropic rule → global default.
212
+ * Resolve the budget for one "provider/id" spec. Use the first matching
213
+ * override, then the configured token count, then the built-in default.
215
214
  * Runs against the LIVE model on EVERY check — failover, /model, and handoff
216
215
  * restore can all swap models mid-session, so the result is never cached.
217
216
  */
@@ -221,7 +220,6 @@ function resolveBudgetTokens(budget: ContextBudgetObject | undefined, modelSpec:
221
220
  if (new RegExp(`^(?:${o.match})$`).test(modelSpec)) return o.tokens;
222
221
  }
223
222
  if (budget?.tokens !== undefined) return budget.tokens;
224
- if (ANTHROPIC_MODEL_RE.test(modelSpec)) return ANTHROPIC_DEFAULT_BUDGET_TOKENS;
225
223
  return DEFAULT_CONTEXT_BUDGET_TOKENS;
226
224
  }
227
225
 
@@ -288,8 +286,8 @@ function buildKickoff(cwd: string, trusted: boolean, brief: string, focus?: stri
288
286
  if (!base) {
289
287
  base = [
290
288
  "Slate orchestrator handoff.",
291
- "Orchestrator mode and all worker threads/episodes from the previous session are restored:",
292
- "use `threads` to list them and `episode` to fetch details. Continue the work.",
289
+ "Orchestrator mode and all worker threads and episodes from the previous session are restored.",
290
+ "Continue the work.",
293
291
  ].join("\n");
294
292
  }
295
293
  const parts = [base];
@@ -298,6 +296,44 @@ function buildKickoff(cwd: string, trusted: boolean, brief: string, focus?: stri
298
296
  return parts.join("\n");
299
297
  }
300
298
 
299
+ const SESSION_CLOCK_LIMIT_MS = 3_000;
300
+ const SESSION_CLOCK_POLL_MS = 10;
301
+
302
+ async function waitForSessionClock(ctx: ExtensionContext, parentFile: string | undefined): Promise<void> {
303
+ if (!parentFile) return;
304
+ try {
305
+ const parent = statSync(parentFile, { throwIfNoEntry: false });
306
+ if (!parent) return;
307
+
308
+ // Pi sorts sessions by modification time. A tie can select the parent.
309
+ // Measure a write in the session directory before the successor writes.
310
+ const probe = join(dirname(parentFile), `.slate-handoff-clock-${randomUUID()}.tmp`);
311
+ const fd = openSync(probe, "wx", 0o600);
312
+ try {
313
+ const deadline = performance.now() + SESSION_CLOCK_LIMIT_MS;
314
+ while (performance.now() < deadline) {
315
+ writeFileSync(fd, ".");
316
+ if (fstatSync(fd).mtimeMs > parent.mtimeMs) return;
317
+ await delay(SESSION_CLOCK_POLL_MS);
318
+ }
319
+ } finally {
320
+ try {
321
+ closeSync(fd);
322
+ } catch (error) {
323
+ reportFailure(ctx, `slate: could not close the handoff clock probe: ${sanitizeForNotify(String(error))}`);
324
+ }
325
+ try {
326
+ unlinkSync(probe);
327
+ } catch (error) {
328
+ reportFailure(ctx, `slate: could not delete the handoff clock probe: ${sanitizeForNotify(String(error))}`);
329
+ }
330
+ }
331
+ reportFailure(ctx, `slate: the handoff session file clock did not advance within the ${SESSION_CLOCK_LIMIT_MS / 1_000}-second polling limit.`);
332
+ } catch (error) {
333
+ reportFailure(ctx, `slate: could not check the handoff session file clock: ${sanitizeForNotify(String(error))}`);
334
+ }
335
+ }
336
+
301
337
  type KickoffSender = (message: { customType: string; content: string; display: boolean; details?: { sessionId: string } }, options?: { triggerTurn?: boolean }) => void | Promise<void>;
302
338
 
303
339
  /** Claim delivery before starting a turn. A claimed kickoff is never replayed on reload. */
@@ -590,7 +626,7 @@ export function registerSlateHandoff(
590
626
  let adopted = false;
591
627
  try {
592
628
  // Keep the whole adoption block inside the compatibility restore guard.
593
- // Pi 1.5.2 extension setters are session-only, so this is normally a
629
+ // Pi 1.6.0 extension setters are session-only, so this is normally a
594
630
  // zero-write no-op. The guard covers hosts that persist switches,
595
631
  // including a thinking-level-only write.
596
632
  await withGlobalModelDefaultRestored(
@@ -599,7 +635,7 @@ export function registerSlateHandoff(
599
635
  getConfig(),
600
636
  { provider, id },
601
637
  async () => {
602
- // True once a Pi setter has been called. Pi 1.5.2 does not persist
638
+ // True once a Pi setter has been called. Pi 1.6.0 does not persist
603
639
  // this call. The compatibility guard also covers hosts where the call
604
640
  // can write a default.
605
641
  let calledSetter = false;
@@ -698,7 +734,13 @@ export function registerSlateHandoff(
698
734
  }
699
735
  });
700
736
 
701
- const performHandoff = async (ctx: ExtensionCommandContext, focus?: string, summaryVisible?: boolean, purpose?: HandoffPurpose): Promise<boolean> => {
737
+ const performHandoff = async (
738
+ ctx: ExtensionCommandContext,
739
+ focus: string | undefined,
740
+ summaryVisible: boolean | undefined,
741
+ purpose: HandoffPurpose,
742
+ onTransfer: (fresh: ExtensionContext) => void,
743
+ ): Promise<void> => {
702
744
  const brief = lastAssistantText(ctx);
703
745
  const parentSession = ctx.sessionManager.getSessionFile();
704
746
  // ctx.model can be undefined (no-model session): capture neither field
@@ -733,6 +775,9 @@ export function registerSlateHandoff(
733
775
  successor.appendCustomEntry("slate-handoff", entry as unknown as Record<string, unknown>);
734
776
  },
735
777
  withSession: async (fresh) => {
778
+ // Finish the parent write after setup and before kickoff.
779
+ onTransfer(fresh);
780
+ await waitForSessionClock(fresh, parentSession);
736
781
  await deliverKickoff(fresh, (message, options) => fresh.sendMessage(message, options));
737
782
  },
738
783
  });
@@ -742,7 +787,6 @@ export function registerSlateHandoff(
742
787
  store.save();
743
788
  if (ctx.hasUI) ctx.ui.notify("slate: handoff cancelled — pause cleared.", "warning");
744
789
  }
745
- return !cancelled;
746
790
  } catch (error) {
747
791
  // Best-effort: if the replacement partially happened, the old pi/ctx
748
792
  // are stale and these calls themselves throw.
@@ -774,10 +818,14 @@ export function registerSlateHandoff(
774
818
  const selected = purpose ?? retained ?? "user-request";
775
819
  pi.appendEntry("slate-handoff-purpose", { sessionId, purpose: selected });
776
820
  await ctx.waitForIdle();
777
- const transferred = await performHandoff(ctx, focus, summaryVisible, selected);
778
- if (transferred && parentManager instanceof SessionManager) {
779
- parentManager.appendCustomEntry("slate-handoff-purpose", { sessionId, purpose: selected, consumed: true });
780
- }
821
+ await performHandoff(ctx, focus, summaryVisible, selected, (fresh) => {
822
+ if (!(parentManager instanceof SessionManager)) return;
823
+ try {
824
+ parentManager.appendCustomEntry("slate-handoff-purpose", { sessionId, purpose: selected, consumed: true });
825
+ } catch (error) {
826
+ reportFailure(fresh, `slate: could not record the handoff purpose as consumed: ${sanitizeForNotify(String(error))}`);
827
+ }
828
+ });
781
829
  });
782
830
  };
783
831
 
@@ -60,6 +60,8 @@ function deepFreeze<T>(value: T): T {
60
60
 
61
61
  const SONNET_OPUS_CAUTION = "May exceed explicit scope or infer permission from earlier requests. Check changes against stated exclusions and approval requirements.";
62
62
  const SOL_CAUTION = "When blocked, may substitute unapproved resources or perform destructive cleanup. Require permission before either action. Do not run a dependency install that the project rules forbid. Ask first.";
63
+ const SOL_REVIEW_CAUTION = "As reviewer or fix gate, may judge runtime behavior from source reading alone. When a run is available, name it in the task and require a reproduced run for each blocker or major runtime claim.";
64
+ const SOL_VERIFY_CAUTION = "For verify-then-edit work, may edit first or accept a related passing check as proof. Require the measured evidence for each claim before the edit.";
63
65
  const LUNA_CAUTION = "May treat supplied repair context as permission to implement despite explicit task limits. Restrict write access for record-only work and verify the changed files.";
64
66
  const FLASH_CAUTION = "Do not use as a reviewer. It relies too much on passing tests and exact-size assertions. Verify source citations and distinguish proposed behavior from existing behavior.";
65
67
 
@@ -93,7 +95,7 @@ const SHIPPED_DEFINITIONS: LogicalModelDefinition[] = [
93
95
  model: "luna-6", capabilityRating: 35, effort: "max", costRating: 2,
94
96
  preferredProvider: "openai", providers: providers("openai", "gpt-6-luna"),
95
97
  guidelines: ["auxiliary tasks only, such as file location, check-result collection, or routine text management such as modifying research logs", "never primary research, implementation, design, or review", "consumer-contract work only when auxiliary"],
96
- cautions: [LUNA_CAUTION, "Do not use Luna to handle complex texts.", "May shorten long file paths in tool calls. Give the full path and require a read-back of the edited lines.", "May undo its own checked writes before it ends. Check the final file state after every record task.", "For an append, anchor one single-block edit on the exact current last line, then read back the tail.", "May report state outside the task scope incorrectly. Verify such a claim before acting on it."], source: source(),
98
+ cautions: [LUNA_CAUTION, "Do not use Luna to handle complex texts.", "May shorten long file paths in tool calls. Give the full path and require a read-back of the edited lines.", "May undo its own checked writes before it ends. Check the final file state after every record task.", "For an append outside a research log or implementer report, anchor one single-block edit on the exact current last line, then read back the tail.", "May report state outside the task scope incorrectly. Verify such a claim before acting on it.", "May change apostrophe or backslash characters, or omit text, when it stages supplied text. Its own comparison with the staged file cannot detect this. Require a quoted heredoc or the file-writing tool, a stated line count and a read-back against the task text.", "For an append with cat, name exactly one source file in the command."], source: source(),
97
99
  },
98
100
  {
99
101
  model: "claude-sonnet-5.5", capabilityRating: 35, effort: "high", costRating: 25,
@@ -103,7 +105,7 @@ const SHIPPED_DEFINITIONS: LogicalModelDefinition[] = [
103
105
  {
104
106
  model: "sol-6.1", capabilityRating: 66, effort: "high", costRating: 9,
105
107
  preferredProvider: "openai", providers: providers("openai", "gpt-6.1-sol"),
106
- guidelines: ["default thread choice"], cautions: [SOL_CAUTION, "Broad searches can return text from excluded private paths. State path limits in the task and use path-limited commands.", "For cross-runtime process and networking fixes, verify exit, slot ownership and silent output on every supported runtime before closing the repair.", "When shortening text to fit a size budget, may drop or weaken duties. Require a duty-by-duty comparison of the text before and after the cut."], source: source(true),
108
+ guidelines: ["default thread choice"], cautions: [SOL_CAUTION, "Broad searches can return text from excluded private paths. State path limits in the task and use path-limited commands.", "For cross-runtime process and networking fixes, verify exit, slot ownership and silent output on every supported runtime before closing the repair.", "When shortening text to fit a size budget, may drop or weaken duties. Require a duty-by-duty comparison of the text before and after the cut.", SOL_REVIEW_CAUTION, SOL_VERIFY_CAUTION], source: source(true),
107
109
  },
108
110
  {
109
111
  model: "gemini-3.8-flash", capabilityRating: 43, effort: "medium", costRating: 14,
@@ -130,7 +132,7 @@ const SHIPPED_DEFINITIONS: LogicalModelDefinition[] = [
130
132
  {
131
133
  model: "sol-6.2", capabilityRating: 73, effort: "high", costRating: 9,
132
134
  preferredProvider: "openai", providers: providers("openai", "gpt-6.2-sol"),
133
- guidelines: ["default thread choice"], cautions: [SOL_CAUTION, "Broad searches can return text from excluded private paths. State path limits in the task and use path-limited commands.", "For cross-runtime process and networking fixes, verify exit, slot ownership and silent output on every supported runtime before closing the repair.", "When shortening text to fit a size budget, may drop or weaken duties. Require a duty-by-duty comparison of the text before and after the cut."], source: { capabilityRating: { publisher: "Slate project", decided: "2026-11-18", basis: "Project judgment scaled from Sol 6.1 without a benchmark source" }, costRating: { publisher: "Slate project", decided: "2026-11-18", basis: "Project judgment copied from Sol 6.1 without a benchmark source" }, guidelines: fieldSource() },
135
+ guidelines: ["default thread choice"], cautions: [SOL_CAUTION, "Broad searches can return text from excluded private paths. State path limits in the task and use path-limited commands.", "For cross-runtime process and networking fixes, verify exit, slot ownership and silent output on every supported runtime before closing the repair.", "When shortening text to fit a size budget, may drop or weaken duties. Require a duty-by-duty comparison of the text before and after the cut.", SOL_REVIEW_CAUTION, SOL_VERIFY_CAUTION], source: { capabilityRating: { publisher: "Slate project", decided: "2026-11-18", basis: "Project judgment scaled from Sol 6.1 without a benchmark source" }, costRating: { publisher: "Slate project", decided: "2026-11-18", basis: "Project judgment copied from Sol 6.1 without a benchmark source" }, guidelines: fieldSource() },
134
136
  },
135
137
  {
136
138
  model: "astra-6.2", capabilityRating: 80, effort: "high", costRating: 19,
package/extension/mode.ts CHANGED
@@ -586,7 +586,7 @@ export function registerSlateMode(
586
586
  if (store.orchestratorMode && choice.enabled) displaySummary(ctx);
587
587
  };
588
588
 
589
- // In pinned pi 1.5.2, AgentSession.prompt() handles registered extension
589
+ // In pinned pi 1.6.0, AgentSession.prompt() handles registered extension
590
590
  // commands before the input event. It returns when a command claims the text.
591
591
  // /slate resume and /slate handoff therefore never reach this handler.
592
592
  // Command matching is exact and case-sensitive. sendUserMessage() skips
@@ -2,7 +2,7 @@
2
2
  * Global model-default restore: put the user's GLOBAL pi defaults back after a
3
3
  * slate-initiated model switch.
4
4
  *
5
- * Pi 1.5.2 keeps ordinary extension model and thinking-level switches inside
5
+ * Pi 1.6.0 keeps ordinary extension model and thinking-level switches inside
6
6
  * the current session. AgentSession changes global defaults only when a caller
7
7
  * explicitly requests persistence. Slate requests no persistence. This guard
8
8
  * covers explicit persistence fixtures and hosts that persist switches. If a
@@ -86,7 +86,7 @@ type ThinkingLevel = ReturnType<ExtensionAPI["getThinkingLevel"]>;
86
86
  * busy-waits SYNCHRONOUSLY, so an attempt's cost is set by contention, not by
87
87
  * slate — a count-based bound would leave the stall unbounded.
88
88
  *
89
- * WORST-CASE STALL, derived from this file as written (pi 1.5.2: a contended
89
+ * WORST-CASE STALL, derived from this file as written (pi 1.6.0: a contended
90
90
  * acquisition makes ten attempts with nine 20 ms waits, about 180 ms):
91
91
  * five lock acquisitions per attempt — post-switch read (construction IS a
92
92
  * read), write-manager construction, the pair write, the separate
@@ -517,7 +517,7 @@ function switchMayHavePersisted<T>(predicate: ((result: T) => boolean) | undefin
517
517
  * `performSwitch` must contain every setter call for that switch.
518
518
  * The post-switch read must follow the last write.
519
519
  * Explicit persistence or a host that persists switches can write the thinking
520
- * default alone during handoff adoption. Ordinary pi 1.5.2 switches write no
520
+ * default alone during handoff adoption. Ordinary pi 1.6.0 switches write no
521
521
  * global defaults.
522
522
  *
523
523
  * The restore runs even when `performSwitch` throws.
@@ -17,8 +17,8 @@ export interface NativeNotificationOptions {
17
17
  readonly platform?: NodeJS.Platform;
18
18
  readonly environment?: Environment;
19
19
  }
20
- // Start-menu discovery supplies a registered application identity, not an invented sender name.
21
- // The folder is the one Get-StartApps enumerates. The first exact match in folder order wins.
20
+ // Search the Start applications folder for the first exact Windows PowerShell name match.
21
+ // If the name is absent, match the registered system Windows PowerShell identity.
22
22
  // Text enters XML only through text nodes. The interpreter receives fixed source only.
23
23
  const windowsScript = `
24
24
  $ErrorActionPreference = 'Stop'
@@ -29,6 +29,12 @@ $app = $null
29
29
  foreach ($item in $folder.Items()) {
30
30
  if ($item.Name -eq 'Windows PowerShell') { $app = $item; break }
31
31
  }
32
+ if (-not $app) {
33
+ $systemPowerShellId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe'
34
+ foreach ($item in $folder.Items()) {
35
+ if ([string]$item.Path -eq $systemPowerShellId) { $app = $item; break }
36
+ }
37
+ }
32
38
  if (-not $app -or [string]::IsNullOrWhiteSpace($app.Path)) { exit 1 }
33
39
  $appId = [string]$app.Path
34
40
  $null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
@@ -114,6 +114,7 @@ export function threadTypeMarker(type: ThreadType): string {
114
114
 
115
115
  export interface ThreadRecord {
116
116
  id: string; // "t1", "t2", ...
117
+ sessionId?: string;
117
118
  name: string;
118
119
  status: "queued" | "running" | "successful" | "failed" | "cancelled";
119
120
  /** Immutable thread type. */
@@ -499,6 +500,7 @@ export const ADOPTED_SNAPSHOT_FIELDS = {
499
500
 
500
501
  export const ADOPTED_THREAD_FIELDS = {
501
502
  id: true,
503
+ sessionId: true,
502
504
  name: true,
503
505
  status: true,
504
506
  type: true,
@@ -548,7 +550,7 @@ export const ADOPTED_EPISODE_FIELDS = {
548
550
  * So the checklist is also enforced against what the sanitizer actually BUILT: a field
549
551
  * the snapshot carries, that adoption claims to know, that the built record lacks, and
550
552
  * that was not deliberately refused (those are already reported by name) is a slate bug,
551
- * and it says so. Cheap — one pass over ten keys per record — and it fires on the first
553
+ * and it says so. It checks the known fields once per record and fires on the first
552
554
  * restore after the omission rather than whenever the missing data is next needed.
553
555
  *
554
556
  * Exported for the same reason as the checklists: a checker can drive it with a record
@@ -626,6 +628,7 @@ export function sanitizeThreadRecord(raw: unknown, repairs: string[]): ThreadRec
626
628
  const now = Date.now();
627
629
  const built: ThreadRecord = {
628
630
  id,
631
+ sessionId: keep("sessionId", t.sessionId, str(t.sessionId) || undefined),
629
632
  name,
630
633
  status: adoptedStatus,
631
634
  type,
@@ -823,7 +826,7 @@ export interface SlateConfig {
823
826
  requestThrottle?: RequestThrottleConfig | SanitizedRequestThrottle; // raw or session-sanitized per-model worker request pacing — see request-throttle.ts
824
827
  maxConcurrent?: number; // per-manager action cap, validated as a positive safe integer with fallback 8. See docs/design-principles.md §5.
825
828
  pauseThresholdPercent?: number; // DEPRECATED: legacy percent-based auto-pause (default 40); applies only when set AND contextBudget is absent or entirely invalid (invalid sanitizes to absent — a partially invalid object stays budget mode)
826
- contextBudget?: number | ContextBudgetObject; // absolute orchestrator token budget; bare number = { tokens: N }; {} opts into built-in defaults (256k, 400k for anthropic/*) — see handoff.ts
829
+ contextBudget?: number | ContextBudgetObject; // A number sets the token budget. An empty object uses the 400,000-token default.
827
830
  orchestratorModeDefault?: boolean; // seed orchestrator mode ON for fresh interactive sessions (unsaved until first real mutation)
828
831
  orchestratorPromptDocs?: string[]; // role-guideline docs appended to the orchestrator prompt (source-relative paths resolved by config.ts)
829
832
  workerPromptDocs?: string[]; // role-guideline docs appended to worker system prompts (source-relative paths resolved by config.ts)
@@ -374,13 +374,22 @@ export class ThreadManager {
374
374
  if (this.store.currentChange !== capturedChange || this.store.changeOwnerSessionId !== capturedOwner) {
375
375
  throw new Error("The current change or its session owner changed during action validation. No action was admitted.");
376
376
  }
377
+ let sessionId: string | undefined;
378
+ try {
379
+ sessionId = ctx.sessionManager?.getSessionId?.();
380
+ } catch (cause) {
381
+ throw new Error("Cannot create a thread without a nonempty session ID.", { cause });
382
+ }
383
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
384
+ throw new Error("Cannot create a thread without a nonempty session ID.");
385
+ }
377
386
  const temporary = capturedChange === undefined ? undefined : allocateActionTemporary(ctx.cwd, capturedChange);
378
387
  if (temporary) this.store.actionTemporaryOwners.add(temporary);
379
388
  let thread: ThreadRecord;
380
389
  let actionMessage: ReturnType<typeof actionTemporaryMessage> | undefined;
381
390
  try {
382
391
  if (temporary) actionMessage = actionTemporaryMessage(`slate-changes/${capturedChange}/tmp/${basename(temporary.path)}`);
383
- thread = this.createThread(accepted);
392
+ thread = this.createThread(accepted, sessionId);
384
393
  } catch (error) {
385
394
  if (temporary) {
386
395
  const message = retainedActionTemporary(temporary.path, error);
@@ -392,7 +401,7 @@ export class ThreadManager {
392
401
  return await this.runDispatch(thread, accepted, prompt, ctx, signal, onProgress, admission, initialRoute, reviewGuidance, temporary, folderGuidance, actionMessage);
393
402
  }
394
403
 
395
- private createThread(opts: DispatchOptions): ThreadRecord {
404
+ private createThread(opts: DispatchOptions, sessionId: string): ThreadRecord {
396
405
  const id = this.store.claimNextThreadId();
397
406
  const type = parseThreadType(opts.type, true)!
398
407
  const configuredTools = opts.tools ?? this.config.workerTools;
@@ -400,6 +409,7 @@ export class ThreadManager {
400
409
  const now = Date.now();
401
410
  const record: ThreadRecord = {
402
411
  id,
412
+ sessionId,
403
413
  name: opts.name?.trim() || id,
404
414
  status: "queued",
405
415
  type,
@@ -3,10 +3,9 @@
3
3
  */
4
4
 
5
5
  import { readFileSync } from "node:fs";
6
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import type { ExtensionAPI, ExtensionToolContext } from "@earendil-works/pi-coding-agent";
7
7
  import { Type, type Static } from "typebox";
8
8
  import { renderCompactCall, renderCompactResult, renderThreadCall, renderThreadResult, type DisplayDetails } from "./render.ts";
9
- import { sanitizeForNotify } from "./notify.ts";
10
9
  import {
11
10
  displayThreadType,
12
11
  isModelSpec,
@@ -15,12 +14,12 @@ import {
15
14
  resolveEpisodeFile,
16
15
  renderThreadId,
17
16
  sanitizeDispatchReason,
18
- threadTypeMarker,
19
17
  THREAD_TYPE_GLOSSES,
20
18
  THREAD_TYPES,
21
19
  type EpisodeRecord,
22
20
  type EpisodeUsage,
23
21
  type SlateStore,
22
+ type ThreadRecord,
24
23
  } from "./state.ts";
25
24
  import { MAX_CONTEXT_EPISODES, type DispatchProgress, type ThreadManager } from "./threads.ts";
26
25
  import { JUDGEMENT_THREAD_TYPES } from "./worker.ts";
@@ -60,6 +59,154 @@ function dispatchCostLine(episode: EpisodeRecord): string {
60
59
  return `Cost: ${partialCost ? "≥" : ""}$${reportedCost.toFixed(4)}${costScope} | tokens: ${quantities.join(", ")} | ended ${model} ${effort}${warm}`;
61
60
  }
62
61
 
62
+ const THREAD_PAGE_ROWS = 20;
63
+ const MAX_THREAD_CURSOR = "t9007199254740992";
64
+
65
+ function compareThreadIds(a: string, b: string): number {
66
+ // Canonical decimal IDs sort by digit count and then by digit value.
67
+ return a.length - b.length || (a < b ? -1 : a > b ? 1 : 0);
68
+ }
69
+
70
+ function validateThreadCursor(value: unknown): asserts value is string {
71
+ if (typeof value !== "string" || value.length > MAX_THREAD_CURSOR.length
72
+ || !/^t[1-9][0-9]*$/u.test(value) || compareThreadIds(value, MAX_THREAD_CURSOR) > 0) {
73
+ throw new Error('Invalid before value. Use a thread ID such as "t9". Omit both before and parentSession to list the current session.');
74
+ }
75
+ }
76
+
77
+ function inspectThreadArguments(args: unknown) {
78
+ try {
79
+ if (typeof args === "object" && args !== null && !Array.isArray(args)) {
80
+ const before = Object.getOwnPropertyDescriptor(args, "before");
81
+ const detail = Object.getOwnPropertyDescriptor(args, "detail");
82
+ const parentSession = Object.getOwnPropertyDescriptor(args, "parentSession");
83
+ if ([before, detail, parentSession].every((entry) => !entry || Object.hasOwn(entry, "value"))) {
84
+ return { before, detail, parentSession };
85
+ }
86
+ }
87
+ } catch {
88
+ // Proxy inspection can throw. Do not return the proxy's error text.
89
+ }
90
+ throw new Error("Invalid threads arguments. Use an object such as {}.");
91
+ }
92
+
93
+ function threadLabel(value: string, limit: number, quoted = false): string {
94
+ let text = "";
95
+ let bytes = 0;
96
+ let scanned = 0;
97
+ for (const point of value) {
98
+ // Bound the work even when the label contains only characters we omit.
99
+ if (++scanned > limit * 4) return text + "…";
100
+ if (/[\p{Cc}\p{Bidi_Control}]/u.test(point)) continue;
101
+ const char = point.replace(/[\p{Zl}\p{Zp}]/u, " ").replace(/\p{Cs}/u, "�");
102
+ const escaped = quoted && (char === '"' || char === "\\") ? "\\" + char : char;
103
+ bytes += Buffer.byteLength(escaped, "utf8");
104
+ if (bytes > limit - 3) return text + "…";
105
+ text += escaped;
106
+ }
107
+ return text;
108
+ }
109
+
110
+ const ROUTING_LABEL_ESCAPE = /[\s\p{White_Space}\p{Cc}\p{Bidi_Control}\p{Cs}"\\]/u;
111
+
112
+ function routingLabel(value: string, limit: number): string {
113
+ if (!ROUTING_LABEL_ESCAPE.test(value)) return threadLabel(value, limit);
114
+
115
+ let text = "";
116
+ let bytes = 0;
117
+ for (const point of value) {
118
+ const encoded = JSON.stringify(point).slice(1, -1);
119
+ const escaped = encoded === point && point !== " " && ROUTING_LABEL_ESCAPE.test(point)
120
+ ? "\\u" + point.charCodeAt(0).toString(16).padStart(4, "0")
121
+ : encoded;
122
+ bytes += Buffer.byteLength(escaped, "utf8");
123
+ if (bytes > limit - 3) return `"${text}…"`;
124
+ text += escaped;
125
+ }
126
+ return `"${text}"`;
127
+ }
128
+
129
+ function threadPageRow(thread: ThreadRecord, store: SlateStore, getManager: () => ThreadManager, detail: boolean): string {
130
+ const row = `${thread.id} "${threadLabel(thread.name, 200, true)}" [${thread.status}] type=${displayThreadType(thread.type)}`;
131
+ const episode = ` — episode: ${thread.episodeId ?? "(none)"}`;
132
+ if (!detail) return row + episode;
133
+
134
+ const last = thread.episodeId === undefined ? undefined : store.episodes.get(thread.episodeId);
135
+ const marks: string[] = [];
136
+ if (last?.logicalModel) marks.push(`logical=${routingLabel(last.logicalModel, 80)}`);
137
+ const requestedModel = isModelSpec(last?.requestedModel) ? last.requestedModel : undefined;
138
+ if (requestedModel) {
139
+ const effort = isThinkingLevel(last?.requestedEffort) ? `@${last.requestedEffort}` : "";
140
+ marks.push(`requested=${routingLabel(requestedModel, 120)}${effort}`);
141
+ }
142
+ const reason = sanitizeDispatchReason(last?.reason);
143
+ if (reason) marks.push(`reason=${JSON.stringify(reason)}`);
144
+ if (last?.model) {
145
+ const effort = last.effort ? `@${routingLabel(last.effort, 48)}` : "";
146
+ const unmeasured = last.effortUnmeasured ? "(unmeasured)" : "";
147
+ const differs = requestedModel !== undefined && requestedModel !== last.model ? " (different from requested)" : "";
148
+ marks.push(`last=${routingLabel(last.model, 120)}${effort}${unmeasured}${differs}`);
149
+ }
150
+ const live = getManager().liveFailoverModel(thread.id);
151
+ if (live) marks.push(`live=${routingLabel(live, 120)} (failover)`);
152
+ const date = new Date(thread.updatedAt);
153
+ const updated = Number.isNaN(date.getTime()) ? "unavailable" : date.toISOString();
154
+ const models = marks.length > 0 ? ` ${marks.join(" ")}` : "";
155
+ return `${row}${models}${episode} — updated ${updated}`;
156
+ }
157
+
158
+ function validateThreadMode(hasBefore: boolean, parentSession: boolean | undefined): void {
159
+ if (hasBefore && parentSession === true) {
160
+ throw new Error("Use either before or parentSession: true, not both.");
161
+ }
162
+ }
163
+
164
+ function listThreads(
165
+ store: SlateStore,
166
+ getManager: () => ThreadManager,
167
+ ctx: ExtensionToolContext,
168
+ { before, detail, parentSession }: { before?: string; detail?: boolean; parentSession?: boolean },
169
+ ) {
170
+ const count = store.threads.size;
171
+ if (count === 0) {
172
+ return { text: "No threads yet. Use the thread tool to create one.", details: { count, failedCount: 0 } };
173
+ }
174
+ const sessionId = ctx.sessionManager.getSessionId();
175
+ const totals = { queued: 0, running: 0, successful: 0, failed: 0, cancelled: 0 };
176
+ const all = [...store.threads.values()].sort((a, b) => compareThreadIds(b.id, a.id));
177
+ const current = all.filter((thread) => thread.sessionId === sessionId);
178
+ for (const thread of all) totals[thread.status]++;
179
+
180
+ let rows = current;
181
+ let mode = "current session";
182
+ let limit = rows.length;
183
+ if (before !== undefined) {
184
+ rows = all.filter((thread) => compareThreadIds(thread.id, before) < 0);
185
+ limit = THREAD_PAGE_ROWS;
186
+ } else if (parentSession === true) {
187
+ const parent = all.find((thread) => thread.sessionId !== sessionId);
188
+ rows = parent ? all.filter((thread) => thread.sessionId === parent.sessionId) : [];
189
+ mode = "parent session";
190
+ limit = parent?.sessionId === undefined ? THREAD_PAGE_ROWS : rows.length;
191
+ }
192
+
193
+ const summary = `Threads: ${count}. Queued: ${totals.queued}. Running: ${totals.running}. Successful: ${totals.successful}. Failed: ${totals.failed}. Cancelled: ${totals.cancelled}. Current session: ${current.length}.`;
194
+ const page = rows.slice(0, limit);
195
+ const listing = before === undefined
196
+ ? `${mode}, ${page.length} ${page.length === 1 ? "thread" : "threads"}`
197
+ : `all sessions, threads older than ${before}${page.length === 0 ? ", 0 threads" : ""}`;
198
+ const lines = [summary, `Listing: ${listing}.`];
199
+ for (const thread of page) lines.push(threadPageRow(thread, store, getManager, detail === true));
200
+ if (before !== undefined && page.length === 0) lines.push("No older threads.");
201
+ if (page.length < rows.length) {
202
+ const last = page.at(-1)!;
203
+ const remaining = all.length - all.indexOf(last) - 1;
204
+ const nextArgs = JSON.stringify({ before: last.id, detail });
205
+ lines.push(`Remaining threads: ${remaining}. Next call: threads(${nextArgs})`);
206
+ }
207
+ return { text: lines.join("\n"), details: { count, failedCount: totals.failed } };
208
+ }
209
+
63
210
  export function registerSlateTools(pi: ExtensionAPI, store: SlateStore, getManager: () => ThreadManager): void {
64
211
  const parameters = Type.Object({
65
212
  name: Type.Optional(Type.String({ description: "Short name for a NEW thread (e.g. \"recon\")" })),
@@ -240,59 +387,60 @@ export function registerSlateTools(pi: ExtensionAPI, store: SlateStore, getManag
240
387
  },
241
388
  });
242
389
 
390
+ const threadsParameters = Type.Object({
391
+ before: Type.Optional(Type.String({ description: "List up to 20 threads from all sessions that are older than this thread ID." })),
392
+ parentSession: Type.Optional(Type.Union([Type.Literal(true), Type.Literal(false)], {
393
+ description: "List threads from the newest earlier session with threads. Do not combine true with before.",
394
+ })),
395
+ detail: Type.Optional(Type.Union([Type.Literal(true), Type.Literal(false)], {
396
+ description: "Show model choices, effort, the reason for the choice, and update times.",
397
+ })),
398
+ });
399
+ const prepareThreadsArguments = (args: unknown): Static<typeof threadsParameters> => {
400
+ const { before, detail, parentSession } = inspectThreadArguments(args);
401
+ const prepared: Static<typeof threadsParameters> = {};
402
+ if (parentSession) {
403
+ const value: unknown = parentSession.value;
404
+ if (typeof value !== "boolean") {
405
+ throw new Error("Invalid parentSession value. Use true or false.");
406
+ }
407
+ prepared.parentSession = value;
408
+ }
409
+ validateThreadMode(before !== undefined, prepared.parentSession);
410
+ if (before) {
411
+ const value: unknown = before.value;
412
+ validateThreadCursor(value);
413
+ prepared.before = value;
414
+ }
415
+ if (detail) {
416
+ const value: unknown = detail.value;
417
+ if (typeof value !== "boolean") {
418
+ throw new Error("Invalid detail value. Use true or false.");
419
+ }
420
+ prepared.detail = value;
421
+ }
422
+ return prepared;
423
+ };
243
424
  pi.registerTool({
244
425
  name: "threads",
245
426
  label: "Threads",
246
427
  renderCall: (args, theme, context) => renderCompactCall("threads", args, theme, context),
247
428
  renderResult: (result, options, theme, context) => renderCompactResult("threads", result, options, theme, context),
248
429
  description:
249
- "List worker threads, their status, episodes, activity, and models. " +
250
- "type=<type> marks a non-general thread. " +
251
- "logical=<name> and reason= show the action selection. " +
252
- "requested=<physical-model>@<effort> and last=<physical-model>@<effort> preserve execution facts.",
430
+ "List worker threads and their episode IDs, newest thread first. " +
431
+ "By default, list the current session. " +
432
+ "Set parentSession to true to list the newest earlier session with threads. Slate skips sessions without threads. " +
433
+ "Slate groups threads without a saved session ID together and lists up to 20 when that group is the parent. " +
434
+ "Set before to a thread ID to list up to 20 older threads from all sessions. " +
435
+ "Use only one of before or parentSession: true. Follow the next call to list older threads. " +
436
+ "Lists and totals use only the thread records available in this session. The totals include the current session count. " +
437
+ "Set detail to true to see model choices, effort, the reason for the choice, and update times.",
253
438
  promptSnippet: "List worker threads and their episodes",
254
- parameters: Type.Object({}),
255
- async execute() {
256
- const threads = [...store.threads.values()];
257
- if (threads.length === 0) {
258
- return { content: [{ type: "text", text: "No threads yet. Use the thread tool to create one." }], details: { count: 0 } };
259
- }
260
- const lines = threads.map((t) => {
261
- const episode = t.episodeId ?? "(none)";
262
- const typeMarker = threadTypeMarker(displayThreadType(t.type));
263
- const marks: string[] = [];
264
- // The action's model may differ from the base after an explicit route or failover.
265
- const lastEpisode = t.episodeId === undefined ? undefined : store.episodes.get(t.episodeId);
266
- const logicalModel = typeof lastEpisode?.logicalModel === "string" ? lastEpisode.logicalModel : undefined;
267
- if (logicalModel) marks.push(`logical=${sanitizeForNotify(logicalModel, 80)}`);
268
- const requestedModel = isModelSpec(lastEpisode?.requestedModel) ? lastEpisode.requestedModel : undefined;
269
- const requestedEffort = isThinkingLevel(lastEpisode?.requestedEffort) ? lastEpisode.requestedEffort : undefined;
270
- if (requestedModel) {
271
- marks.push(`requested=${sanitizeForNotify(requestedModel, 80)}${requestedEffort ? `@${requestedEffort}` : ""}`);
272
- }
273
- const requestReason = sanitizeDispatchReason(lastEpisode?.reason);
274
- if (requestReason) marks.push(`reason=${JSON.stringify(requestReason)}`);
275
- if (lastEpisode?.model) {
276
- const differs = requestedModel !== undefined && requestedModel !== lastEpisode.model ? " (different from requested)" : "";
277
- marks.push(
278
- `last=${sanitizeForNotify(lastEpisode.model, 80)}${lastEpisode.effort ? `@${lastEpisode.effort}` : ""}${
279
- lastEpisode.effortUnmeasured ? "(unmeasured)" : ""
280
- }${differs}`,
281
- );
282
- }
283
- // AF12: after a model failover the LIVE cached session runs a different model
284
- // than the thread's base. The marker disappears when the session is disposed, or
285
- // when a dispatch's own ROUTING moves that session — an explicit `model`, or the
286
- // thread's base with the router on — since the marker describes the model the
287
- // session is ACTUALLY on (CQ20, the same correction CQ14 made in threads.ts; the
288
- // one switch that never clears it is the revert, which stands down while the
289
- // marker is held). Failover is never persisted to the thread record.
290
- const live = getManager().liveFailoverModel(t.id);
291
- if (live) marks.push(`live=${live} (failover)`);
292
- const models = marks.length > 0 ? ` ${marks.join(" ")}` : "";
293
- return `${renderThreadId(t.id)} "${t.name}" [${t.status}]${typeMarker}${models} — episode: ${episode} — updated ${new Date(t.updatedAt).toISOString()}`;
294
- });
295
- return { content: [{ type: "text", text: lines.join("\n") }], details: { count: threads.length, failedCount: threads.filter((thread) => thread.status === "failed").length } };
439
+ parameters: threadsParameters,
440
+ prepareArguments: prepareThreadsArguments,
441
+ async execute(_toolCallId, args, _signal, _onUpdate, ctx) {
442
+ const { text, details } = listThreads(store, getManager, ctx, prepareThreadsArguments(args));
443
+ return { content: [{ type: "text", text }], details };
296
444
  },
297
445
  });
298
446
 
@@ -309,8 +457,7 @@ export function registerSlateTools(pi: ExtensionAPI, store: SlateStore, getManag
309
457
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
310
458
  const episode = store.episodes.get(params.id);
311
459
  if (!episode) {
312
- const known = [...store.episodes.keys()].join(", ") || "none";
313
- throw new Error(`Unknown episode "${params.id}". Known episodes: ${known}`);
460
+ throw new Error("Unknown episode. Use threads to find episode IDs.");
314
461
  }
315
462
  const file = resolveEpisodeFile(ctx.cwd, episode.file);
316
463
  if (file === undefined) throw new Error(`Episode "${params.id}" is no longer a safe readable slate episode file.`);
@@ -80,7 +80,7 @@ export function isJudgementThreadType(type: unknown): type is (typeof JUDGEMENT_
80
80
  return (JUDGEMENT_THREAD_TYPES as readonly unknown[]).includes(type);
81
81
  }
82
82
 
83
- // pi-ai 1.5.2 declares this value in
83
+ // pi-ai 1.6.0 declares this value in
84
84
  // @earendil-works/pi-ai/dist/api/openai-prompt-cache.js. pi's extension loader
85
85
  // aliases the package root to dist/core/extensions/pi-ai-extension-view.js,
86
86
  // which re-exports compat. This file alias prevents safe deep-subpath imports.
@@ -187,7 +187,7 @@ function installPromptCacheKey(session: WorkerSession, promptCacheKey?: string):
187
187
  }
188
188
 
189
189
  try {
190
- // pi-ai 1.5.2 api/openai-responses.js buildParams always creates
190
+ // pi-ai 1.6.0 api/openai-responses.js buildParams always creates
191
191
  // prompt_cache_key and assigns undefined when resolved cacheRetention is
192
192
  // "none". Own-property presence therefore distinguishes that deliberate
193
193
  // opt-out from a payload shape that never considered this field.
@@ -320,10 +320,10 @@ export function createWorkerRequestContract(): WorkerRequestContract {
320
320
  * · the wait happens BEFORE the SDK converts the conversation into a provider
321
321
  * payload, so a waiting request holds no converted copy (PF5).
322
322
  *
323
- * In pi 1.5.2, createAgentSession marks its installed stream function through
323
+ * In pi 1.6.0, createAgentSession marks its installed stream function through
324
324
  * markRuntimeStreamFunction (dist/core/sdk.js:290).
325
325
  * AgentSession._getSummarizationRequestAuth skips credential pre-resolution
326
- * only for a marked function (dist/core/agent-session.js:275–308).
326
+ * only for a marked function (dist/core/agent-session.js:279–312).
327
327
  * Slate replaces that function without carrying its mark. Worker summaries
328
328
  * take the fallback branch and receive the resolved credential as an explicit
329
329
  * apiKey. Issue #591 tracks the repair.
@@ -487,7 +487,7 @@ export async function openWorkerSession(opts: {
487
487
  // user has NOT trusted. Carry the host session's actual trust decision into
488
488
  // both the resource loader and the session.
489
489
  //
490
- // READ-ONLY view (AF8/AF9): pi 1.5.2 keeps ordinary session.setModel and
490
+ // READ-ONLY view (AF8/AF9): pi 1.6.0 keeps ordinary session.setModel and
491
491
  // setThinkingLevel calls inside the session. Slate requests no persistence.
492
492
  // This storage protects global settings from calls with persist:true and
493
493
  // from hosts that persist switches. A file-backed manager would save those
@@ -664,7 +664,7 @@ export async function openWorkerSession(opts: {
664
664
  ? SessionManager.open(opts.sessionFile)
665
665
  : SessionManager.create(ctx.cwd, ensureRuntimeDirectory(ctx.cwd, opts.runtimeFolder ?? defaultArtifactFolder(), "threads"));
666
666
 
667
- // In pi 1.5.2, createAgentSession creates a ModelRuntime when none is passed.
667
+ // In pi 1.6.0, createAgentSession creates a ModelRuntime when none is passed.
668
668
  // It uses auth.json, models.json and models-store.json under agentDir.
669
669
  // SDK creation enables network catalog refresh only with allowModelNetwork.
670
670
  // This call supplies no runtime option, so creation uses no network catalog
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ytdb-slate",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Design-first feature development for the pi coding agent. Slate researches, designs, implements and reviews each change. You judge the design and keep control of the code without reading every line.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -37,9 +37,9 @@
37
37
  "typebox": "*"
38
38
  },
39
39
  "devDependencies": {
40
- "@earendil-works/pi-ai": "1.5.2",
41
- "@earendil-works/pi-coding-agent": "1.5.2",
42
- "@earendil-works/pi-tui": "1.5.2",
40
+ "@earendil-works/pi-ai": "1.6.0",
41
+ "@earendil-works/pi-coding-agent": "1.6.0",
42
+ "@earendil-works/pi-tui": "1.6.0",
43
43
  "@types/node": "24.13.3",
44
44
  "typebox": "1.3.27",
45
45
  "typescript": "5.9.3"