pi-context-kit 0.4.2 → 0.4.3

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,30 +2,38 @@
2
2
 
3
3
  Pi shows the entries newer than your installed version after `pi update`.
4
4
 
5
- ## [0.4.2] - 2026-11-13
5
+ ## 0.4.3
6
+
7
+ ### Patch Changes
8
+
9
+ - An early summary can no longer be longer than the room left under the threshold. Before, Pi could generate a longer summary that pi-context-kit then rejected.
10
+ - The documentation is in English only. The Simplified Chinese translation is removed.
11
+ - The README states that handoff notes and summaries skip the `context` and `before_provider_request` hooks of other extensions, as Pi's own compaction summaries do.
12
+
13
+ ## 0.4.2 - 2026-11-13
6
14
 
7
15
  - Documentation in Simplified Chinese: README, contribution guide and security policy. No change to the extension.
8
16
 
9
- ## [0.4.1] - 2026-11-13
17
+ ## 0.4.1 - 2026-11-13
10
18
 
11
19
  - The README has a quick start and a troubleshooting section. No change to the extension.
12
20
 
13
- ## [0.4.0] - 2026-11-13
21
+ ## 0.4.0 - 2026-11-13
14
22
 
15
23
  - The footer shows how full the context is and when cleanup starts, for example `Context 62% · cleanup at 75%`.
16
24
  - `/context-kit` opens a panel to turn cleanup on or off, and to choose when and how to clean up.
17
25
  - Settings move to their own file: `~/.pi/agent/context-kit.json`, and `.pi/context-kit.json` in a trusted project. At the first start, the `contextKit` entry of Pi's `settings.json` moves there with the same behavior.
18
26
  - The default threshold is now `75%`. Set `"threshold": "pi"` to wait for Pi's limit as before.
19
27
 
20
- ## [0.3.2] - 2026-11-11
28
+ ## 0.3.2 - 2026-11-11
21
29
 
22
30
  - Documentation only.
23
31
 
24
- ## [0.3.1] - 2026-11-11
32
+ ## 0.3.1 - 2026-11-11
25
33
 
26
34
  - Documentation and package metadata only.
27
35
 
28
- ## [0.3.0] - 2026-11-11
36
+ ## 0.3.0 - 2026-11-11
29
37
 
30
38
  - Breaking: the `staleSuffixTokens` setting is removed. Remove it from your settings.
31
39
  - Supports Pi 1.5. Pi 1.0.3 is still the oldest supported version.
@@ -35,11 +43,11 @@ Pi shows the entries newer than your installed version after `pi update`.
35
43
  - With Pi's compaction off, pi-context-kit changes the context only on `/compact`.
36
44
  - Background handoff notes are cancelled after session-tree navigation.
37
45
 
38
- ## [0.2.1] - 2026-10-06
46
+ ## 0.2.1 - 2026-10-06
39
47
 
40
48
  - The README explains each term, the steps of a session, and each setting.
41
49
 
42
- ## [0.2.0] - 2026-10-06
50
+ ## 0.2.0 - 2026-10-06
43
51
 
44
52
  - Handoff notes use the session's thinking level and tool choice, so Anthropic can reuse the cached conversation.
45
53
  - An earlier threshold compacts at the end of a turn, even when no handoff note is ready.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 HugoLopes45
3
+ Copyright (c) 2026 Hugo Lopes
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # pi-context-kit: long Pi sessions that stay sharp
2
2
 
3
- English | [简体中文](https://github.com/HugoLopes45/pi-context-kit/blob/main/README.zh-CN.md)
4
-
5
- [![CI](https://github.com/HugoLopes45/pi-context-kit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HugoLopes45/pi-context-kit/actions/workflows/ci.yml)
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)
6
4
  [![npm](https://img.shields.io/npm/v/pi-context-kit)](https://www.npmjs.com/package/pi-context-kit)
7
5
  [![Pi package](https://img.shields.io/badge/pi.dev-package-blue)](https://pi.dev/packages/pi-context-kit)
8
6
  [![Node.js](https://img.shields.io/node/v/pi-context-kit)](https://nodejs.org)
9
7
  [![License: MIT](https://img.shields.io/npm/l/pi-context-kit)](LICENSE)
10
8
 
11
- 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.
9
+ **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.
12
10
 
13
- ```sh
11
+ ```bash
14
12
  pi install npm:pi-context-kit
15
13
  ```
16
14
 
@@ -45,12 +43,12 @@ These notices never change your messages or the model's tool calls. The model's
45
43
 
46
44
  ## Pi alone, and Pi with pi-context-kit
47
45
 
48
- | In a long session | Pi alone | With pi-context-kit |
49
- | --- | --- | --- |
50
- | The model reads the same file again | Both copies stay in the context. | The old copy is replaced, above the threshold. |
51
- | Old tool outputs fill the context | They stay until Pi summarizes. | They are replaced with a short notice. No model request. |
52
- | The context reaches the limit | Pi writes a summary. | A handoff note can be ready, because it was written in the background. |
53
- | The model needs a removed detail | The summary is all that remains in the context. | The model calls `recall` to read the original text. |
46
+ | In a long session | Pi alone | With pi-context-kit |
47
+ | ----------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------- |
48
+ | The model reads the same file again | Both copies stay in the context. | The old copy is replaced, above the threshold. |
49
+ | Old tool outputs fill the context | They stay until Pi summarizes. | They are replaced with a short notice. No model request. |
50
+ | The context reaches the limit | Pi writes a summary. | A handoff note can be ready, because it was written in the background. |
51
+ | The model needs a removed detail | The summary is all that remains in the context. | The model calls `recall` to read the original text. |
54
52
 
55
53
  The original session entries never change. Only the context that Pi sends to the model becomes smaller.
56
54
 
@@ -65,17 +63,17 @@ In a long session, the conversation fills the context window. File reads and com
65
63
  <details>
66
64
  <summary>Words used in this document</summary>
67
65
 
68
- | Word | Meaning |
69
- | --- | --- |
70
- | Token | A small piece of text. The model counts its memory in tokens. |
71
- | Context window | The maximum number of tokens that the model can read at one time. |
72
- | Context | All the text that Pi sends to the model now: instructions, messages, and tool outputs. |
73
- | Turn | One cycle: the model replies, uses its tools, and stops. |
74
- | Tool output | The result of a tool, for example the content of a file or the output of a command. |
75
- | Threshold | The number of tokens at which maintenance starts. |
76
- | Compaction | Pi replaces the old conversation with a summary. The newest messages stay. |
77
- | Handoff note | A summary that pi-context-kit writes with the same model as your session. |
78
- | Pi's summary | The summary that Pi writes when no handoff note is available. |
66
+ | Word | Meaning |
67
+ | -------------- | -------------------------------------------------------------------------------------- |
68
+ | Token | A small piece of text. The model counts its memory in tokens. |
69
+ | Context window | The maximum number of tokens that the model can read at one time. |
70
+ | Context | All the text that Pi sends to the model now: instructions, messages, and tool outputs. |
71
+ | Turn | One cycle: the model replies, uses its tools, and stops. |
72
+ | Tool output | The result of a tool, for example the content of a file or the output of a command. |
73
+ | Threshold | The number of tokens at which maintenance starts. |
74
+ | Compaction | Pi replaces the old conversation with a summary. The newest messages stay. |
75
+ | Handoff note | A summary that pi-context-kit writes with the same model as your session. |
76
+ | Pi's summary | The summary that Pi writes when no handoff note is available. |
79
77
 
80
78
  </details>
81
79
 
@@ -88,42 +86,34 @@ You need Pi 1.0.3 or later and Node.js 22.19 or later.
88
86
  3. Look at the footer. It shows `Context 0% · cleanup at 75%` when the extension is active.
89
87
  4. Work as usual. Type `/context-kit` to change the settings.
90
88
 
91
- ## Update, try or remove
92
-
93
- ```sh
94
- pi update npm:pi-context-kit # update, then restart Pi
95
- pi -e npm:pi-context-kit # try for one session without installing
96
- pi remove npm:pi-context-kit # remove, then restart Pi
97
- ```
98
-
99
- After an update, Pi shows what changed, from [CHANGELOG.md](CHANGELOG.md).
100
-
101
- ## Use it
89
+ ## Footer
102
90
 
103
91
  You do not need to configure anything. pi-context-kit shows its state in Pi's footer:
104
92
 
105
- | Footer | Meaning |
106
- | --- | --- |
107
- | `Context 62% · cleanup at 75%` | The context is 62% full. Cleanup starts at 75%. |
93
+ | Footer | Meaning |
94
+ | ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
95
+ | `Context 62% · cleanup at 75%` | The context is 62% full. Cleanup starts at 75%. |
108
96
  | `Context 70% · cleanup at 75% · writing summary` | A handoff note is being written in the background. `summary ready` means that it is ready. |
109
- | `Context 25% · no automatic cleanup` | Pi's automatic compaction is off, so cleanup runs only when you type `/compact`. |
110
- | `Context cleanup off` | You turned automatic cleanup off. |
97
+ | `Context 25% · no automatic cleanup` | Pi's automatic compaction is off, so cleanup runs only when you type `/compact`. |
98
+ | `Context cleanup off` | You turned automatic cleanup off. |
111
99
 
112
100
  After pi-context-kit shortens old outputs, Pi shows a notice, for example: `pi-context-kit freed 17% of the context (34k tokens). The agent can still look up what was removed.`
113
101
 
102
+ ## Commands
103
+
114
104
  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.
115
105
 
116
- | Panel line | Choices | Setting in the file |
117
- | --- | --- | --- |
118
- | Automatic cleanup | On, Off | `enabled` |
119
- | Clean up when the context is | 50% to 90% full, At Pi's limit | `threshold` |
120
- | Cleanup method | Summary notes (recommended), Trim first, Pi's summary | `strategy`: `"balanced"`, `"frugal"`, `"pi-summary"` |
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"` |
121
111
 
122
112
  The panel does not show the Cleanup method line when `advanced.methodOrder` is in the file, because that setting replaces the method.
123
113
 
124
114
  Outside the interactive mode, `/context-kit` shows the current settings in one line.
125
115
 
126
- ## How it works during a session
116
+ ## How it works
127
117
 
128
118
  ```text
129
119
  Every turn ends
@@ -172,14 +162,16 @@ The newest 40,000 tokens of tool outputs always stay. pi-context-kit keeps this
172
162
 
173
163
  If pruning is not sufficient, pi-context-kit tries the methods of the [strategy](#main-settings), one after the other:
174
164
 
175
- | Method | What it does | Uses the model? |
176
- | --- | --- | --- |
177
- | `handoff` | Replaces the old conversation with the handoff note. The newest messages stay. | Yes |
178
- | `shake` | Replaces large old code blocks, XML blocks, and images with a short notice. Your messages are never shaken. | No |
179
- | `soft` | Replaces the old conversation with Pi's summary. The newest messages stay. Stops here. | Yes |
165
+ | Method | What it does | Uses the model? |
166
+ | --------- | ----------------------------------------------------------------------------------------------------------- | --------------- |
167
+ | `handoff` | Replaces the old conversation with the handoff note. The newest messages stay. | Yes |
168
+ | `shake` | Replaces large old code blocks, XML blocks, and images with a short notice. Your messages are never shaken. | No |
169
+ | `soft` | Replaces the old conversation with Pi's summary. The newest messages stay. Stops here. | Yes |
180
170
 
181
171
  Your work continues during these steps. pi-context-kit never stops a running task to compact.
182
172
 
173
+ Failed and truncated responses remain under Pi's recovery control. Aborted turns do not start background notes or commit maintenance edits. Disabling cleanup cancels pending notes at the next turn boundary.
174
+
183
175
  ### The `recall` tool
184
176
 
185
177
  The `recall` tool reads original session text, not the shortened context sent to the model. It can:
@@ -188,6 +180,8 @@ The `recall` tool reads original session text, not the shortened context sent to
188
180
  - read an entry's text by ID, with pagination for large entries.
189
181
 
190
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`.
184
+
191
185
  Images remain in the original session entries, but `recall` returns only their MIME types, not image content.
192
186
  The model must call `recall` to retrieve a missing detail. Retrieval is not automatic.
193
187
 
@@ -208,9 +202,9 @@ This section is for users who edit the settings file. The panel changes the thre
208
202
 
209
203
  ### The settings files
210
204
 
211
- | File | Applies to |
212
- | --- | --- |
213
- | `~/.pi/agent/context-kit.json` | All your projects. `~` is your home folder. |
205
+ | File | Applies to |
206
+ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
207
+ | `~/.pi/agent/context-kit.json` | All your projects. `~` is your home folder. |
214
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. |
215
209
 
216
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.
@@ -227,21 +221,21 @@ Add the `$schema` line to get completion and checks in editors such as VS Code:
227
221
 
228
222
  ### Main settings
229
223
 
230
- | Setting | Allowed values | Default | What it does |
231
- | --- | --- | --- | --- |
232
- | `enabled` | `true`, `false` | `true` | `false` stops all maintenance and handoff notes. The `recall` tool stays available. |
233
- | `threshold` | A whole number of tokens, a percentage such as `"75%"`, or `"pi"` | `"75%"` | Where maintenance starts. |
234
- | `strategy` | `"balanced"`, `"frugal"`, `"pi-summary"` | `"balanced"` | What pi-context-kit does when pruning is not sufficient. |
224
+ | Setting | Allowed values | Default | What it does |
225
+ | ----------- | ----------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------- |
226
+ | `enabled` | `true`, `false` | `true` | `false` stops all maintenance and handoff notes. The `recall` tool stays available. |
227
+ | `threshold` | A whole number of tokens, a percentage such as `"75%"`, or `"pi"` | `"75%"` | Where maintenance starts. |
228
+ | `strategy` | `"balanced"`, `"frugal"`, `"pi-summary"` | `"balanced"` | What pi-context-kit does when pruning is not sufficient. |
235
229
 
236
230
  **`threshold`.** A percentage applies to each model's context window, so `"75%"` is 150,000 tokens with a 200,000-token window and 750,000 tokens with a 1,000,000-token window. Decimals are allowed, for example `"72.5%"`. A number such as `150000` is the same for all models. Do not put spaces, dots or commas in a number of tokens. `"pi"` waits for Pi's own limit. pi-context-kit can start before Pi's limit, never after: if your value is larger, Pi's limit is used. See [Pi settings that also apply](#pi-settings-that-also-apply).
237
231
 
238
232
  **`strategy`.**
239
233
 
240
- | Strategy (panel name) | Above the threshold, after pruning | Background requests |
241
- | --- | --- | --- |
242
- | `"balanced"` (Summary notes) | A handoff note. If the note fails, shake. Then Pi's summary. | Yes: the note is written before the threshold. |
243
- | `"frugal"` (Trim first) | Shake, because it does not call the model. If that is not sufficient, a handoff note. Then Pi's summary. | No |
244
- | `"pi-summary"` (Pi's summary) | Pi's summary. No handoff note, no shaking. | No |
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 |
245
239
 
246
240
  ### Advanced settings
247
241
 
@@ -260,19 +254,19 @@ Put these settings in an `advanced` block. Most users never need them.
260
254
  }
261
255
  ```
262
256
 
263
- | Setting | Default | What it does |
264
- | --- | --- | --- |
265
- | `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. |
266
- | `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. |
267
- | `supersedeReads` | `true` | Replaces the old copy of a file that the model read again. |
268
- | `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. |
269
- | `prune.enabled` | `true` | `false` never prunes tool outputs. |
270
- | `prune.protectTokens` | `40000` | The newest tool outputs, up to this number of tokens, are never pruned. |
271
- | `prune.minSavings` | `20000` | Pruning occurs only if it removes at least this number of tokens. |
272
- | `prune.minTokens` | `50` | Tool outputs smaller than this are never pruned. |
273
- | `shake.protectTokens` | `16000` | The newest context, up to this number of tokens, is never shaken. Your own messages are never shaken. |
274
- | `shake.minSavings` | `4000` | Shaking occurs only if it removes at least this number of tokens. |
275
- | `shake.blockMinTokens` | `400` | Code and XML blocks smaller than this are never shaken. |
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. |
276
270
 
277
271
  ### When a setting is incorrect
278
272
 
@@ -288,42 +282,42 @@ Pi also warns about a setting name with a spelling mistake, a file that is not v
288
282
 
289
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.
290
284
 
291
- | 0.3 (`contextKit` in `settings.json`) | 0.4 (`context-kit.json`) |
292
- | --- | --- |
293
- | `thresholdTokens: 150000` | `threshold: 150000` |
294
- | `thresholdPercent: 75` | `threshold: "75%"` |
295
- | Both `thresholdTokens` and `thresholdPercent` | `threshold` with the number of tokens |
296
- | No threshold (Pi's limit) | `threshold: "pi"`. The default for new users is `"75%"`. |
297
- | `methodOrder: ["shake", "handoff", "soft"]` | `strategy: "frugal"`, with `advanced.background: true` unless `asyncEnabled` was `false` |
298
- | `methodOrder: ["soft"]` | `strategy: "pi-summary"` |
299
- | 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. |
300
- | `asyncEnabled` | `advanced.background`, when it differs from the strategy |
301
- | `supersedeReads`, `progressRatio`, `prune`, `shake` | The same names in `advanced` |
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` |
302
296
 
303
297
  ### Pi settings that also apply
304
298
 
305
299
  These settings belong to Pi, not to pi-context-kit. Put them in the `compaction` block of Pi's `settings.json`.
306
300
 
307
- | Pi setting | Default | Effect on pi-context-kit |
308
- | --- | --- | --- |
309
- | `compaction.enabled` | `true` | `false` stops Pi's automatic compaction. Then pi-context-kit changes the context only on `/compact`, because there is no threshold. |
310
- | `compaction.reserveTokens` | `16384` | Pi's limit is the context window minus this number. pi-context-kit always starts at this limit or before. |
311
- | `compaction.keepRecentTokens` | `20000` | After a handoff note, approximately this number of the newest tokens stays unchanged. |
312
- | `compaction.modelOverrides` | none | Changes `reserveTokens` and `keepRecentTokens` for one model. |
301
+ | Pi setting | Default | Effect on pi-context-kit |
302
+ | ----------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
303
+ | `compaction.enabled` | `true` | `false` stops Pi's automatic compaction. Then pi-context-kit changes the context only on `/compact`, because there is no threshold. |
304
+ | `compaction.reserveTokens` | `16384` | Pi's limit is the context window minus this number. pi-context-kit always starts at this limit or before. |
305
+ | `compaction.keepRecentTokens` | `20000` | After a handoff note, approximately this number of the newest tokens stays unchanged. |
306
+ | `compaction.modelOverrides` | none | Changes `reserveTokens` and `keepRecentTokens` for one model. |
313
307
 
314
308
  pi-context-kit has no setting per model. To start earlier for one model only, make Pi's limit smaller for this model with `compaction.modelOverrides`, for example `{ "compaction": { "modelOverrides": { "provider/model-id": { "reserveTokens": 80000 } } } }`. With a 200,000-token window, this model then starts at 120,000 tokens at the latest. The model key must be the exact `provider/modelId`. To see the IDs, type `pi --list-models`.
315
309
 
316
- ## Recipes
310
+ ### Recipes
317
311
 
318
- | I want to... | `context-kit.json` |
319
- | --- | --- |
320
- | Start later, at Pi's own limit | `{ "threshold": "pi" }` |
321
- | Start at the same number of tokens on all models | `{ "threshold": 150000 }` |
322
- | Avoid model requests when possible | `{ "strategy": "frugal" }` |
323
- | Never write a handoff note | `{ "advanced": { "methodOrder": ["shake", "soft"] } }` |
324
- | Keep more recent tool outputs | `{ "advanced": { "prune": { "protectTokens": 80000 } } }` |
325
- | Keep all old file copies | `{ "advanced": { "supersedeReads": false } }` |
326
- | Turn pi-context-kit off, but keep `recall` | `{ "enabled": false }`, or `/context-kit` |
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` |
327
321
 
328
322
  ## Limits
329
323
 
@@ -333,6 +327,7 @@ pi-context-kit has no setting per model. To start earlier for one model only, ma
333
327
  - **If Pi's compaction is off** (`compaction.enabled: false`), pi-context-kit changes the context only when you run `/compact`. Then it writes a handoff note, as with compaction on. `threshold` is ignored, because pi-context-kit edits the context automatically only at a threshold.
334
328
  - **Manual compaction and errors.** When you type `/compact`, when the context is too large for the model, or when Pi compacts before a turn, `shake` cannot run. pi-context-kit uses a ready handoff note, or Pi's summary.
335
329
  - **The method order stops at `soft`.** The methods after `soft` do not run.
330
+ - **Summary requests skip session hooks.** Handoff notes and early summaries go to the model directly, as Pi's own compaction summaries do. The `context` and `before_provider_request` hooks of other extensions do not change these requests. If an extension removes sensitive text with these hooks, that text can still reach the model in a summary request.
336
331
  - **Subagents** read the same settings files. They show no warnings and no status, because they have no screen.
337
332
 
338
333
  ## Troubleshooting
@@ -365,21 +360,24 @@ Yes. Type `/compact` and the focus, for example `/compact keep the database migr
365
360
  **The model forgot a detail. What can I do?**
366
361
  Ask the model to use the `recall` tool, for example: "Use recall to find the error message from the first test run."
367
362
 
368
- ## Development
363
+ ## Update, try or remove
369
364
 
370
- ```sh
371
- npm ci
372
- npm run check
365
+ ```bash
366
+ pi update npm:pi-context-kit # update, then restart Pi
367
+ pi -e npm:pi-context-kit # try for one session without installing
368
+ pi remove npm:pi-context-kit # remove, then restart Pi
373
369
  ```
374
370
 
375
- The tests run offline with Pi's faux provider. They do not call a real model.
376
- Development uses Pi `1.5.2`. The oldest supported version is Pi `1.0.3`. CI checks the locked dependencies on Node 22 and 24, and Pi `1.0.3` and latest Pi on Node 24.
377
- Host-provided peer dependencies use `"*"`, as required by Pi's package guide. This is not a guarantee that every Pi version works.
371
+ After an update, Pi shows what changed, from [CHANGELOG.md](CHANGELOG.md).
372
+
373
+ ## Contributing
374
+
375
+ See [CONTRIBUTING.md](https://github.com/HugoLopes45/pi-extensions/blob/main/CONTRIBUTING.md) for setup, checks and releases. Report bugs on [GitHub Issues](https://github.com/HugoLopes45/pi-extensions/issues), and vulnerabilities through [SECURITY.md](https://github.com/HugoLopes45/pi-extensions/blob/main/SECURITY.md).
378
376
 
379
- ## Contributing and releases
377
+ ## Author
380
378
 
381
- See [CONTRIBUTING.md](CONTRIBUTING.md) for local checks, pull requests and releases. Report vulnerabilities through [SECURITY.md](SECURITY.md), not public issues.
379
+ Built by [Hugo Lopes](https://github.com/HugoLopes45), a senior frontend developer based in Paris, passionate about AI and agent harnesses.
382
380
 
383
381
  ## License
384
382
 
385
- MIT
383
+ [MIT](LICENSE)
@@ -17,7 +17,10 @@
17
17
  "default": "75%",
18
18
  "oneOf": [
19
19
  { "type": "integer", "minimum": 1 },
20
- { "type": "string", "pattern": "^(0*100(\\.0+)?|0*[1-9]\\d?(\\.\\d+)?|0+\\.\\d*[1-9]\\d*)%$" },
20
+ {
21
+ "type": "string",
22
+ "pattern": "^(0*100(\\.0+)?|0*[1-9]\\d?(\\.\\d+)?|0+\\.\\d*[1-9]\\d*)%$"
23
+ },
21
24
  { "const": "pi" }
22
25
  ]
23
26
  },