pi-context-kit 0.4.3 → 0.4.5

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,19 @@
2
2
 
3
3
  Pi shows the entries newer than your installed version after `pi update`.
4
4
 
5
+ ## 0.4.5
6
+
7
+ ### Patch Changes
8
+
9
+ - Shake no longer stalls a turn on large tool output with many unclosed HTML tags or code fences. A code fence now closes only on a fence at least as long as its opening fence, and the elision removes the whole closing fence.
10
+ - Notices now show provider errors, settings problems and file errors without terminal control sequences, so such text can no longer change the window title, clear the screen or add hidden links. Line breaks and tabs stay.
11
+
12
+ ## 0.4.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Settings now live in the `context-kit` entry of Pi's `settings.json`, globally and per project, with a session layer changed by `/context-kit`. On first start, each layer without a `context-kit` entry is imported once: its `context-kit.json` when that file exists, which is then renamed to `context-kit.json.migrated`, otherwise the 0.3 `contextKit` block of `settings.json`. The `/context-kit` menu lists every setting. Per-layer validation now ignores a whole layer when one key is invalid or unknown, so the other layers still apply.
17
+
5
18
  ## 0.4.3
6
19
 
7
20
  ### Patch Changes
package/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # pi-context-kit: long Pi sessions that stay sharp
2
2
 
3
- [![CI](https://github.com/HugoLopes45/pi-extensions/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HugoLopes45/pi-extensions/actions/workflows/ci.yml)
4
- [![npm](https://img.shields.io/npm/v/pi-context-kit)](https://www.npmjs.com/package/pi-context-kit)
5
- [![Pi package](https://img.shields.io/badge/pi.dev-package-blue)](https://pi.dev/packages/pi-context-kit)
6
- [![Node.js](https://img.shields.io/node/v/pi-context-kit)](https://nodejs.org)
7
- [![License: MIT](https://img.shields.io/npm/l/pi-context-kit)](LICENSE)
3
+ [![CI](https://github.com/HugoLopes45/pi-extensions/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HugoLopes45/pi-extensions/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/pi-context-kit)](https://www.npmjs.com/package/pi-context-kit) [![Pi package](https://img.shields.io/badge/pi.dev-package-blue)](https://pi.dev/packages/pi-context-kit) [![Node.js](https://img.shields.io/node/v/pi-context-kit)](https://nodejs.org) [![License: MIT](https://img.shields.io/npm/l/pi-context-kit)](LICENSE)
8
4
 
9
5
  **Pi compaction and context management for the [Pi coding agent](https://github.com/earendil-works/pi).** pi-context-kit clears stale file reads and old tool outputs out of the context window, writes the handoff summary in the background before Pi needs it, and keeps the original text of the current branch one `recall` search away.
10
6
 
@@ -103,13 +99,17 @@ After pi-context-kit shortens old outputs, Pi shows a notice, for example: `pi-c
103
99
 
104
100
  To change the settings, type `/context-kit` and press Enter. Select a line with the arrow keys and press Enter to change its value. The change is saved at once and applies from the next turn. Press Escape to close the panel.
105
101
 
106
- | Panel line | Choices | Setting in the file |
107
- | ---------------------------- | ----------------------------------------------------- | ---------------------------------------------------- |
108
- | Automatic cleanup | On, Off | `enabled` |
109
- | Clean up when the context is | 50% to 90% full, At Pi's limit | `threshold` |
110
- | Cleanup method | Summary notes (recommended), Trim first, Pi's summary | `strategy`: `"balanced"`, `"frugal"`, `"pi-summary"` |
102
+ The panel has a scope row. Choose the session, the global settings, or the project settings when the project is trusted. Edits go to the selected scope. Each other line is one setting, named as in [Settings](#settings). A line shows the value in effect, and the scope it comes from when that is not the default. The first three lines are the main settings:
111
103
 
112
- The panel does not show the Cleanup method line when `advanced.methodOrder` is in the file, because that setting replaces the method.
104
+ | Line | On Enter |
105
+ | ----------- | ----------------------------------------------------------------- |
106
+ | `enabled` | Steps through `inherit`, `on`, `off` |
107
+ | `threshold` | Opens a field: a token count, a percentage such as `75%`, or `pi` |
108
+ | `strategy` | Steps through `inherit`, `balanced`, `frugal`, `pi-summary` |
109
+
110
+ The other on and off settings step the same way as `enabled`. The other settings open a field. In a field, type `inherit` to remove the value from the selected scope.
111
+
112
+ Commands write the same values, for example `/context-kit off --global` turns cleanup off in the global settings. `/context-kit set threshold 8000` sets a value for this session only. `/context-kit inherit threshold --project` removes the project value. Without `--global` or `--project`, a command writes to the session.
113
113
 
114
114
  Outside the interactive mode, `/context-kit` shows the current settings in one line.
115
115
 
@@ -138,16 +138,13 @@ Outside the interactive mode, `/context-kit` shows the current settings in one l
138
138
 
139
139
  ### 1. Old file reads are replaced
140
140
 
141
- Sometimes the model reads the same file two times. The first copy is then old.
142
- pi-context-kit replaces the old copy with this text: `[Superseded by a newer read of this file]`.
141
+ Sometimes the model reads the same file two times. The first copy is then old. pi-context-kit replaces the old copy with this text: `[Superseded by a newer read of this file]`.
143
142
 
144
- It does this only when the newer read covers all of the old read. If the newer read was cut short, the old copy stays.
145
- It does this only when the context is above the threshold, in the same change as pruning, shaking or compaction. Each change to old text makes the provider read all later text again without its cache. With Anthropic, it also removes the model's earlier reasoning from the request. One change near the threshold costs less than one change at each turn.
143
+ It does this only when the newer read covers all of the old read. If the newer read was cut short, the old copy stays. It does this only when the context is above the threshold, in the same change as pruning, shaking or compaction. Each change to old text makes the provider read all later text again without its cache. With Anthropic, it also removes the model's earlier reasoning from the request. One change near the threshold costs less than one change at each turn.
146
144
 
147
145
  ### 2. A handoff note is prepared in advance
148
146
 
149
- Before the context reaches the threshold, the session model writes a handoff note in the background. Your work does not stop.
150
- The note starts one eighth of the threshold early, with a maximum of 32,000 tokens. With a threshold of 150,000 tokens, it starts at approximately 131,250 tokens.
147
+ Before the context reaches the threshold, the session model writes a handoff note in the background. Your work does not stop. The note starts one eighth of the threshold early, with a maximum of 32,000 tokens. With a threshold of 150,000 tokens, it starts at approximately 131,250 tokens.
151
148
 
152
149
  The note uses the same sections as Pi's summary. It also lists the files that were read and changed.
153
150
 
@@ -179,16 +176,13 @@ The `recall` tool reads original session text, not the shortened context sent to
179
176
  - search earlier conversation text on the current branch, including removed and summarized messages;
180
177
  - read an entry's text by ID, with pagination for large entries.
181
178
 
182
- Other branches and sessions are excluded. System prompt entries are not searched.
183
- Shell commands explicitly excluded from model context with `!!` are not available through `recall`.
179
+ Other branches and sessions are excluded. System prompt entries are not searched. Shell commands explicitly excluded from model context with `!!` are not available through `recall`.
184
180
 
185
- Images remain in the original session entries, but `recall` returns only their MIME types, not image content.
186
- The model must call `recall` to retrieve a missing detail. Retrieval is not automatic.
181
+ Images remain in the original session entries, but `recall` returns only their MIME types, not image content. The model must call `recall` to retrieve a missing detail. Retrieval is not automatic.
187
182
 
188
183
  ## What maintenance preserves
189
184
 
190
- File-read replacement, pruning, and shaking do not rewrite the original session entries.
191
- In the model's context, these steps preserve:
185
+ File-read replacement, pruning, and shaking do not rewrite the original session entries. In the model's context, these steps preserve:
192
186
 
193
187
  - Your messages, including your instructions and images.
194
188
  - The model's tool calls and reasoning. Anthropic can still drop the reasoning after an edited message (see [Old file reads are replaced](#1-old-file-reads-are-replaced)).
@@ -198,27 +192,33 @@ Compaction is different: it replaces older context with a summary, including old
198
192
 
199
193
  ## Settings
200
194
 
201
- This section is for users who edit the settings file. The panel changes the three main settings; the file also has the advanced settings.
195
+ This section is for users who edit the settings. The `/context-kit` panel lists every setting, one line each. The main settings come first in this section.
202
196
 
203
197
  ### The settings files
204
198
 
205
- | File | Applies to |
206
- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
207
- | `~/.pi/agent/context-kit.json` | All your projects. `~` is your home folder. |
208
- | `.pi/context-kit.json` in a project folder | Only this project, and only when you trust the project in Pi. Its values replace the values of the global file. |
199
+ pi-context-kit keeps its settings in the `context-kit` entry of Pi's `settings.json`. Three layers apply, the later one wins:
209
200
 
210
- You do not need to set all settings. A missing setting uses its default. pi-context-kit reads the files again at each turn, so you do not need to restart Pi. The panel writes to the project file when that file sets the setting, otherwise to the global file.
201
+ | Layer | File | Applies to |
202
+ | ------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
203
+ | Global | `~/.pi/agent/settings.json` | All your projects. `~` is your home folder. |
204
+ | Project | `.pi/settings.json` in a project | Only this project, and only when you trust the project in Pi. Its values replace the values of the global file. |
205
+ | Session | Entries of the current session | This session only. It replaces the values of both files. Commands write here unless you name a file with `--global` or `--project`. |
211
206
 
212
- Add the `$schema` line to get completion and checks in editors such as VS Code:
207
+ Write the values in the `context-kit` entry, like this:
213
208
 
214
209
  ```json
215
210
  {
216
- "$schema": "https://unpkg.com/pi-context-kit/context-kit.schema.json",
217
- "threshold": "70%",
218
- "strategy": "frugal"
211
+ "context-kit": {
212
+ "threshold": "70%",
213
+ "strategy": "frugal"
214
+ }
219
215
  }
220
216
  ```
221
217
 
218
+ The package file `context-kit.schema.json` describes the `context-kit` entry for editors. Do not add a `$schema` key to the entry: it is not a setting.
219
+
220
+ You do not need to set all settings. A missing setting uses its default. Pi applies a change from the next turn, so you do not need to restart Pi.
221
+
222
222
  ### Main settings
223
223
 
224
224
  | Setting | Allowed values | Default | What it does |
@@ -231,68 +231,82 @@ Add the `$schema` line to get completion and checks in editors such as VS Code:
231
231
 
232
232
  **`strategy`.**
233
233
 
234
- | Strategy (panel name) | Above the threshold, after pruning | Background requests |
235
- | ----------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
236
- | `"balanced"` (Summary notes) | A handoff note. If the note fails, shake. Then Pi's summary. | Yes: the note is written before the threshold. |
237
- | `"frugal"` (Trim first) | Shake, because it does not call the model. If that is not sufficient, a handoff note. Then Pi's summary. | No |
238
- | `"pi-summary"` (Pi's summary) | Pi's summary. No handoff note, no shaking. | No |
234
+ | Strategy | Above the threshold, after pruning | Background requests |
235
+ | -------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
236
+ | `"balanced"` | A handoff note. If the note fails, shake. Then Pi's summary. | Yes: the note is written before the threshold. |
237
+ | `"frugal"` | Shake, because it does not call the model. If that is not sufficient, a handoff note. Then Pi's summary. | No |
238
+ | `"pi-summary"` | Pi's summary. No handoff note, no shaking. | No |
239
239
 
240
240
  ### Advanced settings
241
241
 
242
- Put these settings in an `advanced` block. Most users never need them.
242
+ Put these settings in the `context-kit` entry under the flat names in the table. Most users never need them.
243
243
 
244
244
  ```json
245
245
  {
246
- "advanced": {
246
+ "context-kit": {
247
247
  "methodOrder": ["handoff", "shake", "soft"],
248
248
  "background": true,
249
249
  "supersedeReads": true,
250
250
  "progressRatio": 0.8,
251
- "prune": { "enabled": true, "protectTokens": 40000, "minSavings": 20000, "minTokens": 50 },
252
- "shake": { "protectTokens": 16000, "minSavings": 4000, "blockMinTokens": 400 }
251
+ "pruneEnabled": true,
252
+ "pruneProtectTokens": 40000,
253
+ "pruneMinSavings": 20000,
254
+ "pruneMinTokens": 50,
255
+ "shakeProtectTokens": 16000,
256
+ "shakeMinSavings": 4000,
257
+ "shakeBlockMinTokens": 400
253
258
  }
254
259
  }
255
260
  ```
256
261
 
257
- | Setting | Default | What it does |
258
- | ---------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
- | `methodOrder` | From `strategy` | Replaces the method order of the strategy. Allowed values: `"handoff"`, `"shake"`, `"soft"`. Methods after `"soft"` never run. Without `"handoff"` before `"soft"`, no handoff note is written, also on `/compact`. An empty list `[]` only replaces old reads and prunes. |
260
- | `background` | From `strategy` | `true` writes the handoff note in the background, one eighth of the threshold early (maximum 32,000 tokens). `false` writes it at the threshold, and your work waits for it. |
261
- | `supersedeReads` | `true` | Replaces the old copy of a file that the model read again. |
262
- | `progressRatio` | `0.8` | Each method must bring the context to this fraction of the threshold, otherwise its result is not used and the next method runs. Above 0, up to 1. |
263
- | `prune.enabled` | `true` | `false` never prunes tool outputs. |
264
- | `prune.protectTokens` | `40000` | The newest tool outputs, up to this number of tokens, are never pruned. |
265
- | `prune.minSavings` | `20000` | Pruning occurs only if it removes at least this number of tokens. |
266
- | `prune.minTokens` | `50` | Tool outputs smaller than this are never pruned. |
267
- | `shake.protectTokens` | `16000` | The newest context, up to this number of tokens, is never shaken. Your own messages are never shaken. |
268
- | `shake.minSavings` | `4000` | Shaking occurs only if it removes at least this number of tokens. |
269
- | `shake.blockMinTokens` | `400` | Code and XML blocks smaller than this are never shaken. |
262
+ The flat names replace the nested names of 0.4 `context-kit.json`: `prune.enabled` is `pruneEnabled`, `prune.protectTokens` is `pruneProtectTokens`, `prune.minSavings` is `pruneMinSavings`, `prune.minTokens` is `pruneMinTokens`, and `shake.protectTokens`, `shake.minSavings` and `shake.blockMinTokens` become `shakeProtectTokens`, `shakeMinSavings` and `shakeBlockMinTokens`.
263
+
264
+ | Setting | Default | What it does |
265
+ | --------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
266
+ | `methodOrder` | From `strategy` | Replaces the method order of the strategy. Allowed values: `"handoff"`, `"shake"`, `"soft"`. Methods after `"soft"` never run. Without `"handoff"` before `"soft"`, no handoff note is written, also on `/compact`. An empty list `[]` only replaces old reads and prunes. |
267
+ | `background` | From `strategy` | `true` writes the handoff note in the background, one eighth of the threshold early (maximum 32,000 tokens). `false` writes it at the threshold, and your work waits for it. |
268
+ | `supersedeReads` | `true` | Replaces the old copy of a file that the model read again. |
269
+ | `progressRatio` | `0.8` | Each method must bring the context to this fraction of the threshold, otherwise its result is not used and the next method runs. Above 0, up to 1. |
270
+ | `pruneEnabled` | `true` | `false` never prunes tool outputs. |
271
+ | `pruneProtectTokens` | `40000` | The newest tool outputs, up to this number of tokens, are never pruned. |
272
+ | `pruneMinSavings` | `20000` | Pruning occurs only if it removes at least this number of tokens. |
273
+ | `pruneMinTokens` | `50` | Tool outputs smaller than this are never pruned. |
274
+ | `shakeProtectTokens` | `16000` | The newest context, up to this number of tokens, is never shaken. Your own messages are never shaken. |
275
+ | `shakeMinSavings` | `4000` | Shaking occurs only if it removes at least this number of tokens. |
276
+ | `shakeBlockMinTokens` | `400` | Code and XML blocks smaller than this are never shaken. |
270
277
 
271
278
  ### When a setting is incorrect
272
279
 
273
- pi-context-kit checks each value. If a value is incorrect, Pi shows a warning and the setting uses its default. The other settings still apply. Example: with `"threshold": "150000"` (a text in quotes, not a number), Pi shows:
280
+ pi-context-kit checks every value of a layer. If one value is incorrect, pi-context-kit ignores that whole layer, the global file or the project file. The other layer still applies, and defaults apply to every setting that no remaining layer sets. Pi shows a warning that names the layer and the problem.
274
281
 
275
- ```text
276
- pi-context-kit settings need attention: threshold must be a positive integer (tokens), a percentage such as "75%", or "pi" (default used). Type /context-kit to see them.
277
- ```
278
-
279
- Pi also warns about a setting name with a spelling mistake, a file that is not valid JSON, and settings that have no effect, for example `advanced.background` without a handoff note in the method order.
282
+ Pi also warns about an unknown setting name, which makes its layer incorrect, and about a settings file that is not valid JSON.
280
283
 
281
284
  ### Upgrade from 0.3
282
285
 
283
- You do not need to do anything. Version 0.4 reads its own file. At the first start, it copies the `contextKit` block of Pi's `settings.json` to `~/.pi/agent/context-kit.json` (and the block of a trusted project to `.pi/context-kit.json`), with the same behavior, and shows a notice once. The project file gets only the settings that the project block changed, because 0.3 used the global block for the others. It does not change Pi's `settings.json`; you can delete the `contextKit` block, which is no longer used. If `context-kit.json` already exists, nothing is copied. If you had no `contextKit` block, 0.4 starts maintenance at the new default of `"75%"`; to wait for Pi's limit as before, set `"threshold": "pi"`. The table shows how the values are converted.
286
+ You do not need to do anything. At each start, pi-context-kit moves its settings into the `context-kit` entry once for each layer that has no such entry.
287
+
288
+ A layer that has no `context-kit` entry imports its `context-kit.json` if that file exists. Otherwise it converts the `contextKit` block of Pi's `settings.json`, the 0.3 settings, with the same behavior.
289
+
290
+ The project block converts over the global settings, as 0.3 merged them. The project entry gets only the settings that the project block changed.
291
+
292
+ After the import is written, `context-kit.json` is renamed to `context-kit.json.migrated`, and pi-context-kit shows a notice once. If the write fails, the file keeps its name and the import runs again at the next start. Defaults apply until then.
293
+
294
+ An existing `context-kit` entry is never changed by the import. The 0.3 `contextKit` block stays in `settings.json` and is no longer read, so you can delete it.
295
+
296
+ If you had no `contextKit` block, 0.4 starts maintenance at the new default of `"75%"`; to wait for Pi's limit as before, set `"threshold": "pi"`. The table shows how the values are converted.
284
297
 
285
- | 0.3 (`contextKit` in `settings.json`) | 0.4 (`context-kit.json`) |
286
- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
287
- | `thresholdTokens: 150000` | `threshold: 150000` |
288
- | `thresholdPercent: 75` | `threshold: "75%"` |
289
- | Both `thresholdTokens` and `thresholdPercent` | `threshold` with the number of tokens |
290
- | No threshold (Pi's limit) | `threshold: "pi"`. The default for new users is `"75%"`. |
291
- | `methodOrder: ["shake", "handoff", "soft"]` | `strategy: "frugal"`, with `advanced.background: true` unless `asyncEnabled` was `false` |
292
- | `methodOrder: ["soft"]` | `strategy: "pi-summary"` |
293
- | Other `methodOrder` values | `advanced.methodOrder`, without `"remote"` and `"snapcompact"`, which 0.3 already skipped. A list with an unknown method becomes the default order, as in 0.3. |
294
- | `asyncEnabled` | `advanced.background`, when it differs from the strategy |
295
- | `supersedeReads`, `progressRatio`, `prune`, `shake` | The same names in `advanced` |
298
+ | 0.3 (`contextKit` in `settings.json`) | 0.4 (`context-kit` entry) |
299
+ | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
300
+ | `thresholdTokens: 150000` | `threshold: 150000` |
301
+ | `thresholdPercent: 75` | `threshold: "75%"` |
302
+ | Both `thresholdTokens` and `thresholdPercent` | `threshold` with the number of tokens |
303
+ | No threshold (Pi's limit) | `threshold: "pi"`. The default for new users is `"75%"`. |
304
+ | `methodOrder: ["shake", "handoff", "soft"]` | `strategy: "frugal"`, with `background: true` unless `asyncEnabled` was `false` |
305
+ | `methodOrder: ["soft"]` | `strategy: "pi-summary"` |
306
+ | Other `methodOrder` values | `methodOrder`, without `"remote"` and `"snapcompact"`, which 0.3 already skipped. A list with an unknown method becomes the default order, as in 0.3. |
307
+ | `asyncEnabled` | `background`, when it differs from the strategy |
308
+ | `supersedeReads`, `progressRatio` | The same names |
309
+ | `prune`, `shake` (0.3 or 0.4 `context-kit.json`) | Flat names, such as `pruneEnabled` and `shakeMinSavings` |
296
310
 
297
311
  ### Pi settings that also apply
298
312
 
@@ -309,15 +323,15 @@ pi-context-kit has no setting per model. To start earlier for one model only, ma
309
323
 
310
324
  ### Recipes
311
325
 
312
- | I want to... | `context-kit.json` |
313
- | ------------------------------------------------ | --------------------------------------------------------- |
314
- | Start later, at Pi's own limit | `{ "threshold": "pi" }` |
315
- | Start at the same number of tokens on all models | `{ "threshold": 150000 }` |
316
- | Avoid model requests when possible | `{ "strategy": "frugal" }` |
317
- | Never write a handoff note | `{ "advanced": { "methodOrder": ["shake", "soft"] } }` |
318
- | Keep more recent tool outputs | `{ "advanced": { "prune": { "protectTokens": 80000 } } }` |
319
- | Keep all old file copies | `{ "advanced": { "supersedeReads": false } }` |
320
- | Turn pi-context-kit off, but keep `recall` | `{ "enabled": false }`, or `/context-kit` |
326
+ | I want to... | Value in the `context-kit` entry |
327
+ | ------------------------------------------------ | -------------------------------------------------- |
328
+ | Start later, at Pi's own limit | `"threshold": "pi"` |
329
+ | Start at the same number of tokens on all models | `"threshold": 150000` |
330
+ | Avoid model requests when possible | `"strategy": "frugal"` |
331
+ | Never write a handoff note | `"methodOrder": ["shake", "soft"]` |
332
+ | Keep more recent tool outputs | `"pruneProtectTokens": 80000` |
333
+ | Keep all old file copies | `"supersedeReads": false` |
334
+ | Turn pi-context-kit off, but keep `recall` | `"enabled": false`, or `/context-kit off --global` |
321
335
 
322
336
  ## Limits
323
337
 
@@ -334,19 +348,18 @@ pi-context-kit has no setting per model. To start earlier for one model only, ma
334
348
 
335
349
  **No `Context` in the footer**: type `pi list` and check that it shows `npm:pi-context-kit`. Then restart Pi. Pi shows the footer only in the interactive mode.
336
350
 
337
- **`pi-context-kit settings need attention`**: a value in a settings file is not valid. pi-context-kit uses the default for that value. Type `/context-kit` to see the problem, then correct the file or select a new value in the panel.
351
+ **`pi-context-kit settings need attention`**: a value in a settings layer is not valid, so that layer is ignored. The other layer still applies. Type `/context-kit` to see the problem, then correct the file or select a new value in the panel.
338
352
 
339
- **`pi-context-kit moved its settings to ...`**: an earlier version kept the settings in Pi's `settings.json`. pi-context-kit copied them to its own file once. You can remove the `contextKit` entry from `settings.json`.
353
+ **`pi-context-kit moved its settings into Pi's settings.json`**: an earlier version kept the settings in its own files. pi-context-kit moved them once, and renamed each file to `context-kit.json.migrated`. You can delete the `.migrated` files and the `contextKit` block of Pi's `settings.json`.
340
354
 
341
355
  **`pi-context-kit: handoff note failed`**: the summary request failed. pi-context-kit uses the next method or Pi's summary, so your session continues. Check the model and your provider limits.
342
356
 
343
- **The panel cannot save a value**: Pi shows `pi-context-kit:` and the file error. Check that you can write the settings file, then select the value again.
357
+ **The panel cannot save a value**: the panel shows the error under the list, and a command shows it after `pi-context-kit:`. Check that you can write the settings file, then select the value again.
344
358
 
345
359
  ## FAQ
346
360
 
347
361
  **Does it slow down my work?**
348
- Usually not. The handoff note is written in the background, and pruning and shaking do not use the model.
349
- If no note is ready at the threshold, pi-context-kit can postpone the handoff until the note in progress is ready. It can also write a new note, which adds one model request.
362
+ Usually not. The handoff note is written in the background, and pruning and shaking do not use the model. If no note is ready at the threshold, pi-context-kit can postpone the handoff until the note in progress is ready. It can also write a new note, which adds one model request.
350
363
 
351
364
  **Does it cost more?**
352
365
  A handoff note is one extra model request. It uses the same model, thinking level, and tool choice as your session. With Anthropic, this lets the provider reuse the cached conversation. Caching is not guaranteed.
@@ -2,11 +2,10 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://unpkg.com/pi-context-kit/context-kit.schema.json",
4
4
  "title": "pi-context-kit settings",
5
- "description": "~/.pi/agent/context-kit.json, or .pi/context-kit.json in a trusted project.",
5
+ "description": "The \"context-kit\" namespace of Pi's settings.json: ~/.pi/agent/settings.json, or .pi/settings.json in a trusted project.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
- "$schema": { "type": "string" },
10
9
  "enabled": {
11
10
  "description": "false stops context maintenance and handoff notes. recall stays available.",
12
11
  "type": "boolean",
@@ -29,81 +28,63 @@
29
28
  "enum": ["balanced", "frugal", "pi-summary"],
30
29
  "default": "balanced"
31
30
  },
32
- "advanced": {
33
- "type": "object",
34
- "additionalProperties": false,
35
- "properties": {
36
- "methodOrder": {
37
- "description": "Replaces the method order of the strategy. Methods after \"soft\" never run.",
38
- "type": "array",
39
- "items": { "enum": ["handoff", "shake", "soft"] }
40
- },
41
- "background": {
42
- "description": "Write the handoff note in the background before the threshold. The strategy sets the default.",
43
- "type": "boolean"
44
- },
45
- "supersedeReads": {
46
- "description": "Replace an older read of a file that was read again.",
47
- "type": "boolean",
48
- "default": true
49
- },
50
- "progressRatio": {
51
- "description": "Each method must bring the context to this fraction of the threshold, or the next method runs.",
52
- "type": "number",
53
- "exclusiveMinimum": 0,
54
- "maximum": 1,
55
- "default": 0.8
56
- },
57
- "prune": {
58
- "type": "object",
59
- "additionalProperties": false,
60
- "properties": {
61
- "enabled": { "type": "boolean", "default": true },
62
- "protectTokens": {
63
- "description": "The newest tool outputs, up to this many tokens, are never pruned.",
64
- "type": "integer",
65
- "minimum": 0,
66
- "default": 40000
67
- },
68
- "minSavings": {
69
- "description": "Prune only when this many tokens or more are removed.",
70
- "type": "integer",
71
- "minimum": 0,
72
- "default": 20000
73
- },
74
- "minTokens": {
75
- "description": "Tool outputs smaller than this are never pruned.",
76
- "type": "integer",
77
- "minimum": 0,
78
- "default": 50
79
- }
80
- }
81
- },
82
- "shake": {
83
- "type": "object",
84
- "additionalProperties": false,
85
- "properties": {
86
- "protectTokens": {
87
- "description": "The newest context, up to this many tokens, is never shaken.",
88
- "type": "integer",
89
- "minimum": 0,
90
- "default": 16000
91
- },
92
- "minSavings": {
93
- "description": "Shake only when this many tokens or more are removed.",
94
- "type": "integer",
95
- "minimum": 0,
96
- "default": 4000
97
- },
98
- "blockMinTokens": {
99
- "description": "Code and XML blocks smaller than this are never shaken.",
100
- "type": "integer",
101
- "minimum": 0,
102
- "default": 400
103
- }
104
- }
105
- }
106
- }
31
+ "methodOrder": {
32
+ "description": "Replaces the method order of the strategy. Methods after \"soft\" never run.",
33
+ "type": "array",
34
+ "items": { "enum": ["handoff", "shake", "soft"] }
35
+ },
36
+ "background": {
37
+ "description": "Write the handoff note in the background before the threshold. The strategy sets the default.",
38
+ "type": "boolean"
39
+ },
40
+ "supersedeReads": {
41
+ "description": "Replace an older read of a file that was read again.",
42
+ "type": "boolean",
43
+ "default": true
44
+ },
45
+ "progressRatio": {
46
+ "description": "Each method must bring the context to this fraction of the threshold, or the next method runs.",
47
+ "type": "number",
48
+ "exclusiveMinimum": 0,
49
+ "maximum": 1,
50
+ "default": 0.8
51
+ },
52
+ "pruneEnabled": { "type": "boolean", "default": true },
53
+ "pruneProtectTokens": {
54
+ "description": "The newest tool outputs, up to this many tokens, are never pruned.",
55
+ "type": "integer",
56
+ "minimum": 0,
57
+ "default": 40000
58
+ },
59
+ "pruneMinSavings": {
60
+ "description": "Prune only when this many tokens or more are removed.",
61
+ "type": "integer",
62
+ "minimum": 0,
63
+ "default": 20000
64
+ },
65
+ "pruneMinTokens": {
66
+ "description": "Tool outputs smaller than this are never pruned.",
67
+ "type": "integer",
68
+ "minimum": 0,
69
+ "default": 50
70
+ },
71
+ "shakeProtectTokens": {
72
+ "description": "The newest context, up to this many tokens, is never shaken.",
73
+ "type": "integer",
74
+ "minimum": 0,
75
+ "default": 16000
76
+ },
77
+ "shakeMinSavings": {
78
+ "description": "Shake only when this many tokens or more are removed.",
79
+ "type": "integer",
80
+ "minimum": 0,
81
+ "default": 4000
82
+ },
83
+ "shakeBlockMinTokens": {
84
+ "description": "Code and XML blocks smaller than this are never shaken.",
85
+ "type": "integer",
86
+ "minimum": 0,
87
+ "default": 400
107
88
  }
108
89
  }
109
90
  }