@agentmemory/agentmemory 0.7.2 → 0.7.3

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 (217) hide show
  1. package/AGENTS.md +2 -2
  2. package/README.md +41 -68
  3. package/dist/cli.mjs +3 -3
  4. package/dist/index.mjs +3 -2
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/{src-1fTKFEtN.mjs → src-sYZDDbiA.mjs} +4 -3
  7. package/dist/src-sYZDDbiA.mjs.map +1 -0
  8. package/dist/standalone.mjs +1 -1
  9. package/dist/standalone.mjs.map +1 -1
  10. package/package.json +10 -1
  11. package/plugin/.claude-plugin/plugin.json +1 -1
  12. package/plugin/scripts/notification.d.mts +1 -0
  13. package/plugin/scripts/notification.mjs.map +1 -0
  14. package/plugin/scripts/post-tool-failure.d.mts +1 -0
  15. package/plugin/scripts/post-tool-failure.mjs.map +1 -0
  16. package/plugin/scripts/post-tool-use.d.mts +1 -0
  17. package/plugin/scripts/post-tool-use.mjs.map +1 -0
  18. package/plugin/scripts/pre-compact.d.mts +1 -0
  19. package/plugin/scripts/pre-compact.mjs.map +1 -0
  20. package/plugin/scripts/pre-tool-use.d.mts +1 -0
  21. package/plugin/scripts/pre-tool-use.mjs.map +1 -0
  22. package/plugin/scripts/prompt-submit.d.mts +1 -0
  23. package/plugin/scripts/prompt-submit.mjs.map +1 -0
  24. package/plugin/scripts/session-end.d.mts +1 -0
  25. package/plugin/scripts/session-end.mjs.map +1 -0
  26. package/plugin/scripts/session-start.d.mts +1 -0
  27. package/plugin/scripts/session-start.mjs.map +1 -0
  28. package/plugin/scripts/stop.d.mts +1 -0
  29. package/plugin/scripts/stop.mjs.map +1 -0
  30. package/plugin/scripts/subagent-start.d.mts +1 -0
  31. package/plugin/scripts/subagent-start.mjs.map +1 -0
  32. package/plugin/scripts/subagent-stop.d.mts +1 -0
  33. package/plugin/scripts/subagent-stop.mjs.map +1 -0
  34. package/plugin/scripts/task-completed.d.mts +1 -0
  35. package/plugin/scripts/task-completed.mjs.map +1 -0
  36. package/.claude-plugin/marketplace.json +0 -14
  37. package/.github/workflows/ci.yml +0 -22
  38. package/.github/workflows/publish.yml +0 -28
  39. package/assets/banner.png +0 -0
  40. package/assets/demo.gif +0 -0
  41. package/assets/demo.mp4 +0 -0
  42. package/benchmark/QUALITY.md +0 -73
  43. package/benchmark/REAL-EMBEDDINGS.md +0 -67
  44. package/benchmark/SCALE.md +0 -110
  45. package/benchmark/dataset.ts +0 -293
  46. package/benchmark/quality-eval.ts +0 -643
  47. package/benchmark/real-embeddings-eval.ts +0 -405
  48. package/benchmark/scale-eval.ts +0 -398
  49. package/dist/src-1fTKFEtN.mjs.map +0 -1
  50. package/src/auth.ts +0 -12
  51. package/src/cli.ts +0 -251
  52. package/src/config.ts +0 -221
  53. package/src/eval/metrics-store.ts +0 -65
  54. package/src/eval/quality.ts +0 -51
  55. package/src/eval/schemas.ts +0 -124
  56. package/src/eval/self-correct.ts +0 -28
  57. package/src/eval/validator.ts +0 -31
  58. package/src/functions/actions.ts +0 -288
  59. package/src/functions/audit.ts +0 -61
  60. package/src/functions/auto-forget.ts +0 -169
  61. package/src/functions/branch-aware.ts +0 -169
  62. package/src/functions/cascade.ts +0 -80
  63. package/src/functions/checkpoints.ts +0 -209
  64. package/src/functions/claude-bridge.ts +0 -161
  65. package/src/functions/compress.ts +0 -194
  66. package/src/functions/consolidate.ts +0 -212
  67. package/src/functions/consolidation-pipeline.ts +0 -258
  68. package/src/functions/context.ts +0 -169
  69. package/src/functions/crystallize.ts +0 -293
  70. package/src/functions/dedup.ts +0 -57
  71. package/src/functions/diagnostics.ts +0 -785
  72. package/src/functions/enrich.ts +0 -132
  73. package/src/functions/evict.ts +0 -163
  74. package/src/functions/export-import.ts +0 -508
  75. package/src/functions/facets.ts +0 -248
  76. package/src/functions/file-index.ts +0 -106
  77. package/src/functions/flow-compress.ts +0 -214
  78. package/src/functions/frontier.ts +0 -196
  79. package/src/functions/governance.ts +0 -131
  80. package/src/functions/graph-retrieval.ts +0 -277
  81. package/src/functions/graph.ts +0 -275
  82. package/src/functions/leases.ts +0 -216
  83. package/src/functions/lessons.ts +0 -253
  84. package/src/functions/mesh.ts +0 -434
  85. package/src/functions/migrate.ts +0 -165
  86. package/src/functions/observe.ts +0 -144
  87. package/src/functions/obsidian-export.ts +0 -310
  88. package/src/functions/patterns.ts +0 -138
  89. package/src/functions/privacy.ts +0 -39
  90. package/src/functions/profile.ts +0 -155
  91. package/src/functions/query-expansion.ts +0 -186
  92. package/src/functions/relations.ts +0 -237
  93. package/src/functions/remember.ts +0 -162
  94. package/src/functions/retention.ts +0 -235
  95. package/src/functions/routines.ts +0 -289
  96. package/src/functions/search.ts +0 -80
  97. package/src/functions/sentinels.ts +0 -417
  98. package/src/functions/signals.ts +0 -186
  99. package/src/functions/sketches.ts +0 -274
  100. package/src/functions/sliding-window.ts +0 -257
  101. package/src/functions/smart-search.ts +0 -115
  102. package/src/functions/snapshot.ts +0 -219
  103. package/src/functions/summarize.ts +0 -155
  104. package/src/functions/team.ts +0 -147
  105. package/src/functions/temporal-graph.ts +0 -476
  106. package/src/functions/timeline.ts +0 -138
  107. package/src/functions/verify.ts +0 -117
  108. package/src/health/monitor.ts +0 -110
  109. package/src/health/thresholds.ts +0 -73
  110. package/src/hooks/notification.ts +0 -52
  111. package/src/hooks/post-tool-failure.ts +0 -58
  112. package/src/hooks/post-tool-use.ts +0 -62
  113. package/src/hooks/pre-compact.ts +0 -60
  114. package/src/hooks/pre-tool-use.ts +0 -72
  115. package/src/hooks/prompt-submit.ts +0 -46
  116. package/src/hooks/session-end.ts +0 -71
  117. package/src/hooks/session-start.ts +0 -48
  118. package/src/hooks/stop.ts +0 -39
  119. package/src/hooks/subagent-start.ts +0 -49
  120. package/src/hooks/subagent-stop.ts +0 -54
  121. package/src/hooks/task-completed.ts +0 -54
  122. package/src/index.ts +0 -342
  123. package/src/mcp/in-memory-kv.ts +0 -61
  124. package/src/mcp/server.ts +0 -1455
  125. package/src/mcp/standalone.ts +0 -177
  126. package/src/mcp/tools-registry.ts +0 -769
  127. package/src/mcp/transport.ts +0 -91
  128. package/src/prompts/compression.ts +0 -67
  129. package/src/prompts/consolidation.ts +0 -48
  130. package/src/prompts/graph-extraction.ts +0 -35
  131. package/src/prompts/summary.ts +0 -38
  132. package/src/prompts/xml.ts +0 -26
  133. package/src/providers/agent-sdk.ts +0 -34
  134. package/src/providers/anthropic.ts +0 -35
  135. package/src/providers/circuit-breaker.ts +0 -82
  136. package/src/providers/embedding/cohere.ts +0 -46
  137. package/src/providers/embedding/gemini.ts +0 -54
  138. package/src/providers/embedding/index.ts +0 -39
  139. package/src/providers/embedding/local.ts +0 -52
  140. package/src/providers/embedding/openai.ts +0 -45
  141. package/src/providers/embedding/openrouter.ts +0 -51
  142. package/src/providers/embedding/voyage.ts +0 -46
  143. package/src/providers/fallback-chain.ts +0 -31
  144. package/src/providers/index.ts +0 -84
  145. package/src/providers/openrouter.ts +0 -71
  146. package/src/providers/resilient.ts +0 -37
  147. package/src/state/hybrid-search.ts +0 -295
  148. package/src/state/index-persistence.ts +0 -63
  149. package/src/state/keyed-mutex.ts +0 -18
  150. package/src/state/kv.ts +0 -33
  151. package/src/state/schema.ts +0 -71
  152. package/src/state/search-index.ts +0 -245
  153. package/src/state/stemmer.ts +0 -104
  154. package/src/state/synonyms.ts +0 -63
  155. package/src/state/vector-index.ts +0 -130
  156. package/src/telemetry/setup.ts +0 -116
  157. package/src/triggers/api.ts +0 -1904
  158. package/src/triggers/events.ts +0 -71
  159. package/src/types.ts +0 -769
  160. package/src/version.ts +0 -1
  161. package/src/viewer/index.html +0 -2556
  162. package/src/viewer/server.ts +0 -207
  163. package/src/xenova.d.ts +0 -3
  164. package/test/actions.test.ts +0 -490
  165. package/test/audit.test.ts +0 -108
  166. package/test/auto-forget.test.ts +0 -188
  167. package/test/cascade.test.ts +0 -277
  168. package/test/checkpoints.test.ts +0 -493
  169. package/test/circuit-breaker.test.ts +0 -107
  170. package/test/claude-bridge.test.ts +0 -178
  171. package/test/confidence.test.ts +0 -247
  172. package/test/consistency.test.ts +0 -61
  173. package/test/consolidation-pipeline.test.ts +0 -251
  174. package/test/crystallize.test.ts +0 -521
  175. package/test/diagnostics.test.ts +0 -638
  176. package/test/embedding-provider.test.ts +0 -49
  177. package/test/enrich.test.ts +0 -209
  178. package/test/eval.test.ts +0 -300
  179. package/test/export-import.test.ts +0 -251
  180. package/test/facets.test.ts +0 -448
  181. package/test/fallback-chain.test.ts +0 -93
  182. package/test/frontier.test.ts +0 -485
  183. package/test/governance.test.ts +0 -147
  184. package/test/graph-retrieval.test.ts +0 -186
  185. package/test/graph.test.ts +0 -160
  186. package/test/helpers/mocks.ts +0 -40
  187. package/test/hybrid-search.test.ts +0 -145
  188. package/test/index-persistence.test.ts +0 -124
  189. package/test/integration.test.ts +0 -265
  190. package/test/leases.test.ts +0 -399
  191. package/test/mcp-prompts.test.ts +0 -218
  192. package/test/mcp-resources.test.ts +0 -286
  193. package/test/mcp-standalone.test.ts +0 -113
  194. package/test/mesh.test.ts +0 -700
  195. package/test/privacy.test.ts +0 -87
  196. package/test/profile.test.ts +0 -161
  197. package/test/query-expansion.test.ts +0 -154
  198. package/test/relations.test.ts +0 -198
  199. package/test/retention.test.ts +0 -245
  200. package/test/routines.test.ts +0 -497
  201. package/test/schema-fingerprint.test.ts +0 -81
  202. package/test/schema.test.ts +0 -42
  203. package/test/search-index.test.ts +0 -128
  204. package/test/sentinels.test.ts +0 -626
  205. package/test/signals.test.ts +0 -410
  206. package/test/sketches.test.ts +0 -549
  207. package/test/sliding-window.test.ts +0 -199
  208. package/test/smart-search.test.ts +0 -169
  209. package/test/snapshot.test.ts +0 -165
  210. package/test/team.test.ts +0 -156
  211. package/test/temporal-graph.test.ts +0 -378
  212. package/test/timeline.test.ts +0 -148
  213. package/test/vector-index.test.ts +0 -79
  214. package/test/verify.test.ts +0 -209
  215. package/test/xml.test.ts +0 -65
  216. package/tsconfig.json +0 -22
  217. package/tsdown.config.ts +0 -62
package/src/types.ts DELETED
@@ -1,769 +0,0 @@
1
- export interface Session {
2
- id: string;
3
- project: string;
4
- cwd: string;
5
- startedAt: string;
6
- endedAt?: string;
7
- status: "active" | "completed" | "abandoned";
8
- observationCount: number;
9
- model?: string;
10
- tags?: string[];
11
- }
12
-
13
- export interface RawObservation {
14
- id: string;
15
- sessionId: string;
16
- timestamp: string;
17
- hookType: HookType;
18
- toolName?: string;
19
- toolInput?: unknown;
20
- toolOutput?: unknown;
21
- userPrompt?: string;
22
- assistantResponse?: string;
23
- raw: unknown;
24
- }
25
-
26
- export interface CompressedObservation {
27
- id: string;
28
- sessionId: string;
29
- timestamp: string;
30
- type: ObservationType;
31
- title: string;
32
- subtitle?: string;
33
- facts: string[];
34
- narrative: string;
35
- concepts: string[];
36
- files: string[];
37
- importance: number;
38
- confidence?: number;
39
- }
40
-
41
- export type ObservationType =
42
- | "file_read"
43
- | "file_write"
44
- | "file_edit"
45
- | "command_run"
46
- | "search"
47
- | "web_fetch"
48
- | "conversation"
49
- | "error"
50
- | "decision"
51
- | "discovery"
52
- | "subagent"
53
- | "notification"
54
- | "task"
55
- | "other";
56
-
57
- export interface Memory {
58
- id: string;
59
- createdAt: string;
60
- updatedAt: string;
61
- type: "pattern" | "preference" | "architecture" | "bug" | "workflow" | "fact";
62
- title: string;
63
- content: string;
64
- concepts: string[];
65
- files: string[];
66
- sessionIds: string[];
67
- strength: number;
68
- version: number;
69
- parentId?: string;
70
- supersedes?: string[];
71
- relatedIds?: string[];
72
- sourceObservationIds?: string[];
73
- isLatest: boolean;
74
- forgetAfter?: string;
75
- }
76
-
77
- export interface SessionSummary {
78
- sessionId: string;
79
- project: string;
80
- createdAt: string;
81
- title: string;
82
- narrative: string;
83
- keyDecisions: string[];
84
- filesModified: string[];
85
- concepts: string[];
86
- observationCount: number;
87
- }
88
-
89
- export type HookType =
90
- | "session_start"
91
- | "prompt_submit"
92
- | "pre_tool_use"
93
- | "post_tool_use"
94
- | "post_tool_failure"
95
- | "pre_compact"
96
- | "subagent_start"
97
- | "subagent_stop"
98
- | "notification"
99
- | "task_completed"
100
- | "stop"
101
- | "session_end";
102
-
103
- export interface HookPayload {
104
- hookType: HookType;
105
- sessionId: string;
106
- project: string;
107
- cwd: string;
108
- timestamp: string;
109
- data: unknown;
110
- }
111
-
112
- export interface ProviderConfig {
113
- provider: ProviderType;
114
- model: string;
115
- maxTokens: number;
116
- }
117
-
118
- export type ProviderType = "agent-sdk" | "anthropic" | "gemini" | "openrouter";
119
-
120
- export interface MemoryProvider {
121
- name: string;
122
- compress(systemPrompt: string, userPrompt: string): Promise<string>;
123
- summarize(systemPrompt: string, userPrompt: string): Promise<string>;
124
- }
125
-
126
- export interface AgentMemoryConfig {
127
- engineUrl: string;
128
- restPort: number;
129
- streamsPort: number;
130
- provider: ProviderConfig;
131
- tokenBudget: number;
132
- maxObservationsPerSession: number;
133
- compressionModel: string;
134
- dataDir: string;
135
- }
136
-
137
- export interface SearchResult {
138
- observation: CompressedObservation;
139
- score: number;
140
- sessionId: string;
141
- }
142
-
143
- export interface ContextBlock {
144
- type: "summary" | "observation" | "memory";
145
- content: string;
146
- tokens: number;
147
- recency: number;
148
- }
149
-
150
- export interface EvalResult {
151
- valid: boolean;
152
- errors: string[];
153
- qualityScore: number;
154
- latencyMs: number;
155
- functionId: string;
156
- }
157
-
158
- export interface FunctionMetrics {
159
- functionId: string;
160
- totalCalls: number;
161
- successCount: number;
162
- failureCount: number;
163
- avgLatencyMs: number;
164
- avgQualityScore: number;
165
- }
166
-
167
- export interface HealthSnapshot {
168
- connectionState: string;
169
- workers: Array<{ id: string; name: string; status: string }>;
170
- memory: {
171
- heapUsed: number;
172
- heapTotal: number;
173
- rss: number;
174
- external: number;
175
- };
176
- cpu: { userMicros: number; systemMicros: number; percent: number };
177
- eventLoopLagMs: number;
178
- uptimeSeconds: number;
179
- kvConnectivity?: { status: string; latencyMs?: number; error?: string };
180
- status: "healthy" | "degraded" | "critical";
181
- alerts: string[];
182
- }
183
-
184
- export interface CircuitBreakerState {
185
- state: "closed" | "open" | "half-open";
186
- failures: number;
187
- lastFailureAt: number | null;
188
- openedAt: number | null;
189
- }
190
-
191
- export interface EmbeddingProvider {
192
- name: string;
193
- dimensions: number;
194
- embed(text: string): Promise<Float32Array>;
195
- embedBatch(texts: string[]): Promise<Float32Array[]>;
196
- }
197
-
198
- export interface MemoryRelation {
199
- type: "supersedes" | "extends" | "derives" | "contradicts" | "related";
200
- sourceId: string;
201
- targetId: string;
202
- createdAt: string;
203
- confidence?: number;
204
- }
205
-
206
- export interface HybridSearchResult {
207
- observation: CompressedObservation;
208
- bm25Score: number;
209
- vectorScore: number;
210
- graphScore: number;
211
- combinedScore: number;
212
- sessionId: string;
213
- graphContext?: string;
214
- }
215
-
216
- export interface CompactSearchResult {
217
- obsId: string;
218
- sessionId: string;
219
- title: string;
220
- type: ObservationType;
221
- score: number;
222
- timestamp: string;
223
- }
224
-
225
- export interface TimelineEntry {
226
- observation: CompressedObservation;
227
- sessionId: string;
228
- relativePosition: number;
229
- }
230
-
231
- export interface ProjectProfile {
232
- project: string;
233
- updatedAt: string;
234
- topConcepts: Array<{ concept: string; frequency: number }>;
235
- topFiles: Array<{ file: string; frequency: number }>;
236
- conventions: string[];
237
- commonErrors: string[];
238
- recentActivity: string[];
239
- sessionCount: number;
240
- totalObservations: number;
241
- summary?: string;
242
- }
243
-
244
- export interface ExportPagination {
245
- offset: number;
246
- limit: number;
247
- total: number;
248
- hasMore: boolean;
249
- }
250
-
251
- export interface ExportData {
252
- version: "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.6.1" | "0.7.0" | "0.7.2";
253
- exportedAt: string;
254
- sessions: Session[];
255
- observations: Record<string, CompressedObservation[]>;
256
- memories: Memory[];
257
- summaries: SessionSummary[];
258
- profiles?: ProjectProfile[];
259
- graphNodes?: GraphNode[];
260
- graphEdges?: GraphEdge[];
261
- semanticMemories?: SemanticMemory[];
262
- proceduralMemories?: ProceduralMemory[];
263
- actions?: Action[];
264
- actionEdges?: ActionEdge[];
265
- routines?: Routine[];
266
- signals?: Signal[];
267
- checkpoints?: Checkpoint[];
268
- sentinels?: Sentinel[];
269
- sketches?: Sketch[];
270
- crystals?: Crystal[];
271
- facets?: Facet[];
272
- lessons?: Lesson[];
273
- pagination?: ExportPagination;
274
- }
275
-
276
- export interface EmbeddingConfig {
277
- provider?: string;
278
- bm25Weight: number;
279
- vectorWeight: number;
280
- }
281
-
282
- export interface FallbackConfig {
283
- providers: ProviderType[];
284
- }
285
-
286
- export interface ClaudeBridgeConfig {
287
- enabled: boolean;
288
- projectPath: string;
289
- memoryFilePath: string;
290
- lineBudget: number;
291
- }
292
-
293
- export interface StandaloneConfig {
294
- dataDir: string;
295
- persistPath: string;
296
- agentType?: string;
297
- }
298
-
299
- export type GraphNodeType =
300
- | "file"
301
- | "function"
302
- | "concept"
303
- | "error"
304
- | "decision"
305
- | "pattern"
306
- | "library"
307
- | "person"
308
- | "project"
309
- | "preference"
310
- | "location"
311
- | "organization"
312
- | "event";
313
-
314
- export interface GraphNode {
315
- id: string;
316
- type: GraphNodeType;
317
- name: string;
318
- properties: Record<string, unknown>;
319
- sourceObservationIds: string[];
320
- createdAt: string;
321
- updatedAt?: string;
322
- aliases?: string[];
323
- stale?: boolean;
324
- }
325
-
326
- export type GraphEdgeType =
327
- | "uses"
328
- | "imports"
329
- | "modifies"
330
- | "causes"
331
- | "fixes"
332
- | "depends_on"
333
- | "related_to"
334
- | "works_at"
335
- | "prefers"
336
- | "blocked_by"
337
- | "caused_by"
338
- | "optimizes_for"
339
- | "rejected"
340
- | "avoids"
341
- | "located_in"
342
- | "succeeded_by";
343
-
344
- export interface GraphEdge {
345
- id: string;
346
- type: GraphEdgeType;
347
- sourceNodeId: string;
348
- targetNodeId: string;
349
- weight: number;
350
- sourceObservationIds: string[];
351
- createdAt: string;
352
- tcommit?: string;
353
- tvalid?: string;
354
- tvalidEnd?: string;
355
- context?: EdgeContext;
356
- version?: number;
357
- supersededBy?: string;
358
- isLatest?: boolean;
359
- stale?: boolean;
360
- }
361
-
362
- export interface EdgeContext {
363
- reasoning?: string;
364
- sentiment?: string;
365
- alternatives?: string[];
366
- situationalFactors?: string[];
367
- confidence?: number;
368
- }
369
-
370
- export interface GraphQueryResult {
371
- nodes: GraphNode[];
372
- edges: GraphEdge[];
373
- depth: number;
374
- }
375
-
376
- export type ConsolidationTier =
377
- | "working"
378
- | "episodic"
379
- | "semantic"
380
- | "procedural";
381
-
382
- export interface SemanticMemory {
383
- id: string;
384
- fact: string;
385
- confidence: number;
386
- sourceSessionIds: string[];
387
- sourceMemoryIds: string[];
388
- accessCount: number;
389
- lastAccessedAt: string;
390
- strength: number;
391
- createdAt: string;
392
- updatedAt: string;
393
- }
394
-
395
- export interface ProceduralMemory {
396
- id: string;
397
- name: string;
398
- steps: string[];
399
- triggerCondition: string;
400
- frequency: number;
401
- sourceSessionIds: string[];
402
- strength: number;
403
- createdAt: string;
404
- updatedAt: string;
405
- }
406
-
407
- export interface TeamConfig {
408
- teamId: string;
409
- userId: string;
410
- mode: "shared" | "private";
411
- }
412
-
413
- export interface TeamSharedItem {
414
- id: string;
415
- sharedBy: string;
416
- sharedAt: string;
417
- type: "observation" | "memory" | "pattern";
418
- content: unknown;
419
- project: string;
420
- visibility: "shared" | "private";
421
- }
422
-
423
- export interface TeamProfile {
424
- teamId: string;
425
- members: string[];
426
- topConcepts: Array<{ concept: string; frequency: number }>;
427
- topFiles: Array<{ file: string; frequency: number }>;
428
- sharedPatterns: string[];
429
- totalSharedItems: number;
430
- updatedAt: string;
431
- }
432
-
433
- export interface AuditEntry {
434
- id: string;
435
- timestamp: string;
436
- operation:
437
- | "observe"
438
- | "compress"
439
- | "remember"
440
- | "forget"
441
- | "evolve"
442
- | "consolidate"
443
- | "share"
444
- | "delete"
445
- | "import"
446
- | "export"
447
- | "action_create"
448
- | "action_update"
449
- | "lease_acquire"
450
- | "lease_release"
451
- | "routine_run"
452
- | "signal_send"
453
- | "checkpoint_resolve"
454
- | "mesh_sync"
455
- | "sentinel_create"
456
- | "sentinel_trigger"
457
- | "sketch_create"
458
- | "sketch_promote"
459
- | "sketch_discard"
460
- | "crystallize"
461
- | "diagnose"
462
- | "heal"
463
- | "facet_tag"
464
- | "lesson_save"
465
- | "lesson_recall"
466
- | "lesson_strengthen"
467
- | "obsidian_export";
468
- userId?: string;
469
- functionId: string;
470
- targetIds: string[];
471
- details: Record<string, unknown>;
472
- qualityScore?: number;
473
- }
474
-
475
- export interface GovernanceFilter {
476
- type?: string[];
477
- dateFrom?: string;
478
- dateTo?: string;
479
- project?: string;
480
- qualityBelow?: number;
481
- }
482
-
483
- export interface SnapshotMeta {
484
- id: string;
485
- commitHash: string;
486
- createdAt: string;
487
- message: string;
488
- stats: {
489
- sessions: number;
490
- observations: number;
491
- memories: number;
492
- graphNodes: number;
493
- };
494
- }
495
-
496
- export interface SnapshotDiff {
497
- fromCommit: string;
498
- toCommit: string;
499
- added: { memories: number; observations: number; graphNodes: number };
500
- removed: { memories: number; observations: number; graphNodes: number };
501
- }
502
-
503
- export interface Action {
504
- id: string;
505
- title: string;
506
- description: string;
507
- status: "pending" | "active" | "done" | "blocked" | "cancelled";
508
- priority: number;
509
- createdAt: string;
510
- updatedAt: string;
511
- createdBy: string;
512
- assignedTo?: string;
513
- project?: string;
514
- tags: string[];
515
- sourceObservationIds: string[];
516
- sourceMemoryIds: string[];
517
- result?: string;
518
- parentId?: string;
519
- metadata?: Record<string, unknown>;
520
- sketchId?: string;
521
- crystallizedInto?: string;
522
- }
523
-
524
- export type ActionEdgeType =
525
- | "requires"
526
- | "unlocks"
527
- | "spawned_by"
528
- | "gated_by"
529
- | "conflicts_with";
530
-
531
- export interface ActionEdge {
532
- id: string;
533
- type: ActionEdgeType;
534
- sourceActionId: string;
535
- targetActionId: string;
536
- createdAt: string;
537
- metadata?: Record<string, unknown>;
538
- }
539
-
540
- export interface Lease {
541
- id: string;
542
- actionId: string;
543
- agentId: string;
544
- acquiredAt: string;
545
- expiresAt: string;
546
- renewedAt?: string;
547
- status: "active" | "expired" | "released";
548
- }
549
-
550
- export interface Routine {
551
- id: string;
552
- name: string;
553
- description: string;
554
- steps: RoutineStep[];
555
- createdAt: string;
556
- updatedAt: string;
557
- frozen: boolean;
558
- tags: string[];
559
- sourceProceduralIds: string[];
560
- }
561
-
562
- export interface RoutineStep {
563
- order: number;
564
- title: string;
565
- description: string;
566
- actionTemplate: Partial<Action>;
567
- dependsOn: number[];
568
- }
569
-
570
- export interface RoutineRun {
571
- id: string;
572
- routineId: string;
573
- status: "running" | "completed" | "failed" | "paused";
574
- startedAt: string;
575
- completedAt?: string;
576
- actionIds: string[];
577
- stepStatus: Record<number, "pending" | "active" | "done" | "failed">;
578
- initiatedBy: string;
579
- }
580
-
581
- export interface Signal {
582
- id: string;
583
- from: string;
584
- to?: string;
585
- threadId?: string;
586
- replyTo?: string;
587
- type: "info" | "request" | "response" | "alert" | "handoff";
588
- content: string;
589
- metadata?: Record<string, unknown>;
590
- createdAt: string;
591
- readAt?: string;
592
- expiresAt?: string;
593
- }
594
-
595
- export interface Checkpoint {
596
- id: string;
597
- name: string;
598
- description: string;
599
- status: "pending" | "passed" | "failed" | "expired";
600
- type: "ci" | "approval" | "deploy" | "external" | "timer";
601
- createdAt: string;
602
- resolvedAt?: string;
603
- resolvedBy?: string;
604
- result?: unknown;
605
- expiresAt?: string;
606
- linkedActionIds: string[];
607
- }
608
-
609
- export interface Sketch {
610
- id: string;
611
- title: string;
612
- description: string;
613
- status: "active" | "promoted" | "discarded";
614
- actionIds: string[];
615
- project?: string;
616
- createdAt: string;
617
- expiresAt: string;
618
- promotedAt?: string;
619
- discardedAt?: string;
620
- }
621
-
622
- export interface Facet {
623
- id: string;
624
- targetId: string;
625
- targetType: "action" | "memory" | "observation";
626
- dimension: string;
627
- value: string;
628
- createdAt: string;
629
- }
630
-
631
- export interface Sentinel {
632
- id: string;
633
- name: string;
634
- type: "webhook" | "timer" | "threshold" | "pattern" | "approval" | "custom";
635
- status: "watching" | "triggered" | "cancelled" | "expired";
636
- config: Record<string, unknown>;
637
- result?: unknown;
638
- createdAt: string;
639
- triggeredAt?: string;
640
- expiresAt?: string;
641
- linkedActionIds: string[];
642
- escalatedAt?: string;
643
- }
644
-
645
- export interface Crystal {
646
- id: string;
647
- narrative: string;
648
- keyOutcomes: string[];
649
- filesAffected: string[];
650
- lessons: string[];
651
- sourceActionIds: string[];
652
- sessionId?: string;
653
- project?: string;
654
- createdAt: string;
655
- }
656
-
657
- export interface Lesson {
658
- id: string;
659
- content: string;
660
- context: string;
661
- confidence: number;
662
- reinforcements: number;
663
- source: "crystal" | "manual" | "consolidation";
664
- sourceIds: string[];
665
- project?: string;
666
- tags: string[];
667
- createdAt: string;
668
- updatedAt: string;
669
- lastReinforcedAt?: string;
670
- lastDecayedAt?: string;
671
- decayRate: number;
672
- deleted?: boolean;
673
- }
674
-
675
- export interface DiagnosticCheck {
676
- name: string;
677
- category: string;
678
- status: "pass" | "warn" | "fail";
679
- message: string;
680
- fixable: boolean;
681
- }
682
-
683
- export interface MeshPeer {
684
- id: string;
685
- url: string;
686
- name: string;
687
- lastSyncAt?: string;
688
- status: "connected" | "disconnected" | "syncing" | "error";
689
- sharedScopes: string[];
690
- syncFilter?: { project?: string };
691
- }
692
-
693
-
694
- export interface EnrichedChunk {
695
- id: string;
696
- originalObsId: string;
697
- sessionId: string;
698
- content: string;
699
- resolvedEntities: Record<string, string>;
700
- preferences: string[];
701
- contextBridges: string[];
702
- windowStart: number;
703
- windowEnd: number;
704
- createdAt: string;
705
- }
706
-
707
- export interface LatentEmbedding {
708
- obsId: string;
709
- contentEmbedding: string;
710
- latentEmbedding: string;
711
- sessionId: string;
712
- }
713
-
714
- export interface QueryExpansion {
715
- original: string;
716
- reformulations: string[];
717
- temporalConcretizations: string[];
718
- entityExtractions: string[];
719
- }
720
-
721
- export interface TripleStreamResult {
722
- observation: CompressedObservation;
723
- vectorScore: number;
724
- bm25Score: number;
725
- graphScore: number;
726
- combinedScore: number;
727
- sessionId: string;
728
- graphContext?: string;
729
- }
730
-
731
- export interface TemporalQuery {
732
- entityName: string;
733
- asOf?: string;
734
- from?: string;
735
- to?: string;
736
- includeHistory?: boolean;
737
- }
738
-
739
- export interface TemporalState {
740
- entity: GraphNode;
741
- currentEdges: GraphEdge[];
742
- historicalEdges: GraphEdge[];
743
- timeline: Array<{
744
- edge: GraphEdge;
745
- validFrom: string;
746
- validTo?: string;
747
- context?: EdgeContext;
748
- }>;
749
- }
750
-
751
- export interface RetentionScore {
752
- memoryId: string;
753
- score: number;
754
- salience: number;
755
- temporalDecay: number;
756
- reinforcementBoost: number;
757
- lastAccessed: string;
758
- accessCount: number;
759
- }
760
-
761
- export interface DecayConfig {
762
- lambda: number;
763
- sigma: number;
764
- tierThresholds: {
765
- hot: number;
766
- warm: number;
767
- cold: number;
768
- };
769
- }