agent-recall-core 3.4.50 → 3.5.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.
Files changed (152) hide show
  1. package/README.md +559 -330
  2. package/dist/embeddings/config.d.ts.map +1 -1
  3. package/dist/embeddings/config.js +17 -4
  4. package/dist/embeddings/config.js.map +1 -1
  5. package/dist/helpers/alignment-patterns.d.ts +46 -0
  6. package/dist/helpers/alignment-patterns.d.ts.map +1 -1
  7. package/dist/helpers/alignment-patterns.js +103 -2
  8. package/dist/helpers/alignment-patterns.js.map +1 -1
  9. package/dist/helpers/journal-files.d.ts +12 -6
  10. package/dist/helpers/journal-files.d.ts.map +1 -1
  11. package/dist/helpers/journal-files.js +13 -7
  12. package/dist/helpers/journal-files.js.map +1 -1
  13. package/dist/helpers/transcript-project.d.ts +69 -0
  14. package/dist/helpers/transcript-project.d.ts.map +1 -0
  15. package/dist/helpers/transcript-project.js +212 -0
  16. package/dist/helpers/transcript-project.js.map +1 -0
  17. package/dist/index.d.ts +28 -7
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +62 -6
  20. package/dist/index.js.map +1 -1
  21. package/dist/palace/awareness.d.ts +6 -0
  22. package/dist/palace/awareness.d.ts.map +1 -1
  23. package/dist/palace/awareness.js +10 -4
  24. package/dist/palace/awareness.js.map +1 -1
  25. package/dist/prompts/consolidation-prompt.js +14 -14
  26. package/dist/retrieval/activation.d.ts +202 -0
  27. package/dist/retrieval/activation.d.ts.map +1 -0
  28. package/dist/retrieval/activation.js +313 -0
  29. package/dist/retrieval/activation.js.map +1 -0
  30. package/dist/retrieval/candidates.d.ts +17 -0
  31. package/dist/retrieval/candidates.d.ts.map +1 -1
  32. package/dist/retrieval/candidates.js +4 -2
  33. package/dist/retrieval/candidates.js.map +1 -1
  34. package/dist/retrieval/contradiction.d.ts +42 -0
  35. package/dist/retrieval/contradiction.d.ts.map +1 -1
  36. package/dist/retrieval/contradiction.js +126 -7
  37. package/dist/retrieval/contradiction.js.map +1 -1
  38. package/dist/retrieval/lexical-index.d.ts +150 -0
  39. package/dist/retrieval/lexical-index.d.ts.map +1 -0
  40. package/dist/retrieval/lexical-index.js +514 -0
  41. package/dist/retrieval/lexical-index.js.map +1 -0
  42. package/dist/retrieval/query-memory.d.ts +17 -7
  43. package/dist/retrieval/query-memory.d.ts.map +1 -1
  44. package/dist/retrieval/query-memory.js +274 -68
  45. package/dist/retrieval/query-memory.js.map +1 -1
  46. package/dist/storage/classification.d.ts.map +1 -1
  47. package/dist/storage/classification.js +4 -1
  48. package/dist/storage/classification.js.map +1 -1
  49. package/dist/storage/content-guard.d.ts +26 -0
  50. package/dist/storage/content-guard.d.ts.map +1 -1
  51. package/dist/storage/content-guard.js +450 -48
  52. package/dist/storage/content-guard.js.map +1 -1
  53. package/dist/storage/corrections.d.ts +140 -2
  54. package/dist/storage/corrections.d.ts.map +1 -1
  55. package/dist/storage/corrections.js +144 -70
  56. package/dist/storage/corrections.js.map +1 -1
  57. package/dist/storage/cwd-allowlist.d.ts +28 -2
  58. package/dist/storage/cwd-allowlist.d.ts.map +1 -1
  59. package/dist/storage/cwd-allowlist.js +61 -13
  60. package/dist/storage/cwd-allowlist.js.map +1 -1
  61. package/dist/storage/filelock.d.ts +26 -8
  62. package/dist/storage/filelock.d.ts.map +1 -1
  63. package/dist/storage/filelock.js +202 -26
  64. package/dist/storage/filelock.js.map +1 -1
  65. package/dist/storage/fs-utils.d.ts +51 -0
  66. package/dist/storage/fs-utils.d.ts.map +1 -1
  67. package/dist/storage/fs-utils.js +123 -2
  68. package/dist/storage/fs-utils.js.map +1 -1
  69. package/dist/storage/heed-tiers.d.ts +206 -0
  70. package/dist/storage/heed-tiers.d.ts.map +1 -0
  71. package/dist/storage/heed-tiers.js +318 -0
  72. package/dist/storage/heed-tiers.js.map +1 -0
  73. package/dist/storage/memory-protocol.js +55 -55
  74. package/dist/storage/paths.d.ts.map +1 -1
  75. package/dist/storage/paths.js +7 -2
  76. package/dist/storage/paths.js.map +1 -1
  77. package/dist/storage/project.d.ts.map +1 -1
  78. package/dist/storage/project.js +9 -2
  79. package/dist/storage/project.js.map +1 -1
  80. package/dist/storage/store-manifest.js +57 -57
  81. package/dist/supabase/embedding.d.ts.map +1 -1
  82. package/dist/supabase/embedding.js +7 -0
  83. package/dist/supabase/embedding.js.map +1 -1
  84. package/dist/supabase/sync.d.ts +1 -1
  85. package/dist/supabase/sync.d.ts.map +1 -1
  86. package/dist/supabase/sync.js +88 -28
  87. package/dist/supabase/sync.js.map +1 -1
  88. package/dist/tools-logic/association.d.ts +260 -0
  89. package/dist/tools-logic/association.d.ts.map +1 -0
  90. package/dist/tools-logic/association.js +502 -0
  91. package/dist/tools-logic/association.js.map +1 -0
  92. package/dist/tools-logic/bootstrap.d.ts.map +1 -1
  93. package/dist/tools-logic/bootstrap.js +4 -2
  94. package/dist/tools-logic/bootstrap.js.map +1 -1
  95. package/dist/tools-logic/check-action.d.ts.map +1 -1
  96. package/dist/tools-logic/check-action.js +14 -0
  97. package/dist/tools-logic/check-action.js.map +1 -1
  98. package/dist/tools-logic/check.d.ts +7 -0
  99. package/dist/tools-logic/check.d.ts.map +1 -1
  100. package/dist/tools-logic/check.js +54 -44
  101. package/dist/tools-logic/check.js.map +1 -1
  102. package/dist/tools-logic/dream-admission.js +29 -29
  103. package/dist/tools-logic/implicit-harvest.d.ts +196 -0
  104. package/dist/tools-logic/implicit-harvest.d.ts.map +1 -0
  105. package/dist/tools-logic/implicit-harvest.js +675 -0
  106. package/dist/tools-logic/implicit-harvest.js.map +1 -0
  107. package/dist/tools-logic/insight-promotion.d.ts.map +1 -1
  108. package/dist/tools-logic/insight-promotion.js +53 -1
  109. package/dist/tools-logic/insight-promotion.js.map +1 -1
  110. package/dist/tools-logic/recall-backend.d.ts.map +1 -1
  111. package/dist/tools-logic/recall-backend.js +3 -1
  112. package/dist/tools-logic/recall-backend.js.map +1 -1
  113. package/dist/tools-logic/retier.d.ts +274 -0
  114. package/dist/tools-logic/retier.d.ts.map +1 -0
  115. package/dist/tools-logic/retier.js +511 -0
  116. package/dist/tools-logic/retier.js.map +1 -0
  117. package/dist/tools-logic/session-end.d.ts +35 -0
  118. package/dist/tools-logic/session-end.d.ts.map +1 -1
  119. package/dist/tools-logic/session-end.js +26 -7
  120. package/dist/tools-logic/session-end.js.map +1 -1
  121. package/dist/tools-logic/session-start.d.ts +11 -0
  122. package/dist/tools-logic/session-start.d.ts.map +1 -1
  123. package/dist/tools-logic/session-start.js +34 -4
  124. package/dist/tools-logic/session-start.js.map +1 -1
  125. package/dist/tools-logic/smart-recall.d.ts +63 -0
  126. package/dist/tools-logic/smart-recall.d.ts.map +1 -1
  127. package/dist/tools-logic/smart-recall.js +213 -31
  128. package/dist/tools-logic/smart-recall.js.map +1 -1
  129. package/dist/tools-logic/smart-remember-vector.d.ts +3 -1
  130. package/dist/tools-logic/smart-remember-vector.d.ts.map +1 -1
  131. package/dist/tools-logic/smart-remember-vector.js +3 -1
  132. package/dist/tools-logic/smart-remember-vector.js.map +1 -1
  133. package/dist/tools-logic/smart-remember.d.ts.map +1 -1
  134. package/dist/tools-logic/smart-remember.js +6 -2
  135. package/dist/tools-logic/smart-remember.js.map +1 -1
  136. package/dist/tools-logic/transcript-audit.d.ts +128 -0
  137. package/dist/tools-logic/transcript-audit.d.ts.map +1 -0
  138. package/dist/tools-logic/transcript-audit.js +428 -0
  139. package/dist/tools-logic/transcript-audit.js.map +1 -0
  140. package/dist/types.d.ts +17 -2
  141. package/dist/types.d.ts.map +1 -1
  142. package/dist/types.js +31 -3
  143. package/dist/types.js.map +1 -1
  144. package/dist/vector/embedding.d.ts +20 -1
  145. package/dist/vector/embedding.d.ts.map +1 -1
  146. package/dist/vector/embedding.js +27 -1
  147. package/dist/vector/embedding.js.map +1 -1
  148. package/dist/vector/local-vector-backend.d.ts +4 -1
  149. package/dist/vector/local-vector-backend.d.ts.map +1 -1
  150. package/dist/vector/local-vector-backend.js +7 -3
  151. package/dist/vector/local-vector-backend.js.map +1 -1
  152. package/package.json +59 -59
@@ -1 +1 @@
1
- {"version":3,"file":"content-guard.js","sourceRoot":"","sources":["../../src/storage/content-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAS;IAC5C,IAAI,CAAC;QACH,OAAO,CAAC;aACL,OAAO,CACN,wFAAwF,EACxF,gBAAgB,CACjB;aACA,OAAO,CAAC,wBAAwB,EAAE,YAAY,CAAC;aAC/C,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,sBAAsB;aAC/C,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,sCAAsC;AACtC,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,iFAAiF;AACjF,8EAA8E;AAC9E,iFAAiF;AACjF,MAAM,uBAAuB,GAAiD;IAC5E,EAAE,EAAE,EAAE,wBAAwB,EAAW,KAAK,EAAE,gBAAgB,EAAE;IAClE,EAAE,EAAE,EAAE,4BAA4B,EAAO,KAAK,EAAE,mBAAmB,EAAE;IACrE,EAAE,EAAE,EAAE,4BAA4B,EAAO,KAAK,EAAE,2BAA2B,EAAE;IAC7E,EAAE,EAAE,EAAE,4BAA4B,EAAO,KAAK,EAAE,yBAAyB,EAAE;IAC3E,EAAE,EAAE,EAAE,mCAAmC,EAAE,KAAK,EAAE,uCAAuC,EAAE;IAC3F,EAAE,EAAE,EAAE,2BAA2B,EAAQ,KAAK,EAAE,6BAA6B,EAAE;IAC/E,EAAE,EAAE,EAAE,6BAA6B,EAAM,KAAK,EAAE,mCAAmC,EAAE;IACrF,EAAE,EAAE,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a,GAAG,GAAG,CAAC,aAAa,KAAK,CAAC,EAAE,CAAC;YAC5E,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,yEAAyE;IACzE,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,OAAO,CAAC,aAAa,GAAG,cAAc,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,KAAK,CAAC,EAAE,CAAC;QAC1F,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,IAAI,eAAe,CACvB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,2BAA2B,CACrG,CAAC;AACJ,CAAC"}
@@ -21,6 +21,19 @@ import type { Confidence, DecayClass } from "../types.js";
21
21
  * silently rewrite old files, which the owner ruled out.
22
22
  */
23
23
  export type FailureClass = "wrong_ref" | "naming_violation" | "skipped_verify" | "scope_violation" | "model_dispatch" | "framing_error" | "confidential_leak" | "publish_gate" | "other";
24
+ /**
25
+ * Evolution p4 (2026-09-17) — the soft-constraint ladder `ar corrections
26
+ * retier` computes via `tierOf()` (tools-logic/retier.ts):
27
+ * "gate" — hard-enforced, non-negotiable (subset of p0)
28
+ * "nudge" — surfaced but advisory
29
+ * "watch" — background-only, lowest priority
30
+ * Declared HERE (storage layer) rather than in retier.ts because the field
31
+ * it types (`CorrectionRecord.tier` below) lives here — retier.ts (tools-
32
+ * logic) imports this type FROM corrections.ts, never the reverse, matching
33
+ * this file's existing "low-level storage layer never imports the
34
+ * tools-logic stack" discipline (see betaPosterior's doc comment below).
35
+ */
36
+ export type CorrectionTier = "gate" | "nudge" | "watch";
24
37
  export interface CorrectionRecord {
25
38
  id: string;
26
39
  date: string;
@@ -138,6 +151,29 @@ export interface CorrectionRecord {
138
151
  * caller's original, unmixed list.
139
152
  */
140
153
  applies_when?: string[];
154
+ /**
155
+ * Evolution p4 (2026-09-17, soft-constraint ladder) — the LAST-PERSISTED
156
+ * output of `tierOf(record, asOfDay)` (tools-logic/retier.ts), written
157
+ * ONLY by `ar corrections retier --write` via `setCorrectionTier()`
158
+ * below. ADDITIVE + OPTIONAL: absent on every pre-p4 record and on any
159
+ * record `ar corrections retier` has never touched.
160
+ *
161
+ * READ-CONTRACT (the CHALLENGE this field's design had to resolve): this
162
+ * is a WRITE-TIME CACHE, not truth. `heeded_count`/`recurrence_count`/
163
+ * `not_violated_count`/`last_retrieved` all keep accruing between retier
164
+ * runs, so `tierOf(record, today)` can legitimately disagree with this
165
+ * field the moment ANY outcome lands after the last `--write`. Consumers
166
+ * that need a CURRENT tier (e.g. a future session_start gating decision)
167
+ * MUST call `tierOf()` fresh — this field exists so `ar corrections
168
+ * retier --dry-run` can show "current [stored] vs computed" drift and so
169
+ * `--write` has something idempotent to compare against (a second
170
+ * `--write` with unchanged inputs writes nothing — see retier.ts). The
171
+ * session_start render tag (evolution p4 goal 3) ALSO recomputes fresh
172
+ * rather than reading this field, for the same reason. Never treat
173
+ * absence as "watch" by convention — absence means "never retiered",
174
+ * which is a different fact than "computed watch".
175
+ */
176
+ tier?: CorrectionTier;
141
177
  }
142
178
  /**
143
179
  * v4 W1 (2026-07-02 field-design-options.md §A.1) — provenance of a
@@ -192,8 +228,21 @@ export interface CorrectionOutcome {
192
228
  *
193
229
  * Backward-compatibility: old readers that filter on the pre-C3 kind set skip
194
230
  * these new kinds without error (confirmed: rmr-report.mjs, activity-feed.ts).
231
+ *
232
+ * Evolution p1a (2026-09-17) — transcript-audit ledger-only verdicts:
233
+ * "cited" = a day's project transcripts show ≥2 unique ≥4-char rule
234
+ * content-words in ASSISTANT text (or the correction id
235
+ * literal appears) — the correction's topic was surfaced.
236
+ * "ignored" = neither cited nor recurred — the correction was injected
237
+ * that day but never surfaced in the transcripts.
238
+ * Both are LEDGER-ONLY (see recordOutcome's early-return) and are
239
+ * single-producer-gated to evidence starting "transcript-audit:", exactly
240
+ * like "not_triggered"'s "dream-audit:" gate above. "recurred" from this
241
+ * same instrument reuses the EXISTING "recurred" kind (counter-mutating,
242
+ * intended) and is NOT gated — session-end and check-action already
243
+ * produce "recurred" from other evidence.
195
244
  */
196
- kind: "retrieved" | "heeded" | "recurred" | "predicted" | "predict_hit" | "triggered" | "not_triggered" | "unknown" | "not_violated";
245
+ kind: "retrieved" | "heeded" | "recurred" | "predicted" | "predict_hit" | "triggered" | "not_triggered" | "unknown" | "not_violated" | "cited" | "ignored";
197
246
  /**
198
247
  * SEMANTIC timestamp (ISO) — the day the outcome belongs to. The dream-audit
199
248
  * path (C3b) deliberately backdates this to the audited day so day-bucketed
@@ -507,6 +556,48 @@ export interface WriteCorrectionResult {
507
556
  id?: string;
508
557
  }
509
558
  export declare function distillRuleIdentity(rule: string): string;
559
+ export interface WriteCorrectionOptions {
560
+ /**
561
+ * Evolution p1b seam (2026-09-17, `ar corrections harvest-implicit` — see
562
+ * implicit-harvest.ts and its worker report for the CHALLENGE this closes).
563
+ *
564
+ * writeCorrection's ONLY gate was `isLikelyRealCorrection` — hard noise
565
+ * gates (length/system-fragment/doc-header) FUSED with the actionable-scan
566
+ * (STRONG/WEAK imperative + preference) and the soft-acknowledgment gate,
567
+ * with no seam to run just the hard gates. That is fine for every existing
568
+ * producer (check.ts's structured human_correction form, which is already
569
+ * imperative-shaped by construction), but a signal-miner over IMPLICIT
570
+ * conversational corrections (negation-opener re-instructions, again-
571
+ * markers, repeated near-identical instructions) deliberately captures text
572
+ * that often has NO clean imperative/preference shape — that is the entire
573
+ * point of mining implicit signal the explicit gate was never meant to see.
574
+ * Worse, the soft-ack gate would frequently REJECT exactly the negation-
575
+ * opener shape this miner targets ("No, that's wrong. <4+ words of
576
+ * re-instruction>" matches the ack pattern's own optional "that's wrong"
577
+ * clause when the re-instruction is short — the historical Loop-7 failure
578
+ * the actionable-scan rescue exists to prevent, replayed from the opposite
579
+ * side once that rescue is skipped).
580
+ *
581
+ * Forking a parallel write path was rejected (violates "storage via the
582
+ * canonical write path" — the whole point is to keep on-write consolidation
583
+ * dedup, atomic write, and index regen shared with every other producer).
584
+ * Refactoring isLikelyRealCorrection's internals were rejected too (v3/S-M3
585
+ * dropHardNoise/actionable-scan/soft-ack sequencing is a precision-tuned,
586
+ * heavily-regression-tested unit — see the doc comments above; splitting it
587
+ * would risk the Loop 7/8/14 regressions it exists to prevent).
588
+ *
589
+ * Minimal seam instead: an OPTIONAL 3rd parameter, additive only — every
590
+ * existing call site (dozens, see corrections.ts callers) omits it and gets
591
+ * byte-identical behavior. When `skipActionableGate` is true, the gate run
592
+ * is `dropHardNoise` ONLY (still exported, still unchanged, still the exact
593
+ * precision floor every other producer clears) — never the actionable scan,
594
+ * never the soft-ack gate. Callers that opt in accept full responsibility
595
+ * for their OWN signal-specific vetting (this is why the brief's severity/
596
+ * weight/confidence for implicit records are hard-floored low — see
597
+ * implicit-harvest.ts).
598
+ */
599
+ skipActionableGate?: boolean;
600
+ }
510
601
  /**
511
602
  * Write a correction to persistent storage.
512
603
  * Auto-detects severity from the rule/context text.
@@ -516,7 +607,7 @@ export declare function distillRuleIdentity(rule: string): string;
516
607
  * are unaffected (the return value was void, now it is an object; ignoring it
517
608
  * still compiles and runs correctly).
518
609
  */
519
- export declare function writeCorrection(project: string, correction: CorrectionRecord): Promise<WriteCorrectionResult>;
610
+ export declare function writeCorrection(project: string, correction: CorrectionRecord, opts?: WriteCorrectionOptions): Promise<WriteCorrectionResult>;
520
611
  /**
521
612
  * TEST-ONLY instrumentation log — one entry (the project slug) appended per
522
613
  * actual corrections-directory enumeration inside readCorrections() below
@@ -593,8 +684,46 @@ export declare function retractCorrection(project: string, id: string, reason?:
593
684
  * string MUST start with "dream-audit:". Any other producer throws. This is
594
685
  * the core-level enforcement of the single-producer contract (the CLI's
595
686
  * `ar outcomes record` is the one caller that adds the prefix).
687
+ * - `cited` / `ignored` (evolution p1a, transcript-audit) are gated the same
688
+ * way: evidence MUST start with "transcript-audit:". Any other producer
689
+ * throws. `recurred` produced by this SAME instrument reuses the shared
690
+ * "recurred" kind and carries a "transcript-audit:<basename>" evidence
691
+ * prefix too, but is NOT gated here — session-end and check-action are
692
+ * pre-existing, legitimate "recurred" producers with their own evidence
693
+ * shapes.
596
694
  */
597
695
  export declare function recordOutcome(outcome: CorrectionOutcome): Promise<void>;
696
+ export interface SetCorrectionTierResult {
697
+ written: boolean;
698
+ /** Present only when `written` is false because of a lock-contention skip. */
699
+ error?: string;
700
+ }
701
+ /**
702
+ * Evolution p4 (2026-09-17, soft-constraint ladder) — the SANCTIONED
703
+ * single-record write path `ar corrections retier --write` uses to persist
704
+ * `tierOf()`'s (tools-logic/retier.ts) computed tier onto a correction.
705
+ * Mirrors `retractCorrection`'s locked read→find→mutate→atomic-rewrite→
706
+ * index-regen shape EXACTLY (same lock name, same existing-filename reuse,
707
+ * same atomic-write primitive) — this is a NEW field being written through
708
+ * the EXISTING write mechanism, not a new write mechanism. ADDITIVE: only
709
+ * `tier` changes; every other field on the record is preserved byte-for-byte.
710
+ *
711
+ * IDEMPOTENT BY CONSTRUCTION: no-ops (returns `{written:false}`, touches
712
+ * disk not at all — no lock even acquired past the read) when the record
713
+ * already carries this exact tier. This is what makes a second
714
+ * `ar corrections retier --write` run over unchanged inputs write zero
715
+ * records (see retier.ts's own `changed` guard, which this double-checks
716
+ * against a FRESH read rather than trusting the caller's snapshot).
717
+ *
718
+ * Lock-contention handling mirrors `recordOutcome`, not `retractCorrection`:
719
+ * retier writes MANY records in one CLI invocation (a loop, not a single
720
+ * human-typed command), so one record's lock timeout must not abort the
721
+ * whole run — it is caught, logged, and reported to the caller as a skip
722
+ * (re-runnable later; `tier` is a derived cache, never a ledger, so nothing
723
+ * is lost by skipping — the next `ar corrections retier --write` recomputes
724
+ * it fresh from `tierOf()`, not from any partial state here).
725
+ */
726
+ export declare function setCorrectionTier(project: string, id: string, tier: CorrectionTier): Promise<SetCorrectionTierResult>;
598
727
  /** One `_outcomes.jsonl` line that failed to parse (or lacked required fields). */
599
728
  export interface MalformedOutcomeRow {
600
729
  /** 1-based line number within _outcomes.jsonl. */
@@ -647,6 +776,15 @@ export interface RecomputedCounters {
647
776
  * increment site, L1049/L1052).
648
777
  */
649
778
  export declare function recomputeCorrectionCounters(events: CorrectionOutcome[], record: Pick<CorrectionRecord, "weight" | "severity">): RecomputedCounters;
779
+ /**
780
+ * Public read-only view of the outcomes ledger, bucketed per correction id
781
+ * (fix12 hygiene, 2026-09-12). Thin wrapper over parseOutcomesLedger so KPI
782
+ * surfaces (`ar stats` evidence-tiered heed split via storage/heed-tiers.ts)
783
+ * can classify full event lists without re-implementing ledger parsing.
784
+ * Malformed lines are silently dropped here — callers that need the
785
+ * quarantine trail use runOutcomesRebuild's dry-run instead.
786
+ */
787
+ export declare function readOutcomeEventsByCorrection(project: string): Map<string, CorrectionOutcome[]>;
650
788
  /** One correction's before/after divergence, plus the on-disk record needed to apply the fix. */
651
789
  export interface DivergenceEntry {
652
790
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"corrections.d.ts","sourceRoot":"","sources":["../../src/storage/corrections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,cAAc,GACd,OAAO,CAAC;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,IAA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;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kFAAkF;IAClF,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,uBAAuB,EAAE,CAiG3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,gBAAgB,EAAE,GAAG,aAAa,CA4FhG;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,WAAW,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,oEAAoE;IACpE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gDAAgD;IAChD,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAW7G;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAsB/F"}
@@ -7,7 +7,7 @@
7
7
  import * as fs from "node:fs";
8
8
  import * as path from "node:path";
9
9
  import * as crypto from "node:crypto";
10
- import { ensureDir } from "./fs-utils.js";
10
+ import { ensureDir, renameAtomic } from "./fs-utils.js";
11
11
  import { byteCap, sanitizeName } from "./sanitize.js";
12
12
  import { journalDir, projectSubPath } from "./paths.js";
13
13
  import { withLock, LockContentionError } from "./filelock.js";
@@ -213,7 +213,7 @@ export function writeRecordAtomic(filepath, record) {
213
213
  // point for every persisted correction record.
214
214
  const tmp = `${filepath}.tmp.${process.pid}.${Date.now()}`;
215
215
  fs.writeFileSync(tmp, scrubForCloud(JSON.stringify(record, null, 2)), { encoding: "utf-8", mode: 0o600 });
216
- fs.renameSync(tmp, filepath);
216
+ renameAtomic(tmp, filepath); // win32 transient-EPERM retry — see fs-utils.ts
217
217
  }
218
218
  /** Sort rank for the corrections index — p0 first, unknown severities last. */
219
219
  function severityRank(severity) {
@@ -872,7 +872,7 @@ function normalizeRule(rule) {
872
872
  * are unaffected (the return value was void, now it is an object; ignoring it
873
873
  * still compiles and runs correctly).
874
874
  */
875
- export async function writeCorrection(project, correction) {
875
+ export async function writeCorrection(project, correction, opts) {
876
876
  // Capture-quality gate — reject noise before touching disk.
877
877
  // v3 (Loop 8): classify on the FULL correction text, not the truncated rule.
878
878
  // `rule` is a first-sentence title slice (set by check.ts) that hid the
@@ -884,10 +884,16 @@ export async function writeCorrection(project, correction) {
884
884
  // matched a hard gate is rejected regardless of which field it came from.
885
885
  const ruleText = (correction.rule ?? "").trim();
886
886
  const contextText = (correction.context ?? "").trim();
887
- const ruleGate = ruleText ? isLikelyRealCorrection(ruleText) : { ok: false, reason: "empty rule" };
887
+ // p1b seam — see WriteCorrectionOptions.skipActionableGate above.
888
+ const classify = (text) => opts?.skipActionableGate
889
+ ? dropHardNoise(text)
890
+ ? { ok: true }
891
+ : { ok: false, reason: "implicit-gate" }
892
+ : isLikelyRealCorrection(text);
893
+ const ruleGate = ruleText ? classify(ruleText) : { ok: false, reason: "empty rule" };
888
894
  // Only consult context when it adds NEW text (production: context ⊇ rule).
889
895
  const contextGate = contextText && contextText !== ruleText
890
- ? isLikelyRealCorrection(contextText)
896
+ ? classify(contextText)
891
897
  : { ok: false };
892
898
  const gate = ruleGate.ok || contextGate.ok ? { ok: true } : ruleGate;
893
899
  if (!gate.ok) {
@@ -1159,6 +1165,13 @@ export async function retractCorrection(project, id, reason, supersededBy) {
1159
1165
  * string MUST start with "dream-audit:". Any other producer throws. This is
1160
1166
  * the core-level enforcement of the single-producer contract (the CLI's
1161
1167
  * `ar outcomes record` is the one caller that adds the prefix).
1168
+ * - `cited` / `ignored` (evolution p1a, transcript-audit) are gated the same
1169
+ * way: evidence MUST start with "transcript-audit:". Any other producer
1170
+ * throws. `recurred` produced by this SAME instrument reuses the shared
1171
+ * "recurred" kind and carries a "transcript-audit:<basename>" evidence
1172
+ * prefix too, but is NOT gated here — session-end and check-action are
1173
+ * pre-existing, legitimate "recurred" producers with their own evidence
1174
+ * shapes.
1162
1175
  */
1163
1176
  export async function recordOutcome(outcome) {
1164
1177
  // C3b single-producer gate: not_triggered without the dream-audit evidence
@@ -1169,6 +1182,15 @@ export async function recordOutcome(outcome) {
1169
1182
  `evidence must start with "dream-audit:". Use \`ar outcomes record --kind not_triggered\` ` +
1170
1183
  `(it adds the prefix) instead of calling recordOutcome directly.`);
1171
1184
  }
1185
+ // Evolution p1a single-producer gate: cited/ignored without the
1186
+ // transcript-audit evidence prefix indicates an unauthorized producer —
1187
+ // mirrors the not_triggered gate above exactly.
1188
+ if ((outcome.kind === "cited" || outcome.kind === "ignored") &&
1189
+ !(outcome.evidence ?? "").startsWith("transcript-audit:")) {
1190
+ throw new Error(`recordOutcome: kind "${outcome.kind}" is only producible by the transcript-audit path — ` +
1191
+ `evidence must start with "transcript-audit:". Use \`ar outcomes audit\` ` +
1192
+ `(it adds the prefix) instead of calling recordOutcome directly.`);
1193
+ }
1172
1194
  const dir = correctionsDir(outcome.project);
1173
1195
  ensureDir(dir);
1174
1196
  // Append jsonl event (audit trail). recorded_at is the forensic wall-clock
@@ -1182,9 +1204,13 @@ export async function recordOutcome(outcome) {
1182
1204
  // nothing. Early-return after the jsonl append (the authoritative sink):
1183
1205
  // avoids a wasted betaPosterior + atomic rewrite on every check-action call
1184
1206
  // and keeps these hot-path kinds clear of the unlocked-RMW counter race.
1207
+ // Evolution p1a: cited/ignored join this same ledger-only set — neither
1208
+ // touches retrieved_count/heeded_count/recurrence_count/precision.
1185
1209
  if (outcome.kind === "triggered" ||
1186
1210
  outcome.kind === "not_triggered" ||
1187
- outcome.kind === "unknown") {
1211
+ outcome.kind === "unknown" ||
1212
+ outcome.kind === "cited" ||
1213
+ outcome.kind === "ignored") {
1188
1214
  return;
1189
1215
  }
1190
1216
  // ── LOCKED critical section (P0 data-loss fix, 2026-07-25) ────────────────
@@ -1203,80 +1229,60 @@ export async function recordOutcome(outcome) {
1203
1229
  // fix6-locks contention handling: the jsonl ledger line above is ALREADY
1204
1230
  // appended (append-only, lossless), and the materialized counters below are
1205
1231
  // fully re-derivable from that ledger via runOutcomesRebuild. So if another
1206
- // LIVE process holds the lock past the timeout, skipping this counter pass
1232
+ // LIVE process holds the lock past the hard cap, skipping this counter pass
1207
1233
  // loses NOTHING durable — log the skip and return instead of stealing the
1208
1234
  // lock (old behavior, mid-write corruption risk) or failing the caller's
1209
1235
  // hot path (session_start / session_end / check_action record inline).
1236
+ //
1237
+ // CI windows-latest regression fix (2026-10-12, run 38230438655): on a
1238
+ // starved 2-vCPU runner the audit stress (24 procs × 20 calls) skipped
1239
+ // 190/480 counter passes — a healthy holder descheduled past the 5s
1240
+ // no-progress deadline reads as "wedged" — and INCREMENT semantics turned
1241
+ // every skip into a permanently lost increment (materialized 290 vs ledger
1242
+ // 480). Two-part fix:
1243
+ // (1) LEDGER-DERIVED counters: the locked pass below RE-DERIVES this
1244
+ // correction's counters from its _outcomes.jsonl events via the exact
1245
+ // replay core `ar outcomes rebuild` uses (recomputeCorrectionCounters)
1246
+ // instead of incrementing the possibly-stale record — the counter is
1247
+ // honestly a CACHE of the ledger, so any earlier skip self-heals on
1248
+ // the next successful pass and materialized == ledger at rest.
1249
+ // (2) waitForLiveHolder: this caller opts out of the wedged-holder
1250
+ // heuristic — it waits while the holder PID probes alive (dead holders
1251
+ // still reclaim promptly) up to the 60s hard cap, so a starvation
1252
+ // misdiagnosis can no longer skip the pass at all. See
1253
+ // AcquireLockOptions in filelock.ts.
1210
1254
  try {
1211
1255
  await withLock(`corrections-${outcome.project}`, () => {
1212
1256
  // Update the per-correction file's counters.
1213
1257
  const target = readCorrections(outcome.project).find((r) => r.id === outcome.correction_id);
1214
1258
  if (!target)
1215
1259
  return; // outcome can still be replayed later if record is restored
1260
+ // Re-derive EVERY counter-derived field from this correction's ledger
1261
+ // events — the same parse → sortForReplay → recomputeCorrectionCounters
1262
+ // pipeline runOutcomesRebuild applies, so live writes and rebuild can
1263
+ // never disagree. The event appended above is already in the file, so
1264
+ // this pass covers the current outcome too. Per-kind increment formulas
1265
+ // live in recomputeCorrectionCounters (single implementation).
1266
+ const events = sortForReplay(parseOutcomesLedger(outcome.project).eventsByCorrectionId.get(outcome.correction_id) ?? []);
1267
+ const counters = recomputeCorrectionCounters(events, target);
1268
+ // Merge shape mirrors runOutcomesRebuild's apply pass EXACTLY (explicit
1269
+ // per-field assignment; an `undefined` overwrites a stale field, which
1270
+ // JSON.stringify then drops — same absent-vs-0 asymmetry as live writes).
1216
1271
  const updated = {
1217
1272
  ...target,
1218
- retrieved_count: target.retrieved_count ?? 0,
1219
- heeded_count: target.heeded_count ?? 0,
1220
- recurrence_count: target.recurrence_count ?? 0,
1273
+ retrieved_count: counters.retrieved_count,
1274
+ heeded_count: counters.heeded_count,
1275
+ recurrence_count: counters.recurrence_count,
1276
+ predicted_count: counters.predicted_count,
1277
+ predict_hits: counters.predict_hits,
1278
+ not_violated_count: counters.not_violated_count,
1279
+ last_retrieved: counters.last_retrieved,
1280
+ last_outcome: counters.last_outcome,
1281
+ last_predicted: counters.last_predicted,
1282
+ precision: counters.precision,
1283
+ predict_precision: counters.predict_precision,
1284
+ proof_confidence: counters.proof_confidence,
1221
1285
  };
1222
- if (outcome.kind === "retrieved") {
1223
- updated.retrieved_count = (updated.retrieved_count ?? 0) + 1;
1224
- updated.last_retrieved = outcome.at;
1225
- }
1226
- else if (outcome.kind === "heeded") {
1227
- updated.heeded_count = (updated.heeded_count ?? 0) + 1;
1228
- updated.last_outcome = outcome.at;
1229
- }
1230
- else if (outcome.kind === "recurred") {
1231
- updated.recurrence_count = (updated.recurrence_count ?? 0) + 1;
1232
- updated.last_outcome = outcome.at;
1233
- }
1234
- else if (outcome.kind === "predicted") {
1235
- // Wave 5: prediction fired — instrument the predict-the-correction loop.
1236
- updated.predicted_count = (updated.predicted_count ?? 0) + 1;
1237
- updated.last_predicted = outcome.at;
1238
- }
1239
- else if (outcome.kind === "predict_hit") {
1240
- updated.predict_hits = (updated.predict_hits ?? 0) + 1;
1241
- }
1242
- else if (outcome.kind === "not_violated") {
1243
- // Heed-rate credit model Option A (2026-08-29): its OWN counter, seeded
1244
- // only on its own first event (mirrors predicted_count/predict_hits'
1245
- // pattern, NOT the unconditional retrieved/heeded/recurrence baseline
1246
- // seed above) — deliberately kept out of precision/proof_confidence
1247
- // below, which read ONLY heeded_count/recurrence_count.
1248
- updated.not_violated_count = (updated.not_violated_count ?? 0) + 1;
1249
- updated.last_outcome = outcome.at;
1250
- }
1251
- const r = updated.retrieved_count ?? 0;
1252
- // Clamp to [0,1]: `retrieved` is guarded 1/day but `heeded` can fire on every
1253
- // session_end, so raw heeded/retrieved can exceed 1.0 ("150% heeded" is
1254
- // nonsense). min(1, …) keeps the metric honest. (Root-cause follow-up: apply
1255
- // the same 1/day guard to heeded as retrieved has, for finer resolution.)
1256
- // NB (Wave 5): `precision` is heeded/retrieved ONLY — predict_* never touch it.
1257
- updated.precision = r > 0 ? Math.min(1, Number(((updated.heeded_count ?? 0) / r).toFixed(3))) : undefined;
1258
- // Wave 5: predict_precision = predict_hits / predicted_count, kept SEPARATE
1259
- // from `precision`. Undefined until at least one prediction has fired.
1260
- // A predict_hit implies a prior prediction. If data is inconsistent (hits
1261
- // recorded without a matching predicted_count — e.g. migrated/corrupt records),
1262
- // floor the denominator at predict_hits so the metric stays VISIBLE and bounded
1263
- // rather than silently undefined while hits exist.
1264
- const pc = updated.predicted_count ?? 0;
1265
- const ph = updated.predict_hits ?? 0;
1266
- const predictDenom = Math.max(pc, ph);
1267
- updated.predict_precision = predictDenom > 0
1268
- ? Math.min(1, Number((ph / predictDenom).toFixed(3)))
1269
- : undefined;
1270
- // P3: evidence-grounded proof_confidence. With NO outcome evidence yet, keep the
1271
- // authority prior (weight); once heeded/recurrence accrue, move to the Beta
1272
- // posterior so a rule that keeps being honored strengthens and one whose bug
1273
- // keeps recurring weakens. Kept SEPARATE from `precision` (heeded/retrieved) and
1274
- // from `weight` (static authority) — this is the evidence axis.
1275
- const heededC = updated.heeded_count ?? 0;
1276
- const recurC = updated.recurrence_count ?? 0;
1277
- updated.proof_confidence = (heededC + recurC) > 0
1278
- ? Number(betaPosterior(heededC, recurC).toFixed(3))
1279
- : (updated.weight ?? defaultWeight(updated.severity));
1280
1286
  // Re-write the JSON file atomically (tmp + rename — prevents truncation on
1281
1287
  // SIGTERM). Reuse the EXISTING filename (see findExistingCorrectionFile
1282
1288
  // doc) — never recompute via slugify, or a v1-named file would orphan.
@@ -1290,18 +1296,75 @@ export async function recordOutcome(outcome) {
1290
1296
  // failure_class are all unchanged — so they deliberately skip this call,
1291
1297
  // preserving the existing hot-path optimization documented above.)
1292
1298
  regenerateCorrectionsIndex(outcome.project);
1293
- });
1299
+ }, { waitForLiveHolder: true });
1294
1300
  }
1295
1301
  catch (err) {
1296
1302
  if (err instanceof LockContentionError) {
1297
1303
  console.error(`[agent-recall] recordOutcome(${outcome.kind}, ${outcome.correction_id}): ${err.message} ` +
1298
1304
  `— materialized counter update skipped; the _outcomes.jsonl ledger already holds this ` +
1299
- `event and \`ar outcomes rebuild\` re-derives the counters.`);
1305
+ `event, the next successful recordOutcome pass re-derives ALL counters from the ledger ` +
1306
+ `(self-healing), and \`ar outcomes rebuild\` forces the same re-derivation on demand.`);
1300
1307
  return;
1301
1308
  }
1302
1309
  throw err;
1303
1310
  }
1304
1311
  }
1312
+ /**
1313
+ * Evolution p4 (2026-09-17, soft-constraint ladder) — the SANCTIONED
1314
+ * single-record write path `ar corrections retier --write` uses to persist
1315
+ * `tierOf()`'s (tools-logic/retier.ts) computed tier onto a correction.
1316
+ * Mirrors `retractCorrection`'s locked read→find→mutate→atomic-rewrite→
1317
+ * index-regen shape EXACTLY (same lock name, same existing-filename reuse,
1318
+ * same atomic-write primitive) — this is a NEW field being written through
1319
+ * the EXISTING write mechanism, not a new write mechanism. ADDITIVE: only
1320
+ * `tier` changes; every other field on the record is preserved byte-for-byte.
1321
+ *
1322
+ * IDEMPOTENT BY CONSTRUCTION: no-ops (returns `{written:false}`, touches
1323
+ * disk not at all — no lock even acquired past the read) when the record
1324
+ * already carries this exact tier. This is what makes a second
1325
+ * `ar corrections retier --write` run over unchanged inputs write zero
1326
+ * records (see retier.ts's own `changed` guard, which this double-checks
1327
+ * against a FRESH read rather than trusting the caller's snapshot).
1328
+ *
1329
+ * Lock-contention handling mirrors `recordOutcome`, not `retractCorrection`:
1330
+ * retier writes MANY records in one CLI invocation (a loop, not a single
1331
+ * human-typed command), so one record's lock timeout must not abort the
1332
+ * whole run — it is caught, logged, and reported to the caller as a skip
1333
+ * (re-runnable later; `tier` is a derived cache, never a ledger, so nothing
1334
+ * is lost by skipping — the next `ar corrections retier --write` recomputes
1335
+ * it fresh from `tierOf()`, not from any partial state here).
1336
+ */
1337
+ export async function setCorrectionTier(project, id, tier) {
1338
+ const dir = correctionsDir(project);
1339
+ try {
1340
+ return await withLock(`corrections-${project}`, () => {
1341
+ const target = readCorrections(project).find((r) => r.id === id);
1342
+ if (!target)
1343
+ return { written: false, error: `correction not found: ${id}` };
1344
+ if (target.tier === tier)
1345
+ return { written: false }; // already correct — idempotent no-op
1346
+ const updated = { ...target, tier };
1347
+ const filename = findExistingCorrectionFile(dir, updated.id)
1348
+ ?? `${updated.date}--${slugify(updated.rule || updated.id)}.json`;
1349
+ const filepath = path.join(dir, filename);
1350
+ writeRecordAtomic(filepath, updated);
1351
+ // W2-1: regenerate the materialized index on every corrections mutation.
1352
+ // `tier` is not one of `_index.md`'s rendered columns today, but this
1353
+ // keeps the invariant "every mutation regenerates the index" uniform
1354
+ // rather than carving out a silent exception for this one writer.
1355
+ regenerateCorrectionsIndex(project);
1356
+ return { written: true };
1357
+ });
1358
+ }
1359
+ catch (err) {
1360
+ if (err instanceof LockContentionError) {
1361
+ console.error(`[agent-recall] setCorrectionTier(${id}, ${tier}): ${err.message} ` +
1362
+ `— tier update skipped this run; a later \`ar corrections retier --write\` will retry.`);
1363
+ return { written: false, error: "lock contention" };
1364
+ }
1365
+ throw err;
1366
+ }
1367
+ }
1305
1368
  /**
1306
1369
  * Outcome kinds that affect per-correction counters (mirrors recordOutcome's
1307
1370
  * early-return for triggered/not_triggered/unknown — those are ledger-only).
@@ -1514,6 +1577,17 @@ function parseOutcomesLedger(project) {
1514
1577
  }
1515
1578
  return { malformedRows, eventsByCorrectionId };
1516
1579
  }
1580
+ /**
1581
+ * Public read-only view of the outcomes ledger, bucketed per correction id
1582
+ * (fix12 hygiene, 2026-09-12). Thin wrapper over parseOutcomesLedger so KPI
1583
+ * surfaces (`ar stats` evidence-tiered heed split via storage/heed-tiers.ts)
1584
+ * can classify full event lists without re-implementing ledger parsing.
1585
+ * Malformed lines are silently dropped here — callers that need the
1586
+ * quarantine trail use runOutcomesRebuild's dry-run instead.
1587
+ */
1588
+ export function readOutcomeEventsByCorrection(project) {
1589
+ return parseOutcomesLedger(project).eventsByCorrectionId;
1590
+ }
1517
1591
  /** Snapshot of a correction's CURRENT on-disk counter/derived fields (before any rebuild). */
1518
1592
  function currentCountersOf(r) {
1519
1593
  return {