memorix 1.1.13 → 1.2.1

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 (97) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +6 -3
  3. package/README.zh-CN.md +6 -3
  4. package/dist/cli/index.js +36639 -31279
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/dashboard/static/app.js +50 -30
  7. package/dist/index.js +6636 -1778
  8. package/dist/index.js.map +1 -1
  9. package/dist/maintenance-runner.d.ts +1 -1
  10. package/dist/maintenance-runner.js +3775 -302
  11. package/dist/maintenance-runner.js.map +1 -1
  12. package/dist/memcode-runtime/CHANGELOG.md +33 -1
  13. package/dist/sdk.d.ts +1 -1
  14. package/dist/sdk.js +6634 -1776
  15. package/dist/sdk.js.map +1 -1
  16. package/docs/1.2.0-CLAIM-LEDGER.md +72 -0
  17. package/docs/1.2.0-CODE-STATE.md +61 -0
  18. package/docs/1.2.0-DEVELOPMENT-CHARTER.md +255 -0
  19. package/docs/1.2.0-DYNAMIC-LIFECYCLE.md +71 -0
  20. package/docs/1.2.0-EVALUATION-HARNESS.md +51 -0
  21. package/docs/1.2.0-IMPLEMENTATION-PLAN.md +554 -0
  22. package/docs/1.2.0-KNOWLEDGE-WORKFLOW-RESEARCH.md +205 -0
  23. package/docs/1.2.0-KNOWLEDGE-WORKSPACE.md +68 -0
  24. package/docs/1.2.0-PRODUCT-STORY.md +234 -0
  25. package/docs/1.2.0-PROVIDER-QUALITY.md +189 -0
  26. package/docs/1.2.0-WORKFLOW-INHERITANCE.md +101 -0
  27. package/docs/1.2.0-WORKSET-RETRIEVAL.md +80 -0
  28. package/docs/AGENT_OPERATOR_PLAYBOOK.md +6 -3
  29. package/docs/API_REFERENCE.md +27 -6
  30. package/docs/CONFIGURATION.md +21 -3
  31. package/docs/DEVELOPMENT.md +4 -0
  32. package/docs/README.md +17 -2
  33. package/docs/SETUP.md +7 -1
  34. package/docs/dev-log/progress.txt +120 -40
  35. package/docs/knowledge/workflows/memorix-release.md +57 -0
  36. package/llms-full.txt +16 -2
  37. package/llms.txt +9 -4
  38. package/package.json +3 -2
  39. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  40. package/src/cli/capability-map.ts +1 -0
  41. package/src/cli/commands/codegraph.ts +111 -9
  42. package/src/cli/commands/context.ts +2 -0
  43. package/src/cli/commands/doctor.ts +73 -4
  44. package/src/cli/commands/knowledge.ts +322 -0
  45. package/src/cli/commands/serve-http.ts +26 -42
  46. package/src/cli/commands/setup.ts +9 -3
  47. package/src/cli/index.ts +3 -1
  48. package/src/cli/tui/App.tsx +1 -1
  49. package/src/cli/tui/Panels.tsx +8 -8
  50. package/src/cli/tui/theme.ts +1 -1
  51. package/src/cli/tui/views/GraphView.tsx +8 -7
  52. package/src/cli/tui/views/KnowledgeView.tsx +9 -9
  53. package/src/codegraph/auto-context.ts +169 -19
  54. package/src/codegraph/code-state.ts +95 -0
  55. package/src/codegraph/context-pack.ts +82 -1
  56. package/src/codegraph/current-facts.ts +19 -1
  57. package/src/codegraph/external-provider.ts +581 -0
  58. package/src/codegraph/lite-provider.ts +64 -19
  59. package/src/codegraph/project-context.ts +9 -1
  60. package/src/codegraph/store.ts +154 -6
  61. package/src/codegraph/task-lens.ts +49 -5
  62. package/src/codegraph/types.ts +117 -0
  63. package/src/config/resolved-config.ts +28 -0
  64. package/src/config/toml-loader.ts +3 -0
  65. package/src/config/yaml-loader.ts +6 -0
  66. package/src/dashboard/server.ts +30 -47
  67. package/src/evaluation/workset-evaluation.ts +120 -0
  68. package/src/hooks/handler.ts +48 -6
  69. package/src/knowledge/claim-store.ts +267 -0
  70. package/src/knowledge/claims.ts +587 -0
  71. package/src/knowledge/markdown.ts +129 -0
  72. package/src/knowledge/types.ts +158 -0
  73. package/src/knowledge/wiki.ts +524 -0
  74. package/src/knowledge/workflow-store.ts +168 -0
  75. package/src/knowledge/workflow-types.ts +95 -0
  76. package/src/knowledge/workflows.ts +774 -0
  77. package/src/knowledge/workset.ts +515 -0
  78. package/src/knowledge/workspace-store.ts +220 -0
  79. package/src/knowledge/workspace-types.ts +106 -0
  80. package/src/knowledge/workspace.ts +220 -0
  81. package/src/memory/auto-relations.ts +21 -0
  82. package/src/memory/graph-scope.ts +46 -0
  83. package/src/memory/observations.ts +19 -0
  84. package/src/orchestrate/verify-gate.ts +33 -10
  85. package/src/runtime/control-plane-maintenance.ts +5 -0
  86. package/src/runtime/isolated-maintenance.ts +5 -0
  87. package/src/runtime/lifecycle-status.ts +102 -0
  88. package/src/runtime/lifecycle.ts +107 -0
  89. package/src/runtime/maintenance-jobs.ts +5 -0
  90. package/src/runtime/project-maintenance.ts +190 -0
  91. package/src/server/tool-profile.ts +3 -2
  92. package/src/server.ts +424 -22
  93. package/src/store/file-lock.ts +24 -4
  94. package/src/store/sqlite-db.ts +307 -0
  95. package/src/wiki/generator.ts +4 -2
  96. package/src/wiki/knowledge-graph.ts +7 -4
  97. package/src/wiki/types.ts +16 -4
@@ -4,43 +4,123 @@
4
4
  > older notes when they conflict.
5
5
 
6
6
  ## Current State
7
- - Phase: 1.1.13 ready to publish
8
- - Branch: `codex/1.1.13-release-contract`
9
- - Last updated: 2026-07-17
10
- - Goal: make Codex global setup diagnosable end to end, remove the accidental
11
- workspace publish lane, restore the Star History chart, then publish a clean
12
- 1.1.13 before beginning 1.2 work.
13
-
14
- ## Completed Recently
15
- - Released `memorix@1.1.12`, tagged `v1.1.12`, with native Codex lifecycle
16
- hooks, Windows-safe OpenCode hook resolution, scope-isolated setup, and
17
- cache-first semantic-vector hydration.
18
- - `memorix setup --agent codex --global` now stamps the copied plugin manifest
19
- with the running Memorix version instead of leaving the template version.
20
- - `memorix doctor agents --agent codex --scope global` now reports four
21
- independently useful facts: the local bundle and declared hook contract, the
22
- Personal marketplace entry, Codex's installed/enabled plugin state, and the
23
- trusted state for each Codex lifecycle hook.
24
- - Repair only refreshes Memorix-owned files. A disabled plugin or untrusted
25
- hook remains an explicit user action in Codex's plugin/hook UI.
26
- - `@memorix/ai`, `@memorix/agent-core`, `@memorix/tui`, and
27
- `@memorix/memcode` are explicitly internal workspaces. The public release
28
- contract is the bundled root `memorix` package.
29
- - Restored the AVIDS2/memorix Star History chart at the bottom of both READMEs.
30
-
31
- ## Verification Snapshot
32
- - Focused Codex setup, hook, doctor, and release-contract regressions pass.
33
- - `npm run lint`, `npm run build`, and the full serial `npm test` suite pass.
34
- - `npm pack --dry-run` includes the root runtime, plugin templates, hooks,
35
- READMEs, and docs at `memorix@1.1.13`.
36
- - A clean normal npm installation of the tarball completed a real stdio MCP
37
- store/search call against an isolated Git repository and exposed the expected
38
- seven-tool micro profile.
39
- - An isolated real Codex CLI setup installed and enabled `memorix@personal`,
40
- stamped the manifest at `1.1.13`, and let doctor verify the bundle,
41
- marketplace, runtime state, and pending first-use hook trust separately.
42
- - The Star History embed uses Star History's current `/image` README endpoint.
43
-
44
- ## Next Steps
45
- - Push/merge/tag/publish `v1.1.13`, then create the 1.2 development baseline
46
- from the released main branch.
7
+ - Phase: 1.2 release validation and publication
8
+ - Branch: `codex/1.2.0-multidimensional-memory`
9
+ - Last updated: 2026-07-18
10
+ - Released baseline: `memorix@1.1.13`, tag `v1.1.13`, PR #129 merged as
11
+ `7e8077f`.
12
+ - Goal: turn Memorix from a useful narrative-memory layer into a task-ready
13
+ working-context layer where code state, change evidence, verification,
14
+ source-backed project knowledge, workflows, and durable decisions are ranked
15
+ together.
16
+
17
+ ## 1.1.13 Closeout
18
+ - Codex setup now stamps plugin versions and doctor distinguishes bundle,
19
+ marketplace, installed/enabled state, declared hooks, and hook trust.
20
+ - Root package publishing is isolated from internal `@memorix/*` workspaces.
21
+ - Full tests, build, pack inspection, isolated MCP smoke, isolated Codex smoke,
22
+ and Ubuntu/Windows CI all passed before release.
23
+
24
+ ## 1.2 Accepted Direction
25
+ - The [1.2 Product Story](../1.2.0-PRODUCT-STORY.md) is the canonical
26
+ user-facing narrative; the Development Charter is its implementation
27
+ contract.
28
+ - The [Knowledge and Workflow Research](../1.2.0-KNOWLEDGE-WORKFLOW-RESEARCH.md)
29
+ establishes Knowledge Workspace and Workflow Inheritance as 1.2 core product
30
+ layers, with an explicit boundary against claiming the existing memory map is
31
+ already a semantic graph or maintained LLM Wiki.
32
+ - The [1.2 Implementation Plan](../1.2.0-IMPLEMENTATION-PLAN.md) is the
33
+ execution contract for the single complete 1.2 goal. All phases are internal
34
+ gates in one continuous delivery path, not separate user approval points.
35
+ - Use the [1.2 Development Charter](../1.2.0-DEVELOPMENT-CHARTER.md) as the
36
+ working product contract.
37
+ - Keep the current SQLite CodeGraph tables and incremental refresh as the base;
38
+ do not discard working 1.1 Code Memory.
39
+ - Add versioned Code State and evidence-quality semantics before new parsers,
40
+ external providers, or user-visible tool surfaces.
41
+ - Treat natural-language `memorix_project_context` as the product surface;
42
+ internal graph/provider complexity must stay behind it.
43
+
44
+ ## Phase 0 Evaluation Foundation
45
+ - Existing UI/API projections now identify themselves honestly as a read-only
46
+ Memory Overview and deterministic Memory Map. They are not presented as a
47
+ maintained wiki or semantic graph.
48
+ - The Workset evaluation harness has fixture repositories for TypeScript,
49
+ Python, Go, docs-only, dirty worktree, deleted-symbol, and incomplete-scan
50
+ cases. Its seed manifest covers observations, Git facts, test evidence,
51
+ mini-skills, and explicit graph relations.
52
+ - The harness compares memory-only, current-context, and candidate Worksets
53
+ against source/evidence/caution requirements and variant token ceilings.
54
+ - The current Auto Context path is smoke-tested against real local TypeScript
55
+ and dirty-worktree fixtures with embeddings disabled. The candidate budget is
56
+ 180 tokens; the current baseline budget is 320 tokens.
57
+ - The former memory map remains separate from the formal Claim Ledger. Phase 2
58
+ owns claim provenance, conflict, and supersession semantics; Phase 0 only
59
+ prevents the old views from being mislabeled as those capabilities.
60
+
61
+ ## Phase 1 Code State
62
+ - Lite refresh now appends a Code State Snapshot with bounded Git revision and
63
+ worktree metadata, a source epoch, a prior-snapshot link, and explicit scan
64
+ completeness.
65
+ - Current files, symbols, edges, and current observation-code refs are marked
66
+ with the latest completed snapshot. Existing CodeGraph rows survive the
67
+ additive schema migration.
68
+ - Project Context, the CodeGraph MCP status payload, and the codegraph CLI
69
+ status output expose the latest snapshot. A non-Git directory reports
70
+ unavailable instead of clean.
71
+
72
+ ## Phase 2 Claim Ledger
73
+ - SQLite now has additive, transactional tables for claims, evidence
74
+ references, and lifecycle events. Every stored claim requires at least one
75
+ source reference and credential values are sanitized before durable writes.
76
+ - Exact normalized assertions reuse their record and attach more evidence;
77
+ competing approved assertions remain disputed rather than being overwritten.
78
+ Evidence-aware supersession preserves an audit trail.
79
+ - Explicit memories and Git-ingested facts can derive conservative claims.
80
+ Hook/model output does not become approved knowledge automatically.
81
+ - Observation code references inherit the latest Code State Snapshot when they
82
+ are created. CodeGraph refresh requalifies bound claims: changed or deleted
83
+ symbols become unknown, and incomplete scans force review instead of false
84
+ certainty.
85
+ - Unit and integration tests cover evidence validation, redaction, conflict,
86
+ supersession, model-review policy, snapshot binding, changed-symbol
87
+ requalification, and compact task selection.
88
+
89
+ ## Phase 3 Knowledge Workspace
90
+ - Memorix now initializes a private local Markdown workspace by default. A
91
+ versioned workspace requires an explicit absolute path inside the Git project
92
+ and refuses ignored or unsafe target directories.
93
+ - Approved active claims compile into Markdown proposals with frontmatter,
94
+ source claim ids, evidence references, snapshot context, a catalog, and an
95
+ append-only change log. Proposed pages are not silently published.
96
+ - The knowledge init, status, compile, apply, and lint commands provide the
97
+ operator path. Applying a proposal protects a manual page edit by default;
98
+ an explicit force flag is the only overwrite path and is logged.
99
+ - Workspace lint detects malformed frontmatter, broken links, orphan pages,
100
+ missing claims/evidence, superseded claims, unresolved conflicts, stale code
101
+ snapshots, and protected manual edits.
102
+ - The compiled CLI was smoke-tested in an isolated Git project through init,
103
+ compile, apply, and lint with a source-backed claim.
104
+
105
+ ## 1.2 Delivery Complete, Release Checks In Progress
106
+ - Phase 4 added canonical Markdown workflows, safe adapter preview/apply, import,
107
+ selection, and verification receipts. Agent instruction files are render
108
+ targets, not the workflow source of truth.
109
+ - Phase 5 routes Project Context and Context Pack through one bounded Workset
110
+ assembler. It ranks current facts, claims, knowledge pages, workflows, and
111
+ cautions instead of dumping unrelated narrative memory.
112
+ - Phase 6 makes refresh, claim derivation/requalification, knowledge
113
+ compile/lint, workflow indexing, retention, and consolidation durable
114
+ maintenance work. Interactive MCP requests do not scan an entire corpus.
115
+ - Phase 7 adds an optional local semantic CodeGraph boundary. Lite remains the
116
+ durable local fallback; external output is used only from a healthy existing
117
+ `.codegraph` index, is validated, bounded, and never persisted as raw code.
118
+ - The advanced `memorix_knowledge` MCP action tool now exposes explicit
119
+ workspace/proposal/workflow management only in `team` and `full` profiles.
120
+ - Completed local release gates: lint, full test suite, production build,
121
+ package-content audit, isolated Windows npm install, stdio MCP smoke, and
122
+ HTTP dashboard/lifecycle smoke.
123
+ - Release audit also incorporated #130 before publication: the optional SQLite
124
+ runtime now uses the Node-26-compatible `better-sqlite3` 12.x line, with a
125
+ dedicated Node 26 CI smoke that opens an in-memory database.
126
+ - Remaining remote gates: GitHub CI, npm publish, tag, and GitHub release.
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: memorix-release
3
+ title: Memorix release
4
+ description: Prepare a Memorix release with evidence, package verification, and explicit maintainer approval.
5
+ status: active
6
+ version: 1
7
+ taskLenses: [release]
8
+ triggers: [release, publish, npm, version, changelog]
9
+ allowedAgents: [codex, claude-code, cursor, windsurf, copilot, antigravity, gemini-cli, openclaw, hermes, omp, kiro, opencode, trae]
10
+ verificationGates:
11
+ - Version and changelog match the release scope
12
+ - npm run lint passes
13
+ - npm run build passes
14
+ - npm test passes
15
+ - Focused live MCP smoke passes when server behavior changed
16
+ - Package smoke passes
17
+ - CI passes on the release commit
18
+ - Maintainer approval is explicit before publishing
19
+ ---
20
+
21
+ ## Inspect
22
+
23
+ Read the current version, changelog, Git state, open release risks, and the
24
+ diff that will ship. Do not treat a release tag, an old test run, or a local
25
+ token as proof that this exact commit is ready.
26
+
27
+ ## Prepare
28
+
29
+ Update version metadata, changelog, and user-facing documentation only for
30
+ changes that are actually included. Keep package workspace visibility and npm
31
+ access settings unchanged unless the release specifically changes them.
32
+
33
+ ## Verify
34
+
35
+ Run `npm run lint`, `npm run build`, and `npm test`. Run focused tests for the
36
+ changed surface. When MCP behavior changed, use a real isolated stdio client to
37
+ exercise the affected tool path. Inspect `npm pack --dry-run --json` and run a
38
+ package smoke from the packed artifact when packaging changed.
39
+
40
+ ## Review
41
+
42
+ Record what passed, what was not run, and any remaining risk. Confirm that the
43
+ release commit has passing CI. A workflow may prepare evidence, but publishing
44
+ requires explicit maintainer approval.
45
+
46
+ ## Publish
47
+
48
+ After explicit maintainer approval, publish through the approved release path.
49
+ Never put credentials in the repository, release notes, workflow files, or
50
+ command output. Verify the published package version without exposing tokens.
51
+
52
+ ## Follow Up
53
+
54
+ Check a fresh install or `npx` invocation, create or update the GitHub release
55
+ if appropriate, and reply to affected issue reporters with the concrete fix and
56
+ version. Store the verification evidence as project knowledge rather than an
57
+ unstructured chat note.
package/llms-full.txt CHANGED
@@ -2,10 +2,23 @@
2
2
 
3
3
  > Local-first shared memory layer for AI coding agents.
4
4
 
5
- Memorix is a TypeScript/Node.js project that gives AI coding agents persistent, project-aware memory. It targets software development workflows, not generic chat. It works across Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, Pi, Kiro, Antigravity, Trae, and any agent that can speak MCP over stdio or HTTP. Integrations usually start with `memorix setup --agent <agent> --global`, which installs the recommended user-level package or config for that agent: plugin packages when supported, package or extension entries, MCP config, generated guidance, hooks, skills, or the bundled terminal agent.
5
+ Memorix is a TypeScript/Node.js project that gives AI coding agents persistent, project-aware memory. It targets software development workflows, not generic chat. It works across Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, and any agent that can speak MCP over stdio or HTTP. Integrations usually start with `memorix setup --agent <agent> --global`, which installs the recommended user-level package or config for that agent: plugin packages when supported, package or extension entries, MCP config, generated guidance, hooks, skills, or the bundled terminal agent.
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
10
+
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
+
13
+ - **Observation, Reasoning, and Git Memory** preserve durable engineering facts.
14
+ - **Code State** records versioned local file, symbol, import, and memory-to-code links so prior evidence can be requalified when code moves.
15
+ - **Claim Ledger** keeps provenance, confidence, conflicts, and lifecycle state separate from prose.
16
+ - **Knowledge Workspace** compiles claims into reviewable Markdown proposals; it does not silently overwrite manually edited pages.
17
+ - **Canonical Workflows** represent project process once and render conservative agent-specific adapters only on explicit request.
18
+ - **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
+ 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.
21
+
9
22
  ## Entry Points
10
23
 
11
24
  ### Setup package
@@ -348,7 +361,7 @@ Docker is for the HTTP service. The container must have access to the repositori
348
361
 
349
362
  ## Supported Clients
350
363
 
351
- Memorix supports Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, Pi, Kiro, Antigravity, Trae, memcode, and other stdio or HTTP MCP clients.
364
+ Memorix supports Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, memcode, and other stdio or HTTP MCP clients.
352
365
 
353
366
  Support depth differs by client:
354
367
 
@@ -356,6 +369,7 @@ Support depth differs by client:
356
369
  - MCP is the common integration layer.
357
370
  - Claude Code, Codex, and GitHub Copilot CLI receive local plugin packages.
358
371
  - Pi receives a user-level package when setup runs with `--global`; Gemini CLI receives a local extension package.
372
+ - OpenClaw receives a compatible bundle; Hermes Agent receives a plugin package; Oh-my-Pi receives a package/extension entry.
359
373
  - Project instructions and rules include AGENTS.md, GEMINI.md, Cursor rules, Windsurf rules, Kiro steering, and Trae rules.
360
374
  - Hooks are generated for agents that expose usable hook events.
361
375
  - OpenCode receives a local plugin file at `.opencode/plugins/memorix.js`, an OpenCode skill at `.opencode/skills/memorix-memory/SKILL.md`, plus `opencode.json` MCP config.
package/llms.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Local-first shared memory layer for AI coding agents.
4
4
 
5
- Memorix gives coding agents persistent, project-aware memory across sessions, IDEs, terminals, and MCP clients. It stores project knowledge once so multiple agents can retrieve it through plugin packages, MCP, CLI, SDK, generated rules/instructions, hooks, skills, local plugins, or the bundled terminal agent. It works with Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, Pi, Kiro, Antigravity, Trae, and other MCP-capable agents.
5
+ Memorix gives coding agents persistent, project-aware memory across sessions, IDEs, terminals, and MCP clients. It stores project knowledge once so multiple agents can retrieve it through plugin packages, MCP, CLI, SDK, generated rules/instructions, hooks, skills, local plugins, or the bundled terminal agent. It works with Claude Code, Codex, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, and other MCP-capable agents.
6
6
 
7
7
  ## Entry Points
8
8
 
@@ -10,20 +10,25 @@ Memorix gives coding agents persistent, project-aware memory across sessions, ID
10
10
  - `memorix setup --list` lists supported agent entry points.
11
11
  - `memorix serve` starts the manual stdio MCP server for IDEs and agents.
12
12
  - `memorix background start` starts the HTTP MCP service and dashboard.
13
- - `memorix memory`, `reasoning`, `session`, `team`, `task`, `handoff`, `poll`, `receipt`, `sync`, `ingest`, and `orchestrate` expose the CLI command set.
13
+ - `memorix memory`, `codegraph`, `knowledge`, `reasoning`, `session`, `team`, `task`, `handoff`, `poll`, `receipt`, `sync`, `ingest`, and `orchestrate` expose the CLI command set.
14
14
  - `memorix integrate --agent <agent>` and `memorix hooks install --agent <agent>` are manual/fallback generation commands.
15
15
  - `memorix` and `memcode` open memcode, the bundled terminal agent that uses the same project memory pool.
16
16
  - `memorix dashboard` opens the local read-mostly dashboard.
17
17
 
18
18
  ## Memory Model
19
19
 
20
- Memorix combines three layers:
20
+ Memorix combines durable memory with a bounded task Workset:
21
21
 
22
22
  - **Observation Memory**: facts, gotchas, fixes, implementation notes, what changed
23
23
  - **Reasoning Memory**: why decisions were made, alternatives, constraints, risks
24
24
  - **Git Memory**: commit-derived engineering facts with source provenance
25
+ - **Code State**: versioned local file/symbol/import facts and freshness links that keep memory tied to the current checkout
26
+ - **Claim Ledger and Knowledge Workspace**: source-backed claims compiled into reviewable Markdown proposals, never silent overwrites
27
+ - **Canonical Workflows**: project workflows with safe per-agent adapters and recorded verification outcomes
25
28
 
26
- Search is project-scoped by default. Use global scope only when cross-project recall is intentional.
29
+ 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
+ The built-in CodeGraph Lite index is structural and intentionally not presented as a complete semantic graph. A project that already has a healthy local CodeGraph index can contribute a small validated semantic outline through `[codegraph].external_context = "auto"`; Memorix never initializes, syncs, exports, or remotely uploads that index.
27
32
 
28
33
  ## memcode
29
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memorix",
3
- "version": "1.1.13",
3
+ "version": "1.2.1",
4
4
  "description": "Local-first shared memory layer for AI coding agents across MCP clients, Git history, reasoning context, and project sessions.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -61,6 +61,7 @@
61
61
  "test:watch": "vitest",
62
62
  "test:llm-live": "MEMORIX_RUN_LIVE_LLM_TESTS=1 vitest run tests/integration/formation-llm-quality.test.ts",
63
63
  "test:e2e": "vitest run tests/e2e/",
64
+ "benchmark:codegraph": "node scripts/benchmark-codegraph-provider.cjs",
64
65
  "lint": "tsc --noEmit",
65
66
  "prepublishOnly": "npm run build && npm test"
66
67
  },
@@ -137,7 +138,7 @@
137
138
  },
138
139
  "optionalDependencies": {
139
140
  "@huggingface/transformers": "^3.0.0",
140
- "better-sqlite3": "^11.0.0"
141
+ "better-sqlite3": "^12.11.1"
141
142
  },
142
143
  "overrides": {
143
144
  "tar": "^7.5.16",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memorix",
3
- "version": "1.1.13",
3
+ "version": "1.2.1",
4
4
  "description": "Shared workspace memory for Codex and other AI coding agents.",
5
5
  "author": {
6
6
  "name": "AVIDS2",
@@ -6,6 +6,7 @@ export const CLI_NATIVE_PARITY: Record<string, string> = Object.freeze({
6
6
  memorix_project_context: 'memorix context',
7
7
  memorix_context_pack: 'memorix codegraph context-pack',
8
8
  memorix_codegraph_status: 'memorix codegraph status',
9
+ memorix_knowledge: 'memorix knowledge init|status|compile|lint|apply|workflow',
9
10
  memorix_resolve: 'memorix memory resolve',
10
11
  memorix_timeline: 'memorix memory timeline',
11
12
  memorix_suggest_topic_key: 'memorix memory suggest-topic-key',
@@ -1,20 +1,54 @@
1
1
  import { defineCommand } from 'citty';
2
2
  import { CodeGraphStore } from '../../codegraph/store.js';
3
3
  import { refreshProjectLite } from '../../codegraph/lite-provider.js';
4
- import { assembleContextPackForTask, buildContextPackPrompt } from '../../codegraph/context-pack.js';
4
+ import { assembleContextPackForTask, attachTaskWorkset, buildContextPackPrompt } from '../../codegraph/context-pack.js';
5
5
  import { backfillMissingObservationCodeRefs } from '../../codegraph/binder.js';
6
+ import { collectCurrentProjectFacts, formatGitFact } from '../../codegraph/current-facts.js';
7
+ import { resolveTaskLens } from '../../codegraph/task-lens.js';
8
+ import { getExternalCodeGraphContext, inspectExternalCodeGraph } from '../../codegraph/external-provider.js';
9
+ import type { CodeGraphProviderQuality } from '../../codegraph/types.js';
6
10
  import { getResolvedConfig } from '../../config/resolved-config.js';
7
11
  import { getAllObservations } from '../../memory/observations.js';
8
12
  import { emitError, emitResult, getCliProjectContext, parsePositiveInt } from './operator-shared.js';
9
13
 
10
- function formatStatus(status: ReturnType<CodeGraphStore['status']>): string {
14
+ function formatSnapshotStatus(status: ReturnType<CodeGraphStore['status']>): string[] {
15
+ const snapshot = status.latestSnapshot;
16
+ if (!snapshot) return ['- Code state: no completed snapshot yet'];
17
+ const revision = snapshot.baseRevision ? snapshot.baseRevision.slice(0, 12) : 'Git unavailable';
18
+ const completeness = snapshot.completeness;
19
+ const scanState = completeness.skippedOversizedFiles > 0
20
+ || (completeness.unreadableFiles ?? 0) > 0
21
+ || completeness.removalScanDeferred
22
+ ? 'incomplete'
23
+ : 'complete';
11
24
  return [
25
+ '- Code state: ' + revision
26
+ + ', ' + snapshot.worktreeState + ' worktree'
27
+ + ', ' + snapshot.changedPathCount + ' changed path(s)'
28
+ + ', epoch ' + snapshot.sourceEpoch,
29
+ '- Scan completeness: ' + scanState
30
+ + ' (' + completeness.scannedFiles + '/' + completeness.maxFiles + ' paths'
31
+ + ', ' + completeness.skippedOversizedFiles + ' oversized skipped'
32
+ + ', ' + (completeness.unreadableFiles ?? 0) + ' unreadable)',
33
+ ];
34
+ }
35
+
36
+ function formatStatus(status: ReturnType<CodeGraphStore['status']>, quality?: CodeGraphProviderQuality): string {
37
+ return [
38
+ ...formatSnapshotStatus(status),
12
39
  `CodeGraph Memory: ${status.provider}`,
13
40
  `- Files: ${status.files}`,
14
41
  `- Symbols: ${status.symbols}`,
15
42
  `- Edges: ${status.edges}`,
16
43
  `- Memory refs: ${status.refs}`,
17
44
  status.indexedAt ? `- Indexed at: ${status.indexedAt}` : '- Indexed at: never',
45
+ ...(quality
46
+ ? [
47
+ `- Persistent provider: ${status.provider} (heuristic local index)`,
48
+ `- External semantic CodeGraph: ${quality.external.state}`
49
+ + (quality.external.reason ? ` (${quality.external.reason})` : ''),
50
+ ]
51
+ : []),
18
52
  ].join('\n');
19
53
  }
20
54
 
@@ -29,6 +63,18 @@ function formatUsageHint(): string {
29
63
  ].join('\n');
30
64
  }
31
65
 
66
+ function compactFacts(project: { rootPath: string }): { facts: string[]; dirty: boolean } {
67
+ const current = collectCurrentProjectFacts({ project, now: new Date() });
68
+ const facts: string[] = [];
69
+ if (current.packageVersion) facts.push('Package version: ' + current.packageVersion);
70
+ if (current.latestChangelog) {
71
+ facts.push('Latest changelog: ' + current.latestChangelog.version
72
+ + (current.latestChangelog.date ? ' (' + current.latestChangelog.date + ')' : ''));
73
+ }
74
+ facts.push(formatGitFact(current.git));
75
+ return { facts, dirty: current.git.dirty };
76
+ }
77
+
32
78
  export default defineCommand({
33
79
  meta: {
34
80
  name: 'codegraph',
@@ -56,10 +102,16 @@ export default defineCommand({
56
102
  switch (action) {
57
103
  case 'status': {
58
104
  const status = store.status(project.id);
105
+ const providerQuality = await inspectExternalCodeGraph({
106
+ projectRoot: project.rootPath,
107
+ mode: codegraphConfig.externalContext,
108
+ command: codegraphConfig.externalCommand,
109
+ timeoutMs: codegraphConfig.externalTimeoutMs,
110
+ });
59
111
  const text = explicitAction || asJson
60
- ? formatStatus(status)
61
- : `${formatStatus(status)}\n\n${formatUsageHint()}`;
62
- emitResult({ project, status }, text, asJson);
112
+ ? formatStatus(status, providerQuality.quality)
113
+ : `${formatStatus(status, providerQuality.quality)}\n\n${formatUsageHint()}`;
114
+ emitResult({ project, status, providerQuality: providerQuality.quality }, text, asJson);
63
115
  return;
64
116
  }
65
117
 
@@ -73,12 +125,25 @@ export default defineCommand({
73
125
  const activeObservations = getAllObservations()
74
126
  .filter(obs => obs.projectId === project.id && (obs.status ?? 'active') === 'active');
75
127
  const backfill = await backfillMissingObservationCodeRefs(store, activeObservations);
128
+ const { enqueueClaimRequalification } = await import('../../runtime/lifecycle.js');
129
+ enqueueClaimRequalification({
130
+ dataDir,
131
+ projectId: project.id,
132
+ source: 'manual-codegraph-refresh',
133
+ snapshotId: refresh.snapshot.id,
134
+ });
76
135
  const status = store.status(project.id);
136
+ const providerQuality = await inspectExternalCodeGraph({
137
+ projectRoot: project.rootPath,
138
+ mode: codegraphConfig.externalContext,
139
+ command: codegraphConfig.externalCommand,
140
+ timeoutMs: codegraphConfig.externalTimeoutMs,
141
+ });
77
142
  emitResult(
78
- { project, status, refresh, backfill },
143
+ { project, status, providerQuality: providerQuality.quality, refresh, backfill },
79
144
  [
80
145
  'CodeGraph Memory refreshed.',
81
- formatStatus(status),
146
+ formatStatus(status, providerQuality.quality),
82
147
  `- Files: ${refresh.changedFiles} changed, ${refresh.unchangedFiles} unchanged, ${refresh.removedFiles} removed`,
83
148
  `- Backfilled memories: ${backfill.observationsBackfilled}`,
84
149
  `- Backfilled refs: ${backfill.refsBackfilled}`,
@@ -98,7 +163,7 @@ export default defineCommand({
98
163
  const observations = getAllObservations()
99
164
  .filter(obs => obs.projectId === project.id && (obs.status ?? 'active') === 'active')
100
165
  .reverse();
101
- const pack = assembleContextPackForTask({
166
+ const basePack = assembleContextPackForTask({
102
167
  store,
103
168
  projectId: project.id,
104
169
  task,
@@ -106,7 +171,44 @@ export default defineCommand({
106
171
  limit,
107
172
  exclude,
108
173
  });
109
- emitResult({ project, pack }, buildContextPackPrompt(pack), asJson);
174
+ const status = store.status(project.id);
175
+ const facts = compactFacts(project);
176
+ const snapshot = status.latestSnapshot;
177
+ const external = await getExternalCodeGraphContext({
178
+ projectRoot: project.rootPath,
179
+ task,
180
+ exclude,
181
+ mode: codegraphConfig.externalContext,
182
+ command: codegraphConfig.externalCommand,
183
+ timeoutMs: codegraphConfig.externalTimeoutMs,
184
+ });
185
+ const pack = await attachTaskWorkset({
186
+ pack: basePack,
187
+ projectId: project.id,
188
+ dataDir,
189
+ lens: resolveTaskLens(task).id,
190
+ worktreeDirty: facts.dirty,
191
+ currentFacts: facts.facts,
192
+ codeState: formatSnapshotStatus(status).join(' '),
193
+ ...(snapshot
194
+ ? {
195
+ snapshot: {
196
+ id: snapshot.id,
197
+ sourceEpoch: snapshot.sourceEpoch,
198
+ worktreeState: snapshot.worktreeState,
199
+ incomplete: snapshot.completeness.skippedOversizedFiles > 0
200
+ || (snapshot.completeness.unreadableFiles ?? 0) > 0
201
+ || snapshot.completeness.removalScanDeferred,
202
+ },
203
+ }
204
+ : {}),
205
+ ...(external.outline ? { semanticCode: external.outline } : {}),
206
+ providerQuality: external.quality,
207
+ ...(external.caution
208
+ ? { runtimeCautions: [{ kind: 'external-codegraph-fallback' as const, message: external.caution }] }
209
+ : {}),
210
+ });
211
+ emitResult({ project, pack, providerQuality: external.quality }, buildContextPackPrompt(pack), asJson);
110
212
  return;
111
213
  }
112
214
 
@@ -45,6 +45,8 @@ export default defineCommand({
45
45
  currentFacts: context.currentFacts,
46
46
  overview: context.overview,
47
47
  refresh: context.refresh,
48
+ providerQuality: context.providerQuality,
49
+ workset: context.workset,
48
50
  ...(context.task ? { task: context.task } : {}),
49
51
  },
50
52
  formatAutoProjectContextPrompt(context),