@foliox/transparent-compact-pi 0.11.1 → 0.11.2
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/docs/DESIGN.md +11 -49
- package/extensions/index.ts +4 -126
- package/package.json +1 -1
- package/skills/context-retrieval/SKILL.md +2 -2
package/docs/DESIGN.md
CHANGED
|
@@ -16,7 +16,6 @@ extension builds a checkpoint without changing that boundary or calling a model:
|
|
|
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
|
-
| Read/modified file lists | Cumulative operation lists with checkpoint-relative retained-evidence annotations. |
|
|
20
19
|
|
|
21
20
|
New tool lines use `[Tools]:` with compact display signatures:
|
|
22
21
|
|
|
@@ -43,17 +42,16 @@ these are not effect analysis. Unsupported, oversized or malformed shell input
|
|
|
43
42
|
falls back to a head-only literal preview, still without execution metadata.
|
|
44
43
|
|
|
45
44
|
A shared `<locations>` dictionary near the checkpoint end resolves `@N` IDs.
|
|
46
|
-
File lists use the same IDs while retaining their operation/evidence annotations.
|
|
47
45
|
IDs are append-only and branch-local, persisted in compaction details so resume,
|
|
48
46
|
fork, filtering/restoration and repeated compaction do not renumber old references.
|
|
49
|
-
Definitions are rendered only for surviving structured tool references
|
|
50
|
-
|
|
47
|
+
Definitions are rendered only for surviving structured tool references, never
|
|
48
|
+
discovered by regex-scanning prose. Canonical metadata keeps the
|
|
51
49
|
complete registry so restoring a turn or disabling the cap restores its definitions.
|
|
52
50
|
Raw command/program payloads are not copied into display records.
|
|
53
51
|
|
|
54
52
|
The cap counts dictionary characters, including their removal when a call is
|
|
55
|
-
trimmed.
|
|
56
|
-
|
|
53
|
+
trimmed. Unused definitions are omitted after pruning, native-turn replacement
|
|
54
|
+
and capping. Skeletons are not
|
|
57
55
|
shortened into partial syntax. Literal previews can tighten to 120 then 80 encoded
|
|
58
56
|
characters before adjacent tool-only prefixes are grouped and destructive trimming
|
|
59
57
|
starts. Calls remain independently removable and ordered.
|
|
@@ -160,16 +158,16 @@ A group includes all activity until the next raw user message, even across multi
|
|
|
160
158
|
compaction spans. Confirmed exclusions are stored as the current `filteredTurnIds`
|
|
161
159
|
snapshot on the compaction entry or its standalone revision, not an append-only
|
|
162
160
|
union. Later verbatim checkpoints apply that branch-local selection to the original canonical spans before size
|
|
163
|
-
trimming, reindexing tool display records without changing stored history.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
also restores its retained-read copies and
|
|
161
|
+
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
|
|
167
165
|
files or reselecting startup evidence. There is no migration or reconstruction of
|
|
168
166
|
saved spans without turn ownership; opaque content is not individually selectable.
|
|
169
167
|
|
|
170
168
|
One `[Turn manually filtered]` marker replaces each excluded group at its original
|
|
171
169
|
position, even across spans. Markers survive the size cap. Startup-read copies owned
|
|
172
|
-
by the group are excluded;
|
|
170
|
+
by the group are excluded; location definitions used only by excluded turns are removed.
|
|
173
171
|
Filtering does not undo filesystem mutations. The checkpoint introduction and
|
|
174
172
|
persistent reorientation conditionally explain that the user excluded low-value
|
|
175
173
|
context, which remains retrievable from the full raw history. Recovery tools are
|
|
@@ -190,7 +188,7 @@ receive the revision. The checkpoint size guard applies before a revision is sav
|
|
|
190
188
|
Reload/resume and tree navigation select revisions from the raw active branch.
|
|
191
189
|
The next real verbatim compaction inherits their choices and supersedes the old
|
|
192
190
|
revision; model-summary compaction is also given the revised previous summary and
|
|
193
|
-
file
|
|
191
|
+
file-operation metadata rather than stale saved checkpoint content. Cancelling the picker or
|
|
194
192
|
size-cap decision saves no filtering revision. No-op confirmation writes nothing.
|
|
195
193
|
|
|
196
194
|
`/filter-later <message>` (alias `/fl`) submits an ordinary user message through Pi's user-message API.
|
|
@@ -306,42 +304,6 @@ a failed estimate), not on every toggle. Generation checks reject stale results,
|
|
|
306
304
|
closing/disposing the dialog invalidates pending work. No estimated sizes are
|
|
307
305
|
persisted in checkpoint metadata, and no model calls are introduced.
|
|
308
306
|
|
|
309
|
-
### File-list evidence annotations
|
|
310
|
-
|
|
311
|
-
The lists record reads and modifications in compacted history, not an exhaustive
|
|
312
|
-
inventory of current file contents. At every checkpoint, the extension checks
|
|
313
|
-
Pi's model-context projection from `firstKeptEntryId` onward. The turn prefix is
|
|
314
|
-
being compacted and is not treated as retained evidence. Context omissions and
|
|
315
|
-
replacements are respected; replacement read text has unknown completeness.
|
|
316
|
-
No filesystem reads or model calls are made for annotation.
|
|
317
|
-
|
|
318
|
-
Successful, unambiguously paired `read` results receive `(full read in tail)`,
|
|
319
|
-
`(partial read in tail)`, or `(read output in tail)` when completeness is uncertain.
|
|
320
|
-
For Pi's read contract, offset/limit alone does not imply partialness: an offset of
|
|
321
|
-
1 with a limit beyond EOF can still be complete. Truncation metadata and continuation
|
|
322
|
-
notices are checked. Separate partial pages are not combined into a full-file claim.
|
|
323
|
-
A later partial read does not hide an earlier complete snapshot with no intervening
|
|
324
|
-
tracked modification.
|
|
325
|
-
|
|
326
|
-
Successful writes with a visible full payload receive `(write content in tail)`.
|
|
327
|
-
Recorded subsequent edits/writes invalidate earlier snapshots and produce labels
|
|
328
|
-
such as `(read in tail, then edited)`. Mutation metadata can invalidate a snapshot
|
|
329
|
-
even when the mutation's message was omitted, but cannot restore omitted source
|
|
330
|
-
contents. Nested calls can invalidate snapshots, not supply visible file contents.
|
|
331
|
-
Same-path sibling operations may run concurrently, so ambiguous read/write versus
|
|
332
|
-
mutation ordering receives `(read in tail; order uncertain)` or the write equivalent
|
|
333
|
-
instead of treating result order as proof of freshness.
|
|
334
|
-
|
|
335
|
-
Modified paths without retained read/write evidence receive `(no read-tool output
|
|
336
|
-
in tail)`, unless a selected startup read is retained separately. Startup reads
|
|
337
|
-
keep their existing positive annotation. Unmodified paths without established
|
|
338
|
-
retained evidence remain unannotated; the read-list header states the default once:
|
|
339
|
-
"unless annotated, no retained read-tool output identified". A bare path does not
|
|
340
|
-
establish that document contents are still visible. The shared explanation states that labels
|
|
341
|
-
apply as of this checkpoint, not to live filesystem state; shell reads/changes and
|
|
342
|
-
external modifications are not inferred. File contents are never duplicated into
|
|
343
|
-
these lists, and annotations are recomputed rather than persisted as file metadata.
|
|
344
|
-
|
|
345
307
|
### Retained startup reads
|
|
346
308
|
|
|
347
309
|
On the first verbatim compaction, the extension scans successful text-only `read`
|
|
@@ -560,7 +522,7 @@ instructions that must be prominent at the actual point of resumption:
|
|
|
560
522
|
|
|
561
523
|
```text
|
|
562
524
|
Checkpoint introduction: what was removed + full recovery instructions
|
|
563
|
-
All compacted spans (oldest first), then retained startup reads and
|
|
525
|
+
All compacted spans (oldest first), then retained startup reads and location dictionary
|
|
564
526
|
One evidence-boundary warning + start-of-verbatim-tail marker
|
|
565
527
|
Retained verbatim tail
|
|
566
528
|
Any pending new user input
|
package/extensions/index.ts
CHANGED
|
@@ -736,16 +736,6 @@ ${r.text.join("\n")}
|
|
|
736
736
|
].join("\n\n");
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
// File annotations describe evidence, not a guarantee of filesystem freshness.
|
|
740
|
-
// Use Pi's projection for visibility, but recorded mutations can invalidate a
|
|
741
|
-
// snapshot even when the mutation's message was subsequently omitted.
|
|
742
|
-
interface FileEvidence {
|
|
743
|
-
kind: "read" | "write";
|
|
744
|
-
completeness?: "full" | "partial" | "unknown";
|
|
745
|
-
changed?: "edit" | "write";
|
|
746
|
-
orderUncertain?: boolean;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
739
|
function fileEvidenceKey(file: string, cwd: string): string {
|
|
750
740
|
// Lexical normalization only: no stat/realpath, and no symlink-equivalence claim.
|
|
751
741
|
let normalized = file.replace(/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g, " ").replace(/^@/, "");
|
|
@@ -757,87 +747,6 @@ function fileEvidenceKey(file: string, cwd: string): string {
|
|
|
757
747
|
return path.resolve(cwd, normalized);
|
|
758
748
|
}
|
|
759
749
|
|
|
760
|
-
function readCompleteness(args: Record<string, any>, message: Record<string, any>, replaced: boolean): "full" | "partial" | "unknown" {
|
|
761
|
-
const blocks = message.content;
|
|
762
|
-
if (replaced || !Array.isArray(blocks) || blocks.length !== 1 || blocks[0].type !== "text" || typeof blocks[0].text !== "string") return "unknown";
|
|
763
|
-
const text = blocks[0].text;
|
|
764
|
-
if (/^Read image file \[/.test(text)) return "unknown";
|
|
765
|
-
const truncation = message.details?.truncation;
|
|
766
|
-
if (truncation?.firstLineExceedsLimit) return "unknown"; // Only a warning, not file contents.
|
|
767
|
-
// Pi's read tool supplies these notices for both default and explicit limits.
|
|
768
|
-
if (truncation?.truncated === true || /\[(?:Showing lines [^\n]*Use offset=\d+ to continue\.|\d+ more lines in file\. Use offset=\d+ to continue\.)\]\s*$/.test(text)) return "partial";
|
|
769
|
-
const offset = args.offset ?? 1;
|
|
770
|
-
if (!Number.isInteger(offset) || offset < 1 || (args.limit != null && (!Number.isInteger(args.limit) || args.limit < 1))) return "unknown";
|
|
771
|
-
if (offset > 1) return "partial";
|
|
772
|
-
// A limit is not proof of partialness: without a continuation notice Pi reached EOF.
|
|
773
|
-
// Unknown argument schemas are not assumed to have Pi's read semantics.
|
|
774
|
-
return Object.keys(args).every((key) => ["path", "offset", "limit"].includes(key)) ? "full" : "unknown";
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
function retainedFileEvidence(entries: SessionEntry[], firstKeptEntryId: string | undefined, cwd: string): Map<string, FileEvidence> {
|
|
778
|
-
const evidence = new Map<string, FileEvidence>();
|
|
779
|
-
const cut = entries.findIndex((entry) => entry.id === firstKeptEntryId);
|
|
780
|
-
if (cut < 0) return evidence;
|
|
781
|
-
const visible = new Map(buildSessionProjection(entries).entries.map((entry) => [entry.sourceEntry.id, entry.messages]));
|
|
782
|
-
const pending = new Map<string, { name: string; args: Record<string, any>; visible: boolean; orderUncertain: boolean } | null>();
|
|
783
|
-
const changed = (name: "edit" | "write", args: Record<string, any>) => {
|
|
784
|
-
if (typeof args.path !== "string") return;
|
|
785
|
-
const previous = evidence.get(fileEvidenceKey(args.path, cwd));
|
|
786
|
-
if (previous) previous.changed = name;
|
|
787
|
-
};
|
|
788
|
-
for (const entry of entries.slice(cut)) {
|
|
789
|
-
if (entry.type !== "message") continue;
|
|
790
|
-
const raw = entry.message as unknown as Record<string, any>;
|
|
791
|
-
const projected = visible.get(entry.id)?.find((message) => message.role === raw.role) as Record<string, any> | undefined;
|
|
792
|
-
if (raw.role === "assistant") {
|
|
793
|
-
const blocks = Array.isArray(raw.content) ? raw.content : [];
|
|
794
|
-
for (const block of blocks) {
|
|
795
|
-
if (block.type !== "toolCall" || typeof block.id !== "string") continue;
|
|
796
|
-
// Sibling calls may execute concurrently; result order is not read/write order.
|
|
797
|
-
const orderUncertain = typeof block.arguments?.path === "string" && blocks.some((other: any) =>
|
|
798
|
-
other !== block && other.type === "toolCall" && ["write", "edit"].includes(other.name) &&
|
|
799
|
-
typeof other.arguments?.path === "string" &&
|
|
800
|
-
fileEvidenceKey(other.arguments.path, cwd) === fileEvidenceKey(block.arguments.path, cwd));
|
|
801
|
-
const shown = projected?.content?.filter?.((b: any) => b.type === "toolCall" && b.id === block.id);
|
|
802
|
-
const sameCall = shown?.length === 1 && shown[0].name === block.name &&
|
|
803
|
-
JSON.stringify(shown[0].arguments) === JSON.stringify(block.arguments);
|
|
804
|
-
pending.set(block.id, pending.has(block.id) ? null : { name: block.name, args: block.arguments ?? {}, visible: sameCall, orderUncertain });
|
|
805
|
-
}
|
|
806
|
-
} else if (raw.role === "toolResult") {
|
|
807
|
-
const call = pending.get(raw.toolCallId);
|
|
808
|
-
pending.delete(raw.toolCallId);
|
|
809
|
-
if (call && call.name === raw.toolName && typeof call.args.path === "string" && raw.isError === false) {
|
|
810
|
-
const key = fileEvidenceKey(call.args.path, cwd);
|
|
811
|
-
if (call.name === "write" || call.name === "edit") changed(call.name, call.args);
|
|
812
|
-
if (call.visible && projected && call.name === "read") {
|
|
813
|
-
const completeness = readCompleteness(call.args, projected, projected.content !== raw.content);
|
|
814
|
-
const previous = evidence.get(key);
|
|
815
|
-
// A later partial read does not hide an earlier complete snapshot.
|
|
816
|
-
if (!previous || previous.changed || previous.orderUncertain || (previous.kind === "read" && previous.completeness !== "full"))
|
|
817
|
-
evidence.set(key, { kind: "read", completeness, orderUncertain: call.orderUncertain });
|
|
818
|
-
} else if (call.visible && call.name === "write" && typeof call.args.content === "string") {
|
|
819
|
-
evidence.set(key, { kind: "write", orderUncertain: call.orderUncertain });
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
// Nested calls have metadata but no model-visible read outputs or write payloads.
|
|
823
|
-
for (const nested of raw.nestedCalls?.calls ?? []) {
|
|
824
|
-
if (nested.status === "ok" && (nested.name === "edit" || nested.name === "write")) changed(nested.name, nested.arguments ?? {});
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
return evidence;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
function fileEvidenceLabel(evidence: FileEvidence | undefined): string | undefined {
|
|
832
|
-
if (!evidence) return;
|
|
833
|
-
if (evidence.orderUncertain) return `${evidence.kind} in tail; order uncertain`;
|
|
834
|
-
if (evidence.changed) return `${evidence.kind} in tail, then ${evidence.changed === "edit" ? "edited" : "written"}`;
|
|
835
|
-
if (evidence.kind === "write") return "write content in tail";
|
|
836
|
-
return evidence.completeness === "unknown" ? "read output in tail" : `${evidence.completeness} read in tail`;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
const FILE_LIST_EXPLANATION = "File lists record earlier operations. Read/write annotations describe retained evidence as of this checkpoint, not live filesystem state; unannotated paths do not establish content visibility.";
|
|
840
|
-
|
|
841
750
|
const SECTION_HEADER = "### Compacted conversation (oldest first)";
|
|
842
751
|
const SPAN_CLOSE = "</compacted-span>";
|
|
843
752
|
const SPAN_TRIMMED_NOTE = "(trimmed for size — use context_lookup)";
|
|
@@ -1075,7 +984,7 @@ const CHECKPOINT_EXPLANATION = `**Compacted conversation follows.** The earlier
|
|
|
1075
984
|
|
|
1076
985
|
const RECOVERY_INSTRUCTIONS = `**Recovering hidden details.** Use \`context_lookup\` with a specific historical question: a subagent searches this conversation's full session history and returns relevant findings. Use the recovery tools for history established by this conversation or its checkpoint, not for project discovery or exploration of other sessions. If its findings are incomplete, use the bounded fallback tools \`context_list_entries\`, \`context_grep\`, and \`context_show_entry\`.`;
|
|
1077
986
|
|
|
1078
|
-
const EVIDENCE_BOUNDARY_RULE = "**Evidence boundary:** Tool stubs
|
|
987
|
+
const EVIDENCE_BOUNDARY_RULE = "**Evidence boundary:** Tool stubs omit supporting details. Most output and detailed payloads are omitted. Inline observations are historical, not verification of unshown details or current state. Use `context_lookup` for omitted observations or provenance; inspect sources for current state.";
|
|
1079
988
|
|
|
1080
989
|
const REORIENT_MESSAGE = "transparent-compact:reorient";
|
|
1081
990
|
const RECOVERY_RECAP = `**Recovery recap.** ${RECOVERY_SCOPE_RULE} For unfamiliar project details or missing requirements, inspect project files or ask the user instead. If lookup findings are incomplete, use \`context_list_entries\`, \`context_grep\`, or \`context_show_entry\`, following pagination instructions. ${RECOVERY_FILESYSTEM_RULE} Keep these evidence/recovery rules in force as work continues.`;
|
|
@@ -1167,8 +1076,6 @@ async function buildMechanicalSummary(opts: {
|
|
|
1167
1076
|
spanFrom?: string; // ISO timestamp of the first summarised message
|
|
1168
1077
|
spanTo?: string; // ISO timestamp of the last summarised message
|
|
1169
1078
|
firstKeptEntryId?: string; // start of the verbatim (uncompacted) tail
|
|
1170
|
-
readFiles: string[];
|
|
1171
|
-
modifiedFiles: string[];
|
|
1172
1079
|
startupReads: StartupReads;
|
|
1173
1080
|
cwd: string;
|
|
1174
1081
|
notify: (msg: string) => void;
|
|
@@ -1179,19 +1086,13 @@ async function buildMechanicalSummary(opts: {
|
|
|
1179
1086
|
const native = Object.keys(fidelity).length ? fidelityMessages(opts.branchEntries, fidelity, opts.firstKeptEntryId!) : new Map<string, AgentMessage[]>();
|
|
1180
1087
|
const nativeMessages = [...native.values()].flat();
|
|
1181
1088
|
const nativeChars = messageTokens(nativeMessages) * 4;
|
|
1182
|
-
const nativeResults = pairedToolResults(nativeMessages), nativeReadPaths = new Set<string>();
|
|
1183
|
-
for (const message of nativeMessages) if (message.role === "assistant") for (const block of message.content) {
|
|
1184
|
-
if (block.type === "toolCall" && block.name === "read" && typeof block.arguments?.path === "string" && nativeResults.get(block)?.isError === false)
|
|
1185
|
-
nativeReadPaths.add(fileEvidenceKey(block.arguments.path, opts.cwd));
|
|
1186
|
-
}
|
|
1187
1089
|
const rendered = fidelitySpans(filterSpans(opts.revisedAt ? spans : [...spans, {
|
|
1188
1090
|
at: opts.now, reason: opts.reason, from: opts.spanFrom, to: opts.spanTo,
|
|
1189
1091
|
lines: opts.spanLines, tools: opts.spanTools, turnIds: opts.spanTurnIds,
|
|
1190
1092
|
}], new Set(opts.filteredTurnIds)), fidelity);
|
|
1191
1093
|
const allSpans = rendered.spans;
|
|
1192
1094
|
const locations = new Locations(opts.cwd, opts.locations ?? checkpointLocations(opts.branchEntries));
|
|
1193
|
-
const
|
|
1194
|
-
const dictionary = (ids: string[]) => locations.render(new Set([...fileIds, ...ids]));
|
|
1095
|
+
const dictionary = (ids: string[]) => locations.render(new Set(ids));
|
|
1195
1096
|
const dictionaryCost = (ids: string[]) => { const text = dictionary(ids); return text ? text.length + 2 : 0; };
|
|
1196
1097
|
const allLocationIds = allSpans.flatMap((span) => span.tools?.lines.flatMap((line) => line.calls.flatMap((call) => call.locations ?? [])) ?? []);
|
|
1197
1098
|
const coversOf = (s: { from?: string; to?: string }): string | undefined => (s.from && s.to ? `${s.from} → ${s.to}` : undefined);
|
|
@@ -1225,8 +1126,6 @@ async function buildMechanicalSummary(opts: {
|
|
|
1225
1126
|
opts.notify(`transparent-compact: the base block alone is ${base.summary.length.toLocaleString()} chars (budget ${maxChars.toLocaleString()}); it is kept un-capped`);
|
|
1226
1127
|
if (maxChars !== undefined && retainedReads.length > maxChars)
|
|
1227
1128
|
opts.notify(`transparent-compact: retained startup reads alone are ${retainedReads.length.toLocaleString()} chars (budget ${maxChars.toLocaleString()}); they are kept un-capped`);
|
|
1228
|
-
if (maxChars !== undefined && dictionaryCost([]) > maxChars)
|
|
1229
|
-
opts.notify(`transparent-compact: location definitions required by file lists exceed the budget; they are kept to avoid dangling references`);
|
|
1230
1129
|
if (maxChars !== undefined && nativeChars > maxChars)
|
|
1231
1130
|
opts.notify(`transparent-compact: full-fidelity turns alone are ~${nativeChars.toLocaleString()} estimated chars (budget ${maxChars.toLocaleString()}); they are kept un-capped. Only PROSE can be trimmed.`);
|
|
1232
1131
|
const capped = capSpans(allSpans, maxChars === undefined ? undefined : Math.max(500, maxChars - overhead), dictionaryCost);
|
|
@@ -1272,29 +1171,9 @@ async function buildMechanicalSummary(opts: {
|
|
|
1272
1171
|
parts.push(SECTION_HEADER);
|
|
1273
1172
|
parts.push("");
|
|
1274
1173
|
parts.push(blocks.length > 0 ? blocks.join("\n\n") : "(no user or assistant prose in these spans — use context_lookup)");
|
|
1275
|
-
//
|
|
1276
|
-
//
|
|
1277
|
-
// checkpoint; everything after it is pi's retained verbatim tail.
|
|
1174
|
+
// Retained reads and the location dictionary describe compacted history,
|
|
1175
|
+
// above the LAST checkpoint line; everything after it is Pi's verbatim tail.
|
|
1278
1176
|
if (retainedReads) parts.push("", retainedReads);
|
|
1279
|
-
const retainedPaths = new Set(opts.startupReads.reads.map((r) => fileEvidenceKey(r.path, opts.cwd)));
|
|
1280
|
-
const hasFileLists = opts.readFiles.length > 0 || opts.modifiedFiles.length > 0;
|
|
1281
|
-
if (hasFileLists) {
|
|
1282
|
-
const evidence = retainedFileEvidence(opts.branchEntries, opts.firstKeptEntryId, opts.cwd);
|
|
1283
|
-
const knownTail = opts.branchEntries.some((entry) => entry.id === opts.firstKeptEntryId);
|
|
1284
|
-
const fileLine = (file: string, modified: boolean): string => {
|
|
1285
|
-
const key = fileEvidenceKey(file, opts.cwd);
|
|
1286
|
-
const label = fileEvidenceLabel(evidence.get(key)) ?? (retainedPaths.has(key)
|
|
1287
|
-
? "startup read output retained in checkpoint or tail; may be partial"
|
|
1288
|
-
: nativeReadPaths.has(key) ? "historical read output retained in a full-fidelity turn; re-read for current contents"
|
|
1289
|
-
: modified && knownTail ? "no read-tool output in tail" : undefined);
|
|
1290
|
-
return `${locations.ref(file, opts.cwd, 'path', true).id}${label ? ` (${label})` : ""}`;
|
|
1291
|
-
};
|
|
1292
|
-
parts.push("", FILE_LIST_EXPLANATION);
|
|
1293
|
-
if (opts.readFiles.length > 0)
|
|
1294
|
-
parts.push(`<read-files note="reads in compacted history; unless annotated, no retained read-tool output identified">\n${opts.readFiles.map((file) => fileLine(file, false)).join("\n")}\n</read-files>`);
|
|
1295
|
-
if (opts.modifiedFiles.length > 0)
|
|
1296
|
-
parts.push(`<modified-files note="modified in compacted history">\n${opts.modifiedFiles.map((file) => fileLine(file, true)).join("\n")}\n</modified-files>`);
|
|
1297
|
-
}
|
|
1298
1177
|
const locationTable = dictionary(capped.locationIds);
|
|
1299
1178
|
if (locationTable) parts.push("", locationTable);
|
|
1300
1179
|
parts.push("");
|
|
@@ -2238,7 +2117,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
2238
2117
|
const spanFrom = toIso(msgTs(allMessages[0]));
|
|
2239
2118
|
const spanTo = toIso(msgTs(allMessages[allMessages.length - 1]));
|
|
2240
2119
|
const renderer = new ToolRenderer(ctx.cwd, { entries: checkpointLocations(branchEntries) });
|
|
2241
|
-
for (const file of [...canonicalReadFiles, ...canonicalModifiedFiles]) renderer.locations.ref(file, ctx.cwd, 'path', true);
|
|
2242
2120
|
const span = await summarizeMessages(allMessages, renderer, preparedTurnOwners(branchEntries, allMessages));
|
|
2243
2121
|
const spanLines = span.lines;
|
|
2244
2122
|
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ If `context_lookup` is not in your tool list, say that subagent recovery is unav
|
|
|
37
37
|
- You are unsure where an earlier finding came from, what a command actually printed, or why you reached a conclusion.
|
|
38
38
|
- Earlier notes conflict with new evidence and you need to check the historical evidence behind them.
|
|
39
39
|
|
|
40
|
-
Tool stubs
|
|
40
|
+
Tool stubs do not preserve the full supporting material. Most output
|
|
41
41
|
and detailed payloads are omitted. Inline observations are historical, not verification
|
|
42
42
|
of unshown details or current state. Unlabelled calls do not establish exit 0 or passing tests.
|
|
43
43
|
|
|
@@ -112,7 +112,7 @@ intended context parameters.
|
|
|
112
112
|
2. Ask narrowly scoped questions using exact error strings, file paths, function names, or the command whose output you need. Recover tightly related details together; use separate queries for independent facts. Ask the subagent for evidence, not for a solution to the broader task.
|
|
113
113
|
3. Findings cite ENTRY ids and the logical transcript name. Retain these citations when relying on recovered facts. The renderer preserves full thinking, text, tool-call arguments, and tool results, although individual search results have output limits.
|
|
114
114
|
4. Distinguish **user instructions**, **observed tool output**, and **reasoning at the time**. A recovered `[thinking]` block is a historical hypothesis, not verified fact. Earlier assistant prose is not independently observed evidence either.
|
|
115
|
-
5. Historical tool output proves what was observed then, not what is true now. Review uncommitted work and re-verify current build/test state when needed. **Before using `write` to replace an existing file, re-read it unless its current contents are already visible in context. Do not reconstruct unchanged sections from memory.** This is not a blanket reread requirement for small exact-match `edit`s.
|
|
115
|
+
5. Historical tool output proves what was observed then, not what is true now. Review uncommitted work and re-verify current build/test state when needed. **Before using `write` to replace an existing file, re-read it unless its current contents are already visible in context. Do not reconstruct unchanged sections from memory.** This is not a blanket reread requirement for small exact-match `edit`s.
|
|
116
116
|
6. Lookups can return incomplete findings or fail. State what remains missing; do not invent details or treat a partial answer as exhaustive.
|
|
117
117
|
|
|
118
118
|
## Independent exports
|