memorix 1.4.0 → 1.4.2
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.
- package/CHANGELOG.md +31 -0
- package/CLAUDE.md +9 -9
- package/README.md +7 -2
- package/README.zh-CN.md +6 -2
- package/dist/cli/index.js +1216 -485
- package/dist/index.js +984 -337
- package/dist/maintenance-runner.js +564 -180
- package/dist/media-video-runner.js +564 -180
- package/dist/memcode/index.js +53 -21
- package/dist/memcode-runtime/CHANGELOG.md +31 -0
- package/dist/sdk.js +983 -336
- package/dist/vector-backfill-runner.js +564 -180
- package/docs/1.4.2-EVIDENCE-GOVERNED-MEMORY-SPEC.md +434 -0
- package/docs/API_REFERENCE.md +1 -1
- package/docs/KNOWN_ISSUES_AND_ROADMAP.md +52 -128
- package/package.json +5 -2
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/codegraph.ts +83 -2
- package/src/codegraph/auto-context.ts +20 -0
- package/src/codegraph/current-facts.ts +1 -0
- package/src/codegraph/external-provider.ts +1 -0
- package/src/codegraph/store.ts +216 -5
- package/src/codegraph/types.ts +42 -0
- package/src/knowledge/context-assembly.ts +25 -0
- package/src/knowledge/governor.ts +156 -0
- package/src/knowledge/outcome-store.ts +102 -0
- package/src/knowledge/outcome-types.ts +49 -0
- package/src/knowledge/workflows.ts +32 -1
- package/src/knowledge/workset.ts +203 -13
- package/src/store/sqlite-db.ts +42 -0
- package/docs/dev-log/progress.txt +0 -388
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
# Memorix 1.4.2: Evidence-Governed Memory and CodeGraph
|
|
2
|
+
|
|
3
|
+
Status: implementation complete; release verification recorded in v1.4.2
|
|
4
|
+
Branch: `codex/1.4.2-evidence-governor`
|
|
5
|
+
Baseline: `v1.4.1`
|
|
6
|
+
Updated: 2026-08-06
|
|
7
|
+
|
|
8
|
+
## One-Sentence Product Contract
|
|
9
|
+
|
|
10
|
+
Memorix should give an agent the smallest useful set of **current, source-backed
|
|
11
|
+
project knowledge**, and should say "do not use memory here" when it cannot
|
|
12
|
+
justify a useful answer.
|
|
13
|
+
|
|
14
|
+
This is not a new prompt wrapper or a second knowledge store. It is the policy
|
|
15
|
+
layer that unifies existing observations, claims, workflows, CodeGraph evidence,
|
|
16
|
+
Git state, and verification results before they reach an agent.
|
|
17
|
+
|
|
18
|
+
## Why This Release Exists
|
|
19
|
+
|
|
20
|
+
The product already has much of the necessary foundation:
|
|
21
|
+
|
|
22
|
+
- source-backed claims and code-reference freshness;
|
|
23
|
+
- versioned CodeGraph snapshots and bounded Worksets;
|
|
24
|
+
- retention, archive, workflow, and background-maintenance primitives;
|
|
25
|
+
- project context through MCP and CLI.
|
|
26
|
+
|
|
27
|
+
Those pieces currently answer related questions in different modules. A memory
|
|
28
|
+
can be relevant but old, source-backed but never verified, or compact but still
|
|
29
|
+
harmful for the current task. 1.4.2 makes the final decision explicit,
|
|
30
|
+
consistent, inspectable, and shared by CLI, MCP, hooks, and dashboard surfaces.
|
|
31
|
+
|
|
32
|
+
## Research Constraints
|
|
33
|
+
|
|
34
|
+
This release follows published findings without overstating what they prove.
|
|
35
|
+
|
|
36
|
+
1. Similar retrieved experiences can cause agents to imitate prior outputs,
|
|
37
|
+
including wrong or misaligned ones. Memory quality and deletion policy are
|
|
38
|
+
product safety concerns, not cleanup cosmetics.
|
|
39
|
+
2. Long-horizon memory needs indexing, retrieval, reading, temporal updates,
|
|
40
|
+
and abstention. Retrieval quality alone is not enough.
|
|
41
|
+
3. Dynamic note links and hierarchical storage are useful only when the source,
|
|
42
|
+
freshness, and revision path remain visible.
|
|
43
|
+
4. Persistent memory is a privacy boundary. Retrieval must preserve scope,
|
|
44
|
+
visibility, and provenance instead of treating all stored text as promptable.
|
|
45
|
+
|
|
46
|
+
The primary research references are listed at the end of this document. Recent
|
|
47
|
+
2026 preprints may guide investigation but do not become product truth without
|
|
48
|
+
reproducible local tests.
|
|
49
|
+
|
|
50
|
+
## Terms
|
|
51
|
+
|
|
52
|
+
| Term | Meaning |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| Candidate | Any possible context item: observation, claim, workflow, code fact, Git fact, test result, or wiki page. |
|
|
55
|
+
| Evidence | A source that can be checked later: file/symbol hash, CodeGraph snapshot, commit, test/run result, document, or explicit user action. |
|
|
56
|
+
| Qualification | The deterministic check that decides whether a candidate is current enough, visible to this caller, and safe enough to use. |
|
|
57
|
+
| Context plan | The bounded answer to: inject nothing, inject a compact card, inject selected evidence, or schedule more work. |
|
|
58
|
+
| Outcome signal | A later, auditable fact such as a focused test passing, a claim being corrected, or a memory helping a verified task. |
|
|
59
|
+
| Observation period | The period after capture before a memory is promoted to trusted reusable knowledge. |
|
|
60
|
+
|
|
61
|
+
## Non-Negotiable Invariants
|
|
62
|
+
|
|
63
|
+
1. **No automatic context dump.** Existing memory is not a reason to inject it.
|
|
64
|
+
2. **No silent truth rewrite.** A model may propose a link, summary, or
|
|
65
|
+
promotion; it cannot overwrite evidence-backed claims without an auditable
|
|
66
|
+
transition.
|
|
67
|
+
3. **No model-only authority.** Test, Git, code, and explicit user signals outrank
|
|
68
|
+
a generated confidence score.
|
|
69
|
+
4. **No new default MCP tool explosion.** `memorix_project_context` remains the
|
|
70
|
+
primary agent surface. Advanced diagnostics stay grouped and opt-in.
|
|
71
|
+
5. **CLI and MCP parity.** Both construct the same context plan from the same
|
|
72
|
+
policy. Hooks only trigger the plan; they do not own a separate policy.
|
|
73
|
+
6. **Foreground stays fast.** Context assembly may schedule refresh or analysis,
|
|
74
|
+
but never waits for a corpus scan, remote provider, or LLM synthesis.
|
|
75
|
+
7. **Code facts are versioned.** A narrative cannot claim that code is current
|
|
76
|
+
without a matching snapshot or an explicit caution.
|
|
77
|
+
8. **Scope is enforced before relevance.** Personal, project, team, and public
|
|
78
|
+
knowledge do not mix merely because embeddings are similar.
|
|
79
|
+
|
|
80
|
+
## Target Architecture
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
observations / claims / workflows / wiki / Git / tests / CodeGraph
|
|
84
|
+
|
|
|
85
|
+
v
|
|
86
|
+
candidate collection
|
|
87
|
+
|
|
|
88
|
+
v
|
|
89
|
+
evidence qualification gate
|
|
90
|
+
scope -> provenance -> freshness -> conflict -> quality
|
|
91
|
+
|
|
|
92
|
+
v
|
|
93
|
+
budgeted context planner
|
|
94
|
+
abstain | compact card | selected detail
|
|
95
|
+
|
|
|
96
|
+
v
|
|
97
|
+
MCP / CLI / hook / dashboard explain view
|
|
98
|
+
|
|
|
99
|
+
v
|
|
100
|
+
verified outcomes feed lifecycle and CodeGraph links
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The governor is deliberately a pure, deterministic core. Storage adapters and
|
|
104
|
+
renderers call it; it does not import an MCP server, hook implementation, or UI.
|
|
105
|
+
|
|
106
|
+
## Data Contracts
|
|
107
|
+
|
|
108
|
+
### 1. Context Candidate
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
ContextCandidate
|
|
112
|
+
id, kind, projectId, scope, visibility
|
|
113
|
+
title, compactText, sourceRefs
|
|
114
|
+
capturedAt, observedAt
|
|
115
|
+
freshness current | suspect | stale | unknown
|
|
116
|
+
conflict none | possible | confirmed
|
|
117
|
+
quality probation | verified | degraded | blocked
|
|
118
|
+
relevanceSignals lexical, semantic, task-lens, code-link
|
|
119
|
+
estimatedTokens
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Existing records are adapted into candidates. This is not a duplicated store.
|
|
123
|
+
|
|
124
|
+
### 2. Qualification Result
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
QualificationResult
|
|
128
|
+
candidateId
|
|
129
|
+
disposition include | compact | defer | exclude
|
|
130
|
+
reasons[] stable machine-readable reason codes
|
|
131
|
+
evidenceSummary[] source type, id, snapshot/revision, locator
|
|
132
|
+
qualitySignals[] verified test, successful reuse, user pin, correction
|
|
133
|
+
freshness
|
|
134
|
+
tokenCost
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
An excluded item is visible in diagnostics only. It is never silently presented
|
|
138
|
+
as if it had not existed.
|
|
139
|
+
|
|
140
|
+
### 3. Context Plan
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
ContextPlan
|
|
144
|
+
task, taskLens, projectState
|
|
145
|
+
mode abstain | card | workset
|
|
146
|
+
selected[] QualificationResult
|
|
147
|
+
deferred[] bounded follow-up suggestions
|
|
148
|
+
cautions[]
|
|
149
|
+
budget requested, used, remaining
|
|
150
|
+
scheduledMaintenance[]
|
|
151
|
+
explanationId
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`abstain` is a successful result. It means Memorix did not find sufficiently
|
|
155
|
+
qualified context and recommends normal repository inspection instead.
|
|
156
|
+
|
|
157
|
+
### 4. Outcome Signal
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
MemoryOutcomeSignal
|
|
161
|
+
id, candidateId, projectId, kind
|
|
162
|
+
kind test-pass | test-fail | verified-reuse |
|
|
163
|
+
user-pin | user-correction | source-changed |
|
|
164
|
+
conflict-confirmed | manual-review
|
|
165
|
+
sourceRef, snapshotId, observedAt
|
|
166
|
+
detail sanitized, bounded explanation
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Outcome signals are append-only audit facts. They update a derived quality
|
|
170
|
+
state; they do not erase the original memory. A generic manual review is
|
|
171
|
+
auditable but does not by itself raise quality: verification or an explicit
|
|
172
|
+
user pin is still required.
|
|
173
|
+
|
|
174
|
+
## Lifecycle Policy
|
|
175
|
+
|
|
176
|
+
1. **Capture:** new observations remain usable as local session material but are
|
|
177
|
+
labelled `probation` for durable retrieval.
|
|
178
|
+
2. **Qualify:** source and scope are checked. Code-bound items are matched to a
|
|
179
|
+
snapshot; unbound assertions remain lower confidence.
|
|
180
|
+
3. **Promote:** explicit user pin, review approval, successful verified reuse,
|
|
181
|
+
or source-backed test/Git evidence can promote a candidate.
|
|
182
|
+
4. **Degrade:** changed/deleted source, failing verification, contradiction, or
|
|
183
|
+
a user correction downgrades the derived quality state.
|
|
184
|
+
5. **Archive:** retention rules continue to govern cleanup, but archive decisions
|
|
185
|
+
consume this shared state instead of copying their own freshness formula.
|
|
186
|
+
6. **Recover:** an archived fact can be revisited with its original evidence;
|
|
187
|
+
archive never means invisible deletion by default.
|
|
188
|
+
|
|
189
|
+
No score alone can cause destructive deletion. A score can only suggest a
|
|
190
|
+
review or make a candidate ineligible for automatic injection.
|
|
191
|
+
|
|
192
|
+
## CodeGraph Upgrade
|
|
193
|
+
|
|
194
|
+
### Product Goal
|
|
195
|
+
|
|
196
|
+
CodeGraph becomes the code evidence service for the governor. It should answer
|
|
197
|
+
four practical questions quickly:
|
|
198
|
+
|
|
199
|
+
1. What files and symbols are relevant to this task now?
|
|
200
|
+
2. What changed since this memory or workflow was formed?
|
|
201
|
+
3. What may be affected if this symbol or file changes?
|
|
202
|
+
4. How complete and trustworthy is that structural answer?
|
|
203
|
+
|
|
204
|
+
### New Capabilities
|
|
205
|
+
|
|
206
|
+
#### A. Snapshot Diff
|
|
207
|
+
|
|
208
|
+
The first 1.4.2 slice adds a hash-only **file** manifest to each completed
|
|
209
|
+
snapshot. It can report added, modified, and removed indexed files between two
|
|
210
|
+
complete snapshots. It stores paths and hashes, never a second copy of source.
|
|
211
|
+
|
|
212
|
+
Symbol and relation history are not yet retained per snapshot, so this release
|
|
213
|
+
does **not** pretend to provide historical symbol/edge diffs. Current graph
|
|
214
|
+
relations are used only for the bounded impact slice below.
|
|
215
|
+
|
|
216
|
+
Target shape for later schema evolution:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
CodeStateDiff
|
|
220
|
+
fromSnapshotId, toSnapshotId
|
|
221
|
+
added/changed/removed files
|
|
222
|
+
added/changed/removed symbols
|
|
223
|
+
added/changed/removed relations
|
|
224
|
+
completeness delta
|
|
225
|
+
affected observation/claim/workflow references
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
This must report unknowns from incomplete scans. It is not allowed to label an
|
|
229
|
+
unscanned path as unchanged.
|
|
230
|
+
|
|
231
|
+
#### B. Impact Slice
|
|
232
|
+
|
|
233
|
+
Given a file or symbol, return a bounded, explainable graph slice:
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
ImpactSlice
|
|
237
|
+
root references
|
|
238
|
+
inbound and outbound relations
|
|
239
|
+
direct test/config/workflow references when available
|
|
240
|
+
confidence, coverage, traversal limit, and reasons
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The first release supports direct edges and a small bounded traversal only. It
|
|
244
|
+
does not claim whole-program call-graph precision.
|
|
245
|
+
|
|
246
|
+
#### Implemented Slice
|
|
247
|
+
|
|
248
|
+
- `memorix codegraph diff` compares the newest two snapshots by default, or
|
|
249
|
+
accepts explicit `--from` and `--to` snapshot ids.
|
|
250
|
+
- `memorix codegraph impact --path <relative-source-path>` exposes the same
|
|
251
|
+
bounded current one-hop graph slice to CLI-only agents. It rejects paths that
|
|
252
|
+
are not in the current index instead of reporting a misleading empty result.
|
|
253
|
+
- A diff is refused when either snapshot is incomplete or predates the manifest
|
|
254
|
+
schema. The result explains why instead of treating absent data as unchanged.
|
|
255
|
+
- The impact view resolves both file edges and symbol edges to current files,
|
|
256
|
+
follows only one hop, and caps relation traversal. It is an inspection aid,
|
|
257
|
+
not a guarantee of complete impact coverage.
|
|
258
|
+
- Lite deterministically resolves local relative import paths, including the
|
|
259
|
+
Node ESM `.js`-from-`.ts` convention. It still does not claim semantic symbol
|
|
260
|
+
resolution or whole-program call-graph precision.
|
|
261
|
+
- A continuation Workset reports how many stale memory bindings point directly
|
|
262
|
+
at the changed snapshot files. It does not attribute unrelated old stale
|
|
263
|
+
memory to the current change.
|
|
264
|
+
- The Workset governor now filters optional claims, workflows, durable memory,
|
|
265
|
+
and code-bound memory before prompt rendering. Its receipt records the safe
|
|
266
|
+
disposition and reason without exposing hidden content. In this first slice,
|
|
267
|
+
task facts, Git state, current code state, and safety cautions remain outside
|
|
268
|
+
the optional-evidence gate so an abstention never hides current source facts.
|
|
269
|
+
|
|
270
|
+
#### C. Test and Verification Links
|
|
271
|
+
|
|
272
|
+
Workflow runs now record an append-only pass/fail signal for their selected
|
|
273
|
+
claims and durable memories. The newest signal is applied only as a delivery
|
|
274
|
+
qualification: a failed verification degrades optional context instead of
|
|
275
|
+
silently rewriting or deleting the original record. A later code change can
|
|
276
|
+
then downgrade the confidence of a memory that says "this is verified" rather
|
|
277
|
+
than leaving an old green test as permanent proof. File/symbol references on
|
|
278
|
+
individual test outcomes remain a later extension.
|
|
279
|
+
|
|
280
|
+
#### D. Provider Coverage Contract
|
|
281
|
+
|
|
282
|
+
Every provider returns:
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
ProviderCoverage
|
|
286
|
+
provider, parserMode, supportedLanguages
|
|
287
|
+
indexedFiles, skippedFiles, skippedReasons
|
|
288
|
+
relationTypes, confidencePolicy
|
|
289
|
+
snapshotCompleteness
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
CodeGraph Lite remains a mandatory local fallback. Parser-backed or external
|
|
293
|
+
providers are optional accelerators and may only add normalized facts through
|
|
294
|
+
this contract. They cannot bypass project scope, source epoch, or secret rules.
|
|
295
|
+
|
|
296
|
+
#### E. Claim-to-Code Requalification
|
|
297
|
+
|
|
298
|
+
Existing claim and observation code references should consume snapshot diffs:
|
|
299
|
+
|
|
300
|
+
- removed source -> `blocked` or `needs-review`;
|
|
301
|
+
- changed bound source -> `degraded` until rechecked;
|
|
302
|
+
- current source plus fresh verification -> `verified`;
|
|
303
|
+
- incomplete provider coverage -> `unknown`, never falsely `current`.
|
|
304
|
+
|
|
305
|
+
## Retrieval Policy
|
|
306
|
+
|
|
307
|
+
The governor collects candidates first, then applies this order:
|
|
308
|
+
|
|
309
|
+
1. project identity, scope, visibility, and secret policy;
|
|
310
|
+
2. hard exclusions: deleted evidence, forbidden scope, confirmed contradiction;
|
|
311
|
+
3. source freshness and provider completeness;
|
|
312
|
+
4. task lens and direct code/Git/test links;
|
|
313
|
+
5. quality signals and explicit user review;
|
|
314
|
+
6. relevance ranking and diversity;
|
|
315
|
+
7. strict section and total token budgets.
|
|
316
|
+
|
|
317
|
+
Default delivery is progressive:
|
|
318
|
+
|
|
319
|
+
- **abstain:** no qualified advantage; return normal start files only;
|
|
320
|
+
- **card:** one compact "where we were / what changed / what to verify" card;
|
|
321
|
+
- **workset:** selected details with source references and cautions;
|
|
322
|
+
- **defer:** schedule a refresh or requalification without blocking the agent.
|
|
323
|
+
|
|
324
|
+
## Public Experience
|
|
325
|
+
|
|
326
|
+
Normal users still say a natural-language task, for example:
|
|
327
|
+
|
|
328
|
+
> Continue the auth migration. What remains and what must be checked first?
|
|
329
|
+
|
|
330
|
+
They receive a short, useful answer. They do not see score arithmetic.
|
|
331
|
+
|
|
332
|
+
An explicit diagnostic path can answer:
|
|
333
|
+
|
|
334
|
+
```text
|
|
335
|
+
Why did Memorix include or skip this memory?
|
|
336
|
+
Which code snapshot supports it?
|
|
337
|
+
What changed since it was verified?
|
|
338
|
+
How much context budget did it consume?
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
This diagnostic output is grouped under existing context/knowledge diagnostics;
|
|
342
|
+
it is not a new default tool for every graph operation.
|
|
343
|
+
|
|
344
|
+
## Delivery Phases
|
|
345
|
+
|
|
346
|
+
### Phase 0: Baseline and Compatibility
|
|
347
|
+
|
|
348
|
+
- Inventory all existing context ranking, retention, claim, freshness, and
|
|
349
|
+
CodeGraph paths.
|
|
350
|
+
- Add a behavior matrix covering current output and no-regression fixtures.
|
|
351
|
+
- Establish deterministic context-plan fixtures: abstain, compact card, stale
|
|
352
|
+
code caution, conflict exclusion, and incomplete graph coverage.
|
|
353
|
+
|
|
354
|
+
### Phase 1: Governor Core
|
|
355
|
+
|
|
356
|
+
- Implement candidate adapters and pure qualification/context-plan modules.
|
|
357
|
+
- Route `project_context`, `context_pack`, and CLI context/resume through the
|
|
358
|
+
same plan builder without changing their stable output contracts.
|
|
359
|
+
- Add explicit abstention and reason codes.
|
|
360
|
+
|
|
361
|
+
### Phase 2: Outcome and Lifecycle Unification
|
|
362
|
+
|
|
363
|
+
- Add append-only outcome signals and derived candidate quality.
|
|
364
|
+
- Route retention report, HTTP/dashboard status, archive eligibility, and
|
|
365
|
+
claim requalification through one lifecycle evaluation path.
|
|
366
|
+
- Treat test/Git/source changes as higher-quality signals than model estimates.
|
|
367
|
+
|
|
368
|
+
### Phase 3: CodeGraph Evidence Upgrade
|
|
369
|
+
|
|
370
|
+
- Add snapshot diffs, bounded impact slices, coverage reporting, and test/run
|
|
371
|
+
reference links.
|
|
372
|
+
- Requalify claim/observation references from diffs.
|
|
373
|
+
- Add fixture coverage for changed symbol, removed file, incomplete scan, and
|
|
374
|
+
uncertain relation handling.
|
|
375
|
+
|
|
376
|
+
### Phase 4: Explainability and Operator UX
|
|
377
|
+
|
|
378
|
+
- Add context-plan explanations to CLI JSON and grouped diagnostics.
|
|
379
|
+
- Add dashboard views for quality state, source freshness, impact slice, and
|
|
380
|
+
exclusion reason without leaking hidden/private evidence.
|
|
381
|
+
- Keep the normal agent path quiet.
|
|
382
|
+
|
|
383
|
+
### Phase 5: Verification and Release Gate
|
|
384
|
+
|
|
385
|
+
- Run unit, SQLite reopen, provider fallback, CLI, MCP, hook, and packaged
|
|
386
|
+
installation checks.
|
|
387
|
+
- Run isolated agent smoke tests with qualified context, stale context, and
|
|
388
|
+
abstention scenarios.
|
|
389
|
+
- Measure first-turn latency, token usage, stale-context catches, and false
|
|
390
|
+
inclusion/exclusion rates against Phase 0 fixtures.
|
|
391
|
+
|
|
392
|
+
## Acceptance Criteria
|
|
393
|
+
|
|
394
|
+
1. Every automatic inclusion has a machine-readable reason and at least one
|
|
395
|
+
visible source or explicit `unknown` caution.
|
|
396
|
+
2. A changed or deleted code source changes the retrieval disposition without a
|
|
397
|
+
human rediscovering the mismatch.
|
|
398
|
+
3. A task with no qualified memory returns less context, not a generic summary.
|
|
399
|
+
4. CLI, MCP, and hooks select the same qualified evidence for the same task and
|
|
400
|
+
project state.
|
|
401
|
+
5. An incomplete CodeGraph provider result can never be formatted as complete
|
|
402
|
+
code truth.
|
|
403
|
+
6. Test failure, user correction, and source change can lower reusable-memory
|
|
404
|
+
quality; no score-only path deletes a memory.
|
|
405
|
+
7. Existing stored observations, claims, workflows, context commands, and lite
|
|
406
|
+
MCP profile remain backward compatible.
|
|
407
|
+
8. Default MCP tool count does not increase.
|
|
408
|
+
|
|
409
|
+
## Explicit Non-Goals
|
|
410
|
+
|
|
411
|
+
- A remote graph database requirement.
|
|
412
|
+
- Silent LLM rewriting of a project's wiki or workflow.
|
|
413
|
+
- Claiming exact whole-program impact analysis from CodeGraph Lite.
|
|
414
|
+
- Replacing a real language server, CodeGraph product, Git, or test runner.
|
|
415
|
+
- Auto-capturing all conversations, screenshots, or tool outputs.
|
|
416
|
+
- Treating a visual graph as proof of a maintained semantic knowledge graph.
|
|
417
|
+
|
|
418
|
+
## Research References
|
|
419
|
+
|
|
420
|
+
- Xiong et al., "How Memory Management Impacts LLM Agents: An Empirical Study
|
|
421
|
+
of Experience-Following Behavior," ACL 2026.
|
|
422
|
+
https://aclanthology.org/2026.acl-long.27/
|
|
423
|
+
- Wu et al., "LongMemEval: Benchmarking Chat Assistants on Long-Term
|
|
424
|
+
Interactive Memory," ICLR 2025.
|
|
425
|
+
https://iclr.cc/virtual/2025/poster/28290
|
|
426
|
+
- Xu et al., "A-MEM: Agentic Memory for LLM Agents," NeurIPS 2025.
|
|
427
|
+
https://neurips.cc/virtual/2025/poster/119020
|
|
428
|
+
- Kang et al., "Memory OS of AI Agent," EMNLP 2025.
|
|
429
|
+
https://aclanthology.org/2025.emnlp-main.1318
|
|
430
|
+
- Tan et al., "MemBench: Towards More Comprehensive Evaluation on the Memory
|
|
431
|
+
of LLM-based Agents," Findings of ACL 2025.
|
|
432
|
+
https://aclanthology.org/2025.findings-acl.989.pdf
|
|
433
|
+
- Wang et al., "Unveiling Privacy Risks in LLM Agent Memory," ACL 2025.
|
|
434
|
+
https://aclanthology.org/2025.acl-long.1227.pdf
|
package/docs/API_REFERENCE.md
CHANGED
|
@@ -114,7 +114,7 @@ MCP:
|
|
|
114
114
|
- `memorix_codegraph_status` returns provider/index counts for the current project.
|
|
115
115
|
- `memorix_context_pack` builds a task-specific packet with reliable current memories, lower-trust unbound memories, current code facts, freshness warnings, suggested reads, and suggested verification.
|
|
116
116
|
|
|
117
|
-
`memorix context` defaults to `--refresh auto`, so first use can seed Code State without a separate manual `memorix codegraph refresh`. Its brief puts live package/changelog/Git facts before memory hints and flags old `progress.txt
|
|
117
|
+
`memorix context` defaults to `--refresh auto`, so first use can seed Code State without a separate manual `memorix codegraph refresh`. Its brief puts live package/changelog/Git facts before memory hints and flags an old `ACTIVE_WORK.md`, legacy `progress.txt`, or legacy dev-log note as historical when it predates the latest changelog, so agents should treat current facts as the source of truth when files disagree. Task lenses keep the packet shaped to the work: bugfix briefs prefer failing tests and repros, release briefs prefer metadata/changelog/package checks, and onboarding briefs prefer docs and entry points while hiding unrelated suspect details. Continuation delivery is separate from the task lens: continuation language in `memorix_project_context` enables a bounded prior-work projection, and `memorix resume "..."` makes that choice explicit. It includes only the latest useful session summary, up to three readable durable memories, and at most one recent source-labelled compact checkpoint. Checkpoints are host lifecycle evidence, not durable memory or transcript backups; ordinary new tasks do not receive historical-session context. A completed MCP brief is the default retrieval boundary: search, detail, or Context Pack should expand it only for a named missing fact or an explicit request for deeper history. Use `--refresh never` for read-only inspection and `--refresh always` when you want to force a fresh scan.
|
|
118
118
|
|
|
119
119
|
Project-specific generated, vendored, or cache paths can be excluded from Code State with `[codegraph].exclude_patterns` in `memorix.toml` or `~/.memorix/config.toml` (`codegraph.excludePatterns` in legacy YAML). User patterns extend the built-in excludes and are applied to indexing, Project Context suggested reads, and Context Pack suggested reads.
|
|
120
120
|
|
|
@@ -1,149 +1,73 @@
|
|
|
1
|
-
# Memorix
|
|
1
|
+
# Memorix 已知边界与路线图
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 最后审阅:2026-08-03(对照 v1.4.0)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
这份文档说明仍然成立的产品边界、风险和方向;它不是发布流水账。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- 已发布版本和每次修复的事实,以 [CHANGELOG](../CHANGELOG.md) 为准。
|
|
8
|
+
- 当前正在进行的维护工作,以 [ACTIVE_WORK](../ACTIVE_WORK.md) 为准。
|
|
9
|
+
- 可讨论、可订阅的后续事项,以 GitHub Open Issues 为准。
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
---
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|---|------|------|------|
|
|
13
|
-
| 1 | ~~**无文件锁**~~ — 多 Agent 同时写入 | 数据完整性 | ✅ v0.7.11 (`withFileLock` + `atomicWriteFile`) |
|
|
14
|
-
| 2 | **Orama where 过滤不可靠** — 空 term + number filter 时结果可能不正确 | `compactDetail` 已绕过 (使用内存查找) | 已变通 |
|
|
13
|
+
## 当前产品边界
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
Memorix 是本地优先、可插拔的 Agent Memory 系统。它给不同 Agent 或同一 Agent 的新会话提供同一个项目记忆层,并把 CLI 作为最完整、最稳定的控制面;MCP 是面向 Agent 的受控入口,而不是唯一入口。
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|---|------|------|------|
|
|
20
|
-
| 3 | **非 Git 项目的 projectId 不稳定** — 基于目录名,不同机器或路径会不同 | 数据隔离 | 未修复 |
|
|
21
|
-
| 4 | ~~**retention 只有报告没有执行**~~ | 数据膨胀 | ✅ v0.7.11 (`archiveExpired` + `action="archive"`) |
|
|
22
|
-
| 5 | ~~**实体抽取不支持中文标识符**~~ | 中文项目覆盖不足 | ✅ v0.7.11 (中文括号/反引号 + 因果语言) |
|
|
23
|
-
| 6 | ~~**auto-relations 每次读取全图**~~ | 性能 | ✅ v0.7.11 (entityIndex O(1) 查找) |
|
|
24
|
-
| 7 | **高重要性 observations 永远免疫** — gotcha/decision/trade-off 永不过期 | 数据膨胀 | 设计如此,需评估 |
|
|
17
|
+
当前版本已经包括:
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
- 项目记忆、会话续接、任务透镜和按需展开的上下文;
|
|
20
|
+
- 代码状态、知识库 / Wiki、知识图谱投影和工作流记录;
|
|
21
|
+
- 受控的本地媒体资产库,可显式导入图片、音频、视频和 PDF,并保留来源、哈希、配额和删除审计;
|
|
22
|
+
- 多 Agent 集成、hook、doctor / repair,以及可选择的后台维护;
|
|
23
|
+
- SQLite 规范存储、可见性边界、保留策略和清理审计。
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|---|------|------|------|
|
|
30
|
-
| 8 | ~~**Kiro/Trae Agent hooks 未实现**~~ | 功能缺失 | ✅ v0.9.12+ (Kiro/Trae/OpenCode/Gemini CLI 全部支持) |
|
|
31
|
-
| 9 | **fastembed 首次使用需下载模型** — ~30MB,可能在网络不好时超时 | 用户体验 | 需用户显式安装 |
|
|
32
|
-
| 10 | **npx 缓存可能损坏** — 见 `MODULE_NOT_FOUND chownr` 问题 | 安装体验 | 需文档说明 |
|
|
25
|
+
这些能力并不等于“任何数据都会被自动收集”或“所有媒体都已经被模型理解”。Memorix 的默认边界是显式、可追溯、可清理,避免把无关聊天、任意本地文件或有成本的模型调用悄悄写入长期记忆。
|
|
33
26
|
|
|
34
27
|
---
|
|
35
28
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Phase 2: 推广 & 用户获取
|
|
48
|
-
- [ ] 社区推广 (Reddit, HN, X, Discord)
|
|
49
|
-
- [ ] 技术博客文章
|
|
50
|
-
- [ ] 演示视频
|
|
51
|
-
- [ ] 与其他 MCP Server 项目的对比文档
|
|
52
|
-
|
|
53
|
-
### Phase 3: Web Dashboard ✅
|
|
54
|
-
- [x] 知识图谱可视化 (D3.js force graph)
|
|
55
|
-
- [x] Observation 搜索/浏览 Web UI
|
|
56
|
-
- [x] 记忆保留状态仪表板
|
|
57
|
-
- [x] 跨项目记忆概览 (project switcher)
|
|
58
|
-
|
|
59
|
-
### Phase 4: 功能增强 ✅
|
|
60
|
-
- [x] 自动归档过期记忆 (`memorix_retention action="archive"`)
|
|
61
|
-
- [x] 文件锁机制 (多进程安全)
|
|
62
|
-
- [x] 搜索精确度优化 (fuzzy + field boosting)
|
|
63
|
-
- [x] 中文实体抽取
|
|
64
|
-
- [x] 图谱-记忆双向同步
|
|
65
|
-
- [x] `memorix_transfer` — 导出/导入记忆 (JSON + Markdown)
|
|
66
|
-
- [x] 记忆去重和冲突检测 (`memorix_deduplicate` + `memorix_consolidate`)
|
|
67
|
-
- [x] LLM 增强模式 (压缩/重排序/写入时去重)
|
|
68
|
-
|
|
69
|
-
### Phase 5: Agent 集成 ✅
|
|
70
|
-
- [x] Kiro 完整支持
|
|
71
|
-
- [x] Trae 支持
|
|
72
|
-
- [x] OpenCode 支持
|
|
73
|
-
- [x] Gemini CLI 支持
|
|
74
|
-
- [x] Copilot hooks 支持
|
|
75
|
-
- [x] 10 个 Agent 全覆盖
|
|
76
|
-
|
|
77
|
-
### Phase 6: v1.0.0 特性 ✅
|
|
78
|
-
- [x] 团队协作 (Agent注册/文件锁/任务板/消息)
|
|
79
|
-
- [x] 工具合并 (41 → 22 默认)
|
|
80
|
-
- [x] 启动自动清理 (归档 + LLM/Jaccard 去重)
|
|
81
|
-
- [x] Mini-Skills (永久技能, 自动注入)
|
|
82
|
-
- [x] 会话管理 (跨会话上下文注入)
|
|
83
|
-
|
|
84
|
-
### Phase 7: 未来路线图
|
|
85
|
-
- [ ] 多项目记忆关联搜索
|
|
86
|
-
- [ ] LLM-based 实体抽取 (替代正则)
|
|
87
|
-
- [ ] JetBrains AI 支持
|
|
88
|
-
- [ ] VS Code + Continue.dev 支持
|
|
89
|
-
- [ ] 自定义 embedding 模型支持
|
|
90
|
-
- [ ] 记忆联邦协议 (跨团队共享)
|
|
29
|
+
## 仍需注意的边界
|
|
30
|
+
|
|
31
|
+
| 主题 | 现状 | 使用建议 |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| 项目绑定 | 没有可靠工作区根目录时,MCP 会等待显式根目录、MCP Roots 或会话启动,而不会猜测上一个项目。 | 这是防止跨项目读写的安全边界;首次接入时按客户端的项目根目录配置即可。 |
|
|
34
|
+
| 向量与外部模型 | 可选嵌入提供商、网络和首次模型准备会影响写入或检索延迟。 | 不要把外部 API 的瞬时可用性当作本地数据是否已写入的唯一判断;先用 `memorix status` / `doctor` 看状态。 |
|
|
35
|
+
| 媒体记忆 | 已有受控附件和元数据/向量基础,但 PDF 文本提取、音频转写、视频语义提取仍不是默认的全自动链路。 | 只导入确实需要长期复用的资产;不要把截图或工具输出当作默认记忆来源。 |
|
|
36
|
+
| 图谱与 Wiki | 它们是从规范记忆和代码状态生成的可追溯投影,不是可任意编辑的 GraphRAG 数据库。 | 先写清楚有来源的知识和决策,让投影自然形成关联;不要把图谱当作另一份手工真相。 |
|
|
37
|
+
| Agent 集成 | 上游客户端会改变 hook、MCP、配置文件和权限模型。 | 使用 `memorix doctor agents` 诊断,优先让 `setup` / `repair` 做非破坏性修复。 |
|
|
38
|
+
| 大规模数据 | 保留、归档、去重和检索预算已存在,但上万至百万级数据仍需要按项目负载做容量验证。 | 为高增长项目配置明确的保留与清理策略,并关注 Dashboard / CLI 的审计信息。 |
|
|
91
39
|
|
|
92
40
|
---
|
|
93
41
|
|
|
94
|
-
##
|
|
95
|
-
|
|
96
|
-
### 运行时依赖
|
|
97
|
-
| 包 | 版本 | 用途 |
|
|
98
|
-
|---|------|------|
|
|
99
|
-
| `@modelcontextprotocol/sdk` | ^latest | MCP 协议 SDK |
|
|
100
|
-
| `@orama/orama` | ^latest | 全文/向量搜索 |
|
|
101
|
-
| `gpt-tokenizer` | ^latest | Token 计数 |
|
|
102
|
-
| `citty` | ^latest | CLI 框架 |
|
|
103
|
-
| `@clack/prompts` | ^latest | CLI 交互提示 |
|
|
104
|
-
| `zod` | ^3 | 参数验证 |
|
|
105
|
-
|
|
106
|
-
### 可选依赖
|
|
107
|
-
| 包 | 版本 | 用途 |
|
|
108
|
-
|---|------|------|
|
|
109
|
-
| `fastembed` | ^latest | 本地 ONNX embedding (384d),需用户显式安装 |
|
|
110
|
-
|
|
111
|
-
### 开发依赖
|
|
112
|
-
| 包 | 版本 | 用途 |
|
|
113
|
-
|---|------|------|
|
|
114
|
-
| `vitest` | ^latest | 测试框架 |
|
|
115
|
-
| `tsup` | ^latest | 打包构建 |
|
|
116
|
-
| `typescript` | ^5 | 类型系统 |
|
|
42
|
+
## 公开路线
|
|
117
43
|
|
|
118
|
-
|
|
44
|
+
### 1. 稳定性与可操作性
|
|
45
|
+
|
|
46
|
+
- 继续以 Windows、macOS/Linux、CLI、MCP、后台服务和全新安装作为发布门槛;
|
|
47
|
+
- 保持 MCP 工具面小而按需展开,CLI 保持完整的管理和恢复能力;
|
|
48
|
+
- 让配置迁移、诊断、修复和清理保持非破坏性、可解释、可回退。
|
|
49
|
+
|
|
50
|
+
### 2. 记忆质量与知识工作区
|
|
119
51
|
|
|
120
|
-
|
|
52
|
+
- 提高“新会话接手”时的相关性:先给简短进度卡,再按任务取详情;
|
|
53
|
+
- 统一保留状态、归档、检索预算和 Dashboard 的解释,避免同一条记忆在不同入口显示不同状态;
|
|
54
|
+
- 继续发展代码状态、知识库、Wiki、图谱和工作流之间的可追溯关联,而不是重复堆叠文本摘要。
|
|
121
55
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
56
|
+
### 3. 受控的多模态派生能力
|
|
57
|
+
|
|
58
|
+
- 在现有资产生命周期之上评估 PDF 文本提取、音频转写、视频语义派生;
|
|
59
|
+
- 每一类派生都必须有来源、成本边界、配额、删除联动和重建路径;
|
|
60
|
+
- 不把“接受任意 URL / 任意文件”误宣传为完整多模态 RAG。
|
|
61
|
+
|
|
62
|
+
### 4. Agent 生态与研究
|
|
63
|
+
|
|
64
|
+
- 跟进受用户需求推动的集成,例如 [Qwen 自动 hooks](https://github.com/AVIDS2/memorix/issues/3) 与 [持久化 Agent 身份](https://github.com/AVIDS2/memorix/issues/49);
|
|
65
|
+
- 独立推进记忆能力的实证研究,例如[模型能力如何改变项目记忆收益与伤害边界](https://github.com/AVIDS2/memorix/issues/152),不把研究假设当作产品已经证明的效果。
|
|
131
66
|
|
|
132
67
|
---
|
|
133
68
|
|
|
134
|
-
##
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
| 2026-02-13 | Antigravity MCP 配置修复,Memorix MCP Server 首次成功运行 |
|
|
140
|
-
| 2026-02-13 | 发现并修复 npx 缓存损坏问题 (MODULE_NOT_FOUND chownr) |
|
|
141
|
-
| 2026-02-15 | 完成全部核心模块的深度代码审查 |
|
|
142
|
-
| 2026-02-15 | 开发文档完成 (ARCHITECTURE, MODULES, DEVELOPMENT, DESIGN_DECISIONS, API_REFERENCE) |
|
|
143
|
-
| 2026-02-24 | v0.7.8-0.7.10: Antigravity 兼容 + MCP roots + 中英双语文档 |
|
|
144
|
-
| 2026-02-24 | v0.7.11: P0-P2 全部完成 (文件锁 + 搜索优化 + 自动归档 + 中文实体 + 性能优化 + 图谱同步) |
|
|
145
|
-
| 2026-02-25 | v0.9.0-0.9.12: Hooks 系统全量修复 + 10 Agent 支持 |
|
|
146
|
-
| 2026-02-28 | v0.9.25: Windsurf 兼容性修复 |
|
|
147
|
-
| 2026-03-05 | v0.10.5: Antigravity/Claude Code hooks 修复 |
|
|
148
|
-
| 2026-03-07 | v0.11.0: Mini-Skills + LLM 增强模式 |
|
|
149
|
-
| 2026-03-09 | **v1.0.0**: 首个稳定版 — 22 工具 + 团队协作 + 自动清理 + 753 测试 |
|
|
69
|
+
## 贡献与验证原则
|
|
70
|
+
|
|
71
|
+
贡献会先检查三件事:是否符合当前存储/可见性/生命周期边界,是否能由 CLI 与 MCP 一致地使用,是否有可重复的测试或人工验证证据。功能方向有价值但架构已演进的 PR 会保留作者署名,并通过公开后续 Issue 延续,而不是悄悄重写或吞掉成果。
|
|
72
|
+
|
|
73
|
+
历史版本、已解决问题和详细发布日期请查看 [CHANGELOG](../CHANGELOG.md)。
|