@foliox/transparent-compact-pi 0.8.9 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +146 -2
- package/README.md +135 -46
- package/docs/DESIGN.md +309 -34
- package/extensions/index.ts +731 -135
- package/extensions/lib/checkpoint-cap.ts +182 -0
- package/extensions/lib/turn-context.ts +209 -0
- package/extensions/lib/turn-filter.ts +346 -0
- package/package.json +2 -1
- package/skills/context-retrieval/SKILL.md +22 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,149 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
- Clarify the context readout: label delta as net, show measured tail inclusion,
|
|
6
|
+
and show combined notice-cost changes after the tail as `+~N scaffolding`,
|
|
7
|
+
without a separate row or breakdown. Keep the last completed readout visible
|
|
8
|
+
during recalculation to avoid loading/color flashes on each selection.
|
|
9
|
+
Remove the `reply/framing` label.
|
|
10
|
+
Replace `cap warn` labels with plain-language size-limit information only when
|
|
11
|
+
the preview was actually shortened. Add small-turn/adjacent-user regressions
|
|
12
|
+
reconciling content savings with generated-notice overhead.
|
|
13
|
+
|
|
14
|
+
- Add a live whole-context size readout to turn selection and review: estimated
|
|
15
|
+
input tokens/window usage, delta from saved context, and reserve-aware headroom.
|
|
16
|
+
Preview the actual capped checkpoint and native expansions with current
|
|
17
|
+
system/tool overhead, without dialogs, writes or model calls. Discard stale
|
|
18
|
+
estimates and label unavailable sizes rather than inventing zero-token counts.
|
|
19
|
+
|
|
20
|
+
- Simplify `/compact-filtered` to ordinary compaction followed by the shared
|
|
21
|
+
`/filter-turns` editor. The checkpoint is committed before selection; cancelling
|
|
22
|
+
the picker leaves that compaction intact. With nothing new to compact, edit the
|
|
23
|
+
existing checkpoint instead. Failed/cancelled compactions never open controls.
|
|
24
|
+
Remove the special interactive compaction-hook path and its request sentinel.
|
|
25
|
+
|
|
26
|
+
- Add whole-turn context modes: `[X] PRUNED`, `[ ] PROSE`, `[○] PROSE+TOOLS`, and
|
|
27
|
+
`[■] FULL`; preserve `[-] LOCKED`. Space retains the prune/restore shortcut;
|
|
28
|
+
`f` cycles modes, including from agent/tool subentries. Preview native content,
|
|
29
|
+
explicit mode transitions and estimated token growth.
|
|
30
|
+
- Reinsert selected original messages at their chronological positions without
|
|
31
|
+
compacted/startup-read duplicates. PROSE+TOOLS retains complete recorded tools
|
|
32
|
+
with thinking markers; FULL retains recorded thinking/signatures and images.
|
|
33
|
+
Persist reversible branch-local choices through reload and later compactions,
|
|
34
|
+
respect explicit context edits, protect native turns from trimming, and reject
|
|
35
|
+
oversized selections rather than silently losing fidelity. Normal provider
|
|
36
|
+
compatibility transformations still apply.
|
|
37
|
+
|
|
38
|
+
- Clarify the filtering TUI with framed selection/review steps, a highlighted
|
|
39
|
+
focused row, numbered turns, semantic action labels and fixed keyboard controls.
|
|
40
|
+
Separate preview instructions from turn content and show a change summary.
|
|
41
|
+
|
|
42
|
+
- Add `/filter-turns` to immediately filter or restore an existing checkpoint,
|
|
43
|
+
without compacting additional history, moving the boundary or starting an agent
|
|
44
|
+
turn. Persist branch-local revisions, refresh reorientation for each revision,
|
|
45
|
+
and carry choices into later verbatim or summary compaction. Recent messages
|
|
46
|
+
remain untouched; pending pre-flags can still be cancelled.
|
|
47
|
+
|
|
48
|
+
- Add `/filter-later <message>` (alias `/fl`) to submit a normal user turn pre-flagged for future
|
|
49
|
+
filtering. Add branch-local `/filter-auto on|off` (default off) to apply eligible
|
|
50
|
+
user pre-flags during verbatim threshold/overflow compaction without a picker.
|
|
51
|
+
- Allow previously filtered turns to be unchecked and restored using `/filter-turns`
|
|
52
|
+
or manual filtered compaction. Preview restorations and pending-flag cancellations; preserve
|
|
53
|
+
canonical startup-read and file-operation metadata for reversible checkpoints.
|
|
54
|
+
Explicit keep/restore decisions prevent automatic re-filtering of the same aside.
|
|
55
|
+
|
|
56
|
+
- Add `/compact-filtered` for optional manual whole-turn filtering in the terminal:
|
|
57
|
+
ordinary compaction followed by tree-like selection and scrollable confirmation.
|
|
58
|
+
Cancelling turn edits leaves the completed compaction and original history intact. Replace excluded groups with `[Turn manually filtered]`, remove their
|
|
59
|
+
retained startup-read copies and exclusive file-list paths, and explain the
|
|
60
|
+
marker conditionally in the checkpoint and reorientation. Exclusions persist
|
|
61
|
+
through later verbatim compactions and follow the active branch; original
|
|
62
|
+
history remains recoverable. Recent-tail turns cannot be partially filtered.
|
|
63
|
+
|
|
64
|
+
## 0.9.3
|
|
65
|
+
|
|
66
|
+
- Restore the `706b04b` advertisements for lookup, listing, and grep, including the
|
|
67
|
+
lookup question description; omit "authoritative" from grep attribution. Keep
|
|
68
|
+
the 0.9.2 `context_show_entry` advertisement and ref-free checkpoints unchanged.
|
|
69
|
+
This changes wording only; capping, retrieval behavior, the current lookup-call
|
|
70
|
+
limit, re-orientation, and the retrieval skill remain unchanged.
|
|
71
|
+
- consecutive context_lookups now default to a limit of 3 rather than 1
|
|
72
|
+
|
|
73
|
+
## 0.9.2
|
|
74
|
+
|
|
75
|
+
- Remove inline checkpoint refs, their selection heuristics, stored locator/priority
|
|
76
|
+
fields, the ref-thinning cap stage, and associated prompting and replay metrics.
|
|
77
|
+
Keep compaction-aware, focused recovery tools and ENTRY ids returned by recovery
|
|
78
|
+
results for targeted follow-up. Keep output observations, head-only previews,
|
|
79
|
+
preview tightening, tool-only prefix folding, and destructive cap behavior.
|
|
80
|
+
No migration or compatibility handling for saved checkpoints is added.
|
|
81
|
+
|
|
82
|
+
## 0.9.1
|
|
83
|
+
|
|
84
|
+
- Keep recovery tool advertisements explicitly compaction-aware while adding
|
|
85
|
+
question-led examples: exact earlier commands/results, provenance, conflicting
|
|
86
|
+
observations, and uncertainty about what was done, observed, or decided.
|
|
87
|
+
Distinguish locating an entry, finding a narrow passage, and reading
|
|
88
|
+
a specific detail at a known ENTRY id/ref. Make paging conditional on the missing
|
|
89
|
+
detail, including incomplete or ambiguous passages, and stop once the question
|
|
90
|
+
is answered; do not promote bulk expansion. Partial searches do not prove absence.
|
|
91
|
+
Ref locators are not verification. Retrieval code, payload limits, and defaults
|
|
92
|
+
are unchanged; this is a prompting experiment, not a bounded-return redesign.
|
|
93
|
+
|
|
94
|
+
- Restore the 0.8.9 lookup-first re-orientation and compaction-aware recovery
|
|
95
|
+
framing. Keep refs as raw-entry locators that may narrow a lookup question,
|
|
96
|
+
not citations or validation.
|
|
97
|
+
Restore explicit missing-detail cautions in the checkpoint boundary, tool
|
|
98
|
+
advertisements, and skill. Keep compact signatures, output observations, ref
|
|
99
|
+
selection, progressive capping, and paired-entry retrieval behavior unchanged.
|
|
100
|
+
- Return new bash previews to the first 160 encoded characters plus an omission
|
|
101
|
+
marker, with head-only 120/80-character cap stages. Store bounded prefixes in
|
|
102
|
+
version-2 tool-display records. No legacy rendering or upgrade logic is added.
|
|
103
|
+
|
|
104
|
+
## 0.9.0
|
|
105
|
+
|
|
106
|
+
- Add progressive capping in the pure `extensions/lib/checkpoint-cap.ts` module.
|
|
107
|
+
Before omitting history, try 120/80-character previews, fewer lower-priority
|
|
108
|
+
refs, and folded adjacent tool-only prefixes, oldest first and only as needed.
|
|
109
|
+
Protect file paths, observed outcomes, and history-bearing refs. Preserve
|
|
110
|
+
independently trimmable calls after grouping. Distinguish `tools-tightened`
|
|
111
|
+
presentation changes from `trimmed` omissions.
|
|
112
|
+
- Persist versioned bounded tool-display records alongside uncapped span lines.
|
|
113
|
+
Later checkpoints can tighten earlier structured spans without editing stored
|
|
114
|
+
compactions or reinterpreting raw history. Budget increases/cap-off restore
|
|
115
|
+
normal rendering. Text-only legacy spans and invalid/future records remain
|
|
116
|
+
opaque. Retained startup reads, inherited bases, and cap-policy dialogs retain
|
|
117
|
+
their existing protection/behavior.
|
|
118
|
+
|
|
119
|
+
- Render compact `[Tools]:` signatures with complete file paths, requested read
|
|
120
|
+
ranges, payload sizes/counts, and 160-character head-and-tail bash previews.
|
|
121
|
+
Keep escaped newlines and shell syntax intact; omit tool-level timeout fields.
|
|
122
|
+
Replace new `[ok]` labels with conservative historical output observations;
|
|
123
|
+
retain explicit tool-error/unknown status. Recognized test/build summaries,
|
|
124
|
+
HTTP observations, tiny complete historical outputs, and commit hashes can
|
|
125
|
+
remain visible. Unlabelled calls do not imply success. Normal rendering keeps
|
|
126
|
+
messages separate; progressive capping may fold tool-only prefixes. No command
|
|
127
|
+
diffs, arbitrary output tails, or read folding.
|
|
128
|
+
- Add checkpoint `ref=ID` hints for write/edit payloads, truncated commands, and
|
|
129
|
+
likely historical observations. `context_show_entry` can open refs directly
|
|
130
|
+
with `includeRelated=true`, recovering matched calls and results together in
|
|
131
|
+
bounded pages. Ordinary single-entry retrieval stays unchanged; related-entry
|
|
132
|
+
indexing respects tool names, duplicate ambiguity, sequential reuse, and the
|
|
133
|
+
active branch. Refs do not depend on deletion inference; no ref makes no
|
|
134
|
+
reproducibility claim. Existing saved span lines are preserved.
|
|
135
|
+
|
|
136
|
+
- Add read-only compaction timing and headroom replays, including valid doubled
|
|
137
|
+
histories with remapped IDs. Record the first destructive cap at identical cut
|
|
138
|
+
points; keep reconstruction costs separate from timed compaction hooks. Baseline
|
|
139
|
+
snapshots preserve relative imports after modular source refactors. These are
|
|
140
|
+
local performance/evidence-retention checks, not live-model quality results.
|
|
141
|
+
- Known performance limitation: the final destructive fallback recounts remaining
|
|
142
|
+
rows after each deletion, so heavily capped histories can scale superlinearly.
|
|
143
|
+
Incremental size accounting is deferred; the presentation-only stages are not
|
|
144
|
+
subject to that repeated-recount path.
|
|
145
|
+
|
|
146
|
+
## Earlier development notes
|
|
4
147
|
|
|
5
148
|
- Raise the default lookup budget from 10 to 25 substantive search turns (75 total
|
|
6
149
|
search-phase model calls, plus a final tool-free write-up). Keep the consecutive
|
|
@@ -158,4 +301,5 @@
|
|
|
158
301
|
- Preliminary synthetic pilot figures are preserved as historical results from
|
|
159
302
|
the earlier file-backed implementation, not measurements of the current implementation.
|
|
160
303
|
|
|
161
|
-
|
|
304
|
+
Full live-model evaluation remains pending; integration tests and local replay
|
|
305
|
+
benchmarks are not live-model quality measurements.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# transparent-compact
|
|
2
2
|
|
|
3
3
|
Deterministic context compaction for [Pi](https://pi.dev/), with session-backed
|
|
4
|
-
recovery.
|
|
4
|
+
recovery. Replaces Pi's model-generated compaction summary with a verbatim
|
|
5
5
|
compaction, with a checkpoint built mechanically from conversation text. Thinking and most tool outputs are removed
|
|
6
6
|
from the active model context, while user inputs, assistant text and selected startup reads are retained verbatim.
|
|
7
7
|
Tool calls and custom messages are reduced to short stubs; custom-message bodies remain recoverable from the session.
|
|
@@ -9,8 +9,9 @@ Verbatim compaction itself makes no model call. When a missing detail is needed,
|
|
|
9
9
|
full raw branch and returns only relevant findings.
|
|
10
10
|
The goal is to let the agent withstand many (but finite) rounds of compaction without the copy-of-a-copy degradation of model-summary compaction, which is exacerbated in sub-frontier models.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Additionally, a manual filtering tool is provided to allow the user to selectively include or exclude full turns in the context checkpoint, at varying degrees of fidelity.
|
|
13
|
+
|
|
14
|
+
The design principle is that:
|
|
14
15
|
|
|
15
16
|
- All algorithmic or model-based manipulation of prose has the potential to confound the model later, and should be avoided for as long as possible.
|
|
16
17
|
- History retrieval should be parsimonious, explicitly clear to the agent, and agnostic to the task and session structure.
|
|
@@ -19,8 +20,8 @@ such as **Qwen 3.8 27B** or **GPT-6 Luna**. The design principle is that:
|
|
|
19
20
|
this outperforms more complicated techniques with lightweight models, and is at least as effective with frontier models too.
|
|
20
21
|
It helps weaker models to avoid confabulating the historical context and to more carefully verify what it does and does not know.
|
|
21
22
|
|
|
22
|
-
The
|
|
23
|
-
|
|
23
|
+
The advantages over other methods are most apparent in a strong local LLM with a reasonably large context window (>128k) : for example, through **Qwen 3.8 27B llama.cpp on an RTX 5090**.
|
|
24
|
+
However it is also very practical for use with stronger models and larger context windows.
|
|
24
25
|
|
|
25
26
|
## Install
|
|
26
27
|
|
|
@@ -45,9 +46,6 @@ or from a downloaded or cloned checkout:
|
|
|
45
46
|
pi install /absolute/path/to/transparent-compact
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
The extension entry point is `extensions/index.ts`, so Pi's compact extension list
|
|
49
|
-
shows `@foliox/transparent-compact-pi` without a filename suffix for npm installs.
|
|
50
|
-
|
|
51
49
|
## Usage
|
|
52
50
|
|
|
53
51
|
Pi's compaction uses transparent-compact by default once the extension is loaded.
|
|
@@ -60,25 +58,113 @@ To compact manually:
|
|
|
60
58
|
The checkpoint begins with an explanation and full recovery instructions, and
|
|
61
59
|
ends with an evidence-boundary warning. Task-relevant recovery reminders and a
|
|
62
60
|
brief recovery recap follow **the retained recent history and any pending new
|
|
63
|
-
user input**.
|
|
64
|
-
After another compaction, only the current checklist is presented: older generated
|
|
65
|
-
checklists are excluded from compacted spans and the retained tail. This is
|
|
66
|
-
instruction delivery, not a guarantee of model compliance.
|
|
61
|
+
user input**. This is instruction delivery, not a guarantee of model compliance.
|
|
67
62
|
|
|
68
63
|
Compaction hides earlier details from the model's view; recorded history remains
|
|
69
64
|
retrievable. Recovery guidance explicitly names uncertain provenance (where a
|
|
70
65
|
finding came from or why a conclusion was reached) and contradictions between
|
|
71
|
-
earlier notes and new evidence.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
earlier notes and new evidence.
|
|
67
|
+
|
|
68
|
+
### Choose checkpoint turn fidelity
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
/filter-turns # edit the existing checkpoint; no compaction
|
|
72
|
+
/compact-filtered # ordinary compaction first, then open the same editor
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`/compact-filtered` completes an ordinary verbatim compaction, preserving existing
|
|
76
|
+
turn settings, **before** opening the `/filter-turns` editor. Cancelling that editor
|
|
77
|
+
leaves the completed compaction intact. If Pi has nothing new to compact, the command
|
|
78
|
+
opens the existing checkpoint instead. Cancelling compaction itself (including its
|
|
79
|
+
size-cap dialog), or a compaction failure, does not open the editor. No special
|
|
80
|
+
filtering step runs inside the compaction hook.
|
|
81
|
+
|
|
82
|
+
In the interactive terminal, the editor opens a framed checklist of user turns, with
|
|
83
|
+
a highlighted cursor, action labels and a separate fixed controls area. The review
|
|
84
|
+
step summarizes mode changes; a live estimated context readout stays visible on
|
|
85
|
+
both selection and review screens.
|
|
86
|
+
Each choice applies to a user message and everything following it until the next
|
|
87
|
+
user message, including turns spanning multiple compactions.
|
|
88
|
+
|
|
89
|
+
| Symbol | Mode | Active context |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `[X]` | **PRUNED** | A positioned filtering marker only |
|
|
92
|
+
| `[ ]` | **PROSE** | Our standard mechanical compaction, including compact tool stubs |
|
|
93
|
+
| `[○]` | **PROSE+TOOLS** | Original conversation text and complete recorded tool arguments/results; thinking markers only |
|
|
94
|
+
| `[■]` | **FULL** | Original conversation content, including all recorded thinking and image attachments |
|
|
95
|
+
| `[-]` | **LOCKED** | Unavailable; not a fifth fidelity mode |
|
|
96
|
+
|
|
97
|
+
The readout updates as you change modes, for example:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
Estimated context: ~29,365 / 272,000 tokens (10.8%) · incl. ~20,000 tail · +~160 scaffolding
|
|
101
|
+
Net Δ −20 · free 222,155 · reserve 20,480
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Counts use Pi's rough characters/4 heuristic plus message-framing allowances, not
|
|
105
|
+
provider tokenization.
|
|
106
|
+
|
|
107
|
+
Use **↑/↓** to navigate and **←/→** to collapse/expand details for the selected
|
|
108
|
+
mode. **Space** prunes any kept mode, or restores a pruned turn as PROSE. **f** cycles
|
|
109
|
+
PRUNED → PROSE → PROSE+TOOLS → FULL → PRUNED. Both keys act on the owning whole turn
|
|
110
|
+
when an agent/tool subentry is focused. **Enter** opens a complete, scrollable
|
|
111
|
+
change preview; **Enter** again confirms, **Esc** goes back or cancels.
|
|
112
|
+
|
|
113
|
+
Filtering requires verbatim mode and an idle agent. Turns overlapping Pi's retained
|
|
114
|
+
recent tail cannot be removed yet: filtering never removes only half a turn or
|
|
115
|
+
changes Pi's retention boundary. Content inside an opaque inherited summary cannot be
|
|
116
|
+
selected individually.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
`/filter-turns` requires an existing verbatim checkpoint
|
|
120
|
+
and works even when there is no new history to compact. It saves a reversible,
|
|
121
|
+
branch-local checkpoint revision without moving the retained boundary or starting
|
|
122
|
+
an agent turn. PROSE restoration uses the canonical spans, startup reads and file
|
|
123
|
+
operations and remains subject to the size cap. PROSE+TOOLS/FULL instead reinsert
|
|
124
|
+
original messages at their chronological positions, replacing their compacted
|
|
125
|
+
copies and any duplicate startup-read copies. Explicit context omissions and
|
|
126
|
+
replacements remain respected. Complete tool-call/result groups are required.
|
|
127
|
+
Before the first checkpoint, use `/compact-filtered`.
|
|
128
|
+
|
|
129
|
+
Full-fidelity choices persist through later verbatim compactions and reload/resume.
|
|
130
|
+
Their content is **never silently shortened by the prose cap**. Estimated native
|
|
131
|
+
message cost is treated as fixed overhead; only PROSE can be trimmed. The extension
|
|
132
|
+
checks the model context budget before saving and on actual requests, reserving
|
|
133
|
+
output/framing headroom. Oversized selections are rejected; if later context growth
|
|
134
|
+
or a model change makes existing choices too large, the request is aborted with
|
|
135
|
+
instructions to downgrade turns through `/filter-turns`. Large full-fidelity turns
|
|
136
|
+
can therefore prevent automatic compaction from freeing enough space. Token counts
|
|
137
|
+
are estimates, not provider tokenization guarantees.
|
|
138
|
+
|
|
139
|
+
FULL means all content actually recorded, not unavailable internal reasoning or
|
|
140
|
+
unrecorded nested-tool outputs. Pi's normal model/provider transformations still
|
|
141
|
+
apply: changing models can convert/drop signed or encrypted thinking, and non-vision
|
|
142
|
+
models cannot receive images. Switching to summary compaction still weakens the
|
|
143
|
+
verbatim guarantee; its summarizer receives the expanded recorded text.
|
|
144
|
+
|
|
145
|
+
Each excluded group becomes `[Turn manually filtered]`. Its retained startup reads
|
|
146
|
+
and file-list paths used only in excluded turns are removed too. The checkpoint
|
|
147
|
+
and post-compaction reorientation explain the marker only when filtering is present.
|
|
148
|
+
Exclusions follow the active branch through later verbatim compactions, reload and
|
|
149
|
+
resume. Original session entries remain unchanged and recoverable; filtering does
|
|
150
|
+
not undo file changes. Ordinary `/compact` never applies new pre-flags or opens the
|
|
151
|
+
picker. Automatic compactions apply new pre-flags only when explicitly enabled below.
|
|
152
|
+
|
|
153
|
+
### Pre-flag an aside and optionally apply flags automatically
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
/filter-later <message> # normal user turn, pre-checked in either filtering command
|
|
157
|
+
/fl <message> # short alias for /filter-later
|
|
158
|
+
/filter-auto # report current policy (default off)
|
|
159
|
+
/filter-auto on # apply pre-flags during threshold/overflow compaction
|
|
160
|
+
/filter-auto off # stop applying new pre-flags automatically
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`/filter-later` (or `/fl`) requires an idle agent in verbatim mode. The message and its following
|
|
164
|
+
agent/tool activity remain in normal context until the entire group is eligible
|
|
165
|
+
for filtering. It is not an isolated `/btw` conversation. In `/filter-turns` or
|
|
166
|
+
`/compact-filtered`, you can uncheck the aside before exclusion, or restore it afterward.
|
|
167
|
+
|
|
82
168
|
|
|
83
169
|
### Automatic startup-read retention
|
|
84
170
|
|
|
@@ -92,36 +178,22 @@ continues until that prompt arrives.
|
|
|
92
178
|
|
|
93
179
|
This is a literal filename-matching heuristic, not an interpretation of required
|
|
94
180
|
reading. It does not capture every possible reference or fill in incomplete reads.
|
|
95
|
-
The agent is no longer given a required-document reread checklist; recovery is for
|
|
96
|
-
missing task-relevant evidence. See [selection details](docs/DESIGN.md#retained-startup-reads).
|
|
97
|
-
|
|
98
|
-
### Select the compaction method
|
|
99
|
-
|
|
100
|
-
```text
|
|
101
|
-
/compaction-method
|
|
102
|
-
/compaction-method verbatim
|
|
103
|
-
/compaction-method summary
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
`/compaction-method` is available to opt-in to Pi's builtin summary compaction for the current session.
|
|
107
|
-
|
|
108
|
-
The choice applies to manual `/compact`, automatic threshold compaction, and context-overflow recovery.
|
|
109
|
-
With no argument, the command reports the current method.
|
|
110
|
-
|
|
111
|
-
The choice persists in the existing session, follows branch history through
|
|
112
|
-
reload, resume, fork, and tree navigation, and needs no extra configuration file.
|
|
113
|
-
New sessions default to verbatim.
|
|
114
181
|
|
|
115
182
|
### Control the compaction cap
|
|
116
183
|
|
|
117
|
-
|
|
118
|
-
|
|
184
|
+
When the checkpoint exceeds its budget, capping first tightens tool presentation:
|
|
185
|
+
160→120→80-character previews, then grouped tool-only prefixes. Only if those stages
|
|
186
|
+
cannot make it fit does it remove conversation content. `tools-tightened` marks presentation changes; `trimmed` marks actual
|
|
187
|
+
omissions. Earlier structured spans can be tightened in the new checkpoint without
|
|
188
|
+
editing their stored originals; disabling the cap restores their normal rendering.
|
|
189
|
+
Text-only legacy spans use a conservative fallback.
|
|
190
|
+
See [how cap trimming works](docs/DESIGN.md#how-cap-trimming-works) for the full order.
|
|
119
191
|
This is meant as a fallback option for allowing compaction rounds to run far in excess of the intended use case, and should probably be used to allow work to be wrapped up before handing off to a new session.
|
|
120
192
|
If you find that in normal usage you frequently work over the compaction cap, other compaction tools are likely to be more suitable.
|
|
121
193
|
|
|
122
194
|
The default is **`warn 25%`**: a conversation-and-retained-reads budget estimated at 25% of
|
|
123
195
|
the current model's context window, using **4 characters per token**, not an
|
|
124
|
-
exact tokenizer. When
|
|
196
|
+
exact tokenizer. When tightening or omission would be needed, choose **Apply trimming**,
|
|
125
197
|
**Disable cap for this session**, **Change budget**, or **Cancel compaction**. Disabling persists as `off`, rather than
|
|
126
198
|
bypassing just once.
|
|
127
199
|
|
|
@@ -159,7 +231,6 @@ for unattended operation. If a percentage cannot be resolved because the model's
|
|
|
159
231
|
context window is unavailable, compaction is cancelled: choose a character/token
|
|
160
232
|
budget or turn the cap off.
|
|
161
233
|
|
|
162
|
-
|
|
163
234
|
## Configuration
|
|
164
235
|
|
|
165
236
|
No separate configuration file is required. Set environment variables before
|
|
@@ -206,6 +277,24 @@ Instructions and file lists sit outside the budget; an inherited base and retain
|
|
|
206
277
|
startup reads are uncapped, and the line budget has a 500-character minimum. Tune it
|
|
207
278
|
alongside the model's context window and Pi's `compaction.keepRecentTokens`.
|
|
208
279
|
|
|
280
|
+
### Select the compaction method
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
/compaction-method
|
|
284
|
+
/compaction-method verbatim
|
|
285
|
+
/compaction-method summary
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
`/compaction-method` is available to opt-in to Pi's builtin summary compaction for the current session.
|
|
289
|
+
|
|
290
|
+
The choice applies to manual `/compact`, automatic threshold compaction, and context-overflow recovery.
|
|
291
|
+
With no argument, the command reports the current method.
|
|
292
|
+
|
|
293
|
+
The choice persists in the existing session, follows branch history through
|
|
294
|
+
reload, resume, fork, and tree navigation, and needs no extra configuration file.
|
|
295
|
+
New sessions default to verbatim.
|
|
296
|
+
|
|
297
|
+
|
|
209
298
|
### Local inference engines
|
|
210
299
|
|
|
211
300
|
When lookups use the session model on a local server, they share its KV cache with the main session.
|