pi-tuck 1.3.3 → 1.4.1
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 +43 -0
- package/LICENSE +0 -59
- package/NOTICE +63 -0
- package/README.md +59 -189
- package/dist/index.d.ts +1 -4
- package/dist/index.js +49 -10
- package/dist/src/budget.d.ts +6 -15
- package/dist/src/budget.js +6 -11
- package/dist/src/build-id.d.ts +1 -1
- package/dist/src/build-id.js +1 -1
- package/dist/src/compaction.d.ts +12 -20
- package/dist/src/compaction.js +220 -202
- package/dist/src/content-observations.d.ts +24 -0
- package/dist/src/content-observations.js +122 -0
- package/dist/src/diagnostics.d.ts +1 -3
- package/dist/src/ledger.d.ts +6 -3
- package/dist/src/ledger.js +14 -7
- package/dist/src/llama-continuation.d.ts +8 -0
- package/dist/src/llama-continuation.js +179 -0
- package/dist/src/omissions.d.ts +1 -5
- package/dist/src/omissions.js +8 -10
- package/dist/src/recall.js +8 -25
- package/dist/src/request-capacity.d.ts +11 -26
- package/dist/src/request-capacity.js +20 -57
- package/dist/src/run.d.ts +16 -7
- package/dist/src/run.js +53 -25
- package/dist/src/status.d.ts +2 -0
- package/dist/src/status.js +6 -5
- package/dist/src/tuck/core/format.js +1 -1
- package/dist/src/tuck/core/readable-content.d.ts +14 -0
- package/dist/src/tuck/core/readable-content.js +43 -0
- package/dist/src/tuck.d.ts +2 -1
- package/dist/src/tuck.js +92 -30
- package/index.ts +42 -10
- package/package.json +3 -2
- package/src/budget.ts +7 -12
- package/src/build-id.ts +1 -1
- package/src/compaction.ts +220 -193
- package/src/content-observations.ts +115 -0
- package/src/diagnostics.ts +1 -1
- package/src/ledger.ts +17 -10
- package/src/llama-continuation.ts +176 -0
- package/src/omissions.ts +8 -10
- package/src/recall.ts +8 -20
- package/src/request-capacity.ts +18 -57
- package/src/run.ts +48 -22
- package/src/status.ts +8 -5
- package/src/tuck/core/format.ts +1 -1
- package/src/tuck/core/readable-content.ts +44 -0
- package/src/tuck.ts +79 -28
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to pi-tuck. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
4
4
|
[Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [1.4.1]
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- The release workflow fetches full history, so the Part 6 reference test runs before publishing. 1.4.0 was tagged but never
|
|
11
|
+
published; 1.4.1 ships the same code.
|
|
12
|
+
|
|
13
|
+
## [1.4.0]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Content lane: kept output, definition maps and plain-text thinking openings rank below kept reads and searches in the summary.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Post-cut headroom: cut at the room by default, and carry no more native history than Pi keeps. The adaptive cut point is gone.
|
|
22
|
+
|
|
23
|
+
- Use Pi's reserve as the cut target and replace the fixed reply floor with observed output for the active model. Observed reply demand stays within the reserve and the model's output limit.
|
|
24
|
+
- A cut above the room aims to leave 3,584 reply tokens, within the reserve and the model's output limit. Where no cut can, the request goes
|
|
25
|
+
out as before.
|
|
26
|
+
- Allow selected local models to defer early cuts.
|
|
27
|
+
- Support bounded native llama.cpp continuation for an explicitly configured and verified provider.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Preserve reasoning-only output exhaustion at the model's output limit. Below it, retry once, re-armed as Pi's overflow recovery is, and uncut
|
|
32
|
+
when a cut adds no reply room. A model with llama.cpp continuation retries at most once per run, and only when a cut increases the estimated
|
|
33
|
+
reply cap.
|
|
34
|
+
- Require standalone overflow recovery cuts to lower estimated input and combined request size when the failed request has a paired estimate.
|
|
35
|
+
- Stop inferring a smaller context window from an ambiguous length stop. Windows inferred by earlier versions no longer constrain requests.
|
|
36
|
+
- Reject invalid run transitions and discard pending cuts when their branch or model budget changes.
|
|
37
|
+
- Keep valid settings active when another field in `pi-tuck.json` is invalid.
|
|
38
|
+
|
|
39
|
+
## [1.3.4] - 2026-11-20
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- **A session that already holds a summary from Pi's own `/compact` works with pi-tuck.** Loading pi-tuck into a session whose history
|
|
44
|
+
already contained a summary written by Pi's built-in compaction, not by pi-tuck, made every prompt fail before it was sent ("pi-tuck could
|
|
45
|
+
not plan this request (Cannot resolve custom sources in an unsupported compaction summary)"), so the session could neither continue nor
|
|
46
|
+
reach a cut. Such a summary is now sent as it is, as Pi sends it, and pi-tuck's next cut replaces it. Thanks to basileaw for the detailed
|
|
47
|
+
report and root cause (#1).
|
|
48
|
+
|
|
6
49
|
## [1.3.3] - 2026-11-20
|
|
7
50
|
|
|
8
51
|
### Fixed
|
package/LICENSE
CHANGED
|
@@ -20,62 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
20
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
SOFTWARE.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
Portions derived from pi-blackhole (https://github.com/k0valik/pi-blackhole).
|
|
27
|
-
The following notice is retained for those portions:
|
|
28
|
-
|
|
29
|
-
MIT License
|
|
30
|
-
|
|
31
|
-
Copyright (c) 2026 k0valik
|
|
32
|
-
|
|
33
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
35
|
-
in the Software without restriction, including without limitation the rights
|
|
36
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
38
|
-
furnished to do so, subject to the following conditions:
|
|
39
|
-
|
|
40
|
-
The above copyright notice and this permission notice shall be included in all
|
|
41
|
-
copies or substantial portions of the Software.
|
|
42
|
-
|
|
43
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
-
SOFTWARE.
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
Pi-derived inlined message constructors
|
|
54
|
-
|
|
55
|
-
The following notice applies to the adapted createCustomMessage and
|
|
56
|
-
createBranchSummaryMessage construction branches in src/tuck/cut.ts
|
|
57
|
-
and their distributed generated equivalents. Notice source: Pi v1.1.0,
|
|
58
|
-
https://github.com/earendil-works/pi/blob/abe508e1b89912adde45528136c3221eb69acdd7/LICENSE
|
|
59
|
-
This notice-source pin does not identify the original copy revision.
|
|
60
|
-
|
|
61
|
-
MIT License
|
|
62
|
-
|
|
63
|
-
Copyright (c) 2025 Mario Zechner
|
|
64
|
-
|
|
65
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
66
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
67
|
-
in the Software without restriction, including without limitation the rights
|
|
68
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
69
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
70
|
-
furnished to do so, subject to the following conditions:
|
|
71
|
-
|
|
72
|
-
The above copyright notice and this permission notice shall be included in all
|
|
73
|
-
copies or substantial portions of the Software.
|
|
74
|
-
|
|
75
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
76
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
77
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
78
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
79
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
80
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
81
|
-
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
pi-tuck is released under the MIT License in LICENSE. Some portions are derived from the projects below; their notices are retained here
|
|
4
|
+
word for word, as their licenses require.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Portions derived from pi-blackhole (https://github.com/k0valik/pi-blackhole).
|
|
9
|
+
The following notice is retained for those portions:
|
|
10
|
+
|
|
11
|
+
MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026 k0valik
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Pi-derived inlined message constructors
|
|
36
|
+
|
|
37
|
+
The following notice applies to the adapted createCustomMessage and
|
|
38
|
+
createBranchSummaryMessage construction branches in src/tuck/cut.ts
|
|
39
|
+
and their distributed generated equivalents. Notice source: Pi v1.1.0,
|
|
40
|
+
https://github.com/earendil-works/pi/blob/abe508e1b89912adde45528136c3221eb69acdd7/LICENSE
|
|
41
|
+
This notice-source pin does not identify the original copy revision.
|
|
42
|
+
|
|
43
|
+
MIT License
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2025 Mario Zechner
|
|
46
|
+
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
49
|
+
in the Software without restriction, including without limitation the rights
|
|
50
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
52
|
+
furnished to do so, subject to the following conditions:
|
|
53
|
+
|
|
54
|
+
The above copyright notice and this permission notice shall be included in all
|
|
55
|
+
copies or substantial portions of the Software.
|
|
56
|
+
|
|
57
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
58
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
59
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
60
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
61
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,217 +1,75 @@
|
|
|
1
1
|
# pi-tuck
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
pi-tuck is an extension for [Pi](https://pi.dev). It builds deterministic compaction summaries from the saved session without calling a model. After a cut, the agent can look up original text and tool results on the current branch.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Use Pi 1.2.0 or later and Node.js 22.19.0 or later on macOS, Linux, or Windows.
|
|
4
8
|
|
|
5
9
|
```sh
|
|
6
10
|
pi install npm:pi-tuck
|
|
7
11
|
```
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Pi's built-in compaction asks a model to write a summary. pi-tuck builds the summary from the session itself. The time, context and task rows compare pi-tuck 1.0.1 with Pi 1.4.0's built-in compaction, where a local model writes the summary. Each measured result in this README names the pi-tuck build or version it was measured on; the release you install may be newer.
|
|
12
|
-
|
|
13
|
-
| | Pi's built-in (local model writes the summary) | pi-tuck |
|
|
14
|
-
|---|---|---|
|
|
15
|
-
| Model call per cut | One, to a model you pay for or wait on | None |
|
|
16
|
-
| Time per cut | **235 s** (median) | **0.08 s** (median; an upper bound, see below) |
|
|
17
|
-
| Context carried after a cut | 27,750 tokens | 26,790 tokens (about the same) |
|
|
18
|
-
| Facts cut away, asked back at 128k (mechanical probes) | Answered from the summary alone, with no recall tool | Answered from the summary and pi-tuck's recall tools, cuts 1 to 4 only. Claim line below the table |
|
|
19
|
-
| Tasks resolved at 128k (300 SWE-bench Verified tasks per arm, pi-tuck 1.0.1) | 251 of 300 | 258 of 300. The registered claim is only "no loss larger than 0.4 points"; chain s09 matters, see below |
|
|
20
|
-
| Same session, same summary | Not guaranteed, since a model writes it | Yes |
|
|
21
|
-
| Can the agent get dropped detail back | No recall tool in Pi 1.4.0. The full history stays in the session file, but the agent has no tool made to search it | Yes. `tuck_recall` reads any original exactly |
|
|
22
|
-
| Can the summary invent history | It can, since a model writes it | No, it holds only recorded text |
|
|
23
|
-
| What the summary leaves out | Whatever the model dropped | Tool output only; the agent reads it back exactly |
|
|
24
|
-
| Tasks resolved at a 32k window (150 SWE-bench Verified tasks, one model, pi-tuck 1.0.5) | 94 of 150 | 120 of 150 (+17.3 points, 95% lower bound +10.7). Limits below the table |
|
|
25
|
-
|
|
26
|
-
The time and context rows are from the 128k live run: 10 chains of 30 tasks, pi-tuck 1.0.1, medians over 46 pi-tuck cuts and 48 cuts by Pi's compaction. pi-tuck's cut time is an upper bound, read from the session file ([`benchmark/DEVIATIONS.md`](benchmark/DEVIATIONS.md)).
|
|
27
|
-
|
|
28
|
-
The retention row is a paired replay on mechanical probes only: files changed, test-runner summary, required tag, error class and the session's result-line rule. No probe judged how well an agent reasons. The claim line, as [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) words it: **pi-tuck, answering with its recall tools, retains probed facts at a rate not more than 3 points below that of "Pi's compaction prompts on mac-studio/main:xhigh" (20 recordings) or of "Pi's compaction prompts on GPT-6.1 Terra" (19 of 20 recordings, s09-A missing), each answering from its summary alone, on these probes.** This is not summary against summary: it compares pi-tuck's summary together with its recall tools against Pi's compaction without them, and the run has no pi-tuck arm without its recall tools. It says nothing about any other compactor, model or window.
|
|
13
|
+
Start a new Pi process after installing or updating. pi-tuck handles automatic compaction and `/compact` by default. Run `/tuck` to see the loaded version, cut history, and active cut policy.
|
|
29
14
|
|
|
30
|
-
|
|
15
|
+
This README describes pi-tuck 1.4.1. To pin a published release, use a versioned source such as `pi install npm:pi-tuck@1.4.1` or `pi install git:github.com/galyavin/pi-tuck@v1.4.1`. To uninstall, run `pi remove` with the source you installed.
|
|
31
16
|
|
|
32
|
-
|
|
17
|
+
## Compaction and recall
|
|
33
18
|
|
|
34
|
-
|
|
19
|
+
A cut replaces older turns in the model's context with a summary while keeping the original entries in the session. The summary prioritizes the current prompt, recent turns, excerpts from earlier prompts, and pointers to files and tool actions. It can also carry recent reads and searches when the session records no action that could have changed their files. The recorded text is historical evidence about the session. Re-read a file before editing it.
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
> "What was the reason we dropped the retry on the token refresh?"
|
|
39
|
-
|
|
40
|
-
The agent searches its history by keyword with `tuck_recall`:
|
|
21
|
+
When pi-tuck is active, `tuck_recall` becomes available after a cut on the current branch. Use a keyword query to locate a passage.
|
|
41
22
|
|
|
42
23
|
```json
|
|
43
24
|
{ "query": "retry token refresh" }
|
|
44
25
|
```
|
|
45
26
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{ "index": 212 }
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The agent answers from the original text, not from a model's memory of it.
|
|
27
|
+
Read the original by the hit's `entryId`, or use `{"index": 212}` to follow a `#212` reference in the summary. Pass a search result's `next` value as `continuation` to get the next page. Page long sources with `offset` and `limit` in UTF-16 characters. Use `outputPath` with an `entryId` or `index` to export eligible text through Pi's `write` tool. Recall excludes hidden reasoning and system records.
|
|
53
28
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Install
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
pi install npm:pi-tuck
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Then start a new Pi session. That is all. pi-tuck takes over Pi's compaction, both automatic and `/compact`. You change no setting.
|
|
63
|
-
|
|
64
|
-
- Needs Pi 1.2.0 or later (tested on 1.2.0 and 1.4.0), on macOS, Linux or Windows (Windows since 1.2.0, tested on Windows 10 with Node 24 and Pi 1.5.2). On an older Pi, pi-tuck stays off, Pi's own compaction runs, and pi-tuck says so once.
|
|
65
|
-
- Prefer GitHub? `pi install git:github.com/galyavin/pi-tuck@v1.3.1`.
|
|
66
|
-
- To pin a version, add it: `pi install npm:pi-tuck@1.3.1`.
|
|
67
|
-
|
|
68
|
-
## Uninstall
|
|
69
|
-
|
|
70
|
-
```sh
|
|
71
|
-
pi remove npm:pi-tuck
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Use the same source you installed with. This takes pi-tuck out of Pi's settings. pi-tuck downloads nothing, so there is nothing else to delete, apart from incident records if you turned `/tuck-incident` on: they are in `~/.local/state/pi-tuck-incidents`. Versions before 1.2.0 downloaded about 460 MB of files for a search feature that has been removed. pi-tuck deletes those old files itself, once per machine, the first time 1.2.0 starts, and a notice names the folders it removed. On Windows it leaves them alone, so delete `~/.pi/agent/pi-tuck` yourself if it exists.
|
|
75
|
-
|
|
76
|
-
## How it works
|
|
77
|
-
|
|
78
|
-
When context fills up, pi-tuck replaces the older turns with one summary. The summary keeps:
|
|
79
|
-
|
|
80
|
-
- **The dialogue and your prompts, ranked.** Since 1.0.18, one ranked list decides what a cut carries, across the summary and the kept tail together: the current prompt, whole; the openings of the first prompt and the newest answered prompts, sized to the room; the newest part of the conversation, kept as it is; the file and action lists below; and the rest of the conversation. Dropped turns and tool results are counted with index ranges that `tuck_recall` reads back. Clipped text says how to read it in full.
|
|
81
|
-
- **The files.** Files the agent read, wrote or edited, newest first (up to 60), each with a pointer to read it back.
|
|
82
|
-
- **Kept reads** (1.1.0 and later). After the Files list, the summary carries the newest whole read of each file that has no later write or edit, headed `read PATH (as recorded at #N; no write or edit recorded since):`. It keeps at most 4 files, whole outputs only, within 20% of the summary's room and never more than 24,000 characters. Since 1.2.0, a read is also dropped from the summary when a later shell command that is not read-only names the file, or when a git command such as `checkout`, `stash`, `restore` or `reset` ran, and paths are compared after normalising their spelling. When the summary is over its target, these records are dropped first, oldest first. With no such reads the summary is unchanged, and tool outputs are never touched. The header says only that no write or edit was recorded since the read; it does not say the file on disk is unchanged. After a cut, agents often doubted what an earlier read had shown and read the same file again, and this is meant to spare that. It has no effectiveness claim; see Benchmarks.
|
|
83
|
-
- **Kept searches** (1.3.0 and later; 1.3.0 never reached npm, so 1.3.1 is the first release with them). A cut's summary also keeps the latest output of a `grep` or `rg` search, per command and at most 4, beside the kept reads, while nothing the search lists has changed since: a later write or edit of a listed file, or a shell command that is not read-only and names one, drops it. Searches with shell syntax pi-tuck cannot classify are never kept. Kept searches share kept reads' space in the summary, so the summary's size target is unchanged. It has no effectiveness claim; see Benchmarks.
|
|
84
|
-
- **The action trail.** The agent's other tool calls, such as shell commands, newest first (up to 30). The output is left out. A pointer leads to it.
|
|
85
|
-
|
|
86
|
-
Tool output stays in the session file, not in the summary. Each summary ends with a short instruction to the agent: re-read a file before you edit it, look things up, and treat anything not shown as unknown.
|
|
87
|
-
|
|
88
|
-
The summary is plain text, one line per record, such as `#12 user @2026-10-30T14:00:00Z: text`. The number is the index that `tuck_recall` takes. Summaries from earlier versions are still read.
|
|
89
|
-
|
|
90
|
-
The agent gets one tool to get anything back:
|
|
91
|
-
|
|
92
|
-
- **`tuck_recall`** finds earlier text by keyword. It reads any original message or tool result exactly, by the index shown in a summary. It can also write an original out to a file.
|
|
93
|
-
|
|
94
|
-
pi-tuck's tool appears only after its first cut. Before that there is nothing out of view to recall, and a request is byte-identical to one without pi-tuck (254 of 254 requests on replay).
|
|
95
|
-
|
|
96
|
-
| Command | Does |
|
|
29
|
+
| Command | Purpose |
|
|
97
30
|
|---|---|
|
|
98
|
-
| `/
|
|
99
|
-
| `/tuck
|
|
100
|
-
|
|
101
|
-
Since 1.1.1, pi-tuck stands down to native Pi when it cannot do its job safely: with an unknown context window (0, missing or not a number), with a Pi virtual model, or with Pi's auto-compaction turned off. It then does exactly what native Pi does, and `/tuck` says `standing down:` with the reason. Refusal, overflow and manual-cut notices also reach stderr when there is no UI (`pi -p`, JSON runs), as the output-limit notice already did.
|
|
102
|
-
|
|
103
|
-
`/compact` works as usual. Text after it does not steer the summary, because pi-tuck builds the summary from the session itself: since 1.0.19 it cuts as plain `/compact` does and says the text was not used. Pi's own setting `"compaction": { "enabled": false }` turns compaction off.
|
|
104
|
-
|
|
105
|
-
## What is proven, and what is not
|
|
106
|
-
|
|
107
|
-
**Measured so far.** In the 128k live run (pi-tuck 1.0.1), a pi-tuck cut took a median 0.08 s, where Pi's compaction with a local model writing the summary took a median 235 s. A cut calls no model, so it costs no tokens. After a cut, both carried about the same context. On mechanical probes about facts cut away, pi-tuck with its recall tools was not more than 3 points below Pi's compaction prompts on mac-studio/main:xhigh, or below Pi's compaction prompts on GPT-6.1 Terra, each answering from its summary alone (claim line above; cuts 1 to 4 only). Over 300 tasks per arm, pi-tuck resolved 258 and Pi's compaction 251; the registered claim is only that pi-tuck lost no more than 0.4 points. In replay, answers held when pi-tuck cut at 60% of the room instead of 100%. At a 32k window, in one suite of 150 SWE-bench Verified tasks with one model, pi-tuck 1.0.5 resolved 120 tasks and Pi's built-in compaction 94 (+17.3 points, 95% lower bound +10.7). Observation masking resolved 117 (pi-tuck +2.0 points, lower bound −2.7: no difference shown). The limits of each result are in [Benchmarks](#benchmarks).
|
|
108
|
-
|
|
109
|
-
**Not claimed.** This README does not say that pi-tuck is as good as or better than any compactor, model, window or kind of task other than those named, and it never calls it "the best LLM compactor". The retention tests compare pi-tuck with its recall tools against Pi's compaction without them. The tests were pre-registered before any result came in. The plans, and every result, including those that did not favour pi-tuck, are in [`benchmark/`](benchmark).
|
|
110
|
-
|
|
111
|
-
The pre-registered plan has three parts:
|
|
112
|
-
|
|
113
|
-
1. **A live run** at a 128k window on a local model, with pi-tuck 1.0.1. Ten chains of 30 SWE-bench Verified tasks per arm, with Pi's built-in compaction in one arm and pi-tuck in the other. Official grading.
|
|
114
|
-
2. **A paired replay with probe questions.** The same cuts, made by pi-tuck and by Pi's summarize prompts, then questions about facts that fell before the cut. Pre-registered rule: the claim holds only if pi-tuck is no more than 3 points worse than the better compactor, with a one-sided 95% bound. The comparators are named in [`benchmark/PINS.md`](benchmark/PINS.md) and above.
|
|
115
|
-
3. **A 32k suite**, where tasks are bigger than the room, so cuts must summarise work in progress. Its result is the 32k row above.
|
|
116
|
-
|
|
117
|
-
The plan: [`benchmark/PREREG.md`](benchmark/PREREG.md), [`benchmark/PREREG-32K.md`](benchmark/PREREG-32K.md), [`benchmark/PREREG-TERRA.md`](benchmark/PREREG-TERRA.md), and every change after the freeze in [`benchmark/DEVIATIONS.md`](benchmark/DEVIATIONS.md).
|
|
118
|
-
|
|
119
|
-
Known limits today:
|
|
120
|
-
|
|
121
|
-
- pi-tuck's summary does not explain why things happened. It holds the words that were said, not a model's reading of them. The agent must look things up. Each look-up costs a tool call.
|
|
122
|
-
- Small windows: an upstream that spends far more context on tool schemas than others (some OpenRouter upstreams do) can leave a small input room too little space. pi-tuck then refuses to cut rather than overflow. This made 1.0.1 refuse at a 32k window with Pi's default 16,384 reserve. Version 1.0.4 added a notice that says when the provider counts far above pi-tuck's estimate. In 1.0.4, after an oversize tool result or a "Nothing to compact" error from Pi, a session could keep refusing later prompts; 1.0.5 fixed both. Version 1.0.8 clips a fresh tool result that is too large for the room (its head and tail, with a `tuck_recall` locator to the rest) instead of refusing the run. If a small window still refuses, pin a different upstream or use a larger window; see [Small windows](#small-windows).
|
|
123
|
-
- Small window, after a stopped run (1.0.8 and 1.0.9 only; fixed in 1.0.10): Pi's default `compaction.keepRecentTokens` (20,000) can exceed pi-tuck's input room, which was the window less the larger of `compaction.reserveTokens` and the model's maximum output (16,384 at a 32k window with the default reserve). After a run that is stopped (Esc, or a time limit) with the context above the room, every later prompt could be refused with "The request needs a cut and Pi has none to make (Nothing to compact (session too small))", and the session stayed stuck. In one check at these defaults (pi-tuck 1.0.8, 32k window, one session of 30 tasks, one local model), 28 tasks were lost, tasks 3 to 30 ([`benchmark/RESULTS-DEFAULTS.md`](benchmark/RESULTS-DEFAULTS.md)). If you are on 1.0.8 or 1.0.9, upgrade to 1.0.10. In 1.0.10 the cut a prompt needs is pi-tuck's own, so `keepRecentTokens` no longer leaves it with nothing to cut. A rerun of the same check on the 1.0.10 candidate had no refusal and no stuck session. It had two caveats: two of its tasks had a first request the local server never answered, and 8 of its 30 tasks began without their prompt, which the refusal counter cannot see (fixed in 1.0.12; see Benchmarks and [`benchmark/RESULTS-DEFAULTS-1010.md`](benchmark/RESULTS-DEFAULTS-1010.md)). Windows of 128k and up were not affected at the defaults.
|
|
124
|
-
- A prompt could be lost, with no notice (1.0.10 and 1.0.11; fixed in 1.0.12). When a new prompt arrived over the cut point and pi-tuck's cut kept nothing of the conversation before it, which happens when everything since the last cut is one long turn, the prompt was dropped from the request and from the saved session. The model never saw it and usually went on with the previous task, so work you asked for could be lost, and could look answered. The next prompt ran normally. If you used 1.0.10 or 1.0.11 and a reply ignored what you had just asked, this is the likely cause. Upgrade to 1.0.12 ([`CHANGELOG.md`](CHANGELOG.md) 1.0.12).
|
|
125
|
-
- A host that patches a large section into the system prompt could get a refusal that a cut would have fit (1.0.0 to 1.0.16; fixed in 1.0.17). pi-tuck plans a prompt's cut when the prompt arrives, before other extensions change the system prompt. A host engine that adds a section of thousands of tokens for one turn could push that turn's first request over the room, and the final guard refused it. Now the guard plans the cut against the system prompt as finally sent, and refuses only if that cut does not fit either ([`CHANGELOG.md`](CHANGELOG.md) 1.0.17).
|
|
126
|
-
- pi-tuck refused requests that fit the window, and could strand a session (1.0.0 to 1.0.21; fixed in 1.0.22). It refused at the room, the window less the full reply reserve, where native Pi still sends. With Pi's defaults and a large setup, a session could be refused at every prompt. The final refusal now sits at the window less a reply floor ([`CHANGELOG.md`](CHANGELOG.md) 1.0.22).
|
|
127
|
-
- pi-tuck 1.0.25 failed to load in an installed Pi ("Cannot find module '@earendil-works/pi-ai/utils/estimate'"); fixed in 1.0.26, and 1.0.25 is deprecated. Since 1.0.23, the check of Pi's own reply cap also never ran in an installed Pi, for the same reason: Pi's extension loader resolves only a few pi-ai entry points for an installed package. It loaded only in tests and the eval harness, and the installed package fell back to the same 4,096-token margin without it. Fixed in 1.0.26, which was loaded in a real installed Pi before publishing ([`CHANGELOG.md`](CHANGELOG.md) 1.0.26).
|
|
128
|
-
- A request above the room could be admitted and then refused, leaving the session stuck where native Pi would have sent (1.0.22 to 1.0.24; fixed in 1.0.25). pi-tuck checked its line in its own corrected token count, while Pi's reply cap uses Pi's own estimate, which is higher when the provider counts fewer tokens than pi-tuck's raw measure ([`CHANGELOG.md`](CHANGELOG.md) 1.0.25).
|
|
129
|
-
- Near the 1.0.22 refusal line, replies were cut to a few hundred tokens (1.0.22; fixed in 1.0.23). 1.0.22 left only its reply floor and did not count Pi's 4,096-token margin on the reply cap ([`CHANGELOG.md`](CHANGELOG.md) 1.0.23).
|
|
130
|
-
- Cost of the 1.0.22 change: between the room and the window, the reply reserve no longer cushions a wrong count. At a cold start an undercount can reach the provider. A provider that errors is caught and learned from; a server that truncates silently truncates, as it does for native Pi. With a setup above the room, cuts are forced and frequent, each freeing little, which beats a stranded session ([`CHANGELOG.md`](CHANGELOG.md) 1.0.22).
|
|
131
|
-
- Fixed in 1.2.0: kept reads could quote a stale or partial file as if it were whole and current. A cut's summary now keeps only whole reads, and drops a read when a later shell command that is not read-only names the file, or when a git command such as `checkout`, `stash`, `restore` or `reset` ran. In the live gate, kept-read records quoting a partial or stale read were 0 against 141 ([`CHANGELOG.md`](CHANGELOG.md) 1.2.0).
|
|
132
|
-
- Fixed in 1.1.3: a steering message after a very large tool round could end the run with a false refusal. When the user or a harness sent a message while the agent was working, right after a round of tool results too large for the window, pi-tuck planned that cut as if a new run were starting. The summary could then leave out the prompt that started the run, and pi-tuck's own prompt check refused with "the request is missing the whole text of the prompt that started this run". The cut now keeps the running task's prompt and the fresh tool round, as a cut at a tool boundary does ([`CHANGELOG.md`](CHANGELOG.md) 1.1.3).
|
|
133
|
-
- Fixed in 1.1.1: a resumed session forgot what pi-tuck had learned about the provider's token counts. pi-tuck saved its calibration only inside a cut, so after quitting and resuming Pi before the next cut it counted at 1x again and could send a request the provider truncated or refused, where native Pi succeeded. pi-tuck now saves a small private entry in the session when what a resume would learn changes, not every turn, and reads it back on resume. The entry never reaches the model ([`CHANGELOG.md`](CHANGELOG.md) 1.1.1).
|
|
134
|
-
- Fixed in 1.1.1: pi-tuck refused prompts that native Pi would have sent when the context window was unknown, the model was a Pi virtual model, or Pi's auto-compaction was turned off. It now stands down to native in those cases. Also fixed in 1.1.1: refusal, overflow and manual-cut notices were silent without a UI, so a run in `pi -p` or JSON mode could end with no word; and a retry after a reply hit the output limit skipped a check that a pending cut had really been saved in the session ([`CHANGELOG.md`](CHANGELOG.md) 1.1.1).
|
|
135
|
-
- Fixed in 1.0.33: a file read's recall number pointed at the read call, not at what the read returned. The summary lists each file the session read with a `tuck_recall` number, and that number brought back the call's arguments instead of the file's contents, so recalling a read cost a turn and showed nothing useful. It now brings back the read's output ([`CHANGELOG.md`](CHANGELOG.md) 1.0.33).
|
|
136
|
-
- Fixed in 1.0.31: input that arrived after a tool round had been checked, such as another extension's context or a newly enabled tool, could push the next request past the hard line, and the final check refused a request that pi-tuck could still cut. It now cuts at that check, carries the cut in that request, saves it at the next boundary, and refuses only when no cut can fit ([`CHANGELOG.md`](CHANGELOG.md) 1.0.31).
|
|
137
|
-
- Fixed in 1.0.29, when Pi's configured window was larger than the server's: a session could get stuck after one overflow, because pi-tuck mistook a cut Pi had saved for one Pi had failed to save. And a server that silently shrinks the reply to fit its real window went unnoticed, so pi-tuck answered fewer prompts than plain Pi. A reply that stops for length below the reply cap Pi sent is now read as the server's real window: pi-tuck learns it, keeps it for the model in the session, plans with the smaller window, and retries that turn once ([`CHANGELOG.md`](CHANGELOG.md) 1.0.29).
|
|
138
|
-
- 1.0.28 moved each piece of state that had several owners to one owner: the pending cut, the run and reply fit. Requests were unchanged. It also fixed a plan made for a prompt that another extension handled, which could still answer Pi's own compaction check before a later run and make a cut deeper than needed ([`CHANGELOG.md`](CHANGELOG.md) 1.0.28).
|
|
139
|
-
- A run that a custom message started could lose that message after a cut in the middle of the run (fixed in 1.0.27). pi-tuck protected only a prompt the user typed, so a tool-loop cut in a run an extension started with a custom message kept the message neither whole nor quoted, and later requests lacked the instruction that started the run. Now such a message gets the same protection as a typed prompt: it is kept, or quoted whole in the summary, and the guard checks it. A custom message with no text has nothing to quote and stays unprotected ([`CHANGELOG.md`](CHANGELOG.md) 1.0.27).
|
|
140
|
-
- A prompt's cut could reach a run it was not planned for (fixed in 1.0.24). pi-tuck plans a prompt's cut when the prompt arrives. When another extension handled that prompt, no run started, and the plan waited for the next run. A run started by a custom message carried a cut sized for the prompt that never ran, deeper than needed. After a move in the session tree (`/tree`), the plan was applied on the new branch, where its kept entry was not present, so the request lost the custom message that started the run, even on a branch that needed no cut ([`CHANGELOG.md`](CHANGELOG.md) 1.0.24).
|
|
141
|
-
- pi-tuck cut earlier than native Pi when a model's reply cap is above Pi's reserve (1.0.0 to 1.0.19; fixed in 1.0.20). It reserved the larger of Pi's `compaction.reserveTokens` and the model's `maxTokens`: with `maxTokens` 32,768 and a reserve of 16,384 on an 81,920 window, its room fell to 49,152 tokens, where native Pi compacts at 65,536 ([`CHANGELOG.md`](CHANGELOG.md) 1.0.20).
|
|
142
|
-
- A summary could drop the task a session was working on (1.0.0 to 1.0.17; fixed in 1.0.18). Until 1.0.15 a summary quoted only the session's first user turn, up to 12,000 characters, and the newest one, so in a long session the current task, an older turn followed by short steps, was clipped or dropped while a finished first task stayed whole, and agents acted on a days-old task. 1.0.16 added more quotes. From 1.0.13 to 1.0.17, separate rules decided what a summary quoted and what the kept tail held, and the prompt that set the current task, or the first prompt, could lose its opening after a cut: the stress test found it 40 times in 32 cells on 1.0.16 and 1.0.17. Since 1.0.18 one ranked list fills a cut's room, and the stress test finds no lost opening in 287 cells. Short sessions, and the SWE-bench chains behind our benchmarks, keep each task's prompt in the kept tail and never hit it. Upgrade to 1.0.18 ([`CHANGELOG.md`](CHANGELOG.md) 1.0.18).
|
|
143
|
-
- pi-tuck 1.0.16 cost more in live chains than its notes first said. Against 1.0.13 at an 81,920 window, it took 1.48 times the turns on the tasks both resolved (95% interval 1.34 to 1.64), 74% more cuts and 1.66 times the tokens, with 56 of 60 tasks resolved against 55. Replay of single-task sessions cannot show this cost. 1.0.18 replaced its quote rules; in the 1.0.18 gate it took 22.27 turns per task against 29.35 for 1.0.16 and 20.22 for the 1.0.13 arm (different pairs of runs; reported, not claimed) ([`benchmark/RESULTS-V1016.md`](benchmark/RESULTS-V1016.md), [`CHANGELOG.md`](CHANGELOG.md) 1.0.18).
|
|
144
|
-
- Since 1.0.18, on replay of 17 recordings, estimated request time against 1.0.13 is 2.2% higher quiet and 4.2% higher loaded at 81,920, and 1.1% and 1.9% lower at 131,072. Billed input moves the same way. At 81,920 each cut carries about 600 more tokens. Sessions that are open keep the build they started with until they are restarted ([`CHANGELOG.md`](CHANGELOG.md) 1.0.18).
|
|
145
|
-
- The cut point adapts by itself since 1.0.13; before it, pi-tuck cut too often at small windows or with a large setup (1.0.11 and 1.0.12). The trade, from the changelog: on windows that cut too often, each request now carries more context. Cuts, re-processing and request time fall, and billed tokens rise on paid models. On replay of real sessions at an 81,920 window, cuts went from 22.3 to 9.3 per 100 requests, request time was about 16 to 20% lower, and billed tokens were 16 to 19% higher; at a 65,536 window billed tokens rose by as much as 35%. A very large setup at a small window, such as 40k at 65,536, still leaves too little free room for a good rhythm: cuts stay frequent and free little ([`CHANGELOG.md`](CHANGELOG.md) 1.0.13).
|
|
146
|
-
- Still applying (1.0.11 to 1.0.16): a fresh assistant message larger than the free room is refused, and a short next prompt recovers (in an unattended `pi -p` run, a refusal ends the run). A reply that reports more than the window reads to Pi as a silent overflow; when nothing can be cut, pi-tuck refuses the next prompt, and the prompt after that runs. If a provider keeps rejecting requests in a wording Pi does not class as a context overflow, or with a bare HTTP 413, pi-tuck does not recover on its own: the session stays intact, and every prompt can fail until the request shrinks. Try `/compact` ([`CHANGELOG.md`](CHANGELOG.md) 1.0.13).
|
|
147
|
-
- Other extensions (1.0.10): a prompt's cut no longer goes through Pi's `session_before_compact`, so another extension's veto there no longer stops it. It never stopped a cut between tool rounds. Pi's own threshold and overflow cuts, and `/compact`, still ask other extensions as before.
|
|
148
|
-
|
|
149
|
-
## Benchmarks
|
|
31
|
+
| `/compact` | Request a cut. pi-tuck builds the summary from the session and ignores any appended instructions. |
|
|
32
|
+
| `/tuck` | Inspect the loaded version, saved cuts, and cut point. |
|
|
33
|
+
| `/tuck-incident on\|next\|off\|status` | Control diagnostic recording. The default directory is `~/.local/state/pi-tuck-incidents`. |
|
|
150
34
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
| What | Result | Conditions | Source |
|
|
154
|
-
|---|---|---|---|
|
|
155
|
-
| Pi's default compaction settings, 32k window, pi-tuck 1.0.10 candidate | Passed as registered: 0 dead tasks and 0 stuck sessions on 30 tasks, on a slow local server (27 of 30 tasks hit the 30-minute wall cap, and 2 had a first request the server never answered). 6 resolved. A counter written later, which counts a task with no token as dead, would count those 2. **The registered counter counts refusals and cannot see a task that began without its prompt**: in 8 of the 30 tasks (4, 8, 9, 10, 13, 14, 17, 21) a cut at the prompt kept no turn, none of the 8 resolved, and 6 ended with an empty patch. So the pass shows no refusal, not that every task began with its prompt. The 1.0.11 candidate on the same test had 7 of 30 such tasks, 1 resolved. Fixed in 1.0.12 | Candidate `a67ec30` of 1.0.10, `mac-studio/main`, window 32,768, output cap 16,384, Pi's default `reserveTokens` 16,384 and `keepRecentTokens` 20,000, one session of chain t06. One mid-run refusal (a round with 9,020 tokens of reasoning against the 16,384-token room). One session per arm, one model. In 12 of the 15 tasks across both arms the model's own first messages show it lacked the prompt; the other 3 are not clear from the records | [`benchmark/RESULTS-DEFAULTS-1010.md`](benchmark/RESULTS-DEFAULTS-1010.md) |
|
|
156
|
-
| Pi's default compaction settings, 32k window, pi-tuck 1.0.8 | 28 of 30 tasks lost (tasks 3 to 30, each refused at its prompt); 1 resolved. Fails the pre-registered bar of 0 lost tasks | pi-tuck 1.0.8 (`86935e9`), `mac-studio/main`, window 32,768, output cap 16,384, `reserveTokens` 16,384 and `keepRecentTokens` 20,000 (larger than the room), one session of chain t06. One session, one model, one build: it shows that the failure occurs at these settings, not how often. Not comparable with other rows | [`benchmark/RESULTS-DEFAULTS.md`](benchmark/RESULTS-DEFAULTS.md) |
|
|
157
|
-
| Tasks resolved, 32k window | Pi's built-in compaction 94 of 150; pi-tuck 120 of 150 (+17.3 points, 95% lower bound +10.7); observation masking 117 of 150 (pi-tuck +2.0, lower bound −2.7: no difference shown). Turns per task: 9.4 (built-in), 24.0 (pi-tuck), 11.9 (masking). Tokens per session: 6.10 M, 6.39 M, 7.02 M. Spend per arm for the five sessions: $0.87, $0.55, $0.94 | pi-tuck 1.0.5 (commit `aa30824`, the 1.0.5 code; 1.0.6 and 1.0.7 are not measured). DeepSeek V4.1 Flash pinned to one upstream, window 32,768, reserve 16,384, 5 chains of 30 SWE-bench Verified tasks, paired by task, one-sided bootstrap over tasks. **Limits:** only pi-tuck is held to the 16,384-token room (the built-in sent a request over it in 97 of 150 tasks, masking in 73, so the window is nominal for them). The difference by chain is +10.0, −3.3, +50.0, +16.7 and +13.3 points; leaving out chain t03 it is +9.2. The bootstrap resamples tasks, not chains. The pi-tuck arm ran at a different time from the others. One model, one window. pi-tuck refused to cut mid-run in 5 tasks, where one fresh tool result was larger than the room; they count as unresolved. In the same setup pi-tuck 1.0.3 resolved 72 of 150, with 52 dead tasks (tasks refused at their prompt after an earlier failure). In the pi-tuck arm of this row there was 1 dead task (t03 task 24: refused at its prompt with "Nothing to compact"; the next task ran normally), so this build missed the pre-registered acceptance bar of zero dead tasks by one task (the other part of the bar, no loss against 1.0.3 by more than 3 points, was met) | [`benchmark/RESULTS-32K-ACCEPT.md`](benchmark/RESULTS-32K-ACCEPT.md) |
|
|
158
|
-
| Kept searches (1.3.0, shipped in 1.3.1): live gate against 1.2.0's line | In a 10-task paired live gate, the agent repeated a search after a cut 0.23 times per cut against 0.45, and resolved 5 tasks the other build missed against 2, with no refusals, lost tasks or error stops | NVIDIA Nemotron, room 16,384, 10 paired tasks, one model, one room, one run per arm. The counts are what the ten tasks showed, and no effectiveness claim is made. 1.3.1 is 1.3.0's code: 1.3.0 never reached npm because a timing check in the test suite stopped its publish on the release runner | [`CHANGELOG.md`](CHANGELOG.md) 1.3.0 and 1.3.1 |
|
|
159
|
-
| pi-tuck 1.2.0: live gate against 1.1.2, and replay against 1.1.3 | Live gate, 10 paired tasks at room 16,384: solved wins minus losses +1 (bar: at least −1), turn-cap stops 3 against 4, doubt moments 6 against 9, 0 lost tasks; kept-read records quoting a partial or stale read 0 against 141. Replay against 1.1.3 (byte-identical to 1.1.2): 29 recordings, cuts 1,975 to 1,869 and clips 16 to 8 with the smaller tool list and the stricter kept reads, 0 lost or dead tasks, 0 faults | Ten tasks on NIM Nemotron, one model, one room, one run per arm: no effectiveness claim is made. The gate found one false refusal after a steering message, fixed in 1.1.3 and pinned by tests built from that run. Strict stress: 322 cells, 0 findings. Tests and CI on macOS and Ubuntu; the full suite also passed on Windows | [`CHANGELOG.md`](CHANGELOG.md) 1.2.0 |
|
|
160
|
-
| Kept reads (1.1.0): 5-task check against 1.0.31, and replay against 1.0.33 | No breakage in 5 of 5 tasks, and all 5 solved on both builds. Re-checks after a doubt 22 against 45; doubt moments 9 against 24; cuts 22 against 26; turns 305 against 384. One heavy task went worse: 90 turns against 59, 9 cuts against 4, 3 doubts against 1. Replay against 1.0.33: 13,946 requests, 0 lost or dead tasks, clips 17 to 16, cuts 1,946 to 1,971; in every recording that differs, the first difference is the first summary carrying a kept read, and 11 of 29 never differ | Five tasks, before the Tier 1. This is not an effectiveness result and no effectiveness claim is made for kept reads. The Tier 1 against 1.0.33 is still running; if it fails, npm and installs go back to 1.0.33. Strict stress: 0 findings in 313 cells on Pi 1.2.0 and the newest Pi | [`CHANGELOG.md`](CHANGELOG.md) 1.1.0 |
|
|
161
|
-
| pi-tuck 1.0.18 against the recorded 1.0.16 arm, 81,920 window | Registered bar (Tier 1) met: both arms resolved the same 56 of 60 tasks (+0.0 points, one-sided 95% lower bound +0.0, against a bar of above −10); 0 lost tasks: dead tasks, mid-run refusals and dropped prompts are 0 in both arms, and the audit listed one candidate task (t06 task 21), which, with the two other candidate tasks that had a cut at a prompt (t06 task 8, t07 task 24), was read by hand and works on its own task. Readouts: turns per task 22.27 against 29.35, cuts 57 against 61, total tokens 40.3 M against 62.1 M. Against the recorded 1.0.13 arm of the adaptive gate, a different pair of runs a day apart, 1.0.18 is at 22.27 turns per task against 20.22 and 40.3 M tokens against 37.4 M | Pre-registered gate. pi-tuck 1.0.18 (`2d1f830`, tag `v1.0.18`), run from the unpacked npm tarball; its `src/` is byte-identical to `1ea1e1e`, the commit replay and the stress test measured, ran alone on chains t06 and t07 (60 tasks) against the recorded 1.0.16 arm; the arms did not run side by side, the base earlier the same day, so seconds are not compared. One model, one window, one run per arm. The resolved result is a bound, not a gain. The turn, cut and token readouts are reported, not claimed | [`benchmark/RESULTS-V1018.md`](benchmark/RESULTS-V1018.md) |
|
|
162
|
-
| pi-tuck 1.0.16 against the recorded 1.0.13 arm, 81,920 window | Registered bar (Tier 1) met: resolved 56 of 60 against 55 (+1.7 points, one-sided 95% lower bound +0.0, against a bar of above −10); 0 lost tasks. Readouts: turns per task 29.35 against 20.22 (1.48 times on the 55 tasks both resolved, 95% interval 1.34 to 1.64), cuts 61 against 35, total tokens 62.1 M against 37.4 M | Pre-registered gate. pi-tuck 1.0.16 (`dee0eab`) ran alone on chains t06 and t07 (60 tasks) against the recorded 1.0.13 arm from the adaptive gate; the two arms did not run side by side, the base a day earlier, so seconds are not compared. One model, one window, one run per arm. The resolved result is a bound, not a gain. The cost readouts are reported, not claimed. 1.0.18 replaced this build's quote rules | [`benchmark/RESULTS-V1016.md`](benchmark/RESULTS-V1016.md) |
|
|
163
|
-
| The adaptive cut point (1.0.13) against 1.0.12, 81,920 window | Registered bar (Tier 2) met: resolved 131 of 150 in both arms (+0.0 points, one-sided 95% lower bound −1.3, against a bar of above −5); 0 lost tasks in the candidate arm. The 0 counts dead tasks, tasks whose prompt was dropped at a cut, and tasks an audit found started without their prompt; all 11 tasks with a cut at a prompt, in both arms, were also read by hand, and in each the model's first messages work on that task | Pre-registered gate. pi-tuck 1.0.13 (`6f13685`) is the exact code the gate measured (`882f6f6`); only the version and the notes changed. It was measured against pi-tuck 1.0.12, `mac-studio/main` at xhigh, window 81,920, reserve 16,384, `keepRecentTokens` 20,000, 5 chains (t06 to t10) of 30 tasks, 150 paired tasks, one run per arm, one model throughout. The resolved result is a bound, not a gain. Turns, tokens and seconds are in the file and are not claimed here. Nothing about other windows, models or builds | [`benchmark/RESULTS-ADAPTIVE.md`](benchmark/RESULTS-ADAPTIVE.md) |
|
|
164
|
-
| The 1.0.10 candidate against 1.0.9, 32k window | 0 dead tasks in both arms; no mid-run refusal. Resolved 50 of 60 (1.0.9) and 49 of 60 (1.0.10 candidate): −1.7 points, 95% lower bound −8.3. **The gate failed as registered, by one task**; 1.0.10 shipped as an exception because of the small-window defect. 6 of the 1.0.10 candidate's 60 tasks began without their prompt (4 of them resolved), against 0 in the 1.0.9 arm; fixed in 1.0.12. Turns per task 25.08 and 29.12; cuts 731 and 884; total tokens 13.07 M and 15.12 M | Pre-registered gate. pi-tuck `a67ec30` against 1.0.9 (`cd4626b`). DeepSeek V4.1 Flash pinned to one upstream, window 32,768, reserve 16,384, `keepRecentTokens` 3,333, chains t01 and t02, 60 paired tasks. One model, one window, one run per arm; 60 tasks cannot separate a one-task difference from run-to-run variation | [`benchmark/RESULTS-V110.md`](benchmark/RESULTS-V110.md) |
|
|
165
|
-
| The 1.0.8 candidate against 1.0.7, 32k window | 0 dead tasks in both arms. Resolved 46 of 60 in both (+0.0 points, 95% lower bound −6.7). No mid-run refusal in either arm. Turns per task 25.37 (1.0.7) and 26.10 (1.0.8) | Pre-registered gate, passed as registered. pi-tuck `a2e7d1a` (the tool-result clip and the cut at the end of a run, on 1.0.6) against 1.0.7. Released 1.0.8 is that build merged with 1.0.7's change; its replay requests are reported byte-identical to the gated build on 29 recordings (stated in the source file, not re-run for this README). DeepSeek V4.1 Flash pinned to one upstream, window 32,768, reserve 16,384, chains t01 and t02, 60 paired tasks, both arms run together. One model, one window, one run per arm; 60 tasks cannot show a difference smaller than the bound. The run shows that the change introduced no refusal; no refusal occurred in the 1.0.7 arm for the clip to prevent | [`benchmark/RESULTS-V108.md`](benchmark/RESULTS-V108.md) |
|
|
166
|
-
| Cut time, live, 128k | pi-tuck median 0.081 s (46 cuts; 90th percentile 0.279 s). Pi's compaction median 235.3 s (48 cuts; 90th percentile 403.8 s). Context carried after a cut, median: 26,790 tokens (pi-tuck), 27,750 (Pi's compaction) | pi-tuck 1.0.1, Pi 1.4.0, SWE-bench Verified, 10 chains of 30 tasks, window 128,000, reply reserve 32,768, `mac-studio/main:xhigh` writing Pi's summaries. The built-in time depends on that model and on server load. pi-tuck's time is an upper bound, read from the session file: the time between the entry written just before the cut and the compaction entry, so it includes anything between the last message and the cut (pi-tuck's tool-loop cuts emit no compaction events). The 44 failed compaction attempts in chain s09-A have no compaction entry and are not in the counts | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 3 |
|
|
167
|
-
| Cut time, paired replay, 128k | pi-tuck median 0.061 s (95 cuts). Pi's compaction prompts on mac-studio/main:xhigh 154.6 s (86 cuts). Pi's compaction prompts on GPT-6.1 Terra 53.2 s (87 cuts, 19 recordings). Context carried after a cut, median: 27,656, 25,790 and 22,784 tokens; median summary 85,561, 23,598 and 11,200 characters | The same recorded sessions cut at the same raw positions. pi-tuck 1.0.1. Terra's cuts ran through Codex, not on the local server | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 3 |
|
|
168
|
-
| Retention, 128k, test 1a: pi-tuck with its recall tools against Pi's compaction prompts on mac-studio/main:xhigh | Registered claim: not more than 3 points below, on these probes (cuts 1 to 4 only) (supported). Accuracy on the probes each was asked: 89.7% (783 probes) and 61.8% (1,677). Difference over the 783 shared probes, which come from the 43 of pi-tuck's 95 answer sets that did not abort: +25.7 points, one-sided 95% lower bound +22.0 (+22.3 clustered by chain). By probe type, pi-tuck / comparator: error class 80.2 / 24.7, files changed 84.5 / 78.9, result-line rule 100.0 / 100.0, required tag 100.0 / 99.3, test-runner summary 90.1 / 31.6 | pi-tuck 1.0.1, 20 recordings, mechanical probes only, evidence at least 35,000 raw tokens before the cut. pi-tuck answered with its recall tools (1.0.1 had a second recall tool, since removed) and the comparators with none, from the summary and the kept recent messages. Every one of the 43 asks behind the 783 probes made recall calls (1.25 per probe on average), so no pi-tuck answer lacked the tools; the run cannot show how much of the result comes from the summary and how much from recall. No pi-tuck arm without recall tools exists. The comparators' agents had unrestricted bash, and the logs cannot rule out that one read a recording; nothing shows it. pi-tuck's accuracy does not rise with more calls per probe (87.9%, 90.8%, 90.0% by thirds; post hoc, descriptive). The 783 shared probes are fewer than the 2,969 needed to certify a difference near the margin | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 1a |
|
|
169
|
-
| Retention, 128k, test 1b-Terra: pi-tuck with its recall tools against Pi's compaction prompts on GPT-6.1 Terra | Registered claim: not more than 3 points below, on these probes (cuts 1 to 4 only) (supported). Accuracy on the probes each was asked: 89.7% (783) and 57.8% (1,685). Difference over the 728 shared probes, from the same 43 of pi-tuck's 95 answer sets: +33.7 points, one-sided 95% lower bound +30.4 (+30.1 clustered by chain). By probe type, pi-tuck / Terra: error class 80.2 / 14.7, files changed 84.5 / 72.3, result-line rule 100.0 / 100.0, required tag 100.0 / 93.3, test-runner summary 90.1 / 38.1 | As test 1a, on 19 of the 20 recordings: s09-A is missing because its Terra cut job hit a Codex usage limit, and the set was closed at 19 before any Terra result was read. The claim is non-inferiority. The same limits as test 1a apply | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 1b-Terra |
|
|
170
|
-
| Tasks resolved, 128k, test 2 | Pi's compaction 251 of 300, pi-tuck 258 of 300. Registered claim: no loss larger than 0.4 points. All 10 chains: +2.3 points, lower bound +0.3. Without chain s09: +1.5 points, lower bound −0.4 | pi-tuck 1.0.1, 10 chains of 30 tasks, paired by task, bootstrap over chains. In s09-A Pi's compaction failed 44 times ("generation hit the token cap") from task 23 on, and no other chain has a failed compaction; that is why the bound changes without s09 | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 2 |
|
|
171
|
-
| Tokens per session, input plus output without cache reads, 128k | 241,000 fewer for pi-tuck per session on average, one-sided 95% upper bound −21,000, with all 10 chains. Without chain s09 the mean is −174,000 and the upper bound +43,000 | pi-tuck 1.0.1, paired by chain, bootstrap over sessions. The line holds only with all chains | [`benchmark/RESULTS-MAIN.md`](benchmark/RESULTS-MAIN.md) test 3 |
|
|
172
|
-
| Answers after cutting at 60% instead of 100% | No more losses than the limit on all 4 sets. Losses / wins over n questions: 128k shared 3 / 7 of 99; 128k asymmetric 3 / 1 of 67; 32k shared 5 / 3 of 77; 32k asymmetric 9 / 5 of 343. In the 32k asymmetric set the losses lean against 60% (test_result 4 / 2, error_hit 3 / 1); it is the set to watch | Paired replay, same 5 sessions, DeepSeek flash as agent and judge. Limit, set in advance: losses minus wins at most max(2, 5% of n). Asymmetric = evidence the base keeps native and the variant has summarised | [`rnd/replay32/RESULT-lean.md`](rnd/replay32/RESULT-lean.md) |
|
|
173
|
-
| 1.0.2 changes (plain-text summary, shrinking dialogue view, time on user turns only) against 1.0.1 | No more losses than the limit on all 4 sets. Losses / wins: 128k 1 / 2 of 128; 128k time questions 0 / 0 of 48; 32k 4 / 2 of 127; 32k asymmetric 0 / 2 of 56 | Paired replay, 5 recorded live sessions, DeepSeek flash as agent and judge. 11 of 146 answer sessions hit a 15-minute wall limit and drop out of the pairing | [`rnd/replay32/RESULT-lean.md`](rnd/replay32/RESULT-lean.md), [`CHANGELOG.md`](CHANGELOG.md) |
|
|
174
|
-
| Summary size, plain-text format against the 1.0.1 JSON format | About 30% shorter where the agent writes little, about 14% shorter where it writes a lot | Same dialogue | [`CHANGELOG.md`](CHANGELOG.md) 1.0.2 |
|
|
175
|
-
| Small-window fix | A session that writes little prose cut 174 times in 300 tool rounds at 32k with a 16k reserve (1.0.1 code). With the fix, a test pins that no cut frees under a tenth of the room | Real planner on synthetic sessions | [`CHANGELOG.md`](CHANGELOG.md) 1.0.2 (the 174 cuts); [`test/cut-yield.test.ts`](test/cut-yield.test.ts), which pins that every cut frees at least a tenth of the room |
|
|
176
|
-
| Stall fix: a long session's cut | A cut at 3,888 entries took 72 s in 1.0.0 and takes 174 ms since 1.0.1. Since 1.0.1 the cost grows linearly with the session | One machine, the same synthetic session for both numbers (little prose, 128k window, reserve 16,384, turn 644) | [`CHANGELOG.md`](CHANGELOG.md) 1.0.1 |
|
|
177
|
-
|
|
178
|
-
Notes:
|
|
179
|
-
|
|
180
|
-
- The answer replays use one cheap hosted model (DeepSeek flash) as agent and judge. They compare pi-tuck with other pi-tuck settings and versions. They do not compare pi-tuck with an LLM compactor.
|
|
181
|
-
- The 128k rows measure pi-tuck 1.0.1. The newer versions are listed in the [changelog](CHANGELOG.md). A cut still calls no model, but the 128k run has not been repeated on them.
|
|
182
|
-
- Everything here is from SWE-bench-style tasks on a small set of models. It may not carry to your work.
|
|
35
|
+
Pi-tuck needs a supported Pi version and a nonvirtual model with a valid context window. Setting `"compaction": { "enabled": false }` in Pi's settings disables automatic compaction and makes pi-tuck stand down, including for `/compact` and recall. `/tuck` reports why a loaded compactor is standing down. Capacity notices go to stderr in headless runs.
|
|
183
36
|
|
|
184
37
|
## Settings
|
|
185
38
|
|
|
186
|
-
|
|
39
|
+
Optional settings go in `pi-tuck.json` in Pi's agent directory (`~/.pi/agent` by default, or `PI_CODING_AGENT_DIR`). Restart Pi to apply changes. The input room starts at the model's context window minus Pi's `compaction.reserveTokens`. Invalid JSON uses defaults. An invalid field uses its own default, with a notice when compaction is active.
|
|
40
|
+
|
|
41
|
+
- **`cutAt`** is a fraction above 0 and at most 1. By default pi-tuck cuts at the room, less a 2% margin. An explicit value fixes a fraction of the room, subject to the same margin even at `1`.
|
|
42
|
+
- **`cacheSensitiveModels`** lists exact `provider/model` identifiers. For these models, the cut point is the full room, taking precedence over `cutAt`. This delays early cuts that would discard a reusable prompt prefix.
|
|
43
|
+
- **`llamaContinuation`** opts one reasoning model into a single extra request after a thinking-only response exhausts the full configured output allowance. In Pi's `models.json`, configure that model on a llama.cpp provider using the `openai-completions` API. Verify that the runtime and template support `continue_final_message: "reasoning_content"` and report reused prompt tokens through `prompt_progress`. Pi-tuck requires the first cache report to match the prefix within 15 seconds. The positive integer `extraTokens` caps the additional allowance within the remaining context. The positive integer `deadlineMs` covers both requests.
|
|
187
44
|
|
|
188
45
|
```json
|
|
189
|
-
{
|
|
46
|
+
{
|
|
47
|
+
"cacheSensitiveModels": ["my-provider/my-model"],
|
|
48
|
+
"llamaContinuation": {
|
|
49
|
+
"model": "my-provider/my-model",
|
|
50
|
+
"extraTokens": 4096,
|
|
51
|
+
"deadlineMs": 5400000
|
|
52
|
+
}
|
|
53
|
+
}
|
|
190
54
|
```
|
|
191
55
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
A bad file is reported at session start, and pi-tuck uses the defaults.
|
|
195
|
-
|
|
196
|
-
### Small windows
|
|
197
|
-
|
|
198
|
-
pi-tuck keeps room for the model's reply. Since 1.0.20 that room is Pi's `compaction.reserveTokens` (default 16,384), the same as native Pi. It rises to the model's `maxTokens` for the rest of the branch only after a reply on that branch did not fit: a reply that stopped for length, or a request refused as a context overflow. A transient error such as a 503 keeps the native room. This is read from the current branch at each decision, so resume, fork and `/tree` follow the branch, and a new session starts at `reserveTokens` again. A host that passes its own reserve keeps its own. Before 1.0.20, pi-tuck always reserved the larger of the two, so with a large `maxTokens` it cut earlier than native Pi.
|
|
199
|
-
|
|
200
|
-
Since 1.0.22, pi-tuck refuses a request only past a line near the window. Pi sets each request's reply cap to the window less its own estimate of the request less a 4,096-token safety margin, and since 1.0.26 pi-tuck loads Pi's own reply clamp and estimator from the running Pi's install (a host that embeds Pi falls back to the same 4,096-token margin). Since 1.0.25, each point that sends a request above the room checks Pi's own cap on the request it would send. When that leaves less than the reply floor, pi-tuck cuts deeper, with up to three re-plans and then the deepest cut that still carries the whole prompt, and refuses only if that leaves less than the floor too. The floor is the larger of the biggest reply seen on the branch and 3,584 tokens, capped at the model's own reply cap. After a reply that stopped for length or was refused as a context overflow, the floor is the reserve. The line never sits below the room, where 1.0.21 also sends. Before it refuses, pi-tuck cuts to the band, cuts to the room, makes a smaller summary and clips a fresh tool result, in that order. A run's request always carries the whole prompt that started the run: if it cannot fit after every reduction, pi-tuck stops the run with a notice saying to shorten the prompt or use a larger window. Each refusal, and each request sent above the room, leaves one `pi-tuck-capacity` entry in the session; it is never sent to the model, and never appears in summaries or recall.
|
|
201
|
-
|
|
202
|
-
Since 1.0.25, after a reply that stops for length with thinking only, pi-tuck retries the turn once, leaving the stopped reply out of the request. It uses the deepest cut that still carries the whole prompt when that gives the reply more room, and otherwise retries uncut. A retried reply that stops again ends the run. When a run ends on a reply cut at the output limit, pi-tuck says so ("the last reply stopped at the model's output limit and may be cut off"): in the interface, or on stderr when there is no UI. The notice never enters the model's context.
|
|
56
|
+
## Output exhaustion and small windows
|
|
203
57
|
|
|
204
|
-
|
|
58
|
+
- Pi-tuck preserves thinking-only stops in session history. At the model's full output allowance, it reports exhaustion if the reply remains unfinished. Below that allowance, it retries once, re-armed as Pi's overflow recovery is.
|
|
59
|
+
- Pi-tuck uses the context window declared in Pi's model configuration. A length stop alone does not establish a smaller window. If the server has a smaller effective limit, set that limit in Pi's model configuration.
|
|
60
|
+
- Pi's compaction reserve sets the cut target. For larger requests, pi-tuck estimates reply needs from observed output on the current branch for the active model, bounded by the reserve and model output limit. A cut above the room aims to leave 3,584 reply tokens within those bounds; where no cut can, the request goes out as before. If cuts cannot leave enough room for the protected prompt and a reply, try a shorter prompt, fewer tools, or a larger window. Pi-tuck's checks use estimates. Pi handles recognized provider overflows, and silent truncation can go undetected.
|
|
205
61
|
|
|
206
|
-
|
|
62
|
+
When using OpenRouter, you can pin an upstream in Pi's `models.json` if upstreams count context differently.
|
|
207
63
|
|
|
208
64
|
```json
|
|
209
65
|
{ "providers": { "openrouter": { "compat": { "openRouterRouting": { "only": ["your-upstream"], "allow_fallbacks": false } } } } }
|
|
210
66
|
```
|
|
211
67
|
|
|
68
|
+
See [Small windows](docs/small-windows.md) for the current budgeting policy and the [proposed Pi request contract](docs/pi-request-boundary.md) for the limits on final request admission and retry coordination.
|
|
69
|
+
|
|
212
70
|
## Use from code
|
|
213
71
|
|
|
214
|
-
|
|
72
|
+
Hosts that embed Pi through its SDK can import the compactor directly.
|
|
215
73
|
|
|
216
74
|
```ts
|
|
217
75
|
import { installCompaction } from "pi-tuck";
|
|
@@ -219,23 +77,35 @@ import { installCompaction } from "pi-tuck";
|
|
|
219
77
|
const handle = await installCompaction(pi);
|
|
220
78
|
```
|
|
221
79
|
|
|
222
|
-
`
|
|
80
|
+
Use `hostMessages` for context the host injects, `requestReserve` for a host reply budget, and `recallPolicy` to restrict recall. Set `responseExact: true` in the reserve result to use the declared value. By default a host reserve is at least the model's configured output limit. Call `await handle.close()` before disposing the session to stop the incident recorder. [SDK options](src/compaction.ts)
|
|
223
81
|
|
|
224
82
|
## Development
|
|
225
83
|
|
|
84
|
+
From the repository root, install the locked dependencies and run the checks.
|
|
85
|
+
|
|
226
86
|
```sh
|
|
227
|
-
npm
|
|
228
|
-
npm run
|
|
229
|
-
npm
|
|
230
|
-
npm
|
|
87
|
+
npm ci
|
|
88
|
+
npm run build
|
|
89
|
+
npm run check
|
|
90
|
+
npm test
|
|
231
91
|
```
|
|
232
92
|
|
|
233
|
-
|
|
93
|
+
The build emits the SDK in `dist/` and refreshes the tracked `src/build-id.ts`. Include the refreshed ID when committing changes to `index.ts` or `src/`. To run one file, use `npm test -- test/llama-continuation.test.ts`. To load this checkout for one Pi invocation, run `pi --no-extensions -e ./index.ts` from the repository root.
|
|
94
|
+
|
|
95
|
+
- The extension entry point reads settings and registers the optional provider adapter. [Entry point](index.ts) · [Continuation adapter](src/llama-continuation.ts)
|
|
96
|
+
- Session hooks plan cuts for Pi to commit. [Compaction hooks](src/compaction.ts) · [Reply budgeting and Pi's clamp](src/request-capacity.ts)
|
|
97
|
+
- The summary compiler renders the cut. Recall reads eligible source entries from the branch. [Summary compiler](src/tuck.ts) · [Recall](src/recall.ts)
|
|
98
|
+
|
|
99
|
+
See [Contributing](CONTRIBUTING.md) for stress tests and [the changelog](CHANGELOG.md) for release changes.
|
|
100
|
+
|
|
101
|
+
## Benchmarks
|
|
234
102
|
|
|
235
|
-
|
|
103
|
+
- **128k live run.** pi-tuck 1.0.1 resolved 258 of 300 SWE-bench Verified tasks versus Pi's 251. Median completed cuts took 0.081 s (an upper bound from session timestamps) versus 235.3 s with a local summarizer. The one-sided 95% lower bound on the resolution difference fell from +0.3 to −0.4 points when the chain with 44 Pi compaction failures was excluded. [128k results](benchmark/RESULTS-MAIN.md)
|
|
104
|
+
- **128k recall replay.** Completed answer sets at cuts 1–4 supported the registered 3-point margin against Pi's summaries and kept messages. The scoring excluded 52 of 95 pi-tuck sets that aborted. [Retention results](benchmark/RESULTS-MAIN.md)
|
|
105
|
+
- **32k live run.** pi-tuck 1.0.5 resolved 120 of 150 tasks versus Pi's 94 and observation masking's 117. The one-sided 95% lower bounds were +10.7 and −2.7 points, respectively. pi-tuck recorded one dead task against a target of zero. [32k results](benchmark/RESULTS-32K-ACCEPT.md)
|
|
236
106
|
|
|
237
|
-
|
|
107
|
+
The [benchmark index](benchmark/README.md) records the models, versions, plans, and scope of each result.
|
|
238
108
|
|
|
239
|
-
##
|
|
109
|
+
## Credits and license
|
|
240
110
|
|
|
241
|
-
MIT
|
|
111
|
+
MIT. pi-tuck grew out of [pi-vcc](https://github.com/sting8k/pi-vcc) and includes code from [pi-blackhole](https://github.com/k0valik/pi-blackhole) and [Pi](https://github.com/earendil-works/pi). See [NOTICE](NOTICE).
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,7 @@ import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
export type { CompactionOptions } from "./src/compaction.js";
|
|
3
3
|
export { installCompaction } from "./src/compaction.js";
|
|
4
4
|
export { inspectIncident, readableIncident } from "./src/diagnostic-replay.js";
|
|
5
|
-
/**
|
|
6
|
-
* 1) fixes the cut point as a fraction of the input room; without it, the cut point adapts. */
|
|
7
|
-
/** The oldest Pi with every hook and API pi-tuck uses, and the oldest its tests pass on (Pi 1.2 added the custom message that starts a
|
|
8
|
-
* run to before_agent_start, which the prompt's cut counts). */
|
|
5
|
+
/** Pi 1.2 added the run's custom message to before_agent_start so preflight can count it. */
|
|
9
6
|
export declare const PI_FLOOR = "1.2.0";
|
|
10
7
|
/** Whether a Pi version is at or above the floor. A version that does not parse is taken as supported. */
|
|
11
8
|
export declare function piSupported(version: string): boolean;
|