@cleocode/contracts 2026.4.95 → 2026.4.97

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 (58) hide show
  1. package/dist/facade.d.ts +63 -1
  2. package/dist/facade.d.ts.map +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/operations/brain.d.ts +579 -0
  7. package/dist/operations/brain.d.ts.map +1 -0
  8. package/dist/operations/brain.js +39 -0
  9. package/dist/operations/brain.js.map +1 -0
  10. package/dist/operations/conduit.d.ts +151 -0
  11. package/dist/operations/conduit.d.ts.map +1 -0
  12. package/dist/operations/conduit.js +29 -0
  13. package/dist/operations/conduit.js.map +1 -0
  14. package/dist/operations/index.d.ts +4 -0
  15. package/dist/operations/index.d.ts.map +1 -1
  16. package/dist/operations/index.js +4 -0
  17. package/dist/operations/index.js.map +1 -1
  18. package/dist/operations/lifecycle.d.ts +29 -1
  19. package/dist/operations/lifecycle.d.ts.map +1 -1
  20. package/dist/operations/memory.d.ts +814 -0
  21. package/dist/operations/memory.d.ts.map +1 -0
  22. package/dist/operations/memory.js +26 -0
  23. package/dist/operations/memory.js.map +1 -0
  24. package/dist/operations/nexus.d.ts +577 -0
  25. package/dist/operations/nexus.d.ts.map +1 -0
  26. package/dist/operations/nexus.js +22 -0
  27. package/dist/operations/nexus.js.map +1 -0
  28. package/dist/operations/orchestrate.d.ts +451 -38
  29. package/dist/operations/orchestrate.d.ts.map +1 -1
  30. package/dist/operations/orchestrate.js +6 -0
  31. package/dist/operations/orchestrate.js.map +1 -1
  32. package/dist/operations/release.d.ts +78 -8
  33. package/dist/operations/release.d.ts.map +1 -1
  34. package/dist/operations/session.d.ts +26 -3
  35. package/dist/operations/session.d.ts.map +1 -1
  36. package/dist/operations/tasks.d.ts +140 -2
  37. package/dist/operations/tasks.d.ts.map +1 -1
  38. package/dist/status-registry.d.ts +1 -1
  39. package/dist/status-registry.d.ts.map +1 -1
  40. package/dist/status-registry.js +3 -0
  41. package/dist/status-registry.js.map +1 -1
  42. package/dist/task.d.ts +66 -0
  43. package/dist/task.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/facade.ts +64 -1
  46. package/src/index.ts +5 -0
  47. package/src/operations/brain.ts +635 -0
  48. package/src/operations/conduit.ts +189 -0
  49. package/src/operations/index.ts +4 -0
  50. package/src/operations/lifecycle.ts +29 -1
  51. package/src/operations/memory.ts +959 -0
  52. package/src/operations/nexus.ts +711 -0
  53. package/src/operations/orchestrate.ts +447 -38
  54. package/src/operations/release.ts +77 -7
  55. package/src/operations/session.ts +26 -3
  56. package/src/operations/tasks.ts +141 -3
  57. package/src/status-registry.ts +3 -0
  58. package/src/task.ts +75 -0
@@ -0,0 +1,814 @@
1
+ /**
2
+ * Memory Domain Operations (31 operations)
3
+ *
4
+ * Query operations: 21
5
+ * Mutate operations: 10
6
+ *
7
+ * memory is the cognitive memory subsystem backed by `brain.db` (SQLite + FTS5
8
+ * + vector + graph). It surfaces observations, decisions, patterns, learnings,
9
+ * a PageIndex graph, RRF hybrid search, causal reasoning, and quality/health
10
+ * telemetry. CLI identifiers start with `memory.*` and are routed through the
11
+ * `memory` domain handler.
12
+ *
13
+ * Distinct from BRAIN (super-domain) — a NEW `operations/brain.ts` will be
14
+ * authored in T962 Wave B for the unified cross-substrate graph operations
15
+ * (wraps memory + nexus + tasks + conduit + signaldock).
16
+ *
17
+ * SYNC: Canonical implementations at packages/core/src/memory/*.
18
+ * Wire-format types live here; they are the contract for CLI + HTTP dispatch.
19
+ *
20
+ * @task T910 — Orchestration Coherence v4 (contract surface completion)
21
+ * @task T965 — operations/brain.ts → operations/memory.ts rename
22
+ * @see packages/cleo/src/dispatch/domains/memory.ts
23
+ * @see packages/contracts/src/brain.ts
24
+ */
25
+ import type { BrainCognitiveType, BrainMemoryTier, BrainSourceConfidence } from '../brain.js';
26
+ import type { LAFSPage } from '../lafs.js';
27
+ /**
28
+ * Cognitive type of a memory entry.
29
+ *
30
+ * @remarks
31
+ * Mirrors the CLI-facing taxonomy accepted by `memory.observe`. Distinct from
32
+ * `BrainCognitiveType` from `../brain.js` which carries the 3-axis
33
+ * semantic/episodic/procedural cognitive model used internally.
34
+ */
35
+ export type MemoryEntryType = 'observation' | 'decision' | 'pattern' | 'learning' | 'reference';
36
+ /** Memory observation subtype categories (from `brain_observations.type`). */
37
+ export type MemoryObservationKind = 'discovery' | 'change' | 'feature' | 'bugfix' | 'decision' | 'refactor';
38
+ /** Origin tag distinguishing where an observation was captured. */
39
+ export type MemoryObservationSourceType = 'manual' | 'session-debrief' | 'observer' | 'reflector' | 'transcript';
40
+ /** Pattern taxonomy (from `brain_patterns.type`). */
41
+ export type MemoryPatternType = 'workflow' | 'blocker' | 'success' | 'failure' | 'optimization';
42
+ /** Severity/impact level for a stored pattern. */
43
+ export type MemoryPatternImpact = 'low' | 'medium' | 'high';
44
+ /** Compact hit returned from `memory.find` / `memory.search.hybrid` layer-0 search. */
45
+ export interface MemoryCompactHit {
46
+ /** Memory entry identifier (e.g. `O-abc123`, `D-def456`). */
47
+ id: string;
48
+ /** Table this hit was drawn from. */
49
+ type: 'decision' | 'pattern' | 'learning' | 'observation';
50
+ /** Normalized display title for the entry. */
51
+ title: string;
52
+ /** ISO 8601 timestamp of entry creation. */
53
+ date: string;
54
+ /** Relevance score (table-specific; higher = better). */
55
+ relevance?: number;
56
+ /** Reciprocal Rank Fusion score (only when RRF path engaged). */
57
+ rrfScore?: number;
58
+ /** BM25 normalized score from FTS path (0..1). */
59
+ bm25Score?: number;
60
+ }
61
+ /** Full memory entry body returned by `memory.fetch` (layer-2 retrieval). */
62
+ export interface MemoryFetchedEntry {
63
+ /** Memory entry identifier. */
64
+ id: string;
65
+ /** Table the entry was drawn from. */
66
+ type: string;
67
+ /** Raw entry payload — columns vary by table. */
68
+ data: unknown;
69
+ }
70
+ /** Timeline neighbor tuple returned by `memory.timeline`. */
71
+ export interface MemoryTimelineNeighbor {
72
+ /** Memory entry identifier. */
73
+ id: string;
74
+ /** Entry table type. */
75
+ type: string;
76
+ /** ISO 8601 timestamp. */
77
+ date: string;
78
+ }
79
+ /** Anchor entry (shape is table-dependent). */
80
+ export type MemoryAnchor = Record<string, unknown>;
81
+ /** PageIndex graph node (projection of `brain_page_nodes`). */
82
+ export interface MemoryGraphNode {
83
+ /** Node identifier. */
84
+ id: string;
85
+ /** Node type classification (e.g. `symbol`, `file`, `concept`). */
86
+ nodeType: string;
87
+ /** Human-readable label. */
88
+ label: string;
89
+ /** Quality score [0..1] used by PageIndex ranking. */
90
+ qualityScore: number;
91
+ /** SHA-256 hash of the referenced content (if applicable). */
92
+ contentHash: string | null;
93
+ /** ISO 8601 timestamp of last activity touching this node. */
94
+ lastActivityAt: string;
95
+ /** Optional JSON-encoded metadata string. */
96
+ metadataJson: string | null;
97
+ /** ISO 8601 timestamp of creation. */
98
+ createdAt: string;
99
+ /** ISO 8601 timestamp of last update (nullable). */
100
+ updatedAt: string | null;
101
+ }
102
+ /** PageIndex graph edge (projection of `brain_page_edges`). */
103
+ export interface MemoryGraphEdge {
104
+ /** Source node id. */
105
+ fromId: string;
106
+ /** Target node id. */
107
+ toId: string;
108
+ /** Edge type classification. */
109
+ edgeType: string;
110
+ /** Edge weight/confidence [0..1]. */
111
+ weight: number;
112
+ /** Optional JSON-encoded metadata string. */
113
+ metadataJson: string | null;
114
+ /** ISO 8601 creation timestamp. */
115
+ createdAt: string;
116
+ }
117
+ /** Decision node returned by reasoning queries. */
118
+ export interface MemoryDecisionNode {
119
+ /** Decision entry identifier (`D-...`). */
120
+ id: string;
121
+ /** The decision statement. */
122
+ title: string;
123
+ /** Rationale for the decision. */
124
+ rationale: string;
125
+ }
126
+ /**
127
+ * Parameters for `memory.find`.
128
+ *
129
+ * @remarks
130
+ * Preconditions: `query` must be non-empty. Returns compact hits suitable for
131
+ * follow-up `memory.fetch` batching (3-layer retrieval: find → filter → fetch).
132
+ */
133
+ export interface MemoryFindParams {
134
+ /** Full-text query string (required). */
135
+ query: string;
136
+ /** Max results to return. */
137
+ limit?: number;
138
+ /** Tables to search (defaults to all four). */
139
+ tables?: Array<'decisions' | 'patterns' | 'learnings' | 'observations'>;
140
+ /** ISO 8601 lower bound on entry date. */
141
+ dateStart?: string;
142
+ /** ISO 8601 upper bound on entry date. */
143
+ dateEnd?: string;
144
+ /** Filter to observations produced by a specific agent (T418 mental models). */
145
+ agent?: string;
146
+ /** When true (default), apply Reciprocal Rank Fusion across FTS + vector sources. */
147
+ useRRF?: boolean;
148
+ }
149
+ /** Result of `memory.find`. */
150
+ export interface MemoryFindResult {
151
+ /** Ranked matches. */
152
+ results: MemoryCompactHit[];
153
+ /** Total match count (may exceed `results.length` when limit applied). */
154
+ total: number;
155
+ /** Estimated token weight of the payload. */
156
+ tokensEstimated: number;
157
+ }
158
+ /** Parameters for `memory.timeline`. */
159
+ export interface MemoryTimelineParams {
160
+ /** Anchor entry id (required). */
161
+ anchor: string;
162
+ /** Number of entries to retrieve before the anchor. */
163
+ depthBefore?: number;
164
+ /** Number of entries to retrieve after the anchor. */
165
+ depthAfter?: number;
166
+ }
167
+ /** Result of `memory.timeline`. */
168
+ export interface MemoryTimelineResult {
169
+ /** The anchor entry (or null if not found). */
170
+ anchor: MemoryAnchor | null;
171
+ /** Entries preceding the anchor (chronological). */
172
+ before: MemoryTimelineNeighbor[];
173
+ /** Entries following the anchor (chronological). */
174
+ after: MemoryTimelineNeighbor[];
175
+ }
176
+ /** Parameters for `memory.fetch`. */
177
+ export interface MemoryFetchParams {
178
+ /** One or more memory entry IDs to retrieve. Must be non-empty. */
179
+ ids: string[];
180
+ }
181
+ /** Result of `memory.fetch`. */
182
+ export interface MemoryFetchResult {
183
+ /** Full entry bodies. */
184
+ results: MemoryFetchedEntry[];
185
+ /** IDs that could not be located. */
186
+ notFound: string[];
187
+ /** Estimated token weight of the payload. */
188
+ tokensEstimated: number;
189
+ }
190
+ /** Parameters for `memory.decision.find`. */
191
+ export interface MemoryDecisionFindParams {
192
+ /** Optional free-text filter. */
193
+ query?: string;
194
+ /** Filter decisions linked to a specific task. */
195
+ taskId?: string;
196
+ /** Max results. */
197
+ limit?: number;
198
+ }
199
+ /** A single decision entry returned by the API. */
200
+ export interface MemoryDecisionEntry {
201
+ /** Decision id (`D-...`). */
202
+ id: string;
203
+ /** Decision statement. */
204
+ decision: string;
205
+ /** Rationale body. */
206
+ rationale: string;
207
+ /** Alternatives considered at decision time. */
208
+ alternatives?: string[];
209
+ /** ISO 8601 creation timestamp. */
210
+ createdAt: string;
211
+ /** Epic context, if captured. */
212
+ contextEpicId?: string;
213
+ /** Task context, if captured. */
214
+ contextTaskId?: string;
215
+ /** Phase context, if captured. */
216
+ contextPhase?: string;
217
+ /** Source confidence (T549). */
218
+ sourceConfidence?: BrainSourceConfidence;
219
+ }
220
+ /** Result of `memory.decision.find`. */
221
+ export type MemoryDecisionFindResult = MemoryDecisionEntry[];
222
+ /** Parameters for `memory.pattern.find`. */
223
+ export interface MemoryPatternFindParams {
224
+ /** Filter by pattern type. */
225
+ type?: MemoryPatternType;
226
+ /** Filter by pattern impact. */
227
+ impact?: MemoryPatternImpact;
228
+ /** Optional free-text query. */
229
+ query?: string;
230
+ /** Minimum reinforcement frequency. */
231
+ minFrequency?: number;
232
+ /** Max results. */
233
+ limit?: number;
234
+ }
235
+ /** A single pattern entry returned by the API. */
236
+ export interface MemoryPatternEntry {
237
+ /** Pattern id (`P-...`). */
238
+ id: string;
239
+ /** Pattern classification. */
240
+ type: MemoryPatternType;
241
+ /** Pattern description. */
242
+ pattern: string;
243
+ /** Surrounding context. */
244
+ context: string;
245
+ /** Impact level. */
246
+ impact: MemoryPatternImpact;
247
+ /** Anti-pattern counter-example (if applicable). */
248
+ antiPattern?: string;
249
+ /** Mitigation guidance (if applicable). */
250
+ mitigation?: string;
251
+ /** Concrete examples. */
252
+ examples?: string[];
253
+ /** Empirical success rate [0..1]. */
254
+ successRate?: number;
255
+ /** How often this pattern has been observed. */
256
+ frequency: number;
257
+ /** ISO 8601 creation timestamp. */
258
+ createdAt: string;
259
+ }
260
+ /** Result of `memory.pattern.find`. */
261
+ export interface MemoryPatternFindResult {
262
+ /** Matching pattern entries. */
263
+ patterns: MemoryPatternEntry[];
264
+ /** Count of matches. */
265
+ total: number;
266
+ }
267
+ /** Parameters for `memory.learning.find`. */
268
+ export interface MemoryLearningFindParams {
269
+ /** Optional free-text query. */
270
+ query?: string;
271
+ /** Minimum confidence threshold [0..1]. */
272
+ minConfidence?: number;
273
+ /** Restrict to learnings marked actionable. */
274
+ actionableOnly?: boolean;
275
+ /** Filter by applicable task/entry type. */
276
+ applicableType?: string;
277
+ /** Max results. */
278
+ limit?: number;
279
+ }
280
+ /** A single learning entry returned by the API. */
281
+ export interface MemoryLearningEntry {
282
+ /** Learning id (`L-...`). */
283
+ id: string;
284
+ /** Insight statement. */
285
+ insight: string;
286
+ /** Source reference for the insight. */
287
+ source: string;
288
+ /** Confidence score [0..1]. */
289
+ confidence: number;
290
+ /** Whether the learning is actionable. */
291
+ actionable: boolean;
292
+ /** How to apply the insight. */
293
+ application?: string;
294
+ /** Types this insight applies to. */
295
+ applicableTypes?: string[];
296
+ /** ISO 8601 creation timestamp. */
297
+ createdAt: string;
298
+ }
299
+ /** Result of `memory.learning.find`. */
300
+ export type MemoryLearningFindResult = MemoryLearningEntry[];
301
+ /** Parameters for `memory.graph.show`. */
302
+ export interface MemoryGraphShowParams {
303
+ /** Node identifier. */
304
+ nodeId: string;
305
+ }
306
+ /** Result of `memory.graph.show`. */
307
+ export interface MemoryGraphShowResult {
308
+ /** The node, if found. */
309
+ node: MemoryGraphNode | null;
310
+ /** In-edges (node is target). */
311
+ inEdges: MemoryGraphEdge[];
312
+ /** Out-edges (node is source). */
313
+ outEdges: MemoryGraphEdge[];
314
+ }
315
+ /** Parameters for `memory.graph.neighbors`. */
316
+ export interface MemoryGraphNeighborsParams {
317
+ /** Node identifier. */
318
+ nodeId: string;
319
+ /** Optional filter to a single edge type. */
320
+ edgeType?: string;
321
+ }
322
+ /** Result of `memory.graph.neighbors`. */
323
+ export interface MemoryGraphNeighbor {
324
+ /** The neighbor node. */
325
+ node: MemoryGraphNode;
326
+ /** Edge type connecting the query node to this neighbor. */
327
+ edgeType: string;
328
+ /** Relative to the queried node: `out` = outbound, `in` = inbound. */
329
+ direction: 'out' | 'in';
330
+ /** Edge weight/confidence. */
331
+ weight: number;
332
+ }
333
+ /** Result payload for `memory.graph.neighbors`. */
334
+ export type MemoryGraphNeighborsResult = MemoryGraphNeighbor[];
335
+ /** Parameters for `memory.graph.trace` (BFS traversal). */
336
+ export interface MemoryGraphTraceParams {
337
+ /** Seed node identifier. */
338
+ nodeId: string;
339
+ /** Max traversal depth. */
340
+ maxDepth?: number;
341
+ }
342
+ /** A node visited during BFS traversal. */
343
+ export interface MemoryGraphTraceNode extends MemoryGraphNode {
344
+ /** Distance from the seed (0 = seed itself). */
345
+ depth: number;
346
+ }
347
+ /** Result of `memory.graph.trace`. */
348
+ export type MemoryGraphTraceResult = MemoryGraphTraceNode[];
349
+ /** Parameters for `memory.graph.related` (1-hop typed neighbors). */
350
+ export interface MemoryGraphRelatedParams {
351
+ /** Node identifier. */
352
+ nodeId: string;
353
+ /** Optional filter to a single edge type. */
354
+ edgeType?: string;
355
+ }
356
+ /** Result of `memory.graph.related`. */
357
+ export type MemoryGraphRelatedResult = MemoryGraphNeighbor[];
358
+ /** Parameters for `memory.graph.context` (360-degree view). */
359
+ export interface MemoryGraphContextParams {
360
+ /** Node identifier. */
361
+ nodeId: string;
362
+ }
363
+ /** Result of `memory.graph.context`. */
364
+ export interface MemoryGraphContextResult {
365
+ /** The node itself. */
366
+ node: MemoryGraphNode;
367
+ /** In-edges (this node is target). */
368
+ inEdges: MemoryGraphEdge[];
369
+ /** Out-edges (this node is source). */
370
+ outEdges: MemoryGraphEdge[];
371
+ /** Deduplicated neighbour list with direction + edge metadata. */
372
+ neighbors: MemoryGraphNeighbor[];
373
+ }
374
+ /** Parameters for `memory.graph.stats` — none. */
375
+ export type MemoryGraphStatsParams = Record<string, never>;
376
+ /** Result of `memory.graph.stats`. */
377
+ export interface MemoryGraphStatsResult {
378
+ /** Per-type node counts. */
379
+ nodesByType: Array<{
380
+ nodeType: string;
381
+ count: number;
382
+ }>;
383
+ /** Per-type edge counts. */
384
+ edgesByType: Array<{
385
+ edgeType: string;
386
+ count: number;
387
+ }>;
388
+ /** Total node count. */
389
+ totalNodes: number;
390
+ /** Total edge count. */
391
+ totalEdges: number;
392
+ }
393
+ /** Parameters for `memory.reason.why` (causal trace). */
394
+ export interface MemoryReasonWhyParams {
395
+ /** Task identifier whose blocker chain should be traced. */
396
+ taskId: string;
397
+ }
398
+ /** A single blocker in a causal trace. */
399
+ export interface MemoryBlockerNode {
400
+ /** Blocking task identifier. */
401
+ taskId: string;
402
+ /** Task status at time of trace. */
403
+ status: string;
404
+ /** Free-text reason (if captured). */
405
+ reason?: string;
406
+ /** Decisions linked to this blocker. */
407
+ decisions: MemoryDecisionNode[];
408
+ }
409
+ /** Result of `memory.reason.why`. */
410
+ export interface MemoryReasonWhyResult {
411
+ /** Root task ID that triggered the trace. */
412
+ taskId: string;
413
+ /** Walk of unresolved blockers (depth-ordered). */
414
+ blockers: MemoryBlockerNode[];
415
+ /** Leaf blocker IDs flagged as root causes. */
416
+ rootCauses: string[];
417
+ /** Maximum traversal depth reached. */
418
+ depth: number;
419
+ }
420
+ /** Parameters for `memory.reason.similar`. */
421
+ export interface MemoryReasonSimilarParams {
422
+ /** Source entry id to compare against. */
423
+ entryId: string;
424
+ /** Maximum results to return. */
425
+ limit?: number;
426
+ }
427
+ /** A similar entry with a distance score. */
428
+ export interface MemorySimilarEntry {
429
+ /** Matched entry id. */
430
+ id: string;
431
+ /** Cosine / vector distance (lower = more similar). */
432
+ distance: number;
433
+ /** Entry type/table. */
434
+ type: string;
435
+ /** Display title. */
436
+ title: string;
437
+ /** Truncated text preview. */
438
+ text: string;
439
+ }
440
+ /** Result of `memory.reason.similar`. */
441
+ export type MemoryReasonSimilarResult = MemorySimilarEntry[];
442
+ /** Parameters for `memory.search.hybrid`. */
443
+ export interface MemorySearchHybridParams {
444
+ /** Query string (required). */
445
+ query: string;
446
+ /** RRF weight for FTS results [0..1]. */
447
+ ftsWeight?: number;
448
+ /** RRF weight for vector results [0..1]. */
449
+ vecWeight?: number;
450
+ /** RRF weight for graph-expansion results [0..1]. */
451
+ graphWeight?: number;
452
+ /** Max results to return. */
453
+ limit?: number;
454
+ }
455
+ /** A fused result from hybrid search. */
456
+ export interface MemoryHybridHit {
457
+ /** Memory entry id. */
458
+ id: string;
459
+ /** Fused RRF score. */
460
+ score: number;
461
+ /** Entry type/table. */
462
+ type: string;
463
+ /** Display title. */
464
+ title: string;
465
+ /** Truncated text preview. */
466
+ text: string;
467
+ /** Retrieval sources that contributed. */
468
+ sources: Array<'fts' | 'vec' | 'graph'>;
469
+ /** Rank from FTS source (0-based; undefined if absent). */
470
+ ftsRank?: number;
471
+ /** Rank from vector source (0-based; undefined if absent). */
472
+ vecRank?: number;
473
+ }
474
+ /** Result of `memory.search.hybrid`. */
475
+ export type MemorySearchHybridResult = MemoryHybridHit[];
476
+ /** Parameters for `memory.quality` — none. */
477
+ export type MemoryQualityParams = Record<string, never>;
478
+ /** Result of `memory.quality`. */
479
+ export interface MemoryQualityResult {
480
+ /** Per-tier entry counts. */
481
+ tierDistribution: Record<BrainMemoryTier, number>;
482
+ /** Per-cognitive-type counts. */
483
+ cognitiveDistribution: Record<BrainCognitiveType, number>;
484
+ /** Fraction of entries classified as noise [0..1]. */
485
+ noiseRatio: number;
486
+ /** Retrieval hit-rate stats for the last sampling window. */
487
+ retrievalStats: {
488
+ /** Count of retrieval requests. */
489
+ totalQueries: number;
490
+ /** Fraction returning at least one hit [0..1]. */
491
+ hitRate: number;
492
+ };
493
+ /** ISO 8601 timestamp when the report was computed. */
494
+ generatedAt: string;
495
+ }
496
+ /** Parameters for `memory.code.links` — none. */
497
+ export type MemoryCodeLinksParams = Record<string, never>;
498
+ /** A single code_reference edge. */
499
+ export interface MemoryCodeLink {
500
+ /** Memory entry id. */
501
+ memoryId: string;
502
+ /** Nexus code symbol identifier. */
503
+ codeSymbol: string;
504
+ /** ISO 8601 creation timestamp. */
505
+ createdAt: string;
506
+ }
507
+ /** Result of `memory.code.links`. */
508
+ export type MemoryCodeLinksResult = MemoryCodeLink[];
509
+ /** Parameters for `memory.code.memories-for-code`. */
510
+ export interface MemoryCodeMemoriesForCodeParams {
511
+ /** Code symbol identifier. */
512
+ symbol: string;
513
+ }
514
+ /** Result of `memory.code.memories-for-code`. */
515
+ export interface MemoryCodeMemoriesForCodeResult {
516
+ /** Code symbol that was queried. */
517
+ symbol: string;
518
+ /** Memory entries referencing this symbol. */
519
+ memories: Array<{
520
+ id: string;
521
+ type: string;
522
+ title: string;
523
+ }>;
524
+ }
525
+ /** Parameters for `memory.code.for-memory`. */
526
+ export interface MemoryCodeForMemoryParams {
527
+ /** Memory entry id. */
528
+ memoryId: string;
529
+ }
530
+ /** Result of `memory.code.for-memory`. */
531
+ export interface MemoryCodeForMemoryResult {
532
+ /** Memory entry id that was queried. */
533
+ memoryId: string;
534
+ /** Code symbols referenced by this memory. */
535
+ codeSymbols: string[];
536
+ }
537
+ /** Parameters for `memory.llm-status` — none. */
538
+ export type MemoryLlmStatusParams = Record<string, never>;
539
+ /** Result of `memory.llm-status`. */
540
+ export interface MemoryLlmStatusResult {
541
+ /** Where the Anthropic API key was resolved from (env, config, keychain, etc.). */
542
+ resolvedSource: string;
543
+ /** True when LLM-assisted extraction is wired and key is present. */
544
+ extractionEnabled: boolean;
545
+ /** ISO 8601 timestamp of the most recent extraction run; null if none. */
546
+ lastExtractionRun: string | null;
547
+ /** Suggested CLI command to trigger a test extraction. */
548
+ testCommand: string;
549
+ }
550
+ /** Parameters for `memory.pending-verify`. */
551
+ export interface MemoryPendingVerifyParams {
552
+ /** Minimum citation count to surface an entry (default 5). */
553
+ minCitations?: number;
554
+ /** Max entries to return (default 50). */
555
+ limit?: number;
556
+ }
557
+ /** A single pending-verify row. */
558
+ export interface MemoryPendingEntry {
559
+ /** Entry id (prefix varies by table). */
560
+ id: string;
561
+ /** Normalized display title. */
562
+ title: string | null;
563
+ /** Source confidence (nullable when never scored). */
564
+ sourceConfidence: string | null;
565
+ /** Times this entry has been cited by retrieval/reasoning. */
566
+ citationCount: number;
567
+ /** Memory tier (nullable when never assigned). */
568
+ memoryTier: string | null;
569
+ /** ISO 8601 creation timestamp. */
570
+ createdAt: string;
571
+ /** Source table name (e.g. `observations`, `decisions`). */
572
+ table: string;
573
+ }
574
+ /** Result of `memory.pending-verify`. */
575
+ export interface MemoryPendingVerifyResult {
576
+ /** Count of entries returned. */
577
+ count: number;
578
+ /** Minimum citation threshold applied. */
579
+ minCitations: number;
580
+ /** Pending entries ordered by citation count desc. */
581
+ items: MemoryPendingEntry[];
582
+ /** Human-readable next-step hint. */
583
+ hint: string;
584
+ }
585
+ /** Parameters for `memory.observe`. */
586
+ export interface MemoryObserveParams {
587
+ /** Observation text body (required). */
588
+ text: string;
589
+ /** Short display title. */
590
+ title?: string;
591
+ /** Observation kind (default inferred from content). */
592
+ type?: MemoryObservationKind;
593
+ /** Project context override. */
594
+ project?: string;
595
+ /** Originating session id. */
596
+ sourceSessionId?: string;
597
+ /** Observation source classification. */
598
+ sourceType?: MemoryObservationSourceType;
599
+ /** Agent that captured this observation (T417 mental models). */
600
+ agent?: string;
601
+ /** Source confidence override (T549). */
602
+ sourceConfidence?: BrainSourceConfidence;
603
+ /** Attachment SHA-256 refs to link to this observation (T799). */
604
+ attachmentRefs?: string[];
605
+ /** Cross-reference to other memory or external IDs (T794). */
606
+ crossRef?: string[];
607
+ }
608
+ /** Result of `memory.observe`. */
609
+ export interface MemoryObserveResult {
610
+ /** Newly-created observation id (`O-...`). */
611
+ id: string;
612
+ /** Entry table this was written to. */
613
+ type: string;
614
+ /** ISO 8601 creation timestamp. */
615
+ createdAt: string;
616
+ }
617
+ /** Parameters for `memory.decision.store`. */
618
+ export interface MemoryDecisionStoreParams {
619
+ /** Decision statement (required). */
620
+ decision: string;
621
+ /** Rationale for the decision (required). */
622
+ rationale: string;
623
+ /** Alternatives considered at decision time. */
624
+ alternatives?: string[];
625
+ /** Task ID providing decision context. */
626
+ taskId?: string;
627
+ /** Session ID providing decision context. */
628
+ sessionId?: string;
629
+ /** Epic context. */
630
+ contextEpicId?: string;
631
+ /** Phase context. */
632
+ contextPhase?: string;
633
+ }
634
+ /** Result of `memory.decision.store`. */
635
+ export interface MemoryDecisionStoreResult {
636
+ /** New decision id (`D-...` or sequential `D001`). */
637
+ id: string;
638
+ /** ISO 8601 creation timestamp. */
639
+ createdAt: string;
640
+ }
641
+ /** Parameters for `memory.pattern.store`. */
642
+ export interface MemoryPatternStoreParams {
643
+ /** Pattern description (required). */
644
+ pattern: string;
645
+ /** Surrounding context (required). */
646
+ context: string;
647
+ /** Pattern classification (default `workflow`). */
648
+ type?: MemoryPatternType;
649
+ /** Pattern impact level. */
650
+ impact?: MemoryPatternImpact;
651
+ /** Counter-example anti-pattern. */
652
+ antiPattern?: string;
653
+ /** Mitigation guidance. */
654
+ mitigation?: string;
655
+ /** Concrete examples. */
656
+ examples?: string[];
657
+ /** Empirical success rate [0..1]. */
658
+ successRate?: number;
659
+ /** Origin tag (e.g. `auto`, `agent`). Routes source confidence. */
660
+ source?: string;
661
+ }
662
+ /** Result of `memory.pattern.store`. */
663
+ export interface MemoryPatternStoreResult {
664
+ /** New pattern id (`P-...`). */
665
+ id: string;
666
+ /** True when this store call incremented frequency on a duplicate match. */
667
+ deduplicated: boolean;
668
+ /** ISO 8601 creation timestamp. */
669
+ createdAt: string;
670
+ }
671
+ /** Parameters for `memory.learning.store`. */
672
+ export interface MemoryLearningStoreParams {
673
+ /** Insight statement (required). */
674
+ insight: string;
675
+ /** Source reference for the insight (required). */
676
+ source: string;
677
+ /** Confidence [0..1] (default 0.5). */
678
+ confidence?: number;
679
+ /** Marks the learning as actionable. */
680
+ actionable?: boolean;
681
+ /** How to apply the insight. */
682
+ application?: string;
683
+ /** Types/domains this learning applies to. */
684
+ applicableTypes?: string[];
685
+ }
686
+ /** Result of `memory.learning.store`. */
687
+ export interface MemoryLearningStoreResult {
688
+ /** New learning id (`L-...`). */
689
+ id: string;
690
+ /** True when this store call updated an existing duplicate. */
691
+ deduplicated: boolean;
692
+ /** ISO 8601 creation timestamp. */
693
+ createdAt: string;
694
+ }
695
+ /** Parameters for `memory.link`. */
696
+ export interface MemoryLinkParams {
697
+ /** Task id to link. */
698
+ taskId: string;
699
+ /** Memory entry id to link. */
700
+ entryId: string;
701
+ }
702
+ /** Result of `memory.link`. */
703
+ export interface MemoryLinkResult {
704
+ /** Task id that was linked. */
705
+ taskId: string;
706
+ /** Entry id that was linked. */
707
+ entryId: string;
708
+ /** True when the edge was newly created (false if already present). */
709
+ linked: boolean;
710
+ }
711
+ /**
712
+ * Parameters for `memory.graph.add`.
713
+ *
714
+ * @remarks
715
+ * Either a node-insert shape (`nodeId` + `nodeType` + `label`) or an
716
+ * edge-insert shape (`fromId` + `toId` + `edgeType`). Caller MUST supply
717
+ * exactly one of those two variants.
718
+ */
719
+ export interface MemoryGraphAddParams {
720
+ /** Node id (node-insert mode). */
721
+ nodeId?: string;
722
+ /** Node type classification (node-insert mode). */
723
+ nodeType?: string;
724
+ /** Display label (node-insert mode). */
725
+ label?: string;
726
+ /** JSON-encoded metadata string. */
727
+ metadataJson?: string;
728
+ /** Source node id (edge-insert mode). */
729
+ fromId?: string;
730
+ /** Target node id (edge-insert mode). */
731
+ toId?: string;
732
+ /** Edge type (edge-insert mode). */
733
+ edgeType?: string;
734
+ /** Edge weight [0..1] (edge-insert mode). */
735
+ weight?: number;
736
+ }
737
+ /** Result of `memory.graph.add`. */
738
+ export interface MemoryGraphAddResult {
739
+ /** Variant applied. */
740
+ mode: 'node' | 'edge';
741
+ /** Id of the node or `fromId:toId:edgeType` edge key. */
742
+ id: string;
743
+ /** ISO 8601 creation timestamp. */
744
+ createdAt: string;
745
+ }
746
+ /** Parameters for `memory.graph.remove`. */
747
+ export interface MemoryGraphRemoveParams {
748
+ /** Node id (node-remove mode). */
749
+ nodeId?: string;
750
+ /** Source node id (edge-remove mode). */
751
+ fromId?: string;
752
+ /** Target node id (edge-remove mode). */
753
+ toId?: string;
754
+ /** Edge type (edge-remove mode). */
755
+ edgeType?: string;
756
+ }
757
+ /** Result of `memory.graph.remove`. */
758
+ export interface MemoryGraphRemoveResult {
759
+ /** Variant applied. */
760
+ mode: 'node' | 'edge';
761
+ /** Number of rows deleted. */
762
+ removed: number;
763
+ }
764
+ /** Parameters for `memory.code.link`. */
765
+ export interface MemoryCodeLinkParams {
766
+ /** Memory entry id. */
767
+ memoryId: string;
768
+ /** Nexus code symbol identifier. */
769
+ codeSymbol: string;
770
+ }
771
+ /** Result of `memory.code.link`. */
772
+ export interface MemoryCodeLinkResult {
773
+ /** True when the edge was newly created (false when it already existed). */
774
+ linked: boolean;
775
+ }
776
+ /** Parameters for `memory.code.auto-link` — none. */
777
+ export type MemoryCodeAutoLinkParams = Record<string, never>;
778
+ /** Result of `memory.code.auto-link`. */
779
+ export interface MemoryCodeAutoLinkResult {
780
+ /** Count of memory entries scanned. */
781
+ scanned: number;
782
+ /** Count of new edges created by the scan. */
783
+ linked: number;
784
+ /** Count of edges skipped because they already existed. */
785
+ skipped: number;
786
+ }
787
+ /** Parameters for `memory.verify`. */
788
+ export interface MemoryVerifyParams {
789
+ /** Memory entry id to promote to verified=1. */
790
+ id: string;
791
+ /** Caller identity (`cleo-prime` or `owner`). Omit for terminal invocation. */
792
+ agent?: string;
793
+ }
794
+ /** Result of `memory.verify`. */
795
+ export interface MemoryVerifyResult {
796
+ /** Entry id that was verified. */
797
+ id: string;
798
+ /** Table the entry lives in. */
799
+ table: string;
800
+ /** True when verified=0 → 1 transition occurred. False when already verified. */
801
+ promoted: boolean;
802
+ /** ISO 8601 timestamp of the verify attempt. */
803
+ verifiedAt: string;
804
+ }
805
+ /** Generic paginated envelope reused by future list variants. */
806
+ export interface MemoryPagedResult<T> {
807
+ /** Items for this page. */
808
+ items: T[];
809
+ /** Total count across all pages. */
810
+ total: number;
811
+ /** Pagination descriptor. */
812
+ page: LAFSPage;
813
+ }
814
+ //# sourceMappingURL=memory.d.ts.map