@foliox/transparent-compact-pi 0.8.8 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,96 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased — initial release preparation
3
+ ## 0.9.3
4
+
5
+ - Restore the `706b04b` advertisements for lookup, listing, and grep, including the
6
+ lookup question description; omit "authoritative" from grep attribution. Keep
7
+ the 0.9.2 `context_show_entry` advertisement and ref-free checkpoints unchanged.
8
+ This changes wording only; capping, retrieval behavior, the current lookup-call
9
+ limit, re-orientation, and the retrieval skill remain unchanged.
10
+ - consecutive context_lookups now default to a limit of 3 rather than 1
11
+
12
+ ## 0.9.2
13
+
14
+ - Remove inline checkpoint refs, their selection heuristics, stored locator/priority
15
+ fields, the ref-thinning cap stage, and associated prompting and replay metrics.
16
+ Keep compaction-aware, focused recovery tools and ENTRY ids returned by recovery
17
+ results for targeted follow-up. Keep output observations, head-only previews,
18
+ preview tightening, tool-only prefix folding, and destructive cap behavior.
19
+ No migration or compatibility handling for saved checkpoints is added.
20
+
21
+ ## 0.9.1
22
+
23
+ - Keep recovery tool advertisements explicitly compaction-aware while adding
24
+ question-led examples: exact earlier commands/results, provenance, conflicting
25
+ observations, and uncertainty about what was done, observed, or decided.
26
+ Distinguish locating an entry, finding a narrow passage, and reading
27
+ a specific detail at a known ENTRY id/ref. Make paging conditional on the missing
28
+ detail, including incomplete or ambiguous passages, and stop once the question
29
+ is answered; do not promote bulk expansion. Partial searches do not prove absence.
30
+ Ref locators are not verification. Retrieval code, payload limits, and defaults
31
+ are unchanged; this is a prompting experiment, not a bounded-return redesign.
32
+
33
+ - Restore the 0.8.9 lookup-first re-orientation and compaction-aware recovery
34
+ framing. Keep refs as raw-entry locators that may narrow a lookup question,
35
+ not citations or validation.
36
+ Restore explicit missing-detail cautions in the checkpoint boundary, tool
37
+ advertisements, and skill. Keep compact signatures, output observations, ref
38
+ selection, progressive capping, and paired-entry retrieval behavior unchanged.
39
+ - Return new bash previews to the first 160 encoded characters plus an omission
40
+ marker, with head-only 120/80-character cap stages. Store bounded prefixes in
41
+ version-2 tool-display records. No legacy rendering or upgrade logic is added.
42
+
43
+ ## 0.9.0
44
+
45
+ - Add progressive capping in the pure `extensions/lib/checkpoint-cap.ts` module.
46
+ Before omitting history, try 120/80-character previews, fewer lower-priority
47
+ refs, and folded adjacent tool-only prefixes, oldest first and only as needed.
48
+ Protect file paths, observed outcomes, and history-bearing refs. Preserve
49
+ independently trimmable calls after grouping. Distinguish `tools-tightened`
50
+ presentation changes from `trimmed` omissions.
51
+ - Persist versioned bounded tool-display records alongside uncapped span lines.
52
+ Later checkpoints can tighten earlier structured spans without editing stored
53
+ compactions or reinterpreting raw history. Budget increases/cap-off restore
54
+ normal rendering. Text-only legacy spans and invalid/future records remain
55
+ opaque. Retained startup reads, inherited bases, and cap-policy dialogs retain
56
+ their existing protection/behavior.
57
+
58
+ - Render compact `[Tools]:` signatures with complete file paths, requested read
59
+ ranges, payload sizes/counts, and 160-character head-and-tail bash previews.
60
+ Keep escaped newlines and shell syntax intact; omit tool-level timeout fields.
61
+ Replace new `[ok]` labels with conservative historical output observations;
62
+ retain explicit tool-error/unknown status. Recognized test/build summaries,
63
+ HTTP observations, tiny complete historical outputs, and commit hashes can
64
+ remain visible. Unlabelled calls do not imply success. Normal rendering keeps
65
+ messages separate; progressive capping may fold tool-only prefixes. No command
66
+ diffs, arbitrary output tails, or read folding.
67
+ - Add checkpoint `ref=ID` hints for write/edit payloads, truncated commands, and
68
+ likely historical observations. `context_show_entry` can open refs directly
69
+ with `includeRelated=true`, recovering matched calls and results together in
70
+ bounded pages. Ordinary single-entry retrieval stays unchanged; related-entry
71
+ indexing respects tool names, duplicate ambiguity, sequential reuse, and the
72
+ active branch. Refs do not depend on deletion inference; no ref makes no
73
+ reproducibility claim. Existing saved span lines are preserved.
74
+
75
+ - Add read-only compaction timing and headroom replays, including valid doubled
76
+ histories with remapped IDs. Record the first destructive cap at identical cut
77
+ points; keep reconstruction costs separate from timed compaction hooks. Baseline
78
+ snapshots preserve relative imports after modular source refactors. These are
79
+ local performance/evidence-retention checks, not live-model quality results.
80
+ - Known performance limitation: the final destructive fallback recounts remaining
81
+ rows after each deletion, so heavily capped histories can scale superlinearly.
82
+ Incremental size accounting is deferred; the presentation-only stages are not
83
+ subject to that repeated-recount path.
84
+
85
+ ## Earlier development notes
86
+
87
+ - Raise the default lookup budget from 10 to 25 substantive search turns (75 total
88
+ search-phase model calls, plus a final tool-free write-up). Keep the consecutive
89
+ lookup limit at 1. Mark plain-text answers after the paging-only budget warning
90
+ as potentially incomplete and include fallback guidance. Instruct the subagent
91
+ not to turn incomplete searches into claims that evidence was never recorded.
92
+ - Advertise the retrieval skill as guidance on targeting evidence, phrasing lookup
93
+ questions, and handling incomplete findings, without a mandatory preflight read.
4
94
 
5
95
  - Replace misleading file-list content-absence claims with compact retained-evidence
6
96
  labels, recomputed from Pi's projected tail at each checkpoint. Distinguish full,
@@ -93,7 +183,7 @@
93
183
  budget when they use previously issued, single-use cursors with unchanged
94
184
  effective parameters. New searches, mixed batches, invented/replayed cursors,
95
185
  and duplicate continuations still count. A separate ceiling allows at most
96
- 3× the configured budget in search-phase model calls (30 by default), plus
186
+ 3× the configured budget in search-phase model calls (75 by default), plus
97
187
  one final tool-free write-up. This is a safety guard, not a measured optimum;
98
188
  no telemetry or subagent trace is persisted.
99
189
  - Paging guidance now asks for continuation only when omitted evidence matters,
@@ -150,4 +240,5 @@
150
240
  - Preliminary synthetic pilot figures are preserved as historical results from
151
241
  the earlier file-backed implementation, not measurements of the current implementation.
152
242
 
153
- No version has been published from this staging directory. Full evaluation is pending.
243
+ Full live-model evaluation remains pending; integration tests and local replay
244
+ benchmarks are not live-model quality measurements.
package/README.md CHANGED
@@ -72,6 +72,17 @@ earlier notes and new evidence. Prefer lookup for historical observations or to
72
72
  avoid repeating costly research; inspect project files for current contents.
73
73
  Cheap local rereads and recomputations remain reasonable.
74
74
 
75
+ Tool lines use compact signatures and head-only bash previews: the first 160
76
+ encoded characters, followed by an ellipsis when truncated. Selected historical
77
+ output observations (such as failing-test counts) replace misleading `[ok]` labels;
78
+ an unlabelled call is not proof of success. Most output and detailed payloads are
79
+ omitted. When you need details hidden by compaction, ask `context_lookup` a specific
80
+ historical question. Recovery results supply ENTRY ids for targeted follow-up;
81
+ `context_show_entry` can read a specific passage at a known ENTRY id. Start small
82
+ and continue only if the detail is missing, incomplete, or needs more context to
83
+ resolve ambiguity; stop once the question is answered. Do not expand surrounding
84
+ history by default. See [the rendering contract](docs/DESIGN.md#deterministic-checkpoint).
85
+
75
86
  File lists now distinguish source output retained in the recent tail, partial
76
87
  reads, and reads followed by tracked changes. Modified paths without retained
77
88
  read/write evidence are marked `no read-tool output in tail`; these annotations
@@ -114,14 +125,19 @@ New sessions default to verbatim.
114
125
 
115
126
  ### Control the compaction cap
116
127
 
117
- Capping of the context eventually applies to strip further elements from the checkpoint.
118
- See [how cap trimming works](docs/DESIGN.md#how-cap-trimming-works) for the removal order.
128
+ When the checkpoint exceeds its budget, capping first tightens tool presentation:
129
+ 160→120→80-character previews, then grouped tool-only prefixes. Only if those stages
130
+ cannot make it fit does it remove conversation content. `tools-tightened` marks presentation changes; `trimmed` marks actual
131
+ omissions. Earlier structured spans can be tightened in the new checkpoint without
132
+ editing their stored originals; disabling the cap restores their normal rendering.
133
+ Text-only legacy spans use a conservative fallback.
134
+ See [how cap trimming works](docs/DESIGN.md#how-cap-trimming-works) for the full order.
119
135
  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
136
  If you find that in normal usage you frequently work over the compaction cap, other compaction tools are likely to be more suitable.
121
137
 
122
138
  The default is **`warn 25%`**: a conversation-and-retained-reads budget estimated at 25% of
123
139
  the current model's context window, using **4 characters per token**, not an
124
- exact tokenizer. When content would actually be trimmed, choose **Apply trimming**,
140
+ exact tokenizer. When tightening or omission would be needed, choose **Apply trimming**,
125
141
  **Disable cap for this session**, **Change budget**, or **Cancel compaction**. Disabling persists as `off`, rather than
126
142
  bypassing just once.
127
143
 
@@ -170,7 +186,7 @@ starting Pi:
170
186
  | `MECH_COMPACT_MAX_SUMMARY_CHARS` | Unset (uses percentage budget) | Initial conversation-and-retained-reads character budget override; takes precedence over the percentage setting. |
171
187
  | `MECH_COMPACT_MAX_SUMMARY_PERCENT` | `25` | Initial percentage of the model's context window, using estimated tokens. Accepts numbers greater than 0 and at most 100, including decimals; invalid values fall back to 25. |
172
188
  | `MECH_COMPACT_LOOKUP_MODEL` | Session model | Optional `provider/modelId` for lookups; must support tool calls and be available in Pi. An unresolved model falls back to the session model. |
173
- | `MECH_COMPACT_LOOKUP_TURNS` | `10` | Maximum substantive search turns. Valid continuation-only turns are exempt; total search-phase model calls are capped at 3× this budget (30 by default), plus one tool-free write-up on exhaustion. |
189
+ | `MECH_COMPACT_LOOKUP_TURNS` | `25` | Maximum substantive search turns. Valid continuation-only turns are exempt; total search-phase model calls are capped at 3× this budget (75 by default), plus one tool-free write-up on exhaustion. |
174
190
  | `MECH_COMPACT_LOOKUP_MAX_CALLS` | `1` | Maximum consecutive lookup attempts. `0` means unlimited; see [recovery reset rules](docs/DESIGN.md#recover-historical-details). Invalid values fall back to 1. |
175
191
  | `MECH_COMPACT_LOOKUP_SESSION_FILE` | Unset | Optional absolute path to a full session JSONL, replacing the current branch as the lookup source. Intended for harnesses using pruned forks. |
176
192
 
package/docs/DESIGN.md CHANGED
@@ -12,33 +12,69 @@ 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 | Removed from the checkpoint except selected startup reads; all remain in the raw session. |
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
- Checkpoints label tool outcomes as `ok`, `error`, or `unknown` and remind the
22
- agent to recover missing evidence when needed. These labels describe tool
23
- results, not a guarantee that tests passed. Output removal is explained once in
24
- the checkpoint header rather than repeated beside every outcome. There is no
25
- required-document reread checklist: retained reads remain available as evidence.
26
-
27
- File-tool signatures keep complete identifying paths, made relative to the session
28
- working directory where possible. Shell commands abbreviate that directory to
29
- `.` at path boundaries, without changing raw arguments. This is display notation,
30
- not a replayable command. Read/modified file lists use the same relative paths.
31
- Write bodies become `content=<N chars>`; edit arrays become `edits=K` (individual
32
- `oldText`/`newText` arguments become character counts). Other argument previews,
33
- including bash commands, retain a 160-character JSON-encoded prefix with a single
34
- ellipsis when abbreviated. Multi-line command prefixes are not reduced to their
35
- first line. These changes affect only checkpoint signatures, never conversation
36
- prose, retained read outputs, or raw session evidence.
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.
42
78
 
43
79
  ### File-list evidence annotations
44
80
 
@@ -111,20 +147,50 @@ original branch, not from its summary prose.
111
147
 
112
148
  #### How cap trimming works
113
149
 
114
- **User messages are prioritized**—capping is not simply an oldest-first cutoff:
115
-
116
- 1. Remove non-user content, oldest first.
117
- 2. If still over budget, shorten long user messages to marked prefix stubs,
118
- oldest first.
119
- 3. As a last resort, remove the oldest remaining content, including user messages.
150
+ The pure renderer/size guard lives in `extensions/lib/checkpoint-cap.ts`, separately
151
+ from Pi hooks, cap-policy dialogs, and session access in `extensions/index.ts`.
152
+ It accepts canonical span data and a line budget and never mutates its inputs.
153
+ **Presentation reductions precede history omission.** Each rung walks oldest first
154
+ across all eligible spans, stopping as soon as the budget fits:
155
+
156
+ 1. Shorten bash previews from 160 to 120 encoded characters.
157
+ 2. If still over budget, shorten them to 80 characters.
158
+ 3. Fold repeated `[Tools]:` prefixes across adjacent tool-only messages in the
159
+ same span. Do not cross prose, custom messages, user messages, or span boundaries.
160
+ 4. Only then remove non-user content, oldest first. Structured tool batches remain
161
+ independently trimmable by call even after prefixes have been folded.
162
+ 5. Shorten long user messages to marked prefix stubs, oldest first.
163
+ 6. As a last resort, remove the oldest remaining content, including user messages.
164
+
165
+ File paths, read ranges, tool status, and output observations are not shortened by
166
+ presentation stages. User and assistant prose remains verbatim until the destructive
167
+ fallback. `tools-tightened="true"` identifies presentation changes without omitted
168
+ prose/calls; `trimmed="true"` and a recovery note identify actual omissions or user
169
+ text shortening. Both attributes can occur on one span. Empty spans are not marked
170
+ unless they became empty through omission.
171
+
172
+ New spans store versioned, bounded display records in `details.span.tools`, alongside
173
+ their normal uncapped `lines`. Records contain signature fragments, original encoded
174
+ command prefixes, and annotations—not unbounded commands, write/edit payloads, or
175
+ full tool outputs. Smaller previews are always derived from
176
+ the same canonical prefix, never from a previous 120/80-character rendering.
177
+ Version-2 records distinguish a truncated prefix from a complete short command.
178
+ Stored compaction entries are not edited: a later checkpoint re-renders its earlier
179
+ spans for the current budget. Increasing the budget or disabling the cap restores
180
+ normal previews; reload/resume/fork follow the active branch's records.
181
+
182
+ Only records that exactly reproduce the stored canonical tool line can be tightened.
183
+ Legacy text-only spans, unsupported versions, and malformed/mismatched records stay
184
+ opaque and use the conservative omission fallback. They are not regex-parsed or
185
+ reconstructed from current raw history, which might differ from the projected
186
+ content originally compacted. Inherited model-summary/opaque bases remain fixed.
120
187
 
121
188
  Retained startup reads count as fixed budget overhead and are never trimmed.
122
189
  Like an inherited base, they can exceed the budget by themselves; in that case
123
190
  the extension warns and preserves them. The conversation-line budget still has
124
- a 500-character minimum. Every span changed by the cap carries `trimmed="true"`
125
- and a recovery note, including partial line removal and shortened user messages.
126
- An originally empty span is not marked as trimmed. Originals remain recoverable
127
- from the session.
191
+ a 500-character minimum. Space for span annotations is reserved in the size guard.
192
+ Originals remain recoverable from the session; cap settings and warn/on/off dialog
193
+ behavior are unchanged.
128
194
 
129
195
 
130
196
  ### Session-backed lookup
@@ -154,12 +220,17 @@ copy, or cleanup is needed. They share the fallback tools' paginated search
154
220
  functions. Individual results and the final answer have size limits. Follow
155
221
  pages only when omitted content is needed, not to exhaust every match or entry.
156
222
 
157
- Valid continuation-only turns do not spend the substantive search budget; new
158
- queries, changed parameters, or replayed cursors do. A separate ceiling caps all
159
- search-phase model calls at three times the configured turn budget (30 by default).
160
- When either budget ends searching, one final tool-free model call writes up
161
- partial findings; a failed write-up falls back to the latest text, explicitly
162
- labeled incomplete. Lookup requests use normal provider caching
223
+ The default substantive search budget is 25 turns. Valid continuation-only turns
224
+ do not spend it; new queries, changed parameters, or replayed cursors do. A separate
225
+ ceiling caps all search-phase model calls at three times the configured turn budget
226
+ (75 by default). A turn may batch multiple tool calls; these are not individual
227
+ search counts. When either budget ends searching, one final tool-free model call
228
+ writes up partial findings; a failed write-up falls back to the latest text,
229
+ explicitly labeled incomplete. A plain-text answer after the paging-only budget
230
+ warning also carries an incomplete-findings marker and fallback guidance, without
231
+ an extra write-up call. Both normal-answer and forced-write-up instructions distinguish
232
+ unreached evidence from absence: an incomplete search does not establish that the
233
+ answer was never recorded. Lookup requests use normal provider caching
163
234
  defaults rather than forcing caching off; actual cache behavior and savings vary
164
235
  by provider.
165
236
 
@@ -173,8 +244,10 @@ These triggers are advertised in the tool description and conditionally explaine
173
244
  in post-compaction reminders, not just in the skill body. Reminders lead with
174
245
  restoring task-relevant inputs, current-file reads, and cheap recomputation;
175
246
  compaction alone is not a lookup trigger. Advertising and re-orientation use
176
- separate wording. The skill description also names provenance and contradictions.
177
- This is guidance, not a guarantee of model compliance.
247
+ separate wording. The skill description advertises procedural guidance for targeting
248
+ earlier evidence, phrasing lookup questions, and handling incomplete findings,
249
+ without requiring a skill read before every lookup. This is guidance, not a
250
+ guarantee of model compliance.
178
251
 
179
252
  Re-read project files for their current contents. Prefer lookup for what was
180
253
  observed earlier or to avoid repeating slow external research or expensive
@@ -192,14 +265,14 @@ files through filesystem tools. This restriction does not apply to user-requeste
192
265
  session audits, debugging, or cross-session analysis, which can use ordinary file
193
266
  tools. Lookup itself still cannot search other sessions or abandoned branches.
194
267
 
195
- The extension registers a subagent lookup and three direct-search fallback tools:
268
+ The extension registers a subagent lookup and three bounded direct-recovery tools:
196
269
 
197
270
  | Tool | Purpose |
198
271
  |---|---|
199
- | `context_lookup` | Recover specific historical details from the full raw session branch. Accepts only `question`. |
200
- | `context_list_entries` | Fallback: list entry ids, roles, timestamps, and previews. |
201
- | `context_grep` | Fallback: regex-search the raw branch with surrounding lines and entry attribution. |
202
- | `context_show_entry` | Fallback: retrieve an entry by id. |
272
+ | `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`. |
273
+ | `context_list_entries` | Post-compaction fallback: list raw session ENTRY headers and previews. |
274
+ | `context_grep` | Post-compaction fallback: regex-search raw history, including thinking and tool outputs, with entry attribution. |
275
+ | `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. |
203
276
 
204
277
  For example, ask the agent to recover the build error observed before compaction.
205
278
  It can call `context_lookup` with:
@@ -210,6 +283,32 @@ It can call `context_lookup` with:
210
283
  }
211
284
  ```
212
285
 
286
+ ENTRY ids returned by recovery tools can narrow subsequent `context_lookup`
287
+ questions or identify a specific passage for `context_show_entry`. Prefer lookup
288
+ when search or interpretation is needed.
289
+ Lookup, listing, and grep use concise capability-oriented advertisements. The
290
+ `context_show_entry` advertisement retains small-first retrieval and continuation
291
+ only while the requested detail is missing, incomplete, or needs more context to
292
+ resolve ambiguity; stop once the question is answered. The skill retains bounded
293
+ recovery guidance, including that a partial search does not establish absence.
294
+ Advertisement changes do not change payload limits, defaults, or retrieval behavior,
295
+ and do not guarantee small total responses. No automatic decision sweep or new
296
+ re-orientation instruction is added.
297
+
298
+ Ordinary entry retrieval defaults to `includeRelated=false`. Related expansion
299
+ remains available to the subagent and direct entry tool; it is one-hop and
300
+ chronological: a result includes its originating assistant entry (including any
301
+ sibling calls), not sibling outputs; an assistant includes its matched results.
302
+ Relations come from raw call IDs and matching tool names, never transcript text.
303
+ Ambiguous duplicate IDs, orphan results, and mismatched tool names do not establish
304
+ relations. Sequential ID reuse is matched separately. Branch scoping and source
305
+ overrides apply equally to both modes.
306
+
307
+ Related expansions share the usual character/line guards. Keep `includeRelated`
308
+ unchanged when following an offset; changing it starts a different retrieval and
309
+ spends a substantive subagent search turn. An expansion of an unfinished call may
310
+ change if results arrive later; restart paging if its source changes.
311
+
213
312
  The subagent searches in its own context and returns findings with entry
214
313
  references. Its raw search results stay out of the main conversation. If findings
215
314
  are incomplete, the fallback tools run the same searches directly; their results