memorix 1.2.10 → 1.3.0

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 (63) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +28 -2
  3. package/README.zh-CN.md +28 -2
  4. package/assets/star-history-dark.svg +30 -0
  5. package/assets/star-history-light.svg +30 -0
  6. package/assets/star-history.json +599 -0
  7. package/dist/cli/index.js +1783 -557
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/index.js +1292 -267
  10. package/dist/index.js.map +1 -1
  11. package/dist/maintenance-runner.js +97 -21
  12. package/dist/maintenance-runner.js.map +1 -1
  13. package/dist/memcode-runtime/CHANGELOG.md +15 -0
  14. package/dist/sdk.d.ts +1 -1
  15. package/dist/sdk.js +1294 -269
  16. package/dist/sdk.js.map +1 -1
  17. package/dist/types.d.ts +99 -1
  18. package/dist/types.js.map +1 -1
  19. package/dist/vector-backfill-runner.js +97 -21
  20. package/dist/vector-backfill-runner.js.map +1 -1
  21. package/docs/1.3-MEMORY-ARCHITECTURE.md +236 -0
  22. package/docs/AGENT_OPERATOR_PLAYBOOK.md +3 -1
  23. package/docs/API_REFERENCE.md +20 -1
  24. package/docs/ARCHITECTURE.md +34 -1
  25. package/docs/DEVELOPMENT.md +3 -2
  26. package/docs/MODULES.md +27 -1
  27. package/docs/README.md +3 -3
  28. package/docs/dev-log/progress.txt +22 -0
  29. package/llms-full.txt +5 -1
  30. package/llms.txt +2 -0
  31. package/package.json +2 -1
  32. package/plugins/antigravity/memorix/rules/memorix.md +2 -0
  33. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  34. package/plugins/claude/memorix/skills/memorix-memory/SKILL.md +3 -0
  35. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  36. package/plugins/codex/memorix/skills/memorix-memory/SKILL.md +3 -0
  37. package/plugins/copilot/memorix/plugin.json +1 -1
  38. package/plugins/copilot/memorix/skills/memorix-memory/SKILL.md +3 -0
  39. package/plugins/cursor/memorix/skills/memorix-memory/SKILL.md +3 -0
  40. package/plugins/gemini/memorix/GEMINI.md +2 -0
  41. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  42. package/plugins/omp/memorix/package.json +1 -1
  43. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  44. package/plugins/pi/memorix/package.json +1 -1
  45. package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +3 -0
  46. package/server.json +2 -2
  47. package/src/cli/command-guide.ts +9 -1
  48. package/src/cli/commands/codegraph.ts +1 -0
  49. package/src/cli/commands/memory.ts +217 -1
  50. package/src/codegraph/auto-context.ts +11 -0
  51. package/src/codegraph/context-pack.ts +3 -0
  52. package/src/embedding/api-provider.ts +23 -9
  53. package/src/embedding/provider.ts +21 -10
  54. package/src/hooks/installers/index.ts +2 -0
  55. package/src/knowledge/context-assembly.ts +2 -1
  56. package/src/knowledge/workset.ts +77 -4
  57. package/src/memory/long-term-store.ts +242 -0
  58. package/src/memory/long-term-types.ts +136 -0
  59. package/src/memory/long-term.ts +626 -0
  60. package/src/memory/owner.ts +75 -0
  61. package/src/server.ts +112 -30
  62. package/src/store/sqlite-db.ts +74 -0
  63. package/src/types.ts +20 -0
@@ -0,0 +1,236 @@
1
+ # Memorix 1.3: Memory Architecture 2.0
2
+
3
+ ## Problem
4
+
5
+ Memorix already captures useful project observations, code-state evidence,
6
+ knowledge claims, wiki pages, workflows, sessions, and compaction checkpoints.
7
+ Those records have different sources and lifecycles, but they are not yet
8
+ expressed as one cognitive memory architecture. In particular, a `personal`
9
+ observation still lives under one project and cannot safely become durable
10
+ cross-project knowledge for the local user.
11
+
12
+ Version 1.3 makes Memorix a local-first persistent memory system for coding
13
+ agents. It does not replace the agent's context window or turn every note into
14
+ a global profile. It supplies small, current, source-aware working context and
15
+ keeps durable knowledge under explicit lifecycle control.
16
+
17
+ ## Goals
18
+
19
+ 1. Model durable memory with independent **kind**, **scope**, **state**, and
20
+ **evidence** dimensions.
21
+ 2. Add local-user durable memories that can be reused across projects without
22
+ silently exposing project facts to unrelated projects.
23
+ 3. Treat the existing Task Workset as derived working memory, not another
24
+ database or a transcript dump.
25
+ 4. Allow agents to capture a candidate through their normal memory write path,
26
+ while keeping qualification and approval explicit and inspectable through
27
+ the CLI.
28
+ 5. Include only bounded, task-relevant qualified or approved durable memory in
29
+ project context. A candidate, stale record, or unrelated user preference is
30
+ never injected merely because it exists.
31
+ 6. Preserve all existing Observation, Claim, Wiki, Workflow, Session, and
32
+ Code Memory behavior. The migration is additive and idempotent.
33
+
34
+ ## Non-goals
35
+
36
+ - No cloud account, remote synchronization, organization directory, or
37
+ cross-machine identity system in 1.3.
38
+ - No automatic export of source code, paths, Git facts, or project observations
39
+ into a user-global memory.
40
+ - No claim that a graph alone makes information true. Graph links remain
41
+ navigational provenance, and source evidence remains authoritative.
42
+ - No automatic execution of a stored procedure. Procedures advise a Workset;
43
+ existing workflow gates still control execution and verification.
44
+ - No automated psychological profile or covert user tracking.
45
+
46
+ ## Mental Model
47
+
48
+ The following axes are deliberately independent.
49
+
50
+ | Axis | Values | Meaning |
51
+ | --- | --- | --- |
52
+ | Cognitive kind | `episodic`, `semantic`, `procedural` | What the durable item represents. |
53
+ | Scope | `project`, `user`, `team` | Who may retrieve it and where it may travel. |
54
+ | State | `candidate`, `qualified`, `approved`, `archived`, `superseded` | Whether it can be delivered and how much trust it carries. |
55
+ | Source | `manual`, `agent`, `hook`, `git`, `test`, `code-state`, `workflow` | Where the supporting evidence came from. |
56
+ | Portability | `project-bound`, `portable` | Whether a user item may be considered outside its origin project. |
57
+
58
+ Working memory is not a fourth persisted record class. It is the temporary
59
+ Task Workset assembled for one task from current code facts, continuation
60
+ evidence, source-qualified knowledge, and relevant durable memories under a
61
+ strict token budget.
62
+
63
+ ### Kinds
64
+
65
+ - **Episodic**: a bounded event or handoff, such as a completed debugging
66
+ session and its verified result. Existing Sessions and compaction checkpoints
67
+ remain the canonical event sources.
68
+ - **Semantic**: a source-backed fact, preference, or stable convention. Existing
69
+ Claims and reviewed Wiki pages remain project semantic truth; new long-term
70
+ memories cover deliberate user-scoped facts and portable conventions.
71
+ - **Procedural**: a reusable way of working with applicability and verification
72
+ evidence. Existing canonical Workflows and Mini-Skills remain the project
73
+ procedure sources; the long-term layer can hold deliberately promoted user
74
+ procedures.
75
+
76
+ ## Canonical Storage
77
+
78
+ 1. `observations` remains the raw evidence ledger and legacy-compatible agent
79
+ write surface.
80
+ 2. `knowledge_claims`, Markdown Wiki pages, Workflows, Sessions, Code Graph
81
+ snapshots, and checkpoints remain their existing specialized stores.
82
+ 3. A new SQLite `long_term_memories` table stores curated cross-source memory
83
+ artifacts. Each item records its origin project, owner, scope, cognitive
84
+ kind, lifecycle state, evidence references, tags, and portability.
85
+ 4. A local installation identity is stored only on the local machine. It is a
86
+ random stable identifier unless `MEMORIX_USER_ID` is explicitly supplied.
87
+ It is never derived from a model prompt and is never transmitted by
88
+ Memorix.
89
+
90
+ The new table does not copy all legacy observations on upgrade. Existing
91
+ records keep their current behavior. Promotion creates a new artifact with
92
+ references to its evidence, so no provenance is lost and no historical record
93
+ becomes global by accident.
94
+
95
+ ## Lifecycle and Promotion
96
+
97
+ ```text
98
+ raw observation / session / claim / workflow result
99
+ |
100
+ v
101
+ long-term candidate
102
+ |
103
+ explicit qualify
104
+ v
105
+ qualified durable memory
106
+ |
107
+ explicit approval or review
108
+ v
109
+ approved durable memory
110
+ |
111
+ archive / supersede
112
+ ```
113
+
114
+ - Agent-facing `memorix_store` may create an **additional candidate** when a
115
+ caller explicitly requests long-term capture. It always writes normal source
116
+ evidence first.
117
+ - Candidate artifacts are visible to management commands but are excluded from
118
+ automatic task context.
119
+ - Qualification requires at least one evidence reference. A semantic or
120
+ procedural item never becomes an unsupported text summary.
121
+ - Approval is a separate deliberate operation. The CLI records the transition
122
+ and reason in the artifact audit trail.
123
+ - Project code, Git, observation, test, and workflow evidence may support a
124
+ project-bound item. A portable user item rejects project-bound source kinds;
125
+ the operator must create it from user/manual evidence instead.
126
+
127
+ ## Scope and Privacy Rules
128
+
129
+ | Scope | Default retrieval | Cross-project behavior |
130
+ | --- | --- | --- |
131
+ | `project` | Current project only | Never crosses automatically. |
132
+ | `user` + `project-bound` | Origin project for the same local user | Does not cross. |
133
+ | `user` + `portable` | Same local user, task-relevant only | May cross projects after explicit portable promotion. |
134
+ | `team` | Explicit active project team only | Not cross-project in 1.3. |
135
+
136
+ `personal` Observation visibility remains a project-local private sharing rule
137
+ for backward compatibility. It is not renamed to `user`: a project-private
138
+ observation and a user-level portable durable memory are intentionally
139
+ different things.
140
+
141
+ ## Retrieval and Delivery
142
+
143
+ Task Workset assembly combines existing project facts with a new long-term
144
+ selection stage:
145
+
146
+ 1. Filter by owner, scope, project, portability, lifecycle state, and reader
147
+ capability before ranking.
148
+ 2. Rank only approved or qualified artifacts by task term overlap, kind fit,
149
+ validation recency, and explicit tag matches. If that produces no result
150
+ and the user has configured an embedding provider, one bounded semantic
151
+ fallback may compare the task with already-visible durable records. A slow,
152
+ unavailable, or disabled provider falls back to keyword-only retrieval.
153
+ 3. Include at most three short entries under a fixed sub-budget. Include title,
154
+ kind, scope, applicability, and a `durable:<id>` provenance reference, not
155
+ a long historical narrative. An agent can open that reference through the
156
+ existing `memorix_detail` route when it needs the full evidence-backed
157
+ record.
158
+ 4. Keep current code, dirty-worktree cautions, source-backed claims, and
159
+ verification evidence ahead of optional durable enrichment.
160
+ 5. Record selected and omitted durable memory in the delivery receipt without
161
+ exposing private content in diagnostics.
162
+
163
+ The result is a useful memory directory for an agent, not an automatic history
164
+ dump. An agent can request detail through the CLI when it needs more.
165
+
166
+ ### Semantic fallback budget
167
+
168
+ Keyword matching is the deterministic first route. Only when no eligible long-term
169
+ record matches may Memorix use the configured embedding provider for a small,
170
+ scope-filtered semantic fallback. It has a strict 1.8-second request budget and
171
+ no retry. Provider startup probing receives the same budget. Failure is silent
172
+ from the agent's point of view: the normal lexical Workset is still delivered.
173
+ This keeps semantic recall additive rather than making a remote API a dependency
174
+ of task continuation.
175
+
176
+ ## Operator Surface
177
+
178
+ The CLI is the complete management surface:
179
+
180
+ ```text
181
+ memorix memory long-term list
182
+ memorix memory long-term show --id <id>
183
+ memorix memory long-term add --kind procedural --scope user --portability portable --title "Release verification preference" --text "Run focused tests and a packed-package smoke before publishing." --tags "release,verification" --applicability "When publishing an npm package."
184
+ memorix memory long-term promote --from-observation <id> --kind semantic --scope project
185
+ memorix memory long-term qualify --id <id> --reason "verified against focused test"
186
+ memorix memory long-term approve --id <id> --reason "reviewed by operator"
187
+ memorix memory long-term archive --id <id> --reason "no longer current"
188
+ memorix memory long-term supersede --id <old-id> --superseded-by <qualified-id> --reason "replaced by the current procedure"
189
+ ```
190
+
191
+ `memorix_store` gains optional long-term capture metadata for agents. This
192
+ keeps the default MCP micro profile small: no additional MCP tool is necessary
193
+ to capture a candidate or receive relevant working context. The CLI remains the
194
+ inspection, promotion, and audit route.
195
+
196
+ ## Compatibility and Migration
197
+
198
+ - SQLite creates the new table and indexes through an idempotent named schema
199
+ migration.
200
+ - Existing records receive no data rewrite and remain project-visible under
201
+ their current legacy rules.
202
+ - Missing local user identity means no user-memory retrieval; a write creates
203
+ the local identity lazily.
204
+ - The new APIs fail closed for unavailable owner/team context. They never
205
+ broaden project visibility to compensate for missing identity.
206
+
207
+ ## Acceptance Criteria
208
+
209
+ 1. A normal Observation remains readable after the migration with unchanged
210
+ visibility and project behavior.
211
+ 2. A promoted project semantic memory appears in a task Workset only after
212
+ qualification.
213
+ 3. A portable user semantic memory created under one project can be selected in
214
+ another local project for the same owner, while a project-bound user memory
215
+ cannot.
216
+ 4. A portable promotion with code, Git, observation, test, or workflow source
217
+ evidence is rejected.
218
+ 5. Team memories are absent without explicit active team membership.
219
+ 6. Candidate, archived, superseded, and unrelated durable memories do not
220
+ appear in the agent-facing prompt.
221
+ 7. The Workset stays within its configured token budget and its receipt records
222
+ durable memory selection or omission.
223
+ 8. CLI JSON flows cover create, list, promote, qualify, approve, archive, and
224
+ cross-project retrieval.
225
+ 9. Type checking, focused tests, full test suite, package build, and an
226
+ installed-package CLI smoke all pass before publishing 1.3.0.
227
+
228
+ ## Research Basis
229
+
230
+ This design uses the memory taxonomy and evidence discipline in
231
+ `AI-Agents-in-Depth` (working / episodic / semantic / procedural memory), while
232
+ keeping Memorix's current-source-first code-memory and proposal-first Knowledge
233
+ Workspace principles. It takes AgentMemory's capture/consolidate/forget and
234
+ token-budget lessons as inspiration, but does not adopt generic time-decay or
235
+ automatic global slots for code facts. Source-qualified promotion and explicit
236
+ portable scope are the safety boundary for a coding-agent memory system.
@@ -50,12 +50,14 @@ For the 1.2 release line, the visible product shape is:
50
50
 
51
51
  ### CLI is the direct command surface; MCP is the integration layer
52
52
 
53
- For direct use, prefer `memorix ...` commands first. In the 1.2 line, the CLI covers session, memory, Code State, knowledge workspaces, reasoning, retention, formation, audit, transfer, skills, orchestration coordination, sync, ingest workflows, and the bundled terminal agent.
53
+ For direct use, prefer `memorix ...` commands first. In the 1.3 line, the CLI covers session, memory, reviewed long-term memory, Code State, knowledge workspaces, reasoning, retention, formation, audit, transfer, skills, orchestration coordination, sync, ingest workflows, and the bundled terminal agent.
54
54
 
55
55
  Do not ask memory-only users to join coordination state. A lightweight session is enough for memory, retrieval, reasoning, and continuation. Use `joinTeam` / `team_manage(join)` only for explicit task/message/lock coordination or for CLI-agent work managed by `memorix orchestrate`.
56
56
 
57
57
  An unbound terminal is intentionally project-scoped: it reads and writes project-visible memory only. Use `memorix identity join --agent-type <agent>` or `memorix identity use --agent-id <id>` only when an operator explicitly needs personal/team memory or coordinated task actions. `memorix identity clear` removes that local selection; `--as <agent-id>` is the one-command script form and still requires an active member of the current project.
58
58
 
59
+ Long-term memory is a reviewed layer, not a generic global note store. `memorix memory long-term add` creates a candidate; `qualify` and `approve` are explicit audit transitions before it can appear in a bounded task Workset. A project-derived observation, code fact, Git fact, test, session, Claim, or workflow stays project-bound. Only manual or user-confirmed `user + portable` records can cross local projects for the same local installation identity. When one is task-matched in a Workset, it is intentionally usable background even if its origin differs; use its `durable:<id>` reference with `memorix_detail` only when the full record is needed. Use `archive` or `supersede` when a durable item is no longer current.
60
+
59
61
  `--cwd <git-project>` is the canonical way to run direct CLI work from outside a repository. It changes the command's project anchor only; Git remains the source of truth for final project identity.
60
62
 
61
63
  Use MCP when:
@@ -219,6 +219,7 @@ Important inputs:
219
219
  - optional `relatedCommits`
220
220
  - optional `relatedEntities`
221
221
  - optional `visibility`: `project` (default), `personal`, or `team`
222
+ - optional `longTerm`: an explicit source-backed long-term candidate with `kind` (`episodic`, `semantic`, or `procedural`), an optional `scope` (`project`, `user`, or `team`), tags, and applicability
222
223
 
223
224
  Visibility controls who can retrieve a record through agent-facing memory
224
225
  tools. Normal memories default to `project`. `personal` and `team` writes
@@ -230,6 +231,13 @@ When the current Autopilot task is read-only or explicitly says not to modify
230
231
  files, `memorix_store` returns without writing. Use `overrideReadOnly: true`
231
232
  only when the user explicitly asks to preserve a record during that task.
232
233
 
234
+ `longTerm` is deliberately opt-in. It stores the normal Observation first, then
235
+ creates a separate candidate with an evidence reference. Candidates are not
236
+ inserted into a Task Workset. Review them with `memorix memory long-term
237
+ list|show|qualify|approve|archive|supersede`. Source-derived entries remain
238
+ project-bound; only a manual or user-confirmed `user + portable` record created
239
+ through the CLI may cross local projects for the same local installation.
240
+
233
241
  Example:
234
242
 
235
243
  ```json
@@ -291,7 +299,7 @@ Global example:
291
299
 
292
300
  ### `memorix_detail`
293
301
 
294
- Fetch full observation detail.
302
+ Fetch full observation, mini-skill, or curated long-term memory detail.
295
303
 
296
304
  After `memorix_project_context`, use `purpose` only for a named missing fact. Set `force: true` only when the user explicitly asks for the full underlying record already represented in the brief.
297
305
 
@@ -299,6 +307,10 @@ Supports two modes:
299
307
 
300
308
  - `ids` for current-project observations
301
309
  - `refs` for project-aware cross-project lookup
310
+ - `typedRefs` for typed observation/skill refs and a `durable:<uuid>` reference
311
+ emitted by a Task Workset. A matching `user + portable` durable item is
312
+ intentionally reusable across local projects, but remains background guidance
313
+ rather than a current-project fact.
302
314
 
303
315
  Examples:
304
316
 
@@ -316,6 +328,13 @@ Examples:
316
328
  }
317
329
  ```
318
330
 
331
+ ```json
332
+ {
333
+ "typedRefs": ["durable:9f3d9a6d-1111-4222-8333-abcdefabcdef"],
334
+ "purpose": "Need the full verified release procedure before publishing."
335
+ }
336
+ ```
337
+
319
338
  ### `memorix_timeline`
320
339
 
321
340
  Get the chronological context around one observation.
@@ -2,11 +2,16 @@
2
2
 
3
3
  Memorix is an open-source cross-agent memory layer for coding agents via MCP.
4
4
 
5
- It combines three core memory layers:
5
+ It combines three source-of-truth memory layers and a curated long-term memory layer:
6
6
 
7
7
  - **Observation Memory** for what changed and how things work
8
8
  - **Reasoning Memory** for why choices were made
9
9
  - **Git Memory** for engineering truth derived from commits
10
+ - **Long-term Memory** for explicitly curated episodic, semantic, and procedural knowledge that should outlive a single project session
11
+
12
+ Observation, reasoning, and Git records remain the canonical evidence. Long-term
13
+ memory references that evidence and has its own lifecycle; it is not a second
14
+ copy of every conversation or a global dump shared between unrelated projects.
10
15
 
11
16
  These layers are exposed through MCP tools, CLI workflows, and an HTTP service.
12
17
 
@@ -36,6 +41,7 @@ flowchart LR
36
41
  C2["Reasoning store"]
37
42
  C3["Git memory store"]
38
43
  C4["Session / team registry"]
44
+ C5["Curated long-term memory"]
39
45
  end
40
46
 
41
47
  subgraph Intelligence["Intelligence and Quality"]
@@ -65,6 +71,7 @@ flowchart LR
65
71
  B3 --> C2
66
72
  B3 --> C3
67
73
  B3 --> C4
74
+ B3 --> C5
68
75
 
69
76
  C1 --> D1
70
77
  C1 --> D2
@@ -74,6 +81,8 @@ flowchart LR
74
81
  C2 --> D3
75
82
  C3 --> D2
76
83
  C4 --> D3
84
+ C5 --> D4
85
+ C5 --> E1
77
86
 
78
87
  D1 --> E1
79
88
  D2 --> E1
@@ -114,6 +123,8 @@ Main pieces:
114
123
  - `src/memory/retention.ts`
115
124
  - `src/memory/graph.ts`
116
125
  - `src/memory/consolidation.ts`
126
+ - `src/memory/long-term.ts`
127
+ - `src/memory/long-term-store.ts`
117
128
 
118
129
  Responsibilities:
119
130
 
@@ -123,6 +134,8 @@ Responsibilities:
123
134
  - manage session state
124
135
  - retention, archive, and deduplication
125
136
  - knowledge graph entities and relations
137
+ - curate long-lived episodes, facts, and procedures with source evidence,
138
+ qualification, approval, archival, and supersession
126
139
 
127
140
  ### Intelligence and Quality Layer
128
141
 
@@ -212,6 +225,26 @@ Git Memory turns commits into structured memory with source provenance:
212
225
 
213
226
  This creates an engineering truth layer that complements human- or agent-authored observations.
214
227
 
228
+ ### Curated Long-term Memory
229
+
230
+ Long-term memory holds a deliberately small set of records that remain useful
231
+ after a project session ends:
232
+
233
+ - **episodic**: a completed, reusable episode
234
+ - **semantic**: a stable fact or principle
235
+ - **procedural**: a repeatable workflow
236
+
237
+ It is separate from ordinary observations so the two jobs do not get confused:
238
+
239
+ - an observation records what happened in context;
240
+ - a long-term record says that the fact or procedure has earned durable reuse.
241
+
242
+ Each record is source-bound, auditable, and moves through
243
+ `candidate -> qualified -> approved -> archived/superseded`. Candidates are
244
+ never injected into an agent context. A record can be portable only when it is
245
+ user-owned and based on explicit manual or user evidence; project, team, Git,
246
+ session, code, and claim evidence never crosses that boundary.
247
+
215
248
  ---
216
249
 
217
250
  ## 3. Main Data Flows
@@ -13,9 +13,9 @@ Memorix is a TypeScript project built around:
13
13
 
14
14
  ## Current Development Baseline
15
15
 
16
- The current release work targets the **1.1 line** while package metadata may still show the last published patch version until the release commit is cut.
16
+ The current release work targets the **1.3 line** while package metadata may still show the last published version until the release commit is cut.
17
17
 
18
- Contributors should assume the following areas are part of the 1.1 release line:
18
+ Contributors should assume the following areas are part of the 1.3 release line:
19
19
 
20
20
  - shared memory across MCP clients, CLI, SDK, dashboard, hooks, and memcode
21
21
  - memcode uses Memorix project memory, hooks, `/memory` commands, resumable sessions, and model switching as the bundled terminal agent
@@ -26,6 +26,7 @@ Contributors should assume the following areas are part of the 1.1 release line:
26
26
  - notify-only auto-update by default with explicit install opt-in
27
27
  - dashboard config loading aligned with CLI/TUI status surfaces
28
28
  - the existing layered retrieval, retention, attribution, and compact output model
29
+ - source-backed long-term memory with candidate, qualification, approval, archival, supersession, and explicit portable user scope
29
30
 
30
31
  ---
31
32
 
package/docs/MODULES.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Memorix 模块详解
2
2
 
3
- > 最后更新: 2026-03-09 (v1.0.0)
3
+ > 最后更新: 2026-07-30 (v1.3.0)
4
4
  > 本文档详细记录每个模块的实现细节、关键算法和注意事项
5
5
 
6
+ > 本文档中的早期 JSON/Orama 章节保留为历史模块说明。当前运行时的
7
+ > SQLite 数据层和长期记忆生命周期以 `docs/ARCHITECTURE.md`、
8
+ > `docs/1.3-MEMORY-ARCHITECTURE.md` 及对应源码为准。
9
+
6
10
  ---
7
11
 
8
12
  ## 1. Orama 搜索引擎 (`store/orama-store.ts`)
@@ -148,6 +152,28 @@ Archive-candidate: age > 100% retention & !immune
148
152
 
149
153
  ---
150
154
 
155
+ ## 5. 长期记忆 (`memory/long-term.ts`, `memory/long-term-store.ts`)
156
+
157
+ 长期记忆不是把所有 observation 再复制一遍。它是由已有证据支撑、经过
158
+ 明确管理的少量长期知识,面向跨会话持续使用。
159
+
160
+ | 维度 | 取值 | 含义 |
161
+ |---|---|---|
162
+ | 认知类型 | `episodic` / `semantic` / `procedural` | 完成经历、稳定事实、可复用流程 |
163
+ | 范围 | `project` / `user` / `team` | 项目、同一安装的用户、显式团队 |
164
+ | 生命周期 | `candidate` -> `qualified` -> `approved` -> `archived` / `superseded` | 候选不会自动注入;只有合格或已批准的记录才会进入受限 Workset |
165
+
166
+ ### 核心边界
167
+
168
+ - 每条记录保存来源 observation 和生命周期事件,便于审计和追溯。
169
+ - `portable` 只允许用户范围、并且来源是显式手工或用户输入的记录。
170
+ - Git、代码、会话、项目、团队和模型生成的证据不能因为标记为长期记忆就跨项目共享。
171
+ - 用户通过 `memorix memory long-term` 管理记录;MCP 的 `memorix_store`
172
+ 只能创建候选,不会偷偷把日常对话升级成长期知识。
173
+ - 检索遵守任务相关性和 token 预算,最多放入少量合格/批准记录,不回填完整历史。
174
+
175
+ ---
176
+
151
177
  ## 5. 实体抽取器 (`memory/entity-extractor.ts`)
152
178
 
153
179
  ### 正则模式
package/docs/README.md CHANGED
@@ -32,6 +32,7 @@ The public docs are organized by user intent:
32
32
  | --- | --- |
33
33
  | CLI commands and MCP tools | [API_REFERENCE.md](API_REFERENCE.md) |
34
34
  | Memory Autopilot, Code State, and context packs | [API_REFERENCE.md § Memory Autopilot, Code State, and Context Packs](API_REFERENCE.md#memory-autopilot-code-state-and-context-packs), [1.2 Code State](1.2.0-CODE-STATE.md), and [1.2 Workset Retrieval](1.2.0-WORKSET-RETRIEVAL.md) |
35
+ | Reviewed episodic, semantic, and procedural long-term memory | [1.3 Memory Architecture](1.3-MEMORY-ARCHITECTURE.md) |
35
36
  | Reviewable knowledge pages and workflow inheritance | [API_REFERENCE.md § Knowledge Workspace and Workflows](API_REFERENCE.md#knowledge-workspace-and-workflows), [1.2 Knowledge Workspace](1.2.0-KNOWLEDGE-WORKSPACE.md), and [1.2 Workflow Inheritance](1.2.0-WORKFLOW-INHERITANCE.md) |
36
37
  | Git-derived engineering memory | [GIT_MEMORY.md](GIT_MEMORY.md) |
37
38
  | Memory formation and quality pipeline | [MEMORY_FORMATION_PIPELINE.md](MEMORY_FORMATION_PIPELINE.md) |
@@ -87,6 +88,7 @@ The public docs are organized by user intent:
87
88
  | 1.2 task-shaped evidence selection | [1.2 Workset Retrieval](1.2.0-WORKSET-RETRIEVAL.md) |
88
89
  | 1.2 non-blocking refresh and maintenance contract | [1.2 Dynamic Lifecycle](1.2.0-DYNAMIC-LIFECYCLE.md) |
89
90
  | 1.2 honest Lite and optional semantic CodeGraph provider contract | [1.2 Provider Quality](1.2.0-PROVIDER-QUALITY.md) |
91
+ | 1.3 long-term memory model, source boundary, and lifecycle | [1.3 Memory Architecture](1.3-MEMORY-ARCHITECTURE.md) |
90
92
  | Active context-control work | [1.2.2 Memory Control Plane](1.2.2-MEMORY-CONTROL-PLANE.md) |
91
93
  | Historical cloud sync and multi-agent research | [CLOUD_SYNC_AND_MULTI_AGENT_RESEARCH.md](CLOUD_SYNC_AND_MULTI_AGENT_RESEARCH.md) |
92
94
  | Known issues and old roadmap notes | [KNOWN_ISSUES_AND_ROADMAP.md](KNOWN_ISSUES_AND_ROADMAP.md) |
@@ -115,9 +117,7 @@ Historical/deep-reference documents may describe older designs. If they conflict
115
117
 
116
118
  ## Current Product Line
117
119
 
118
- The released product is on the **1.1 line**. Active 1.2 design work is tracked
119
- in the [1.2 Development Charter](1.2.0-DEVELOPMENT-CHARTER.md). The current
120
- released baseline has:
120
+ The released product is on the **1.3 line**. The current baseline has:
121
121
 
122
122
  - `memorix setup --agent <agent> --global` is the default agent integration command
123
123
  - `memorix serve` is the manual stdio MCP server for external agents
@@ -364,3 +364,25 @@
364
364
  CLI `context --json` path returned a structured Workset. `npm pack --dry-run`
365
365
  and `npm publish --dry-run --ignore-scripts` both accepted the final tarball
366
366
  without manifest normalization warnings.
367
+
368
+ ## 1.3 Curated Long-Term Memory
369
+ - Added an additive SQLite long-term-memory layer with explicit episodic,
370
+ semantic, and procedural kinds; independent scope and portability; source
371
+ evidence; and an auditable `candidate -> qualified -> approved ->
372
+ archived/superseded` lifecycle. Existing Observation, Claim, Wiki, Workflow,
373
+ Session, and Code State stores remain their own canonical sources.
374
+ - Added the complete CLI lifecycle surface and extended the existing MCP store/
375
+ detail routes without increasing the default seven-tool micro profile. Task
376
+ Worksets expose at most three relevant approved or qualified records as short
377
+ `durable:<id>` references for progressive expansion.
378
+ - Explicit `user + portable` manual/user-confirmed records can be reused across
379
+ local projects for the same owner. Code, Git, tests, sessions, workflows,
380
+ observations, claims, and team/project evidence remain project-bound.
381
+ - Semantic durable retrieval is an optional cross-language/paraphrase fallback
382
+ after lexical selection. Provider initialization and the one batch request use
383
+ a 1.8-second no-retry budget; API request cancellation is propagated to the
384
+ remote fetch so an unavailable embedding service cannot retain a CLI process.
385
+ - Verification in progress: focused lifecycle/CLI/MCP/embedding tests, a real
386
+ packed-package cross-project Chinese-to-English retrieval smoke, and an
387
+ isolated Claude Code plugin user test that returned the reviewed release
388
+ procedure without inspecting project files.
package/llms-full.txt CHANGED
@@ -6,7 +6,7 @@ Memorix is a TypeScript/Node.js project that gives AI coding agents persistent,
6
6
 
7
7
  If you are an AI coding agent helping a user install, operate, or troubleshoot Memorix, read `docs/AGENT_OPERATOR_PLAYBOOK.md` before taking action. It is the main reference for install, runtime selection, Git/project binding, MCP integration, hooks, and troubleshooting.
8
8
 
9
- ## 1.2 Multi-Dimensional Memory Model
9
+ ## 1.3 Multi-Dimensional Memory Model
10
10
 
11
11
  Memorix is not a transcript dump. The normal agent path is `memorix_project_context` or `memorix context --task "..."`, which assembles a bounded task Workset: current Git/package facts, selected observations and reasoning, Code State freshness, source-backed claims, matching knowledge/workflow starts, cautions, and verification hints.
12
12
 
@@ -15,6 +15,7 @@ Memorix is not a transcript dump. The normal agent path is `memorix_project_cont
15
15
  - **Claim Ledger** keeps provenance, confidence, conflicts, and lifecycle state separate from prose.
16
16
  - **Knowledge Workspace** compiles claims into reviewable Markdown proposals; it does not silently overwrite manually edited pages.
17
17
  - **Canonical Workflows** represent project process once and render conservative agent-specific adapters only on explicit request.
18
+ - **Curated Long-Term Memory** keeps source-bound episodic, semantic, and procedural records separate from ordinary observations. A record is a candidate first, then can be explicitly qualified or approved; candidates, archived records, and superseded records never enter a Workset. A portable record is allowed only for explicit local `user + portable` knowledge with manual/user evidence. Project, team, Git, code, session, workflow, test, and observation evidence always remains project-bound. Keyword retrieval is primary; an optional semantic fallback is scope-filtered, limited to 1.8 seconds with no retry, and never blocks a lexical Workset when an embedding provider is slow or unavailable.
18
19
  - **Lifecycle maintenance** uses durable, resumable jobs so indexing, claim requalification, knowledge compile/lint, retention, and consolidation do not turn an interactive MCP request into a corpus-sized foreground job.
19
20
 
20
21
  The built-in CodeGraph Lite provider is a structural local fallback, not a complete semantic graph. If a project already has a healthy local CodeGraph index, `[codegraph].external_context = "auto"` can add a small validated semantic outline. Memorix never runs `codegraph init`, `index`, or `sync`, does not transmit the repository, and does not persist raw external code output.
@@ -111,6 +112,9 @@ Typical commands:
111
112
  ```bash
112
113
  memorix memory search --query "release blocker"
113
114
  memorix memory store --text "Auth tokens expire after 24h" --title "Auth token TTL" --entity auth --type decision
115
+ memorix memory long-term add --kind procedural --scope user --portability portable --text "Always run focused tests before a patch release"
116
+ memorix memory long-term qualify --id <memory-id> --reason "Verified in the release workflow"
117
+ memorix memory long-term approve --id <memory-id> --reason "Approved for local reuse"
114
118
  memorix reasoning search --query "why sqlite"
115
119
  memorix session start --agent codex-main --agentType codex
116
120
  memorix receipt --json
package/llms.txt CHANGED
@@ -25,6 +25,7 @@ Memorix combines durable memory with a bounded task Workset:
25
25
  - **Code State**: versioned local file/symbol/import facts and freshness links that keep memory tied to the current checkout
26
26
  - **Claim Ledger and Knowledge Workspace**: source-backed claims compiled into reviewable Markdown proposals, never silent overwrites
27
27
  - **Canonical Workflows**: project workflows with safe per-agent adapters and recorded verification outcomes
28
+ - **Curated Long-Term Memory**: source-bound episodic, semantic, and procedural records that stay candidates until explicitly qualified or approved; only deliberately created `user + portable` records can be reused across projects on the same local installation. Keyword retrieval stays primary; optional cross-language/paraphrase fallback is bounded to 1.8 seconds and never blocks lexical delivery.
28
29
 
29
30
  For non-trivial coding work, agents normally call `memorix_project_context` (or `memorix context --task "...")`. It selects a small task Workset with current facts, relevant evidence, start files, cautions, and verification hints instead of dumping all old text memory. Search is project-scoped by default. Use global scope only when cross-project recall is intentional.
30
31
 
@@ -109,4 +110,5 @@ Endpoint: `http://localhost:3211/mcp`.
109
110
  - Git Memory: https://github.com/AVIDS2/memorix/blob/main/docs/GIT_MEMORY.md
110
111
  - memcode: https://github.com/AVIDS2/memorix/blob/main/docs/MEMCODE.md
111
112
  - Agent Playbook: https://github.com/AVIDS2/memorix/blob/main/docs/AGENT_OPERATOR_PLAYBOOK.md
113
+ - Long-Term Memory Architecture: https://github.com/AVIDS2/memorix/blob/main/docs/1.3-MEMORY-ARCHITECTURE.md
112
114
  - Full AI context: https://github.com/AVIDS2/memorix/blob/main/llms-full.txt
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "memorix",
3
3
  "mcpName": "io.github.AVIDS2/memorix",
4
- "version": "1.2.10",
4
+ "version": "1.3.0",
5
5
  "description": "Local-first shared memory layer for AI coding agents across MCP clients, Git history, reasoning context, and project sessions.",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -65,6 +65,7 @@
65
65
  "test:e2e": "vitest run tests/e2e/",
66
66
  "benchmark:codegraph": "node scripts/benchmark-codegraph-provider.cjs",
67
67
  "benchmark:retrieval": "npm run build && node scripts/benchmark-retrieval.mjs",
68
+ "generate:star-history": "node scripts/generate-star-history.mjs",
68
69
  "sync:mcp-registry": "node scripts/sync-mcp-registry-manifest.mjs",
69
70
  "check:mcp-registry": "node scripts/check-mcp-registry-manifest.mjs",
70
71
  "audit:pi-upstream": "node scripts/pi-upstream-audit.mjs",
@@ -9,6 +9,8 @@ Use Memorix when prior workspace context, decisions, fixes, or handoff state wou
9
9
  - Use `memorix_search` for focused lookup.
10
10
  - Use `memorix_detail` before relying on a specific memory.
11
11
  - Use `memorix_store` for durable workspace knowledge.
12
+ - Use `longTerm` on `memorix_store` only for a stable fact, reusable procedure, or completed episode that merits explicit review. It creates a candidate, not live context; keep the default project scope and do not use it for routine updates.
13
+ - A `user` + `portable` durable memory in a task brief is intentionally reusable across projects. When it matches the task, use it as background even if it originated elsewhere; it is not a current-project fact. Expand it only when needed with `memorix_detail` and `typedRefs: ["durable:<id>"]`, stating the missing fact as `purpose`.
12
14
  - Use `memorix_store_reasoning` for the reason behind a technical decision.
13
15
  - Use `memorix_resolve` when completed or outdated memories should stop surfacing.
14
16
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "memorix",
4
- "version": "1.2.10",
4
+ "version": "1.3.0",
5
5
  "description": "Shared workspace memory for Claude Code and other AI coding agents.",
6
6
  "author": {
7
7
  "name": "AVIDS2",
@@ -17,6 +17,7 @@ Use Memorix as the shared memory layer for the active workspace when Memorix too
17
17
  | Need the full source for a search hit | `memorix_detail` | `memorix memory detail --id <id>` |
18
18
  | Need the sequence around one memory | `memorix_timeline` | `memorix memory timeline --id <id>` |
19
19
  | Learned reusable project knowledge | `memorix_store` | `memorix memory store --type <type> --entity <name> --title "<title>" "<text>"` |
20
+ | Stable source-backed fact or procedure needing long-term review | `memorix_store` with `longTerm` | `memorix memory long-term qualify|approve --id <id> --reason "..."` |
20
21
  | Task or bug is complete/outdated | `memorix_resolve` | `memorix memory resolve --ids <ids>` |
21
22
 
22
23
  ## Search Rules
@@ -41,4 +42,6 @@ Use Memorix as the shared memory layer for the active workspace when Memorix too
41
42
  | Accepted compromise | `trade-off` |
42
43
 
43
44
  - Use concise titles, stable entity names, relevant `filesModified`, and `topicKey` for evolving topics.
45
+ - Use `longTerm` only for a stable fact, reusable procedure, or completed episode that merits explicit review. It creates a candidate, not live context; keep the default project scope and do not use it for routine updates.
46
+ - A `user` + `portable` durable memory in a task brief is intentionally reusable across projects. When it matches the task, use it as background even if it originated elsewhere; it is not a current-project fact. Expand it only when needed with `memorix_detail` and `typedRefs: ["durable:<id>"]`, stating the missing fact as `purpose`.
44
47
  - Do not store secrets, credentials, raw private transcripts, trivial commands, or routine file reads.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memorix",
3
- "version": "1.2.10",
3
+ "version": "1.3.0",
4
4
  "description": "Shared workspace memory for Codex and other AI coding agents.",
5
5
  "author": {
6
6
  "name": "AVIDS2",
@@ -18,6 +18,7 @@ Use Memorix as the shared memory layer for the active workspace when Memorix too
18
18
  | Need the full source for a search hit | `memorix_detail` | `memorix memory detail --id <id>` |
19
19
  | Need the sequence around one memory | `memorix_timeline` | `memorix memory timeline --id <id>` |
20
20
  | Learned reusable project knowledge | `memorix_store` | `memorix memory store --type <type> --entity <name> --title "<title>" "<text>"` |
21
+ | Stable source-backed fact or procedure needing long-term review | `memorix_store` with `longTerm` | `memorix memory long-term qualify|approve --id <id> --reason "..."` |
21
22
  | Task or bug is complete/outdated | `memorix_resolve` | `memorix memory resolve --ids <ids>` |
22
23
 
23
24
  ## Search Rules
@@ -42,4 +43,6 @@ Use Memorix as the shared memory layer for the active workspace when Memorix too
42
43
  | Accepted compromise | `trade-off` |
43
44
 
44
45
  - Use concise titles, stable entity names, relevant `filesModified`, and `topicKey` for evolving topics.
46
+ - Use `longTerm` only for a stable fact, reusable procedure, or completed episode that merits explicit review. It creates a candidate, not live context; keep the default project scope and do not use it for routine updates.
47
+ - A `user` + `portable` durable memory in a task brief is intentionally reusable across projects. When it matches the task, use it as background even if it originated elsewhere; it is not a current-project fact. Expand it only when needed with `memorix_detail` and `typedRefs: ["durable:<id>"]`, stating the missing fact as `purpose`.
45
48
  - Do not store secrets, credentials, raw private transcripts, trivial commands, or routine file reads.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memorix",
3
- "version": "1.2.10",
3
+ "version": "1.3.0",
4
4
  "description": "Shared local workspace memory for GitHub Copilot CLI and other AI coding agents.",
5
5
  "author": {
6
6
  "name": "AVIDS2",