@remnic/core 10.0.8 → 10.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.js +14 -14
- package/dist/access-authorization-probe.js +15 -15
- package/dist/access-boundary.js +14 -14
- package/dist/access-cli.js +52 -52
- package/dist/access-extraction-force-flush.js +14 -14
- package/dist/access-http-briefing.js +15 -15
- package/dist/access-http-query.js +16 -16
- package/dist/access-http.js +30 -30
- package/dist/access-identity-continuity-surface.js +14 -14
- package/dist/access-lcm-surface.js +14 -14
- package/dist/access-mcp.js +23 -23
- package/dist/access-namespace-preflight.js +14 -14
- package/dist/access-observe-write-surface.js +14 -14
- package/dist/access-operations-batch.js +15 -15
- package/dist/access-operations.js +22 -22
- package/dist/access-recall-concurrency.js +14 -14
- package/dist/access-recall-response.js +14 -14
- package/dist/access-recall-surface.js +14 -14
- package/dist/access-service.js +14 -14
- package/dist/access-surface-catalog.js +16 -16
- package/dist/active-recall.js +1 -1
- package/dist/briefing.js +2 -2
- package/dist/causal-consolidation.js +3 -3
- package/dist/{chunk-ZQYAE2C5.js → chunk-2U4BM3TW.js} +2 -2
- package/dist/{chunk-QFIPSKPC.js → chunk-3ZCRHW7U.js} +2 -2
- package/dist/{chunk-76KHEHT2.js → chunk-4N2MFNTG.js} +2 -2
- package/dist/{chunk-FBVLTTVV.js → chunk-4TP3MJ3D.js} +5 -5
- package/dist/{chunk-JSIQSZXI.js → chunk-56GJLXBA.js} +3 -3
- package/dist/{chunk-MVRIW6MI.js → chunk-6OAXWYE3.js} +2 -2
- package/dist/{chunk-KDYQYMJZ.js → chunk-7SUWY37K.js} +2 -2
- package/dist/{chunk-KRIEQCKE.js → chunk-A2L3P2IY.js} +2 -2
- package/dist/{chunk-AMFCRZYB.js → chunk-AV2OQF2O.js} +2 -2
- package/dist/{chunk-WJLGUY27.js → chunk-BD5QEP3T.js} +2 -1
- package/dist/{chunk-C3WJNRGR.js → chunk-BH44JOLA.js} +2 -2
- package/dist/{chunk-NYVKLB2I.js → chunk-BX4WDBTE.js} +11 -11
- package/dist/{chunk-V4WSQYO6.js → chunk-CAUNCRLQ.js} +21 -21
- package/dist/{chunk-RH6QEGCT.js → chunk-D5UPBXZM.js} +2 -2
- package/dist/{chunk-77HNHT6S.js → chunk-E57LYSHI.js} +114 -4
- package/dist/chunk-E57LYSHI.js.map +1 -0
- package/dist/{chunk-IOM5QSNR.js → chunk-EKKAHJ4B.js} +2 -2
- package/dist/{chunk-JK3DYMOC.js → chunk-GKOML66M.js} +2 -2
- package/dist/{chunk-QW7G7PWN.js → chunk-I2M4ZVDD.js} +2 -2
- package/dist/{chunk-JTUKDLAD.js → chunk-J6FFBORM.js} +2 -2
- package/dist/{chunk-MAJ2OKE4.js → chunk-J7MDPTX7.js} +6 -6
- package/dist/{chunk-5FNVK7MW.js → chunk-JVNEXW6X.js} +2 -2
- package/dist/{chunk-IJWEXCWF.js → chunk-JXWTPOMJ.js} +2 -2
- package/dist/{chunk-3R6SLDTH.js → chunk-KJOGIRMF.js} +2 -2
- package/dist/{chunk-GDI64ITR.js → chunk-KWVI52ER.js} +2 -2
- package/dist/{chunk-AV46CT77.js → chunk-KX36OCGK.js} +2 -2
- package/dist/{chunk-2K7D6EFT.js → chunk-L3G5CGL5.js} +674 -126
- package/dist/chunk-L3G5CGL5.js.map +1 -0
- package/dist/{chunk-CSUAHUOH.js → chunk-MK552I5J.js} +2 -2
- package/dist/{chunk-BPY4RRTF.js → chunk-MO25AN7J.js} +10 -10
- package/dist/{chunk-NAHUBSUF.js → chunk-N75Q5ZSP.js} +2 -2
- package/dist/{chunk-HZVYDWUP.js → chunk-NQMG2W5L.js} +2 -2
- package/dist/{chunk-L3Z4NXDO.js → chunk-O52WWLKU.js} +3 -3
- package/dist/{chunk-OC6JYPZX.js → chunk-O5MW6CQL.js} +2 -2
- package/dist/{chunk-6PHB45IU.js → chunk-O6YDGTH4.js} +2 -2
- package/dist/{chunk-E5274WUC.js → chunk-OAIWPB2I.js} +19 -2
- package/dist/chunk-OAIWPB2I.js.map +1 -0
- package/dist/{chunk-5NOPZYNI.js → chunk-OFDIGTC2.js} +7 -7
- package/dist/{chunk-5EOV7ANU.js → chunk-OGWEWJRH.js} +2 -2
- package/dist/{chunk-3ENX2RB4.js → chunk-OM3RWZQK.js} +2 -2
- package/dist/{chunk-GSAZBZMA.js → chunk-PDVWGGX4.js} +2 -2
- package/dist/{chunk-N44GZ73R.js → chunk-SOJ3IQD3.js} +3 -3
- package/dist/{chunk-4OKPH6FG.js → chunk-SQA2MM2F.js} +2 -2
- package/dist/{chunk-7O252IE6.js → chunk-SSAXGPXY.js} +2 -2
- package/dist/{chunk-R2AWYR4Q.js → chunk-SVDU4OHO.js} +2 -2
- package/dist/{chunk-WPFSZZ35.js → chunk-UOA2VQ7C.js} +2 -2
- package/dist/{chunk-S4GUMZRB.js → chunk-VA2HNBGQ.js} +17 -17
- package/dist/{chunk-YAF3NRNC.js → chunk-VBJD4RSJ.js} +2 -2
- package/dist/{chunk-A6G7K273.js → chunk-VDXTXVFZ.js} +3 -3
- package/dist/{chunk-5Q4NQNW7.js → chunk-VJGDQA3D.js} +2 -2
- package/dist/{chunk-QN77HA6P.js → chunk-WCTL3PVM.js} +2 -2
- package/dist/{chunk-NXLQQ6WI.js → chunk-WH4QXVKU.js} +2 -2
- package/dist/{chunk-3VTNNO2B.js → chunk-WXFKXCOQ.js} +3 -3
- package/dist/{chunk-K3DZ3G5I.js → chunk-XQIHFXYP.js} +2 -2
- package/dist/{chunk-VSHRMIJH.js → chunk-YYNHJF3N.js} +2 -2
- package/dist/cli.js +40 -40
- package/dist/coding/export-okf-codegraph.js +1 -1
- package/dist/compounding/engine.d.ts +1 -5
- package/dist/compounding/engine.d.ts.map +1 -1
- package/dist/compounding/engine.js +5 -3
- package/dist/compounding/iso-week.d.ts +18 -0
- package/dist/compounding/iso-week.d.ts.map +1 -0
- package/dist/compounding/weekly-evidence.d.ts +123 -0
- package/dist/compounding/weekly-evidence.d.ts.map +1 -0
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.js +2 -2
- package/dist/connectors/index.js +2 -2
- package/dist/convergence-refresh.js +4 -4
- package/dist/corpus-watermark.js +4 -4
- package/dist/entity-retrieval.js +2 -2
- package/dist/external-wiki-access.js +15 -15
- package/dist/extraction.js +2 -2
- package/dist/harmonic-retrieval.js +2 -2
- package/dist/index.js +52 -52
- package/dist/location/index.js +4 -4
- package/dist/maintenance/memory-governance.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
- package/dist/maintenance/rebuild-memory-projection-runner.js +4 -4
- package/dist/maintenance/rebuild-memory-projection.js +3 -3
- package/dist/memory-browse-operations.js +15 -15
- package/dist/memory-browse.js +2 -2
- package/dist/namespaces/migrate.js +3 -3
- package/dist/namespaces/storage.js +2 -2
- package/dist/operator-doctor-corpus.js +5 -5
- package/dist/operator-toolkit.js +10 -10
- package/dist/orchestration/generic-recall-paths.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +11 -11
- package/dist/orchestrator.js +52 -52
- package/dist/recall-navigation-operations.js +15 -15
- package/dist/recall-navigation.js +14 -14
- package/dist/recall-state-view-admission.js +2 -2
- package/dist/recall-why-service.js +2 -2
- package/dist/resume-bundles.js +1 -1
- package/dist/semantic-consolidation.js +3 -3
- package/dist/semantic-rule-promotion.js +2 -2
- package/dist/semantic-rule-verifier.js +2 -2
- package/dist/shared-context/manager.d.ts +18 -0
- package/dist/shared-context/manager.d.ts.map +1 -1
- package/dist/shared-context/manager.js +7 -1
- package/dist/source-agent-qualifier.js +2 -2
- package/dist/standup/build.js +2 -2
- package/dist/storage.js +1 -1
- package/dist/support-passport/index.js +17 -17
- package/dist/transfer/export-okf.js +2 -2
- package/dist/verified-recall.js +2 -2
- package/dist/who-knows-cli.js +3 -3
- package/dist/who-knows.js +2 -2
- package/package.json +2 -2
- package/src/compounding/engine.ts +135 -130
- package/src/compounding/iso-week.ts +60 -0
- package/src/compounding/weekly-evidence.ts +698 -0
- package/src/orchestration/generic-recall-paths.ts +27 -1
- package/src/shared-context/manager.ts +132 -3
- package/dist/chunk-2K7D6EFT.js.map +0 -1
- package/dist/chunk-77HNHT6S.js.map +0 -1
- package/dist/chunk-E5274WUC.js.map +0 -1
- /package/dist/{chunk-ZQYAE2C5.js.map → chunk-2U4BM3TW.js.map} +0 -0
- /package/dist/{chunk-QFIPSKPC.js.map → chunk-3ZCRHW7U.js.map} +0 -0
- /package/dist/{chunk-76KHEHT2.js.map → chunk-4N2MFNTG.js.map} +0 -0
- /package/dist/{chunk-FBVLTTVV.js.map → chunk-4TP3MJ3D.js.map} +0 -0
- /package/dist/{chunk-JSIQSZXI.js.map → chunk-56GJLXBA.js.map} +0 -0
- /package/dist/{chunk-MVRIW6MI.js.map → chunk-6OAXWYE3.js.map} +0 -0
- /package/dist/{chunk-KDYQYMJZ.js.map → chunk-7SUWY37K.js.map} +0 -0
- /package/dist/{chunk-KRIEQCKE.js.map → chunk-A2L3P2IY.js.map} +0 -0
- /package/dist/{chunk-AMFCRZYB.js.map → chunk-AV2OQF2O.js.map} +0 -0
- /package/dist/{chunk-WJLGUY27.js.map → chunk-BD5QEP3T.js.map} +0 -0
- /package/dist/{chunk-C3WJNRGR.js.map → chunk-BH44JOLA.js.map} +0 -0
- /package/dist/{chunk-NYVKLB2I.js.map → chunk-BX4WDBTE.js.map} +0 -0
- /package/dist/{chunk-V4WSQYO6.js.map → chunk-CAUNCRLQ.js.map} +0 -0
- /package/dist/{chunk-RH6QEGCT.js.map → chunk-D5UPBXZM.js.map} +0 -0
- /package/dist/{chunk-IOM5QSNR.js.map → chunk-EKKAHJ4B.js.map} +0 -0
- /package/dist/{chunk-JK3DYMOC.js.map → chunk-GKOML66M.js.map} +0 -0
- /package/dist/{chunk-QW7G7PWN.js.map → chunk-I2M4ZVDD.js.map} +0 -0
- /package/dist/{chunk-JTUKDLAD.js.map → chunk-J6FFBORM.js.map} +0 -0
- /package/dist/{chunk-MAJ2OKE4.js.map → chunk-J7MDPTX7.js.map} +0 -0
- /package/dist/{chunk-5FNVK7MW.js.map → chunk-JVNEXW6X.js.map} +0 -0
- /package/dist/{chunk-IJWEXCWF.js.map → chunk-JXWTPOMJ.js.map} +0 -0
- /package/dist/{chunk-3R6SLDTH.js.map → chunk-KJOGIRMF.js.map} +0 -0
- /package/dist/{chunk-GDI64ITR.js.map → chunk-KWVI52ER.js.map} +0 -0
- /package/dist/{chunk-AV46CT77.js.map → chunk-KX36OCGK.js.map} +0 -0
- /package/dist/{chunk-CSUAHUOH.js.map → chunk-MK552I5J.js.map} +0 -0
- /package/dist/{chunk-BPY4RRTF.js.map → chunk-MO25AN7J.js.map} +0 -0
- /package/dist/{chunk-NAHUBSUF.js.map → chunk-N75Q5ZSP.js.map} +0 -0
- /package/dist/{chunk-HZVYDWUP.js.map → chunk-NQMG2W5L.js.map} +0 -0
- /package/dist/{chunk-L3Z4NXDO.js.map → chunk-O52WWLKU.js.map} +0 -0
- /package/dist/{chunk-OC6JYPZX.js.map → chunk-O5MW6CQL.js.map} +0 -0
- /package/dist/{chunk-6PHB45IU.js.map → chunk-O6YDGTH4.js.map} +0 -0
- /package/dist/{chunk-5NOPZYNI.js.map → chunk-OFDIGTC2.js.map} +0 -0
- /package/dist/{chunk-5EOV7ANU.js.map → chunk-OGWEWJRH.js.map} +0 -0
- /package/dist/{chunk-3ENX2RB4.js.map → chunk-OM3RWZQK.js.map} +0 -0
- /package/dist/{chunk-GSAZBZMA.js.map → chunk-PDVWGGX4.js.map} +0 -0
- /package/dist/{chunk-N44GZ73R.js.map → chunk-SOJ3IQD3.js.map} +0 -0
- /package/dist/{chunk-4OKPH6FG.js.map → chunk-SQA2MM2F.js.map} +0 -0
- /package/dist/{chunk-7O252IE6.js.map → chunk-SSAXGPXY.js.map} +0 -0
- /package/dist/{chunk-R2AWYR4Q.js.map → chunk-SVDU4OHO.js.map} +0 -0
- /package/dist/{chunk-WPFSZZ35.js.map → chunk-UOA2VQ7C.js.map} +0 -0
- /package/dist/{chunk-S4GUMZRB.js.map → chunk-VA2HNBGQ.js.map} +0 -0
- /package/dist/{chunk-YAF3NRNC.js.map → chunk-VBJD4RSJ.js.map} +0 -0
- /package/dist/{chunk-A6G7K273.js.map → chunk-VDXTXVFZ.js.map} +0 -0
- /package/dist/{chunk-5Q4NQNW7.js.map → chunk-VJGDQA3D.js.map} +0 -0
- /package/dist/{chunk-QN77HA6P.js.map → chunk-WCTL3PVM.js.map} +0 -0
- /package/dist/{chunk-NXLQQ6WI.js.map → chunk-WH4QXVKU.js.map} +0 -0
- /package/dist/{chunk-3VTNNO2B.js.map → chunk-WXFKXCOQ.js.map} +0 -0
- /package/dist/{chunk-K3DZ3G5I.js.map → chunk-XQIHFXYP.js.map} +0 -0
- /package/dist/{chunk-VSHRMIJH.js.map → chunk-YYNHJF3N.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/compounding/engine.ts","../src/compounding/iso-week.ts","../src/compounding/weekly-evidence.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { mkdir, readFile, readdir, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { isoWeekId } from \"./iso-week.js\";\nimport { log } from \"../logger.js\";\nimport { composeSalvagedEnvelope } from \"../salvage-envelope.js\";\nimport { sanitizeMemoryContent } from \"../sanitize.js\";\nimport { StorageManager } from \"../storage.js\";\nimport type { ContinuityIncidentRecord, PluginConfig } from \"../types.js\";\nimport { migrateLegacyFeedbackInbox, resolveFeedbackInboxPath, type SharedFeedbackEntry } from \"../shared-context/manager.js\";\nimport { parseContinuityImprovementLoops } from \"../identity-continuity.js\";\nimport { resolveQmdCapabilities, type QmdConfigProjection, resolveConsolidationCapabilities } from \"../capabilities.js\";\nimport { resolveConversationContextCapabilities } from \"../capabilities.js\";\nimport {\n actionEventsVisibleInStore, capWeeklyPatternDetails,\n buildActionFailurePatterns,\n defaultNamespaceRecallPrefix,\n provenanceVisibleInStoreRecall,\n visibleRubricEntries,\n readFeedbackEntriesForWeekFile,\n readWeeklyActionEvents,\n forgottenCorrectionPatterns, readWeeklyCorrections,\n type FeedbackEntryWithProvenance,\n type WeeklyActionEvent,\n type WeeklyCorrectionEvidence,\n} from \"./weekly-evidence.js\";\n\ntype MistakesFile = {\n version?: number;\n updatedAt: string;\n patterns: string[];\n registry?: MistakeRegistryEntry[];\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\" | \"correction\";\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\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\" | \"correction\",\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\" | \"correction\";\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 if (pattern.startsWith(\"correction:\")) {\n return {\n category: \"correction\",\n agent: null,\n workflow: \"corrections\",\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 // Linear trailing-punctuation strip (no `/[,:;]+$/` — CodeQL flags that as a\n // polynomial-backtracking ReDoS on long runs of ',;:'). Walk back once, O(n).\n let end = value.length;\n while (end > 0) {\n const ch = value[end - 1];\n if (ch === \",\" || ch === \":\" || ch === \";\") end--;\n else break;\n }\n return value.slice(0, end).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 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\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 = resolveFeedbackInboxPath(config);\n this.identityAuditWeeklyDir = path.join(config.memoryDir, \"identity\", \"audits\", \"weekly\");\n this.identityAuditMonthlyDir = path.join(config.memoryDir, \"identity\", \"audits\", \"monthly\");\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 try {\n await migrateLegacyFeedbackInbox(this.config);\n } catch (error) {\n log.warn(`[compounding] legacy feedback inbox migration failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n }\n const entries = await readFeedbackEntriesForWeekFile(this.feedbackInboxPath, weekId);\n const actionEvents = await readWeeklyActionEvents({\n storage: this.storage,\n memoryDir: this.config.memoryDir,\n weekId,\n });\n const defaultPrefix = await defaultNamespaceRecallPrefix(this.config);\n const corrections = await readWeeklyCorrections({\n storage: this.storage,\n memoryDir: this.config.memoryDir,\n weekId, defaultNamespacePrefix: defaultPrefix,\n });\n const actionPatterns = buildActionFailurePatterns(actionEvents);\n const outcomeSummary = this.buildActionOutcomeSummary(actionEvents);\n const storeOutcomeSummary = this.buildActionOutcomeSummary(actionEventsVisibleInStore(actionEvents, defaultPrefix));\n const previousMistakes = await this.readMistakes();\n const priorRegistry = previousMistakes?.registry ?? [];\n const forgottenPatterns = await forgottenCorrectionPatterns(this.storage, this.config.memoryDir, priorRegistry, defaultPrefix);\n const mistakes = this.buildMistakes(entries, actionPatterns, corrections, weekId, priorRegistry, defaultPrefix, forgottenPatterns);\n const rubrics = this.buildRubricSnapshot(entries, storeOutcomeSummary, corrections);\n let promotionCandidates = resolveConsolidationCapabilities(this.config).compoundingSemantic\n ? this.derivePromotionCandidates(storeOutcomeSummary, mistakes.registry, rubrics, defaultPrefix)\n : [];\n if (resolveConversationContextCapabilities(this.config).cmcConsolidation) {\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 { calibrationConsolidationInput, runCalibrationConsolidation } = await import(\"../calibration.js\");\n const calRules = await runCalibrationConsolidation(calibrationConsolidationInput(this.config));\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(storeOutcomeSummary, 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 // Sealed-envelope write (issue #1989 PR4): synthesized machine data.\n const promotionInput = { content: persistedContent, category: candidate.category, confidence, tags: uniqueTags };\n const { id, tombstoneBlocked } = await storage.writeSealedMemory(\n composeSalvagedEnvelope(\"compounding-promotion\", promotionInput, { source: \"compounding-promotion\" }),\n { lineage, 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 const defaultPrefix = await defaultNamespaceRecallPrefix(this.config);\n\n const activePatterns = (mistakes?.registry ?? [])\n .filter((entry) => entry.status === \"active\" && provenanceVisibleInStoreRecall(entry.provenance, defaultPrefix))\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 = visibleRubricEntries(\n [...(rubrics?.workflows ?? []), ...(rubrics?.agents ?? [])],\n (entry) => this.getRubricObservationEntries(entry),\n defaultPrefix,\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 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(`${event.ledgerLabel}: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 defaultNamespacePrefix: string | null = null,\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 (!provenanceVisibleInStoreRecall(entry.provenance, defaultNamespacePrefix)) 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 if (!provenanceVisibleInStoreRecall(observation.provenance, defaultNamespacePrefix)) 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: Array<{ pattern: string; provenance: string }>,\n corrections: WeeklyCorrectionEvidence[],\n weekId: string,\n previousRegistry: MistakeRegistryEntry[] = [], defaultNamespacePrefix: string | null = null, forgottenPatterns: ReadonlySet<string> = new Set(),\n ): MistakesFile & { details: PatternWithProvenance[]; registry: MistakeRegistryEntry[] } {\n const patterns: PatternWithProvenance[] = [];\n const evidenceByPattern = new Map<string, {\n category: \"feedback\" | \"action\" | \"correction\";\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 correction of corrections) {\n patterns.push({ pattern: correction.pattern, provenance: [correction.provenance] });\n const visible = provenanceVisibleInStoreRecall([correction.provenance], defaultNamespacePrefix);\n const prev = evidenceByPattern.get(correction.pattern) ?? {\n category: \"correction\" as const,\n agent: visible ? correction.source : null,\n workflow: visible ? (correction.entityRef ?? \"corrections\") : \"corrections\",\n tags: new Set<string>(),\n severity: null,\n confidence: visible ? correction.confidence : null,\n outcome: null,\n timestamps: [],\n evidenceWindow: { start: correction.created, end: correction.created },\n };\n if (visible) for (const tag of correction.tags) prev.tags.add(tag);\n prev.timestamps.push(correction.created);\n if (visible && prev.agent === null && correction.source) prev.agent = correction.source;\n if (visible && correction.entityRef && prev.workflow === \"corrections\") prev.workflow = correction.entityRef;\n if (visible && prev.confidence === null) prev.confidence = correction.confidence;\n prev.evidenceWindow = mergeEvidenceWindows(prev.evidenceWindow, {\n start: correction.created,\n end: correction.created,\n });\n evidenceByPattern.set(correction.pattern, prev);\n }\n\n for (const item of actionPatterns) {\n patterns.push({ pattern: item.pattern, provenance: [item.provenance] });\n const previous = evidenceByPattern.get(item.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(item.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 = capWeeklyPatternDetails(\n [...byPattern.entries()].map(([pattern, provenance]) => ({ pattern, provenance: [...provenance].sort() })),\n (pattern) => evidenceByPattern.get(pattern)?.category, defaultNamespacePrefix);\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: forgottenPatterns.has(previous.pattern) || staleWeeks >= RETIREMENT_WINDOW_WEEKS ? \"retired\" : previous.status,\n retiredAt: forgottenPatterns.has(previous.pattern) || 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 corrections: WeeklyCorrectionEvidence[] = [],\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 correction of corrections) {\n if (correction.source) {\n const agentEntry = byAgent.get(correction.source) ?? {\n id: stableRubricId(\"agent\", correction.source),\n kind: \"agent\" as const,\n subject: correction.source,\n observations: [],\n tags: [],\n provenance: [],\n observationEntries: [],\n updatedAt,\n };\n this.addRubricObservation(agentEntry, correction.note, correction.provenance);\n agentEntry.tags = normalizeTags([...agentEntry.tags, ...correction.tags]);\n byAgent.set(correction.source, agentEntry);\n }\n const workflow = correction.entityRef ?? \"corrections\";\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, correction.note, correction.provenance);\n workflowEntry.tags = normalizeTags([...workflowEntry.tags, ...correction.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, correction memories, and 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","/**\n * UTC ISO-8601 week ids (`YYYY-Www`) shared by compounding reports and the\n * daemon weekly run. Week boundaries follow the Thursday rule: the week\n * belongs to the year that contains its Thursday.\n */\n\nconst DAY_MS = 86_400_000;\nconst WEEK_MS = 7 * DAY_MS;\n\n/** ISO week id for `d`, evaluated in UTC. */\nexport function 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\n/** The ISO week that ended before the week containing `d`. */\nexport function previousIsoWeekId(d: Date): string {\n const dt = new Date(d.getTime());\n dt.setUTCDate(dt.getUTCDate() - 7);\n return isoWeekId(dt);\n}\n\n/**\n * Milliseconds until the next Monday 00:00 UTC. Exactly on a Monday boundary\n * the next run is one week out, so a tick that fires on the boundary does not\n * schedule a zero-delay follow-up.\n */\nexport function msUntilNextIsoWeek(d: Date): number {\n const utcMidnight = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());\n const day = new Date(utcMidnight).getUTCDay() || 7;\n const daysFromMonday = day - 1;\n const thisMonday = utcMidnight - daysFromMonday * DAY_MS;\n const nextMonday = thisMonday + WEEK_MS;\n const delta = nextMonday - d.getTime();\n if (delta <= 0) return WEEK_MS;\n return delta;\n}\n\n/** True for the `YYYY-Www` ids this module produces (week 01 through 53). */\nexport function isIsoWeekId(weekId: string): boolean {\n if (weekId.length !== 8 || weekId[4] !== \"-\" || weekId[5] !== \"W\") return false;\n const year = weekId.slice(0, 4);\n const week = weekId.slice(6);\n for (let i = 0; i < year.length; i += 1) {\n const code = year.charCodeAt(i);\n if (code < 48 || code > 57) return false;\n }\n for (let i = 0; i < week.length; i += 1) {\n const code = week.charCodeAt(i);\n if (code < 48 || code > 57) return false;\n }\n const weekNum = Number(week);\n return weekNum >= 1 && weekNum <= 53;\n}\n","/**\n * Week-scoped inputs for compounding synthesis.\n *\n * Corrections, namespace action ledgers, and the feedback inbox are read here\n * so CompoundingEngine stays inside its line ceiling. Scans are bounded:\n * correction files outside the ISO week are skipped before they are read.\n * Parsing stops after WEEKLY_CORRECTION_READ_LIMIT accepted corrections or\n * WEEKLY_CORRECTION_SCAN_LIMIT opened files, whichever comes first. Visible\n * store candidates are opened before other namespaces, so a foreign store\n * cannot fill the accepted cap and hide an older default-store correction.\n */\n\nimport type { Stats } from \"node:fs\";\nimport { lstat, readFile, readdir, realpath } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { log } from \"../logger.js\";\nimport { namespaceIdentityFromToken } from \"../namespaces/identity.js\";\nimport { resolveDefaultNamespaceRoot } from \"../namespaces/storage.js\";\nimport { isSafeRouteNamespace } from \"../routing/engine.js\";\nimport { secureStoreDir } from \"../secure-store/header.js\";\nimport * as keyring from \"../secure-store/keyring.js\";\nimport { readMaybeEncryptedFile } from \"../secure-store/secure-fs.js\";\nimport { type SharedFeedbackEntry, SharedFeedbackEntrySchema } from \"../shared-context/manager.js\";\nimport { readRawMemoryDocument } from \"../storage/memory-frontmatter-metadata.js\";\nimport { readMaybeEncryptedLines } from \"../storage/secure-line-reader.js\";\nimport type { MemoryActionEvent, MemoryFile, PluginConfig } from \"../types.js\";\nimport { isErrnoCode } from \"../utils/errno.js\";\nimport { assertPathInsideRoot } from \"../utils/path-containment.js\";\nimport { isIsoWeekId, isoWeekId } from \"./iso-week.js\";\n\nconst DAY_MS = 86_400_000;\n\n/** Accepted in-week corrections kept per synthesis. */\nexport const WEEKLY_CORRECTION_READ_LIMIT = 500;\n\n/** Opened in-week correction files per synthesis, including ones policy rejects. */\nexport const WEEKLY_CORRECTION_SCAN_LIMIT = 2000;\n\n/** Skip a correction file whose on-disk size exceeds this, before parsing. */\nexport const CORRECTION_FILE_BYTE_LIMIT = 256 * 1024;\n\nconst CORRECTION_NOTE_LIMIT = 240;\n\nexport type FeedbackEntryWithProvenance = {\n entry: SharedFeedbackEntry;\n sourceLine: number;\n sourcePath: string;\n entryId: string;\n};\n\nexport type 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 /** Stable ledger label recorded in outcome provenance. */\n ledgerLabel: string;\n actionId: string | null;\n};\n\nexport type WeeklyCorrectionEvidence = {\n id: string;\n namespace: string;\n pattern: string;\n note: string;\n created: string;\n source: string | null;\n entityRef: string | null;\n confidence: number | null;\n tags: string[];\n provenance: string;\n};\n\nexport type WeeklyEvidenceStorage = {\n readMemoryByPath(filePath: string): Promise<MemoryFile | null>;\n readMemoryActionEventRows(limit: number): Promise<Array<{ line: number; event: MemoryActionEvent }>>;\n};\n\ntype CorrectionCandidate = {\n filePath: string;\n sortMs: number;\n namespace: string;\n};\n\ntype NamespaceDir = {\n dirName: string;\n namespace: string;\n root: string;\n};\n\n/** Monday 00:00 UTC of an ISO week id, or null when `weekId` is not one this module emits. */\nexport function isoWeekStartMs(weekId: string): number | null {\n if (!isIsoWeekId(weekId)) return null;\n const year = Number(weekId.slice(0, 4));\n const week = Number(weekId.slice(6));\n const jan4 = Date.UTC(year, 0, 4);\n const jan4Day = new Date(jan4).getUTCDay() || 7;\n const start = jan4 - (jan4Day - 1) * DAY_MS + (week - 1) * 7 * DAY_MS;\n if (isoWeekId(new Date(start)) !== weekId) return null;\n return start;\n}\n\nexport async function readFeedbackEntriesForWeekFile(\n inboxPath: string,\n weekId: string\n): Promise<FeedbackEntryWithProvenance[]> {\n // Includes entries whose date falls in the ISO week.\n const out: FeedbackEntryWithProvenance[] = [];\n try {\n const raw = await readFile(inboxPath, \"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: inboxPath,\n entryId: `${parsed.data.agent}-${parsed.data.date}-${sourceLine}`.replace(/[^a-zA-Z0-9._:-]/g, \"_\"),\n });\n } catch {\n // ignore a malformed line\n }\n }\n } catch {\n // missing feedback is normal\n }\n return out;\n}\n\nexport function buildActionFailurePatterns(\n events: WeeklyActionEvent[]\n): Array<{ pattern: string; provenance: string }> {\n const out: Array<{ pattern: string; provenance: 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 ? ` - ${event.reason.trim().slice(0, 140)}` : \"\";\n out.push({\n pattern: `memory-action/${event.namespace}: ${event.action} ${event.outcome}${event.policyDecision ? `/${event.policyDecision}` : \"\"}${suffix}`,\n provenance: `${event.ledgerLabel}:*`,\n });\n }\n return out;\n}\n\nexport async function readWeeklyActionEvents(input: {\n storage: WeeklyEvidenceStorage;\n memoryDir: string;\n weekId: string;\n}): Promise<WeeklyActionEvent[]> {\n const seenActionIds = new Set<string>();\n const out: WeeklyActionEvent[] = [];\n const rootRows = await input.storage.readMemoryActionEventRows(Number.MAX_SAFE_INTEGER);\n for (const row of rootRows) {\n pushActionEvent(out, seenActionIds, row.line, row.event, \"default\", \"memory-actions.jsonl\", input.weekId);\n }\n\n const rootReal = await realpath(input.memoryDir);\n const namespaces = await listNamespaceStorageDirs(input.memoryDir, rootReal);\n const key = keyring.getKey(secureStoreDir(input.memoryDir));\n for (const ns of namespaces) {\n const filePath = path.join(ns.root, \"state\", \"memory-actions.jsonl\");\n const label = `namespaces/${ns.dirName}/state/memory-actions.jsonl`;\n let entryStat: Stats;\n try {\n entryStat = await lstat(filePath);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) continue;\n throw err;\n }\n if (entryStat.isSymbolicLink() || !entryStat.isFile()) continue;\n const fileReal = await realpath(filePath);\n assertPathInsideRoot(rootReal, fileReal, filePath);\n try {\n let lineNumber = 0;\n for await (const row of readMaybeEncryptedLines(\n filePath,\n () => readMaybeEncryptedFile(filePath, key, input.memoryDir),\n )) {\n lineNumber += 1;\n const line = row.trim();\n if (line.length === 0) continue;\n const event = parseMemoryActionEventLine(line);\n if (!event) continue;\n pushActionEvent(out, seenActionIds, lineNumber, event, ns.namespace, label, input.weekId);\n }\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) continue;\n throw err;\n }\n }\n return out;\n}\n\nexport async function readWeeklyCorrections(input: {\n storage: WeeklyEvidenceStorage;\n memoryDir: string;\n weekId: string;\n /** Flat root stays visible when this is null. A routed default store passes its `namespaces/<dir>/` prefix. */\n defaultNamespacePrefix?: string | null;\n}): Promise<WeeklyCorrectionEvidence[]> {\n const weekStartMs = isoWeekStartMs(input.weekId);\n if (weekStartMs === null) return [];\n const rootReal = await realpath(input.memoryDir);\n const candidates: CorrectionCandidate[] = [];\n await collectCorrectionCandidates(candidates, input.memoryDir, \"default\", input.weekId, weekStartMs, rootReal);\n const namespaces = await listNamespaceStorageDirs(input.memoryDir, rootReal);\n for (const ns of namespaces) {\n await collectCorrectionCandidates(candidates, ns.root, ns.namespace, input.weekId, weekStartMs, rootReal);\n }\n candidates.sort((a, b) => b.sortMs - a.sortMs || a.filePath.localeCompare(b.filePath));\n const ordered = preferVisibleCorrectionCandidates(\n candidates,\n input.memoryDir,\n input.defaultNamespacePrefix ?? null,\n );\n const out: WeeklyCorrectionEvidence[] = [];\n let scanned = 0;\n for (const candidate of ordered) {\n if (out.length >= WEEKLY_CORRECTION_READ_LIMIT || scanned >= WEEKLY_CORRECTION_SCAN_LIMIT) break;\n scanned += 1;\n const evidence = await readCorrectionCandidate(input.storage, input.memoryDir, input.weekId, candidate);\n if (evidence) out.push(evidence);\n }\n if (scanned < candidates.length) {\n log.warn(\n `weekly synthesis kept ${out.length} accepted corrections after scanning ${scanned} of ${candidates.length} in-week candidates`\n );\n }\n return out;\n}\n\n/** Newest-first within the visible store, then newest-first everywhere else. */\nfunction preferVisibleCorrectionCandidates(\n candidates: readonly CorrectionCandidate[],\n memoryDir: string,\n defaultNamespacePrefix: string | null,\n): CorrectionCandidate[] {\n const visible: CorrectionCandidate[] = [];\n const foreign: CorrectionCandidate[] = [];\n for (const candidate of candidates) {\n const relative = path.relative(memoryDir, candidate.filePath).split(path.sep).join(\"/\");\n if (provenanceVisibleInStoreRecall([relative], defaultNamespacePrefix)) visible.push(candidate);\n else foreign.push(candidate);\n }\n return visible.concat(foreign);\n}\n\nfunction parseMemoryActionEventLine(line: string): MemoryActionEvent | null {\n let parsed: Partial<MemoryActionEvent> & { recordKind?: unknown };\n try {\n parsed = JSON.parse(line) as Partial<MemoryActionEvent> & { recordKind?: unknown };\n } catch {\n return null;\n }\n if (parsed.recordKind !== undefined) return null;\n const outcome = parsed.outcome === \"applied\" || parsed.outcome === \"skipped\" || parsed.outcome === \"failed\"\n ? parsed.outcome\n : null;\n const timestamp = parsed.timestamp;\n const action = parsed.action;\n if (typeof timestamp !== \"string\" || typeof action !== \"string\" || outcome === null) return null;\n return { ...parsed, timestamp, action, outcome };\n}\n\nfunction pushActionEvent(\n out: WeeklyActionEvent[],\n seenActionIds: Set<string>,\n line: number,\n event: MemoryActionEvent,\n fallbackNamespace: string,\n ledgerLabel: string,\n weekId: string\n): void {\n const ts = new Date(event.timestamp);\n if (!Number.isFinite(ts.getTime()) || isoWeekId(ts) !== weekId) return;\n const actionId = typeof event.actionId === \"string\" && event.actionId.length > 0 ? event.actionId : null;\n if (actionId) {\n if (seenActionIds.has(actionId)) return;\n seenActionIds.add(actionId);\n }\n out.push({\n line,\n action: event.action,\n outcome: event.outcome,\n policyDecision: event.policyDecision === \"deny\" || event.policyDecision === \"defer\" ? event.policyDecision : null,\n namespace: typeof event.namespace === \"string\" && event.namespace.length > 0 ? event.namespace : fallbackNamespace,\n reason: typeof event.reason === \"string\" ? event.reason : null,\n ledgerLabel,\n actionId,\n });\n}\n\nasync function listNamespaceStorageDirs(memoryDir: string, rootReal: string): Promise<NamespaceDir[]> {\n const nsRoot = path.join(memoryDir, \"namespaces\");\n let rootStat: Stats;\n try {\n rootStat = await lstat(nsRoot);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) return [];\n throw err;\n }\n // A symlinked namespaces directory can point outside the store. Reject the\n // whole tree rather than following it.\n if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) return [];\n const nsReal = await realpath(nsRoot);\n assertPathInsideRoot(rootReal, nsReal, nsRoot);\n const names = await readdir(nsRoot);\n const out: NamespaceDir[] = [];\n for (const dirName of names) {\n const namespace = namespaceFromDirName(dirName);\n if (!namespace) continue;\n const root = path.join(nsRoot, dirName);\n let entryStat: Stats;\n try {\n entryStat = await lstat(root);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) continue;\n throw err;\n }\n if (entryStat.isSymbolicLink() || !entryStat.isDirectory()) continue;\n const dirReal = await realpath(root);\n assertPathInsideRoot(rootReal, dirReal, root);\n out.push({ dirName, namespace, root });\n }\n out.sort((a, b) => a.dirName.localeCompare(b.dirName));\n return out;\n}\n\nfunction namespaceFromDirName(dirName: string): string | null {\n if (dirName.length === 0 || dirName.includes(\"/\") || dirName.includes(\"\\\\\") || dirName.includes(\"..\")) {\n return null;\n }\n if (dirName.startsWith(\"ns-\")) {\n const decoded = namespaceIdentityFromToken(dirName);\n if (decoded === null) return null;\n // `ns-default` is the empty identity. It is the migrated default store,\n // not a foreign namespace.\n if (decoded.length === 0) return \"default\";\n return isSafeRouteNamespace(decoded) ? decoded : null;\n }\n return isSafeRouteNamespace(dirName) ? dirName : null;\n}\n\nasync function collectCorrectionCandidates(\n candidates: CorrectionCandidate[],\n storageRoot: string,\n namespace: string,\n weekId: string,\n weekStartMs: number,\n rootReal: string\n): Promise<void> {\n await collectCorrectionDir(\n candidates,\n path.join(storageRoot, \"corrections\"),\n namespace,\n weekId,\n weekStartMs,\n rootReal\n );\n const factsDir = path.join(storageRoot, \"facts\");\n const dayNames = await readContainedDirNames(factsDir, rootReal);\n if (!dayNames) return;\n for (const dayName of dayNames) {\n if (!utcDayDirInWeek(dayName, weekId)) continue;\n await collectCorrectionDir(candidates, path.join(factsDir, dayName), namespace, weekId, weekStartMs, rootReal);\n }\n}\n\nasync function collectCorrectionDir(\n candidates: CorrectionCandidate[],\n dir: string,\n namespace: string,\n weekId: string,\n weekStartMs: number,\n rootReal: string\n): Promise<void> {\n const names = await readContainedDirNames(dir, rootReal);\n if (!names) return;\n for (const name of names) {\n if (!name.startsWith(\"correction-\") || !name.endsWith(\".md\")) continue;\n // A timestamped name outside this week is historical. Skip it before\n // lstat or realpath so a large corrections directory stays inside the\n // weekly budget.\n const filenameMs = correctionFilenameTimestampMs(name);\n if (filenameMs !== null && isoWeekId(new Date(filenameMs)) !== weekId) continue;\n const filePath = path.join(dir, name);\n let entryStat: Stats;\n try {\n entryStat = await lstat(filePath);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) continue;\n throw err;\n }\n if (entryStat.isSymbolicLink() || !entryStat.isFile()) continue;\n if (entryStat.size > CORRECTION_FILE_BYTE_LIMIT) continue;\n const fileReal = await realpath(filePath);\n assertPathInsideRoot(rootReal, fileReal, filePath);\n if (filenameMs !== null) {\n candidates.push({ filePath, sortMs: filenameMs, namespace });\n continue;\n }\n if (entryStat.mtimeMs < weekStartMs) continue;\n candidates.push({ filePath, sortMs: entryStat.mtimeMs, namespace });\n }\n}\n\nasync function readContainedDirNames(dir: string, rootReal: string): Promise<string[] | null> {\n let entryStat: Stats;\n try {\n entryStat = await lstat(dir);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) return null;\n throw err;\n }\n if (entryStat.isSymbolicLink() || !entryStat.isDirectory()) return null;\n const dirReal = await realpath(dir);\n assertPathInsideRoot(rootReal, dirReal, dir);\n return readdir(dir);\n}\n\nfunction utcDayDirInWeek(name: string, weekId: string): boolean {\n if (name.length !== 10 || name[4] !== \"-\" || name[7] !== \"-\") return false;\n for (let i = 0; i < name.length; i += 1) {\n if (i === 4 || i === 7) continue;\n const code = name.charCodeAt(i);\n if (code < 48 || code > 57) return false;\n }\n const year = Number(name.slice(0, 4));\n const month = Number(name.slice(5, 7));\n const day = Number(name.slice(8, 10));\n if (month < 1 || month > 12 || day < 1 || day > 31) return false;\n const stamp = new Date(Date.UTC(year, month - 1, day));\n if (stamp.getUTCFullYear() !== year || stamp.getUTCMonth() !== month - 1 || stamp.getUTCDate() !== day) {\n return false;\n }\n return isoWeekId(stamp) === weekId;\n}\n\nfunction correctionFilenameTimestampMs(fileName: string): number | null {\n const prefix = \"correction-\";\n if (!fileName.startsWith(prefix) || !fileName.endsWith(\".md\")) return null;\n const rest = fileName.slice(prefix.length, fileName.length - 3);\n let i = 0;\n while (i < rest.length) {\n const code = rest.charCodeAt(i);\n if (code < 48 || code > 57) break;\n i += 1;\n }\n if (i < 10) return null;\n if (i < rest.length && rest[i] !== \"-\") return null;\n const ms = Number(rest.slice(0, i));\n if (!Number.isSafeInteger(ms)) return null;\n return ms;\n}\n\nasync function readCorrectionCandidate(\n storage: WeeklyEvidenceStorage,\n memoryDir: string,\n weekId: string,\n candidate: CorrectionCandidate\n): Promise<WeeklyCorrectionEvidence | null> {\n const memory = await storage.readMemoryByPath(candidate.filePath);\n if (!memory) return null;\n const raw = readRawMemoryDocument(memory);\n if (!raw) return null;\n if (rawFrontmatterScalar(raw, \"category\") !== \"correction\") return null;\n // Missing status is the writer default (`active`). Any other explicit\n // status, including forgotten, stays out of compounding so a forget is\n // not copied back into recall or promotion.\n const status = rawFrontmatterScalar(raw, \"status\");\n if (status && status !== \"active\") return null;\n const created = rawFrontmatterScalar(raw, \"created\");\n if (!created) return null;\n const createdDate = new Date(created);\n if (!Number.isFinite(createdDate.getTime()) || isoWeekId(createdDate) !== weekId) return null;\n const note = collapseWhitespace(memory.content).slice(0, CORRECTION_NOTE_LIMIT);\n if (note.length === 0) return null;\n const rawSource = rawFrontmatterScalar(raw, \"source\");\n const source = rawSource && rawSource !== \"unknown\" ? rawSource : null;\n const entityRef =\n typeof memory.frontmatter.entityRef === \"string\" && memory.frontmatter.entityRef.length > 0\n ? memory.frontmatter.entityRef\n : null;\n const confidence = rawConfidence(raw);\n const tags = Array.isArray(memory.frontmatter.tags)\n ? memory.frontmatter.tags.filter((tag) => typeof tag === \"string\" && tag.length > 0)\n : [];\n const id =\n typeof memory.frontmatter.id === \"string\" && memory.frontmatter.id.length > 0\n ? memory.frontmatter.id\n : path.basename(candidate.filePath, \".md\");\n return {\n id,\n namespace: candidate.namespace,\n pattern: `correction: ${note}`,\n note,\n created,\n source,\n entityRef,\n confidence,\n tags,\n provenance: path.relative(memoryDir, candidate.filePath).split(path.sep).join(\"/\"),\n };\n}\n\n/**\n * Relative `namespaces/` prefix for the routed default store, or null when\n * that store is still the flat memory root. Recall and promotion treat this\n * prefix as the caller's own store.\n */\nexport async function defaultNamespaceRecallPrefix(config: PluginConfig): Promise<string | null> {\n const root = await resolveDefaultNamespaceRoot(config);\n const rel = path.relative(path.resolve(config.memoryDir), path.resolve(root));\n if (rel === \"\" || rel === \".\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const posix = rel.split(path.sep).join(\"/\");\n if (!posix.startsWith(\"namespaces/\")) return null;\n return `${posix}/`;\n}\n\n/**\n * Store recall and promotion keep the flat root and the routed default\n * namespace. Other `namespaces/` provenance stays on the weekly report.\n */\nexport function visibleRubricEntries<T extends {\n observations: string[];\n provenance: string[];\n observationEntries?: Array<{ note: string; provenance: string[] }>;\n}>(\n entries: T[],\n observationsFor: (entry: T) => Array<{ note: string; provenance: string[] }>,\n defaultNamespacePrefix: string | null,\n): T[] {\n return entries.flatMap((entry) => {\n const visible = observationsFor(entry).filter((item) =>\n provenanceVisibleInStoreRecall(item.provenance, defaultNamespacePrefix),\n );\n if (visible.length === 0) return [];\n return [{\n ...entry,\n observations: visible.map((item) => item.note),\n provenance: [...new Set(visible.flatMap((item) => item.provenance))],\n observationEntries: visible,\n }];\n });\n}\n\n/**\n * The mistake registry keeps 500 patterns. Store-visible action failures stay\n * ahead of correction text, and every visible pattern stays ahead of another\n * namespace, so a full correction week cannot drop the caller's own outcomes.\n */\nexport function capWeeklyPatternDetails<T extends { pattern: string; provenance: readonly string[] }>(\n details: readonly T[],\n categoryFor: (pattern: string) => string | undefined,\n defaultNamespacePrefix: string | null,\n limit = 500,\n): T[] {\n const visibleActions: T[] = [];\n const visibleOther: T[] = [];\n const foreign: T[] = [];\n for (const detail of details) {\n if (!provenanceVisibleInStoreRecall(detail.provenance, defaultNamespacePrefix)) {\n foreign.push(detail);\n continue;\n }\n if (categoryFor(detail.pattern) === \"action\") visibleActions.push(detail);\n else visibleOther.push(detail);\n }\n return [...visibleActions, ...visibleOther, ...foreign].slice(0, limit);\n}\n\n/**\n * Active correction mistakes whose visible source files are all missing or\n * non-active. The next synthesis retires those registry entries immediately.\n * Every active correction entry is checked. The weekly pattern cap and the\n * retirement window already bound how many of those entries exist.\n */\nexport async function forgottenCorrectionPatterns(\n storage: WeeklyEvidenceStorage,\n memoryDir: string,\n registry: ReadonlyArray<{ category?: string; status?: string; pattern: string; provenance?: readonly string[] }>,\n defaultNamespacePrefix: string | null,\n): Promise<Set<string>> {\n const out = new Set<string>();\n for (const entry of registry) {\n if (entry.category !== \"correction\" || entry.status !== \"active\") continue;\n const visible = (entry.provenance ?? []).filter((item) =>\n provenanceVisibleInStoreRecall([item], defaultNamespacePrefix),\n );\n if (visible.length === 0) continue;\n let stillActive = false;\n for (const rel of visible) {\n if (rel.includes(\"..\") || path.isAbsolute(rel)) {\n stillActive = true;\n break;\n }\n let memory: MemoryFile | null;\n try {\n memory = await storage.readMemoryByPath(path.join(memoryDir, rel));\n } catch {\n stillActive = true;\n break;\n }\n if (!memory) {\n // readMemoryByPath returns null for a missing file and for a read\n // or decrypt failure. Only a confirmed absence can retire the lesson.\n const sourcePath = path.join(memoryDir, rel);\n try {\n await lstat(sourcePath);\n stillActive = true;\n break;\n } catch (err) {\n if (!isErrnoCode(err, \"ENOENT\")) {\n stillActive = true;\n break;\n }\n }\n continue;\n }\n const raw = readRawMemoryDocument(memory);\n const status = raw ? rawFrontmatterScalar(raw, \"status\") : undefined;\n if (!status || status === \"active\") {\n stillActive = true;\n break;\n }\n }\n if (!stillActive) out.add(entry.pattern);\n }\n return out;\n}\n\nexport function provenanceVisibleInStoreRecall(\n provenance: readonly string[],\n defaultNamespacePrefix: string | null = null,\n): boolean {\n return provenance.length === 0 || provenance.some((item) => {\n if (!item.startsWith(\"namespaces/\")) return true;\n return defaultNamespacePrefix !== null && item.startsWith(defaultNamespacePrefix);\n });\n}\n\n/** Ledger rows that belong to the flat root or the routed default namespace. */\nexport function actionEventsVisibleInStore<T extends { ledgerLabel: string; line: number }>(\n events: readonly T[],\n defaultNamespacePrefix: string | null,\n): T[] {\n return events.filter((event) =>\n provenanceVisibleInStoreRecall([`${event.ledgerLabel}:L${event.line}`], defaultNamespacePrefix),\n );\n}\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n\nfunction rawConfidence(raw: string): number | null {\n const text = rawFrontmatterScalar(raw, \"confidence\");\n if (!text) return null;\n const value = Number(text);\n if (!Number.isFinite(value)) return null;\n return Math.max(0, Math.min(1, value));\n}\n\n/** Top-level frontmatter scalar. Missing keys stay missing — parser defaults are not used. */\nfunction rawFrontmatterScalar(raw: string, key: string): string | undefined {\n const newline = raw.startsWith(\"---\\r\\n\") ? 5 : raw.startsWith(\"---\\n\") ? 4 : -1;\n if (newline < 0) return undefined;\n const headerEnd = raw.indexOf(\"\\n---\", newline);\n if (headerEnd < 0) return undefined;\n const block = raw.slice(newline, headerEnd);\n const prefix = `${key}:`;\n for (const line of block.split(\"\\n\")) {\n const normalized = line.endsWith(\"\\r\") ? line.slice(0, -1) : line;\n if (normalized.startsWith(\" \") || normalized.startsWith(\"\\t\")) continue;\n if (!normalized.startsWith(prefix)) continue;\n let value = normalized.slice(prefix.length).trim();\n if (value.length >= 2) {\n const quote = value[0];\n if ((quote === '\"' || quote === \"'\") && value.endsWith(quote)) {\n value = value.slice(1, -1);\n }\n }\n return value.length > 0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,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAc,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,aAAaA,MAAK,KAAK,KAAK,wBAAwB,GAAG,MAAM,KAAK;AACxE,UAAM,cAAcA,MAAK,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":["readFile","readdir","path","DAY_MS","limit","path","readFile","readdir"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot,
|
|
3
3
|
resolveNamespaceStorageRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D5UPBXZM.js";
|
|
5
5
|
import {
|
|
6
6
|
MutationSerializer,
|
|
7
7
|
withHeldFileLock
|
|
@@ -1473,4 +1473,4 @@ export {
|
|
|
1473
1473
|
isNamespaceKind,
|
|
1474
1474
|
NamespaceCatalog
|
|
1475
1475
|
};
|
|
1476
|
-
//# sourceMappingURL=chunk-
|
|
1476
|
+
//# sourceMappingURL=chunk-MK552I5J.js.map
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
} from "./chunk-7OAIOE5P.js";
|
|
22
22
|
import {
|
|
23
23
|
handleSupportPassportOwnerHttp
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SQA2MM2F.js";
|
|
25
25
|
import {
|
|
26
26
|
buildSupportPassportPublicRequestHandler
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UOA2VQ7C.js";
|
|
28
28
|
import {
|
|
29
29
|
handleMcpGetSse
|
|
30
30
|
} from "./chunk-SRT6SHVZ.js";
|
|
@@ -37,14 +37,14 @@ import {
|
|
|
37
37
|
processChatMessage,
|
|
38
38
|
sessionBelongsToPrincipal,
|
|
39
39
|
subscribeChatTranscript
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-SOJ3IQD3.js";
|
|
41
41
|
import {
|
|
42
42
|
handleRecallWhyHttpQuery,
|
|
43
43
|
handleRecallXrayHttpQuery
|
|
44
44
|
} from "./chunk-5X4ZJESN.js";
|
|
45
45
|
import {
|
|
46
46
|
RelayMissionStoreError
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-4TP3MJ3D.js";
|
|
48
48
|
import {
|
|
49
49
|
executeResolution,
|
|
50
50
|
isValidResolutionVerb
|
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
optionalNamespaceKindQueryParam,
|
|
62
62
|
optionalQueryString,
|
|
63
63
|
positiveIntQueryParam
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-7SUWY37K.js";
|
|
65
65
|
import {
|
|
66
66
|
respondBriefingHttp
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-VBJD4RSJ.js";
|
|
68
68
|
import {
|
|
69
69
|
maybeHandleLifecycleFlush
|
|
70
70
|
} from "./chunk-2BPPGNAQ.js";
|
|
@@ -75,14 +75,14 @@ import {
|
|
|
75
75
|
authorizationProbeNamespaces,
|
|
76
76
|
authorizationProbeRequiresPrincipalNamespace,
|
|
77
77
|
probeOperationAuthorization
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-3ZCRHW7U.js";
|
|
79
79
|
import {
|
|
80
80
|
getOperation,
|
|
81
81
|
resolveQueryNamespaceWritablePreflight
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-BX4WDBTE.js";
|
|
83
83
|
import {
|
|
84
84
|
handleWhoKnowsHttpQuery
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-OM3RWZQK.js";
|
|
86
86
|
import {
|
|
87
87
|
isTrustZoneName
|
|
88
88
|
} from "./chunk-ROBHL3GL.js";
|
|
@@ -3565,4 +3565,4 @@ export {
|
|
|
3565
3565
|
resolveDefaultAdminConsolePublicDir,
|
|
3566
3566
|
EngramAccessHttpServer
|
|
3567
3567
|
};
|
|
3568
|
-
//# sourceMappingURL=chunk-
|
|
3568
|
+
//# sourceMappingURL=chunk-MO25AN7J.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryProjection
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-56GJLXBA.js";
|
|
4
4
|
|
|
5
5
|
// src/convergence-refresh.ts
|
|
6
6
|
async function refreshConvergedNamespaces(namespaces, namespaceSearchRouter, getStorage, searchEnabled) {
|
|
@@ -32,4 +32,4 @@ async function refreshConvergedNamespaces(namespaces, namespaceSearchRouter, get
|
|
|
32
32
|
export {
|
|
33
33
|
refreshConvergedNamespaces
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-N75Q5ZSP.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFrontmatter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BD5QEP3T.js";
|
|
4
4
|
import {
|
|
5
5
|
activityDigestPath,
|
|
6
6
|
isValidActivityDate
|
|
@@ -199,4 +199,4 @@ export {
|
|
|
199
199
|
buildStandup,
|
|
200
200
|
standupHelp
|
|
201
201
|
};
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-NQMG2W5L.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasMemoryData
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MK552I5J.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveNamespaceStorageRoot
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D5UPBXZM.js";
|
|
7
7
|
import {
|
|
8
8
|
getConfiguredNamespaces
|
|
9
9
|
} from "./chunk-7XI2UJHL.js";
|
|
@@ -724,4 +724,4 @@ export {
|
|
|
724
724
|
runNamespaceMaintenancePlan,
|
|
725
725
|
runNamespaceMaintenanceBatchPlan
|
|
726
726
|
};
|
|
727
|
-
//# sourceMappingURL=chunk-
|
|
727
|
+
//# sourceMappingURL=chunk-O52WWLKU.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-BMWN7B3Y.js";
|
|
12
12
|
import {
|
|
13
13
|
StorageManager
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BD5QEP3T.js";
|
|
15
15
|
import {
|
|
16
16
|
isValidityExpiredNow
|
|
17
17
|
} from "./chunk-6CIAGZ6X.js";
|
|
@@ -416,4 +416,4 @@ export {
|
|
|
416
416
|
readProjectedHarmonicGraph,
|
|
417
417
|
searchHarmonicRetrieval
|
|
418
418
|
};
|
|
419
|
-
//# sourceMappingURL=chunk-
|
|
419
|
+
//# sourceMappingURL=chunk-O5MW6CQL.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-5JMAGU26.js";
|
|
6
6
|
import {
|
|
7
7
|
runPostConsolidationMaterialize
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2U4BM3TW.js";
|
|
9
9
|
import {
|
|
10
10
|
isSemanticConsolidationLlmOperator
|
|
11
11
|
} from "./chunk-G7D6GZ5J.js";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
buildExtensionsBlockForConsolidation,
|
|
221
221
|
materializeAfterSemanticConsolidation
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-O6YDGTH4.js.map
|
|
@@ -133,12 +133,29 @@ function isExternalWikiQmdPath(filePath, source) {
|
|
|
133
133
|
function isSearchExcludedPath(filePath, policy = {}, source = "filesystem") {
|
|
134
134
|
if (isExternalWikiQmdPath(filePath, source)) return true;
|
|
135
135
|
for (const candidate of collectionSpellings(filePath, policy, source)) {
|
|
136
|
-
if (isArtifactMemoryPath(candidate) || isNamespacedActivityDigestPath(candidate, policy.memoryDir) || isNamespacedLocationDayPath(candidate, policy.memoryDir) || isNamespacedJournalDayPath(candidate, policy.memoryDir) || isMeetingRecordPath(candidate)) {
|
|
136
|
+
if (isArtifactMemoryPath(candidate) || isNamespacedActivityDigestPath(candidate, policy.memoryDir) || isNamespacedLocationDayPath(candidate, policy.memoryDir) || isNamespacedJournalDayPath(candidate, policy.memoryDir) || isMeetingRecordPath(candidate) || isCompoundingReportPath(candidate, policy.memoryDir)) {
|
|
137
137
|
return true;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
return false;
|
|
141
141
|
}
|
|
142
|
+
function isCompoundingReportPath(candidate, memoryDir) {
|
|
143
|
+
let relative = candidate.replace(/\\/g, "/");
|
|
144
|
+
if (memoryDir && memoryDir.length > 0) {
|
|
145
|
+
const absolute = path2.resolve(memoryDir, candidate).replace(/\\/g, "/");
|
|
146
|
+
const root = path2.resolve(memoryDir).replace(/\\/g, "/");
|
|
147
|
+
if (absolute !== root && !absolute.startsWith(`${root}/`)) return false;
|
|
148
|
+
relative = absolute.slice(root.length);
|
|
149
|
+
if (relative.startsWith("/")) relative = relative.slice(1);
|
|
150
|
+
}
|
|
151
|
+
if (relative.startsWith("../")) return false;
|
|
152
|
+
if (relative.startsWith("namespaces/")) {
|
|
153
|
+
const slash = relative.indexOf("/", "namespaces/".length);
|
|
154
|
+
if (slash < 0) return false;
|
|
155
|
+
relative = relative.slice(slash + 1);
|
|
156
|
+
}
|
|
157
|
+
return relative === "compounding" || relative.startsWith("compounding/");
|
|
158
|
+
}
|
|
142
159
|
function isNamespacedActivityDigestPath(candidate, memoryDir) {
|
|
143
160
|
if (isActivityDigestPath(candidate, memoryDir)) return true;
|
|
144
161
|
if (memoryDir === void 0 || memoryDir.length === 0) return false;
|
|
@@ -211,4 +228,4 @@ export {
|
|
|
211
228
|
isGenericRecallExcludedPath,
|
|
212
229
|
filterRecallCandidates
|
|
213
230
|
};
|
|
214
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-OAIWPB2I.js.map
|