@foliox/transparent-compact-pi 0.8.8 → 0.8.9

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
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased — initial release preparation
4
4
 
5
+ - Raise the default lookup budget from 10 to 25 substantive search turns (75 total
6
+ search-phase model calls, plus a final tool-free write-up). Keep the consecutive
7
+ lookup limit at 1. Mark plain-text answers after the paging-only budget warning
8
+ as potentially incomplete and include fallback guidance. Instruct the subagent
9
+ not to turn incomplete searches into claims that evidence was never recorded.
10
+ - Advertise the retrieval skill as guidance on targeting evidence, phrasing lookup
11
+ questions, and handling incomplete findings, without a mandatory preflight read.
12
+
5
13
  - Replace misleading file-list content-absence claims with compact retained-evidence
6
14
  labels, recomputed from Pi's projected tail at each checkpoint. Distinguish full,
7
15
  partial, and uncertain reads; visible write payloads; and subsequent tracked
@@ -93,7 +101,7 @@
93
101
  budget when they use previously issued, single-use cursors with unchanged
94
102
  effective parameters. New searches, mixed batches, invented/replayed cursors,
95
103
  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
104
+ 3× the configured budget in search-phase model calls (75 by default), plus
97
105
  one final tool-free write-up. This is a safety guard, not a measured optimum;
98
106
  no telemetry or subagent trace is persisted.
99
107
  - Paging guidance now asks for continuation only when omitted evidence matters,
package/README.md CHANGED
@@ -170,7 +170,7 @@ starting Pi:
170
170
  | `MECH_COMPACT_MAX_SUMMARY_CHARS` | Unset (uses percentage budget) | Initial conversation-and-retained-reads character budget override; takes precedence over the percentage setting. |
171
171
  | `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
172
  | `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. |
173
+ | `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
174
  | `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
175
  | `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
176
 
package/docs/DESIGN.md CHANGED
@@ -154,12 +154,17 @@ copy, or cleanup is needed. They share the fallback tools' paginated search
154
154
  functions. Individual results and the final answer have size limits. Follow
155
155
  pages only when omitted content is needed, not to exhaust every match or entry.
156
156
 
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
157
+ The default substantive search budget is 25 turns. Valid continuation-only turns
158
+ do not spend it; new queries, changed parameters, or replayed cursors do. A separate
159
+ ceiling caps all search-phase model calls at three times the configured turn budget
160
+ (75 by default). A turn may batch multiple tool calls; these are not individual
161
+ search counts. When either budget ends searching, one final tool-free model call
162
+ writes up partial findings; a failed write-up falls back to the latest text,
163
+ explicitly labeled incomplete. A plain-text answer after the paging-only budget
164
+ warning also carries an incomplete-findings marker and fallback guidance, without
165
+ an extra write-up call. Both normal-answer and forced-write-up instructions distinguish
166
+ unreached evidence from absence: an incomplete search does not establish that the
167
+ answer was never recorded. Lookup requests use normal provider caching
163
168
  defaults rather than forcing caching off; actual cache behavior and savings vary
164
169
  by provider.
165
170
 
@@ -173,8 +178,10 @@ These triggers are advertised in the tool description and conditionally explaine
173
178
  in post-compaction reminders, not just in the skill body. Reminders lead with
174
179
  restoring task-relevant inputs, current-file reads, and cheap recomputation;
175
180
  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.
181
+ separate wording. The skill description advertises procedural guidance for targeting
182
+ earlier evidence, phrasing lookup questions, and handling incomplete findings,
183
+ without requiring a skill read before every lookup. This is guidance, not a
184
+ guarantee of model compliance.
178
185
 
179
186
  Re-read project files for their current contents. Prefer lookup for what was
180
187
  observed earlier or to avoid repeating slow external research or expensive
@@ -11,7 +11,7 @@
11
11
  * MECH_COMPACT_MAX_SUMMARY_CHARS initial character budget override (takes precedence over percent)
12
12
  * MECH_COMPACT_MAX_SUMMARY_PERCENT initial percentage of model context (default 25; >0, <=100)
13
13
  * MECH_COMPACT_LOOKUP_MODEL "provider/modelId" for the lookup subagent
14
- * MECH_COMPACT_LOOKUP_TURNS max substantive search turns (default 10).
14
+ * MECH_COMPACT_LOOKUP_TURNS max substantive search turns (default 25).
15
15
  * Valid continuation-only turns are exempt;
16
16
  * total search-phase calls capped at 3x this,
17
17
  * plus one final write-up on exhaustion
@@ -79,7 +79,7 @@ const cfg = {
79
79
  defaultCapBudget: (process.env.MECH_COMPACT_MAX_SUMMARY_CHARS
80
80
  ? { unit: "chars", value: intFromEnv("MECH_COMPACT_MAX_SUMMARY_CHARS", 80_000) }
81
81
  : { unit: "percent", value: percentFromEnv("MECH_COMPACT_MAX_SUMMARY_PERCENT", 25) }) as CapBudget,
82
- lookupTurns: intFromEnv("MECH_COMPACT_LOOKUP_TURNS", 10),
82
+ lookupTurns: intFromEnv("MECH_COMPACT_LOOKUP_TURNS", 25),
83
83
  lookupMaxCalls: lookupMaxCallsFromEnv(),
84
84
  lookupModel: process.env.MECH_COMPACT_LOOKUP_MODEL?.trim() || undefined,
85
85
  argSnippetChars: 160,
@@ -1240,7 +1240,8 @@ function lookupPartialFindings(text: string, marker: string): string {
1240
1240
 
1241
1241
  const LOOKUP_WRITEUP_PROMPT =
1242
1242
  "Search is finished; no further tool calls are allowed. Report what you found so far: the facts you confirmed (with ENTRY ids), " +
1243
- "what you couldn't find, and where you'd look next.";
1243
+ "what you could not locate in the material searched, and where you'd look next. " +
1244
+ "Budget exhaustion or an incomplete search does not establish absence from the transcript.";
1244
1245
 
1245
1246
  const LOOKUP_SYSTEM_PROMPT = `You are a context-lookup subagent for a coding agent whose main context was compacted by verbatim compaction. The full pre-compaction transcript — including assistant thinking blocks and complete tool outputs that were REMOVED from the main context — is in the transcript files named in the request.
1246
1247
 
@@ -1257,7 +1258,7 @@ Final answer rules (your final message is the ONLY text the main agent sees):
1257
1258
  - Return only the important findings. Do not narrate your search process.
1258
1259
  - Quote exact error messages, paths, values, and code verbatim where they matter.
1259
1260
  - Cite the ENTRY id (and file) for each finding so the main agent can verify.
1260
- - If the transcript does not contain the answer, say exactly what is missing.
1261
+ - A failed or incomplete search does not establish absence from the transcript. Distinguish "not found in the material searched" from "absent from the transcript". If the search was incomplete or budget-limited, state what you did not reach or confirm; do not claim the answer was never recorded or that the session ended before it occurred.
1261
1262
 
1262
1263
  Provenance rules — label each finding with its source type:
1263
1264
  - "user instruction" — what the user asked, pasted, or confirmed
@@ -1389,7 +1390,10 @@ async function runLookupSubagent(opts: {
1389
1390
  if (text) lastText = text;
1390
1391
 
1391
1392
  if (toolCalls.length === 0) {
1392
- return truncateHead(text || "(subagent returned no answer)", cfg.lookupAnswerMaxChars);
1393
+ const answer = text || "(subagent returned no answer)";
1394
+ return pagingOnlyNotified
1395
+ ? lookupPartialFindings(answer, `[subagent reached the ${searchLimit}; findings may be incomplete]`)
1396
+ : truncateHead(answer, cfg.lookupAnswerMaxChars);
1393
1397
  }
1394
1398
 
1395
1399
  // Check the whole batch against cursors issued BEFORE this response.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foliox/transparent-compact-pi",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "Deterministic, verbatim-preserving compaction for Pi, with session-backed subagent context recovery.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: context-retrieval
3
- description: Use context_lookup to recover earlier conversation details hidden by compaction, trace where an earlier finding came from, or investigate contradictions between earlier notes and new evidence.
3
+ description: "Guidance for using context_lookup after compaction: how to target earlier evidence, phrase effective lookup questions, and handle incomplete findings."
4
4
  ---
5
5
 
6
6
  # Session context recovery