claude-memory-layer 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/README.md +9 -2
  2. package/dist/cli/index.js +1 -1
  3. package/package.json +11 -2
  4. package/scripts/postinstall-embedding-backend.cjs +16 -12
  5. package/AGENTS.md +0 -71
  6. package/CLAUDE.md +0 -30
  7. package/HANDOFF.md +0 -92
  8. package/Memo.txt +0 -558
  9. package/benchmarks/replay/anonymized-real-sessions.json +0 -48
  10. package/config/kpi-thresholds.json +0 -7
  11. package/context.md +0 -636
  12. package/docs/ARCHITECTURE_COMPARISON_AND_RECOMMENDATIONS.md +0 -627
  13. package/docs/HERMES_MEMORY_INGESTION_ANALYSIS.md +0 -440
  14. package/docs/MCP_MEMORY_SERVICE_COMPARATIVE_REVIEW.md +0 -271
  15. package/docs/MEMORY_USEFULNESS_AUDIT.md +0 -371
  16. package/docs/MEMORY_USEFULNESS_AUDIT_RAW.json +0 -80
  17. package/docs/MEMSEARCH_PROJECT_STRUCTURE_ANALYSIS.md +0 -333
  18. package/docs/MEMU_ADOPTION.md +0 -40
  19. package/docs/OPERATIONS.md +0 -18
  20. package/docs/PRODUCT_VALIDATION_MATRIX.md +0 -82
  21. package/docs/PROJECT_STRUCTURE_ANALYSIS.md +0 -421
  22. package/docs/REFACTORING_MILESTONES_AND_ISSUES.md +0 -501
  23. package/docs/REFACTORING_PLAN_THIN_CORE.md +0 -414
  24. package/docs/REFERENCE_PROJECT_ANALYSES.md +0 -25
  25. package/docs/SUPERLOCALMEMORY_PROJECT_STRUCTURE_ANALYSIS.md +0 -452
  26. package/docs/TARGET_ARCHITECTURE_AND_FOLDER_STRUCTURE.md +0 -446
  27. package/docs/architecture/comparison-index.md +0 -47
  28. package/docs/reports/codex-real-data-validation-20260505T040447Z.md +0 -46
  29. package/plan.md +0 -1642
  30. package/scripts/build.ts +0 -159
  31. package/scripts/bump-patch-version.sh +0 -18
  32. package/scripts/delete-unknown-projects.js +0 -154
  33. package/scripts/fix-sync-gap.js +0 -32
  34. package/scripts/generate-session-qrels.ts +0 -126
  35. package/scripts/heartbeat-memory-orchestrator.sh +0 -28
  36. package/scripts/replay-retrieval-benchmark.ts +0 -69
  37. package/scripts/report-sync-gap.js +0 -26
  38. package/scripts/review-queue-auto-resolve.js +0 -21
  39. package/scripts/sync-gap-auto-heal.sh +0 -17
  40. package/spec.md +0 -624
  41. package/specs/20260207-dashboard-upgrade/context.md +0 -38
  42. package/specs/20260207-dashboard-upgrade/spec.md +0 -96
  43. package/specs/citations-system/context.md +0 -243
  44. package/specs/citations-system/plan.md +0 -495
  45. package/specs/citations-system/spec.md +0 -371
  46. package/specs/endless-mode/context.md +0 -305
  47. package/specs/endless-mode/plan.md +0 -620
  48. package/specs/endless-mode/spec.md +0 -455
  49. package/specs/entity-edge-model/context.md +0 -401
  50. package/specs/entity-edge-model/plan.md +0 -459
  51. package/specs/entity-edge-model/spec.md +0 -391
  52. package/specs/evidence-aligner-v2/context.md +0 -401
  53. package/specs/evidence-aligner-v2/plan.md +0 -303
  54. package/specs/evidence-aligner-v2/spec.md +0 -312
  55. package/specs/mcp-desktop-integration/context.md +0 -278
  56. package/specs/mcp-desktop-integration/plan.md +0 -550
  57. package/specs/mcp-desktop-integration/spec.md +0 -494
  58. package/specs/memory-utilization-improvements/context.md +0 -145
  59. package/specs/memory-utilization-improvements/plan.md +0 -361
  60. package/specs/memory-utilization-improvements/spec.md +0 -361
  61. package/specs/post-tool-use-hook/context.md +0 -319
  62. package/specs/post-tool-use-hook/plan.md +0 -469
  63. package/specs/post-tool-use-hook/spec.md +0 -364
  64. package/specs/private-tags/context.md +0 -288
  65. package/specs/private-tags/plan.md +0 -412
  66. package/specs/private-tags/spec.md +0 -345
  67. package/specs/progressive-disclosure/context.md +0 -346
  68. package/specs/progressive-disclosure/plan.md +0 -663
  69. package/specs/progressive-disclosure/spec.md +0 -415
  70. package/specs/selective-tool-observation/context.md +0 -100
  71. package/specs/selective-tool-observation/plan.md +0 -158
  72. package/specs/selective-tool-observation/spec.md +0 -127
  73. package/specs/task-entity-system/context.md +0 -297
  74. package/specs/task-entity-system/plan.md +0 -301
  75. package/specs/task-entity-system/spec.md +0 -314
  76. package/specs/thin-core-refactor/context.md +0 -275
  77. package/specs/thin-core-refactor/plan.md +0 -536
  78. package/specs/thin-core-refactor/spec.md +0 -465
  79. package/specs/vector-outbox-v2/context.md +0 -470
  80. package/specs/vector-outbox-v2/plan.md +0 -562
  81. package/specs/vector-outbox-v2/spec.md +0 -466
  82. package/specs/web-viewer-ui/context.md +0 -384
  83. package/specs/web-viewer-ui/plan.md +0 -797
  84. package/specs/web-viewer-ui/spec.md +0 -516
  85. package/src/adapters/claude/capture/index.ts +0 -3
  86. package/src/adapters/claude/context/index.ts +0 -3
  87. package/src/adapters/claude/hooks/index.ts +0 -21
  88. package/src/adapters/claude/hooks/post-tool-use.ts +0 -239
  89. package/src/adapters/claude/hooks/prompt-injection-policy.ts +0 -104
  90. package/src/adapters/claude/hooks/semantic-daemon-client.ts +0 -209
  91. package/src/adapters/claude/hooks/semantic-daemon.ts +0 -283
  92. package/src/adapters/claude/hooks/session-end.ts +0 -59
  93. package/src/adapters/claude/hooks/session-start.ts +0 -73
  94. package/src/adapters/claude/hooks/stop.ts +0 -128
  95. package/src/adapters/claude/hooks/user-prompt-submit.ts +0 -361
  96. package/src/adapters/claude/index.ts +0 -4
  97. package/src/adapters/claude/transcript/index.ts +0 -4
  98. package/src/adapters/claude/transcript/transcript-reader.ts +0 -57
  99. package/src/adapters/claude/transcript/turn-reconstructor.ts +0 -65
  100. package/src/apps/cli/claude-settings-hooks.ts +0 -138
  101. package/src/apps/cli/codex-import-runner.ts +0 -125
  102. package/src/apps/cli/codex-validation-output.ts +0 -95
  103. package/src/apps/cli/hermes-import-runner.ts +0 -130
  104. package/src/apps/cli/hermes-validation-output.ts +0 -91
  105. package/src/apps/cli/index.ts +0 -1735
  106. package/src/apps/cli/mcp-install.ts +0 -106
  107. package/src/apps/cli/retrieval-disclosure-output.ts +0 -196
  108. package/src/apps/dashboard/assets/js/bootstrap.js +0 -244
  109. package/src/apps/dashboard/assets/js/chat.js +0 -373
  110. package/src/apps/dashboard/assets/js/disclosure.js +0 -232
  111. package/src/apps/dashboard/assets/js/modals.js +0 -298
  112. package/src/apps/dashboard/assets/js/overview.js +0 -655
  113. package/src/apps/dashboard/assets/js/state.js +0 -72
  114. package/src/apps/dashboard/assets/js/views.js +0 -468
  115. package/src/apps/dashboard/index.html +0 -543
  116. package/src/apps/dashboard/index.ts +0 -3
  117. package/src/apps/dashboard/style.css +0 -1750
  118. package/src/apps/index.ts +0 -5
  119. package/src/apps/server/api/chat.ts +0 -244
  120. package/src/apps/server/api/citations.ts +0 -105
  121. package/src/apps/server/api/events.ts +0 -137
  122. package/src/apps/server/api/health.ts +0 -53
  123. package/src/apps/server/api/index.ts +0 -26
  124. package/src/apps/server/api/projects.ts +0 -74
  125. package/src/apps/server/api/search.ts +0 -184
  126. package/src/apps/server/api/sessions.ts +0 -115
  127. package/src/apps/server/api/stats.ts +0 -723
  128. package/src/apps/server/api/turns.ts +0 -143
  129. package/src/apps/server/api/utils.ts +0 -65
  130. package/src/apps/server/index.ts +0 -111
  131. package/src/cli/index.ts +0 -3
  132. package/src/cli/retrieval-disclosure-output.ts +0 -2
  133. package/src/compat/index.ts +0 -5
  134. package/src/core/canonical-key.ts +0 -186
  135. package/src/core/citation-generator.ts +0 -63
  136. package/src/core/consolidated-store.ts +0 -356
  137. package/src/core/consolidation-worker.ts +0 -493
  138. package/src/core/context-formatter.ts +0 -276
  139. package/src/core/continuity-manager.ts +0 -341
  140. package/src/core/db-wrapper.ts +0 -64
  141. package/src/core/derive/fact-deriver.ts +0 -170
  142. package/src/core/derive/index.ts +0 -2
  143. package/src/core/derive/summary-deriver.ts +0 -76
  144. package/src/core/edge-repo.ts +0 -333
  145. package/src/core/embedder.ts +0 -4
  146. package/src/core/engine/embedding-maintenance-service.ts +0 -187
  147. package/src/core/engine/endless-memory-services.ts +0 -4
  148. package/src/core/engine/index.ts +0 -19
  149. package/src/core/engine/memory-engine-services.ts +0 -170
  150. package/src/core/engine/memory-ingest-service.ts +0 -317
  151. package/src/core/engine/memory-query-service.ts +0 -173
  152. package/src/core/engine/memory-runtime-service.ts +0 -162
  153. package/src/core/engine/memory-service-composition.ts +0 -231
  154. package/src/core/engine/retrieval-analytics-service.ts +0 -181
  155. package/src/core/engine/retrieval-disclosure-service.ts +0 -420
  156. package/src/core/engine/retrieval-orchestrator.ts +0 -377
  157. package/src/core/engine/retrieval-services.ts +0 -176
  158. package/src/core/engine/shared-memory-services.ts +0 -4
  159. package/src/core/entity-repo.ts +0 -349
  160. package/src/core/event-store.ts +0 -779
  161. package/src/core/evidence-aligner.ts +0 -635
  162. package/src/core/external-market-context.ts +0 -582
  163. package/src/core/graduation-worker.ts +0 -171
  164. package/src/core/graduation.ts +0 -377
  165. package/src/core/index.ts +0 -64
  166. package/src/core/ingest-interceptor.ts +0 -80
  167. package/src/core/markdown-mirror.ts +0 -70
  168. package/src/core/matcher.ts +0 -208
  169. package/src/core/md-mirror.ts +0 -92
  170. package/src/core/metadata-extractor.ts +0 -203
  171. package/src/core/model/memory-fact.ts +0 -30
  172. package/src/core/model/memory-rule.ts +0 -14
  173. package/src/core/model/memory-summary.ts +0 -21
  174. package/src/core/model/raw-event.ts +0 -28
  175. package/src/core/model/retrieval-result.ts +0 -35
  176. package/src/core/mongo-sync-config.ts +0 -165
  177. package/src/core/mongo-sync-worker.ts +0 -381
  178. package/src/core/privacy/filter.ts +0 -190
  179. package/src/core/privacy/index.ts +0 -20
  180. package/src/core/privacy/tag-parser.ts +0 -145
  181. package/src/core/product-validation-matrix.ts +0 -314
  182. package/src/core/progressive-retriever.ts +0 -414
  183. package/src/core/registry/project-path.ts +0 -54
  184. package/src/core/registry/session-registry.ts +0 -69
  185. package/src/core/replay-evaluator.ts +0 -625
  186. package/src/core/retrieval-benchmark.ts +0 -117
  187. package/src/core/retrieval-quality.ts +0 -109
  188. package/src/core/retriever.ts +0 -800
  189. package/src/core/session-qrels.ts +0 -360
  190. package/src/core/shared-event-store.ts +0 -114
  191. package/src/core/shared-promoter.ts +0 -249
  192. package/src/core/shared-store.ts +0 -289
  193. package/src/core/shared-vector-store.ts +0 -203
  194. package/src/core/sqlite-event-store.ts +0 -1846
  195. package/src/core/sqlite-wrapper.ts +0 -116
  196. package/src/core/sync-worker.ts +0 -228
  197. package/src/core/tag-taxonomy.ts +0 -51
  198. package/src/core/task/blocker-resolver.ts +0 -333
  199. package/src/core/task/index.ts +0 -9
  200. package/src/core/task/task-matcher.ts +0 -240
  201. package/src/core/task/task-projector.ts +0 -358
  202. package/src/core/task/task-resolver.ts +0 -421
  203. package/src/core/turn-state.ts +0 -207
  204. package/src/core/types.ts +0 -952
  205. package/src/core/vector-outbox.ts +0 -299
  206. package/src/core/vector-store.ts +0 -231
  207. package/src/core/vector-worker.ts +0 -521
  208. package/src/core/working-set-store.ts +0 -257
  209. package/src/extensions/endless-memory/endless-memory-services.ts +0 -350
  210. package/src/extensions/endless-memory/index.ts +0 -1
  211. package/src/extensions/index.ts +0 -5
  212. package/src/extensions/mcp/handlers.ts +0 -960
  213. package/src/extensions/mcp/index.ts +0 -48
  214. package/src/extensions/mcp/tools.ts +0 -252
  215. package/src/extensions/shared-memory/index.ts +0 -1
  216. package/src/extensions/shared-memory/shared-memory-services.ts +0 -211
  217. package/src/extensions/vector/embedder.ts +0 -234
  218. package/src/extensions/vector/index.ts +0 -1
  219. package/src/hooks/post-tool-use.ts +0 -9
  220. package/src/hooks/semantic-daemon-client.ts +0 -1
  221. package/src/hooks/semantic-daemon.ts +0 -11
  222. package/src/hooks/session-end.ts +0 -9
  223. package/src/hooks/session-start.ts +0 -9
  224. package/src/hooks/stop.ts +0 -9
  225. package/src/hooks/user-prompt-submit.ts +0 -9
  226. package/src/index.ts +0 -13
  227. package/src/mcp/handlers.ts +0 -2
  228. package/src/mcp/index.ts +0 -4
  229. package/src/mcp/tools.ts +0 -2
  230. package/src/server/api/chat.ts +0 -2
  231. package/src/server/api/citations.ts +0 -2
  232. package/src/server/api/events.ts +0 -2
  233. package/src/server/api/health.ts +0 -2
  234. package/src/server/api/index.ts +0 -2
  235. package/src/server/api/projects.ts +0 -2
  236. package/src/server/api/search.ts +0 -2
  237. package/src/server/api/sessions.ts +0 -2
  238. package/src/server/api/stats.ts +0 -2
  239. package/src/server/api/turns.ts +0 -2
  240. package/src/server/api/utils.ts +0 -2
  241. package/src/server/index.ts +0 -2
  242. package/src/services/bootstrap-organizer.ts +0 -463
  243. package/src/services/codex-session-history-importer.ts +0 -966
  244. package/src/services/hermes-session-history-importer.ts +0 -733
  245. package/src/services/memory-service-config.ts +0 -36
  246. package/src/services/memory-service-registry.ts +0 -150
  247. package/src/services/memory-service.ts +0 -688
  248. package/src/services/session-history-importer.ts +0 -629
  249. package/tests/README.md +0 -23
  250. package/tests/adapters/claude/claude-semantic-daemon-adapter.test.ts +0 -54
  251. package/tests/adapters/claude/claude-transcript-reconstructor.test.ts +0 -98
  252. package/tests/adapters/claude-hook-prompt-injection-policy.test.ts +0 -99
  253. package/tests/apps/app-layer-boundary.test.ts +0 -48
  254. package/tests/apps/claude-settings-hooks.test.ts +0 -107
  255. package/tests/apps/cli-disclosure-output.test.ts +0 -212
  256. package/tests/apps/codex-import-runner.test.ts +0 -99
  257. package/tests/apps/codex-validation-output.test.ts +0 -100
  258. package/tests/apps/hermes-import-runner.test.ts +0 -99
  259. package/tests/apps/mcp-install-command.test.ts +0 -59
  260. package/tests/apps/package-build-entrypoints.test.ts +0 -30
  261. package/tests/apps/postinstall-embedding-backend.test.ts +0 -185
  262. package/tests/apps/search-api-disclosure.test.ts +0 -162
  263. package/tests/apps/stats-api-lightweight.test.ts +0 -67
  264. package/tests/apps/ui-disclosure-output.test.ts +0 -140
  265. package/tests/core/bootstrap-organizer.test.ts +0 -111
  266. package/tests/core/canonical-key.test.ts +0 -101
  267. package/tests/core/codex-session-history-importer-validation.test.ts +0 -185
  268. package/tests/core/consolidation-worker.test.ts +0 -75
  269. package/tests/core/embedding-maintenance-service.test.ts +0 -282
  270. package/tests/core/evidence-aligner.test.ts +0 -152
  271. package/tests/core/external-market-context.test.ts +0 -209
  272. package/tests/core/fact-deriver.test.ts +0 -79
  273. package/tests/core/hermes-session-history-importer-validation.test.ts +0 -609
  274. package/tests/core/ingest-interceptor.test.ts +0 -38
  275. package/tests/core/markdown-mirror.test.ts +0 -85
  276. package/tests/core/matcher.test.ts +0 -112
  277. package/tests/core/md-mirror.test.ts +0 -50
  278. package/tests/core/memory-engine-services.test.ts +0 -240
  279. package/tests/core/memory-ingest-service.test.ts +0 -296
  280. package/tests/core/memory-query-service.test.ts +0 -129
  281. package/tests/core/memory-runtime-service.test.ts +0 -201
  282. package/tests/core/memory-service-composition.test.ts +0 -192
  283. package/tests/core/memory-service-config.test.ts +0 -41
  284. package/tests/core/memory-service-facade.test.ts +0 -30
  285. package/tests/core/memory-service-registry.test.ts +0 -206
  286. package/tests/core/product-validation-matrix.test.ts +0 -61
  287. package/tests/core/project-registry.test.ts +0 -78
  288. package/tests/core/replay-evaluator.test.ts +0 -181
  289. package/tests/core/retrieval-analytics-service.test.ts +0 -210
  290. package/tests/core/retrieval-benchmark.test.ts +0 -93
  291. package/tests/core/retrieval-disclosure-service.test.ts +0 -264
  292. package/tests/core/retrieval-orchestrator.test.ts +0 -403
  293. package/tests/core/retrieval-quality.test.ts +0 -31
  294. package/tests/core/retrieval-services.test.ts +0 -185
  295. package/tests/core/retriever-fallback-chain.test.ts +0 -223
  296. package/tests/core/retriever-strategy-scope.test.ts +0 -164
  297. package/tests/core/retriever.memu-adoption.test.ts +0 -122
  298. package/tests/core/session-history-importer-filter.test.ts +0 -78
  299. package/tests/core/session-qrels.test.ts +0 -250
  300. package/tests/core/sqlite-event-store-replication.test.ts +0 -127
  301. package/tests/core/summary-deriver.test.ts +0 -66
  302. package/tests/extensions/embedder-warning-suppression.test.ts +0 -84
  303. package/tests/extensions/endless-memory-extension-boundary.test.ts +0 -17
  304. package/tests/extensions/endless-memory-services.test.ts +0 -325
  305. package/tests/extensions/mcp-context-tools.test.ts +0 -905
  306. package/tests/extensions/mcp-extension-boundary.test.ts +0 -21
  307. package/tests/extensions/mcp-package-build.test.ts +0 -22
  308. package/tests/extensions/mcp-project-aware-tools.test.ts +0 -102
  309. package/tests/extensions/shared-memory-extension-boundary.test.ts +0 -24
  310. package/tests/extensions/shared-memory-services.test.ts +0 -309
  311. package/tests/extensions/vector-extension-boundary.test.ts +0 -21
  312. package/tsconfig.json +0 -24
  313. package/vitest.config.ts +0 -15
@@ -1,190 +0,0 @@
1
- /**
2
- * Privacy Filter
3
- * Combines pattern-based filtering with private tag parsing
4
- */
5
-
6
- import { parsePrivateTagsSafe, hasUnmatchedOpenTag } from './tag-parser.js';
7
- import type { Config } from '../types.js';
8
-
9
- export interface FilterResult {
10
- content: string;
11
- metadata: {
12
- hasPrivateTags: boolean;
13
- privateTagCount: number;
14
- patternMatchCount: number;
15
- originalLength: number;
16
- filteredLength: number;
17
- hasUnmatchedTags: boolean;
18
- };
19
- }
20
-
21
- // Sensitive data patterns
22
- const SENSITIVE_PATTERNS = [
23
- // Credential-bearing URLs/connection strings with userinfo before the host.
24
- // Redact the whole URI so usernames, credentials, hosts, paths, and query
25
- // params do not leak either.
26
- /\b[a-z][a-z0-9+.-]*:\/\/[^\s'"`<>/@]+@[^\s'"`<>]+/gi,
27
- /password\s*[:=]\s*['"]?[^\s'"]+/gi,
28
- /api[_-]?key\s*[:=]\s*['"]?[^\s'"]+/gi,
29
- /secret\s*[:=]\s*['"]?[^\s'"]+/gi,
30
- /token\s*[:=]\s*['"]?[^\s'"]+/gi,
31
- /bearer\s+[a-zA-Z0-9\-_.]+/gi,
32
- /AWS[_-]?ACCESS[_-]?KEY[_-]?ID\s*[:=]\s*['"]?[A-Z0-9]+/gi,
33
- /AWS[_-]?SECRET[_-]?ACCESS[_-]?KEY\s*[:=]\s*['"]?[^\s'"]+/gi,
34
- /-----BEGIN\s+(RSA\s+)?PRIVATE\s+KEY-----[\s\S]*?-----END\s+(RSA\s+)?PRIVATE\s+KEY-----/g,
35
- /ghp_[a-zA-Z0-9]{36}/g, // GitHub Personal Access Token
36
- /sk-[a-zA-Z0-9]{48}/g, // OpenAI API Key
37
- ];
38
-
39
- function maskSensitiveString(value: string): string {
40
- let filtered = value;
41
- for (const pattern of SENSITIVE_PATTERNS) {
42
- pattern.lastIndex = 0;
43
- filtered = filtered.replace(pattern, '[REDACTED]');
44
- }
45
- return filtered;
46
- }
47
-
48
- /**
49
- * Apply privacy filter to content
50
- */
51
- export function applyPrivacyFilter(
52
- content: string,
53
- config: Config['privacy']
54
- ): FilterResult {
55
- let filtered = content;
56
- let privateTagCount = 0;
57
- let patternMatchCount = 0;
58
- const hasUnmatchedTags = hasUnmatchedOpenTag(content);
59
-
60
- // 1. Private tag filtering
61
- if (config.privateTags?.enabled !== false) {
62
- const tagResult = parsePrivateTagsSafe(filtered, {
63
- formats: config.privateTags?.supportedFormats || ['xml'],
64
- marker: config.privateTags?.marker || '[PRIVATE]'
65
- });
66
- filtered = tagResult.filtered;
67
- privateTagCount = tagResult.stats.count;
68
- }
69
-
70
- // 2. Built-in sensitive pattern filtering
71
- for (const pattern of SENSITIVE_PATTERNS) {
72
- // Reset lastIndex for global regex
73
- pattern.lastIndex = 0;
74
- const matches = filtered.match(pattern);
75
- if (matches) {
76
- patternMatchCount += matches.length;
77
- filtered = filtered.replace(pattern, '[REDACTED]');
78
- }
79
- }
80
-
81
- // 3. Custom pattern filtering from config
82
- for (const patternStr of config.excludePatterns || []) {
83
- try {
84
- const regex = new RegExp(
85
- `(${patternStr})\\s*[:=]\\s*['"]?[^\\s'"]+`,
86
- 'gi'
87
- );
88
- const matches = filtered.match(regex);
89
- if (matches) {
90
- patternMatchCount += matches.length;
91
- filtered = filtered.replace(regex, '[REDACTED]');
92
- }
93
- } catch {
94
- // Invalid regex pattern, skip
95
- }
96
- }
97
-
98
- // 4. Clean up consecutive markers
99
- filtered = filtered.replace(/(\[PRIVATE\]\s*)+/g, '[PRIVATE]\n');
100
- filtered = filtered.replace(/(\[REDACTED\]\s*)+/g, '[REDACTED] ');
101
-
102
- return {
103
- content: filtered,
104
- metadata: {
105
- hasPrivateTags: privateTagCount > 0,
106
- privateTagCount,
107
- patternMatchCount,
108
- originalLength: content.length,
109
- filteredLength: filtered.length,
110
- hasUnmatchedTags
111
- }
112
- };
113
- }
114
-
115
- /**
116
- * Mask sensitive data in tool input (recursively)
117
- */
118
- export function maskSensitiveInput(
119
- input: Record<string, unknown>
120
- ): Record<string, unknown> {
121
- const result: Record<string, unknown> = {};
122
-
123
- for (const [key, value] of Object.entries(input)) {
124
- // Check if key suggests sensitive data
125
- const sensitiveKeys = ['password', 'secret', 'key', 'token', 'auth', 'credential'];
126
- const isSensitiveKey = sensitiveKeys.some(k =>
127
- key.toLowerCase().includes(k)
128
- );
129
-
130
- if (isSensitiveKey && typeof value === 'string') {
131
- result[key] = '[REDACTED]';
132
- } else if (typeof value === 'string') {
133
- // Apply pattern filtering to string values
134
- result[key] = maskSensitiveString(value);
135
- } else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
136
- result[key] = maskSensitiveInput(value as Record<string, unknown>);
137
- } else if (Array.isArray(value)) {
138
- result[key] = value.map(item => {
139
- if (typeof item === 'string') {
140
- return isSensitiveKey ? '[REDACTED]' : maskSensitiveString(item);
141
- }
142
- return typeof item === 'object' && item !== null
143
- ? maskSensitiveInput(item as Record<string, unknown>)
144
- : item;
145
- });
146
- } else {
147
- result[key] = value;
148
- }
149
- }
150
-
151
- return result;
152
- }
153
-
154
- /**
155
- * Truncate output with head + tail strategy
156
- */
157
- export function truncateOutput(
158
- output: string,
159
- options: { maxLength?: number; maxLines?: number }
160
- ): string {
161
- const { maxLength = 10000, maxLines = 100 } = options;
162
-
163
- // Split into lines
164
- const lines = output.split('\n');
165
-
166
- // Apply line limit first
167
- if (lines.length > maxLines) {
168
- const headLines = Math.ceil(maxLines / 2);
169
- const tailLines = Math.floor(maxLines / 2);
170
- const head = lines.slice(0, headLines);
171
- const tail = lines.slice(-tailLines);
172
- const truncatedLines = [
173
- ...head,
174
- `\n... [${lines.length - maxLines} lines truncated] ...\n`,
175
- ...tail
176
- ];
177
- output = truncatedLines.join('\n');
178
- }
179
-
180
- // Apply character limit
181
- if (output.length > maxLength) {
182
- const headChars = Math.ceil(maxLength / 2);
183
- const tailChars = Math.floor(maxLength / 2);
184
- output = output.slice(0, headChars) +
185
- `\n... [${output.length - maxLength} characters truncated] ...\n` +
186
- output.slice(-tailChars);
187
- }
188
-
189
- return output;
190
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Privacy Module
3
- * Exports privacy-related utilities
4
- */
5
-
6
- export {
7
- parsePrivateTags,
8
- parsePrivateTagsSafe,
9
- hasUnmatchedOpenTag,
10
- type PrivateSection,
11
- type ParseResult,
12
- type ParseOptions
13
- } from './tag-parser.js';
14
-
15
- export {
16
- applyPrivacyFilter,
17
- maskSensitiveInput,
18
- truncateOutput,
19
- type FilterResult
20
- } from './filter.js';
@@ -1,145 +0,0 @@
1
- /**
2
- * Private Tag Parser
3
- * Parses and removes <private> tags from content
4
- */
5
-
6
- export interface PrivateSection {
7
- start: number;
8
- end: number;
9
- content: string;
10
- format: 'xml' | 'bracket' | 'comment';
11
- }
12
-
13
- export interface ParseResult {
14
- filtered: string;
15
- sections: PrivateSection[];
16
- stats: {
17
- count: number;
18
- totalLength: number;
19
- };
20
- }
21
-
22
- export interface ParseOptions {
23
- formats: Array<'xml' | 'bracket' | 'comment'>;
24
- marker: string;
25
- }
26
-
27
- // Tag patterns for different formats
28
- const TAG_PATTERNS: Record<string, RegExp> = {
29
- xml: /<private>([\s\S]*?)<\/private>/gi,
30
- bracket: /\[private\]([\s\S]*?)\[\/private\]/gi,
31
- comment: /<!--\s*private\s*-->([\s\S]*?)<!--\s*\/private\s*-->/gi
32
- };
33
-
34
- /**
35
- * Parse and remove private tags from text
36
- */
37
- export function parsePrivateTags(
38
- text: string,
39
- options: ParseOptions
40
- ): ParseResult {
41
- const sections: PrivateSection[] = [];
42
- let filtered = text;
43
-
44
- // Find all private sections for each format
45
- for (const format of options.formats) {
46
- const pattern = TAG_PATTERNS[format];
47
- if (!pattern) continue;
48
-
49
- // Reset lastIndex for global regex
50
- pattern.lastIndex = 0;
51
-
52
- let match;
53
- while ((match = pattern.exec(text)) !== null) {
54
- sections.push({
55
- start: match.index,
56
- end: match.index + match[0].length,
57
- content: match[1],
58
- format: format as PrivateSection['format']
59
- });
60
- }
61
- }
62
-
63
- // Remove all tags and replace with marker
64
- for (const format of options.formats) {
65
- const pattern = TAG_PATTERNS[format];
66
- if (!pattern) continue;
67
-
68
- // Need to create new regex for replacement (global flag issues)
69
- const replacePattern = new RegExp(pattern.source, 'gi');
70
-
71
- filtered = filtered.replace(replacePattern, (_match, content: string) => {
72
- // Empty tags are completely removed
73
- if (!content.trim()) return '';
74
- return options.marker;
75
- });
76
- }
77
-
78
- return {
79
- filtered,
80
- sections,
81
- stats: {
82
- count: sections.length,
83
- totalLength: sections.reduce((sum, s) => sum + s.content.length, 0)
84
- }
85
- };
86
- }
87
-
88
- /**
89
- * Parse private tags safely, protecting code blocks
90
- */
91
- export function parsePrivateTagsSafe(
92
- text: string,
93
- options: ParseOptions
94
- ): ParseResult {
95
- // 1. Extract and protect code blocks
96
- const codeBlocks: string[] = [];
97
- const textWithPlaceholders = text.replace(
98
- /```[\s\S]*?```/g,
99
- (match) => {
100
- codeBlocks.push(match);
101
- return `__CODE_BLOCK_${codeBlocks.length - 1}__`;
102
- }
103
- );
104
-
105
- // Also protect inline code
106
- const inlineCode: string[] = [];
107
- const textWithAllPlaceholders = textWithPlaceholders.replace(
108
- /`[^`]+`/g,
109
- (match) => {
110
- inlineCode.push(match);
111
- return `__INLINE_CODE_${inlineCode.length - 1}__`;
112
- }
113
- );
114
-
115
- // 2. Parse private tags
116
- const result = parsePrivateTags(textWithAllPlaceholders, options);
117
-
118
- // 3. Restore inline code
119
- result.filtered = result.filtered.replace(
120
- /__INLINE_CODE_(\d+)__/g,
121
- (_, idx) => inlineCode[Number(idx)]
122
- );
123
-
124
- // 4. Restore code blocks
125
- result.filtered = result.filtered.replace(
126
- /__CODE_BLOCK_(\d+)__/g,
127
- (_, idx) => codeBlocks[Number(idx)]
128
- );
129
-
130
- return result;
131
- }
132
-
133
- /**
134
- * Check if text has unclosed private tags
135
- */
136
- export function hasUnmatchedOpenTag(text: string): boolean {
137
- // Check for opening tags without closing
138
- const openXml = (text.match(/<private>/gi) || []).length;
139
- const closeXml = (text.match(/<\/private>/gi) || []).length;
140
-
141
- const openBracket = (text.match(/\[private\]/gi) || []).length;
142
- const closeBracket = (text.match(/\[\/private\]/gi) || []).length;
143
-
144
- return openXml !== closeXml || openBracket !== closeBracket;
145
- }
@@ -1,314 +0,0 @@
1
- /**
2
- * Product-level validation matrix for claude-memory-layer.
3
- *
4
- * This module is intentionally data-first so CLI/reporting/docs can reuse the
5
- * same surface -> requirement -> evidence map that tests assert stays covered.
6
- */
7
-
8
- export type ProductValidationArea = 'claude' | 'codex' | 'hermes' | 'mcp' | 'cli' | 'safety';
9
- export type ProductValidationStatus = 'ready' | 'covered' | 'partial' | 'planned';
10
- export type ProductValidationEvidenceKind = 'test' | 'source' | 'command' | 'doc';
11
-
12
- export interface ProductValidationEvidence {
13
- kind: ProductValidationEvidenceKind;
14
- ref: string;
15
- note: string;
16
- }
17
-
18
- export interface ProductValidationSurface {
19
- id: string;
20
- area: ProductValidationArea;
21
- title: string;
22
- status: ProductValidationStatus;
23
- requirements: string[];
24
- evidence: ProductValidationEvidence[];
25
- }
26
-
27
- export interface ProductValidationMatrixSummary {
28
- totalSurfaces: number;
29
- requirementCount: number;
30
- evidenceCount: number;
31
- surfacesByArea: Record<ProductValidationArea, number>;
32
- statusCounts: Record<ProductValidationStatus, number>;
33
- }
34
-
35
- export const productValidationMatrix: readonly ProductValidationSurface[] = [
36
- {
37
- id: 'claude.adapter.import',
38
- area: 'claude',
39
- title: 'Claude adapter import',
40
- status: 'covered',
41
- requirements: [
42
- 'Import Claude Code JSONL transcripts without storing tool-result noise as user prompts.',
43
- 'Preserve session/project mapping and turn grouping for retrieval continuity.'
44
- ],
45
- evidence: [
46
- { kind: 'test', ref: 'tests/core/session-history-importer-filter.test.ts', note: 'Filters local-command artifacts and keeps substantive prompts.' },
47
- { kind: 'source', ref: 'src/services/session-history-importer.ts', note: 'Claude JSONL import pipeline and project/session registration.' }
48
- ]
49
- },
50
- {
51
- id: 'claude.adapter.search',
52
- area: 'claude',
53
- title: 'Claude adapter search',
54
- status: 'covered',
55
- requirements: [
56
- 'Expose semantic memory search with project/session scoping and fast/deep strategies.',
57
- 'Return plain and disclosure-aware search output without mutating memory.'
58
- ],
59
- evidence: [
60
- { kind: 'test', ref: 'tests/core/retrieval-services.test.ts', note: 'Core retrieval service behavior.' },
61
- { kind: 'test', ref: 'tests/apps/cli-disclosure-output.test.ts', note: 'CLI disclosure output formatting.' },
62
- { kind: 'source', ref: 'src/apps/cli/index.ts', note: 'search command supports disclosure, scope, and strategy flags.' }
63
- ]
64
- },
65
- {
66
- id: 'claude.adapter.disclosure',
67
- area: 'claude',
68
- title: 'Claude adapter disclosure',
69
- status: 'covered',
70
- requirements: [
71
- 'Support progressive search -> expand -> source disclosure flow.',
72
- 'Render source/citation evidence for retrieved memories.'
73
- ],
74
- evidence: [
75
- { kind: 'test', ref: 'tests/core/retrieval-disclosure-service.test.ts', note: 'Disclosure service search/expand/source flow.' },
76
- { kind: 'test', ref: 'tests/apps/ui-disclosure-output.test.ts', note: 'Dashboard disclosure formatting.' },
77
- { kind: 'source', ref: 'src/core/engine/retrieval-disclosure-service.ts', note: 'Core disclosure orchestration.' }
78
- ]
79
- },
80
- {
81
- id: 'codex.adapter.scan',
82
- area: 'codex',
83
- title: 'Codex adapter scan',
84
- status: 'ready',
85
- requirements: [
86
- 'Read ~/.codex/sessions recursively without writes by default.',
87
- 'Match sessions to a project via session_meta.payload.cwd when available and summarize all sessions otherwise.',
88
- 'Count missing cwd, malformed JSONL lines, and unsupported/tool-ish records.'
89
- ],
90
- evidence: [
91
- { kind: 'test', ref: 'tests/core/codex-session-history-importer-validation.test.ts', note: 'Dry-run scan, cwd matching, missing cwd, malformed and unsupported counts.' },
92
- { kind: 'source', ref: 'src/services/codex-session-history-importer.ts', note: 'validateCodexSessions and normalizeCodexSessionFile.' }
93
- ]
94
- },
95
- {
96
- id: 'codex.adapter.import',
97
- area: 'codex',
98
- title: 'Codex adapter import',
99
- status: 'covered',
100
- requirements: [
101
- 'Import explicit Codex session files/project sessions into memory only through import APIs.',
102
- 'Expose a user-facing codex import command for project, session, and all-session imports.',
103
- 'Preserve turn grouping and truncate oversized assistant content before storage.'
104
- ],
105
- evidence: [
106
- { kind: 'test', ref: 'tests/apps/codex-import-runner.test.ts', note: 'Asserts project-scoped, session, and explicit global all-session import routing.' },
107
- { kind: 'source', ref: 'src/apps/cli/codex-import-runner.ts', note: 'Safe Codex import command runner with project/default/global storage decisions.' },
108
- { kind: 'source', ref: 'src/services/codex-session-history-importer.ts', note: 'CodexSessionHistoryImporter importProject/importAll/importSessionFile.' },
109
- { kind: 'doc', ref: 'docs/PRODUCT_VALIDATION_MATRIX.md', note: 'Documents that validation/replay is read-only; mutation remains explicit import-only.' }
110
- ]
111
- },
112
- {
113
- id: 'codex.adapter.replay',
114
- area: 'codex',
115
- title: 'Codex adapter replay',
116
- status: 'ready',
117
- requirements: [
118
- 'Normalize response_item message records with user/assistant roles and text/input_text/output_text blocks.',
119
- 'Handle string content, empty assistant turns, large/truncated content, malformed lines, and tool-ish records robustly.',
120
- 'Emit aggregate replay counts without transcript content.'
121
- ],
122
- evidence: [
123
- { kind: 'test', ref: 'tests/core/codex-session-history-importer-validation.test.ts', note: 'Realistic fixture replay covers supported and malformed Codex JSONL shapes.' },
124
- { kind: 'source', ref: 'src/services/codex-session-history-importer.ts', note: 'normalizeCodexSessionFile parses and counts replay records.' }
125
- ]
126
- },
127
- {
128
- id: 'hermes.adapter.scan',
129
- area: 'hermes',
130
- title: 'Hermes adapter scan',
131
- status: 'ready',
132
- requirements: [
133
- 'Read Hermes ~/.hermes/state.db in read-only mode by default.',
134
- 'Match sessions to a project via Hermes session context/title when available.',
135
- 'Count unsupported/tool messages, empty assistant messages, missing project context, and truncated content without exposing transcript text.'
136
- ],
137
- evidence: [
138
- { kind: 'test', ref: 'tests/core/hermes-session-history-importer-validation.test.ts', note: 'Dry-run SessionDB fixture covers project matching, unsupported/tool skipping, empty assistant messages, and transcript exclusion.' },
139
- { kind: 'source', ref: 'src/services/hermes-session-history-importer.ts', note: 'validateHermesSessions reads SessionDB and emits aggregate replay reports.' }
140
- ]
141
- },
142
- {
143
- id: 'hermes.adapter.import',
144
- area: 'hermes',
145
- title: 'Hermes adapter import',
146
- status: 'covered',
147
- requirements: [
148
- 'Import explicit Hermes SessionDB project/session/all selections into memory only through import APIs.',
149
- 'Default to project-scoped memory for current-project imports and require --all for intentional global imports.',
150
- 'Skip tool/system records and redact sensitive user/assistant content before storage.'
151
- ],
152
- evidence: [
153
- { kind: 'test', ref: 'tests/core/hermes-session-history-importer-validation.test.ts', note: 'Imports only matched user/assistant turns, redacts secrets, and skips tool messages.' },
154
- { kind: 'test', ref: 'tests/apps/hermes-import-runner.test.ts', note: 'Asserts project-scoped, session, and explicit global all-session import routing.' },
155
- { kind: 'source', ref: 'src/apps/cli/hermes-import-runner.ts', note: 'Safe Hermes import command runner with project/default/global storage decisions.' },
156
- { kind: 'source', ref: 'src/services/hermes-session-history-importer.ts', note: 'HermesSessionHistoryImporter importProject/importAll/importSession.' }
157
- ]
158
- },
159
- {
160
- id: 'hermes.adapter.replay',
161
- area: 'hermes',
162
- title: 'Hermes adapter replay',
163
- status: 'ready',
164
- requirements: [
165
- 'Normalize Hermes SessionDB user/assistant rows into aggregate replay counts.',
166
- 'Keep Hermes raw transcript source-of-truth in SessionDB and treat CML as explicit derived memory.',
167
- 'Emit validation reports without transcript content or secrets.'
168
- ],
169
- evidence: [
170
- { kind: 'test', ref: 'tests/core/hermes-session-history-importer-validation.test.ts', note: 'Validation report excludes prompt/response text and synthetic secrets.' },
171
- { kind: 'source', ref: 'src/apps/cli/hermes-validation-output.ts', note: 'JSON/Markdown report output helpers for Hermes aggregate replay.' },
172
- { kind: 'doc', ref: 'docs/HERMES_MEMORY_INGESTION_ANALYSIS.md', note: 'Documents explicit import first; live sync later if needed.' }
173
- ]
174
- },
175
- {
176
- id: 'mcp.context.pack',
177
- area: 'mcp',
178
- title: 'MCP context pack',
179
- status: 'covered',
180
- requirements: [
181
- 'Expose an agent-ready project context pack that combines relevant retrieval results with recent project timeline.',
182
- 'Support projectPath scoping so Hermes, Codex, and Claude Code can share the same project memory backend.',
183
- 'Keep output compact and citation-oriented so agents can follow up with source-ref or timeline tools.'
184
- ],
185
- evidence: [
186
- { kind: 'test', ref: 'tests/extensions/mcp-context-tools.test.ts', note: 'Asserts context-pack output, projectPath routing, compact relevant memory citations, and recent timeline inclusion.' },
187
- { kind: 'source', ref: 'src/extensions/mcp/handlers.ts', note: 'mem-context-pack handler formats relevant memories plus session summaries.' },
188
- { kind: 'source', ref: 'src/extensions/mcp/tools.ts', note: 'MCP tool schema advertises projectPath, topK, recentLimit, and sessionLimit options.' }
189
- ]
190
- },
191
- {
192
- id: 'mcp.project.timeline',
193
- area: 'mcp',
194
- title: 'MCP project timeline',
195
- status: 'covered',
196
- requirements: [
197
- 'Summarize recent project memories by session, source agent, event counts, and last safe preview.',
198
- 'Avoid raw transcript dumps while still giving enough continuity for another agent to resume work.'
199
- ],
200
- evidence: [
201
- { kind: 'test', ref: 'tests/extensions/mcp-context-tools.test.ts', note: 'Asserts session grouping, source-agent metadata, and event type counts.' },
202
- { kind: 'source', ref: 'src/extensions/mcp/handlers.ts', note: 'mem-project-timeline groups recent events by session and source.' },
203
- { kind: 'source', ref: 'src/extensions/mcp/tools.ts', note: 'MCP tool schema advertises limit/sessionLimit/projectPath options.' }
204
- ]
205
- },
206
- {
207
- id: 'mcp.source.ref',
208
- area: 'mcp',
209
- title: 'MCP source reference',
210
- status: 'covered',
211
- requirements: [
212
- 'Resolve event IDs, event: references, and mem citation IDs into source references.',
213
- 'Return privacy-safe redacted previews and a narrow allowlist of metadata instead of raw transcript content.',
214
- 'Support projectPath scoping for project-specific memory stores.'
215
- ],
216
- evidence: [
217
- { kind: 'test', ref: 'tests/extensions/mcp-context-tools.test.ts', note: 'Asserts citation lookup, secret redaction, and safe metadata allowlist.' },
218
- { kind: 'source', ref: 'src/extensions/mcp/handlers.ts', note: 'mem-source-ref applies privacy filtering and safe metadata selection.' },
219
- { kind: 'source', ref: 'src/core/privacy/filter.ts', note: 'Shared privacy filter masks sensitive patterns before output.' }
220
- ]
221
- },
222
- {
223
- id: 'cli.api.reporting',
224
- area: 'cli',
225
- title: 'CLI / API / reporting',
226
- status: 'ready',
227
- requirements: [
228
- 'Expose user-facing Codex validation commands with --project, --sessions-dir, --limit, --format, --output, and --dry-run options.',
229
- 'Expose user-facing Hermes validation commands with --project, --state-db, --limit, --format, --output, and --dry-run options.',
230
- 'Expose explicit Codex and Hermes import commands with project, session, all-session, limit, force, and no-process-embeddings options.',
231
- 'Render JSON and Markdown reports with totals, warnings, top projects/sources, and source paths.'
232
- ],
233
- evidence: [
234
- { kind: 'test', ref: 'tests/apps/codex-validation-output.test.ts', note: 'Codex JSON/Markdown report formatting.' },
235
- { kind: 'test', ref: 'tests/apps/codex-import-runner.test.ts', note: 'Codex import CLI runner behavior and storage-scope routing.' },
236
- { kind: 'test', ref: 'tests/apps/hermes-import-runner.test.ts', note: 'Hermes import CLI runner behavior and storage-scope routing.' },
237
- { kind: 'source', ref: 'src/apps/cli/index.ts', note: 'codex and hermes validate/replay/import commands.' },
238
- { kind: 'source', ref: 'src/apps/cli/codex-validation-output.ts', note: 'Codex report output helpers.' },
239
- { kind: 'source', ref: 'src/apps/cli/hermes-validation-output.ts', note: 'Hermes report output helpers.' },
240
- { kind: 'source', ref: 'src/apps/cli/codex-import-runner.ts', note: 'Codex import runner.' },
241
- { kind: 'source', ref: 'src/apps/cli/hermes-import-runner.ts', note: 'Hermes import runner.' }
242
- ]
243
- },
244
- {
245
- id: 'safety.dryRun',
246
- area: 'safety',
247
- title: 'Safety / dry-run',
248
- status: 'ready',
249
- requirements: [
250
- 'Codex validation/replay is read-only by default and never initializes memory storage or changes Claude settings.',
251
- 'Reports exclude transcript content and can anonymize project paths for real-data validation artifacts.'
252
- ],
253
- evidence: [
254
- { kind: 'test', ref: 'tests/core/codex-session-history-importer-validation.test.ts', note: 'Asserts dryRun=true, willMutate=false, and no transcript content in reports.' },
255
- { kind: 'command', ref: 'claude-memory-layer codex validate --dry-run', note: 'User-facing dry-run validation command.' },
256
- { kind: 'doc', ref: 'docs/PRODUCT_VALIDATION_MATRIX.md', note: 'Documents safety expectations and read-only validation scope.' }
257
- ]
258
- }
259
- ];
260
-
261
- function emptyAreaCounts(): Record<ProductValidationArea, number> {
262
- return { claude: 0, codex: 0, hermes: 0, mcp: 0, cli: 0, safety: 0 };
263
- }
264
-
265
- function emptyStatusCounts(): Record<ProductValidationStatus, number> {
266
- return { ready: 0, covered: 0, partial: 0, planned: 0 };
267
- }
268
-
269
- export function getProductValidationMatrixSummary(
270
- matrix: readonly ProductValidationSurface[] = productValidationMatrix
271
- ): ProductValidationMatrixSummary {
272
- const summary: ProductValidationMatrixSummary = {
273
- totalSurfaces: matrix.length,
274
- requirementCount: 0,
275
- evidenceCount: 0,
276
- surfacesByArea: emptyAreaCounts(),
277
- statusCounts: emptyStatusCounts()
278
- };
279
-
280
- for (const surface of matrix) {
281
- summary.surfacesByArea[surface.area] += 1;
282
- summary.statusCounts[surface.status] += 1;
283
- summary.requirementCount += surface.requirements.length;
284
- summary.evidenceCount += surface.evidence.length;
285
- }
286
-
287
- return summary;
288
- }
289
-
290
- export function renderProductValidationMatrixMarkdown(
291
- matrix: readonly ProductValidationSurface[] = productValidationMatrix
292
- ): string {
293
- const summary = getProductValidationMatrixSummary(matrix);
294
- const lines: string[] = [
295
- '# Product Validation Matrix',
296
- '',
297
- `Surfaces: ${summary.totalSurfaces}`,
298
- `Requirements: ${summary.requirementCount}`,
299
- `Evidence items: ${summary.evidenceCount}`,
300
- '',
301
- '| Area | Surface | Status | Requirements | Evidence |',
302
- '| --- | --- | --- | --- | --- |'
303
- ];
304
-
305
- for (const surface of matrix) {
306
- const requirements = surface.requirements.map((requirement) => requirement.replace(/\|/g, '\\|')).join('<br>');
307
- const evidence = surface.evidence
308
- .map((item) => `${item.kind}: ${item.ref}`.replace(/\|/g, '\\|'))
309
- .join('<br>');
310
- lines.push(`| ${surface.area} | ${surface.title} | ${surface.status} | ${requirements} | ${evidence} |`);
311
- }
312
-
313
- return `${lines.join('\n')}\n`;
314
- }