memorix 1.0.7 → 1.0.9

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.
@@ -0,0 +1,687 @@
1
+ # Memorix API Reference
2
+
3
+ This document covers the main Memorix MCP tools and the most important behavior to know when integrating from an IDE or agent.
4
+
5
+ Memorix exposes:
6
+
7
+ - core memory tools
8
+ - reasoning and session tools
9
+ - maintenance and retention tools
10
+ - workspace and rules sync tools
11
+ - autonomous Agent Team tools
12
+ - dashboard and optional graph compatibility tools
13
+
14
+ It also exposes a **human/operator CLI surface** for terminal workflows. The CLI is not a raw mirror of MCP tool names; it is the primary product surface for human operators, while MCP remains the integration protocol for IDEs and agents.
15
+
16
+ ---
17
+
18
+ ## 1. CLI vs MCP
19
+
20
+ Use **MCP** when:
21
+
22
+ - an IDE or agent needs tool calls
23
+ - you want the full fine-grained API surface
24
+ - you are integrating Memorix into an MCP-capable client
25
+
26
+ Use the **CLI** when:
27
+
28
+ - a human operator wants to inspect or change project state from a terminal
29
+ - you are on SSH / Docker / CI / NAS and want direct commands
30
+ - you want readable, namespaced actions instead of raw MCP tool payloads
31
+ - you want full access to Memorix-native capabilities without depending on an MCP host
32
+
33
+ The current operator CLI namespaces are:
34
+
35
+ - `memorix session`
36
+ - `memorix memory`
37
+ - `memorix reasoning`
38
+ - `memorix retention`
39
+ - `memorix formation`
40
+ - `memorix audit`
41
+ - `memorix transfer`
42
+ - `memorix skills`
43
+ - `memorix team`
44
+ - `memorix task`
45
+ - `memorix message`
46
+ - `memorix lock`
47
+ - `memorix handoff`
48
+ - `memorix poll`
49
+ - `memorix sync`
50
+ - `memorix ingest`
51
+
52
+ Typical examples:
53
+
54
+ ```bash
55
+ memorix session start --agent codex-main --agentType codex
56
+ memorix memory search --query "release blocker"
57
+ memorix reasoning search --query "why sqlite"
58
+ memorix retention status
59
+ memorix task list
60
+ memorix task claim --taskId <id> --agentId <agent-id>
61
+ memorix message inbox --agentId <agent-id>
62
+ memorix lock status --file src/cli/index.ts
63
+ memorix audit project
64
+ memorix transfer export --format markdown
65
+ memorix skills show --name auth-pattern
66
+ memorix sync workspace --action scan
67
+ memorix ingest image --path ./diagram.png
68
+ memorix poll --agentId <agent-id>
69
+ ```
70
+
71
+ The CLI is designed as an **operator control surface**, not as a 1:1 rename of MCP tools. All Memorix-native operator capabilities have a CLI path in 1.0.8. The only intentional MCP-only area is the optional graph-compatibility surface (`create_entities`, `read_graph`, and related tools) for workflows that expect the official memory-server style graph API.
72
+
73
+ ---
74
+
75
+ ## 2. Retrieval Model Basics
76
+
77
+ Before looking at individual tools, there are three important defaults:
78
+
79
+ ### Project scope comes first
80
+
81
+ - `memorix_search` defaults to the current project
82
+ - use `scope="global"` when you intentionally want cross-project recall
83
+
84
+ ### Global hits can be opened explicitly
85
+
86
+ If you search globally, open results with project-aware refs:
87
+
88
+ ```json
89
+ {
90
+ "refs": [
91
+ { "id": 84, "projectId": "AVIDS2/test-memorix-demo" }
92
+ ]
93
+ }
94
+ ```
95
+
96
+ This is supported by `memorix_detail`.
97
+
98
+ ### Retrieval is source-aware
99
+
100
+ Memorix ranks memory differently depending on intent:
101
+
102
+ - "what changed" style queries tend to favor Git Memory
103
+ - "why" style queries tend to favor reasoning and decision memory
104
+ - "problem" style queries can favor both fixes and Git Memory
105
+
106
+ ---
107
+
108
+ ## 3. Core Memory Tools
109
+
110
+ ### `memorix_store`
111
+
112
+ Store a new observation.
113
+
114
+ Typical uses:
115
+
116
+ - store a decision
117
+ - store a gotcha
118
+ - store a problem-solution note
119
+ - record a milestone or a shipped change
120
+
121
+ Important inputs:
122
+
123
+ - `entityName`
124
+ - `type`
125
+ - `title`
126
+ - `narrative`
127
+ - optional `facts`
128
+ - optional `filesModified`
129
+ - optional `concepts`
130
+ - optional `topicKey`
131
+ - optional `progress`
132
+ - optional `source`
133
+ - optional `relatedCommits`
134
+ - optional `relatedEntities`
135
+
136
+ Example:
137
+
138
+ ```json
139
+ {
140
+ "entityName": "auth-module",
141
+ "type": "decision",
142
+ "title": "JWT over cookie sessions",
143
+ "narrative": "Chose JWT because multiple agents and tools need stateless auth.",
144
+ "facts": [
145
+ "Goal: support cross-agent local integrations",
146
+ "Constraint: avoid server-side session state"
147
+ ],
148
+ "filesModified": ["src/auth/index.ts"],
149
+ "concepts": ["jwt", "auth", "stateless"]
150
+ }
151
+ ```
152
+
153
+ ### `memorix_search`
154
+
155
+ Search project memory or global memory.
156
+
157
+ Important inputs:
158
+
159
+ - `query`
160
+ - `limit`
161
+ - `scope`
162
+ - `status`
163
+ - `type`
164
+ - `source`
165
+ - `since`
166
+ - `until`
167
+ - `maxTokens`
168
+
169
+ Typical uses:
170
+
171
+ - search the current project
172
+ - search only Git memories with `source="git"`
173
+ - search resolved or archived memories with `status="all"`
174
+
175
+ Example:
176
+
177
+ ```json
178
+ {
179
+ "query": "why did we switch to HTTP transport",
180
+ "limit": 10
181
+ }
182
+ ```
183
+
184
+ Global example:
185
+
186
+ ```json
187
+ {
188
+ "query": "release status",
189
+ "scope": "global"
190
+ }
191
+ ```
192
+
193
+ ### `memorix_detail`
194
+
195
+ Fetch full observation detail.
196
+
197
+ Supports two modes:
198
+
199
+ - `ids` for current-project observations
200
+ - `refs` for project-aware cross-project lookup
201
+
202
+ Examples:
203
+
204
+ ```json
205
+ {
206
+ "ids": [42, 43]
207
+ }
208
+ ```
209
+
210
+ ```json
211
+ {
212
+ "refs": [
213
+ { "id": 84, "projectId": "AVIDS2/test-memorix-demo" }
214
+ ]
215
+ }
216
+ ```
217
+
218
+ ### `memorix_timeline`
219
+
220
+ Get the chronological context around one observation.
221
+
222
+ Important inputs:
223
+
224
+ - `anchorId`
225
+ - `depthBefore`
226
+ - `depthAfter`
227
+
228
+ Use it when you want:
229
+
230
+ - what happened before this memory
231
+ - what happened after this memory
232
+
233
+ ### `memorix_resolve`
234
+
235
+ Mark observations as resolved or archived.
236
+
237
+ Important inputs:
238
+
239
+ - `ids`
240
+ - optional `status`
241
+
242
+ Typical use:
243
+
244
+ - hide completed or outdated memories from default search without deleting them
245
+
246
+ ---
247
+
248
+ ## 4. Reasoning Tools
249
+
250
+ ### `memorix_store_reasoning`
251
+
252
+ Store a reasoning trace for a non-trivial decision.
253
+
254
+ Important inputs:
255
+
256
+ - `entityName`
257
+ - `decision`
258
+ - `rationale`
259
+ - optional `alternatives`
260
+ - optional `constraints`
261
+ - optional `expectedOutcome`
262
+ - optional `risks`
263
+ - optional `concepts`
264
+ - optional `filesModified`
265
+ - optional `relatedCommits`
266
+ - optional `relatedEntities`
267
+
268
+ Use it when the key value is:
269
+
270
+ - why a choice was made
271
+ - what alternatives were rejected
272
+ - what risks are accepted
273
+
274
+ ### `memorix_search_reasoning`
275
+
276
+ Search only reasoning traces.
277
+
278
+ Important inputs:
279
+
280
+ - `query`
281
+ - `limit`
282
+ - `scope`
283
+
284
+ Use it when you want:
285
+
286
+ - decision rationale
287
+ - design trade-offs
288
+ - previous thinking on a similar problem
289
+
290
+ ---
291
+
292
+ ## 5. Session Tools
293
+
294
+ ### `memorix_session_start`
295
+
296
+ Start a new coding session and load recent context.
297
+
298
+ Important inputs:
299
+
300
+ - optional `agent` — display name (e.g. `"cursor-frontend"`)
301
+ - optional `agentType` — agent type for optional Agent Team identity mapping (e.g. `"windsurf"`, `"cursor"`, `"claude-code"`, `"codex"`, `"gemini-cli"`)
302
+ - optional `projectRoot`
303
+ - optional `sessionId`
304
+ - optional `instanceId`
305
+ - optional `joinTeam`
306
+ - optional `role`
307
+
308
+ Behavior:
309
+
310
+ - opens a session for the current project
311
+ - can auto-close any previous active session for that project
312
+ - returns recent session context and project binding state
313
+ - **does not join the team by default**
314
+ - if you only need memory/search/reasoning/session recovery, stop here; no team identity is required
315
+ - when `joinTeam=true`, it also registers an Agent Team identity using the default role derived from `agentType` via `AGENT_TYPE_ROLE_MAP`
316
+ - `team_manage(join)` remains the formal explicit join entrypoint if you want to separate session start from Agent Team identity
317
+ - team-specific outputs such as agent ID, watermark, and available tasks appear only when the session explicitly joins the Agent Team
318
+
319
+ In HTTP control-plane mode, pass `projectRoot` as the absolute workspace or repo root whenever the client knows it. `projectRoot` is the detection anchor; Git remains the source of truth for the final project identity.
320
+
321
+ ### `memorix_session_end`
322
+
323
+ End the active session with a summary.
324
+
325
+ Important inputs:
326
+
327
+ - `sessionId`
328
+ - optional `summary`
329
+
330
+ Use it to write a handoff note for the next session or next agent.
331
+
332
+ ### `memorix_session_context`
333
+
334
+ Fetch recent session summaries and context.
335
+
336
+ Important inputs:
337
+
338
+ - optional `limit`
339
+
340
+ ---
341
+
342
+ ## 6. Quality and Maintenance Tools
343
+
344
+ ### `memorix_retention`
345
+
346
+ Inspect retention state or archive expired memories.
347
+
348
+ Important inputs:
349
+
350
+ - `action`
351
+
352
+ Typical actions:
353
+
354
+ - `report`
355
+ - `archive`
356
+
357
+ ### `memorix_consolidate`
358
+
359
+ Merge similar memories to reduce noise.
360
+
361
+ Important inputs:
362
+
363
+ - `action`
364
+ - optional `threshold`
365
+
366
+ Typical actions:
367
+
368
+ - `preview`
369
+ - `execute`
370
+
371
+ ### `memorix_deduplicate`
372
+
373
+ Scan for duplicates and contradictions.
374
+
375
+ Important inputs:
376
+
377
+ - optional `dryRun`
378
+ - optional `query`
379
+
380
+ ### `memorix_transfer`
381
+
382
+ Export or import project memory.
383
+
384
+ Important inputs:
385
+
386
+ - `action`
387
+ - optional `format`
388
+ - optional `data`
389
+
390
+ Typical actions:
391
+
392
+ - `export`
393
+ - `import`
394
+
395
+ ### `memorix_suggest_topic_key`
396
+
397
+ Generate a stable `topicKey` for upsert-style memory writes.
398
+
399
+ Important inputs:
400
+
401
+ - `title`
402
+ - `type`
403
+
404
+ ### `memorix_formation_metrics`
405
+
406
+ Show aggregated metrics for the formation pipeline.
407
+
408
+ Use it to inspect:
409
+
410
+ - processed observation counts
411
+ - value score averages
412
+ - stage timing
413
+ - recent pipeline behavior
414
+
415
+ ---
416
+
417
+ ## 7. Skills and Promotion Tools
418
+
419
+ ### `memorix_skills`
420
+
421
+ Work with memory-driven project skills.
422
+
423
+ Important inputs:
424
+
425
+ - `action`
426
+ - optional `name`
427
+ - optional `target`
428
+ - optional `write`
429
+
430
+ Typical actions:
431
+
432
+ - `list`
433
+ - `generate`
434
+ - `inject`
435
+
436
+ ### `memorix_promote`
437
+
438
+ Promote observations into durable mini-skills.
439
+
440
+ Important inputs:
441
+
442
+ - `action`
443
+ - optional `observationIds`
444
+ - optional `skillId`
445
+ - optional `instruction`
446
+ - optional `trigger`
447
+ - optional `tags`
448
+
449
+ Typical actions:
450
+
451
+ - `list`
452
+ - `promote`
453
+ - `delete`
454
+
455
+ ---
456
+
457
+ ## 8. Workspace and Rules Tools
458
+
459
+ ### `memorix_workspace_sync`
460
+
461
+ Scan, preview, or apply cross-agent workspace migration.
462
+
463
+ Important inputs:
464
+
465
+ - `action`
466
+ - optional `target`
467
+ - optional `items`
468
+
469
+ Typical actions:
470
+
471
+ - `scan`
472
+ - `migrate`
473
+ - `apply`
474
+
475
+ ### `memorix_rules_sync`
476
+
477
+ Scan or generate cross-agent rule files.
478
+
479
+ Important inputs:
480
+
481
+ - `action`
482
+ - optional `target`
483
+
484
+ Typical actions:
485
+
486
+ - `status`
487
+ - `generate`
488
+
489
+ ---
490
+
491
+ ## 9. Agent Team Tools
492
+
493
+ These tools are the explicit autonomous-agent coordination surface. They are available through MCP profiles that expose team tools and through the CLI operator surface. HTTP is optional: use it when you want a shared MCP control plane or live dashboard endpoint, not because Agent Team state requires HTTP.
494
+
495
+ ```bash
496
+ memorix team status
497
+ memorix orchestrate --goal "..."
498
+ ```
499
+
500
+ Use `memorix background start` or `memorix serve-http --port 3211` only when you want the HTTP control plane in the background or foreground.
501
+
502
+ Agent Team is opt-in project coordination for tasks, messages, locks, and autonomous agent workflows. It is not required for normal memory use, and it should not be treated as an automatic chat room between separate IDE conversations. For production multi-agent execution, use `memorix orchestrate`; the team tools provide the coordination substrate.
503
+
504
+ Runtime environment:
505
+
506
+ - `MEMORIX_SESSION_TIMEOUT_MS` — HTTP MCP session idle timeout in milliseconds. Default: `1800000` (30 minutes). Increase this for clients that do not transparently reinitialize after stale HTTP session IDs, for example `86400000` for 24 hours.
507
+
508
+ ### `team_manage`
509
+
510
+ Register, unregister, or inspect agents.
511
+
512
+ Important inputs:
513
+
514
+ - `action`
515
+ - optional `name`
516
+ - optional `role`
517
+ - optional `capabilities`
518
+ - optional `agentId`
519
+
520
+ ### `team_message`
521
+
522
+ Send, broadcast, or read messages between agents.
523
+
524
+ Important inputs:
525
+
526
+ - `action`
527
+ - optional `agentId`
528
+ - optional `from`
529
+ - optional `to`
530
+ - optional `content`
531
+ - optional `type`
532
+ - optional `markRead`
533
+
534
+ ### `team_task`
535
+
536
+ Create, claim, complete, or list tasks.
537
+
538
+ Important inputs:
539
+
540
+ - `action`
541
+ - optional `taskId`
542
+ - optional `agentId`
543
+ - optional `description`
544
+ - optional `deps`
545
+ - optional `status`
546
+ - optional `available`
547
+
548
+ ### `team_file_lock`
549
+
550
+ Acquire, release, or inspect advisory file locks.
551
+
552
+ Important inputs:
553
+
554
+ - `action`
555
+ - optional `agentId`
556
+ - optional `file`
557
+
558
+ ### `memorix_poll`
559
+
560
+ Return a compact situational-awareness snapshot for an explicitly joined autonomous agent.
561
+
562
+ Important inputs:
563
+
564
+ - optional `agentId`
565
+
566
+ Use it for:
567
+
568
+ - active autonomous agent overview
569
+ - available tasks
570
+ - unread messages
571
+ - active file locks
572
+ - project-level team activity
573
+
574
+ If `agentId` is omitted, it returns a project-level overview only.
575
+
576
+ ### `memorix_handoff`
577
+
578
+ Create, claim, complete, or inspect handoff artifacts between autonomous agents.
579
+
580
+ Important inputs:
581
+
582
+ - `action`
583
+ - optional `handoffId`
584
+ - optional `fromAgentId`
585
+ - optional `toAgentId`
586
+ - optional `summary`
587
+ - optional `context`
588
+
589
+ Use it when work should survive agent/session boundaries without relying on an IDE chat window staying alive.
590
+
591
+ ---
592
+
593
+ ## 10. Ingestion Tools
594
+
595
+ ### `memorix_ingest_image`
596
+
597
+ Ingest an image as memory context when visual artifacts are relevant to the project.
598
+
599
+ Important inputs:
600
+
601
+ - `path`
602
+ - optional `title`
603
+ - optional `entityName`
604
+ - optional `type`
605
+
606
+ CLI equivalent:
607
+
608
+ ```bash
609
+ memorix ingest image --path ./diagram.png
610
+ ```
611
+
612
+ ---
613
+
614
+ ## 11. Dashboard Tool
615
+
616
+ ### `memorix_dashboard`
617
+
618
+ Launch the local dashboard in the browser.
619
+
620
+ Important inputs:
621
+
622
+ - optional `port`
623
+
624
+ When using HTTP mode, the main dashboard is usually served from the same port as `serve-http`.
625
+
626
+ ---
627
+
628
+ ## 12. Optional Graph Compatibility Tools
629
+
630
+ Memorix can expose MCP-compatible graph tools for workflows that expect the official memory-server style graph API.
631
+
632
+ Typical graph tool families include:
633
+
634
+ - create entities
635
+ - create relations
636
+ - add observations
637
+ - delete entities
638
+ - delete observations
639
+ - delete relations
640
+ - search nodes
641
+ - open nodes
642
+ - read graph
643
+
644
+ These are optional compatibility tools rather than the main recommended Memorix workflow.
645
+
646
+ ---
647
+
648
+ ## 13. Observation Types
649
+
650
+ Common observation types include:
651
+
652
+ - `session-request`
653
+ - `gotcha`
654
+ - `problem-solution`
655
+ - `how-it-works`
656
+ - `what-changed`
657
+ - `discovery`
658
+ - `why-it-exists`
659
+ - `decision`
660
+ - `trade-off`
661
+ - `reasoning`
662
+
663
+ Each type helps retrieval and formatting behave differently, especially when combined with source-aware ranking.
664
+
665
+ ---
666
+
667
+ ## 14. Recommended Usage Pattern
668
+
669
+ For most agents, the best working pattern is:
670
+
671
+ 1. `memorix_search` to find relevant memories
672
+ 2. `memorix_detail` for full records
673
+ 3. `memorix_timeline` for chronological context
674
+ 4. `memorix_store` or `memorix_store_reasoning` to write back important new context
675
+
676
+ Git Memory, retention, skills, and team tools sit on top of that core loop.
677
+
678
+ ---
679
+
680
+ ## 15. Related Docs
681
+
682
+ - [Setup Guide](SETUP.md)
683
+ - [Configuration Guide](CONFIGURATION.md)
684
+ - [Performance and Resource Notes](PERFORMANCE.md)
685
+ - [Git Memory Guide](GIT_MEMORY.md)
686
+ - [Architecture](ARCHITECTURE.md)
687
+ - [Development Guide](DEVELOPMENT.md)