memorix 1.9.12 → 1.10.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 (46) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/cli/index.js +549 -101
  3. package/dist/index.d.ts +46 -0
  4. package/dist/index.js +271 -27
  5. package/dist/maintenance-runner.js +143 -3
  6. package/dist/media-audio-runner.js +143 -3
  7. package/dist/media-video-runner.js +143 -3
  8. package/dist/memcode/index.js +124 -8
  9. package/dist/memcode-runtime/CHANGELOG.md +20 -1
  10. package/dist/sdk.js +270 -26
  11. package/dist/vector-backfill-runner.js +143 -3
  12. package/docs/1.2.0-EVALUATION-HARNESS.md +88 -0
  13. package/docs/1.3-MEMORY-ARCHITECTURE.md +31 -0
  14. package/docs/API_REFERENCE.md +19 -0
  15. package/docs/DEVELOPMENT.md +16 -3
  16. package/docs/INTEGRATIONS.md +25 -0
  17. package/docs/PERFORMANCE.md +21 -6
  18. package/docs/README.md +4 -4
  19. package/docs/ROADMAP-1.9.12-2.0.md +92 -7
  20. package/package.json +3 -1
  21. package/plugins/antigravity/memorix/plugin.json +1 -1
  22. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  23. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  24. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  25. package/plugins/copilot/memorix/plugin.json +1 -1
  26. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  27. package/plugins/hermes/memorix/plugin.yaml +1 -1
  28. package/plugins/omp/memorix/package.json +1 -1
  29. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  30. package/plugins/pi/memorix/package.json +1 -1
  31. package/server.json +2 -2
  32. package/src/cli/commands/agent-integrations.ts +164 -7
  33. package/src/cli/commands/memory.ts +1 -1
  34. package/src/cli/commands/serve-http.ts +30 -1
  35. package/src/cli/commands/setup.ts +5 -21
  36. package/src/codegraph/auto-context.ts +5 -0
  37. package/src/codegraph/context-pack.ts +4 -0
  38. package/src/compact/engine.ts +43 -2
  39. package/src/evaluation/context-task-matrix.ts +247 -0
  40. package/src/evaluation/context-task-runner.ts +175 -0
  41. package/src/integrations/registry.ts +191 -4
  42. package/src/knowledge/context-assembly.ts +33 -2
  43. package/src/knowledge/workset.ts +35 -3
  44. package/src/server/request-context.ts +96 -0
  45. package/src/server.ts +16 -4
  46. package/src/store/orama-store.ts +54 -0
@@ -7151,6 +7151,7 @@ __export(orama_store_exports, {
7151
7151
  getActiveSemanticIndexProfile: () => getActiveSemanticIndexProfile,
7152
7152
  getDb: () => getDb,
7153
7153
  getDeferredCachedVectorHydration: () => getDeferredCachedVectorHydration,
7154
+ getLastSearchDiagnostics: () => getLastSearchDiagnostics,
7154
7155
  getLastSearchMode: () => getLastSearchMode,
7155
7156
  getObservationCount: () => getObservationCount,
7156
7157
  getObservationsByIds: () => getObservationsByIds,
@@ -7180,6 +7181,18 @@ function rememberSearchMode(key, value) {
7180
7181
  function getLastSearchMode(projectId) {
7181
7182
  return lastSearchModeByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY) ?? "fulltext";
7182
7183
  }
7184
+ function getLastSearchDiagnostics(projectId) {
7185
+ const diagnostics = lastSearchDiagnosticsByProject.get(projectId ?? SEARCH_MODE_DEFAULT_KEY);
7186
+ return diagnostics ? { ...diagnostics } : void 0;
7187
+ }
7188
+ function rememberSearchDiagnostics(key, value) {
7189
+ if (!lastSearchDiagnosticsByProject.has(key) && lastSearchDiagnosticsByProject.size >= MAX_SEARCH_MODE_KEYS) {
7190
+ const oldest = lastSearchDiagnosticsByProject.keys().next().value;
7191
+ if (oldest !== void 0) lastSearchDiagnosticsByProject.delete(oldest);
7192
+ }
7193
+ lastSearchDiagnosticsByProject.delete(key);
7194
+ lastSearchDiagnosticsByProject.set(key, value);
7195
+ }
7183
7196
  function getOptionalObservationStore() {
7184
7197
  try {
7185
7198
  return getObservationStore();
@@ -7462,6 +7475,7 @@ async function resetDb() {
7462
7475
  indexEmbeddingProvider = null;
7463
7476
  deferredCachedVectorHydration = null;
7464
7477
  lastSearchModeByProject.clear();
7478
+ lastSearchDiagnosticsByProject.clear();
7465
7479
  }
7466
7480
  function isEmbeddingEnabled() {
7467
7481
  return embeddingEnabled;
@@ -7679,6 +7693,7 @@ async function removeObservation(oramaId) {
7679
7693
  await remove2(database, oramaId);
7680
7694
  }
7681
7695
  async function searchObservations(options) {
7696
+ const searchStartedAt = Date.now();
7682
7697
  const perf = !!process.env.MEMORIX_PERF;
7683
7698
  const t0 = perf ? performance.now() : 0;
7684
7699
  const mark = (label) => {
@@ -7754,6 +7769,8 @@ async function searchObservations(options) {
7754
7769
  let queryVector = null;
7755
7770
  let embeddingProviderForSearch = null;
7756
7771
  let embeddingUnavailable = false;
7772
+ let fallbackUsed = false;
7773
+ let fallbackReason;
7757
7774
  if (quality !== "fast" && embeddingEnabled && hasQuery && tier !== "fast") {
7758
7775
  try {
7759
7776
  const provider2 = await getEmbeddingProvider();
@@ -7762,6 +7779,8 @@ async function searchObservations(options) {
7762
7779
  const activeVectorDimensions = getVectorDimensions();
7763
7780
  if (activeVectorDimensions !== null && provider2.dimensions !== activeVectorDimensions) {
7764
7781
  embeddingUnavailable = true;
7782
+ fallbackUsed = true;
7783
+ fallbackReason = "embedding dimension mismatch; lexical search used";
7765
7784
  rememberSearchMode(
7766
7785
  modeKey,
7767
7786
  `fulltext (embedding dimension mismatch: provider ${provider2.dimensions}d vs index ${activeVectorDimensions}d)`
@@ -7803,9 +7822,13 @@ async function searchObservations(options) {
7803
7822
  }
7804
7823
  } else {
7805
7824
  embeddingUnavailable = true;
7825
+ fallbackUsed = true;
7826
+ fallbackReason = "embedding provider unavailable; lexical search used";
7806
7827
  }
7807
7828
  } catch (error) {
7808
7829
  embeddingUnavailable = true;
7830
+ fallbackUsed = true;
7831
+ fallbackReason = "embedding failed or timed out; lexical search used";
7809
7832
  rememberSearchMode(modeKey, "fulltext (embedding unavailable)");
7810
7833
  console.error("[memorix] Embedding failed or timed out, falling back to fulltext search");
7811
7834
  }
@@ -7855,6 +7878,8 @@ async function searchObservations(options) {
7855
7878
  similarity: 0.25
7856
7879
  };
7857
7880
  rememberSearchMode(modeKey, "vector-only (hybrid empty fallback)");
7881
+ fallbackUsed = true;
7882
+ fallbackReason = "hybrid search returned no results; vector-only fallback used";
7858
7883
  results = await search(database, vectorOnlyParams);
7859
7884
  } catch {
7860
7885
  }
@@ -8128,6 +8153,7 @@ async function searchObservations(options) {
8128
8153
  mark(`rerank(skipped,tier=${tier})`);
8129
8154
  }
8130
8155
  let entries = intermediate.map(({ rawTime: _, _isCommandLog: _c, ...rest }) => rest);
8156
+ const candidateCount = entries.length;
8131
8157
  for (const hit of results.hits) {
8132
8158
  const doc = hit.document;
8133
8159
  if (canReadObservation(doc, options.reader, projectIds ?? void 0)) rememberObservationDoc(doc);
@@ -8170,9 +8196,22 @@ async function searchObservations(options) {
8170
8196
  }
8171
8197
  }
8172
8198
  }
8199
+ const beforeTokenBudget = entries.length;
8173
8200
  if (options.maxTokens && options.maxTokens > 0) {
8174
8201
  entries = applyTokenBudget(entries, options.maxTokens);
8175
8202
  }
8203
+ rememberSearchDiagnostics(modeKey, {
8204
+ version: "1",
8205
+ mode: getLastSearchMode(options.projectId),
8206
+ rawCandidateCount: results.hits.length,
8207
+ candidateCount,
8208
+ selectedCount: entries.length,
8209
+ omittedCount: Math.max(0, candidateCount - entries.length),
8210
+ omittedByTokenBudget: Math.max(0, beforeTokenBudget - entries.length),
8211
+ fallbackUsed,
8212
+ ...fallbackReason ? { fallbackReason } : {},
8213
+ elapsedMs: Math.max(0, Date.now() - searchStartedAt)
8214
+ });
8176
8215
  if (options.trackAccess !== false) {
8177
8216
  const returnedKeys = new Set(entries.map((entry) => makeEntryKey(entry.projectId, entry.id)));
8178
8217
  const hitDocs = results.hits.map((hit) => ({ id: hit.id, doc: hit.document })).filter(({ doc }) => returnedKeys.has(makeEntryKey(doc.projectId, doc.observationId)));
@@ -8288,7 +8327,7 @@ function formatTime(isoDate) {
8288
8327
  return isoDate;
8289
8328
  }
8290
8329
  }
8291
- var db, dbInitPromise, dbGeneration, embeddingEnabled, embeddingDimensions, indexEmbeddingProvider, deferredCachedVectorHydration, NON_CJK_HYBRID_SIMILARITY, CJK_RUN, lastSearchModeByProject, SEARCH_MODE_DEFAULT_KEY, MAX_SEARCH_MODE_KEYS, COMMAND_LOG_TITLE, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
8330
+ var db, dbInitPromise, dbGeneration, embeddingEnabled, embeddingDimensions, indexEmbeddingProvider, deferredCachedVectorHydration, NON_CJK_HYBRID_SIMILARITY, CJK_RUN, lastSearchModeByProject, lastSearchDiagnosticsByProject, SEARCH_MODE_DEFAULT_KEY, MAX_SEARCH_MODE_KEYS, COMMAND_LOG_TITLE, COMMAND_STYLE_TITLE, COMMAND_LIKE_QUERY2, COMMAND_INTENT_QUERY, NATURAL_LANGUAGE_MARKERS;
8292
8331
  var init_orama_store = __esm({
8293
8332
  "src/store/orama-store.ts"() {
8294
8333
  "use strict";
@@ -8314,6 +8353,7 @@ var init_orama_store = __esm({
8314
8353
  NON_CJK_HYBRID_SIMILARITY = 0.45;
8315
8354
  CJK_RUN = /[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff\uac00-\ud7af]+/gu;
8316
8355
  lastSearchModeByProject = /* @__PURE__ */ new Map();
8356
+ lastSearchDiagnosticsByProject = /* @__PURE__ */ new Map();
8317
8357
  SEARCH_MODE_DEFAULT_KEY = "__global__";
8318
8358
  MAX_SEARCH_MODE_KEYS = 4096;
8319
8359
  COMMAND_LOG_TITLE = /^(Ran:|Command:|Executed:)\s/i;
@@ -35999,6 +36039,25 @@ var init_models_generated = __esm({
35999
36039
  }
36000
36040
  },
36001
36041
  "minimax": {
36042
+ "MiniMax-M3.1-Flash": {
36043
+ id: "MiniMax-M3.1-Flash",
36044
+ name: "MiniMax-M3.1-Flash",
36045
+ api: "anthropic-messages",
36046
+ provider: "minimax",
36047
+ baseUrl: "https://api.minimax.io/anthropic",
36048
+ compat: { "forceAdaptiveThinking": true },
36049
+ reasoning: true,
36050
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
36051
+ input: ["text", "image", "video"],
36052
+ cost: {
36053
+ input: 0.15,
36054
+ output: 0.6,
36055
+ cacheRead: 0.015,
36056
+ cacheWrite: 0
36057
+ },
36058
+ contextWindow: 1e6,
36059
+ maxTokens: 524288
36060
+ },
36002
36061
  "MiniMax-M2.7": {
36003
36062
  id: "MiniMax-M2.7",
36004
36063
  name: "MiniMax-M2.7",
@@ -36039,6 +36098,7 @@ var init_models_generated = __esm({
36039
36098
  api: "anthropic-messages",
36040
36099
  provider: "minimax",
36041
36100
  baseUrl: "https://api.minimax.io/anthropic",
36101
+ compat: { "forceAdaptiveThinking": true },
36042
36102
  reasoning: true,
36043
36103
  input: ["text", "image", "video"],
36044
36104
  cost: {
@@ -36048,10 +36108,29 @@ var init_models_generated = __esm({
36048
36108
  cacheWrite: 0
36049
36109
  },
36050
36110
  contextWindow: 1e6,
36051
- maxTokens: 128e3
36111
+ maxTokens: 524288
36052
36112
  }
36053
36113
  },
36054
36114
  "minimax-cn": {
36115
+ "MiniMax-M3.1-Flash": {
36116
+ id: "MiniMax-M3.1-Flash",
36117
+ name: "MiniMax-M3.1-Flash",
36118
+ api: "anthropic-messages",
36119
+ provider: "minimax-cn",
36120
+ baseUrl: "https://api.minimaxi.com/anthropic",
36121
+ compat: { "forceAdaptiveThinking": true },
36122
+ reasoning: true,
36123
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
36124
+ input: ["text", "image", "video"],
36125
+ cost: {
36126
+ input: 0.15,
36127
+ output: 0.6,
36128
+ cacheRead: 0.015,
36129
+ cacheWrite: 0
36130
+ },
36131
+ contextWindow: 1e6,
36132
+ maxTokens: 524288
36133
+ },
36055
36134
  "MiniMax-M2.7": {
36056
36135
  id: "MiniMax-M2.7",
36057
36136
  name: "MiniMax-M2.7",
@@ -36092,6 +36171,7 @@ var init_models_generated = __esm({
36092
36171
  api: "anthropic-messages",
36093
36172
  provider: "minimax-cn",
36094
36173
  baseUrl: "https://api.minimaxi.com/anthropic",
36174
+ compat: { "forceAdaptiveThinking": true },
36095
36175
  reasoning: true,
36096
36176
  input: ["text", "image", "video"],
36097
36177
  cost: {
@@ -36101,7 +36181,7 @@ var init_models_generated = __esm({
36101
36181
  cacheWrite: 0
36102
36182
  },
36103
36183
  contextWindow: 1e6,
36104
- maxTokens: 128e3
36184
+ maxTokens: 524288
36105
36185
  }
36106
36186
  },
36107
36187
  "mistral": {
@@ -39222,6 +39302,24 @@ var init_models_generated = __esm({
39222
39302
  }
39223
39303
  },
39224
39304
  "openrouter": {
39305
+ "minimax/minimax-m3.1-flash:free": {
39306
+ id: "minimax/minimax-m3.1-flash:free",
39307
+ name: "MiniMax: MiniMax M3.1 Flash (free)",
39308
+ api: "openai-completions",
39309
+ provider: "openrouter",
39310
+ baseUrl: "https://openrouter.ai/api/v1",
39311
+ reasoning: true,
39312
+ thinkingLevelMap: { "off": null, "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": "xhigh" },
39313
+ input: ["text", "image"],
39314
+ cost: {
39315
+ input: 0,
39316
+ output: 0,
39317
+ cacheRead: 0,
39318
+ cacheWrite: 0
39319
+ },
39320
+ contextWindow: 1e6,
39321
+ maxTokens: 524288
39322
+ },
39225
39323
  "ai21/jamba-large-1.7": {
39226
39324
  id: "ai21/jamba-large-1.7",
39227
39325
  name: "AI21: Jamba Large 1.7",
@@ -47923,6 +48021,14 @@ var init_models_generated = __esm({
47923
48021
  }
47924
48022
  });
47925
48023
 
48024
+ // packages/ai/dist/minimax-models.js
48025
+ var init_minimax_models = __esm({
48026
+ "packages/ai/dist/minimax-models.js"() {
48027
+ "use strict";
48028
+ init_esm_shims();
48029
+ }
48030
+ });
48031
+
47926
48032
  // packages/ai/dist/models.js
47927
48033
  function calculateCost(model, usage) {
47928
48034
  usage.cost.input = model.cost.input / 1e6 * usage.input;
@@ -47969,6 +48075,8 @@ var init_models2 = __esm({
47969
48075
  "use strict";
47970
48076
  init_esm_shims();
47971
48077
  init_models_generated();
48078
+ init_minimax_models();
48079
+ init_minimax_models();
47972
48080
  modelRegistry = /* @__PURE__ */ new Map();
47973
48081
  for (const [provider2, models] of Object.entries(MODELS)) {
47974
48082
  const providerModels = /* @__PURE__ */ new Map();
@@ -55922,6 +56030,25 @@ function buildParams2(model, context, isOAuthToken2, options) {
55922
56030
  params.tool_choice = options.toolChoice;
55923
56031
  }
55924
56032
  }
56033
+ return normalizeMiniMaxParams(model, params, options);
56034
+ }
56035
+ function normalizeMiniMaxParams(model, params, options) {
56036
+ if (model.provider !== "minimax" && model.provider !== "minimax-cn")
56037
+ return params;
56038
+ if (params.model === "MiniMax-M3.1-Flash") {
56039
+ const effort = params.output_config?.effort ?? options?.effort ?? "max";
56040
+ const normalized = { ...params, thinking: { type: "adaptive" } };
56041
+ normalized.output_config = {
56042
+ ...params.output_config,
56043
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
56044
+ };
56045
+ delete normalized.service_tier;
56046
+ delete normalized.reasoning_split;
56047
+ return normalized;
56048
+ }
56049
+ if (params.model === "MiniMax-M3" && params.thinking) {
56050
+ return { ...params, thinking: { type: params.thinking.type === "disabled" ? "disabled" : "adaptive" } };
56051
+ }
55925
56052
  return params;
55926
56053
  }
55927
56054
  function normalizeToolCallId(id) {
@@ -56228,6 +56355,7 @@ var init_anthropic = __esm({
56228
56355
  if (nextParams !== void 0) {
56229
56356
  params = nextParams;
56230
56357
  }
56358
+ params = normalizeMiniMaxParams(model, params, options);
56231
56359
  const requestOptions = {
56232
56360
  ...options?.signal ? { signal: options.signal } : {},
56233
56361
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -138998,6 +139126,18 @@ var init_openai_completions = __esm({
138998
139126
  if (nextParams !== void 0) {
138999
139127
  params = nextParams;
139000
139128
  }
139129
+ if (model.provider === "openrouter" && new URL(model.baseUrl).hostname === "openrouter.ai" && params.model === "minimax/minimax-m3.1-flash:free") {
139130
+ const flash = params;
139131
+ const effort = flash.reasoning?.effort ?? "max";
139132
+ flash.reasoning = {
139133
+ ...flash.reasoning,
139134
+ enabled: true,
139135
+ effort: ["low", "medium", "high", "xhigh", "max"].includes(effort) ? effort : "max"
139136
+ };
139137
+ delete flash.reasoning_effort;
139138
+ delete flash.reasoning_split;
139139
+ delete flash.service_tier;
139140
+ }
139001
139141
  const requestOptions = {
139002
139142
  ...options?.signal ? { signal: options.signal } : {},
139003
139143
  ...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
@@ -49,3 +49,91 @@ The current-context baseline test runs the existing Auto Context path against
49
49
  real local fixture repositories. Future phases must add their real Workset
50
50
  adapter to this harness before claiming retrieval, wiki, workflow, or provider
51
51
  quality improvements.
52
+
53
+ ## 1.10 Task Matrix
54
+
55
+ The 1.10 contract adds a deterministic task matrix in
56
+ `src/evaluation/context-task-matrix.ts` and
57
+ `tests/evaluation/context-task-matrix.test.ts`. It contains 20 cases across
58
+ continuity, retrieval, safety, runtime, and integration boundaries. The cases
59
+ cover first setup, cross-host recovery, stale and conflicting evidence, CJK and
60
+ large-store retrieval, embedding fallback, poisoning and abstention, project
61
+ isolation, HTTP session/handle expiry, project switches, and adapter doctor
62
+ parity.
63
+
64
+ Every case records the same metric contract: first-action correctness, recovery
65
+ success, memory hit precision/recall, stale and conflict rejection, abstention
66
+ precision, input/output tokens, p50/p95 latency, RSS, fallback/degraded counts,
67
+ and review cost. The matrix is a testable specification; it does not contain
68
+ measured scores. Run its contract gate with:
69
+
70
+ ~~~powershell
71
+ npm run gate:context-matrix
72
+ ~~~
73
+
74
+ The runtime gate executes the same 20 cases against real Workset, compact
75
+ retrieval, CodeGraph freshness, binding-store, and adapter-registry paths. It
76
+ also runs the packed 40k large-store transport gate and injects its measured
77
+ context latency/RSS into the large-store case:
78
+
79
+ ~~~powershell
80
+ npm run gate:context-runtime
81
+ ~~~
82
+
83
+ This is intentionally a separate release gate from the ordinary test suite:
84
+ it rebuilds the packed runtime and seeds 40,000 records across SDK, HTTP MCP,
85
+ stdio hook, and reopen paths. The normal suite still runs the pure runner
86
+ contract and skips the capacity-sized fixture.
87
+
88
+ ### Current Retrieval Baseline
89
+
90
+ The existing deterministic session replay exam provides the first measured
91
+ baseline for the 1.10 matrix. With embeddings disabled, four fixed questions
92
+ achieved 4/4 hit rate, a maximum turn size of 277 tokens, and zero over-budget
93
+ turns. The no-dedup comparison showed 4 duplicate displays out of 16 (25%);
94
+ the surfaced-ID dedup path showed 3 out of 16 (18.75%) while retaining 4/4
95
+ hits. This is a retrieval/session baseline for the mapped continuity and
96
+ retrieval cases, not a score for the remaining matrix cases.
97
+
98
+ ### Measured 1.10 Runtime Baseline
99
+
100
+ Measured on Windows Node `v22.22.3`, `win32-x64`, with embeddings disabled and
101
+ LLM refinement disabled on 2026-10-23:
102
+
103
+ | Result | Measurement |
104
+ | --- | --- |
105
+ | Matrix cases | 20/20 passed |
106
+ | Memory hit precision/recall | 1.00 / 1.00 |
107
+ | Stale/conflict rejection | 1.00 / 1.00 |
108
+ | Abstention precision | 0.95 |
109
+ | Matrix latency | p50 2ms / p95 255ms |
110
+ | Matrix peak RSS | 428,867,584 bytes |
111
+ | 40k seed/index | 45,571.959ms |
112
+ | 40k SDK search | 30.378ms |
113
+ | 40k MCP context / receipt assembly | 518.983ms / 6ms |
114
+ | 40k peak RSS | 409.0MB |
115
+ | 40k SDK reopen | 85.095ms |
116
+ | 100k seed/index | 113,048.097ms |
117
+ | 100k SDK search | 39.71ms |
118
+ | 100k MCP context / receipt assembly | 1,099.809ms / 7ms |
119
+ | 100k peak RSS | 409.4MB |
120
+
121
+ The 40k and 100k large-store gates both returned `ok: true`, with no failed
122
+ checks. The 100k run reopened 100,001 rows after the MCP and hook writes; the
123
+ 40k run reopened 40,001 rows. These are local capacity observations, not
124
+ cross-platform SLOs. The runtime report is produced by
125
+ `src/evaluation/context-task-runner.ts` and
126
+ `tests/evaluation/context-task-runtime.test.ts`.
127
+
128
+ ### Retrieval Receipt Contract
129
+
130
+ Schema version `1` receipts now share these measured fields across compact
131
+ engine, MCP `memorix_search`, and CLI `memory search --json`:
132
+
133
+ - `mode`, `resultCount`, `selectedCount`, and `tokenCount`;
134
+ - `candidateCount`, `omittedCount`, and `omittedByTokenBudget`;
135
+ - `fallbackUsed` and an optional bounded `fallbackReason`;
136
+ - request-level `elapsedMs`.
137
+
138
+ The receipt remains metadata-only: query text, raw memory narratives, and local
139
+ paths are not added to it.
@@ -60,6 +60,37 @@ Task Workset assembled for one task from current code facts, continuation
60
60
  evidence, source-qualified knowledge, and relevant durable memories under a
61
61
  strict token budget.
62
62
 
63
+ ## Memory Ownership Matrix
64
+
65
+ This matrix is the ownership contract for the current product line. A consumer
66
+ may read a projection from another layer, but it must not silently promote that
67
+ projection or replace the layer that owns its truth. `Task Workset` is a derived
68
+ delivery view and is intentionally absent from the persisted kinds below.
69
+
70
+ | Type | Write owner | Verification owner | Default reader | Automatic promotion |
71
+ | --- | --- | --- | --- | --- |
72
+ | Observation | explicit MCP/CLI writes, agent writes, hooks, and Git Memory capture | admission gate, evidence cards, current Code Memory qualification, and visibility rules | task context and deliberate search/detail | source-dependent; hook and model-derived candidates wait for qualification |
73
+ | Reasoning | session/task capture and explicit agent reasoning writes | session outcome, verification events, feedback, and task continuity | handoff, session context, and task context | never as verified durable knowledge without explicit evidence |
74
+ | Claim | explicit/manual entry, Git evidence, or reviewed derivation | claim review plus attached evidence and conflict state | evidence-aware task context and knowledge workspace | no automatic promotion |
75
+ | Wiki / Workflow | reviewed workspace proposal or deliberate workflow import | document review, lint, commit/source checks, and workflow verification gates | task lens and explicit knowledge/workflow operations | no automatic overwrite of claims or manually edited pages |
76
+ | Session / Team | session lifecycle and coordination runtime | lifecycle closure, task outcome, heartbeat/lock state, and handoff verification | active handoff, coordination views, and session recovery | summaries may create observations, but do not become verified facts automatically |
77
+ | Long-term memory | explicit promotion from evidence or deliberate manual capture | qualification, evidence references, scope/owner rules, and explicit review | bounded durable context when the task and scope allow it | only when the promotion conditions and review state are satisfied |
78
+ | CodeGraph | source refresh and provider adapters | complete snapshot, parser/provider health, and current worktree comparison | code context and CodeGraph diagnostics | never copies source truth into memory automatically |
79
+
80
+ The following rules apply across rows:
81
+
82
+ 1. A source may propose or reference another type, but the receiving type owns
83
+ its own lifecycle and verification state.
84
+ 2. `candidate`, `qualified`, `approved`, `stale`, `conflict`, and `blocked` are
85
+ lifecycle/evidence facts; they must not be collapsed into one unexplained
86
+ trust score.
87
+ 3. A default context builder may include only records that pass its admission,
88
+ visibility, freshness, and task-scope rules. Omitted or abstained evidence
89
+ belongs in the delivery receipt.
90
+ 4. Adding a new persisted memory type requires documenting why an existing row
91
+ cannot own the data and adding its writer, verifier, reader, and promotion
92
+ path to this matrix first.
93
+
63
94
  ### Kinds
64
95
 
65
96
  - **Episodic**: a bounded event or handoff, such as a completed debugging
@@ -419,6 +419,12 @@ Global example:
419
419
  }
420
420
  ```
421
421
 
422
+ Successful MCP searches include a machine-readable `structuredContent.retrieval`
423
+ receipt with schema version `1`, the selected search mode, result count, output
424
+ token count, and measured search/format elapsed time. `memorix memory search
425
+ --json` exposes the same receipt under `retrieval`; the human-readable table
426
+ remains unchanged. The receipt contains no query text or raw memory content.
427
+
422
428
  ### `memorix_detail`
423
429
 
424
430
  Fetch full observation, mini-skill, or curated long-term memory detail.
@@ -560,6 +566,19 @@ Behavior:
560
566
 
561
567
  In HTTP service mode, pass `projectRoot` as the absolute workspace or repo root whenever the client knows it. `projectRoot` is the detection anchor; project identity still comes from Git.
562
568
 
569
+ Every successful `memorix_session_start` response also includes a machine-readable
570
+ `structuredContent.binding` receipt. It contains `version`, `state`, `source`,
571
+ `explicit`, the resolved `projectId`, a hash of the verified project root, a hash
572
+ of the active data directory, verified Git remote state (`gitRemote.state`, with
573
+ remote hash and host when present), a project handle lease (`handle.state`, with
574
+ creation, last-use, expiry, and handle hash when present), and the transport label
575
+ (`legacy-http`, `stateless-http`, `stdio`, or `unknown`). The receipt is safe for
576
+ diagnostics and handoffs: it does not include local paths, remote URLs, MCP
577
+ session IDs, or project handles. An expired handle is reported as `expired` when
578
+ the adapter can still inspect its metadata; requests carrying an invalid or
579
+ expired handle fail closed before business tools run. The text response still
580
+ includes the human-readable binding state.
581
+
563
582
  ### `memorix_session_end`
564
583
 
565
584
  End the active session with a summary.
@@ -13,9 +13,9 @@ Memorix is a TypeScript project built around:
13
13
 
14
14
  ## Current Development Baseline
15
15
 
16
- The current release candidate is **1.9.12**. The published baseline remains
17
- **1.9.11** until the release is published. Package metadata is kept
18
- synchronized with the root package and MCP Registry manifest.
16
+ The next release line is **1.10.0** and package metadata is kept synchronized
17
+ with the root package and MCP Registry manifest. Until the release tag and
18
+ published artifacts exist, `1.9.12` remains the latest published baseline.
19
19
 
20
20
  Contributors should assume the following areas are part of the current release line:
21
21
 
@@ -102,6 +102,19 @@ memorix background start
102
102
  memorix status
103
103
  ```
104
104
 
105
+ For the 1.10 context contract and capacity gates, run the deterministic matrix
106
+ and the packed 40k transport fixture:
107
+
108
+ ```bash
109
+ npm run gate:context-matrix
110
+ npm run gate:context-runtime
111
+ node scripts/large-store-gate.mjs --records 100000
112
+ ```
113
+
114
+ `gate:context-runtime` rebuilds the packed runtime before running its fixture.
115
+ The 100k command is a separate capacity check because it takes materially
116
+ longer and is not part of the ordinary `npm test` loop.
117
+
105
118
  ---
106
119
 
107
120
  ## 3. Recommended Development Loop
@@ -2,6 +2,31 @@
2
2
 
3
3
  Memorix is a shared project memory layer. Agents connect through the interfaces they already support: plugin packages, MCP, project instructions, hooks, skills, or the bundled memcode terminal agent.
4
4
 
5
+ ## Capability Registry
6
+
7
+ The canonical adapter registry lives in `src/integrations/registry.ts`. Each
8
+ supported agent has one capability manifest with schema version `1`. The
9
+ manifest describes its MCP transport and command, shipped or generated
10
+ artifacts, hook lifecycle events, rules/skills/guidance surfaces, project and
11
+ global scope, install/repair/doctor/uninstall support, host-version evidence,
12
+ runtime requirements, and the source files that generate and document it.
13
+
14
+ `memorix setup` derives its complete-install target list from this registry.
15
+ Agents with a narrower integration lane remain in the registry: Qwen is the
16
+ current hooks-only example and is installed with
17
+ `memorix hooks install --agent qwen`. Run the registry validation test when
18
+ adding an agent; a new target is not complete until it has a manifest and its
19
+ installer lane is explicit.
20
+
21
+ `memorix doctor agents --json` includes the same manifest version, expected
22
+ transport, observed transport, expected artifact categories, lifecycle support,
23
+ and registry source for each checked target. A `skipped` parity field means the
24
+ host-specific artifact is not inspected by the generic doctor lane; it is not
25
+ silently treated as installed. When a host exposes stable project/global paths,
26
+ the report also includes concrete `artifactChecks` for rules and hooks with the
27
+ path, scope, existence, and status. Package and skill roots remain manifest
28
+ expectations until their install root is stable across host launch modes.
29
+
5
30
  For most users, start with:
6
31
 
7
32
  ```bash
@@ -49,7 +49,8 @@ user is allowed to remember.
49
49
  memory, and the V8 heap limit so a real saturation report can distinguish
50
50
  JavaScript retention from native/model memory. It also exposes SQLite handle
51
51
  cache/lease counts, modern runtime pool counts, HTTP session admission counts,
52
- and event-loop lag percentiles.
52
+ event-loop lag percentiles, and a privacy-safe `binding` receipt with the
53
+ verified project identity/data-directory hashes and `transport: dashboard`.
53
54
 
54
55
  ## SQLite Storage Reliability Contract
55
56
 
@@ -198,11 +199,11 @@ crash must be reconciled before a dangerous retry.
198
199
  temporary Git project with an isolated data directory. It runs with embeddings
199
200
  disabled, so it does not use provider credentials or make paid network calls.
200
201
  The gate measures steady-state writes, first lexical search, process memory,
201
- HTTP readiness, MCP initialize/bind/context/search/store, hook capture, and an
202
- SDK close/reopen cycle. Every network request has a hard timeout, and the
203
- report fails when an interactive path exceeds its release budget. It also
204
- verifies that the personal hook candidate remains durable on disk without
205
- becoming visible to an unbound SDK reader.
202
+ HTTP readiness, MCP initialize/bind/context/search/store, bounded receipt
203
+ assembly latency, hook capture, and an SDK close/reopen cycle. Every network
204
+ request has a hard timeout, and the report fails when an interactive path
205
+ exceeds its release budget. It also verifies that the personal hook candidate
206
+ remains durable on disk without becoming visible to an unbound SDK reader.
206
207
 
207
208
  Small stores may use bounded Orama batches. Large stores skip that hydration and
208
209
  use the persistent FTS5 path immediately; the optional semantic shadow index is
@@ -214,6 +215,11 @@ Results are machine-specific and should be compared on the same OS and Node
214
215
  version. The release gate is an integrity and regression check, not a public
215
216
  latency guarantee.
216
217
 
218
+ The `httpMcp.contextMs` value includes the full MCP request, while
219
+ `httpMcp.receiptAssemblyMs` comes from the receipt's own `elapsedMs` field.
220
+ Keep both values when recording a baseline so transport, runtime startup, and
221
+ context assembly are not conflated.
222
+
217
223
  ### 1.9.x Capacity Closeout Evidence (2026-09-21)
218
224
 
219
225
  The 40,000-record gate passed on Windows with Node `v22.22.3`, SQLite-backed
@@ -313,3 +319,12 @@ Measured Windows/Node 22 evidence for this implementation: 1k, 10k, 40k, and
313
319
  296ms. These are same-machine acceptance numbers, not universal latency
314
320
  promises. The release is complete only when the measurements and fallback
315
321
  behavior remain recorded alongside the implementation.
322
+
323
+ The 1.10 receipt baseline adds an internal assembly measurement to the same
324
+ gate. On Windows Node `v22.22.3` with 40,000 records, the complete HTTP MCP
325
+ context call was `573.561ms`, while the bounded receipt reported `7ms` of
326
+ assembly time. The same run measured `318.202ms` cold HTTP search, `2.733s`
327
+ hook persistence, `157.485ms` SDK reopen, and `428.7MB` peak RSS. The gate
328
+ passed. `contextMs` includes transport and runtime work; `receiptAssemblyMs`
329
+ is the Workset receipt's own assembly timer, so the two values must not be
330
+ compared as duplicate measurements.
package/docs/README.md CHANGED
@@ -127,10 +127,10 @@ Historical/deep-reference documents may describe older designs. If they conflict
127
127
 
128
128
  ## Current Product Line
129
129
 
130
- The current product line is **1.9.12** (release candidate; **1.9.11** remains
131
- the published baseline until release publication). Multi-device store sync is opt-in and
132
- keeps local SQLite canonical; existing users do not upload anything until they
133
- configure a relay provider explicitly.
130
+ The latest published product line is **1.9.12**; the **1.10.0** release
131
+ candidate adds the measured trustworthy-context and retrieval-receipt contract.
132
+ Multi-device store sync is opt-in and keeps local SQLite canonical; existing
133
+ users do not upload anything until they configure a relay provider explicitly.
134
134
  The authoritative acceptance contract for the current implementation is
135
135
  [1.8.0 Release Specification](1.8.0-RELEASE-CANDIDATE-SPEC.md).
136
136
  The current baseline has: