@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/docs/DESIGN.md
CHANGED
|
@@ -12,33 +12,251 @@ extension builds a checkpoint without changing that boundary or calling a model:
|
|
|
12
12
|
| Assistant prose | Kept, subject to the size guard. |
|
|
13
13
|
| Tool calls | Short signatures with outcome labels; full arguments and outputs remain recoverable. |
|
|
14
14
|
| Assistant thinking | Removed from the checkpoint; retained in the raw session. |
|
|
15
|
-
| Tool outputs |
|
|
15
|
+
| Tool outputs | Mostly removed; selected bash observations and startup reads remain. All remain in raw history. |
|
|
16
16
|
| Custom messages | Short type stubs marked `content removed`; bodies remain in the raw session. Managed re-orientation messages are regenerated instead. |
|
|
17
17
|
| Recent conversation | Pi keeps its normal verbatim tail. |
|
|
18
18
|
| Earlier compacted spans | Re-rendered chronologically, without repeated model summarization. |
|
|
19
19
|
| Read/modified file lists | Cumulative operation lists with checkpoint-relative retained-evidence annotations. |
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
New tool lines use `[Tools]:` with compact display signatures:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
read "src/example.ts":12-41
|
|
25
|
+
write "scratch.py" (2144 chars)
|
|
26
|
+
edit "src/example.ts" ×2
|
|
27
|
+
bash "uv run pytest -q 2>&1 | tail -25" → output: "3 failed, 16 passed in 0.21s"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
File paths remain complete and are relative to the session working directory where
|
|
31
|
+
possible. Read ranges record requested lines, not actual returned coverage or symbol
|
|
32
|
+
locations. Write bodies become sizes; edit arrays become counts (individual
|
|
33
|
+
`oldText`/`newText` fields become sizes). Bash omits its tool-level `timeout` argument
|
|
34
|
+
but retains other arguments such as `background`. Commands abbreviate the working
|
|
35
|
+
directory to `.` at path boundaries. New JSON-encoded previews keep the first 160
|
|
36
|
+
characters, followed by an ellipsis when truncated. Newlines remain escaped;
|
|
37
|
+
imports, redirections, and shell syntax are not rewritten. Other argument previews
|
|
38
|
+
remain bounded prefixes. These signatures are display notation, not replayable shell
|
|
39
|
+
commands. Calls normally remain separate across assistant messages. The size guard
|
|
40
|
+
may fold adjacent tool-only prefixes while preserving ordering and independently
|
|
41
|
+
removable calls. No command diffs or read folding are performed.
|
|
42
|
+
|
|
43
|
+
`[tool error]` means a safely matched result was flagged as an error; `[unknown]`
|
|
44
|
+
means no safely matched result/status. Plain successes have no status label; this
|
|
45
|
+
**does not establish exit 0 or passing tests**. Legacy `[ok]` means only that the
|
|
46
|
+
result was not flagged as an error. Selected bash observations appear after `→`:
|
|
47
|
+
reported nonzero shell status, `no output`, recognized test/build summary lines,
|
|
48
|
+
explicit HTTP status observations for leading curl/wget commands, or a short
|
|
49
|
+
error-text quote. Detectors are conservative lexical heuristics, not verdicts.
|
|
50
|
+
Test summaries are scanned only for recognized test/build invocations; error text
|
|
51
|
+
only for recognized execution commands, not leading file-read/search/git commands.
|
|
52
|
+
Unknown formats remain unlabelled. A status for a pipeline does not establish the
|
|
53
|
+
status of its individual commands. A bracketed git commit hash can also be retained.
|
|
54
|
+
|
|
55
|
+
Likely historical bash observations (network, terminal, scripts, timings) may retain
|
|
56
|
+
a complete text output of at most 100 characters, but not arbitrary output tails.
|
|
57
|
+
Media, structured-only results, and detected truncated output do not qualify as tiny
|
|
58
|
+
complete observations. Every quote is escaped and bounded. All observations are
|
|
59
|
+
historical, not proof of current state; assistant prose remains a record of claims,
|
|
60
|
+
not independent verification.
|
|
61
|
+
|
|
62
|
+
Only selected preparation messages supply output labels; raw history and the
|
|
63
|
+
retained tail do not supply missing outcomes. Stored canonical span lines remain
|
|
64
|
+
unchanged; their presentation in a later checkpoint may tighten under budget pressure.
|
|
65
|
+
|
|
66
|
+
When omitted observations, payloads, or provenance are needed, prefer
|
|
67
|
+
`context_lookup` with a specific historical question. Recovery results supply
|
|
68
|
+
ENTRY ids for targeted follow-up. For a specific missing passage at a known ENTRY
|
|
69
|
+
id, `context_show_entry` can read that entry directly; search or interpretation
|
|
70
|
+
remains a `context_lookup` task.
|
|
71
|
+
The list/grep tools remain fallbacks when lookup findings are incomplete. For
|
|
72
|
+
current state, inspect files. There is no required-document reread checklist.
|
|
37
73
|
|
|
38
74
|
All newly compacted custom messages follow the same stub policy, regardless of
|
|
39
75
|
extension, display setting, or content format. Long type names are abbreviated
|
|
40
76
|
like tool-call arguments. This applies even with the cap disabled. Previously
|
|
41
|
-
saved spans are not rewritten; older custom-message bodies may remain in them.
|
|
77
|
+
saved canonical spans are not rewritten; older custom-message bodies may remain in them.
|
|
78
|
+
|
|
79
|
+
### User-controlled turn filtering
|
|
80
|
+
|
|
81
|
+
`/compact-filtered` sequences ordinary verbatim manual compaction and the shared
|
|
82
|
+
`/filter-turns` editor. It waits for Pi's completion callback, so the new checkpoint
|
|
83
|
+
is already saved and the host is idle before the picker opens. There is no special
|
|
84
|
+
custom-instruction sentinel or interactive filtering path in `session_before_compact`.
|
|
85
|
+
The first phase inherits all existing choices like ordinary `/compact`; the second
|
|
86
|
+
phase proposes a separate reversible revision. Escape in the picker leaves the
|
|
87
|
+
completed compaction intact. A failed or cancelled first phase never opens it.
|
|
88
|
+
Pi's current no-op outcomes (`Already compacted` and `Nothing to compact (session too
|
|
89
|
+
small)`) open an existing checkpoint only if the session/branch is unchanged. A
|
|
90
|
+
session/branch change or unexpected checkpoint result cancels the workflow; the
|
|
91
|
+
shared editor rechecks idle/UI/method state before opening.
|
|
92
|
+
|
|
93
|
+
Only turns wholly before the saved boundary can be excluded; pre-flagged turns
|
|
94
|
+
still overlapping the retained tail remain pending and their flags can be cancelled
|
|
95
|
+
in the picker. Other recent turns stay locked. Agent/tool subentries are inspection
|
|
96
|
+
views of their owning user turn. Previously pruned turns start checked; unchecking
|
|
97
|
+
restores their compacted representation. Confirmation distinguishes pruning,
|
|
98
|
+
restoration, fidelity and pending-flag changes. Escape goes back from confirmation,
|
|
99
|
+
or cancels only the proposed revision. No filtering UI runs in ordinary manual,
|
|
100
|
+
threshold or overflow compaction itself.
|
|
101
|
+
|
|
102
|
+
`/filter-turns` uses the same selection/confirmation UI against the existing
|
|
103
|
+
checkpoint only. It does not invoke Pi's compaction preparation, append a compaction,
|
|
104
|
+
add a span, move `firstKeptEntryId`, or start an agent turn. It therefore also works
|
|
105
|
+
immediately after compaction when Pi has nothing more to compact. An existing
|
|
106
|
+
verbatim checkpoint and an idle interactive session are required; recent messages
|
|
107
|
+
remain untouched, though pending aside flags can be cancelled.
|
|
108
|
+
|
|
109
|
+
Canonical span lines carry parallel `turnIds`, anchored to raw user entry IDs
|
|
110
|
+
through Pi's source-preserving projection (including explicit context replacements).
|
|
111
|
+
A group includes all activity until the next raw user message, even across multiple
|
|
112
|
+
compaction spans. Confirmed exclusions are stored as the current `filteredTurnIds`
|
|
113
|
+
snapshot on the compaction entry or its standalone revision, not an append-only
|
|
114
|
+
union. Later verbatim checkpoints apply that branch-local selection to the original canonical spans before size
|
|
115
|
+
trimming, reindexing tool display records without changing stored history. File
|
|
116
|
+
operation lists and startup-read snapshots in compaction details remain canonical
|
|
117
|
+
and unfiltered; only the rendered checkpoint masks them. Restoring a turn therefore
|
|
118
|
+
also restores its retained-read copies and file-list membership without re-reading
|
|
119
|
+
files or reselecting startup evidence. There is no migration or reconstruction of
|
|
120
|
+
saved spans without turn ownership; opaque content is not individually selectable.
|
|
121
|
+
|
|
122
|
+
One `[Turn manually filtered]` marker replaces each excluded group at its original
|
|
123
|
+
position, even across spans. Markers survive the size cap. Startup-read copies owned
|
|
124
|
+
by the group are excluded; file-list paths used only by excluded turns are removed.
|
|
125
|
+
Filtering does not undo filesystem mutations. The checkpoint introduction and
|
|
126
|
+
persistent reorientation conditionally explain that the user excluded low-value
|
|
127
|
+
context, which remains retrievable from the full raw history. Recovery tools are
|
|
128
|
+
unchanged. Cancelling or failing a turn edit saves no revision. Mechanical compaction
|
|
129
|
+
with existing pruning or fidelity choices cancels on build failure rather than
|
|
130
|
+
falling through to a model summary that would lose those choices.
|
|
131
|
+
|
|
132
|
+
Standalone updates append a non-context `transparent-compact:filter-revision`
|
|
133
|
+
entry containing the source compaction ID, rendered checkpoint, exclusions and
|
|
134
|
+
keep overrides. The latest revision for the active compaction wins. At request
|
|
135
|
+
time, `context_with_system` replaces Pi's projected `compactionSummary` with the
|
|
136
|
+
revised text and any selected native turn segments, and refreshes the managed
|
|
137
|
+
reminder for that revision. Original compaction entries and
|
|
138
|
+
the raw recent tail are never edited. Host views/estimates based solely on Pi's
|
|
139
|
+
saved projection can still reflect the original summary; actual provider requests
|
|
140
|
+
receive the revision. The checkpoint size guard applies before a revision is saved.
|
|
141
|
+
|
|
142
|
+
Reload/resume and tree navigation select revisions from the raw active branch.
|
|
143
|
+
The next real verbatim compaction inherits their choices and supersedes the old
|
|
144
|
+
revision; model-summary compaction is also given the revised previous summary and
|
|
145
|
+
file lists rather than stale saved checkpoint content. Cancelling the picker or
|
|
146
|
+
size-cap decision saves no filtering revision. No-op confirmation writes nothing.
|
|
147
|
+
|
|
148
|
+
`/filter-later <message>` (alias `/fl`) submits an ordinary user message through Pi's user-message API.
|
|
149
|
+
A short-lived bridge from that submission's input event writes a non-context
|
|
150
|
+
`transparent-compact:aside-turn` entry just before its user message is persisted.
|
|
151
|
+
The next raw user entry consumes the flag, guarded by that message's timestamp.
|
|
152
|
+
A failed/handled input is cleared by the next input, and session changes clear the
|
|
153
|
+
bridge; no content heuristic is used to flag historical messages. Asides remain
|
|
154
|
+
visible until eligible and are pre-checked by manual filtering.
|
|
155
|
+
|
|
156
|
+
`/filter-auto on|off` persists a branch-local
|
|
157
|
+
`transparent-compact:auto-filter` policy (default off). When enabled, threshold
|
|
158
|
+
and overflow compaction apply eligible user pre-flags without opening a picker.
|
|
159
|
+
Ordinary `/compact` does not apply new pre-flags; summary mode is unchanged.
|
|
160
|
+
The compaction's `keptAsideTurnIds` snapshot records explicit manual keep/restore
|
|
161
|
+
overrides, so future auto compactions do not re-exclude those asides. Turning off
|
|
162
|
+
auto filtering affects new applications, not existing exclusions. No automatic
|
|
163
|
+
relevance judgment, model call or filesystem mutation is introduced.
|
|
164
|
+
|
|
165
|
+
### Selective full-fidelity turns
|
|
166
|
+
|
|
167
|
+
The same picker has four modes: `[X] PRUNED`, `[ ] PROSE`, `[○] PROSE+TOOLS`, and
|
|
168
|
+
`[■] FULL`. `[-] LOCKED` is an independent availability state and remains unchanged.
|
|
169
|
+
Space switches any kept mode to PRUNED, or PRUNED to PROSE. `f` cycles all four modes;
|
|
170
|
+
for pending recent-tail pre-flags it only toggles PRUNED/PROSE. Both controls always
|
|
171
|
+
act on the whole owning user turn. Expansion and confirmation preview show the
|
|
172
|
+
chosen representation; preview also estimates token growth.
|
|
173
|
+
|
|
174
|
+
The compaction/revision stores a `fidelity` map of raw user IDs to `tools`/`full`
|
|
175
|
+
and generated `slots`, never another copy of raw payloads. PRUNED continues to use
|
|
176
|
+
`filteredTurnIds`; absent fidelity means PROSE. Before capping, every compacted copy
|
|
177
|
+
of a selected native turn is replaced by a single generated slot, even across
|
|
178
|
+
multiple canonical spans. Slots are structurally protected from trimming. Generated
|
|
179
|
+
random markers are resolved to checked UTF-16 offsets in the final checkpoint;
|
|
180
|
+
request projection never interprets historical text as a managed placeholder.
|
|
181
|
+
|
|
182
|
+
At request time, the checkpoint is split at those offsets into chronological
|
|
183
|
+
compacted segments interleaved with original user/assistant/tool messages. The raw
|
|
184
|
+
projection disables compaction while preserving branch topology and Pi's explicit
|
|
185
|
+
context edits and custom-message conversion. Historical system configuration and
|
|
186
|
+
obsolete managed reorientation messages are not replayed. Tool-call/result groups
|
|
187
|
+
must be complete and unambiguous. PROSE+TOOLS replaces each thinking block with a
|
|
188
|
+
text marker in place; FULL retains stored blocks/signatures/images. Request-local
|
|
189
|
+
copies prevent later transforms from mutating canonical session records. Provider
|
|
190
|
+
compatibility transformations still apply, including cross-model reasoning and
|
|
191
|
+
non-vision image handling; no unavailable reasoning or nested outputs are invented.
|
|
192
|
+
|
|
193
|
+
Native turns replace their compacted prose and startup-read duplicates, not the
|
|
194
|
+
canonical source data. File paths remain listed and successful read outputs in
|
|
195
|
+
native turns get a conservative historical-evidence annotation. PROSE restoration
|
|
196
|
+
can recover its canonical retained reads again. Mode choices inherit through
|
|
197
|
+
reload/resume, tree navigation and later verbatim compactions; explicit fidelity
|
|
198
|
+
choices also override aside pre-flags. An empty revision clears old fidelity rather
|
|
199
|
+
than falling back to the source checkpoint's map. Explicit summary compaction gets
|
|
200
|
+
expanded historical text as its previous summary and may summarize it normally.
|
|
201
|
+
|
|
202
|
+
Native message token estimates count as fixed overhead in the character cap; only
|
|
203
|
+
PROSE is trimmable. Independent context-window checks run before saving and after
|
|
204
|
+
system restoration on each actual request, with output/framing headroom. They use
|
|
205
|
+
Pi's token estimates, not a provider tokenizer. Oversized updates save no revision;
|
|
206
|
+
subsequent budget/projection failures explicitly abort the active operation (a hook
|
|
207
|
+
exception alone is not a cancellation gate). Existing full-fidelity content is never
|
|
208
|
+
silently dropped or downgraded to make room. The user can remove/downgrade a pin,
|
|
209
|
+
even if later context edits made its original tool group unreplayable. Host views
|
|
210
|
+
and compaction-boundary selection still use Pi's saved checkpoint; provider requests
|
|
211
|
+
include native expansions and are checked separately.
|
|
212
|
+
|
|
213
|
+
### Live context size preview
|
|
214
|
+
|
|
215
|
+
Selection and review share a live whole-context estimate: input tokens/context
|
|
216
|
+
window, percentage, net delta from saved input, and headroom after the same output
|
|
217
|
+
and framing reserve used by the context guard. The total explicitly includes the
|
|
218
|
+
measured tail size, not the configured retention target. Short terminals show the
|
|
219
|
+
total only.
|
|
220
|
+
The editor supplies a read-only estimator to the picker. It renders proposed
|
|
221
|
+
selections through the same checkpoint builder as saving, with passive cap
|
|
222
|
+
resolution and no notifications/dialogs/persistence. Warn assumes applying the
|
|
223
|
+
current budget on changes; unchanged selections use the actual saved checkpoint,
|
|
224
|
+
not a hypothetical rebuild under a newly changed cap policy. A presentation result
|
|
225
|
+
from the real cap renderer records actual trimming/tightening; only then does the UI
|
|
226
|
+
mention the size limit, in plain language, including whether saving asks first.
|
|
227
|
+
Raw `cap warn` policy/debug labels are not shown.
|
|
228
|
+
|
|
229
|
+
Notice accounting separately measures generated pruning guidance, checkpoint
|
|
230
|
+
revision notices and full-fidelity guidance using counterfactual messages through
|
|
231
|
+
the real estimator. Only the generated introduction before `SECTION_HEADER` and
|
|
232
|
+
the generated reminder are edited in these counterfactuals; quoted historical text
|
|
233
|
+
is untouched. Costs therefore follow the actual text/estimator, with no fixed token
|
|
234
|
+
allowance. Activation/removal changes are summed into one inline `+~N scaffolding`
|
|
235
|
+
(or `−~N scaffolding`) indicator after the tail on the estimated-context row,
|
|
236
|
+
already included in the total and net delta.
|
|
237
|
+
No notice breakdown or extra notice row is shown; unchanged context has no added
|
|
238
|
+
scaffolding indicator. Existing notice rounding is not presented as fresh overhead
|
|
239
|
+
on every checkbox.
|
|
240
|
+
The first prune and first checkpoint update can therefore add noticeable one-time
|
|
241
|
+
cost even when little prose is removed. The delta still includes marker replacements
|
|
242
|
+
and size-limit effects; it is not a raw selected-text token count.
|
|
243
|
+
|
|
244
|
+
The estimator expands generated native slots, removes retained-read duplicates,
|
|
245
|
+
and respects explicit context edits. It counts the untouched live tail (excluding
|
|
246
|
+
old system configuration, obsolete managed checklists and context-excluded bash
|
|
247
|
+
output), plus the current prompt/active tool schemas and one current reminder.
|
|
248
|
+
These are Pi estimates before provider-specific transformations; future input and
|
|
249
|
+
other extensions' future request transformations cannot be predicted. A failed
|
|
250
|
+
baseline leaves delta unknown, while repaired proposed context can still get an
|
|
251
|
+
honest total. Failed estimates are shown as unavailable, never zero.
|
|
252
|
+
|
|
253
|
+
Estimation is asynchronous and coalesced per mode change; navigation, resize and
|
|
254
|
+
theme changes reuse the last result. Pending recalculations retain the completed
|
|
255
|
+
readout, its styling and row count, replacing values only when a new estimate is
|
|
256
|
+
ready. Loading text appears only before any successful estimate (or when retrying
|
|
257
|
+
a failed estimate), not on every toggle. Generation checks reject stale results, and
|
|
258
|
+
closing/disposing the dialog invalidates pending work. No estimated sizes are
|
|
259
|
+
persisted in checkpoint metadata, and no model calls are introduced.
|
|
42
260
|
|
|
43
261
|
### File-list evidence annotations
|
|
44
262
|
|
|
@@ -111,20 +329,50 @@ original branch, not from its summary prose.
|
|
|
111
329
|
|
|
112
330
|
#### How cap trimming works
|
|
113
331
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
332
|
+
The pure renderer/size guard lives in `extensions/lib/checkpoint-cap.ts`, separately
|
|
333
|
+
from Pi hooks, cap-policy dialogs, and session access in `extensions/index.ts`.
|
|
334
|
+
It accepts canonical span data and a line budget and never mutates its inputs.
|
|
335
|
+
**Presentation reductions precede history omission.** Each rung walks oldest first
|
|
336
|
+
across all eligible spans, stopping as soon as the budget fits:
|
|
337
|
+
|
|
338
|
+
1. Shorten bash previews from 160 to 120 encoded characters.
|
|
339
|
+
2. If still over budget, shorten them to 80 characters.
|
|
340
|
+
3. Fold repeated `[Tools]:` prefixes across adjacent tool-only messages in the
|
|
341
|
+
same span. Do not cross prose, custom messages, user messages, or span boundaries.
|
|
342
|
+
4. Only then remove non-user content, oldest first. Structured tool batches remain
|
|
343
|
+
independently trimmable by call even after prefixes have been folded.
|
|
344
|
+
5. Shorten long user messages to marked prefix stubs, oldest first.
|
|
345
|
+
6. As a last resort, remove the oldest remaining content, including user messages.
|
|
346
|
+
|
|
347
|
+
File paths, read ranges, tool status, and output observations are not shortened by
|
|
348
|
+
presentation stages. User and assistant prose remains verbatim until the destructive
|
|
349
|
+
fallback. `tools-tightened="true"` identifies presentation changes without omitted
|
|
350
|
+
prose/calls; `trimmed="true"` and a recovery note identify actual omissions or user
|
|
351
|
+
text shortening. Both attributes can occur on one span. Empty spans are not marked
|
|
352
|
+
unless they became empty through omission.
|
|
353
|
+
|
|
354
|
+
New spans store versioned, bounded display records in `details.span.tools`, alongside
|
|
355
|
+
their normal uncapped `lines`. Records contain signature fragments, original encoded
|
|
356
|
+
command prefixes, and annotations—not unbounded commands, write/edit payloads, or
|
|
357
|
+
full tool outputs. Smaller previews are always derived from
|
|
358
|
+
the same canonical prefix, never from a previous 120/80-character rendering.
|
|
359
|
+
Version-2 records distinguish a truncated prefix from a complete short command.
|
|
360
|
+
Stored compaction entries are not edited: a later checkpoint re-renders its earlier
|
|
361
|
+
spans for the current budget. Increasing the budget or disabling the cap restores
|
|
362
|
+
normal previews; reload/resume/fork follow the active branch's records.
|
|
363
|
+
|
|
364
|
+
Only records that exactly reproduce the stored canonical tool line can be tightened.
|
|
365
|
+
Legacy text-only spans, unsupported versions, and malformed/mismatched records stay
|
|
366
|
+
opaque and use the conservative omission fallback. They are not regex-parsed or
|
|
367
|
+
reconstructed from current raw history, which might differ from the projected
|
|
368
|
+
content originally compacted. Inherited model-summary/opaque bases remain fixed.
|
|
120
369
|
|
|
121
370
|
Retained startup reads count as fixed budget overhead and are never trimmed.
|
|
122
371
|
Like an inherited base, they can exceed the budget by themselves; in that case
|
|
123
372
|
the extension warns and preserves them. The conversation-line budget still has
|
|
124
|
-
a 500-character minimum.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
from the session.
|
|
373
|
+
a 500-character minimum. Space for span annotations is reserved in the size guard.
|
|
374
|
+
Originals remain recoverable from the session; cap settings and warn/on/off dialog
|
|
375
|
+
behavior are unchanged.
|
|
128
376
|
|
|
129
377
|
|
|
130
378
|
### Session-backed lookup
|
|
@@ -199,14 +447,14 @@ files through filesystem tools. This restriction does not apply to user-requeste
|
|
|
199
447
|
session audits, debugging, or cross-session analysis, which can use ordinary file
|
|
200
448
|
tools. Lookup itself still cannot search other sessions or abandoned branches.
|
|
201
449
|
|
|
202
|
-
The extension registers a subagent lookup and three direct-
|
|
450
|
+
The extension registers a subagent lookup and three bounded direct-recovery tools:
|
|
203
451
|
|
|
204
452
|
| Tool | Purpose |
|
|
205
453
|
|---|---|
|
|
206
|
-
| `context_lookup` | Recover
|
|
207
|
-
| `context_list_entries` |
|
|
208
|
-
| `context_grep` |
|
|
209
|
-
| `context_show_entry` |
|
|
454
|
+
| `context_lookup` | Recover outputs, findings, decisions, reasoning, and provenance hidden by compaction, including conflicts with new evidence. A subagent searches the raw branch and returns relevant findings. Accepts only `question`. |
|
|
455
|
+
| `context_list_entries` | Post-compaction fallback: list raw session ENTRY headers and previews. |
|
|
456
|
+
| `context_grep` | Post-compaction fallback: regex-search raw history, including thinking and tool outputs, with entry attribution. |
|
|
457
|
+
| `context_show_entry` | Recover a specific detail hidden by compaction at a known ENTRY id, or after lookup. Optional `includeRelated` recovers matched call/result entries only when that counterpart is needed. |
|
|
210
458
|
|
|
211
459
|
For example, ask the agent to recover the build error observed before compaction.
|
|
212
460
|
It can call `context_lookup` with:
|
|
@@ -217,6 +465,32 @@ It can call `context_lookup` with:
|
|
|
217
465
|
}
|
|
218
466
|
```
|
|
219
467
|
|
|
468
|
+
ENTRY ids returned by recovery tools can narrow subsequent `context_lookup`
|
|
469
|
+
questions or identify a specific passage for `context_show_entry`. Prefer lookup
|
|
470
|
+
when search or interpretation is needed.
|
|
471
|
+
Lookup, listing, and grep use concise capability-oriented advertisements. The
|
|
472
|
+
`context_show_entry` advertisement retains small-first retrieval and continuation
|
|
473
|
+
only while the requested detail is missing, incomplete, or needs more context to
|
|
474
|
+
resolve ambiguity; stop once the question is answered. The skill retains bounded
|
|
475
|
+
recovery guidance, including that a partial search does not establish absence.
|
|
476
|
+
Advertisement changes do not change payload limits, defaults, or retrieval behavior,
|
|
477
|
+
and do not guarantee small total responses. No automatic decision sweep or new
|
|
478
|
+
re-orientation instruction is added.
|
|
479
|
+
|
|
480
|
+
Ordinary entry retrieval defaults to `includeRelated=false`. Related expansion
|
|
481
|
+
remains available to the subagent and direct entry tool; it is one-hop and
|
|
482
|
+
chronological: a result includes its originating assistant entry (including any
|
|
483
|
+
sibling calls), not sibling outputs; an assistant includes its matched results.
|
|
484
|
+
Relations come from raw call IDs and matching tool names, never transcript text.
|
|
485
|
+
Ambiguous duplicate IDs, orphan results, and mismatched tool names do not establish
|
|
486
|
+
relations. Sequential ID reuse is matched separately. Branch scoping and source
|
|
487
|
+
overrides apply equally to both modes.
|
|
488
|
+
|
|
489
|
+
Related expansions share the usual character/line guards. Keep `includeRelated`
|
|
490
|
+
unchanged when following an offset; changing it starts a different retrieval and
|
|
491
|
+
spends a substantive subagent search turn. An expansion of an unfinished call may
|
|
492
|
+
change if results arrive later; restart paging if its source changes.
|
|
493
|
+
|
|
220
494
|
The subagent searches in its own context and returns findings with entry
|
|
221
495
|
references. Its raw search results stay out of the main conversation. If findings
|
|
222
496
|
are incomplete, the fallback tools run the same searches directly; their results
|
|
@@ -260,7 +534,8 @@ There is no blanket edit-target reread. Before replacing an existing file with
|
|
|
260
534
|
view, and forbids reconstructing unchanged sections from memory. Small exact-match
|
|
261
535
|
edits and newly created files do not acquire a blanket reread requirement.
|
|
262
536
|
It is a saved
|
|
263
|
-
custom message tagged with the current compaction entry ID,
|
|
537
|
+
custom message tagged with the current compaction entry ID and, after standalone
|
|
538
|
+
filtering, its revision ID, not a temporary nudge:
|
|
264
539
|
subsequent responses and user turns retain it in history before the work that
|
|
265
540
|
followed it. `before_agent_start` adds it on normal starts/resume when missing;
|
|
266
541
|
`session_compact` steers it into automatic mid-run and overflow continuations.
|