agent-recall-core 3.4.49 → 3.4.51
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/dist/helpers/transcript-project.d.ts +69 -0
- package/dist/helpers/transcript-project.d.ts.map +1 -0
- package/dist/helpers/transcript-project.js +212 -0
- package/dist/helpers/transcript-project.js.map +1 -0
- package/dist/index.d.ts +26 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -3
- package/dist/index.js.map +1 -1
- package/dist/palace/awareness.d.ts +28 -0
- package/dist/palace/awareness.d.ts.map +1 -1
- package/dist/palace/awareness.js +40 -6
- package/dist/palace/awareness.js.map +1 -1
- package/dist/prompts/consolidation-prompt.d.ts.map +1 -1
- package/dist/prompts/consolidation-prompt.js +5 -0
- package/dist/prompts/consolidation-prompt.js.map +1 -1
- package/dist/retrieval/activation.d.ts +202 -0
- package/dist/retrieval/activation.d.ts.map +1 -0
- package/dist/retrieval/activation.js +313 -0
- package/dist/retrieval/activation.js.map +1 -0
- package/dist/storage/corrections.d.ts +140 -2
- package/dist/storage/corrections.d.ts.map +1 -1
- package/dist/storage/corrections.js +97 -4
- package/dist/storage/corrections.js.map +1 -1
- package/dist/storage/dream-health.d.ts +56 -8
- package/dist/storage/dream-health.d.ts.map +1 -1
- package/dist/storage/dream-health.js +130 -35
- package/dist/storage/dream-health.js.map +1 -1
- package/dist/storage/dream-yield.d.ts +81 -0
- package/dist/storage/dream-yield.d.ts.map +1 -0
- package/dist/storage/dream-yield.js +77 -0
- package/dist/storage/dream-yield.js.map +1 -0
- package/dist/storage/filelock.d.ts +10 -2
- package/dist/storage/filelock.d.ts.map +1 -1
- package/dist/storage/filelock.js +10 -2
- package/dist/storage/filelock.js.map +1 -1
- package/dist/storage/heed-tiers.d.ts +206 -0
- package/dist/storage/heed-tiers.d.ts.map +1 -0
- package/dist/storage/heed-tiers.js +318 -0
- package/dist/storage/heed-tiers.js.map +1 -0
- package/dist/supabase/sync.d.ts +1 -1
- package/dist/supabase/sync.d.ts.map +1 -1
- package/dist/supabase/sync.js +47 -11
- package/dist/supabase/sync.js.map +1 -1
- package/dist/tools-logic/association.d.ts +260 -0
- package/dist/tools-logic/association.d.ts.map +1 -0
- package/dist/tools-logic/association.js +502 -0
- package/dist/tools-logic/association.js.map +1 -0
- package/dist/tools-logic/check-action.d.ts.map +1 -1
- package/dist/tools-logic/check-action.js +14 -0
- package/dist/tools-logic/check-action.js.map +1 -1
- package/dist/tools-logic/dream-admission.d.ts +144 -0
- package/dist/tools-logic/dream-admission.d.ts.map +1 -0
- package/dist/tools-logic/dream-admission.js +537 -0
- package/dist/tools-logic/dream-admission.js.map +1 -0
- package/dist/tools-logic/implicit-harvest.d.ts +196 -0
- package/dist/tools-logic/implicit-harvest.d.ts.map +1 -0
- package/dist/tools-logic/implicit-harvest.js +675 -0
- package/dist/tools-logic/implicit-harvest.js.map +1 -0
- package/dist/tools-logic/insight-promotion.d.ts +18 -0
- package/dist/tools-logic/insight-promotion.d.ts.map +1 -1
- package/dist/tools-logic/insight-promotion.js +90 -15
- package/dist/tools-logic/insight-promotion.js.map +1 -1
- package/dist/tools-logic/retier.d.ts +274 -0
- package/dist/tools-logic/retier.d.ts.map +1 -0
- package/dist/tools-logic/retier.js +511 -0
- package/dist/tools-logic/retier.js.map +1 -0
- package/dist/tools-logic/safety-consolidation.d.ts +15 -0
- package/dist/tools-logic/safety-consolidation.d.ts.map +1 -1
- package/dist/tools-logic/safety-consolidation.js +13 -2
- package/dist/tools-logic/safety-consolidation.js.map +1 -1
- package/dist/tools-logic/session-end-reflect.d.ts.map +1 -1
- package/dist/tools-logic/session-end-reflect.js +4 -1
- package/dist/tools-logic/session-end-reflect.js.map +1 -1
- package/dist/tools-logic/session-end.d.ts +35 -0
- package/dist/tools-logic/session-end.d.ts.map +1 -1
- package/dist/tools-logic/session-end.js +26 -7
- package/dist/tools-logic/session-end.js.map +1 -1
- package/dist/tools-logic/session-start.d.ts +11 -0
- package/dist/tools-logic/session-start.d.ts.map +1 -1
- package/dist/tools-logic/session-start.js +34 -4
- package/dist/tools-logic/session-start.js.map +1 -1
- package/dist/tools-logic/smart-recall.d.ts +11 -0
- package/dist/tools-logic/smart-recall.d.ts.map +1 -1
- package/dist/tools-logic/smart-recall.js +11 -0
- package/dist/tools-logic/smart-recall.js.map +1 -1
- package/dist/tools-logic/store-doctor.d.ts.map +1 -1
- package/dist/tools-logic/store-doctor.js +7 -1
- package/dist/tools-logic/store-doctor.js.map +1 -1
- package/dist/tools-logic/transcript-audit.d.ts +128 -0
- package/dist/tools-logic/transcript-audit.d.ts.map +1 -0
- package/dist/tools-logic/transcript-audit.js +428 -0
- package/dist/tools-logic/transcript-audit.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* heed-tiers.ts — symmetric evidence-tier classification for correction
|
|
3
|
+
* outcome events (the S0 heed-rate split: ADJUDICATED vs LOOSE, correction-
|
|
4
|
+
* level and event-level).
|
|
5
|
+
*
|
|
6
|
+
* PROVENANCE / SINGLE SOURCE OF TRUTH (fix12 hygiene, 2026-09-12): this logic
|
|
7
|
+
* was authored in `scripts/eval/heed-rate/lib.mjs` (fix11, review-hardened —
|
|
8
|
+
* symmetric tiering after the asymmetric-tiers HIGH finding) and MOVED here
|
|
9
|
+
* verbatim so the shipped KPI surfaces (`ar stats`) can present the tiered
|
|
10
|
+
* split without forking the eval's classification. `lib.mjs` now re-exports
|
|
11
|
+
* these functions from the built core — change the tiers HERE, never in a
|
|
12
|
+
* copy. The eval's mechanics tests (scripts/eval/heed-rate/heed-rate.test.mjs)
|
|
13
|
+
* exercise this implementation through the re-export.
|
|
14
|
+
*
|
|
15
|
+
* WHY TIERS (fix11 retrospective, 2026-09-12): the shipped KPI formula
|
|
16
|
+
* heed_rate = heeded/(heeded+recurred) is bookkeeping, not evidence — in the
|
|
17
|
+
* live store 75.8% of its numerator was pre-C3 default-heeded absence-of-
|
|
18
|
+
* evidence credit, and its denominator carried session_end self-report marker
|
|
19
|
+
* fan-out (3 of 4 correction-level "violated" verdicts traced to unrelated
|
|
20
|
+
* sessions). Presenting the single number invites 2×-style over-trust in
|
|
21
|
+
* either direction, so every KPI surface renders BOTH tiers as a range.
|
|
22
|
+
*/
|
|
23
|
+
/** Minimal structural shape of one `_outcomes.jsonl` event for tiering. */
|
|
24
|
+
export interface HeedTierEvent {
|
|
25
|
+
kind?: string;
|
|
26
|
+
evidence?: string;
|
|
27
|
+
at?: string;
|
|
28
|
+
}
|
|
29
|
+
export type HeedEventTier = "heeded_verified" | "heeded_checkaction" | "heeded_default" | "recurred_verified" | "recurred_selfreport" | "not_violated" | "surfaced" | "no_signal" | "prediction" | "other";
|
|
30
|
+
/**
|
|
31
|
+
* Evidence tiers for outcome-ledger events (_outcomes.jsonl lines).
|
|
32
|
+
*
|
|
33
|
+
* Tiering rationale (verified against the live store 2026-09-12 and against
|
|
34
|
+
* the producer code paths):
|
|
35
|
+
*
|
|
36
|
+
* heeded_verified kind=heeded, evidence starts "dream-audit:" — the C3b
|
|
37
|
+
* nightly audit cites verbatim transcript/journal
|
|
38
|
+
* compliance evidence. Strongest heed signal the ledger
|
|
39
|
+
* carries.
|
|
40
|
+
* heeded_checkaction kind=heeded, evidence mentions "check-action" — the C3
|
|
41
|
+
* authoritative session-end path (trigger evidence + no
|
|
42
|
+
* recurrence marker). Designed but NEVER observed in the
|
|
43
|
+
* live store (0 "triggered" events exist store-wide).
|
|
44
|
+
* heeded_default kind=heeded, anything else — the pre-C3 default-heeded
|
|
45
|
+
* bias ("no recurrence evidence in session summary",
|
|
46
|
+
* with or without the explicit "(default-heeded …)"
|
|
47
|
+
* marker). Credits heed on ABSENCE of evidence — loose
|
|
48
|
+
* tier only.
|
|
49
|
+
* recurred_verified kind=recurred, dream-audit prefix — audited violation.
|
|
50
|
+
* recurred_selfreport kind=recurred, otherwise — session-summary recurrence
|
|
51
|
+
* markers. Loose tier only: primary-evidence review
|
|
52
|
+
* (2026-09-12) showed session_end FANS one summary's
|
|
53
|
+
* marker out onto every correction with ≥2-3 topical
|
|
54
|
+
* content words, so these over-count violations from
|
|
55
|
+
* unrelated sessions (3 of 4 originally-"violated"
|
|
56
|
+
* verdicts were such fan-out artifacts).
|
|
57
|
+
* not_violated weak non-violation (topical overlap, no marker) — own
|
|
58
|
+
* counter by design, NEVER blended into heed_rate.
|
|
59
|
+
* surfaced kind=retrieved — the correction was injected.
|
|
60
|
+
* no_signal unknown / not_triggered — no compliance information.
|
|
61
|
+
* prediction predicted / predict_hit — prediction loop, not heed.
|
|
62
|
+
* other unrecognized kind (forward-compat).
|
|
63
|
+
*
|
|
64
|
+
* NOTE (class-not-instance): the tiers key off producer evidence-string
|
|
65
|
+
* conventions ("dream-audit:" prefix, "check-action" mention). If a producer
|
|
66
|
+
* changes wording, add a row HERE — every consumer (eval + `ar stats` +
|
|
67
|
+
* rmr-report) picks it up.
|
|
68
|
+
*/
|
|
69
|
+
export declare function classifyEvent(evt: HeedTierEvent | null | undefined): HeedEventTier;
|
|
70
|
+
/**
|
|
71
|
+
* Symmetric evidence tiers (fix11 fix round 2026-09-12, review HIGH):
|
|
72
|
+
*
|
|
73
|
+
* The original design excluded default-heeded (absence-of-evidence POSITIVES)
|
|
74
|
+
* from the strict rate but trusted self-report recurrence markers
|
|
75
|
+
* (keyword-heuristic NEGATIVES) at full weight — asymmetric. Primary-evidence
|
|
76
|
+
* review proved the self-report channel over-counts: session_end fans one
|
|
77
|
+
* summary's recurrence marker out onto every correction with ≥2-3 topical
|
|
78
|
+
* content words, producing violation verdicts from unrelated sessions.
|
|
79
|
+
*
|
|
80
|
+
* So both rates are tiered SYMMETRICALLY and reported as a range:
|
|
81
|
+
*
|
|
82
|
+
* ADJUDICATED — evidence-cited verdicts only, both directions:
|
|
83
|
+
* heed: heeded_verified (dream-audit verbatim) + heeded_checkaction
|
|
84
|
+
* (C3 authoritative trigger; zero instances to date)
|
|
85
|
+
* violation: recurred_verified (dream-audit verbatim)
|
|
86
|
+
*
|
|
87
|
+
* LOOSE — heuristic channels included, both directions:
|
|
88
|
+
* heed: adjudicated heeds + heeded_default (pre-C3 absence-of-
|
|
89
|
+
* evidence credit)
|
|
90
|
+
* violation: adjudicated violations + recurred_selfreport (summary
|
|
91
|
+
* marker fan-out)
|
|
92
|
+
*
|
|
93
|
+
* At event level the LOOSE rate is by construction the shipped KPI formula
|
|
94
|
+
* heeded/(heeded+recurred). `not_violated` stays outside BOTH tiers (its own
|
|
95
|
+
* design contract — never blended into heed_rate).
|
|
96
|
+
*/
|
|
97
|
+
export declare const ADJUDICATED_HEED: ReadonlySet<HeedEventTier>;
|
|
98
|
+
export declare const ADJUDICATED_VIOLATION: ReadonlySet<HeedEventTier>;
|
|
99
|
+
export declare const LOOSE_HEED: ReadonlySet<HeedEventTier>;
|
|
100
|
+
export declare const LOOSE_VIOLATION: ReadonlySet<HeedEventTier>;
|
|
101
|
+
/** Local-calendar-day string for an ISO timestamp ("sv" locale = YYYY-MM-DD). */
|
|
102
|
+
export declare function dayOf(iso: string | undefined): string | null;
|
|
103
|
+
export type HeedTierVerdict = "heeded" | "violated" | "mixed" | "no-evidence";
|
|
104
|
+
export interface HeedTierCounts {
|
|
105
|
+
heeds: number;
|
|
106
|
+
violations: number;
|
|
107
|
+
verdict: HeedTierVerdict;
|
|
108
|
+
}
|
|
109
|
+
export interface HeedCorrectionResult {
|
|
110
|
+
status: "surfaced" | "not-surfaced";
|
|
111
|
+
label: string;
|
|
112
|
+
surfaced_count: number;
|
|
113
|
+
first_surfaced: string | null;
|
|
114
|
+
adjudicated: HeedTierCounts;
|
|
115
|
+
loose: HeedTierCounts;
|
|
116
|
+
weak_not_violated: number;
|
|
117
|
+
tiers: Partial<Record<HeedEventTier, number>>;
|
|
118
|
+
pre_surfacing: Array<{
|
|
119
|
+
tier: HeedEventTier;
|
|
120
|
+
at: string | undefined;
|
|
121
|
+
evidence: string;
|
|
122
|
+
}>;
|
|
123
|
+
evidence: Array<{
|
|
124
|
+
tier: HeedEventTier;
|
|
125
|
+
at: string | undefined;
|
|
126
|
+
evidence: string;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Classify one correction's full event list into per-correction verdicts,
|
|
131
|
+
* one per evidence tier (symmetric tiering — see the tier doc above).
|
|
132
|
+
*
|
|
133
|
+
* Only events on/after the first surfacing day count toward compliance —
|
|
134
|
+
* "did SUBSEQUENT behavior comply" (same-day counts as subsequent: retrieval
|
|
135
|
+
* fires at session_start, verdicts at session_end / overnight audit, and the
|
|
136
|
+
* C3b audit backdates `at` to the audited day).
|
|
137
|
+
*
|
|
138
|
+
* Result:
|
|
139
|
+
* status "surfaced" | "not-surfaced"
|
|
140
|
+
* adjudicated {heeds, violations, verdict} evidence-cited, both directions
|
|
141
|
+
* loose {heeds, violations, verdict} heuristic channels included, both directions
|
|
142
|
+
* weak_not_violated count of not_violated signals (outside both tiers)
|
|
143
|
+
* label one display bucket for summary tables:
|
|
144
|
+
* adjudicated-heeded/violated/mixed → loose-heeded/violated/mixed
|
|
145
|
+
* → weak-not-violated → silent
|
|
146
|
+
*/
|
|
147
|
+
export declare function classifyCorrection(events: HeedTierEvent[]): HeedCorrectionResult;
|
|
148
|
+
export interface HeedTierAggregate {
|
|
149
|
+
corrections: {
|
|
150
|
+
heeded: number;
|
|
151
|
+
violated: number;
|
|
152
|
+
mixed: number;
|
|
153
|
+
no_evidence: number;
|
|
154
|
+
denominator: number;
|
|
155
|
+
rate: number | null;
|
|
156
|
+
};
|
|
157
|
+
events: {
|
|
158
|
+
heeded: number;
|
|
159
|
+
recurred: number;
|
|
160
|
+
rate: number | null;
|
|
161
|
+
};
|
|
162
|
+
coverage_of_surfaced: number | null;
|
|
163
|
+
}
|
|
164
|
+
export interface HeedAggregateRow {
|
|
165
|
+
id: string;
|
|
166
|
+
project?: string;
|
|
167
|
+
retracted?: boolean;
|
|
168
|
+
result: HeedCorrectionResult;
|
|
169
|
+
}
|
|
170
|
+
export interface HeedAggregate {
|
|
171
|
+
corrections_total: number;
|
|
172
|
+
corrections_retracted: number;
|
|
173
|
+
corrections_live: number;
|
|
174
|
+
surfaced: number;
|
|
175
|
+
by_label: Record<string, number>;
|
|
176
|
+
adjudicated: HeedTierAggregate;
|
|
177
|
+
loose: HeedTierAggregate;
|
|
178
|
+
kpi_formula: {
|
|
179
|
+
rate: number | null;
|
|
180
|
+
heeded_all: number;
|
|
181
|
+
heeded_default_share: number;
|
|
182
|
+
heeded_default_fraction: number | null;
|
|
183
|
+
recurred: number;
|
|
184
|
+
};
|
|
185
|
+
no_evidence: {
|
|
186
|
+
no_adjudicated_evidence: number;
|
|
187
|
+
no_loose_evidence: number;
|
|
188
|
+
weak_not_violated_only: number;
|
|
189
|
+
silent: number;
|
|
190
|
+
share_without_adjudicated: number | null;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Aggregate per-correction results into the retrospective's headline numbers,
|
|
195
|
+
* SYMMETRICALLY tiered (adjudicated / loose — see the tier doc above) and
|
|
196
|
+
* presented as a range. `rows` = [{id, project, retracted, result}] where
|
|
197
|
+
* result = classifyCorrection().
|
|
198
|
+
*
|
|
199
|
+
* Retracted corrections are aggregated SEPARATELY: in this store every
|
|
200
|
+
* retraction is a "capture noise" triage (the record was never a real rule),
|
|
201
|
+
* so a retraction is an exclusion, NOT a violation — despite the fix11 task
|
|
202
|
+
* brief's suggestion, the data does not support counting retractions as
|
|
203
|
+
* violations.
|
|
204
|
+
*/
|
|
205
|
+
export declare function aggregate(rows: HeedAggregateRow[]): HeedAggregate;
|
|
206
|
+
//# sourceMappingURL=heed-tiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heed-tiers.d.ts","sourceRoot":"","sources":["../../src/storage/heed-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,2EA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,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;QACvC,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,WAAW,EAAE;QACX,uBAAuB,EAAE,MAAM,CAAC;QAChC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,sBAAsB,EAAE,MAAM,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAC;QACf,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1C,CAAC;CACH;AAoCD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,aAAa,CAyCjE"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* heed-tiers.ts — symmetric evidence-tier classification for correction
|
|
3
|
+
* outcome events (the S0 heed-rate split: ADJUDICATED vs LOOSE, correction-
|
|
4
|
+
* level and event-level).
|
|
5
|
+
*
|
|
6
|
+
* PROVENANCE / SINGLE SOURCE OF TRUTH (fix12 hygiene, 2026-09-12): this logic
|
|
7
|
+
* was authored in `scripts/eval/heed-rate/lib.mjs` (fix11, review-hardened —
|
|
8
|
+
* symmetric tiering after the asymmetric-tiers HIGH finding) and MOVED here
|
|
9
|
+
* verbatim so the shipped KPI surfaces (`ar stats`) can present the tiered
|
|
10
|
+
* split without forking the eval's classification. `lib.mjs` now re-exports
|
|
11
|
+
* these functions from the built core — change the tiers HERE, never in a
|
|
12
|
+
* copy. The eval's mechanics tests (scripts/eval/heed-rate/heed-rate.test.mjs)
|
|
13
|
+
* exercise this implementation through the re-export.
|
|
14
|
+
*
|
|
15
|
+
* WHY TIERS (fix11 retrospective, 2026-09-12): the shipped KPI formula
|
|
16
|
+
* heed_rate = heeded/(heeded+recurred) is bookkeeping, not evidence — in the
|
|
17
|
+
* live store 75.8% of its numerator was pre-C3 default-heeded absence-of-
|
|
18
|
+
* evidence credit, and its denominator carried session_end self-report marker
|
|
19
|
+
* fan-out (3 of 4 correction-level "violated" verdicts traced to unrelated
|
|
20
|
+
* sessions). Presenting the single number invites 2×-style over-trust in
|
|
21
|
+
* either direction, so every KPI surface renders BOTH tiers as a range.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Evidence tiers for outcome-ledger events (_outcomes.jsonl lines).
|
|
25
|
+
*
|
|
26
|
+
* Tiering rationale (verified against the live store 2026-09-12 and against
|
|
27
|
+
* the producer code paths):
|
|
28
|
+
*
|
|
29
|
+
* heeded_verified kind=heeded, evidence starts "dream-audit:" — the C3b
|
|
30
|
+
* nightly audit cites verbatim transcript/journal
|
|
31
|
+
* compliance evidence. Strongest heed signal the ledger
|
|
32
|
+
* carries.
|
|
33
|
+
* heeded_checkaction kind=heeded, evidence mentions "check-action" — the C3
|
|
34
|
+
* authoritative session-end path (trigger evidence + no
|
|
35
|
+
* recurrence marker). Designed but NEVER observed in the
|
|
36
|
+
* live store (0 "triggered" events exist store-wide).
|
|
37
|
+
* heeded_default kind=heeded, anything else — the pre-C3 default-heeded
|
|
38
|
+
* bias ("no recurrence evidence in session summary",
|
|
39
|
+
* with or without the explicit "(default-heeded …)"
|
|
40
|
+
* marker). Credits heed on ABSENCE of evidence — loose
|
|
41
|
+
* tier only.
|
|
42
|
+
* recurred_verified kind=recurred, dream-audit prefix — audited violation.
|
|
43
|
+
* recurred_selfreport kind=recurred, otherwise — session-summary recurrence
|
|
44
|
+
* markers. Loose tier only: primary-evidence review
|
|
45
|
+
* (2026-09-12) showed session_end FANS one summary's
|
|
46
|
+
* marker out onto every correction with ≥2-3 topical
|
|
47
|
+
* content words, so these over-count violations from
|
|
48
|
+
* unrelated sessions (3 of 4 originally-"violated"
|
|
49
|
+
* verdicts were such fan-out artifacts).
|
|
50
|
+
* not_violated weak non-violation (topical overlap, no marker) — own
|
|
51
|
+
* counter by design, NEVER blended into heed_rate.
|
|
52
|
+
* surfaced kind=retrieved — the correction was injected.
|
|
53
|
+
* no_signal unknown / not_triggered — no compliance information.
|
|
54
|
+
* prediction predicted / predict_hit — prediction loop, not heed.
|
|
55
|
+
* other unrecognized kind (forward-compat).
|
|
56
|
+
*
|
|
57
|
+
* NOTE (class-not-instance): the tiers key off producer evidence-string
|
|
58
|
+
* conventions ("dream-audit:" prefix, "check-action" mention). If a producer
|
|
59
|
+
* changes wording, add a row HERE — every consumer (eval + `ar stats` +
|
|
60
|
+
* rmr-report) picks it up.
|
|
61
|
+
*/
|
|
62
|
+
export function classifyEvent(evt) {
|
|
63
|
+
const kind = evt?.kind;
|
|
64
|
+
const evidence = (evt?.evidence ?? "").toLowerCase();
|
|
65
|
+
const isDream = evidence.startsWith("dream-audit:");
|
|
66
|
+
switch (kind) {
|
|
67
|
+
case "heeded":
|
|
68
|
+
if (isDream)
|
|
69
|
+
return "heeded_verified";
|
|
70
|
+
if (evidence.includes("check-action"))
|
|
71
|
+
return "heeded_checkaction";
|
|
72
|
+
return "heeded_default";
|
|
73
|
+
case "recurred":
|
|
74
|
+
return isDream ? "recurred_verified" : "recurred_selfreport";
|
|
75
|
+
case "not_violated":
|
|
76
|
+
return "not_violated";
|
|
77
|
+
case "retrieved":
|
|
78
|
+
return "surfaced";
|
|
79
|
+
case "unknown":
|
|
80
|
+
case "not_triggered":
|
|
81
|
+
return "no_signal";
|
|
82
|
+
case "predicted":
|
|
83
|
+
case "predict_hit":
|
|
84
|
+
return "prediction";
|
|
85
|
+
default:
|
|
86
|
+
return "other";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Symmetric evidence tiers (fix11 fix round 2026-09-12, review HIGH):
|
|
91
|
+
*
|
|
92
|
+
* The original design excluded default-heeded (absence-of-evidence POSITIVES)
|
|
93
|
+
* from the strict rate but trusted self-report recurrence markers
|
|
94
|
+
* (keyword-heuristic NEGATIVES) at full weight — asymmetric. Primary-evidence
|
|
95
|
+
* review proved the self-report channel over-counts: session_end fans one
|
|
96
|
+
* summary's recurrence marker out onto every correction with ≥2-3 topical
|
|
97
|
+
* content words, producing violation verdicts from unrelated sessions.
|
|
98
|
+
*
|
|
99
|
+
* So both rates are tiered SYMMETRICALLY and reported as a range:
|
|
100
|
+
*
|
|
101
|
+
* ADJUDICATED — evidence-cited verdicts only, both directions:
|
|
102
|
+
* heed: heeded_verified (dream-audit verbatim) + heeded_checkaction
|
|
103
|
+
* (C3 authoritative trigger; zero instances to date)
|
|
104
|
+
* violation: recurred_verified (dream-audit verbatim)
|
|
105
|
+
*
|
|
106
|
+
* LOOSE — heuristic channels included, both directions:
|
|
107
|
+
* heed: adjudicated heeds + heeded_default (pre-C3 absence-of-
|
|
108
|
+
* evidence credit)
|
|
109
|
+
* violation: adjudicated violations + recurred_selfreport (summary
|
|
110
|
+
* marker fan-out)
|
|
111
|
+
*
|
|
112
|
+
* At event level the LOOSE rate is by construction the shipped KPI formula
|
|
113
|
+
* heeded/(heeded+recurred). `not_violated` stays outside BOTH tiers (its own
|
|
114
|
+
* design contract — never blended into heed_rate).
|
|
115
|
+
*/
|
|
116
|
+
export const ADJUDICATED_HEED = new Set([
|
|
117
|
+
"heeded_verified",
|
|
118
|
+
"heeded_checkaction",
|
|
119
|
+
]);
|
|
120
|
+
export const ADJUDICATED_VIOLATION = new Set([
|
|
121
|
+
"recurred_verified",
|
|
122
|
+
]);
|
|
123
|
+
export const LOOSE_HEED = new Set([
|
|
124
|
+
...ADJUDICATED_HEED,
|
|
125
|
+
"heeded_default",
|
|
126
|
+
]);
|
|
127
|
+
export const LOOSE_VIOLATION = new Set([
|
|
128
|
+
...ADJUDICATED_VIOLATION,
|
|
129
|
+
"recurred_selfreport",
|
|
130
|
+
]);
|
|
131
|
+
const COMPLIANCE_BEARING = new Set([
|
|
132
|
+
...LOOSE_HEED,
|
|
133
|
+
...LOOSE_VIOLATION,
|
|
134
|
+
"not_violated",
|
|
135
|
+
]);
|
|
136
|
+
/** Local-calendar-day string for an ISO timestamp ("sv" locale = YYYY-MM-DD). */
|
|
137
|
+
export function dayOf(iso) {
|
|
138
|
+
const d = new Date(iso ?? "");
|
|
139
|
+
return Number.isNaN(d.getTime()) ? null : d.toLocaleDateString("sv");
|
|
140
|
+
}
|
|
141
|
+
/** Verdict within one evidence tier from heed/violation counts. */
|
|
142
|
+
function tierVerdict(heeds, violations) {
|
|
143
|
+
if (heeds > 0 && violations > 0)
|
|
144
|
+
return "mixed";
|
|
145
|
+
if (heeds > 0)
|
|
146
|
+
return "heeded";
|
|
147
|
+
if (violations > 0)
|
|
148
|
+
return "violated";
|
|
149
|
+
return "no-evidence";
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Classify one correction's full event list into per-correction verdicts,
|
|
153
|
+
* one per evidence tier (symmetric tiering — see the tier doc above).
|
|
154
|
+
*
|
|
155
|
+
* Only events on/after the first surfacing day count toward compliance —
|
|
156
|
+
* "did SUBSEQUENT behavior comply" (same-day counts as subsequent: retrieval
|
|
157
|
+
* fires at session_start, verdicts at session_end / overnight audit, and the
|
|
158
|
+
* C3b audit backdates `at` to the audited day).
|
|
159
|
+
*
|
|
160
|
+
* Result:
|
|
161
|
+
* status "surfaced" | "not-surfaced"
|
|
162
|
+
* adjudicated {heeds, violations, verdict} evidence-cited, both directions
|
|
163
|
+
* loose {heeds, violations, verdict} heuristic channels included, both directions
|
|
164
|
+
* weak_not_violated count of not_violated signals (outside both tiers)
|
|
165
|
+
* label one display bucket for summary tables:
|
|
166
|
+
* adjudicated-heeded/violated/mixed → loose-heeded/violated/mixed
|
|
167
|
+
* → weak-not-violated → silent
|
|
168
|
+
*/
|
|
169
|
+
export function classifyCorrection(events) {
|
|
170
|
+
const empty = { heeds: 0, violations: 0, verdict: "no-evidence" };
|
|
171
|
+
const surfacings = events.filter((e) => e.kind === "retrieved" && dayOf(e.at));
|
|
172
|
+
if (surfacings.length === 0) {
|
|
173
|
+
return {
|
|
174
|
+
status: "not-surfaced", label: "not-surfaced", surfaced_count: 0, first_surfaced: null,
|
|
175
|
+
adjudicated: { ...empty }, loose: { ...empty }, weak_not_violated: 0,
|
|
176
|
+
tiers: {}, pre_surfacing: [], evidence: [],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const firstDay = surfacings.map((e) => dayOf(e.at)).sort()[0];
|
|
180
|
+
const tiers = {};
|
|
181
|
+
const evidence = [];
|
|
182
|
+
const preSurfacing = [];
|
|
183
|
+
for (const e of events) {
|
|
184
|
+
const tier = classifyEvent(e);
|
|
185
|
+
const day = dayOf(e.at);
|
|
186
|
+
// Compliance-bearing events strictly BEFORE first surfacing cannot answer
|
|
187
|
+
// "did behavior comply after the rule was surfaced" — flagged, not counted.
|
|
188
|
+
if (COMPLIANCE_BEARING.has(tier) && day !== null && firstDay !== null && day < firstDay) {
|
|
189
|
+
preSurfacing.push({ tier, at: e.at, evidence: e.evidence ?? "" });
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
tiers[tier] = (tiers[tier] ?? 0) + 1;
|
|
193
|
+
if (COMPLIANCE_BEARING.has(tier) || tier === "no_signal") {
|
|
194
|
+
evidence.push({ tier, at: e.at, evidence: e.evidence ?? "" });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const count = (set) => [...set].reduce((n, t) => n + (tiers[t] ?? 0), 0);
|
|
198
|
+
const adjHeeds = count(ADJUDICATED_HEED);
|
|
199
|
+
const adjViolations = count(ADJUDICATED_VIOLATION);
|
|
200
|
+
const adjudicated = {
|
|
201
|
+
heeds: adjHeeds,
|
|
202
|
+
violations: adjViolations,
|
|
203
|
+
verdict: tierVerdict(adjHeeds, adjViolations),
|
|
204
|
+
};
|
|
205
|
+
const looseHeeds = count(LOOSE_HEED);
|
|
206
|
+
const looseViolations = count(LOOSE_VIOLATION);
|
|
207
|
+
const loose = {
|
|
208
|
+
heeds: looseHeeds,
|
|
209
|
+
violations: looseViolations,
|
|
210
|
+
verdict: tierVerdict(looseHeeds, looseViolations),
|
|
211
|
+
};
|
|
212
|
+
const weakNotViolated = tiers.not_violated ?? 0;
|
|
213
|
+
let label;
|
|
214
|
+
if (adjudicated.verdict !== "no-evidence")
|
|
215
|
+
label = `adjudicated-${adjudicated.verdict}`;
|
|
216
|
+
else if (loose.verdict !== "no-evidence")
|
|
217
|
+
label = `loose-${loose.verdict}`;
|
|
218
|
+
else if (weakNotViolated > 0)
|
|
219
|
+
label = "weak-not-violated";
|
|
220
|
+
else
|
|
221
|
+
label = "silent";
|
|
222
|
+
return {
|
|
223
|
+
status: "surfaced",
|
|
224
|
+
label,
|
|
225
|
+
surfaced_count: surfacings.length,
|
|
226
|
+
first_surfaced: firstDay,
|
|
227
|
+
adjudicated,
|
|
228
|
+
loose,
|
|
229
|
+
weak_not_violated: weakNotViolated,
|
|
230
|
+
tiers,
|
|
231
|
+
pre_surfacing: preSurfacing,
|
|
232
|
+
evidence,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Correction-level + event-level rates for ONE evidence tier. */
|
|
236
|
+
function tierAggregate(surfaced, tierKey) {
|
|
237
|
+
const byVerdict = {
|
|
238
|
+
heeded: 0, violated: 0, mixed: 0, "no-evidence": 0,
|
|
239
|
+
};
|
|
240
|
+
let evHeeds = 0, evViolations = 0;
|
|
241
|
+
for (const r of surfaced) {
|
|
242
|
+
const t = r.result[tierKey];
|
|
243
|
+
byVerdict[t.verdict] = (byVerdict[t.verdict] ?? 0) + 1;
|
|
244
|
+
evHeeds += t.heeds;
|
|
245
|
+
evViolations += t.violations;
|
|
246
|
+
}
|
|
247
|
+
const denom = byVerdict.heeded + byVerdict.violated + byVerdict.mixed;
|
|
248
|
+
return {
|
|
249
|
+
corrections: {
|
|
250
|
+
heeded: byVerdict.heeded,
|
|
251
|
+
violated: byVerdict.violated,
|
|
252
|
+
mixed: byVerdict.mixed, // counts AGAINST the numerator: a violation after surfacing is a heed failure even if a separate day complied
|
|
253
|
+
no_evidence: byVerdict["no-evidence"],
|
|
254
|
+
denominator: denom,
|
|
255
|
+
rate: denom > 0 ? byVerdict.heeded / denom : null,
|
|
256
|
+
},
|
|
257
|
+
events: {
|
|
258
|
+
heeded: evHeeds,
|
|
259
|
+
recurred: evViolations,
|
|
260
|
+
rate: evHeeds + evViolations > 0 ? evHeeds / (evHeeds + evViolations) : null,
|
|
261
|
+
},
|
|
262
|
+
coverage_of_surfaced: surfaced.length > 0 ? denom / surfaced.length : null,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Aggregate per-correction results into the retrospective's headline numbers,
|
|
267
|
+
* SYMMETRICALLY tiered (adjudicated / loose — see the tier doc above) and
|
|
268
|
+
* presented as a range. `rows` = [{id, project, retracted, result}] where
|
|
269
|
+
* result = classifyCorrection().
|
|
270
|
+
*
|
|
271
|
+
* Retracted corrections are aggregated SEPARATELY: in this store every
|
|
272
|
+
* retraction is a "capture noise" triage (the record was never a real rule),
|
|
273
|
+
* so a retraction is an exclusion, NOT a violation — despite the fix11 task
|
|
274
|
+
* brief's suggestion, the data does not support counting retractions as
|
|
275
|
+
* violations.
|
|
276
|
+
*/
|
|
277
|
+
export function aggregate(rows) {
|
|
278
|
+
const live = rows.filter((r) => !r.retracted);
|
|
279
|
+
const surfaced = live.filter((r) => r.result.status === "surfaced");
|
|
280
|
+
const byLabel = {};
|
|
281
|
+
for (const r of surfaced)
|
|
282
|
+
byLabel[r.result.label] = (byLabel[r.result.label] ?? 0) + 1;
|
|
283
|
+
const adjudicated = tierAggregate(surfaced, "adjudicated");
|
|
284
|
+
const loose = tierAggregate(surfaced, "loose");
|
|
285
|
+
// The shipped KPI formula heeded/(heeded+recurred) equals the LOOSE
|
|
286
|
+
// event-level rate by construction; annotate its numerator composition.
|
|
287
|
+
let evHeedDefault = 0;
|
|
288
|
+
for (const r of surfaced)
|
|
289
|
+
evHeedDefault += r.result.tiers?.heeded_default ?? 0;
|
|
290
|
+
const kpi_formula = {
|
|
291
|
+
rate: loose.events.rate,
|
|
292
|
+
heeded_all: loose.events.heeded,
|
|
293
|
+
heeded_default_share: evHeedDefault, // absence-of-evidence credit inside the numerator
|
|
294
|
+
heeded_default_fraction: loose.events.heeded > 0 ? evHeedDefault / loose.events.heeded : null,
|
|
295
|
+
recurred: loose.events.recurred,
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
corrections_total: rows.length,
|
|
299
|
+
corrections_retracted: rows.length - live.length,
|
|
300
|
+
corrections_live: live.length,
|
|
301
|
+
surfaced: surfaced.length,
|
|
302
|
+
by_label: byLabel,
|
|
303
|
+
adjudicated,
|
|
304
|
+
loose,
|
|
305
|
+
kpi_formula,
|
|
306
|
+
// Absence-of-evidence classes (the honest denominator problem):
|
|
307
|
+
no_evidence: {
|
|
308
|
+
no_adjudicated_evidence: surfaced.length - adjudicated.corrections.denominator,
|
|
309
|
+
no_loose_evidence: surfaced.length - loose.corrections.denominator,
|
|
310
|
+
weak_not_violated_only: byLabel["weak-not-violated"] ?? 0,
|
|
311
|
+
silent: byLabel.silent ?? 0,
|
|
312
|
+
share_without_adjudicated: surfaced.length > 0
|
|
313
|
+
? (surfaced.length - adjudicated.corrections.denominator) / surfaced.length
|
|
314
|
+
: null,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=heed-tiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heed-tiers.js","sourceRoot":"","sources":["../../src/storage/heed-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAyBH;;;;;;;;;;;;;;;;;;;;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export declare function parseMemoryFile(content: string): ParsedMemoryFile;
|
|
9
9
|
export declare function deriveSlug(filePath: string): string;
|
|
10
|
-
export declare function logSyncError(message: string): void;
|
|
10
|
+
export declare function logSyncError(message: string, rootAtCall?: string): void;
|
|
11
11
|
export declare function syncToSupabase(filePath: string, content: string, project: string, store: "journal" | "palace" | "awareness" | "digest" | "corrections", room?: string): void;
|
|
12
12
|
/**
|
|
13
13
|
* Gather a project's journal + palace-room files for backfill(), sourced
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/supabase/sync.ts"],"names":[],"mappings":"AAkBA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA8BjE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAanD;AAMD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/supabase/sync.ts"],"names":[],"mappings":"AAkBA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA8BjE;A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