@foliox/transparent-compact-pi 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.3
4
+
5
+ - Replace heuristic startup-read retention with explicit `<retain-reads>` declarations
6
+ in AGENTS/CLAUDE files: default to the first read, or use `latest:`.
7
+ - Add `/retain-reads` with OFF/FIRST/LATEST selection, first/latest read ordering,
8
+ complete previews, coverage labels and filtered-turn flags. Group consecutive
9
+ partial reads into episodes; preserve selected outputs independently of turn
10
+ filtering without duplicating recent-tail or native-turn outputs. Choices persist
11
+ in the session branch; confirmed edits can revise an existing checkpoint without
12
+ additional compaction.
13
+ - Keep retained read outputs at their original positions, or directly after their
14
+ filtered-turn marker, without a separate retained-read section. Preserve placement
15
+ through restoration and repeated compactions; keep inline outputs untrimmed.
16
+ - Document the potential next-request prompt-cache cost of manual context edits.
17
+ - Add `/export-checkpoint [path]` to export the current branch's saved checkpoint
18
+ as plain text, including confirmed manual revisions, without rebuilding it or
19
+ changing context.
20
+
21
+ ## 0.11.2
22
+
23
+ - Remove read/modified file inventories and per-file evidence annotations from
24
+ checkpoints. Keep the location dictionary as a plain ID-to-location lookup and
25
+ remove related agent-facing guidance; file operations remain in conversation context.
26
+
27
+ ## 0.11.2
28
+
29
+ - Added manual context filtering.
30
+
3
31
  ## 0.11.0
4
32
 
5
33
  - Use shared location IDs and AST-based skeletons for long bash tool calls.
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # transparent-compact
1
+ # transparent-compact-pi
2
2
 
3
- [Context compaction](#control-compaction) for [Pi](https://pi.dev/) that keeps conversation text verbatim instead of replacing it with a model-generated summary. It removes thinking and most tool output from the active context, while keeping user messages, assistant text, compact tool-call stubs and selected startup reads. The original session history remains available.
3
+ [Context compaction](#control-compaction) and pruning for [Pi](https://pi.dev/) that keeps conversation text verbatim instead of replacing it with a model-generated summary. It removes thinking and most tool output from the active context, while keeping user messages, assistant text, compact tool-call stubs and explicitly selected reads. The original session history remains available.
4
4
 
5
5
  When the agent needs a detail that is no longer in context, it can use retrieval tools to search the recorded session with a subagent. Compaction itself does not make a model call.
6
6
 
7
- The user can also [selectively manipulate which turns to hold in the current context](#filter-turns) in higher or lower fidelity.
7
+ The user can also [selectively manipulate which turns to hold in the current context](#filter-turns) in higher or lower fidelity, and [specify file reads to be retained in the context in full](#retain-reads), (e.g. a spec or plan).
8
8
 
9
9
  This extension is aimed at addressing two main issues that other compaction techniques face, which are especially exacerbated in agents running on lightweight and local LLMs:
10
10
  - Model summaries such as Pi's default method can lead to degradation and confabulation of details that can cause confident blunders.
11
- - Retrieval-based systems like `pi-vcc` can be effective when the agent knows what to look for, but omitting session structure from the retained context can make retrieval less reliable.
11
+ - Retrieval-based systems like `pi-vcc` can be effective when the agent knows what to look for, but omitting session structure from the retained context can make the actual use of retrieval less reliable.
12
12
 
13
- `transparent-compact` is also a retrieval-based system, but its design keeps manipulation of conversation text to a minimum and maximises the agent's awareness of its compacted state, with the aim of avoiding confabulation and encouraging accurate retrieval of historical details. [This study](https://arxiv.org/abs/2610.20116) found that a minimal approach outperformed more complex techniques with lightweight models and was at least as effective with frontier models.
13
+ `transparent-compact` is also a retrieval-based system, but its design keeps manipulation of conversation text to a minimum and maximises the agent's awareness of its own compacted state, with the aim of avoiding confabulation and encouraging accurate retrieval of historical details. [This study](https://arxiv.org/abs/2610.20116) found that a minimal approach outperformed more complex techniques with lightweight models and was at least as effective with frontier models.
14
14
 
15
15
  The verbatim compaction system plays particularly nicely with manual pruning of the context. This allows you to decide which parts of the session remain important to the current work, without having to commit to a particular branching point with /tree or decide at the time of the prompt with something like claude's /btw.
16
16
 
@@ -35,7 +35,7 @@ Once loaded, the extension uses verbatim compaction by default. Pi's automatic c
35
35
  /compact
36
36
  ```
37
37
 
38
- No additional setup is required. The agent can recover missing details from session history as needed. Successful startup reads referenced by filename in `AGENTS.md` or `CLAUDE.md` are also retained when detected; this is a filename-matching heuristic, so it may not capture every relevant read.
38
+ No additional setup is required. The agent can recover missing details from session history as needed.
39
39
 
40
40
  ## Filter turns
41
41
 
@@ -64,6 +64,12 @@ You can restore filtered turns later. Choices persist in the current session bra
64
64
 
65
65
  PROSE+TOOLS and FULL can use substantial context. Oversized selections are rejected, and if later context growth or a model change makes them too large, use `/filter-turns` to downgrade them. FULL includes only what was recorded; provider and model limitations can still affect thinking and images.
66
66
 
67
+ ### Manual context editing and caching
68
+ Manual context edits typically reduce prompt-cache reuse for the next model request, so frequent edits of the retained reads or turn filters are discouraged, and the best time to adjust them is just after compaction, before the next request.
69
+
70
+ The extension never automatically modifies the context outside of Pi's usual compaction trigger. The user is expected to control the filtering system, or simply ignore it when not needed.
71
+ Treat filtering/pruning/read-retention as useful tools when the situation calls for them, not necessary to the use of the compaction system.
72
+
67
73
  ### Flag an aside
68
74
 
69
75
  ```text
@@ -76,8 +82,35 @@ PROSE+TOOLS and FULL can use substantial context. Oversized selections are rejec
76
82
 
77
83
  A flagged turn remains in context until it is eligible for filtering. It is preselected for pruning in the editor, where you can keep or later restore it. Automatic application of flags is **off** by default. `/fl` is a normal conversation turn, not an isolated aside.
78
84
 
85
+ ## Retain reads
86
+
87
+ Use `/retain-reads` while the agent is idle to keep selected text-read outputs verbatim in the checkpoint. Each file can be **OFF**, **FIRST**, or **LATEST**. In the picker, controls are as in the turn-filtering picker.
88
+
89
+ Consecutive partial reads of the same file with connected ranges form one selectable read episode. Another tool operation, a restarted range, or a new user turn starts a new episode. The picker shows full or partial coverage and flags reads from filtered turns. Retention survives turn filtering;
90
+
91
+ Retained outputs are historical snapshots of the read tool output, not current file contents.
92
+
93
+ ### Automatic file retention
94
+
95
+ Nothing is retained automatically, but files can be declared for retention in `AGENTS.md` or `CLAUDE.md` like so:
96
+
97
+ ```text
98
+ <retain-reads>
99
+ docs/SPEC.md
100
+ latest: docs/WORKING-NOTES.md
101
+ </retain-reads>
102
+ ```
103
+
104
+ Use one literal path per line, relative to the instruction file. Plain paths default to FIRST; `latest:` selects the latest read. These declarations do not read files themselves. Manual choices override the defaults.
105
+
79
106
  ## Control compaction
80
107
 
108
+ ### Export the checkpoint
109
+
110
+ Use `/export-checkpoint [path]` to save the current checkpoint as plain text. Without a path, it writes `pi-checkpoint-<session-id>.txt` in the working directory; quote paths containing spaces.
111
+
112
+ This exports the saved text, including confirmed filtering and read-retention edits, without rebuilding or changing context. Recent messages and separately reinserted PROSE+TOOLS/FULL messages are not included.
113
+
81
114
  ### Choose the method
82
115
 
83
116
  ```text
@@ -105,7 +138,7 @@ If you regularly reach the cap, consider starting a new session or using a diffe
105
138
  /cap-compaction 40000c # change budget without changing mode
106
139
  ```
107
140
 
108
- Mode and budget persist in the session branch; changing one leaves the other unchanged. They apply only to verbatim compaction. The cap estimates tokens at four characters each and is not a limit on the whole model context. Some content, including retained startup reads, is not trimmed. Disabling the cap may leave too much context for the model.
141
+ Mode and budget persist in the session branch; changing one leaves the other unchanged. They apply only to verbatim compaction. The cap estimates tokens at four characters each and is not a limit on the whole model context. Some content, including retained reads, is not trimmed. Disabling the cap may leave too much context for the model.
109
142
 
110
143
  For unattended use, choose `on` to avoid interactive prompts. Without an interactive UI, `warn` emits a warning and applies the cap. If the model's context window is unavailable, use a fixed token or character budget, or turn the cap off.
111
144
 
package/docs/DESIGN.md CHANGED
@@ -12,7 +12,7 @@ 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 | Mostly removed; selected bash observations and startup reads remain. All remain in raw history. |
15
+ | Tool outputs | Mostly removed; selected bash observations and explicitly retained 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. |
@@ -111,11 +111,8 @@ unchanged; their presentation in a later checkpoint may tighten under budget pre
111
111
 
112
112
  When omitted observations, payloads, or provenance are needed, prefer
113
113
  `context_lookup` with a specific historical question. Recovery results supply
114
- ENTRY ids for targeted follow-up. For a specific missing passage at a known ENTRY
115
- id, `context_show_entry` can read that entry directly; search or interpretation
116
- remains a `context_lookup` task.
117
- The list/grep tools remain fallbacks when lookup findings are incomplete. For
118
- current state, inspect files. There is no required-document reread checklist.
114
+ ENTRY ids for targeted follow-up questions. For current state, inspect files.
115
+ There is no required-document reread checklist.
119
116
 
120
117
  All newly compacted custom messages follow the same stub policy, regardless of
121
118
  extension, display setting, or content format. Long type names are abbreviated
@@ -159,21 +156,22 @@ compaction spans. Confirmed exclusions are stored as the current `filteredTurnId
159
156
  snapshot on the compaction entry or its standalone revision, not an append-only
160
157
  union. Later verbatim checkpoints apply that branch-local selection to the original canonical spans before size
161
158
  trimming, reindexing tool display records without changing stored history.
162
- Startup-read snapshots in compaction details remain canonical and unfiltered;
163
- only the rendered checkpoint masks them. Restoring a turn therefore
164
- also restores its retained-read copies and location definitions without re-reading
165
- files or reselecting startup evidence. There is no migration or reconstruction of
166
- saved spans without turn ownership; opaque content is not individually selectable.
159
+ Read-retention choices apply independently after turn filtering; selected read
160
+ outputs survive even when their owning turn is pruned. Restoring a turn restores
161
+ its prose and location definitions without filesystem reads. There is no migration
162
+ or reconstruction of saved spans without turn ownership; opaque content is not
163
+ individually selectable.
167
164
 
168
165
  One `[Turn manually filtered]` marker replaces each excluded group at its original
169
- position, even across spans. Markers survive the size cap. Startup-read copies owned
170
- by the group are excluded; location definitions used only by excluded turns are removed.
166
+ position, even across spans. Markers survive the size cap. Explicitly retained reads
167
+ follow their turn's marker directly, in recorded order, even across spans; location
168
+ definitions used only by excluded turns are removed.
171
169
  Filtering does not undo filesystem mutations. The checkpoint introduction and
172
170
  persistent reorientation conditionally explain that the user excluded low-value
173
171
  context, which remains retrievable from the full raw history. Recovery tools are
174
172
  unchanged. Cancelling or failing a turn edit saves no revision. Mechanical compaction
175
- with existing pruning or fidelity choices cancels on build failure rather than
176
- falling through to a model summary that would lose those choices.
173
+ with existing pruning, fidelity or read-retention choices cancels on build failure
174
+ rather than falling through to a model summary that would lose those choices.
177
175
 
178
176
  Standalone updates append a non-context `transparent-compact:filter-revision`
179
177
  entry containing the source compaction ID, rendered checkpoint, exclusions and
@@ -236,10 +234,9 @@ copies prevent later transforms from mutating canonical session records. Provide
236
234
  compatibility transformations still apply, including cross-model reasoning and
237
235
  non-vision image handling; no unavailable reasoning or nested outputs are invented.
238
236
 
239
- Native turns replace their compacted prose and startup-read duplicates, not the
240
- canonical source data. File paths remain listed and successful read outputs in
241
- native turns get a conservative historical-evidence annotation. PROSE restoration
242
- can recover its canonical retained reads again. Mode choices inherit through
237
+ Native turns replace their compacted prose and retained-read duplicates, not the
238
+ canonical source data. PROSE restoration makes separately selected reads visible
239
+ at their original read positions again. Mode choices inherit through
243
240
  reload/resume, tree navigation and later verbatim compactions; explicit fidelity
244
241
  choices also override aside pre-flags. An empty revision clears old fidelity rather
245
242
  than falling back to the source checkpoint's map. Explicit summary compaction gets
@@ -304,38 +301,61 @@ a failed estimate), not on every toggle. Generation checks reject stale results,
304
301
  closing/disposing the dialog invalidates pending work. No estimated sizes are
305
302
  persisted in checkpoint metadata, and no model calls are introduced.
306
303
 
307
- ### Retained startup reads
308
-
309
- On the first verbatim compaction, the extension scans successful text-only `read`
310
- call/result pairs between the first and second user messages on the active branch.
311
- It retains outputs whose file paths or bare names occur literally in AGENTS/CLAUDE
312
- context files supplied by Pi, or in AGENTS/CLAUDE files read during that interval.
313
- `AGENTS.override.md` is recognized too. Named project-instruction blocks in the
314
- rendered system prompt provide a fallback when structured context files are not
315
- available. No files are opened and no model or agent action is involved.
316
-
317
- Matching accepts absolute paths, paths relative to the working directory or
318
- instruction file, and standalone basenames. It rejects substrings of other paths
319
- or filenames. A bare basename can select multiple same-named files. This is a
320
- lexical heuristic, not a required-reading parser: optional links can qualify;
321
- indirect references, shell reads, nested tool calls and reads after the second
322
- user message do not. Custom messages do not close the startup interval.
323
-
324
- All selected output chunks are preserved verbatim, with entry IDs, paths, offsets
325
- and limits. Pagination/truncation notices are retained too; retention never
326
- invents missing pages or claims a partial read is a complete document. Failed,
327
- ambiguous and non-text results are excluded. Selection respects explicit context
328
- omissions/replacements. It does not check on-disk freshness.
329
-
330
- The selection is stored in compaction details, separately from conversation spans.
331
- Subsequent verbatim compactions carry it forward unchanged, without re-compacting
332
- checkpoint text. If the second user message has not arrived yet, selection remains
333
- open: later compactions scan the startup interval again and add newly qualifying
334
- reads until it closes. Reads still in the uncompacted tail are not duplicated in
335
- the checkpoint; they move into its retained-read section when the cut passes them.
336
- Reload, resume and branch navigation follow the stored state on the active branch.
337
- An older checkpoint without retention metadata initializes selection from the
338
- original branch, not from its summary prose.
304
+ ### Explicit read retention
305
+
306
+ `extensions/lib/read-retention.ts` derives a file/episode catalog from Pi's
307
+ context-edited original projection of the active branch. Only unambiguous,
308
+ successful, text-only `read` pairs qualify. Failed, missing-status, orphaned,
309
+ non-text and explicitly omitted reads do not. Replacements supply their projected
310
+ bytes. Shell and nested reads have no standalone result to retain. No source
311
+ files are opened, and no model calls or additional tool operations are involved.
312
+
313
+ Defaults come only from `<retain-reads>` blocks in AGENTS/CLAUDE context files
314
+ (including `AGENTS.override.md`) or their recorded reads. Named project-instruction
315
+ blocks provide a fallback when structured context files are absent. Each line is
316
+ a literal path resolved relative to its instruction file: plain paths select FIRST,
317
+ `latest:` selects LATEST. Ordinary mentions, basenames elsewhere and globs have
318
+ no matching semantics. Current system context files override recorded copies.
319
+ There is no special first-user-turn selection window.
320
+
321
+ Consecutive successful reads of the same normalized path and user turn form an
322
+ episode when their ranges advance and connect or overlap. Assistant commentary
323
+ is allowed between pages; other tool calls, gaps, errors, restarted ranges and
324
+ new user turns break adjacency. Source call order, not tool completion order,
325
+ defines adjacency. The first/latest episode is selected per file. Requested limits
326
+ are not output coverage: Pi pagination notices and delivered text determine
327
+ coverage, and unknown truncation stays partial. Outputs remain separate verbatim
328
+ blocks, including their original pagination notices; no synthetic file is built.
329
+
330
+ `/retain-reads` uses a local draft with OFF/FIRST/LATEST, first/latest ascending
331
+ ordering, full scrollable previews, coverage/size labels and filtered-turn flags.
332
+ Enter reviews and then saves; Escape cancels. Manual overrides, including OFF,
333
+ persist branch-locally and can be reset to declarations. Before any checkpoint,
334
+ choices are custom state; afterward they share the checkpoint revision mechanism
335
+ with turn controls. Revisions preserve the existing boundary, tail and native
336
+ placements, with session/leaf checks before saving. Compaction details and revisions
337
+ store defaults and overrides, not additional copies of raw read bodies. Saving
338
+ also refreshes changed read candidates without requiring a mode toggle; no-op
339
+ checks compare generated retained copies against the previous revision's branch
340
+ inputs, never parsed checkpoint text.
341
+
342
+ Canonical spans record `readPositions`: result entry IDs and insertion boundaries
343
+ between prose/tool lines, including reads currently OFF. They contain no read bodies.
344
+ Rendering inserts selected original outputs at those positions, with structural
345
+ protection from trimming and remapped tool-record indices. There is no separate
346
+ retained-read section or introduction. Batched results keep recorded result order;
347
+ episode grouping/selection still uses call order.
348
+
349
+ Retention survives turn pruning: protected read rows from a pruned turn, including
350
+ later-span rows, move directly after its single first marker, with
351
+ `filtered-turn="true"`. Restoration returns them to their original positions.
352
+ Native expansion preserves protection on other turns' reads. An unplaceable selected
353
+ read (such as one covered only by an opaque model summary) rejects the rebuild rather
354
+ than silently dropping or moving it to an invented location. OFF does not remove
355
+ normal tool content. Tail/native outputs are not duplicated. Repeated compactions select
356
+ original projected outputs again (FIRST stays first; LATEST follows later reads),
357
+ not text parsed from earlier checkpoints. Reload, resume and tree navigation use
358
+ the active branch's choices and candidates.
339
359
 
340
360
  #### How cap trimming works
341
361
 
@@ -377,7 +397,7 @@ opaque and use the conservative omission fallback. They are not regex-parsed or
377
397
  reconstructed from current raw history, which might differ from the projected
378
398
  content originally compacted. Inherited model-summary/opaque bases remain fixed.
379
399
 
380
- Retained startup reads count as fixed budget overhead and are never trimmed.
400
+ Explicitly retained reads count once in the span budget as protected rows and are never trimmed.
381
401
  Like an inherited base, they can exceed the budget by themselves; in that case
382
402
  the extension warns and preserves them. The conversation-line budget still has
383
403
  a 500-character minimum. Space for span annotations is reserved in the size guard.
@@ -408,9 +428,9 @@ attribution.
408
428
 
409
429
  The subagent uses three internal tools: `list_entries`, `grep`, and `show_entry`.
410
430
  These search the rendered lines directly, so no temporary file, second session
411
- copy, or cleanup is needed. They share the fallback tools' paginated search
412
- functions. Individual results and the final answer have size limits. Follow
413
- pages only when omitted content is needed, not to exhaust every match or entry.
431
+ copy, or cleanup is needed. Individual results and the final answer have size
432
+ limits. Follow pages only when omitted content is needed, not to exhaust every
433
+ match or entry.
414
434
 
415
435
  The default substantive search budget is 25 turns. Valid continuation-only turns
416
436
  do not spend it; new queries, changed parameters, or replayed cursors do. A separate
@@ -419,7 +439,7 @@ ceiling caps all search-phase model calls at three times the configured turn bud
419
439
  search counts. When either budget ends searching, one final tool-free model call
420
440
  writes up partial findings; a failed write-up falls back to the latest text,
421
441
  explicitly labeled incomplete. A plain-text answer after the paging-only budget
422
- warning also carries an incomplete-findings marker and fallback guidance, without
442
+ warning also carries an incomplete-findings marker, without
423
443
  an extra write-up call. Both normal-answer and forced-write-up instructions distinguish
424
444
  unreached evidence from absence: an incomplete search does not establish that the
425
445
  answer was never recorded. Lookup requests use normal provider caching
@@ -457,14 +477,11 @@ files through filesystem tools. This restriction does not apply to user-requeste
457
477
  session audits, debugging, or cross-session analysis, which can use ordinary file
458
478
  tools. Lookup itself still cannot search other sessions or abandoned branches.
459
479
 
460
- The extension registers a subagent lookup and three bounded direct-recovery tools:
480
+ The extension registers one main-agent recovery tool:
461
481
 
462
482
  | Tool | Purpose |
463
483
  |---|---|
464
484
  | `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`. |
465
- | `context_list_entries` | Post-compaction fallback: list raw session ENTRY headers and previews. |
466
- | `context_grep` | Post-compaction fallback: regex-search raw history, including thinking and tool outputs, with entry attribution. |
467
- | `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. |
468
485
 
469
486
  For example, ask the agent to recover the build error observed before compaction.
470
487
  It can call `context_lookup` with:
@@ -475,26 +492,18 @@ It can call `context_lookup` with:
475
492
  }
476
493
  ```
477
494
 
478
- ENTRY ids returned by recovery tools can narrow subsequent `context_lookup`
479
- questions or identify a specific passage for `context_show_entry`. Prefer lookup
480
- when search or interpretation is needed.
481
- Lookup, listing, and grep use concise capability-oriented advertisements. The
482
- `context_show_entry` advertisement retains small-first retrieval and continuation
483
- only while the requested detail is missing, incomplete, or needs more context to
484
- resolve ambiguity; stop once the question is answered. The skill retains bounded
485
- recovery guidance, including that a partial search does not establish absence.
486
- Advertisement changes do not change payload limits, defaults, or retrieval behavior,
487
- and do not guarantee small total responses. No automatic decision sweep or new
488
- re-orientation instruction is added.
495
+ ENTRY ids returned by lookup can narrow subsequent `context_lookup` questions.
496
+ The skill explains recovery scope and limitations, including that a partial
497
+ search does not establish absence.
489
498
 
490
499
  Ordinary entry retrieval defaults to `includeRelated=false`. Related expansion
491
- remains available to the subagent and direct entry tool; it is one-hop and
492
- chronological: a result includes its originating assistant entry (including any
500
+ is available to the subagent; it is one-hop and chronological: a result includes
501
+ its originating assistant entry (including any
493
502
  sibling calls), not sibling outputs; an assistant includes its matched results.
494
503
  Relations come from raw call IDs and matching tool names, never transcript text.
495
504
  Ambiguous duplicate IDs, orphan results, and mismatched tool names do not establish
496
505
  relations. Sequential ID reuse is matched separately. Branch scoping and source
497
- overrides apply equally to both modes.
506
+ overrides apply to both single-entry and related-entry retrieval.
498
507
 
499
508
  Related expansions share the usual character/line guards. Keep `includeRelated`
500
509
  unchanged when following an offset; changing it starts a different retrieval and
@@ -502,17 +511,15 @@ spends a substantive subagent search turn. An expansion of an unfinished call ma
502
511
  change if results arrive later; restart paging if its source changes.
503
512
 
504
513
  The subagent searches in its own context and returns findings with entry
505
- references. Its raw search results stay out of the main conversation. If findings
506
- are incomplete, the fallback tools run the same searches directly; their results
507
- enter the main context. Turn-limit write-ups include a note recommending these
508
- tools for further detail on the same query, even if the write-up fails.
509
-
510
- By default, only one `context_lookup` attempt is allowed until a user message,
511
- a bash execution, or a tool result outside these four recovery tools resets the
512
- limit. Fallback searches, assistant text, and thinking neither increase nor reset
513
- the count. Pending lookup calls in the same batch also count, preventing parallel
514
- calls from bypassing the limit. Blocked attempts return a short fallback note
515
- without launching a subagent; later lookups after other work remain available.
514
+ references. Its raw search results stay out of the main conversation.
515
+ Budget-limited findings retain an incomplete marker even if the write-up fails.
516
+
517
+ By default, three consecutive `context_lookup` attempts are allowed until a user
518
+ message, a bash execution, or another tool's result resets the limit. Assistant
519
+ text and thinking neither increase nor reset the count. Pending lookup calls in
520
+ the same batch also count, preventing parallel calls from bypassing the limit.
521
+ Blocked attempts return a short limit notice without launching a subagent;
522
+ later lookups after other work remain available.
516
523
 
517
524
  ### Instruction envelope and persistent re-orientation
518
525
 
@@ -522,14 +529,14 @@ instructions that must be prominent at the actual point of resumption:
522
529
 
523
530
  ```text
524
531
  Checkpoint introduction: what was removed + full recovery instructions
525
- All compacted spans (oldest first), then retained startup reads and location dictionary
532
+ All compacted spans (oldest first, with retained reads in place), then location dictionary
526
533
  One evidence-boundary warning + start-of-verbatim-tail marker
527
534
  Retained verbatim tail
528
535
  Any pending new user input
529
536
  Task-relevant recovery reminders + brief recovery recap
530
537
  ```
531
538
 
532
- The recovery reminders identify retained startup reads and the uncompacted tail
539
+ The recovery reminders identify selected retained reads and the uncompacted tail
533
540
  as available evidence. They ask for recovery only when task-relevant inputs are
534
541
  missing, not for rediscovery of reading requirements or blanket document rereads.
535
542
  They also distinguish restoring inputs from repeating completed writes, call for