pi-smart-compact 10.1.0 → 10.1.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/ARCHITECTURE.md +13 -10
- package/CHANGELOG.md +84 -0
- package/dist/app/steps/synthesize.d.ts.map +1 -1
- package/dist/app/steps/verify.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.js +122 -45
- package/dist/phases/synthesize.d.ts +11 -2
- package/dist/phases/synthesize.d.ts.map +1 -1
- package/dist/phases/verify.d.ts +26 -1
- package/dist/phases/verify.d.ts.map +1 -1
- package/dist/rtk.js +3 -3
- package/dist/utils/extraction.d.ts +1 -0
- package/dist/utils/extraction.d.ts.map +1 -1
- package/docs/README.md +8 -13
- package/docs/RELEASE.md +4 -3
- package/docs/configuration.md +6 -6
- package/docs/evaluation.md +14 -22
- package/docs/guide.md +1 -1
- package/package.json +1 -1
package/ARCHITECTURE.md
CHANGED
|
@@ -53,9 +53,7 @@ flowchart LR
|
|
|
53
53
|
Quality means retained constraints, trustworthy failure evidence and low
|
|
54
54
|
retrieval churn, not merely fewer tokens. There are no recurring
|
|
55
55
|
model-visible status prompts, no automatic error deletion, and no destructive
|
|
56
|
-
file rollback.
|
|
57
|
-
(repository only, historical) records the original experiments and acceptance
|
|
58
|
-
criteria.
|
|
56
|
+
file rollback.
|
|
59
57
|
|
|
60
58
|
## Design ideas
|
|
61
59
|
|
|
@@ -645,7 +643,15 @@ Repair order is intentional: (1) deterministic patch first (free, idempotent);
|
|
|
645
643
|
lower-scoring output with a deterministic quality floor built only from
|
|
646
644
|
extraction, continuity and steering; (4) reject unless final verification has
|
|
647
645
|
no gaps and meets the verified threshold. Untrusted chunk prose never feeds the
|
|
648
|
-
quality floor.
|
|
646
|
+
quality floor. The floor's Goal, Constraints, Key Decisions, Blocked and
|
|
647
|
+
Critical Context sections are rendered from the verifier's own required
|
|
648
|
+
evidence set (`collectVerificationEvidence`: live, high-confidence,
|
|
649
|
+
non-retired constraints; explicit decisions collapsed to one active answer;
|
|
650
|
+
continuity-merged errors and goal), written whole, so the floor never carries a
|
|
651
|
+
line the verifier does not require and can therefore never fail its own gate on
|
|
652
|
+
a contradiction that deterministic repair cannot fix. The contradiction scan
|
|
653
|
+
treats required error lines and the steering focus as polarity-free: an error
|
|
654
|
+
records what happened and a focus names a subject, neither is a rule. Final verification runs again after continuity injection. The
|
|
649
655
|
final scalar is reported as repaired **verification coverage**, alongside the
|
|
650
656
|
pre-repair score and fallback provenance, never as raw synthesis quality.
|
|
651
657
|
Failures keep only exhaustive content-free gap kinds and the rejecting gate
|
|
@@ -767,9 +773,7 @@ Anthropic blocks or opaque OpenAI items, so this extension does both:
|
|
|
767
773
|
on-demand compaction.
|
|
768
774
|
|
|
769
775
|
`test/native-compaction-compat.test.ts` pins what stock adapters drop by
|
|
770
|
-
themselves.
|
|
771
|
-
[2026-09-24 research report](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/reports/hindsight-native-compaction-research-2026-09-24.md)
|
|
772
|
-
(repository only, historical).
|
|
776
|
+
themselves.
|
|
773
777
|
|
|
774
778
|
### Experimental visual evidence
|
|
775
779
|
|
|
@@ -804,9 +808,8 @@ summary. Changing model/provider/API or using a text-only model withholds
|
|
|
804
808
|
images; stricter scrubbing also withholds old pixels that cannot be
|
|
805
809
|
retroactively redacted. Only the latest compaction's archive is eligible, and
|
|
806
810
|
native fallback can discard it. Metrics record only visual token estimates and
|
|
807
|
-
frame counts.
|
|
808
|
-
|
|
809
|
-
cross-model accuracy.
|
|
811
|
+
frame counts. Historical visual-pilot results are dated single-model synthetic
|
|
812
|
+
samples, not production or cross-model accuracy evidence.
|
|
810
813
|
|
|
811
814
|
## 4. Optional cross-session memory
|
|
812
815
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,90 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [10.1.2] - 2026-09-30
|
|
6
|
+
|
|
7
|
+
### Release approval
|
|
8
|
+
|
|
9
|
+
- Patch release approved by the release owner after the deterministic gates
|
|
10
|
+
on the exact candidate. No version-specific applied-canary cohort or live
|
|
11
|
+
provider run exists for `10.1.2`; the fix is evidenced by the test sweep
|
|
12
|
+
and offline replay of recorded sessions only.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **The deterministic quality floor can no longer fail its own verification
|
|
17
|
+
gate.** The floor rendered every extracted constraint, including ones the
|
|
18
|
+
user had since released (`factOverrides`), stale implicit decisions, and its
|
|
19
|
+
own `[focus]`/`[note]` steering tags, while the verifier required a
|
|
20
|
+
different set; a released prohibition beside its live replacement, an error
|
|
21
|
+
message naming the action a rule forbids ("daemon restart failed" beside "Do
|
|
22
|
+
not restart the daemon"), or a steering focus that named that action, each
|
|
23
|
+
scored as a semantic contradiction, which deterministic repair cannot fix,
|
|
24
|
+
so every candidate was rejected. The floor now renders exactly the
|
|
25
|
+
verifier's required evidence (`collectVerificationEvidence`), written
|
|
26
|
+
whole; the contradiction scan treats required error lines and the steering
|
|
27
|
+
focus as polarity-free; and the floor's goal falls back to the continuity
|
|
28
|
+
goal. Summary-authored contradictions and two live rules of opposite
|
|
29
|
+
polarity still fail. A 512-combination sweep over the evidence sources
|
|
30
|
+
(retired rule, low-confidence inverse, non-live text, continuity-only rule
|
|
31
|
+
or goal, overlapping errors, implicit inverse decision, coverage overflow,
|
|
32
|
+
over-limit texts) asserts no non-repairable gap.
|
|
33
|
+
- A user steering note longer than the constraint line limit is required,
|
|
34
|
+
rendered and repaired whole; a summary that cuts its trailing prohibition
|
|
35
|
+
is still rejected as altered evidence.
|
|
36
|
+
- Display labels `Critical:`, `Open loop:`, `Unresolved error:` and
|
|
37
|
+
`Resolved error:` (plain or bold) are stripped before semantic comparison
|
|
38
|
+
like `Constraint:`/`Goal:`/`Decision:` already were.
|
|
39
|
+
|
|
40
|
+
## [10.1.1] - 2026-09-30
|
|
41
|
+
|
|
42
|
+
### Release approval
|
|
43
|
+
|
|
44
|
+
- Patch release approved by the release owner after the deterministic gates
|
|
45
|
+
on the exact candidate. No version-specific applied-canary cohort or live
|
|
46
|
+
provider run exists for `10.1.1`; the verifier and extraction fixes are
|
|
47
|
+
evidenced by offline replay of recorded sessions only.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- Verification no longer rejects every candidate over its own required
|
|
52
|
+
evidence. Two recorded defects had the same shape: the deterministic floor
|
|
53
|
+
is built from exactly the lines the verifier demands, so a line the verifier
|
|
54
|
+
also scores as a defect leaves nothing that can pass, the session stays
|
|
55
|
+
uncompacted at 99% context, and Pi's own summarizer then hits its output
|
|
56
|
+
cap. First, the contradiction scan judged "Continue to avoid commits,
|
|
57
|
+
installation, or live daemon restart ... (`agm restart` deliberately
|
|
58
|
+
deferred)" as a positive "restart" beside "avoid live daemon restart":
|
|
59
|
+
negation near the anchor cannot see a coordinated list or a split clause.
|
|
60
|
+
Required evidence lines are now compared by sentence-level polarity, the
|
|
61
|
+
judgment the scan already applies to its source, so lines that agree are
|
|
62
|
+
not scored against each other; two required lines of opposite polarity
|
|
63
|
+
("Do not publish stable" beside "Must publish stable now") remain a gap,
|
|
64
|
+
and summary-authored contradictions are never exempt. Second, the outcome
|
|
65
|
+
claim scan read a recorded bug ("message lost with no error surfaced") as
|
|
66
|
+
a success claim, repair removed it, and the next pass reported the
|
|
67
|
+
constraint missing. Exact renderings of required evidence are no longer
|
|
68
|
+
outcome claims; prose that echoes such a phrase still needs tool evidence.
|
|
69
|
+
- Extraction ignores harness-injected `user` messages: pi-processes
|
|
70
|
+
`<process_event>` notifications, this extension's own continuity bridge
|
|
71
|
+
ledger, and agent-mesh envelopes. They were mined as the active goal, as
|
|
72
|
+
constraints (with `Constraint:` labels accumulating across generations),
|
|
73
|
+
decisions, and recent user requests. Continuity labels quoted by Pi's own
|
|
74
|
+
compaction summary are stripped before constraints are stored.
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Automatic runs are capped at 300 seconds instead of 60, and
|
|
79
|
+
`autoTriggerTimeoutMs` defaults to 300,000 ms. Recorded MiniMax M3 runs took
|
|
80
|
+
26–45 s when they finished and ~40% of automatic attempts were cut at the
|
|
81
|
+
old 60 s cap, each leaving the session for Pi's own compactor.
|
|
82
|
+
|
|
83
|
+
### Repository
|
|
84
|
+
|
|
85
|
+
- Research reports and review findings are now local, ignored artifacts rather
|
|
86
|
+
than tracked repository content. Existing files stay on disk; Git history
|
|
87
|
+
and published release tags are unchanged.
|
|
88
|
+
|
|
5
89
|
## [10.1.0] - 2026-09-29
|
|
6
90
|
|
|
7
91
|
### Release approval
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/app/steps/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA4BH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYpE,wBAAsB,qBAAqB,CAC1C,EAAE,EAAE,WAAW,GACb,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/app/steps/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA4BH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYpE,wBAAsB,qBAAqB,CAC1C,EAAE,EAAE,WAAW,GACb,OAAO,CAAC,aAAa,CAAC,CAmmBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/app/steps/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBnE,wBAAsB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/app/steps/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBnE,wBAAsB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAqN3E"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { CompressionProfile, ProfileConfig } from "./types.ts";
|
|
|
8
8
|
* `package.json#version`. Do not hand-edit this line for releases; bump
|
|
9
9
|
* package.json and run `bun run sync-version`.
|
|
10
10
|
*/
|
|
11
|
-
export declare const VERSION = "10.1.
|
|
11
|
+
export declare const VERSION = "10.1.2";
|
|
12
12
|
/**
|
|
13
13
|
* Opt-in components that are not installed with the extension: optional peer
|
|
14
14
|
* dependencies in package.json, pinned to the versions the release audit
|
|
@@ -39,7 +39,7 @@ export declare const POST_SUMMARY_RESERVE_RATIO = 0.25;
|
|
|
39
39
|
/** Maximum number of open-loop records retained in durable continuity state. */
|
|
40
40
|
export declare const MAX_STATE_OPEN_LOOPS = 25;
|
|
41
41
|
/** Auto compaction must yield to native recovery instead of blocking the host indefinitely. */
|
|
42
|
-
export declare const AUTO_TRIGGER_TIMEOUT_CAP_MS =
|
|
42
|
+
export declare const AUTO_TRIGGER_TIMEOUT_CAP_MS = 300000;
|
|
43
43
|
/** Provider-call ceiling for the synchronous session_before_compact hook. */
|
|
44
44
|
export declare const AUTO_TRIGGER_MAX_LLM_CALLS = 4;
|
|
45
45
|
/** Suppress proactive settled-trigger churn after any confirmed compaction. */
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAE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FAAsF;AACtF,eAAO,MAAM,eAAe,QACgI,CAAC;AAC7J,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,QACiH,CAAC;AAChJ,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAC9C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,4HAA4H;AAC5H,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AAOvD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAGtC,eAAO,MAAM,qBAAqB,QAAkB,CAAC;AAGrD,eAAO,MAAM,UAAU,iBAAiB,CAAC;AACzC,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,sBAAsB,QAU4T,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
|
|
7
7
|
// src/constants.ts
|
|
8
|
-
var VERSION = "10.1.
|
|
8
|
+
var VERSION = "10.1.2";
|
|
9
9
|
var OPTIONAL_COMPONENTS = {
|
|
10
10
|
mnemopi: { name: "@oh-my-pi/pi-mnemopi", version: "18.3.1", enables: "Mnemopi memory store" },
|
|
11
11
|
bun: { name: "bun", version: "1.4.2", enables: "Mnemopi worker runtime when no Bun 1.3.14+ is on PATH" },
|
|
@@ -16,7 +16,7 @@ var MIN_COMPACTION_SAVING_RATIO = 0.1;
|
|
|
16
16
|
var ESTIMATOR_ROUNDING_TOLERANCE_TOKENS = 1;
|
|
17
17
|
var POST_SUMMARY_RESERVE_RATIO = 0.25;
|
|
18
18
|
var MAX_STATE_OPEN_LOOPS = 25;
|
|
19
|
-
var AUTO_TRIGGER_TIMEOUT_CAP_MS =
|
|
19
|
+
var AUTO_TRIGGER_TIMEOUT_CAP_MS = 300000;
|
|
20
20
|
var AUTO_TRIGGER_MAX_LLM_CALLS = 4;
|
|
21
21
|
var SETTLED_TRIGGER_COOLDOWN_MS = 10 * 60000;
|
|
22
22
|
var REBUILD_MIN_TOKENS = 16384;
|
|
@@ -100,7 +100,7 @@ var DEFAULT_CONFIG = {
|
|
|
100
100
|
autoTrigger: true,
|
|
101
101
|
showStatus: true,
|
|
102
102
|
autoTriggerStrategy: "settled",
|
|
103
|
-
autoTriggerTimeoutMs:
|
|
103
|
+
autoTriggerTimeoutMs: 300000,
|
|
104
104
|
backupEnabled: true,
|
|
105
105
|
backupDir: "",
|
|
106
106
|
minContextPercent: 80,
|
|
@@ -3403,6 +3403,10 @@ function collapseDecisionsByQuestion(items) {
|
|
|
3403
3403
|
}
|
|
3404
3404
|
return order.map((key) => byQuestion.get(key));
|
|
3405
3405
|
}
|
|
3406
|
+
var HARNESS_INJECTED_RE = /^(?:<process_event\b|Native compaction continuity bridge\b|## Continuity Ledger\b|\[agent-mesh\]|(?:\*\*)?agent-mesh (?:message|reply)\b)/;
|
|
3407
|
+
function isHarnessInjectedText(text) {
|
|
3408
|
+
return HARNESS_INJECTED_RE.test(text.trim());
|
|
3409
|
+
}
|
|
3406
3410
|
function extractDecisions(msgs, _tcIdx) {
|
|
3407
3411
|
const tcIdx = _tcIdx ?? buildToolCallIndex(msgs);
|
|
3408
3412
|
const decisions = [];
|
|
@@ -3429,6 +3433,8 @@ function extractDecisions(msgs, _tcIdx) {
|
|
|
3429
3433
|
if (msgs[i]?.role !== "user")
|
|
3430
3434
|
continue;
|
|
3431
3435
|
const txt = extractText(msgs[i].content);
|
|
3436
|
+
if (isHarnessInjectedText(txt))
|
|
3437
|
+
continue;
|
|
3432
3438
|
if (CHOICE_RE.test(txt)) {
|
|
3433
3439
|
decisions.push({
|
|
3434
3440
|
index: i,
|
|
@@ -3482,6 +3488,7 @@ function isNonLiveConstraintText(text) {
|
|
|
3482
3488
|
const candidate = text.replace(/^\s*[-*]\s+/, "").trim();
|
|
3483
3489
|
return isDiagnosticConstraintText(candidate) || isCompactionStatusText(candidate) || OWN_OUTPUT_CONTEXT_RE.test(candidate) || COMPLETED_CHECKLIST_RE.test(candidate);
|
|
3484
3490
|
}
|
|
3491
|
+
var CONTINUITY_LABEL_RE = /^(?:(?:Constraint|Goal|Decision|Critical|Open loop|Unresolved error|Resolved error):\s*)+/i;
|
|
3485
3492
|
function mineConstraints(msgs) {
|
|
3486
3493
|
const constraints = [];
|
|
3487
3494
|
const seen = new Set;
|
|
@@ -3491,9 +3498,11 @@ function mineConstraints(msgs) {
|
|
|
3491
3498
|
const text = extractText(msgs[i].content);
|
|
3492
3499
|
if (text.length < 10 || text.startsWith("/"))
|
|
3493
3500
|
continue;
|
|
3501
|
+
if (isHarnessInjectedText(text))
|
|
3502
|
+
continue;
|
|
3494
3503
|
const ownOutputMessage = OWN_OUTPUT_CONTEXT_RE.test(text);
|
|
3495
3504
|
for (const raw of text.split(/\n+/)) {
|
|
3496
|
-
const candidate = raw.replace(/^\s*[-*]\s+/, "").trim();
|
|
3505
|
+
const candidate = raw.replace(/^\s*[-*]\s+/, "").trim().replace(CONTINUITY_LABEL_RE, "");
|
|
3497
3506
|
if (candidate.length < 10 || isNonLiveConstraintText(candidate))
|
|
3498
3507
|
continue;
|
|
3499
3508
|
if (ownOutputMessage && OWN_OUTPUT_PHRASE_RE.test(candidate))
|
|
@@ -3538,7 +3547,7 @@ function segmentTopicsHeuristic(msgs, pc, maxSegs = 20, _tcIdx) {
|
|
|
3538
3547
|
const nextBasename = shiftBasename(nextFile);
|
|
3539
3548
|
const closesActiveTool = message.role === "toolResult" && (tcIdx.get(message.toolCallId ?? "")?.msgIndex ?? -1) >= startIdx;
|
|
3540
3549
|
const fileShift = Boolean(lastFile && nextBasename && nextBasename !== lastFile);
|
|
3541
|
-
const userShift = message.role === "user" && SHIFT_RE.test(text);
|
|
3550
|
+
const userShift = message.role === "user" && !isHarnessInjectedText(text) && SHIFT_RE.test(text);
|
|
3542
3551
|
const sizeShift = tokenAcc > 0 && tokenAcc + messageTokens > pc.maxChunkTokens;
|
|
3543
3552
|
const breakBefore = !closesActiveTool && i > startIdx && tokenAcc >= pc.minChunkTokens && (fileShift || userShift || sizeShift) && topics.length < maxSegs - 1;
|
|
3544
3553
|
if (breakBefore) {
|
|
@@ -3600,7 +3609,7 @@ function buildTimeline(msgs, errors) {
|
|
|
3600
3609
|
const m = msgs[i];
|
|
3601
3610
|
if (m.role === "user") {
|
|
3602
3611
|
const txt = extractText(m.content);
|
|
3603
|
-
if (!txt.startsWith("/"))
|
|
3612
|
+
if (!txt.startsWith("/") && !isHarnessInjectedText(txt))
|
|
3604
3613
|
timeline.push({
|
|
3605
3614
|
index: i,
|
|
3606
3615
|
event: "user_request",
|
|
@@ -3631,7 +3640,7 @@ function extractMainGoal(msgs) {
|
|
|
3631
3640
|
if (m?.role !== "user")
|
|
3632
3641
|
continue;
|
|
3633
3642
|
const text = extractText(m.content).trim();
|
|
3634
|
-
if (!text)
|
|
3643
|
+
if (!text || isHarnessInjectedText(text))
|
|
3635
3644
|
continue;
|
|
3636
3645
|
if (HISTORY_SUMMARY_RE.test(text)) {
|
|
3637
3646
|
const carried = summaryEvidenceLine(findSection(text, "goal")?.body ?? "", TRUNC.MESSAGE);
|
|
@@ -3699,7 +3708,7 @@ function extractOpenLoops(msgs, extraction) {
|
|
|
3699
3708
|
if (msg.role !== "user")
|
|
3700
3709
|
continue;
|
|
3701
3710
|
const txt = extractText(msg.content);
|
|
3702
|
-
if (txt.length < 10 || txt.startsWith("/"))
|
|
3711
|
+
if (txt.length < 10 || txt.startsWith("/") || isHarnessInjectedText(txt))
|
|
3703
3712
|
continue;
|
|
3704
3713
|
if (FOLLOWUP_RE.test(txt)) {
|
|
3705
3714
|
const isDup = loops.some((l) => isNearbyDuplicate(l, txt, idx));
|
|
@@ -3722,7 +3731,7 @@ function extractOpenLoops(msgs, extraction) {
|
|
|
3722
3731
|
if (msg.role !== "user")
|
|
3723
3732
|
continue;
|
|
3724
3733
|
const txt = extractText(msg.content);
|
|
3725
|
-
if (txt.length < 10 || txt.startsWith("/"))
|
|
3734
|
+
if (txt.length < 10 || txt.startsWith("/") || isHarnessInjectedText(txt))
|
|
3726
3735
|
continue;
|
|
3727
3736
|
if (BLOCKED_RE.test(txt)) {
|
|
3728
3737
|
const isDup = loops.some((l) => isNearbyDuplicate(l, txt, idx));
|
|
@@ -3803,7 +3812,7 @@ function extractStructured(msgs, pc, precomputedTcIdx) {
|
|
|
3803
3812
|
};
|
|
3804
3813
|
const evidenceOverflow = Object.fromEntries(Object.entries(overflow).filter(([, count]) => count > 0));
|
|
3805
3814
|
const mainGoal = extractMainGoal(msgs);
|
|
3806
|
-
const lastUserMessages = msgs.filter((m) => m.role === "user").slice(-5).map((m) => extractText(m.content));
|
|
3815
|
+
const lastUserMessages = msgs.filter((m) => m.role === "user" && !isHarnessInjectedText(extractText(m.content))).slice(-5).map((m) => extractText(m.content));
|
|
3807
3816
|
const lastErrors = errors.slice(-3).map((e) => e.message);
|
|
3808
3817
|
return {
|
|
3809
3818
|
modifiedFiles,
|
|
@@ -6488,9 +6497,32 @@ function hasListedPath(listed, file, display, normalizedOwners) {
|
|
|
6488
6497
|
}
|
|
6489
6498
|
return false;
|
|
6490
6499
|
}
|
|
6491
|
-
|
|
6500
|
+
var EVIDENCE_LINE_LABEL_RE = /^(?:(?:constraint|goal|decision|critical|open loop|unresolved error|resolved error|\[focus\]|\[note\]):?\s*)+/i;
|
|
6501
|
+
var EVIDENCE_QUOTE_MIN_CHARS = 80;
|
|
6502
|
+
function isRequiredEvidenceLine(line, corpus) {
|
|
6503
|
+
const key = normalizeFactKey(line.replace(/\*\*/g, "").replace(EVIDENCE_LINE_LABEL_RE, ""));
|
|
6504
|
+
if (!key)
|
|
6505
|
+
return false;
|
|
6506
|
+
return corpus.some((text) => text === key || key.length >= EVIDENCE_QUOTE_MIN_CHARS && text.startsWith(key));
|
|
6507
|
+
}
|
|
6508
|
+
function requiredEvidenceCorpus(collected, continuity) {
|
|
6509
|
+
const texts = [
|
|
6510
|
+
...collected.constraints.map((item) => item.text),
|
|
6511
|
+
...collected.unresolved.map((item) => item.message),
|
|
6512
|
+
...collected.resolved.map((item) => item.message),
|
|
6513
|
+
...collected.goal ? [collected.goal] : [],
|
|
6514
|
+
...continuity?.criticalContext ?? [],
|
|
6515
|
+
...collected.decisions.flatMap((item) => {
|
|
6516
|
+
const question = summaryEvidenceLine(item.summary, TRUNC.DECISION_SUMMARY);
|
|
6517
|
+
const answer = item.answer ? summaryEvidenceLine(item.answer, TRUNC.USER_RESPONSE) : "";
|
|
6518
|
+
return answer ? [item.summary, item.answer, question + " \u2192 " + answer] : [item.summary];
|
|
6519
|
+
})
|
|
6520
|
+
];
|
|
6521
|
+
return Array.from(new Set(texts.map((text) => normalizeFactKey(text.replace(/\*\*/g, ""))).filter(Boolean)));
|
|
6522
|
+
}
|
|
6523
|
+
function outcomeClaims(summary, pathEvidence, evidenceCorpus = []) {
|
|
6492
6524
|
const pathLines = new Set(Array.from(pathEvidence, ([path, display]) => [path, display, "`" + path + "`"]).flat());
|
|
6493
|
-
return Array.from(new Set(summary.split(/\r?\n/).map((line) => line.replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "").replace(/^\[[ x]\]\s+/i, "").trim()).filter((line) => line.length > 0 && !line.startsWith("#") && !pathLines.has(line)).filter((line) => HIGH_RISK_OUTCOME_RE.test(line)).filter((line) => /\bno\s+(?:errors?|failures?)\b/i.test(line) || !NEGATED_OUTCOME_RE.test(line)))).slice(0, 12);
|
|
6525
|
+
return Array.from(new Set(summary.split(/\r?\n/).map((line) => line.replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "").replace(/^\[[ x]\]\s+/i, "").trim()).filter((line) => line.length > 0 && !line.startsWith("#") && !pathLines.has(line)).filter((line) => HIGH_RISK_OUTCOME_RE.test(line)).filter((line) => !isRequiredEvidenceLine(line, evidenceCorpus)).filter((line) => /\bno\s+(?:errors?|failures?)\b/i.test(line) || !NEGATED_OUTCOME_RE.test(line)))).slice(0, 12);
|
|
6494
6526
|
}
|
|
6495
6527
|
function classifyOutcomeClaim(claim) {
|
|
6496
6528
|
const lower = claim.toLowerCase();
|
|
@@ -6788,8 +6820,9 @@ function stemToken(token) {
|
|
|
6788
6820
|
return lower.slice(0, -1);
|
|
6789
6821
|
return lower;
|
|
6790
6822
|
}
|
|
6823
|
+
var EVIDENCE_LABEL_PREFIX_RE = /^\s*(?:(?:\*\*)?(?:Constraint|Goal|Decision|Critical|Open loop|Unresolved error|Resolved error):(?:\*\*)?\s*)+/i;
|
|
6791
6824
|
function semanticTokens(text) {
|
|
6792
|
-
const normalized = text.normalize("NFKC").replace(/[\u{2018}\u{2019}\u{02BC}`\u{00B4}]/gu, "'").replace(/\bcannot\b/gi, "can not").replace(/\b(\w+)n't\b/gi, "$1 not").replace(
|
|
6825
|
+
const normalized = text.normalize("NFKC").replace(/[\u{2018}\u{2019}\u{02BC}`\u{00B4}]/gu, "'").replace(/\bcannot\b/gi, "can not").replace(/\b(\w+)n't\b/gi, "$1 not").replace(EVIDENCE_LABEL_PREFIX_RE, "");
|
|
6793
6826
|
return (normalized.match(/[\p{L}\p{N}_-]+/gu) ?? []).map(stemToken).filter((token) => token.length > 2 || NEGATION_MARKERS.has(token));
|
|
6794
6827
|
}
|
|
6795
6828
|
var semanticShapeCache = new Map;
|
|
@@ -6861,14 +6894,15 @@ function hasSemanticEvidence(source, target) {
|
|
|
6861
6894
|
return true;
|
|
6862
6895
|
});
|
|
6863
6896
|
}
|
|
6864
|
-
function hasSemanticContradiction(source, target) {
|
|
6897
|
+
function hasSemanticContradiction(source, target, exempt) {
|
|
6865
6898
|
const sourceFragments = new Set(semanticFragments(source).map((tokens) => tokens.join(" ")));
|
|
6866
6899
|
const { sourceTokens, concepts, anchor, negative, conditional } = semanticShape(source);
|
|
6867
6900
|
if (!anchor)
|
|
6868
6901
|
return false;
|
|
6869
6902
|
const required = Math.min(concepts.length, Math.max(1, Math.ceil(concepts.length * 0.6)));
|
|
6870
6903
|
return semanticFragments(target).some((tokens) => {
|
|
6871
|
-
|
|
6904
|
+
const key = tokens.join(" ");
|
|
6905
|
+
if (!tokens.includes(anchor) || sourceFragments.has(key) || exempt?.has(key))
|
|
6872
6906
|
return false;
|
|
6873
6907
|
const overlap = concepts.filter((concept) => tokens.includes(concept)).length;
|
|
6874
6908
|
if (overlap < required)
|
|
@@ -7151,7 +7185,8 @@ function collectVerificationEvidence(extraction, continuity, evidence) {
|
|
|
7151
7185
|
const steeringConstraints = [];
|
|
7152
7186
|
if (evidence.steering?.focus?.trim()) {
|
|
7153
7187
|
steeringConstraints.push({
|
|
7154
|
-
text: "Preserve detail about: " + evidence.steering.focus
|
|
7188
|
+
text: "Preserve detail about: " + evidence.steering.focus,
|
|
7189
|
+
topic: true
|
|
7155
7190
|
});
|
|
7156
7191
|
}
|
|
7157
7192
|
if (evidence.steering?.note?.trim()) {
|
|
@@ -7250,7 +7285,48 @@ function verifyErrorEvidence(normalizedSummary, collected, accumulator) {
|
|
|
7250
7285
|
}
|
|
7251
7286
|
}
|
|
7252
7287
|
}
|
|
7253
|
-
|
|
7288
|
+
var EVIDENCE_RENDER_LIMITS = [
|
|
7289
|
+
TRUNC.CONSTRAINT_TEXT,
|
|
7290
|
+
TRUNC.MESSAGE,
|
|
7291
|
+
TRUNC.PREVIEW_MID,
|
|
7292
|
+
TRUNC.PREVIEW,
|
|
7293
|
+
TRUNC.DECISION_SUMMARY,
|
|
7294
|
+
TRUNC.USER_RESPONSE,
|
|
7295
|
+
TRUNC.DETAIL,
|
|
7296
|
+
TRUNC.TOPIC_LABEL
|
|
7297
|
+
];
|
|
7298
|
+
function requiredEvidenceKeysByPolarity(collected, continuity) {
|
|
7299
|
+
const texts = [
|
|
7300
|
+
...collected.constraints.flatMap((item) => item.topic ? [] : [item.text]),
|
|
7301
|
+
...collected.decisions.flatMap((item) => item.answer ? [item.summary, item.answer] : [item.summary]),
|
|
7302
|
+
...collected.goal ? [collected.goal] : [],
|
|
7303
|
+
...continuity?.criticalContext ?? []
|
|
7304
|
+
];
|
|
7305
|
+
const polarityFree = [
|
|
7306
|
+
...collected.constraints.flatMap((item) => item.topic ? [item.text] : []),
|
|
7307
|
+
...collected.unresolved.map((item) => item.message),
|
|
7308
|
+
...collected.resolved.map((item) => item.message)
|
|
7309
|
+
];
|
|
7310
|
+
const keys = { negative: new Set, positive: new Set };
|
|
7311
|
+
const addVariants = (text, buckets) => {
|
|
7312
|
+
const variants = [text, ...EVIDENCE_RENDER_LIMITS.map((max) => summaryEvidenceLine(text, max))];
|
|
7313
|
+
for (const variant of variants) {
|
|
7314
|
+
for (const tokens of semanticFragments(variant)) {
|
|
7315
|
+
for (const bucket of buckets)
|
|
7316
|
+
bucket.add(tokens.join(" "));
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
};
|
|
7320
|
+
for (const text of texts) {
|
|
7321
|
+
addVariants(text, [semanticShape(text).negative ? keys.negative : keys.positive]);
|
|
7322
|
+
}
|
|
7323
|
+
for (const text of polarityFree)
|
|
7324
|
+
addVariants(text, [keys.negative, keys.positive]);
|
|
7325
|
+
return keys;
|
|
7326
|
+
}
|
|
7327
|
+
function verifySemanticCoverage(parsed, collected, continuity, accumulator) {
|
|
7328
|
+
const evidenceKeys = requiredEvidenceKeysByPolarity(collected, continuity);
|
|
7329
|
+
const exemptFor = (source) => semanticShape(source).negative ? evidenceKeys.negative : evidenceKeys.positive;
|
|
7254
7330
|
const constraintTarget = [
|
|
7255
7331
|
findSection(parsed, "constraints")?.body ?? "",
|
|
7256
7332
|
findSection(parsed, "critical-context")?.body ?? ""
|
|
@@ -7260,7 +7336,7 @@ function verifySemanticCoverage(parsed, collected, accumulator) {
|
|
|
7260
7336
|
if (!hasSemanticEvidence(constraint.text, constraintTarget)) {
|
|
7261
7337
|
addGap(accumulator, { kind: "missing-constraint", text: constraint.text }, 8);
|
|
7262
7338
|
}
|
|
7263
|
-
if (hasSemanticContradiction(constraint.text, constraintTarget)) {
|
|
7339
|
+
if (hasSemanticContradiction(constraint.text, constraintTarget, exemptFor(constraint.text))) {
|
|
7264
7340
|
addGap(accumulator, {
|
|
7265
7341
|
kind: "inconsistency",
|
|
7266
7342
|
detail: "semantic-contradiction: constraint contradicts " + constraint.text.slice(0, TRUNC.SNIPPET)
|
|
@@ -7272,7 +7348,7 @@ function verifySemanticCoverage(parsed, collected, accumulator) {
|
|
|
7272
7348
|
if (!hasSemanticEvidence(collected.goal, goalTarget)) {
|
|
7273
7349
|
addGap(accumulator, { kind: "missing-goal", goal: collected.goal }, 12);
|
|
7274
7350
|
}
|
|
7275
|
-
if (hasSemanticContradiction(collected.goal, goalTarget)) {
|
|
7351
|
+
if (hasSemanticContradiction(collected.goal, goalTarget, exemptFor(collected.goal))) {
|
|
7276
7352
|
addGap(accumulator, {
|
|
7277
7353
|
kind: "inconsistency",
|
|
7278
7354
|
detail: "semantic-contradiction: goal polarity or condition changed"
|
|
@@ -7298,7 +7374,7 @@ function verifySemanticCoverage(parsed, collected, accumulator) {
|
|
|
7298
7374
|
detail: "decision-answer-conflict: summary carries a different active answer for " + decision.summary.slice(0, TRUNC.SNIPPET)
|
|
7299
7375
|
}, 20);
|
|
7300
7376
|
}
|
|
7301
|
-
if (hasSemanticContradiction(decision.summary, decisionQuestionBody)) {
|
|
7377
|
+
if (hasSemanticContradiction(decision.summary, decisionQuestionBody, exemptFor(decision.summary))) {
|
|
7302
7378
|
addGap(accumulator, {
|
|
7303
7379
|
kind: "inconsistency",
|
|
7304
7380
|
detail: "semantic-contradiction: decision contradicts " + decision.summary.slice(0, TRUNC.SNIPPET)
|
|
@@ -7389,7 +7465,8 @@ function verifyOpenLoopsAndClaims(summary, parsed, paths, extraction, continuity
|
|
|
7389
7465
|
if (!evidence.sourceMessages)
|
|
7390
7466
|
return;
|
|
7391
7467
|
const tools = successfulToolEvidence(evidence.sourceMessages);
|
|
7392
|
-
|
|
7468
|
+
const evidenceCorpus = requiredEvidenceCorpus(collected, continuity);
|
|
7469
|
+
for (const claim of outcomeClaims(summary, paths.rendered, evidenceCorpus)) {
|
|
7393
7470
|
if (!successfulToolSupportsClaim(claim, tools, extraction)) {
|
|
7394
7471
|
addGap(accumulator, { kind: "unsupported-claim", claim }, 20);
|
|
7395
7472
|
}
|
|
@@ -7402,7 +7479,7 @@ function verifySummary(summary, extraction, continuity = null, evidence = {}) {
|
|
|
7402
7479
|
verifyRequiredSections(parsed, accumulator);
|
|
7403
7480
|
const paths = verifyPathCoverage(parsed, extraction, continuity, evidence, accumulator);
|
|
7404
7481
|
verifyErrorEvidence(summary.toLowerCase().replace(/\\/g, "/").replace(/\s+/g, " "), collected, accumulator);
|
|
7405
|
-
verifySemanticCoverage(parsed, collected, accumulator);
|
|
7482
|
+
verifySemanticCoverage(parsed, collected, continuity, accumulator);
|
|
7406
7483
|
verifyFileReferences(summary, extraction, continuity, evidence, collected, paths, accumulator);
|
|
7407
7484
|
verifyProgressConsistency(parsed, extraction, collected, paths, accumulator);
|
|
7408
7485
|
verifyOpenLoopsAndClaims(summary, parsed, paths, extraction, continuity, evidence, collected, accumulator);
|
|
@@ -7498,7 +7575,7 @@ function patchDeterministic(summary, gaps, extraction, continuity = null, eviden
|
|
|
7498
7575
|
break;
|
|
7499
7576
|
}
|
|
7500
7577
|
case "missing-constraint":
|
|
7501
|
-
canonical = appendToSection(canonical, "constraints", "- " + safe(gap.text,
|
|
7578
|
+
canonical = appendToSection(canonical, "constraints", "- " + safe(gap.text, gap.text.length));
|
|
7502
7579
|
break;
|
|
7503
7580
|
case "missing-decision": {
|
|
7504
7581
|
const question = safe(gap.summary, TRUNC.DECISION_SUMMARY);
|
|
@@ -7507,7 +7584,7 @@ function patchDeterministic(summary, gaps, extraction, continuity = null, eviden
|
|
|
7507
7584
|
break;
|
|
7508
7585
|
}
|
|
7509
7586
|
case "missing-goal":
|
|
7510
|
-
canonical = upsertSection(canonical, "goal", safe(gap.goal,
|
|
7587
|
+
canonical = upsertSection(canonical, "goal", safe(gap.goal, gap.goal.length) || "Continue the current task.");
|
|
7511
7588
|
break;
|
|
7512
7589
|
case "missing-open-loops": {
|
|
7513
7590
|
const current = extraction.errors.filter((error) => !error.resolved).map((error) => safe(error.message, TRUNC.SNIPPET)).filter(Boolean).map((message) => "- [high] Resolve " + message);
|
|
@@ -11909,22 +11986,22 @@ async function assembleLLM(summaries, extraction, report, model, auth, budget, p
|
|
|
11909
11986
|
throw new Error("Assembly truncated output");
|
|
11910
11987
|
return assembled;
|
|
11911
11988
|
}
|
|
11912
|
-
function assembleFallback(summaries, extraction, steering = {}, budgetTokens = 6000, continuity = null) {
|
|
11989
|
+
function assembleFallback(summaries, extraction, steering = {}, budgetTokens = 6000, continuity = null, factOverrides = []) {
|
|
11913
11990
|
const safe = (value, max = TRUNC.PREVIEW_MID) => summaryEvidenceLine(value, max);
|
|
11991
|
+
const whole = (value) => summaryEvidenceLine(value, value.length);
|
|
11914
11992
|
const files = deterministicFileEvidence(extraction, budgetTokens, continuity);
|
|
11915
11993
|
const detModified = files.modified;
|
|
11916
11994
|
const detRead = files.read;
|
|
11917
11995
|
const detDeleted = files.deleted;
|
|
11918
|
-
const
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
const
|
|
11927
|
-
const response = item.userResponse ? safe(item.userResponse, TRUNC.USER_RESPONSE) : "";
|
|
11996
|
+
const required = collectVerificationEvidence(extraction, continuity, {
|
|
11997
|
+
steering,
|
|
11998
|
+
factOverrides
|
|
11999
|
+
});
|
|
12000
|
+
const unresolved = required.unresolved.map((error) => safe(error.message, TRUNC.PREVIEW)).filter(Boolean);
|
|
12001
|
+
const constraints = required.constraints.map((item) => "- " + whole(item.text)).filter((line) => line !== "- ");
|
|
12002
|
+
const decisions = required.decisions.map((item) => {
|
|
12003
|
+
const summary = whole(item.summary);
|
|
12004
|
+
const response = item.answer ? whole(item.answer) : "";
|
|
11928
12005
|
return summary ? "- **" + summary + "**" + (response ? " \u2192 " + response : "") : "";
|
|
11929
12006
|
}).filter(Boolean);
|
|
11930
12007
|
const inProgress = summaries.filter((item) => item.priority === "critical" || item.priority === "high").map((item) => safe(item.summary, TRUNC.PREVIEW)).filter(Boolean).map((item) => "- [ ] " + item);
|
|
@@ -11933,13 +12010,12 @@ function assembleFallback(summaries, extraction, steering = {}, budgetTokens = 6
|
|
|
11933
12010
|
}
|
|
11934
12011
|
inProgress.push(...detModified.slice(-5).map((file) => "- [ ] Continue work in " + file));
|
|
11935
12012
|
const next = safe(extraction.lastUserMessages.at(-1) ?? extraction.timeline.at(-1)?.summary ?? "", TRUNC.PREVIEW) || "Continue from the latest preserved context.";
|
|
11936
|
-
const goal =
|
|
12013
|
+
const goal = whole(required.goal ?? "") || "Continue the current task.";
|
|
11937
12014
|
const overflow = Object.entries(extraction.evidenceOverflow ?? {}).filter(([, count]) => typeof count === "number" && count > 0).map(([kind, count]) => "- Safety bound omitted " + count + " older " + kind + " item(s) from the human summary.");
|
|
11938
12015
|
const critical = [
|
|
11939
|
-
...unresolved.map((error) => "- Unresolved error: " + safe(error, TRUNC.TOPIC_LABEL)),
|
|
11940
|
-
...resolved.map((error) => "- Resolved error: " + safe(error, TRUNC.TOPIC_LABEL))
|
|
11941
|
-
|
|
11942
|
-
];
|
|
12016
|
+
...required.unresolved.map((error) => "- Unresolved error: " + safe(error.message, TRUNC.TOPIC_LABEL)),
|
|
12017
|
+
...required.resolved.map((error) => "- Resolved error: " + safe(error.message, TRUNC.TOPIC_LABEL))
|
|
12018
|
+
].filter((line) => !/: $/.test(line));
|
|
11943
12019
|
return [
|
|
11944
12020
|
"## Goal",
|
|
11945
12021
|
goal,
|
|
@@ -11974,6 +12050,7 @@ function assembleFallback(summaries, extraction, steering = {}, budgetTokens = 6
|
|
|
11974
12050
|
...critical.length ? critical : ["- None recorded."],
|
|
11975
12051
|
"",
|
|
11976
12052
|
"## Topics Covered",
|
|
12053
|
+
...overflow,
|
|
11977
12054
|
...summaries.length ? summaries.map((item) => {
|
|
11978
12055
|
const topic = safe(item.topic, TRUNC.TOPIC_LABEL) || "Segment";
|
|
11979
12056
|
return "- **" + topic + "** [" + item.priority + "]: " + safe(item.summary);
|
|
@@ -12098,7 +12175,7 @@ async function summarizeConversation(rc) {
|
|
|
12098
12175
|
phaseName: "Synthesize",
|
|
12099
12176
|
detail: "Building a deterministic continuation summary \xB7 no LLM call"
|
|
12100
12177
|
});
|
|
12101
|
-
const finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState);
|
|
12178
|
+
const finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState, rc.factOverrides);
|
|
12102
12179
|
setCachedSynthesis(cacheKey, {
|
|
12103
12180
|
finalSummary,
|
|
12104
12181
|
method: "heuristic",
|
|
@@ -12160,7 +12237,7 @@ async function summarizeConversation(rc) {
|
|
|
12160
12237
|
phaseName: "Synthesize",
|
|
12161
12238
|
detail: "Summary route unavailable \xB7 building a deterministic summary"
|
|
12162
12239
|
});
|
|
12163
|
-
finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState);
|
|
12240
|
+
finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState, rc.factOverrides);
|
|
12164
12241
|
method = "heuristic";
|
|
12165
12242
|
} else if (singleRequest) {
|
|
12166
12243
|
showProgressOverlay(rc.ctx, {
|
|
@@ -12181,7 +12258,7 @@ async function summarizeConversation(rc) {
|
|
|
12181
12258
|
generationFallbacks.push("single-pass generation failed");
|
|
12182
12259
|
recordIssue({ key: "synth.single-pass", message: "Single-pass synthesis used deterministic fallback (" + errorDetail(err) + ").", error: err });
|
|
12183
12260
|
rc.notify("Single-pass generation stopped \xB7 using deterministic fallback [" + formatGenerationFailureForUi(err) + "]", "info");
|
|
12184
|
-
finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState);
|
|
12261
|
+
finalSummary = assembleFallback([], extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState, rc.factOverrides);
|
|
12185
12262
|
method = "heuristic";
|
|
12186
12263
|
}
|
|
12187
12264
|
} else {
|
|
@@ -12388,7 +12465,7 @@ async function summarizeConversation(rc) {
|
|
|
12388
12465
|
recordIssue({ key: "synth.assembly", message: "Assembly used deterministic fallback (" + errorDetail(err) + ").", error: err });
|
|
12389
12466
|
rc.notify("Assembly stopped \xB7 using deterministic fallback [" + formatGenerationFailureForUi(err) + "]", "info");
|
|
12390
12467
|
method = "heuristic";
|
|
12391
|
-
finalSummary = assembleFallback(summaries, extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState);
|
|
12468
|
+
finalSummary = assembleFallback(summaries, extraction, { focus: rc.focus, note: rc.userNote }, pc.summaryBudgetTokens, rc.previousState, rc.factOverrides);
|
|
12392
12469
|
}
|
|
12393
12470
|
}
|
|
12394
12471
|
rc.cancellation.signal.throwIfAborted();
|
|
@@ -12494,7 +12571,7 @@ async function verifyAndPatch(rc) {
|
|
|
12494
12571
|
detail: "Trying the deterministic safety summary",
|
|
12495
12572
|
explorationRounds: rc.explorationRounds
|
|
12496
12573
|
});
|
|
12497
|
-
let deterministic = assembleFallback([], extraction, evidence.steering, summaryBudgetTokens, rc.previousState);
|
|
12574
|
+
let deterministic = assembleFallback([], extraction, evidence.steering, summaryBudgetTokens, rc.previousState, rc.factOverrides);
|
|
12498
12575
|
let deterministicVerification = verifySummary(deterministic, extraction, rc.previousState, evidence);
|
|
12499
12576
|
const repaired = repairSummaryDeterministically(deterministic, deterministicVerification, extraction, rc.previousState, evidence);
|
|
12500
12577
|
deterministic = repaired.summary;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Phase 3: Hierarchical Synthesis.
|
|
3
3
|
*/
|
|
4
4
|
import type { Model, Api, Context, ProviderHeaders } from "@earendil-works/pi-ai";
|
|
5
|
-
import type { LlmMessage, LlmChunk, ChunkSummary, StructuredExtraction, ExplorationReport, ProfileConfig, CompactionState } from "../types.ts";
|
|
5
|
+
import type { LlmMessage, LlmChunk, ChunkSummary, StructuredExtraction, ExplorationReport, ProfileConfig, CompactionState, ContinuityOverride } from "../types.ts";
|
|
6
6
|
import { type TokenEstimator } from "../utils/tokens.ts";
|
|
7
7
|
import { type SmartCompactServices } from "../infra/services.ts";
|
|
8
8
|
/** A provider response completed, but did not satisfy the batch-output contract. */
|
|
@@ -41,10 +41,19 @@ export declare function assembleLLM(summaries: ChunkSummary[], extraction: Struc
|
|
|
41
41
|
apiKey: string;
|
|
42
42
|
headers?: ProviderHeaders;
|
|
43
43
|
}, budget: number, prevContext: string, signal?: AbortSignal, services?: SmartCompactServices, focus?: string, continuity?: CompactionState | null): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Deterministic quality floor. Its Goal, Constraints, Key Decisions, Blocked
|
|
46
|
+
* and Critical Context sections render exactly the evidence the verifier
|
|
47
|
+
* requires ({@link collectVerificationEvidence}: live, high-confidence,
|
|
48
|
+
* non-retired constraints; explicit decisions collapsed to one active answer;
|
|
49
|
+
* continuity-merged errors and goal). A line the verifier does not require
|
|
50
|
+
* is a line it may score as a contradiction, which is not deterministically
|
|
51
|
+
* repairable; the floor therefore adds nothing of its own to those sections.
|
|
52
|
+
*/
|
|
44
53
|
export declare function assembleFallback(summaries: ChunkSummary[], extraction: StructuredExtraction, steering?: {
|
|
45
54
|
focus?: string;
|
|
46
55
|
note?: string;
|
|
47
|
-
}, budgetTokens?: number, continuity?: CompactionState | null): string;
|
|
56
|
+
}, budgetTokens?: number, continuity?: CompactionState | null, factOverrides?: readonly ContinuityOverride[]): string;
|
|
48
57
|
/**
|
|
49
58
|
* Build a placeholder {@link ChunkSummary} when a batch's LLM call failed, so the
|
|
50
59
|
* assembly step still has something deterministic to merge rather than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/phases/synthesize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,KAAK,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,MAAM,aAAa,CAAC;AAYrB,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,oBAAoB,CAAC;AAY5B,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AA0BrF,oFAAoF;AACpF,qBAAa,uBAAwB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,6BAA6B;IAE1C,YAAY,MAAM,EAAE,MAAM,EAEzB;CACD;AAoRD,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,UAAU,EAAE,EAClB,UAAU,EAAE,OAAO,aAAa,EAAE,aAAa,EAAE,EACjD,EAAE,EAAE,aAAa,EACjB,SAAS,GAAE,cAAqC,EAChD,KAAK,CAAC,EAAE,MAAM,GACZ,QAAQ,EAAE,CAwGZ;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,oBAAoB;;;;;IAOxE;AAED,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,qFAAqF;AACrF,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,iBAAiB,GAA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,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACnD,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,eAAe,CAAC,EAAE,MAAM,EACxB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC,CAsIzB;AA6BD,wBAAsB,WAAW,CAChC,SAAS,EAAE,YAAY,EAAE,EACzB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACnD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,GAAE,eAAe,GAAG,IAAW,GACvC,OAAO,CAAC,MAAM,CAAC,CAwDjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,YAAY,EAAE,EACzB,UAAU,EAAE,oBAAoB,EAChC,QAAQ,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,EAChD,YAAY,GAAE,MAAc,EAC5B,UAAU,GAAE,eAAe,GAAG,IAAW,EACzC,aAAa,GAAE,SAAS,kBAAkB,EAAO,GAC/C,MAAM,CAqIR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,YAAY,CAiB7D"}
|
package/dist/phases/verify.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class VerificationGateError extends Error {
|
|
|
28
28
|
readonly gapCount: number;
|
|
29
29
|
constructor(result: VerificationResult, initialScore: number, stage: VerificationGateStage);
|
|
30
30
|
}
|
|
31
|
-
export declare function hasSemanticContradiction(source: string, target: string): boolean;
|
|
31
|
+
export declare function hasSemanticContradiction(source: string, target: string, exempt?: ReadonlySet<string>): boolean;
|
|
32
32
|
/**
|
|
33
33
|
* True when `release` (a later user message) frees `constraint`.
|
|
34
34
|
*
|
|
@@ -48,6 +48,31 @@ export declare function repairSummaryDeterministically(summary: string, result:
|
|
|
48
48
|
result: VerificationResult;
|
|
49
49
|
patched: VerificationGap[];
|
|
50
50
|
};
|
|
51
|
+
export interface CollectedVerificationEvidence {
|
|
52
|
+
unresolved: Array<{
|
|
53
|
+
message: string;
|
|
54
|
+
}>;
|
|
55
|
+
resolved: Array<{
|
|
56
|
+
message: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** `topic` marks the steering focus: a subject pointer, not a rule with polarity. */
|
|
59
|
+
constraints: Array<{
|
|
60
|
+
text: string;
|
|
61
|
+
topic?: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
decisions: Array<{
|
|
64
|
+
summary: string;
|
|
65
|
+
answer: string | null;
|
|
66
|
+
}>;
|
|
67
|
+
goal: string | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The evidence the verifier requires a summary to carry. Exported so the
|
|
71
|
+
* deterministic floor renders exactly this set: any line the floor adds that
|
|
72
|
+
* the verifier does not require is a line the verifier may score as a defect,
|
|
73
|
+
* and a floor that fails its own gate leaves a session uncompactable.
|
|
74
|
+
*/
|
|
75
|
+
export declare function collectVerificationEvidence(extraction: StructuredExtraction, continuity: CompactionState | null, evidence: VerificationEvidence): CollectedVerificationEvidence;
|
|
51
76
|
export declare function verifySummary(summary: string, extraction: StructuredExtraction, continuity?: CompactionState | null, evidence?: VerificationEvidence): VerificationResult;
|
|
52
77
|
/** Apply every safe, deterministic repair. Hallucination/inconsistency gaps stay visible for LLM/user review. */
|
|
53
78
|
export declare function patchDeterministic(summary: string, gaps: VerificationGap[], extraction: StructuredExtraction, continuity?: CompactionState | null, evidence?: VerificationEvidence): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/phases/verify.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,KAAK,EACL,GAAG,EACH,OAAO,EACP,eAAe,EAEf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACX,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,MAAM,aAAa,CAAC;AAsCrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,MAAM,WAAW,oBAAoB;IACpC,cAAc,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,aAAa,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC9C;
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/phases/verify.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,KAAK,EACL,GAAG,EACH,OAAO,EACP,eAAe,EAEf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACX,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,MAAM,aAAa,CAAC;AAsCrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,MAAM,WAAW,oBAAoB;IACpC,cAAc,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE;QAAE,K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AAUD,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GACzD;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAczC;AAED,wBAAsB,YAAY,CACjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAC3D,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,WAAW,EACzE,QAAQ,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
package/dist/rtk.js
CHANGED
|
@@ -198,7 +198,7 @@ class SecretScrubber {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
// src/constants.ts
|
|
201
|
-
var VERSION = "10.1.
|
|
201
|
+
var VERSION = "10.1.2";
|
|
202
202
|
var OPTIONAL_COMPONENTS = {
|
|
203
203
|
mnemopi: { name: "@oh-my-pi/pi-mnemopi", version: "18.3.1", enables: "Mnemopi memory store" },
|
|
204
204
|
bun: { name: "bun", version: "1.4.2", enables: "Mnemopi worker runtime when no Bun 1.3.14+ is on PATH" },
|
|
@@ -209,7 +209,7 @@ var MIN_COMPACTION_SAVING_RATIO = 0.1;
|
|
|
209
209
|
var ESTIMATOR_ROUNDING_TOLERANCE_TOKENS = 1;
|
|
210
210
|
var POST_SUMMARY_RESERVE_RATIO = 0.25;
|
|
211
211
|
var MAX_STATE_OPEN_LOOPS = 25;
|
|
212
|
-
var AUTO_TRIGGER_TIMEOUT_CAP_MS =
|
|
212
|
+
var AUTO_TRIGGER_TIMEOUT_CAP_MS = 300000;
|
|
213
213
|
var AUTO_TRIGGER_MAX_LLM_CALLS = 4;
|
|
214
214
|
var SETTLED_TRIGGER_COOLDOWN_MS = 10 * 60000;
|
|
215
215
|
var REBUILD_MIN_TOKENS = 16384;
|
|
@@ -293,7 +293,7 @@ var DEFAULT_CONFIG = {
|
|
|
293
293
|
autoTrigger: true,
|
|
294
294
|
showStatus: true,
|
|
295
295
|
autoTriggerStrategy: "settled",
|
|
296
|
-
autoTriggerTimeoutMs:
|
|
296
|
+
autoTriggerTimeoutMs: 300000,
|
|
297
297
|
backupEnabled: true,
|
|
298
298
|
backupDir: "",
|
|
299
299
|
minContextPercent: 80,
|
|
@@ -73,6 +73,7 @@ export declare function collapseDecisionsByQuestion<T extends {
|
|
|
73
73
|
summary: string;
|
|
74
74
|
userResponse?: string;
|
|
75
75
|
}>(items: readonly T[]): T[];
|
|
76
|
+
export declare function isHarnessInjectedText(text: string): boolean;
|
|
76
77
|
export declare function extractDecisions(msgs: LlmMessage[], _tcIdx?: ToolCallIndex): StructuredExtraction["decisions"];
|
|
77
78
|
export declare function isDiagnosticConstraintText(text: string): boolean;
|
|
78
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../src/utils/extraction.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,eAAe,EAChB,MAAM,aAAa,CAAC;AA2BrB,iFAAiF;AACjF,eAAO,MAAM,WAAW,QAAW,CAAC;AAMpC,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B,MAAM,EACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CACvE,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,E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9B,IAAI,EAAE,UAAU,EAAE,EAClB,MAAM,CAAC,EAAE,aAAa,GACrB,oBAAoB,CAAC,WAAW,CAAC,CA6CnC;AA2CD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKhE;AAiBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ7D;AAMD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAAE,GACjB,oBAAoB,CAAC,aAAa,CAAC,CAyCrC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,UAAU,EAAE,EAClB,EAAE,EAAE,aAAa,EACjB,OAAO,SAAK,EACZ,MAAM,CAAC,EAAE,aAAa,GACrB,oBAAoB,CAAC,QAAQ,CAAC,CAgHhC;AA+CD,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO5D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,IAAI,CAoBjE;AA4BD,kEAAkE;AAClE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAAE,EAClB,UAAU,EAAE,oBAAoB,GAC/B,QAAQ,EAAE,CAmJZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAAE,EAClB,EAAE,EAAE,aAAa,EACjB,gBAAgB,CAAC,EAAE,aAAa,GAC/B,oBAAoB,CA0EtB"}
|
package/docs/README.md
CHANGED
|
@@ -46,23 +46,18 @@ state lives and how long it is retained.
|
|
|
46
46
|
|
|
47
47
|
## Historical evidence
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Research reports and review findings are local, ignored artifacts under
|
|
50
|
+
`docs/reports/` and `docs/findings/`, not tracked repository or npm content.
|
|
51
|
+
Their dated measurements and revision limits are not current setup instructions
|
|
52
|
+
or product guarantees. Earlier copies can still exist in Git history; removing
|
|
53
|
+
tracking does not erase them. See the
|
|
54
|
+
[evaluation guide](./evaluation.md#pilots-and-dated-reports) for evidence limits.
|
|
51
55
|
|
|
52
|
-
- [Pilot and research reports on GitHub](https://github.com/alpertarhan/pi-smart-compact/tree/main/docs/reports):
|
|
53
|
-
context hygiene, AgentSession lifecycle, visual evidence, Hindsight/native
|
|
54
|
-
compaction research and the earlier provider baseline. The
|
|
55
|
-
[evaluation guide](./evaluation.md#pilots-and-dated-reports) explains each scope.
|
|
56
|
-
- [Review findings on GitHub](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/findings/README.md):
|
|
57
|
-
the index of external-model and agent-harness audits, organized by reviewer
|
|
58
|
-
and date. Findings are advisory, not a release gate or product guarantee.
|
|
59
56
|
- [v7 → v8 migration](./MIGRATING_TO_V8.md): instructions for that historical
|
|
60
57
|
transition, **not** the current installation baseline.
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
an installed package. User guides and brand assets ship with the package;
|
|
65
|
-
developer source, tests and evaluation scripts do not.
|
|
59
|
+
User guides and brand assets ship with the package; developer source, tests
|
|
60
|
+
and evaluation scripts do not.
|
|
66
61
|
|
|
67
62
|
A green scripted pilot does not establish live-model fidelity, billed savings
|
|
68
63
|
or production readiness. Use the [evaluation limits](./evaluation.md) and
|
package/docs/RELEASE.md
CHANGED
|
@@ -28,9 +28,10 @@ package installation.
|
|
|
28
28
|
`CHANGELOG.md`; never word a candidate entry as if the final release
|
|
29
29
|
check or canary promotion already passed.
|
|
30
30
|
- [ ] Update the guide, configuration, evaluation, architecture and migration
|
|
31
|
-
notes for behavior/config changes.
|
|
32
|
-
|
|
33
|
-
rewriting
|
|
31
|
+
notes for behavior/config changes. Research reports (`docs/reports/`)
|
|
32
|
+
and review findings (`docs/findings/`) stay local, untracked and unpacked.
|
|
33
|
+
Preserve dated evidence; add local reports or addenda instead of rewriting
|
|
34
|
+
it. Existing copies in Git history are not erased by this policy.
|
|
34
35
|
- [ ] On a major version change, update the supported-versions row in
|
|
35
36
|
`SECURITY.md`; `release:audit` requires it to read ``Latest `<major>.x` ``.
|
|
36
37
|
- [ ] For Claude subscription routes, pair the fresh candidate with the exact
|
package/docs/configuration.md
CHANGED
|
@@ -228,10 +228,10 @@ compaction is on.
|
|
|
228
228
|
|
|
229
229
|
### Automatic runs cap
|
|
230
230
|
|
|
231
|
-
Automatic runs (native-hook, settled and background) are capped at **
|
|
232
|
-
seconds** and **four model calls**. `autoTriggerTimeoutMs` defaults to
|
|
233
|
-
ms and accepts up to 300,000 ms
|
|
234
|
-
`min(autoTriggerTimeoutMs × provider timeout multiplier,
|
|
231
|
+
Automatic runs (native-hook, settled and background) are capped at **300
|
|
232
|
+
seconds** and **four model calls**. `autoTriggerTimeoutMs` defaults to 300,000
|
|
233
|
+
ms and accepts up to 300,000 ms; the effective automatic deadline is
|
|
234
|
+
`min(autoTriggerTimeoutMs × provider timeout multiplier, 300 s)`. The call cap is
|
|
235
235
|
`min(mode call budget, 4)`. When an automatic run times out or fails, it unwinds
|
|
236
236
|
so Pi's own compactor can run.
|
|
237
237
|
|
|
@@ -269,7 +269,7 @@ For calls (`maxLlmCalls`) and prompt tokens (`maxLlmInputTokens`):
|
|
|
269
269
|
| Per-run option (`--max-calls`, `max_calls`, ...) | Used as given, even above the mode limit |
|
|
270
270
|
| Config value `0` | The mode limit |
|
|
271
271
|
| Config value above `0` | `min(config value, mode limit)` |
|
|
272
|
-
| Automatic run | Additionally capped at 4 calls and
|
|
272
|
+
| Automatic run | Additionally capped at 4 calls and 300 s |
|
|
273
273
|
|
|
274
274
|
With the default `maxLlmCalls: 8`, every mode keeps its own limit, because 8 is
|
|
275
275
|
not below any mode's call limit. A config value can only lower the limit.
|
|
@@ -517,7 +517,7 @@ Hindsight setup, data flow and troubleshooting:
|
|
|
517
517
|
| `minContextPercent` | 0–100 | `80` | `Start at context %` |
|
|
518
518
|
| `prepareContextPercent` | `null` or 0–100, below `minContextPercent` | `null` | `Cleanup / prepare at context %` |
|
|
519
519
|
| `maxContextTokens` | `0` (off) or integer 16,384–2,000,000 | `0` | `Context cap for start % (tokens)` |
|
|
520
|
-
| `autoTriggerTimeoutMs` | integer 1,000–300,000 | `
|
|
520
|
+
| `autoTriggerTimeoutMs` | integer 1,000–300,000 | `300000` | `Automatic run time limit (ms)`; capped at 300 s |
|
|
521
521
|
| `compactionEngines` | ordered list of `eesv`, `native` | `["eesv"]` | `Engine` |
|
|
522
522
|
| `requireApproval` | boolean | `true` | `Ask before applying` |
|
|
523
523
|
| `showStatus` | boolean | `true` | `Footer status` |
|
package/docs/evaluation.md
CHANGED
|
@@ -133,9 +133,8 @@ receives the same three bounded coding-continuity scenarios (`implementation`,
|
|
|
133
133
|
`debugging`, `continuity`) sequentially, with a 1,500-token output cap and a
|
|
134
134
|
60-second timeout per call, scored by the deterministic verifier. It reports
|
|
135
135
|
score, latency and reported usage. Apply a route manually, and only after
|
|
136
|
-
representative evidence; one probe is not that evidence.
|
|
137
|
-
|
|
138
|
-
(repository only) is an example of this output, not a current ranking.
|
|
136
|
+
representative evidence; one probe is not that evidence. Historical probe
|
|
137
|
+
results are not a current model ranking.
|
|
139
138
|
|
|
140
139
|
## Paired continuation and memory evaluation
|
|
141
140
|
|
|
@@ -400,22 +399,15 @@ no provider request.
|
|
|
400
399
|
| `PSC_HINDSIGHT_LIVE=1 … bun run test/hindsight-live.canary.ts` | Not run by `bun test` | Live Hindsight contract with a hard call budget; see [Hindsight memory](./hindsight-memory.md#tests) |
|
|
401
400
|
|
|
402
401
|
Dated reports record what was measured on their date, with the code and host
|
|
403
|
-
versions stated inside.
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
[architecture](../ARCHITECTURE.md).
|
|
407
|
-
|
|
408
|
-
reports
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
| [Full AgentSession offline pilot, 2026-09-24](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/reports/session-pilot-2026-09-24.md) | Scripted-transport lifecycle pilot; 2026-09-25 candidate and `9.8.0-canary.1` follow-ups |
|
|
416
|
-
| [Visual evidence pilot, 2026-09-24](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/reports/visual-pilot-2026-09-24.md) | Live synthetic bitmap-versus-text reading pilot on one model |
|
|
417
|
-
|
|
418
|
-
External review findings, one folder per reviewer, are indexed in
|
|
419
|
-
[`docs/findings/`](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/findings/README.md).
|
|
420
|
-
They are advisory analyses of a specific revision range, not release gates or
|
|
421
|
-
evidence of current behavior.
|
|
402
|
+
versions stated inside. Preserve their provenance; add dated addenda rather
|
|
403
|
+
than updating measurements retroactively. Current behavior is described in the
|
|
404
|
+
[guide](./guide.md), [configuration](./configuration.md) and
|
|
405
|
+
[architecture](../ARCHITECTURE.md).
|
|
406
|
+
|
|
407
|
+
Research reports in `docs/reports/` and review findings in `docs/findings/`
|
|
408
|
+
are local, ignored artifacts, not tracked repository or npm content. Pilot
|
|
409
|
+
reports can keep machine-readable `.json` companions beside them. Earlier
|
|
410
|
+
copies may remain in Git history; this policy does not erase that history.
|
|
411
|
+
|
|
412
|
+
External review findings are advisory analyses of a specific revision range,
|
|
413
|
+
not release gates or evidence of current behavior.
|
package/docs/guide.md
CHANGED
|
@@ -314,7 +314,7 @@ model (Home warns above 400k tokens), set `Context cap for start % (tokens)`
|
|
|
314
314
|
and safety headroom still use the real window.
|
|
315
315
|
|
|
316
316
|
Turning `Automatic compaction` off disables both Smart Compact strategies. It
|
|
317
|
-
does not turn off Pi's own compactor. Automatic runs are capped at
|
|
317
|
+
does not turn off Pi's own compactor. Automatic runs are capped at 300 seconds
|
|
318
318
|
and four model calls, whatever the configured limits are. When they fail, Pi
|
|
319
319
|
may still use its own compactor. See
|
|
320
320
|
[automatic strategies](./configuration.md#automatic-strategies) for the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-smart-compact",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.2",
|
|
4
4
|
"description": "Pi Continuity — context hygiene and session continuity for Pi Coding Agent: recoverable cleanup, checkpoints, memory and verified compaction.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.4.2",
|