@remnic/core 9.3.737 → 9.3.739

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 (144) hide show
  1. package/dist/access-boundary.d.ts +6 -6
  2. package/dist/access-boundary.js +10 -10
  3. package/dist/access-cli.js +26 -26
  4. package/dist/access-http.d.ts +6 -6
  5. package/dist/access-http.js +15 -15
  6. package/dist/access-mcp.d.ts +6 -6
  7. package/dist/access-mcp.js +14 -14
  8. package/dist/access-operations-batch.js +12 -12
  9. package/dist/access-operations.d.ts +6 -6
  10. package/dist/access-operations.js +13 -13
  11. package/dist/{access-service-DwQ6BIQw.d.ts → access-service-Cbk-Kv_A.d.ts} +1 -1
  12. package/dist/access-service.d.ts +6 -6
  13. package/dist/access-service.js +9 -9
  14. package/dist/access-surface-catalog.d.ts +6 -6
  15. package/dist/active-memory-bridge.js +3 -3
  16. package/dist/bootstrap.d.ts +5 -5
  17. package/dist/buffer.js +2 -1
  18. package/dist/capabilities.d.ts +98 -1
  19. package/dist/capabilities.js +7 -1
  20. package/dist/{chunk-G54IDCD3.js → chunk-23PLOBWT.js} +30 -27
  21. package/dist/chunk-23PLOBWT.js.map +1 -0
  22. package/dist/{chunk-K3Y2SJTN.js → chunk-56LP72AD.js} +6 -6
  23. package/dist/{chunk-ZBZ4XULO.js → chunk-66RZ4EIT.js} +3 -3
  24. package/dist/{chunk-IPI45Q4S.js → chunk-75PDC7VT.js} +9 -8
  25. package/dist/chunk-75PDC7VT.js.map +1 -0
  26. package/dist/{chunk-GB2FZOWB.js → chunk-7B7IPPN5.js} +5 -5
  27. package/dist/{chunk-QNTLWH3T.js → chunk-A7INTIC5.js} +3 -3
  28. package/dist/{chunk-FLPKEMSO.js → chunk-AKKFHN3I.js} +2 -2
  29. package/dist/{chunk-AAIHDIMD.js → chunk-BHJAMSVC.js} +7 -7
  30. package/dist/{chunk-BXPG5AVX.js → chunk-BHQQVUEQ.js} +6 -6
  31. package/dist/{chunk-HFXZIF3V.js → chunk-BVG2IZOB.js} +3 -3
  32. package/dist/{chunk-NDKW67ER.js → chunk-C53JDEH3.js} +4 -4
  33. package/dist/{chunk-AESC5OQJ.js → chunk-CKHPUOAP.js} +2 -2
  34. package/dist/{chunk-OYHYBHHI.js → chunk-DS3FZ7GS.js} +4 -4
  35. package/dist/{chunk-UO6MPN77.js → chunk-EU543UDC.js} +10 -9
  36. package/dist/chunk-EU543UDC.js.map +1 -0
  37. package/dist/{chunk-PB5YON2G.js → chunk-IEWUPZ75.js} +659 -584
  38. package/dist/chunk-IEWUPZ75.js.map +1 -0
  39. package/dist/{chunk-E4LYJ7PY.js → chunk-IFCM6OLK.js} +6 -6
  40. package/dist/{chunk-5BOQNB2K.js → chunk-JQSP7YBJ.js} +3 -3
  41. package/dist/{chunk-2T2N7ISV.js → chunk-L3TYGUTH.js} +3 -3
  42. package/dist/{chunk-AB2E5DCN.js → chunk-MAU7DFCJ.js} +2 -2
  43. package/dist/{chunk-P6VLG7KE.js → chunk-N2O23WYA.js} +2 -2
  44. package/dist/{chunk-HYNHLBKA.js → chunk-OQQRWPFZ.js} +5 -2
  45. package/dist/chunk-OQQRWPFZ.js.map +1 -0
  46. package/dist/{chunk-IXGXALRV.js → chunk-QTJOORGN.js} +2 -2
  47. package/dist/{chunk-JWDE7OVJ.js → chunk-RJBW4EOU.js} +46 -2
  48. package/dist/{chunk-JWDE7OVJ.js.map → chunk-RJBW4EOU.js.map} +1 -1
  49. package/dist/{chunk-AE7NTZ75.js → chunk-TNLXCSXV.js} +3 -3
  50. package/dist/{chunk-NNJKEAP2.js → chunk-VRBBZH4U.js} +4 -4
  51. package/dist/{chunk-VOEVVIP3.js → chunk-W2FBVBQ4.js} +4 -4
  52. package/dist/{chunk-WNGXQMRI.js → chunk-WFNH4UDF.js} +5 -2
  53. package/dist/chunk-WFNH4UDF.js.map +1 -0
  54. package/dist/{chunk-CHJIWG2H.js → chunk-WVAEIKUY.js} +2 -2
  55. package/dist/{chunk-FF36YNKY.js → chunk-XIQAOGAA.js} +11 -10
  56. package/dist/chunk-XIQAOGAA.js.map +1 -0
  57. package/dist/{chunk-HLPYL6LC.js → chunk-Y5OOHER4.js} +14 -12
  58. package/dist/chunk-Y5OOHER4.js.map +1 -0
  59. package/dist/{chunk-GYICIICQ.js → chunk-YF2MMBKA.js} +9 -7
  60. package/dist/chunk-YF2MMBKA.js.map +1 -0
  61. package/dist/{chunk-IX4L7E5G.js → chunk-YXOXAQ5Y.js} +2 -2
  62. package/dist/{cli-BlEIWDQw.d.ts → cli-BQW2xKdb.d.ts} +2 -2
  63. package/dist/cli.d.ts +7 -7
  64. package/dist/cli.js +21 -21
  65. package/dist/compounding/engine.js +2 -2
  66. package/dist/contradiction/index.js +2 -2
  67. package/dist/{contradiction-scan-2B4AE4TI.js → contradiction-scan-CWO3LIWV.js} +3 -3
  68. package/dist/embedding-fallback.js +2 -2
  69. package/dist/entity-retrieval.js +2 -2
  70. package/dist/explicit-capture.d.ts +5 -5
  71. package/dist/explicit-capture.js +2 -2
  72. package/dist/extraction.js +3 -3
  73. package/dist/{first-start-migration-2RQYDIZ7.js → first-start-migration-5DXD3TF2.js} +2 -2
  74. package/dist/index.d.ts +8 -8
  75. package/dist/index.js +32 -32
  76. package/dist/local-llm.js +2 -2
  77. package/dist/mcp-memory-inspector-app.d.ts +6 -6
  78. package/dist/namespaces/migrate.js +6 -6
  79. package/dist/namespaces/principal.js +2 -2
  80. package/dist/namespaces/search.js +4 -4
  81. package/dist/namespaces/storage.js +2 -2
  82. package/dist/operator-toolkit.js +11 -11
  83. package/dist/orchestration/compression-guideline-coordinator.js +2 -2
  84. package/dist/orchestration/maintenance.js +6 -6
  85. package/dist/{orchestrator-CJZ21ZiB.d.ts → orchestrator-BOAFN_Yr.d.ts} +186 -56
  86. package/dist/orchestrator.d.ts +4 -4
  87. package/dist/orchestrator.js +21 -21
  88. package/dist/search/embed-helper.js +2 -2
  89. package/dist/search/factory.js +3 -3
  90. package/dist/search/index.js +3 -3
  91. package/dist/summarizer.js +3 -3
  92. package/dist/{tier-stats-KPDIISG7.js → tier-stats-QID73BBB.js} +2 -2
  93. package/package.json +2 -2
  94. package/src/access-service.ts +7 -8
  95. package/src/buffer.ts +2 -1
  96. package/src/capabilities.test.ts +137 -0
  97. package/src/capabilities.ts +209 -0
  98. package/src/cli/creation-ledger-commands.ts +3 -3
  99. package/src/cli/research-status-commands.ts +4 -4
  100. package/src/cli.ts +9 -10
  101. package/src/compounding/engine.ts +7 -7
  102. package/src/correction/correction-access-wiring.ts +3 -2
  103. package/src/extraction.ts +8 -10
  104. package/src/operator-toolkit.ts +6 -7
  105. package/src/orchestration/conversation-index-coordinator.ts +344 -0
  106. package/src/orchestration/entity-synthesis-coordinator.ts +2 -1
  107. package/src/orchestration/maintenance.ts +5 -7
  108. package/src/orchestration/recall-rerank-coordinator.ts +425 -0
  109. package/src/orchestration/semantic-consolidation-coordinator.ts +2 -2
  110. package/src/orchestrator.ts +88 -602
  111. package/dist/chunk-FF36YNKY.js.map +0 -1
  112. package/dist/chunk-G54IDCD3.js.map +0 -1
  113. package/dist/chunk-GYICIICQ.js.map +0 -1
  114. package/dist/chunk-HLPYL6LC.js.map +0 -1
  115. package/dist/chunk-HYNHLBKA.js.map +0 -1
  116. package/dist/chunk-IPI45Q4S.js.map +0 -1
  117. package/dist/chunk-PB5YON2G.js.map +0 -1
  118. package/dist/chunk-UO6MPN77.js.map +0 -1
  119. package/dist/chunk-WNGXQMRI.js.map +0 -1
  120. /package/dist/{chunk-K3Y2SJTN.js.map → chunk-56LP72AD.js.map} +0 -0
  121. /package/dist/{chunk-ZBZ4XULO.js.map → chunk-66RZ4EIT.js.map} +0 -0
  122. /package/dist/{chunk-GB2FZOWB.js.map → chunk-7B7IPPN5.js.map} +0 -0
  123. /package/dist/{chunk-QNTLWH3T.js.map → chunk-A7INTIC5.js.map} +0 -0
  124. /package/dist/{chunk-FLPKEMSO.js.map → chunk-AKKFHN3I.js.map} +0 -0
  125. /package/dist/{chunk-AAIHDIMD.js.map → chunk-BHJAMSVC.js.map} +0 -0
  126. /package/dist/{chunk-BXPG5AVX.js.map → chunk-BHQQVUEQ.js.map} +0 -0
  127. /package/dist/{chunk-HFXZIF3V.js.map → chunk-BVG2IZOB.js.map} +0 -0
  128. /package/dist/{chunk-NDKW67ER.js.map → chunk-C53JDEH3.js.map} +0 -0
  129. /package/dist/{chunk-AESC5OQJ.js.map → chunk-CKHPUOAP.js.map} +0 -0
  130. /package/dist/{chunk-OYHYBHHI.js.map → chunk-DS3FZ7GS.js.map} +0 -0
  131. /package/dist/{chunk-E4LYJ7PY.js.map → chunk-IFCM6OLK.js.map} +0 -0
  132. /package/dist/{chunk-5BOQNB2K.js.map → chunk-JQSP7YBJ.js.map} +0 -0
  133. /package/dist/{chunk-2T2N7ISV.js.map → chunk-L3TYGUTH.js.map} +0 -0
  134. /package/dist/{chunk-AB2E5DCN.js.map → chunk-MAU7DFCJ.js.map} +0 -0
  135. /package/dist/{chunk-P6VLG7KE.js.map → chunk-N2O23WYA.js.map} +0 -0
  136. /package/dist/{chunk-IXGXALRV.js.map → chunk-QTJOORGN.js.map} +0 -0
  137. /package/dist/{chunk-AE7NTZ75.js.map → chunk-TNLXCSXV.js.map} +0 -0
  138. /package/dist/{chunk-NNJKEAP2.js.map → chunk-VRBBZH4U.js.map} +0 -0
  139. /package/dist/{chunk-VOEVVIP3.js.map → chunk-W2FBVBQ4.js.map} +0 -0
  140. /package/dist/{chunk-CHJIWG2H.js.map → chunk-WVAEIKUY.js.map} +0 -0
  141. /package/dist/{chunk-IX4L7E5G.js.map → chunk-YXOXAQ5Y.js.map} +0 -0
  142. /package/dist/{contradiction-scan-2B4AE4TI.js.map → contradiction-scan-CWO3LIWV.js.map} +0 -0
  143. /package/dist/{first-start-migration-2RQYDIZ7.js.map → first-start-migration-5DXD3TF2.js.map} +0 -0
  144. /package/dist/{tier-stats-KPDIISG7.js.map → tier-stats-QID73BBB.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  NamespaceStorageRouter
3
- } from "./chunk-NNJKEAP2.js";
3
+ } from "./chunk-VRBBZH4U.js";
4
4
  import {
5
5
  namespaceCollectionName
6
- } from "./chunk-ZBZ4XULO.js";
6
+ } from "./chunk-66RZ4EIT.js";
7
7
  import {
8
8
  namespaceIdentityFromToken,
9
9
  namespaceIdentityToken
@@ -11,12 +11,12 @@ import {
11
11
  import {
12
12
  ALL_CATEGORY_DIRS
13
13
  } from "./chunk-VS2IYZRU.js";
14
- import {
15
- resolveNamespaceCapabilities
16
- } from "./chunk-JWDE7OVJ.js";
17
14
  import {
18
15
  isSafeRouteNamespace
19
16
  } from "./chunk-U3PN77QT.js";
17
+ import {
18
+ resolveNamespaceCapabilities
19
+ } from "./chunk-RJBW4EOU.js";
20
20
 
21
21
  // src/namespaces/migrate.ts
22
22
  import path from "path";
@@ -207,4 +207,4 @@ export {
207
207
  verifyNamespaces,
208
208
  runNamespaceMigration
209
209
  };
210
- //# sourceMappingURL=chunk-K3Y2SJTN.js.map
210
+ //# sourceMappingURL=chunk-56LP72AD.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createSearchBackend
3
- } from "./chunk-5BOQNB2K.js";
3
+ } from "./chunk-JQSP7YBJ.js";
4
4
  import {
5
5
  namespaceIdentityToken,
6
6
  normalizeNamespaceIdentity
7
7
  } from "./chunk-ZFXCQPNO.js";
8
8
  import {
9
9
  resolveNamespaceCapabilities
10
- } from "./chunk-JWDE7OVJ.js";
10
+ } from "./chunk-RJBW4EOU.js";
11
11
 
12
12
  // src/namespaces/search.ts
13
13
  import path from "path";
@@ -404,4 +404,4 @@ export {
404
404
  namespaceCollectionName,
405
405
  NamespaceSearchRouter
406
406
  };
407
- //# sourceMappingURL=chunk-ZBZ4XULO.js.map
407
+ //# sourceMappingURL=chunk-66RZ4EIT.js.map
@@ -9,8 +9,9 @@ import {
9
9
  parseContinuityImprovementLoops
10
10
  } from "./chunk-LDXUBPMO.js";
11
11
  import {
12
+ resolveConsolidationCapabilities,
12
13
  resolveQmdCapabilities
13
- } from "./chunk-JWDE7OVJ.js";
14
+ } from "./chunk-RJBW4EOU.js";
14
15
  import {
15
16
  sanitizeMemoryContent
16
17
  } from "./chunk-5GKPFL3S.js";
@@ -259,7 +260,7 @@ var CompoundingEngine = class {
259
260
  const previousMistakes = await this.readMistakes();
260
261
  const mistakes = this.buildMistakes(entries, actionPatterns, weekId, previousMistakes?.registry ?? []);
261
262
  const rubrics = this.buildRubricSnapshot(entries, outcomeSummary);
262
- let promotionCandidates = this.config.compoundingSemanticEnabled ? this.derivePromotionCandidates(outcomeSummary, mistakes.registry, rubrics) : [];
263
+ let promotionCandidates = resolveConsolidationCapabilities(this.config).compoundingSemantic ? this.derivePromotionCandidates(outcomeSummary, mistakes.registry, rubrics) : [];
263
264
  if (this.config.cmcConsolidationEnabled) {
264
265
  try {
265
266
  const { deriveCausalPromotionCandidates, materializeAfterCausalConsolidation } = await import("./causal-consolidation.js");
@@ -294,7 +295,7 @@ var CompoundingEngine = class {
294
295
  log.warn(`[cmc] causal consolidation in synthesizeWeekly failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);
295
296
  }
296
297
  }
297
- if (this.config.calibrationEnabled) {
298
+ if (resolveConsolidationCapabilities(this.config).calibration) {
298
299
  try {
299
300
  const { runCalibrationConsolidation } = await import("./calibration.js");
300
301
  const calRules = await runCalibrationConsolidation({
@@ -309,7 +310,7 @@ var CompoundingEngine = class {
309
310
  log.warn(`[calibration] weekly consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);
310
311
  }
311
312
  }
312
- const continuity = this.config.continuityAuditEnabled ? await this.readContinuityAuditReferences(weekId) : { monthId: monthIdFromIsoWeek(weekId), weeklyPath: null, monthlyPath: null };
313
+ const continuity = resolveConsolidationCapabilities(this.config).continuityAudit ? await this.readContinuityAuditReferences(weekId) : { monthId: monthIdFromIsoWeek(weekId), weeklyPath: null, monthlyPath: null };
313
314
  const reportPath = path.join(this.weeklyDir, `${weekId}.md`);
314
315
  const md = this.formatWeeklyReport(weekId, entries, mistakes.patterns, mistakes.details, continuity, outcomeSummary, promotionCandidates);
315
316
  await writeFile(reportPath, md, "utf-8");
@@ -379,7 +380,7 @@ var CompoundingEngine = class {
379
380
  }
380
381
  async promoteCandidate(opts) {
381
382
  const report = {
382
- enabled: this.config.compoundingEnabled === true && this.config.compoundingSemanticEnabled === true,
383
+ enabled: resolveConsolidationCapabilities(this.config).compounding === true && resolveConsolidationCapabilities(this.config).compoundingSemantic === true,
383
384
  dryRun: opts.dryRun === true,
384
385
  weekId: opts.weekId,
385
386
  promoted: [],
@@ -991,7 +992,7 @@ var CompoundingEngine = class {
991
992
  }
992
993
  }
993
994
  lines.push("");
994
- if (this.config.compoundingSemanticEnabled) {
995
+ if (resolveConsolidationCapabilities(this.config).compoundingSemantic) {
995
996
  lines.push("## Promotion Candidates (Advisory)");
996
997
  if (promotionCandidates.length === 0) {
997
998
  lines.push("- (no advisory promotion candidates this week)");
@@ -1007,7 +1008,7 @@ var CompoundingEngine = class {
1007
1008
  lines.push("_Advisory only: no automatic promotion write is performed by this report. Use `compounding_promote_candidate` or `openclaw engram compounding-promote` to persist one manually._");
1008
1009
  lines.push("");
1009
1010
  }
1010
- if (this.config.continuityAuditEnabled) {
1011
+ if (resolveConsolidationCapabilities(this.config).continuityAudit) {
1011
1012
  lines.push("## Continuity Audits");
1012
1013
  if (continuity.weeklyPath) {
1013
1014
  lines.push(`- weekly: ${continuity.weeklyPath}`);
@@ -1274,4 +1275,4 @@ export {
1274
1275
  defaultTierMigrationCycleBudget,
1275
1276
  CompoundingEngine
1276
1277
  };
1277
- //# sourceMappingURL=chunk-IPI45Q4S.js.map
1278
+ //# sourceMappingURL=chunk-75PDC7VT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/compounding/engine.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { mkdir, readFile, readdir, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { log } from \"../logger.js\";\nimport { sanitizeMemoryContent } from \"../sanitize.js\";\nimport { StorageManager } from \"../storage.js\";\nimport type { ContinuityIncidentRecord, PluginConfig } from \"../types.js\";\nimport { resolveSharedContextDir, SharedFeedbackEntrySchema, type SharedFeedbackEntry } from \"../shared-context/manager.js\";\nimport { parseContinuityImprovementLoops } from \"../identity-continuity.js\";\nimport { resolveQmdCapabilities, type QmdConfigProjection, resolveConsolidationCapabilities } from \"../capabilities.js\";\n\ntype MistakesFile = {\n version?: number;\n updatedAt: string;\n patterns: string[];\n registry?: MistakeRegistryEntry[];\n};\n\ntype FeedbackEntryWithProvenance = {\n entry: SharedFeedbackEntry;\n sourceLine: number;\n sourcePath: string;\n entryId: string;\n};\n\ntype PatternWithProvenance = {\n pattern: string;\n provenance: string[];\n};\n\ntype ActionOutcomeCounts = {\n applied: number;\n skipped: number;\n failed: number;\n};\n\ntype ActionOutcomeSummary = {\n action: string;\n counts: ActionOutcomeCounts;\n total: number;\n weightedScore: number;\n provenance: string[];\n};\n\ntype PromotionCandidate = {\n id: string;\n sourceType: \"action-outcome\" | \"mistake-pattern\" | \"rubric\" | \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: ActionOutcomeCounts | null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n};\n\ntype CompoundingEntrySeverity = \"low\" | \"medium\" | \"high\";\n\ntype EvidenceWindow = {\n start: string | null;\n end: string | null;\n};\n\ntype MistakeRegistryEntry = {\n id: string;\n pattern: string;\n category: \"feedback\" | \"action\";\n status: \"active\" | \"retired\";\n agent: string | null;\n workflow: string | null;\n tags: string[];\n severity: CompoundingEntrySeverity | null;\n confidence: number | null;\n outcome: string | null;\n provenance: string[];\n firstSeenAt: string;\n lastSeenAt: string;\n recurrenceCount: number;\n lastWeekId: string;\n evidenceWindow: EvidenceWindow;\n mergedFromIds?: string[];\n retiredAt?: string | null;\n};\n\ntype RubricSnapshotEntry = {\n id: string;\n kind: \"agent\" | \"workflow\";\n subject: string;\n observations: string[];\n tags: string[];\n provenance: string[];\n observationEntries?: Array<{\n note: string;\n provenance: string[];\n }>;\n updatedAt: string;\n};\n\ntype RubricSnapshot = {\n updatedAt: string;\n agents: RubricSnapshotEntry[];\n workflows: RubricSnapshotEntry[];\n};\n\ntype WeeklyCompoundingArtifact = {\n version: number;\n generatedAt: string;\n weekId: string;\n feedback: {\n count: number;\n byDecision: Record<\"approved\" | \"approved_with_feedback\" | \"rejected\", number>;\n entries: Array<{\n agent: string;\n workflow: string | null;\n decision: SharedFeedbackEntry[\"decision\"];\n reason: string;\n learning: string | null;\n outcome: string | null;\n severity: CompoundingEntrySeverity | null;\n confidence: number | null;\n tags: string[];\n provenance: string;\n evidenceWindow: EvidenceWindow;\n }>;\n };\n mistakes: {\n count: number;\n patterns: string[];\n registry: MistakeRegistryEntry[];\n };\n rubrics: RubricSnapshot;\n outcomes: ActionOutcomeSummary[];\n promotionCandidates: PromotionCandidate[];\n continuity: { monthId: string; weeklyPath: string | null; monthlyPath: string | null };\n};\n\nexport interface CompoundingPromotionReport {\n enabled: boolean;\n dryRun: boolean;\n weekId: string;\n promoted: Array<{\n id: string;\n candidateId: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n confidence: number;\n tags: string[];\n lineage: string[];\n }>;\n skipped: Array<{\n weekId: string;\n candidateId?: string;\n reason: \"disabled\" | \"weekly-artifact-missing\" | \"candidate-not-found\" | \"duplicate-guidance\";\n existingMemoryId?: string;\n }>;\n /**\n * Promotions the #1579 tombstone chokepoint downgraded to pending_review (no\n * active copy). Reported distinctly so callers never treat a blocked write as\n * a successfully promoted active memory (#1645).\n */\n tombstoneBlocked: Array<{\n id: string;\n candidateId: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n }>;\n}\n\ntype WeeklyActionEvent = {\n line: number;\n action: string;\n outcome: \"applied\" | \"skipped\" | \"failed\";\n policyDecision: \"deny\" | \"defer\" | null;\n namespace: string;\n reason: string | null;\n};\n\nconst COMPOUNDING_VERSION = 2;\nconst RETIREMENT_WINDOW_WEEKS = 8;\n\nfunction stableSlug(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 80) || \"item\";\n}\n\nfunction tokenizeRecallQuery(text: string): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const token of text\n .toLowerCase()\n .replace(/[^a-z0-9\\s]+/g, \" \")\n .split(/\\s+/)\n .map((part) => part.trim())\n .filter((part) => part.length >= 3)) {\n if (seen.has(token)) continue;\n seen.add(token);\n out.push(token);\n }\n return out;\n}\n\nfunction weekIdToIndex(weekId: string): number {\n const match = weekId.match(/^(\\d{4})-W(\\d{2})$/);\n if (!match) return Number.POSITIVE_INFINITY;\n const year = Number(match[1]);\n const week = Number(match[2]);\n if (!Number.isInteger(year) || !Number.isInteger(week) || week < 1 || week > 53) {\n return Number.POSITIVE_INFINITY;\n }\n const jan4 = new Date(Date.UTC(year, 0, 4));\n const jan4Day = jan4.getUTCDay() || 7;\n const isoWeekOneStart = new Date(jan4);\n isoWeekOneStart.setUTCDate(jan4.getUTCDate() - (jan4Day - 1));\n const targetWeekStart = new Date(isoWeekOneStart);\n targetWeekStart.setUTCDate(isoWeekOneStart.getUTCDate() + ((week - 1) * 7));\n return Math.floor(targetWeekStart.getTime() / (7 * 24 * 60 * 60 * 1000));\n}\n\nfunction normalizeConfidence(value: unknown): number | null {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return null;\n const clamped = Math.max(0, Math.min(1, value));\n return Number(clamped.toFixed(3));\n}\n\nfunction normalizeTags(tags: string[] | undefined): string[] {\n if (!Array.isArray(tags)) return [];\n return [...new Set(tags.map((tag) => String(tag).trim()).filter((tag) => tag.length > 0))].sort();\n}\n\nfunction normalizeEvidenceWindow(start?: string, end?: string): EvidenceWindow {\n const safeStart = typeof start === \"string\" && start.trim().length > 0 ? start : null;\n const safeEnd = typeof end === \"string\" && end.trim().length > 0 ? end : null;\n return { start: safeStart, end: safeEnd };\n}\n\nfunction mergeEvidenceWindows(current: EvidenceWindow, next: EvidenceWindow): EvidenceWindow {\n return {\n start: current.start === null ? next.start : next.start === null ? current.start : current.start <= next.start ? current.start : next.start,\n end: current.end === null ? next.end : next.end === null ? current.end : current.end >= next.end ? current.end : next.end,\n };\n}\n\nfunction stableMistakeId(\n category: \"feedback\" | \"action\",\n pattern: string,\n agent: string | null,\n workflow: string | null,\n): string {\n return [\n category,\n agent ? stableSlug(agent) : \"global\",\n workflow ? stableSlug(workflow) : \"default\",\n stableSlug(pattern).slice(0, 48),\n ].join(\":\");\n}\n\nfunction stableRubricId(kind: \"agent\" | \"workflow\", subject: string): string {\n return `${kind}:${stableSlug(subject)}`;\n}\n\nfunction stablePromotionCandidateId(\n sourceType: PromotionCandidate[\"sourceType\"],\n subject: string,\n content: string,\n): string {\n const digest = createHash(\"sha256\")\n .update(`${sourceType}\\u0000${subject}\\u0000${content}`)\n .digest(\"hex\")\n .slice(0, 12);\n return `${sourceType}:${digest}`;\n}\n\nfunction rubricArtifactFileName(\n entry: Pick<RubricSnapshotEntry, \"kind\" | \"subject\">,\n slugCollisions: ReadonlyMap<string, number>,\n): string {\n const slug = stableSlug(entry.subject);\n if ((slugCollisions.get(slug) ?? 0) <= 1) return `${slug}.md`;\n const suffix = createHash(\"sha256\").update(`${entry.kind}:${entry.subject}`).digest(\"hex\").slice(0, 8);\n return `${slug}-${suffix}.md`;\n}\n\nfunction inferLegacyMistakeScope(pattern: string): { agent: string | null; workflow: string | null } {\n const separatorIndex = pattern.indexOf(\":\");\n if (separatorIndex <= 0) return { agent: null, workflow: null };\n const subject = pattern.slice(0, separatorIndex).trim();\n return {\n agent: subject.length > 0 ? subject : null,\n workflow: null,\n };\n}\n\nfunction inferLegacyMistakeMetadata(pattern: string): {\n category: \"feedback\" | \"action\";\n agent: string | null;\n workflow: string | null;\n} {\n if (pattern.startsWith(\"memory-action/\")) {\n return {\n category: \"action\",\n agent: null,\n workflow: \"memory-actions\",\n };\n }\n const scope = inferLegacyMistakeScope(pattern);\n return {\n category: \"feedback\",\n agent: scope.agent,\n workflow: scope.workflow,\n };\n}\n\nfunction normalizePromotionWhitespace(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n\nfunction stripTrailingPromotionPunctuation(value: string): string {\n return value.replace(/[,:;]+$/g, \"\").trim();\n}\n\nfunction extractExplicitIfThenRule(value: string): string | null {\n const normalized = normalizePromotionWhitespace(value);\n const match = normalized.match(/^if\\b([\\s\\S]+?)\\bthen\\b([\\s\\S]+?)(?:[.!?])?$/i);\n if (!match) return null;\n const condition = stripTrailingPromotionPunctuation(normalizePromotionWhitespace(match[1] ?? \"\"));\n const outcome = stripTrailingPromotionPunctuation(normalizePromotionWhitespace(match[2] ?? \"\"));\n if (condition.length === 0 || outcome.length === 0) return null;\n return `IF ${condition} THEN ${outcome}.`;\n}\n\nfunction normalizePromotedGuidanceContent(value: string): string {\n const explicitRule = extractExplicitIfThenRule(value);\n if (explicitRule) return explicitRule;\n const normalized = normalizePromotionWhitespace(value);\n if (normalized.length === 0) return normalized;\n return /[.!?]$/.test(normalized) ? normalized : `${normalized}.`;\n}\n\nfunction canonicalPromotionContentKey(value: string): string {\n return normalizePromotedGuidanceContent(value).toLowerCase();\n}\n\nfunction lessonContentFromPattern(pattern: string, agent: string | null): string {\n if (!agent) return normalizePromotionWhitespace(pattern);\n const prefix = `${agent}:`;\n if (!pattern.startsWith(prefix)) return normalizePromotionWhitespace(pattern);\n const withoutPrefix = pattern.slice(prefix.length).trim();\n return withoutPrefix.length > 0 ? normalizePromotionWhitespace(withoutPrefix) : normalizePromotionWhitespace(pattern);\n}\n\nfunction promotionCategoryForContent(content: string): \"principle\" | \"rule\" {\n return extractExplicitIfThenRule(content) ? \"rule\" : \"principle\";\n}\n\nfunction clampPromotionScore(value: number): number {\n if (!Number.isFinite(value)) return 0.65;\n return Number(Math.max(0.65, Math.min(0.98, value)).toFixed(3));\n}\n\nexport type TierMigrationCycleTrigger = \"extraction\" | \"maintenance\";\nexport interface TierMigrationCycleBudget {\n limit: number;\n scanLimit: number;\n minIntervalMs: number;\n}\n\nexport function defaultTierMigrationCycleBudget(\n config: QmdConfigProjection,\n trigger: TierMigrationCycleTrigger,\n): TierMigrationCycleBudget {\n if (trigger === \"extraction\") {\n const limit = 12;\n return {\n limit,\n scanLimit: limit * 4,\n minIntervalMs: 60_000,\n };\n }\n const limit = resolveQmdCapabilities(config).qmdTierAutoBackfill ? 200 : 50;\n return {\n limit,\n scanLimit: limit * 4,\n minIntervalMs: resolveQmdCapabilities(config).qmdTierAutoBackfill ? 120_000 : 300_000,\n };\n}\n\nfunction isoWeekId(d: Date): string {\n // ISO week based on Thursday\n const dt = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()));\n const day = dt.getUTCDay() || 7;\n dt.setUTCDate(dt.getUTCDate() + 4 - day);\n const yearStart = new Date(Date.UTC(dt.getUTCFullYear(), 0, 1));\n const week = Math.ceil((((dt.getTime() - yearStart.getTime()) / 86400000) + 1) / 7);\n const yyyy = dt.getUTCFullYear();\n return `${yyyy}-W${String(week).padStart(2, \"0\")}`;\n}\n\nfunction isoMonthId(d: Date): string {\n return `${d.getUTCFullYear()}-${String(d.getUTCMonth() + 1).padStart(2, \"0\")}`;\n}\n\nfunction monthIdFromIsoWeek(weekId: string): string {\n const match = weekId.match(/^(\\d{4})-W(\\d{2})$/);\n if (!match) return isoMonthId(new Date());\n const year = Number(match[1]);\n const week = Number(match[2]);\n const jan4 = new Date(Date.UTC(year, 0, 4));\n const jan4Day = jan4.getUTCDay() || 7;\n const isoWeekOneMonday = new Date(jan4);\n isoWeekOneMonday.setUTCDate(jan4.getUTCDate() - (jan4Day - 1));\n const monday = new Date(isoWeekOneMonday);\n monday.setUTCDate(isoWeekOneMonday.getUTCDate() + (week - 1) * 7);\n return isoMonthId(monday);\n}\n\nfunction cadenceStaleWindowMs(cadence: \"daily\" | \"weekly\" | \"monthly\" | \"quarterly\"): number {\n switch (cadence) {\n case \"daily\":\n return 2 * 24 * 60 * 60 * 1000;\n case \"weekly\":\n return 10 * 24 * 60 * 60 * 1000;\n case \"monthly\":\n return 45 * 24 * 60 * 60 * 1000;\n case \"quarterly\":\n return 120 * 24 * 60 * 60 * 1000;\n default:\n return 45 * 24 * 60 * 60 * 1000;\n }\n}\n\nexport class CompoundingEngine {\n private readonly weeklyDir: string;\n private readonly rubricsDir: string;\n private readonly rubricsIndexPath: string;\n private readonly rubricsAgentsDir: string;\n private readonly rubricsWorkflowsDir: string;\n private readonly rubricsPath: string;\n private readonly mistakesPath: string;\n private readonly feedbackInboxPath: string;\n private readonly identityAuditWeeklyDir: string;\n private readonly identityAuditMonthlyDir: string;\n private readonly memoryActionEventsPath: string;\n\n constructor(\n private readonly config: PluginConfig,\n private readonly storage: StorageManager = new StorageManager(config.memoryDir),\n ) {\n this.weeklyDir = path.join(config.memoryDir, \"compounding\", \"weekly\");\n this.rubricsDir = path.join(config.memoryDir, \"compounding\", \"rubrics\");\n this.rubricsIndexPath = path.join(this.rubricsDir, \"index.json\");\n this.rubricsAgentsDir = path.join(this.rubricsDir, \"agents\");\n this.rubricsWorkflowsDir = path.join(this.rubricsDir, \"workflows\");\n this.rubricsPath = path.join(config.memoryDir, \"compounding\", \"rubrics.md\");\n this.mistakesPath = path.join(config.memoryDir, \"compounding\", \"mistakes.json\");\n this.feedbackInboxPath = path.join(resolveSharedContextDir(config), \"feedback\", \"inbox.jsonl\");\n this.identityAuditWeeklyDir = path.join(config.memoryDir, \"identity\", \"audits\", \"weekly\");\n this.identityAuditMonthlyDir = path.join(config.memoryDir, \"identity\", \"audits\", \"monthly\");\n this.memoryActionEventsPath = path.join(config.memoryDir, \"state\", \"memory-actions.jsonl\");\n }\n\n async ensureDirs(): Promise<void> {\n await mkdir(this.weeklyDir, { recursive: true });\n await mkdir(path.dirname(this.mistakesPath), { recursive: true });\n await mkdir(path.dirname(this.rubricsPath), { recursive: true });\n await mkdir(this.rubricsDir, { recursive: true });\n await mkdir(this.rubricsAgentsDir, { recursive: true });\n await mkdir(this.rubricsWorkflowsDir, { recursive: true });\n }\n\n async synthesizeWeekly(opts?: {\n weekId?: string;\n }): Promise<{\n weekId: string;\n reportPath: string;\n reportJsonPath: string;\n mistakesCount: number;\n rubricsPath: string;\n rubricsIndexPath: string;\n promotionCandidateCount: number;\n }> {\n await this.ensureDirs();\n const weekId = opts?.weekId ?? isoWeekId(new Date());\n\n const entries = await this.readFeedbackEntriesForWeek(weekId);\n const actionEvents = await this.readActionEventsForWeek(weekId);\n const actionPatterns = this.buildActionFailurePatterns(actionEvents);\n const outcomeSummary = this.buildActionOutcomeSummary(actionEvents);\n const previousMistakes = await this.readMistakes();\n const mistakes = this.buildMistakes(entries, actionPatterns, weekId, previousMistakes?.registry ?? []);\n const rubrics = this.buildRubricSnapshot(entries, outcomeSummary);\n let promotionCandidates = resolveConsolidationCapabilities(this.config).compoundingSemantic\n ? this.derivePromotionCandidates(outcomeSummary, mistakes.registry, rubrics)\n : [];\n if (this.config.cmcConsolidationEnabled) {\n try {\n const { deriveCausalPromotionCandidates, materializeAfterCausalConsolidation } = await import(\"../causal-consolidation.js\");\n const causalCandidates = await deriveCausalPromotionCandidates({\n memoryDir: this.config.memoryDir,\n causalTrajectoryStoreDir: this.config.causalTrajectoryStoreDir,\n gatewayConfig: this.config.gatewayConfig,\n gatewayAgentId: this.config.modelSource === \"gateway\" ? (this.config.gatewayAgentId || undefined) : undefined,\n modelChain: this.config.modelSource === \"gateway\" ? this.config.taskModelChain : undefined,\n workspaceDir: this.config.workspaceDir,\n pluginConfig: this.config,\n config: {\n minRecurrence: this.config.cmcConsolidationMinRecurrence,\n minSessions: this.config.cmcConsolidationMinSessions,\n successThreshold: this.config.cmcConsolidationSuccessThreshold,\n },\n });\n if (causalCandidates.length > 0) {\n promotionCandidates = [...promotionCandidates, ...causalCandidates];\n }\n // #378: fire the Codex materialize post-hook so\n // `codexMaterializeOnConsolidation` actually has a runtime effect\n // when the causal consolidation path runs. The helper silently no-ops\n // when the feature flag or the per-trigger toggle is off, when the\n // sentinel is missing, or when nothing has changed since the previous\n // run. Wrapped in its own try/catch so a failed materialize never\n // aborts weekly synthesis.\n try {\n await materializeAfterCausalConsolidation({\n config: this.config,\n memoryDir: this.config.memoryDir,\n });\n } catch (materializeError) {\n log.warn(\n `[cmc] Codex materialize post-hook failed (non-fatal): ${\n materializeError instanceof Error ? materializeError.message : String(materializeError)\n }`,\n );\n }\n } catch (error) {\n log.warn(`[cmc] causal consolidation in synthesizeWeekly failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n // PEDC: Run calibration consolidation during weekly synthesis\n if (resolveConsolidationCapabilities(this.config).calibration) {\n try {\n const { runCalibrationConsolidation } = await import(\"../calibration.js\");\n const calRules = await runCalibrationConsolidation({\n memoryDir: this.config.memoryDir,\n gatewayConfig: this.config.gatewayConfig,\n gatewayAgentId: this.config.modelSource === \"gateway\" ? (this.config.gatewayAgentId || undefined) : undefined,\n modelChain: this.config.modelSource === \"gateway\" ? this.config.taskModelChain : undefined,\n workspaceDir: this.config.workspaceDir,\n });\n log.debug(`[calibration] weekly synthesis produced ${calRules.length} calibration rule(s)`);\n } catch (error) {\n log.warn(`[calibration] weekly consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n const continuity = resolveConsolidationCapabilities(this.config).continuityAudit\n ? await this.readContinuityAuditReferences(weekId)\n : { monthId: monthIdFromIsoWeek(weekId), weeklyPath: null, monthlyPath: null };\n\n // Write weekly report (always, even if empty: \"day-one outcomes\").\n const reportPath = path.join(this.weeklyDir, `${weekId}.md`);\n const md = this.formatWeeklyReport(weekId, entries, mistakes.patterns, mistakes.details, continuity, outcomeSummary, promotionCandidates);\n await writeFile(reportPath, md, \"utf-8\");\n\n const reportJsonPath = path.join(this.weeklyDir, `${weekId}.json`);\n const weeklyArtifact: WeeklyCompoundingArtifact = {\n version: COMPOUNDING_VERSION,\n generatedAt: mistakes.updatedAt,\n weekId,\n feedback: {\n count: entries.length,\n byDecision: {\n approved: entries.filter((wrapped) => wrapped.entry.decision === \"approved\").length,\n approved_with_feedback: entries.filter((wrapped) => wrapped.entry.decision === \"approved_with_feedback\").length,\n rejected: entries.filter((wrapped) => wrapped.entry.decision === \"rejected\").length,\n },\n entries: entries.map((wrapped) => ({\n agent: wrapped.entry.agent,\n workflow: wrapped.entry.workflow ?? null,\n decision: wrapped.entry.decision,\n reason: wrapped.entry.reason,\n learning: wrapped.entry.learning?.trim() || null,\n outcome: wrapped.entry.outcome?.trim() || null,\n severity: wrapped.entry.severity ?? null,\n confidence: normalizeConfidence(wrapped.entry.confidence),\n tags: normalizeTags(wrapped.entry.tags),\n provenance: `${path.basename(wrapped.sourcePath)}:L${wrapped.sourceLine}#${wrapped.entryId}`,\n evidenceWindow: normalizeEvidenceWindow(wrapped.entry.evidenceWindowStart, wrapped.entry.evidenceWindowEnd),\n })),\n },\n mistakes: {\n count: mistakes.patterns.length,\n patterns: mistakes.patterns,\n registry: mistakes.registry,\n },\n rubrics,\n outcomes: outcomeSummary,\n promotionCandidates,\n continuity,\n };\n await writeFile(reportJsonPath, JSON.stringify(weeklyArtifact, null, 2) + \"\\n\", \"utf-8\");\n\n // Write stable rubric artifact.\n const rubricsMarkdown = this.formatRubrics(outcomeSummary, rubrics);\n await writeFile(this.rubricsPath, rubricsMarkdown, \"utf-8\");\n await writeFile(this.rubricsIndexPath, JSON.stringify(rubrics, null, 2) + \"\\n\", \"utf-8\");\n await this.syncRubricArtifacts(rubrics);\n\n // Update mistakes.json (always).\n await writeFile(\n this.mistakesPath,\n JSON.stringify({\n version: COMPOUNDING_VERSION,\n updatedAt: mistakes.updatedAt,\n patterns: mistakes.patterns,\n registry: mistakes.registry,\n }, null, 2) + \"\\n\",\n \"utf-8\",\n );\n\n log.info(\n `compounding: wrote weekly=${reportPath} weeklyJson=${reportJsonPath} rubrics=${this.rubricsPath} rubricsIndex=${this.rubricsIndexPath} mistakes=${this.mistakesPath}`,\n );\n return {\n weekId,\n reportPath,\n reportJsonPath,\n rubricsPath: this.rubricsPath,\n rubricsIndexPath: this.rubricsIndexPath,\n mistakesCount: mistakes.patterns.length,\n promotionCandidateCount: promotionCandidates.length,\n };\n }\n\n async promoteCandidate(opts: {\n weekId: string;\n candidateId: string;\n dryRun?: boolean;\n storage?: StorageManager;\n }): Promise<CompoundingPromotionReport> {\n const report: CompoundingPromotionReport = {\n enabled: resolveConsolidationCapabilities(this.config).compounding === true && resolveConsolidationCapabilities(this.config).compoundingSemantic === true,\n dryRun: opts.dryRun === true,\n weekId: opts.weekId,\n promoted: [],\n skipped: [],\n tombstoneBlocked: [],\n };\n if (!report.enabled) {\n report.skipped.push({ weekId: opts.weekId, candidateId: opts.candidateId, reason: \"disabled\" });\n return report;\n }\n\n const artifact = await this.readWeeklyArtifact(opts.weekId);\n if (!artifact) {\n report.skipped.push({ weekId: opts.weekId, candidateId: opts.candidateId, reason: \"weekly-artifact-missing\" });\n return report;\n }\n\n const candidate = artifact.promotionCandidates.find((entry) => entry.id === opts.candidateId);\n if (!candidate) {\n report.skipped.push({ weekId: opts.weekId, candidateId: opts.candidateId, reason: \"candidate-not-found\" });\n return report;\n }\n\n const content = normalizePromotedGuidanceContent(candidate.content);\n const persistedContent = sanitizeMemoryContent(content).text;\n const storage = opts.storage ?? new StorageManager(this.config.memoryDir);\n const existing = (await storage.readAllMemories()).find((memory) =>\n memory.frontmatter.category === candidate.category &&\n memory.frontmatter.status !== \"archived\" &&\n memory.frontmatter.status !== \"forgotten\" &&\n canonicalPromotionContentKey(memory.content) === canonicalPromotionContentKey(persistedContent)\n );\n if (existing) {\n report.skipped.push({\n weekId: opts.weekId,\n candidateId: opts.candidateId,\n reason: \"duplicate-guidance\",\n existingMemoryId: existing.frontmatter.id,\n });\n return report;\n }\n\n const tags = [\n \"compounding\",\n \"compounding-promotion\",\n `compounding-source-${candidate.sourceType}`,\n ...(candidate.agent ? [`agent:${stableSlug(candidate.agent)}`] : []),\n ...(candidate.workflow ? [`workflow:${stableSlug(candidate.workflow)}`] : []),\n ];\n const uniqueTags = [...new Set(tags)];\n const lineage = [`compounding:${opts.weekId}:${opts.candidateId}`];\n const confidence = clampPromotionScore(candidate.score);\n\n if (opts.dryRun === true) {\n report.promoted.push({\n id: `dry-run:${opts.weekId}:${opts.candidateId}`,\n candidateId: opts.candidateId,\n category: candidate.category,\n content: persistedContent,\n confidence,\n tags: uniqueTags,\n lineage,\n });\n return report;\n }\n\n const { id, tombstoneBlocked } = await storage.writeMemory(candidate.category, persistedContent, {\n source: \"compounding-promotion\",\n tags: uniqueTags,\n confidence,\n lineage,\n memoryKind: \"note\",\n });\n // #1645: a tombstone-blocked promotion lands pending_review (no active\n // copy) — divert it to the tombstoneBlocked list so the report never\n // claims a blocked write as a successfully promoted active memory.\n if (tombstoneBlocked) {\n report.tombstoneBlocked.push({\n id,\n candidateId: opts.candidateId,\n category: candidate.category,\n content: persistedContent,\n });\n return report;\n }\n report.promoted.push({\n id,\n candidateId: opts.candidateId,\n category: candidate.category,\n content: persistedContent,\n confidence,\n tags: uniqueTags,\n lineage,\n });\n return report;\n }\n\n async synthesizeContinuityAudit(opts?: {\n period?: \"weekly\" | \"monthly\";\n key?: string;\n }): Promise<{ period: \"weekly\" | \"monthly\"; key: string; reportPath: string }> {\n const period = opts?.period === \"monthly\" ? \"monthly\" : \"weekly\";\n const key = opts?.key?.trim() || (period === \"weekly\" ? isoWeekId(new Date()) : isoMonthId(new Date()));\n const nowIso = new Date().toISOString();\n const [identityAnchor, improvementLoopsRaw, openIncidents, closedIncidents, mistakes] = await Promise.all([\n this.readOptionalIdentityAnchorForAudit(),\n this.readOptionalImprovementLoopsForAudit(),\n this.readContinuityIncidentsForAudit(200, \"open\"),\n this.readContinuityIncidentsForAudit(200, \"closed\"),\n this.readMistakes(),\n ]);\n const anchorPresent = (identityAnchor ?? \"\").trim().length > 0;\n const improvementLoops = improvementLoopsRaw ? parseContinuityImprovementLoops(improvementLoopsRaw) : [];\n const activeLoops = improvementLoops.filter((loop) => loop.status === \"active\");\n const staleActiveLoops = activeLoops.filter((loop) => {\n const reviewedAt = Date.parse(loop.lastReviewed);\n if (!Number.isFinite(reviewedAt)) return true;\n return Date.now() - reviewedAt > cadenceStaleWindowMs(loop.cadence);\n });\n const hardeningCandidates: string[] = [];\n if (!anchorPresent) {\n hardeningCandidates.push(\"Create/update identity anchor baseline and verify recovery injection path.\");\n }\n if (openIncidents.length > 0) {\n hardeningCandidates.push(\n `Close or downgrade ${openIncidents.length} open continuity incident${openIncidents.length === 1 ? \"\" : \"s\"}.`,\n );\n }\n if (improvementLoops.length === 0) {\n hardeningCandidates.push(\"Initialize continuity improvement-loops register with cadence and kill conditions.\");\n } else if (staleActiveLoops.length > 0) {\n hardeningCandidates.push(\n `Review stale active continuity loop${staleActiveLoops.length === 1 ? \"\" : \"s\"}: ${staleActiveLoops\n .slice(0, 3)\n .map((loop) => loop.id)\n .join(\", \")}.`,\n );\n }\n if ((mistakes?.patterns.length ?? 0) > 0) {\n hardeningCandidates.push(\"Review latest compounding mistakes and convert one pattern into preventive continuity rule.\");\n }\n const nextAction = hardeningCandidates[0] ?? \"No critical drift detected; keep weekly/monthly continuity audit cadence.\";\n\n const lines: string[] = [\n `# Continuity Audit — ${period} ${key}`,\n \"\",\n `Generated: ${nowIso}`,\n `Scope: ${period}`,\n \"\",\n \"## Signal Summary\",\n `- Identity anchor present: ${anchorPresent ? \"yes\" : \"no\"}`,\n `- Improvement loops tracked: ${improvementLoops.length}`,\n `- Active improvement loops: ${activeLoops.length}`,\n `- Stale active loops: ${staleActiveLoops.length}`,\n `- Open incidents: ${openIncidents.length}`,\n `- Closed incidents: ${closedIncidents.length}`,\n `- Compounding mistake patterns: ${mistakes?.patterns.length ?? 0}`,\n \"\",\n \"## Drift Checks\",\n `- Identity anchor drift: ${anchorPresent ? \"pass\" : \"needs attention\"}`,\n `- Incident backlog: ${openIncidents.length === 0 ? \"pass\" : \"needs attention\"}`,\n `- Improvement-loop coverage: ${improvementLoops.length > 0 ? \"pass\" : \"needs attention\"}`,\n `- Improvement-loop freshness: ${staleActiveLoops.length === 0 ? \"pass\" : \"needs attention\"}`,\n \"\",\n \"## Stale Rule Detection\",\n `- Open incidents older than closure window: ${openIncidents.length > 0 ? \"possible\" : \"none detected\"}`,\n `- Stale active continuity loops: ${staleActiveLoops.length > 0 ? staleActiveLoops.map((l) => l.id).join(\", \") : \"none detected\"}`,\n `- Preventive rule coverage on closed incidents: ${\n closedIncidents.some((i) => (i.preventiveRule ?? \"\").trim().length > 0) ? \"present\" : \"not detected\"\n }`,\n \"\",\n \"## Next Hardening Action\",\n `- ${nextAction}`,\n \"\",\n \"## Open Incident IDs\",\n ...(openIncidents.length > 0 ? openIncidents.slice(0, 20).map((i) => `- ${i.id}`) : [\"- (none)\"]),\n \"\",\n ];\n\n const reportPath = await this.storage.writeIdentityAudit(period, key, lines.join(\"\\n\"));\n return { period, key, reportPath };\n }\n\n async readMistakes(): Promise<MistakesFile | null> {\n try {\n const raw = await readFile(this.mistakesPath, \"utf-8\");\n const parsed = JSON.parse(raw) as MistakesFile;\n if (!parsed || !Array.isArray(parsed.patterns)) return null;\n if (!Array.isArray(parsed.registry)) {\n const updatedAt = typeof parsed.updatedAt === \"string\" && parsed.updatedAt.length > 0\n ? parsed.updatedAt\n : new Date(0).toISOString();\n parsed.registry = parsed.patterns.map((pattern) => {\n const metadata = inferLegacyMistakeMetadata(pattern);\n return {\n id: stableMistakeId(metadata.category, pattern, metadata.agent, metadata.workflow),\n pattern,\n category: metadata.category,\n status: \"active\",\n agent: metadata.agent,\n workflow: metadata.workflow,\n tags: [],\n severity: null,\n confidence: null,\n outcome: null,\n provenance: [],\n firstSeenAt: updatedAt,\n lastSeenAt: updatedAt,\n recurrenceCount: 1,\n lastWeekId: isoWeekId(new Date(updatedAt)),\n evidenceWindow: { start: null, end: null },\n };\n });\n }\n return parsed;\n } catch {\n return null;\n }\n }\n\n async readRubrics(): Promise<RubricSnapshot | null> {\n try {\n const raw = await readFile(this.rubricsIndexPath, \"utf-8\");\n const parsed = JSON.parse(raw) as RubricSnapshot;\n if (!parsed || !Array.isArray(parsed.agents) || !Array.isArray(parsed.workflows)) return null;\n parsed.agents = parsed.agents.map((entry) => this.normalizeRubricEntry(entry));\n parsed.workflows = parsed.workflows.map((entry) => this.normalizeRubricEntry(entry));\n return parsed;\n } catch {\n return null;\n }\n }\n\n async readWeeklyArtifact(weekId: string): Promise<WeeklyCompoundingArtifact | null> {\n try {\n const raw = await readFile(path.join(this.weeklyDir, `${weekId}.json`), \"utf-8\");\n const parsed = JSON.parse(raw) as WeeklyCompoundingArtifact;\n if (\n !parsed ||\n parsed.weekId !== weekId ||\n !Array.isArray(parsed.promotionCandidates)\n ) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n }\n\n async buildRecallSection(\n query: string,\n opts?: { maxPatterns?: number; maxRubrics?: number },\n ): Promise<string | null> {\n const [mistakes, rubrics] = await Promise.all([\n this.readMistakes(),\n this.readRubrics(),\n ]);\n const maxPatterns = Math.max(0, Math.floor(opts?.maxPatterns ?? 40));\n const maxRubrics = Math.max(0, Math.floor(opts?.maxRubrics ?? 4));\n const queryTokens = tokenizeRecallQuery(query);\n\n const activePatterns = (mistakes?.registry ?? [])\n .filter((entry) => entry.status === \"active\")\n .sort((a, b) =>\n b.recurrenceCount - a.recurrenceCount ||\n b.lastSeenAt.localeCompare(a.lastSeenAt) ||\n a.pattern.localeCompare(b.pattern),\n );\n const topPatterns = activePatterns.slice(0, maxPatterns);\n\n const allRubrics = [\n ...(rubrics?.workflows ?? []),\n ...(rubrics?.agents ?? []),\n ];\n const scoredRubrics = allRubrics\n .map((entry) => ({\n entry,\n score: this.scoreRubricForQuery(entry, queryTokens),\n }))\n .sort((a, b) =>\n b.score - a.score ||\n b.entry.observations.length - a.entry.observations.length ||\n a.entry.subject.localeCompare(b.entry.subject),\n );\n const topRubrics = scoredRubrics\n .filter((item) => item.score > 0 || queryTokens.length === 0)\n .slice(0, maxRubrics)\n .map((item) => item.entry);\n\n if (topPatterns.length === 0 && topRubrics.length === 0) return null;\n\n const lines: string[] = [\n \"## Institutional Learning (Compounded)\",\n \"\",\n ];\n\n if (topPatterns.length > 0) {\n lines.push(\"Avoid repeating these patterns:\");\n for (const entry of topPatterns) {\n const scope = entry.workflow ?? entry.agent ?? null;\n const metadata = [`recurrence=${entry.recurrenceCount}`];\n if (scope) metadata.push(`scope=${scope}`);\n lines.push(`- ${entry.pattern} _(${metadata.join(\", \")})_`);\n }\n lines.push(\"\");\n }\n\n if (topRubrics.length > 0) {\n lines.push(\"Active rubrics:\");\n for (const rubric of topRubrics) {\n const notes = rubric.observations.slice(0, 2).join(\"; \");\n lines.push(`- ${rubric.kind} ${rubric.subject}: ${notes}`);\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n tierMigrationCycleBudget(trigger: TierMigrationCycleTrigger): TierMigrationCycleBudget {\n return defaultTierMigrationCycleBudget(this.config, trigger);\n }\n\n private async readFeedbackEntriesForWeek(weekId: string): Promise<FeedbackEntryWithProvenance[]> {\n // Minimal implementation: includes entries where date starts with any day in the ISO week.\n // We approximate by taking all entries and filtering by computed isoWeekId(date).\n const out: FeedbackEntryWithProvenance[] = [];\n try {\n const raw = await readFile(this.feedbackInboxPath, \"utf-8\");\n const lines = raw.split(\"\\n\");\n for (let idx = 0; idx < lines.length; idx += 1) {\n const line = lines[idx];\n if (!line.trim()) continue;\n try {\n const obj = JSON.parse(line);\n const parsed = SharedFeedbackEntrySchema.safeParse(obj);\n if (!parsed.success) continue;\n const d = new Date(parsed.data.date);\n if (!Number.isFinite(d.getTime())) continue;\n if (isoWeekId(d) !== weekId) continue;\n const sourceLine = idx + 1;\n out.push({\n entry: parsed.data,\n sourceLine,\n sourcePath: this.feedbackInboxPath,\n entryId: `${parsed.data.agent}-${parsed.data.date}-${sourceLine}`.replace(/[^a-zA-Z0-9._:-]/g, \"_\"),\n });\n } catch {\n // ignore\n }\n }\n } catch {\n // missing feedback is normal\n }\n return out;\n }\n\n private buildActionFailurePatterns(events: WeeklyActionEvent[]): string[] {\n const out: string[] = [];\n for (const event of events) {\n const failed = event.outcome === \"failed\" || event.outcome === \"skipped\";\n if (!failed && event.policyDecision === null) continue;\n const suffix = event.reason && event.reason.trim().length > 0\n ? ` - ${event.reason.trim().slice(0, 140)}`\n : \"\";\n out.push(\n `memory-action/${event.namespace}: ${event.action} ${event.outcome}${event.policyDecision ? `/${event.policyDecision}` : \"\"}${suffix}`,\n );\n }\n return out;\n }\n\n private async readActionEventsForWeek(weekId: string): Promise<WeeklyActionEvent[]> {\n const out: WeeklyActionEvent[] = [];\n const rows = await this.storage.readMemoryActionEventRows(Number.MAX_SAFE_INTEGER);\n for (const row of rows) {\n const event = row.event;\n const ts = new Date(event.timestamp);\n if (!Number.isFinite(ts.getTime()) || isoWeekId(ts) !== weekId) continue;\n out.push({\n line: row.line,\n action: event.action,\n outcome: event.outcome,\n policyDecision: event.policyDecision === \"deny\" || event.policyDecision === \"defer\"\n ? event.policyDecision\n : null,\n namespace: typeof event.namespace === \"string\" && event.namespace.length > 0 ? event.namespace : \"default\",\n reason: typeof event.reason === \"string\" ? event.reason : null,\n });\n }\n return out;\n }\n\n private buildActionOutcomeSummary(events: WeeklyActionEvent[]): ActionOutcomeSummary[] {\n const byAction = new Map<string, { counts: ActionOutcomeCounts; provenance: Set<string> }>();\n for (const event of events) {\n const key = event.action;\n const acc = byAction.get(key) ?? {\n counts: { applied: 0, skipped: 0, failed: 0 },\n provenance: new Set<string>(),\n };\n if (event.outcome === \"applied\") acc.counts.applied += 1;\n else if (event.outcome === \"skipped\") acc.counts.skipped += 1;\n else acc.counts.failed += 1;\n acc.provenance.add(`${path.basename(this.memoryActionEventsPath)}:L${event.line}`);\n byAction.set(key, acc);\n }\n\n const out: ActionOutcomeSummary[] = [];\n for (const [action, data] of byAction.entries()) {\n const total = data.counts.applied + data.counts.skipped + data.counts.failed;\n if (total <= 0) continue;\n // Conservative weighting: reward applied, penalize skipped/failed.\n const weightedScore = Number((((data.counts.applied * 1) - (data.counts.skipped * 0.5) - (data.counts.failed * 1.5)) / total).toFixed(3));\n out.push({\n action,\n counts: data.counts,\n total,\n weightedScore,\n provenance: [...data.provenance].sort().slice(0, 8),\n });\n }\n out.sort((a, b) => b.total - a.total || b.weightedScore - a.weightedScore || a.action.localeCompare(b.action));\n return out;\n }\n\n private derivePromotionCandidates(\n summary: ActionOutcomeSummary[],\n mistakes: MistakeRegistryEntry[],\n rubrics: RubricSnapshot,\n ): PromotionCandidate[] {\n const deduped = new Map<string, PromotionCandidate>();\n const upsert = (candidate: PromotionCandidate) => {\n const key = `${candidate.category}:${canonicalPromotionContentKey(candidate.content)}`;\n const existing = deduped.get(key);\n if (!existing) {\n deduped.set(key, candidate);\n return;\n }\n const mergedProvenance = [...new Set([...existing.provenance, ...candidate.provenance])];\n if (candidate.score > existing.score) {\n deduped.set(key, {\n ...candidate,\n provenance: mergedProvenance,\n });\n return;\n }\n existing.provenance = mergedProvenance;\n };\n\n for (const item of summary) {\n if (item.total < 3) continue;\n if (item.weightedScore < 0.3) continue;\n const content = normalizePromotedGuidanceContent(\n `Prefer ${item.action} when the same workflow recurs; this week's outcomes were applied=${item.counts.applied}, skipped=${item.counts.skipped}, failed=${item.counts.failed}.`,\n );\n upsert({\n id: stablePromotionCandidateId(\"action-outcome\", item.action, content),\n sourceType: \"action-outcome\",\n subject: item.action,\n category: promotionCategoryForContent(content),\n content,\n score: item.weightedScore,\n rationale: \"High applied ratio with low failure/skips in weekly outcome telemetry.\",\n outcome: item.counts,\n provenance: item.provenance,\n agent: null,\n workflow: \"memory-actions\",\n });\n }\n\n for (const entry of mistakes) {\n if (entry.status !== \"active\") continue;\n if (entry.recurrenceCount < 2) continue;\n const content = normalizePromotedGuidanceContent(lessonContentFromPattern(entry.pattern, entry.agent));\n if (content.length === 0) continue;\n const confidence = entry.confidence ?? 0.75;\n const score = Number(Math.min(0.97, 0.45 + Math.min(entry.recurrenceCount, 6) * 0.08 + confidence * 0.15).toFixed(3));\n upsert({\n id: stablePromotionCandidateId(\"mistake-pattern\", entry.id, content),\n sourceType: \"mistake-pattern\",\n subject: entry.pattern,\n category: promotionCategoryForContent(content),\n content,\n score,\n rationale: `Recurring lesson still active after ${entry.recurrenceCount} confirmations in the mistake registry.`,\n outcome: null,\n provenance: entry.provenance.length > 0 ? entry.provenance : [`mistakes.json#${entry.id}`],\n agent: entry.agent,\n workflow: entry.workflow,\n });\n }\n\n for (const rubric of [...rubrics.workflows, ...rubrics.agents]) {\n for (const observation of this.getRubricObservationEntries(rubric)) {\n if (this.isSyntheticOutcomeRubricObservation(observation.note)) continue;\n const evidenceCount = observation.provenance.length;\n if (evidenceCount < 2) continue;\n const content = normalizePromotedGuidanceContent(observation.note);\n if (content.length === 0) continue;\n const score = Number(Math.min(0.95, 0.5 + Math.min(evidenceCount, 5) * 0.08).toFixed(3));\n upsert({\n id: stablePromotionCandidateId(\"rubric\", `${rubric.id}:${observation.note}`, content),\n sourceType: \"rubric\",\n subject: `${rubric.kind}:${rubric.subject}`,\n category: promotionCategoryForContent(content),\n content,\n score,\n rationale: `Rubric guidance repeated across ${evidenceCount} supporting observations.`,\n outcome: null,\n provenance: observation.provenance,\n agent: rubric.kind === \"agent\" ? rubric.subject : null,\n workflow: rubric.kind === \"workflow\" ? rubric.subject : null,\n });\n }\n }\n\n return [...deduped.values()]\n .sort((a, b) => b.score - a.score || a.subject.localeCompare(b.subject))\n .slice(0, 10);\n }\n\n private buildMistakes(\n entries: FeedbackEntryWithProvenance[],\n actionPatterns: string[] = [],\n weekId: string,\n previousRegistry: MistakeRegistryEntry[] = [],\n ): MistakesFile & { details: PatternWithProvenance[]; registry: MistakeRegistryEntry[] } {\n const patterns: PatternWithProvenance[] = [];\n const evidenceByPattern = new Map<string, {\n category: \"feedback\" | \"action\";\n agent: string | null;\n workflow: string | null;\n tags: Set<string>;\n severity: CompoundingEntrySeverity | null;\n confidence: number | null;\n outcome: string | null;\n timestamps: string[];\n evidenceWindow: EvidenceWindow;\n }>();\n\n for (const wrapped of entries) {\n const e = wrapped.entry;\n const pattern = e.learning && e.learning.trim().length > 0\n ? `${e.agent}: ${e.learning.trim()}`\n : e.decision === \"rejected\"\n ? `${e.agent}: ${e.reason.trim()}`.slice(0, 240)\n : null;\n if (!pattern) continue;\n const provenance = [`${path.basename(wrapped.sourcePath)}:L${wrapped.sourceLine}#${wrapped.entryId}`];\n patterns.push({ pattern, provenance });\n\n const previous = evidenceByPattern.get(pattern) ?? {\n category: \"feedback\" as const,\n agent: e.agent,\n workflow: e.workflow ?? null,\n tags: new Set<string>(),\n severity: e.severity ?? null,\n confidence: normalizeConfidence(e.confidence),\n outcome: e.outcome?.trim() || null,\n timestamps: [],\n evidenceWindow: normalizeEvidenceWindow(e.evidenceWindowStart, e.evidenceWindowEnd),\n };\n for (const tag of normalizeTags(e.tags)) previous.tags.add(tag);\n previous.timestamps.push(e.date);\n if (previous.workflow === null && e.workflow) previous.workflow = e.workflow;\n if (previous.severity === null && e.severity) previous.severity = e.severity;\n if (previous.confidence === null) previous.confidence = normalizeConfidence(e.confidence);\n if (previous.outcome === null && e.outcome) previous.outcome = e.outcome.trim();\n const nextEvidenceWindow = normalizeEvidenceWindow(e.evidenceWindowStart, e.evidenceWindowEnd);\n previous.evidenceWindow = mergeEvidenceWindows(previous.evidenceWindow, nextEvidenceWindow);\n evidenceByPattern.set(pattern, previous);\n }\n\n for (const pattern of actionPatterns) {\n patterns.push({ pattern, provenance: [`${path.basename(this.memoryActionEventsPath)}:*`] });\n const previous = evidenceByPattern.get(pattern) ?? {\n category: \"action\" as const,\n agent: null,\n workflow: \"memory-actions\",\n tags: new Set<string>(),\n severity: \"medium\" as CompoundingEntrySeverity,\n confidence: null,\n outcome: null,\n timestamps: [],\n evidenceWindow: { start: null, end: null },\n };\n evidenceByPattern.set(pattern, previous);\n }\n\n const byPattern = new Map<string, Set<string>>();\n for (const item of patterns) {\n const existing = byPattern.get(item.pattern) ?? new Set<string>();\n for (const provenance of item.provenance) existing.add(provenance);\n byPattern.set(item.pattern, existing);\n }\n\n const details = [...byPattern.entries()]\n .map(([pattern, provenance]) => ({ pattern, provenance: [...provenance].sort() }))\n .slice(0, 500);\n const previousById = new Map(previousRegistry.map((entry) => [entry.id, entry]));\n const previousByPattern = new Map(previousRegistry.map((entry) => [entry.pattern, entry]));\n const registry: MistakeRegistryEntry[] = details.map((detail) => {\n const evidence = evidenceByPattern.get(detail.pattern);\n const id = stableMistakeId(\n evidence?.category ?? \"feedback\",\n detail.pattern,\n evidence?.agent ?? null,\n evidence?.workflow ?? null,\n );\n const previous = previousById.get(id) ?? previousByPattern.get(detail.pattern);\n const timestamps = (evidence?.timestamps ?? []).filter((value) => typeof value === \"string\" && value.length > 0).sort();\n const firstSeenAt = previous?.firstSeenAt ?? timestamps[0] ?? new Date().toISOString();\n const lastSeenAt = timestamps[timestamps.length - 1] ?? previous?.lastSeenAt ?? firstSeenAt;\n return {\n id,\n pattern: detail.pattern,\n category: evidence?.category ?? \"feedback\",\n status: \"active\" as const,\n agent: evidence?.agent ?? null,\n workflow: evidence?.workflow ?? null,\n tags: evidence ? [...evidence.tags].sort() : [],\n severity: evidence?.severity ?? null,\n confidence: evidence?.confidence ?? null,\n outcome: evidence?.outcome ?? null,\n provenance: detail.provenance,\n firstSeenAt,\n lastSeenAt,\n recurrenceCount: previous?.lastWeekId === weekId ? previous.recurrenceCount : (previous?.recurrenceCount ?? 0) + 1,\n lastWeekId: weekId,\n evidenceWindow: evidence?.evidenceWindow ?? { start: null, end: null },\n retiredAt: null,\n } satisfies MistakeRegistryEntry;\n });\n\n const seenIds = new Set(registry.map((entry) => entry.id));\n const seenPatterns = new Set(registry.map((entry) => entry.pattern));\n for (const previous of previousRegistry) {\n if (seenIds.has(previous.id) || seenPatterns.has(previous.pattern)) continue;\n const staleWeeks = weekIdToIndex(weekId) - weekIdToIndex(previous.lastWeekId);\n registry.push({\n ...previous,\n status: staleWeeks >= RETIREMENT_WINDOW_WEEKS ? \"retired\" : previous.status,\n retiredAt: staleWeeks >= RETIREMENT_WINDOW_WEEKS\n ? previous.retiredAt ?? new Date().toISOString()\n : previous.retiredAt ?? null,\n });\n }\n\n registry.sort((a, b) =>\n Number(b.status === \"active\") - Number(a.status === \"active\") ||\n b.recurrenceCount - a.recurrenceCount ||\n b.lastSeenAt.localeCompare(a.lastSeenAt) ||\n a.pattern.localeCompare(b.pattern),\n );\n\n return {\n version: COMPOUNDING_VERSION,\n updatedAt: new Date().toISOString(),\n patterns: details.map((d) => d.pattern),\n details,\n registry,\n };\n }\n\n private formatWeeklyReport(\n weekId: string,\n entries: FeedbackEntryWithProvenance[],\n patterns: string[],\n patternDetails: PatternWithProvenance[],\n continuity: { monthId: string; weeklyPath: string | null; monthlyPath: string | null },\n outcomeSummary: ActionOutcomeSummary[],\n promotionCandidates: PromotionCandidate[],\n ): string {\n const byAgent = new Map<string, FeedbackEntryWithProvenance[]>();\n for (const wrapped of entries) {\n const list = byAgent.get(wrapped.entry.agent) ?? [];\n list.push(wrapped);\n byAgent.set(wrapped.entry.agent, list);\n }\n\n const lines: string[] = [\n `# Weekly Compounding — ${weekId}`,\n \"\",\n \"This file is generated by Engram's compounding engine (v5.0).\",\n \"\",\n \"## Summary\",\n `- Feedback entries: ${entries.length}`,\n `- Mistake patterns: ${patterns.length}`,\n \"\",\n \"## By Agent\",\n ];\n\n if (byAgent.size === 0) {\n lines.push(\"- (none)\");\n } else {\n for (const [agent, list] of Array.from(byAgent.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {\n const approved = list.filter((e) => e.entry.decision === \"approved\").length;\n const awf = list.filter((e) => e.entry.decision === \"approved_with_feedback\").length;\n const rejected = list.filter((e) => e.entry.decision === \"rejected\").length;\n lines.push(`### ${agent}`);\n lines.push(`- approved: ${approved}`);\n lines.push(`- approved_with_feedback: ${awf}`);\n lines.push(`- rejected: ${rejected}`);\n const provenance = list\n .slice(0, 3)\n .map((e) => `${path.basename(e.sourcePath)}:L${e.sourceLine}#${e.entryId}`);\n if (provenance.length > 0) {\n lines.push(`- provenance: ${provenance.join(\", \")}`);\n }\n lines.push(\"\");\n }\n }\n\n lines.push(\"## Patterns (Avoid / Prefer)\");\n if (patterns.length === 0) {\n lines.push(\"- (none yet)\");\n } else {\n const detailMap = new Map(patternDetails.map((d) => [d.pattern, d.provenance]));\n for (const p of patterns.slice(0, 100)) {\n const provenance = detailMap.get(p) ?? [];\n if (provenance.length > 0) {\n lines.push(`- ${p} _(source: ${provenance.join(\", \")})_`);\n } else {\n lines.push(`- ${p}`);\n }\n }\n }\n lines.push(\"\");\n\n lines.push(\"## Outcome Weighting\");\n if (outcomeSummary.length === 0) {\n lines.push(\"- (no action outcomes recorded this week)\");\n } else {\n for (const item of outcomeSummary.slice(0, 20)) {\n lines.push(\n `- ${item.action}: applied=${item.counts.applied}, skipped=${item.counts.skipped}, failed=${item.counts.failed}, weight=${item.weightedScore} _(source: ${item.provenance.join(\", \")})_`,\n );\n }\n }\n lines.push(\"\");\n\n if (resolveConsolidationCapabilities(this.config).compoundingSemantic) {\n lines.push(\"## Promotion Candidates (Advisory)\");\n if (promotionCandidates.length === 0) {\n lines.push(\"- (no advisory promotion candidates this week)\");\n } else {\n for (const candidate of promotionCandidates) {\n const outcomeSummaryText = candidate.outcome\n ? ` outcomes[a=${candidate.outcome.applied}, s=${candidate.outcome.skipped}, f=${candidate.outcome.failed}]`\n : \"\";\n lines.push(\n `- [${candidate.sourceType}] ${candidate.subject} -> ${candidate.content} (category=${candidate.category}, score=${candidate.score}, id=${candidate.id}): ${candidate.rationale}${outcomeSummaryText} _(source: ${candidate.provenance.join(\", \")})_`,\n );\n }\n }\n lines.push(\"\");\n lines.push(\"_Advisory only: no automatic promotion write is performed by this report. Use `compounding_promote_candidate` or `openclaw engram compounding-promote` to persist one manually._\");\n lines.push(\"\");\n }\n\n if (resolveConsolidationCapabilities(this.config).continuityAudit) {\n lines.push(\"## Continuity Audits\");\n if (continuity.weeklyPath) {\n lines.push(`- weekly: ${continuity.weeklyPath}`);\n } else {\n lines.push(`- weekly: (missing for ${weekId})`);\n }\n if (continuity.monthlyPath) {\n lines.push(`- monthly: ${continuity.monthlyPath}`);\n } else {\n lines.push(`- monthly: (missing for ${continuity.monthId})`);\n }\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n }\n\n private buildRubricSnapshot(\n entries: FeedbackEntryWithProvenance[],\n outcomeSummary: ActionOutcomeSummary[],\n ): RubricSnapshot {\n const updatedAt = new Date().toISOString();\n const byAgent = new Map<string, RubricSnapshotEntry>();\n const byWorkflow = new Map<string, RubricSnapshotEntry>();\n\n for (const wrapped of entries) {\n const note = ((wrapped.entry.learning && wrapped.entry.learning.trim().length > 0)\n ? wrapped.entry.learning\n : wrapped.entry.decision === \"rejected\"\n ? wrapped.entry.reason\n : \"\").trim();\n if (!note) continue;\n const provenance = `${path.basename(wrapped.sourcePath)}:L${wrapped.sourceLine}#${wrapped.entryId}`;\n const agentEntry = byAgent.get(wrapped.entry.agent) ?? {\n id: stableRubricId(\"agent\", wrapped.entry.agent),\n kind: \"agent\" as const,\n subject: wrapped.entry.agent,\n observations: [],\n tags: [],\n provenance: [],\n observationEntries: [],\n updatedAt,\n };\n this.addRubricObservation(agentEntry, note, provenance);\n agentEntry.tags = normalizeTags([...agentEntry.tags, ...normalizeTags(wrapped.entry.tags)]);\n byAgent.set(wrapped.entry.agent, agentEntry);\n\n const workflow = wrapped.entry.workflow?.trim();\n if (!workflow) continue;\n const workflowEntry = byWorkflow.get(workflow) ?? {\n id: stableRubricId(\"workflow\", workflow),\n kind: \"workflow\" as const,\n subject: workflow,\n observations: [],\n tags: [],\n provenance: [],\n observationEntries: [],\n updatedAt,\n };\n this.addRubricObservation(workflowEntry, note, provenance);\n workflowEntry.tags = normalizeTags([...workflowEntry.tags, ...normalizeTags(wrapped.entry.tags)]);\n byWorkflow.set(workflow, workflowEntry);\n }\n\n for (const item of outcomeSummary) {\n const workflowEntry = byWorkflow.get(item.action) ?? {\n id: stableRubricId(\"workflow\", item.action),\n kind: \"workflow\" as const,\n subject: item.action,\n observations: [],\n tags: [],\n provenance: [],\n observationEntries: [],\n updatedAt,\n };\n this.addRubricObservation(\n workflowEntry,\n `Outcome weight=${item.weightedScore} (applied=${item.counts.applied}, skipped=${item.counts.skipped}, failed=${item.counts.failed})`,\n ...item.provenance,\n );\n byWorkflow.set(item.action, workflowEntry);\n }\n\n return {\n updatedAt,\n agents: [...byAgent.values()].sort((a, b) => a.subject.localeCompare(b.subject)),\n workflows: [...byWorkflow.values()].sort((a, b) => a.subject.localeCompare(b.subject)),\n };\n }\n\n private formatRubrics(outcomeSummary: ActionOutcomeSummary[], snapshot: RubricSnapshot): string {\n const lines: string[] = [\n \"# Compounding Rubrics\",\n \"\",\n `Generated: ${snapshot.updatedAt}`,\n \"\",\n \"Stable, deterministic rubric snapshot generated from weekly feedback + action outcomes.\",\n \"\",\n ];\n\n lines.push(\"## Agent Rubrics\");\n if (snapshot.agents.length === 0) {\n lines.push(\"- (none yet)\");\n } else {\n for (const rubric of snapshot.agents) {\n lines.push(`### ${rubric.subject}`);\n const observations = this.getRubricObservationEntries(rubric).slice(0, 8);\n if (observations.length === 0) {\n lines.push(\"- No rubric deltas this week.\");\n } else {\n for (const observation of observations) {\n const provenance = observation.provenance.join(\", \");\n lines.push(`- ${observation.note}${provenance ? ` _(source: ${provenance})_` : \"\"}`);\n }\n }\n lines.push(\"\");\n }\n }\n\n lines.push(\"## Workflow Rubrics\");\n if (snapshot.workflows.length === 0) {\n lines.push(\"- (none yet)\");\n } else {\n for (const rubric of snapshot.workflows) {\n lines.push(`### ${rubric.subject}`);\n for (const observation of this.getRubricObservationEntries(rubric).slice(0, 8)) {\n const provenance = observation.provenance.join(\", \");\n lines.push(`- ${observation.note}${provenance ? ` _(source: ${provenance})_` : \"\"}`);\n }\n lines.push(\"\");\n }\n }\n\n lines.push(\"## Action Outcome Signals\");\n if (outcomeSummary.length === 0) {\n lines.push(\"- (none yet)\");\n } else {\n for (const item of outcomeSummary.slice(0, 20)) {\n lines.push(\n `- ${item.action}: weight=${item.weightedScore} (applied=${item.counts.applied}, skipped=${item.counts.skipped}, failed=${item.counts.failed})`,\n );\n }\n }\n lines.push(\"\");\n return lines.join(\"\\n\");\n }\n\n private async syncRubricArtifacts(snapshot: RubricSnapshot): Promise<void> {\n await this.replaceRubricDirectory(this.rubricsAgentsDir, snapshot.agents);\n await this.replaceRubricDirectory(this.rubricsWorkflowsDir, snapshot.workflows);\n }\n\n private async replaceRubricDirectory(dir: string, entries: RubricSnapshotEntry[]): Promise<void> {\n await mkdir(dir, { recursive: true });\n try {\n const names = await readdir(dir);\n await Promise.all(\n names.filter((name) => name.endsWith(\".md\")).map((name) => unlink(path.join(dir, name)).catch(() => undefined)),\n );\n } catch {\n // fail-open\n }\n\n const slugCollisions = new Map<string, number>();\n for (const entry of entries) {\n const slug = stableSlug(entry.subject);\n slugCollisions.set(slug, (slugCollisions.get(slug) ?? 0) + 1);\n }\n\n await Promise.all(entries.map(async (entry) => {\n const observationEntries = this.getRubricObservationEntries(entry);\n const body = [\n `# ${entry.kind === \"agent\" ? \"Agent\" : \"Workflow\"} Rubric — ${entry.subject}`,\n \"\",\n `Updated: ${entry.updatedAt}`,\n \"\",\n \"## Observations\",\n ...(observationEntries.length > 0\n ? observationEntries.map((item) => `- ${item.note}`)\n : [\"- (none yet)\"]),\n \"\",\n \"## Provenance\",\n ...(entry.provenance.length > 0 ? entry.provenance.map((item) => `- ${item}`) : [\"- (none yet)\"]),\n \"\",\n ].join(\"\\n\");\n const fileName = rubricArtifactFileName(entry, slugCollisions);\n await writeFile(path.join(dir, fileName), body, \"utf-8\");\n }));\n }\n\n private scoreRubricForQuery(entry: RubricSnapshotEntry, queryTokens: string[]): number {\n if (queryTokens.length === 0) return entry.observations.length;\n const haystack = [entry.subject, ...entry.observations, ...entry.tags].join(\" \").toLowerCase();\n let score = 0;\n for (const token of queryTokens) {\n if (haystack.includes(token)) score += 2;\n if (entry.subject.toLowerCase().includes(token)) score += 2;\n }\n if (score === 0) return 0;\n return score + Math.min(entry.observations.length, 3);\n }\n\n private normalizeRubricEntry(entry: RubricSnapshotEntry): RubricSnapshotEntry {\n const normalizedEntries = this.getRubricObservationEntries(entry);\n return {\n ...entry,\n observations: normalizedEntries.map((item) => item.note),\n provenance: [...new Set(normalizedEntries.flatMap((item) => item.provenance))],\n observationEntries: normalizedEntries,\n };\n }\n\n private getRubricObservationEntries(entry: RubricSnapshotEntry): Array<{ note: string; provenance: string[] }> {\n if (Array.isArray(entry.observationEntries) && entry.observationEntries.length > 0) {\n return entry.observationEntries.map((item) => ({\n note: item.note,\n provenance: [...new Set(item.provenance)].sort(),\n }));\n }\n\n return entry.observations.map((note, index) => ({\n note,\n provenance: entry.provenance[index] ? [entry.provenance[index]] : (entry.provenance[0] ? [entry.provenance[0]] : []),\n }));\n }\n\n private isSyntheticOutcomeRubricObservation(note: string): boolean {\n return note.trimStart().startsWith(\"Outcome weight=\");\n }\n\n private addRubricObservation(entry: RubricSnapshotEntry, note: string, ...provenance: string[]): void {\n const normalized = this.normalizeRubricEntry(entry);\n const existing = normalized.observationEntries?.find((item) => item.note === note);\n if (existing) {\n existing.provenance = [...new Set([...existing.provenance, ...provenance])].sort();\n } else {\n normalized.observationEntries?.push({\n note,\n provenance: [...new Set(provenance)].sort(),\n });\n }\n entry.observationEntries = normalized.observationEntries;\n entry.observations = normalized.observationEntries?.map((item) => item.note) ?? [];\n entry.provenance = [...new Set((normalized.observationEntries ?? []).flatMap((item) => item.provenance))];\n }\n\n private async readOptionalIdentityAnchorForAudit(): Promise<string | null> {\n try {\n return await this.storage.readIdentityAnchor();\n } catch {\n return null;\n }\n }\n\n private async readOptionalImprovementLoopsForAudit(): Promise<string | null> {\n try {\n return await this.storage.readIdentityImprovementLoops();\n } catch {\n return null;\n }\n }\n\n private async readContinuityIncidentsForAudit(\n limit: number,\n state: \"open\" | \"closed\",\n ): Promise<ContinuityIncidentRecord[]> {\n try {\n return await this.storage.readContinuityIncidents(limit, state);\n } catch {\n return [];\n }\n }\n\n private async readOptionalIdentityAuditForReference(\n period: \"weekly\" | \"monthly\",\n key: string,\n ): Promise<string | null> {\n try {\n return await this.storage.readIdentityAudit(period, key);\n } catch {\n return null;\n }\n }\n\n private async readContinuityAuditReferences(weekId: string): Promise<{\n weekId: string;\n monthId: string;\n weeklyPath: string | null;\n monthlyPath: string | null;\n }> {\n const monthId = monthIdFromIsoWeek(weekId);\n const weeklyPath = path.join(this.identityAuditWeeklyDir, `${weekId}.md`);\n const monthlyPath = path.join(this.identityAuditMonthlyDir, `${monthId}.md`);\n const [weeklyAudit, monthlyAudit] = await Promise.all([\n this.readOptionalIdentityAuditForReference(\"weekly\", weekId),\n this.readOptionalIdentityAuditForReference(\"monthly\", monthId),\n ]);\n const weeklyExists = (weeklyAudit ?? \"\").trim().length > 0;\n const monthlyExists = (monthlyAudit ?? \"\").trim().length > 0;\n return {\n weekId,\n monthId,\n weeklyPath: weeklyExists ? weeklyPath : null,\n monthlyPath: monthlyExists ? monthlyPath : null,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU,SAAS,QAAQ,iBAAiB;AAC5D,OAAO,UAAU;AAiLjB,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEhC,SAAS,WAAW,OAAuB;AACzC,SAAO,MACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE,EACtB,MAAM,GAAG,EAAE,KAAK;AACrB;AAEA,SAAS,oBAAoB,MAAwB;AACnD,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,MAAgB,CAAC;AACvB,aAAW,SAAS,KACjB,YAAY,EACZ,QAAQ,iBAAiB,GAAG,EAC5B,MAAM,KAAK,EACX,IAAI,CAAC,SAAS,KAAK,KAAK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c,uCAA+D;AAC3E,QAAI;AACF,aAAO,MAAM,KAAK,QAAQ,6BAA6B;AAAA,IACzD,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAc,gCACZ,OACA,OACqC;AACrC,QAAI;AACF,aAAO,MAAM,KAAK,QAAQ,wBAAwB,OAAO,KAAK;AAAA,IAChE,QAAQ;AACN,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EAEA,MAAc,sCACZ,QACA,KACwB;AACxB,QAAI;AACF,aAAO,MAAM,KAAK,QAAQ,kBAAkB,QAAQ,GAAG;AAAA,IACzD,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAc,8BAA8B,QAKzC;AACD,UAAM,UAAU,mBAAmB,MAAM;AACzC,UAAM,aAAa,KAAK,KAAK,KAAK,wBAAwB,GAAG,MAAM,KAAK;AACxE,UAAM,cAAc,KAAK,KAAK,KAAK,yBAAyB,GAAG,OAAO,KAAK;AAC3E,UAAM,CAAC,aAAa,YAAY,IAAI,MAAM,QAAQ,IAAI;AAAA,MACpD,KAAK,sCAAsC,UAAU,MAAM;AAAA,MAC3D,KAAK,sCAAsC,WAAW,OAAO;AAAA,IAC/D,CAAC;AACD,UAAM,gBAAgB,eAAe,IAAI,KAAK,EAAE,SAAS;AACzD,UAAM,iBAAiB,gBAAgB,IAAI,KAAK,EAAE,SAAS;AAC3D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,YAAY,eAAe,aAAa;AAAA,MACxC,aAAa,gBAAgB,cAAc;AAAA,IAC7C;AAAA,EACF;AACF;","names":["limit"]}
@@ -11,13 +11,13 @@ import {
11
11
  defaultNamespaceForPrincipal,
12
12
  recallNamespacesForPrincipal,
13
13
  resolvePrincipal
14
- } from "./chunk-OYHYBHHI.js";
15
- import {
16
- resolveNamespaceCapabilities
17
- } from "./chunk-JWDE7OVJ.js";
14
+ } from "./chunk-DS3FZ7GS.js";
18
15
  import {
19
16
  isSafeRouteNamespace
20
17
  } from "./chunk-U3PN77QT.js";
18
+ import {
19
+ resolveNamespaceCapabilities
20
+ } from "./chunk-RJBW4EOU.js";
21
21
  import {
22
22
  expandTildePath
23
23
  } from "./chunk-EYIEWJNI.js";
@@ -772,4 +772,4 @@ export {
772
772
  resolveNamespaceFromStorageDir,
773
773
  resolveWritableNamespaceValue
774
774
  };
775
- //# sourceMappingURL=chunk-GB2FZOWB.js.map
775
+ //# sourceMappingURL=chunk-7B7IPPN5.js.map
@@ -12,10 +12,10 @@ import {
12
12
  } from "./chunk-FVZ2ISIX.js";
13
13
  import {
14
14
  getOperation
15
- } from "./chunk-P6VLG7KE.js";
15
+ } from "./chunk-N2O23WYA.js";
16
16
  import {
17
17
  EngramAccessInputError
18
- } from "./chunk-HLPYL6LC.js";
18
+ } from "./chunk-Y5OOHER4.js";
19
19
  import {
20
20
  readEnvVar
21
21
  } from "./chunk-JUC24CTX.js";
@@ -3619,4 +3619,4 @@ export {
3619
3619
  processChatMessage,
3620
3620
  EngramMcpServer
3621
3621
  };
3622
- //# sourceMappingURL=chunk-QNTLWH3T.js.map
3622
+ //# sourceMappingURL=chunk-A7INTIC5.js.map
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-RGMVMVMF.js";
13
13
  import {
14
14
  resolveNamespaceCapabilities
15
- } from "./chunk-JWDE7OVJ.js";
15
+ } from "./chunk-RJBW4EOU.js";
16
16
  import {
17
17
  log
18
18
  } from "./chunk-NU3CSQ4H.js";
@@ -546,4 +546,4 @@ export {
546
546
  ACTIVE_STATUSES,
547
547
  runContradictionScan
548
548
  };
549
- //# sourceMappingURL=chunk-FLPKEMSO.js.map
549
+ //# sourceMappingURL=chunk-AKKFHN3I.js.map
@@ -11,25 +11,25 @@ import {
11
11
  processChatMessage,
12
12
  sessionBelongsToPrincipal,
13
13
  subscribeChatTranscript
14
- } from "./chunk-QNTLWH3T.js";
14
+ } from "./chunk-A7INTIC5.js";
15
15
  import {
16
16
  validateRequest
17
17
  } from "./chunk-FVZ2ISIX.js";
18
18
  import {
19
19
  getOperation
20
- } from "./chunk-P6VLG7KE.js";
20
+ } from "./chunk-N2O23WYA.js";
21
21
  import {
22
22
  EngramAccessInputError
23
- } from "./chunk-HLPYL6LC.js";
23
+ } from "./chunk-Y5OOHER4.js";
24
24
  import {
25
25
  CorrectionContractError
26
- } from "./chunk-WNGXQMRI.js";
26
+ } from "./chunk-WFNH4UDF.js";
27
27
  import {
28
28
  isTrustZoneName
29
29
  } from "./chunk-JGSKJHF7.js";
30
30
  import {
31
31
  projectTagProjectId
32
- } from "./chunk-GB2FZOWB.js";
32
+ } from "./chunk-7B7IPPN5.js";
33
33
  import {
34
34
  subscribeGraphEvents
35
35
  } from "./chunk-DEUNUKTD.js";
@@ -1769,7 +1769,7 @@ var EngramAccessHttpServer = class {
1769
1769
  if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
1770
1770
  void getOperation("contradiction_scan_run");
1771
1771
  const body = await this.readJsonBody(req);
1772
- const { runContradictionScan } = await import("./contradiction-scan-2B4AE4TI.js");
1772
+ const { runContradictionScan } = await import("./contradiction-scan-CWO3LIWV.js");
1773
1773
  const principal = this.resolveRequestPrincipal(req);
1774
1774
  const result = await runContradictionScan({
1775
1775
  storage: this.service.storageRef,
@@ -2629,4 +2629,4 @@ function positiveIntQueryParam(value, label) {
2629
2629
  export {
2630
2630
  EngramAccessHttpServer
2631
2631
  };
2632
- //# sourceMappingURL=chunk-AAIHDIMD.js.map
2632
+ //# sourceMappingURL=chunk-BHJAMSVC.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveDefaultNamespaceRoot,
3
3
  resolveNamespaceStorageRoot
4
- } from "./chunk-NNJKEAP2.js";
4
+ } from "./chunk-VRBBZH4U.js";
5
5
  import {
6
6
  getConfiguredNamespaces
7
- } from "./chunk-GB2FZOWB.js";
7
+ } from "./chunk-7B7IPPN5.js";
8
8
  import {
9
9
  namespaceIdentityFromToken,
10
10
  namespaceIdentityToken,
@@ -20,12 +20,12 @@ import {
20
20
  import {
21
21
  ALL_CATEGORY_DIRS
22
22
  } from "./chunk-VS2IYZRU.js";
23
- import {
24
- resolveNamespaceCapabilities
25
- } from "./chunk-JWDE7OVJ.js";
26
23
  import {
27
24
  isSafeRouteNamespace
28
25
  } from "./chunk-U3PN77QT.js";
26
+ import {
27
+ resolveNamespaceCapabilities
28
+ } from "./chunk-RJBW4EOU.js";
29
29
 
30
30
  // src/namespaces/catalog.ts
31
31
  import path from "path";
@@ -1949,4 +1949,4 @@ export {
1949
1949
  runNamespaceMaintenancePlan,
1950
1950
  runNamespaceMaintenanceBatchPlan
1951
1951
  };
1952
- //# sourceMappingURL=chunk-BXPG5AVX.js.map
1952
+ //# sourceMappingURL=chunk-BHQQVUEQ.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-PWFWCGOO.js";
9
9
  import {
10
10
  LocalLlmClient
11
- } from "./chunk-IX4L7E5G.js";
11
+ } from "./chunk-YXOXAQ5Y.js";
12
12
  import {
13
13
  sessionStoragePaths
14
14
  } from "./chunk-S4DDLTPX.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-RGMVMVMF.js";
27
27
  import {
28
28
  resolveLocalLlmCapabilities
29
- } from "./chunk-JWDE7OVJ.js";
29
+ } from "./chunk-RJBW4EOU.js";
30
30
  import {
31
31
  log
32
32
  } from "./chunk-NU3CSQ4H.js";
@@ -689,4 +689,4 @@ ${truncatedConversation}`;
689
689
  export {
690
690
  HourlySummarizer
691
691
  };
692
- //# sourceMappingURL=chunk-HFXZIF3V.js.map
692
+ //# sourceMappingURL=chunk-BVG2IZOB.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- resolveNamespaceCapabilities
3
- } from "./chunk-JWDE7OVJ.js";
4
1
  import {
5
2
  isSafeRouteNamespace
6
3
  } from "./chunk-U3PN77QT.js";
4
+ import {
5
+ resolveNamespaceCapabilities
6
+ } from "./chunk-RJBW4EOU.js";
7
7
  import {
8
8
  sanitizeMemoryContent
9
9
  } from "./chunk-5GKPFL3S.js";
@@ -441,4 +441,4 @@ export {
441
441
  shouldSkipImplicitExtraction,
442
442
  shouldProcessInlineExplicitCapture
443
443
  };
444
- //# sourceMappingURL=chunk-NDKW67ER.js.map
444
+ //# sourceMappingURL=chunk-C53JDEH3.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-Q6BAA57B.js";
8
8
  import {
9
9
  resolveNamespaceCapabilities
10
- } from "./chunk-JWDE7OVJ.js";
10
+ } from "./chunk-RJBW4EOU.js";
11
11
  import {
12
12
  sanitizeMemoryContent
13
13
  } from "./chunk-5GKPFL3S.js";
@@ -682,4 +682,4 @@ export {
682
682
  entityIndexVersion,
683
683
  entityRecentTranscriptLookbackHours
684
684
  };
685
- //# sourceMappingURL=chunk-AESC5OQJ.js.map
685
+ //# sourceMappingURL=chunk-CKHPUOAP.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- resolveNamespaceCapabilities
3
- } from "./chunk-JWDE7OVJ.js";
4
1
  import {
5
2
  isLikelyUnsafeRegex
6
3
  } from "./chunk-U3PN77QT.js";
4
+ import {
5
+ resolveNamespaceCapabilities
6
+ } from "./chunk-RJBW4EOU.js";
7
7
 
8
8
  // src/namespaces/principal.ts
9
9
  var MAX_REGEX_SESSION_KEY_LENGTH = 512;
@@ -92,4 +92,4 @@ export {
92
92
  defaultNamespaceForPrincipal,
93
93
  recallNamespacesForPrincipal
94
94
  };
95
- //# sourceMappingURL=chunk-OYHYBHHI.js.map
95
+ //# sourceMappingURL=chunk-DS3FZ7GS.js.map