agent-working-memory 0.17.0 → 0.19.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.
- package/README.md +8 -5
- package/dist/adapters/common.d.ts +34 -0
- package/dist/adapters/common.d.ts.map +1 -1
- package/dist/adapters/common.js +528 -446
- package/dist/adapters/common.js.map +1 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +19 -0
- package/dist/api/routes.js.map +1 -1
- package/dist/cli/migrate.d.ts.map +1 -1
- package/dist/cli/migrate.js +31 -29
- package/dist/cli/migrate.js.map +1 -1
- package/dist/core/asked-value.d.ts +37 -0
- package/dist/core/asked-value.d.ts.map +1 -0
- package/dist/core/asked-value.js +77 -0
- package/dist/core/asked-value.js.map +1 -0
- package/dist/core/conflicts.d.ts +89 -0
- package/dist/core/conflicts.d.ts.map +1 -0
- package/dist/core/conflicts.js +267 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/embeddings.d.ts +14 -2
- package/dist/core/embeddings.d.ts.map +1 -1
- package/dist/core/embeddings.js +32 -10
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/format-recall.d.ts +21 -1
- package/dist/core/format-recall.d.ts.map +1 -1
- package/dist/core/format-recall.js +60 -5
- package/dist/core/format-recall.js.map +1 -1
- package/dist/core/ml-worker.d.ts +24 -1
- package/dist/core/ml-worker.d.ts.map +1 -1
- package/dist/core/ml-worker.js +165 -4
- package/dist/core/ml-worker.js.map +1 -1
- package/dist/core/model-daemon-client.d.ts +77 -0
- package/dist/core/model-daemon-client.d.ts.map +1 -0
- package/dist/core/model-daemon-client.js +383 -0
- package/dist/core/model-daemon-client.js.map +1 -0
- package/dist/core/model-daemon-server.d.ts +71 -0
- package/dist/core/model-daemon-server.d.ts.map +1 -0
- package/dist/core/model-daemon-server.js +363 -0
- package/dist/core/model-daemon-server.js.map +1 -0
- package/dist/core/model-daemon.d.ts +137 -0
- package/dist/core/model-daemon.d.ts.map +1 -0
- package/dist/core/model-daemon.js +231 -0
- package/dist/core/model-daemon.js.map +1 -0
- package/dist/core/query-expander.d.ts +5 -0
- package/dist/core/query-expander.d.ts.map +1 -1
- package/dist/core/query-expander.js +3 -2
- package/dist/core/query-expander.js.map +1 -1
- package/dist/core/recall-config.d.ts +1 -1
- package/dist/core/recall-config.d.ts.map +1 -1
- package/dist/core/recall-config.js +5 -0
- package/dist/core/recall-config.js.map +1 -1
- package/dist/core/rerank-window.d.ts +7 -2
- package/dist/core/rerank-window.d.ts.map +1 -1
- package/dist/core/rerank-window.js +9 -4
- package/dist/core/rerank-window.js.map +1 -1
- package/dist/core/rerank2.d.ts +52 -2
- package/dist/core/rerank2.d.ts.map +1 -1
- package/dist/core/rerank2.js +60 -3
- package/dist/core/rerank2.js.map +1 -1
- package/dist/core/reranker.d.ts +19 -0
- package/dist/core/reranker.d.ts.map +1 -1
- package/dist/core/reranker.js +90 -13
- package/dist/core/reranker.js.map +1 -1
- package/dist/core/trust.d.ts +32 -0
- package/dist/core/trust.d.ts.map +1 -0
- package/dist/core/trust.js +66 -0
- package/dist/core/trust.js.map +1 -0
- package/dist/core/validity.d.ts +21 -0
- package/dist/core/validity.d.ts.map +1 -0
- package/dist/core/validity.js +41 -0
- package/dist/core/validity.js.map +1 -0
- package/dist/core/whoami.d.ts +3 -0
- package/dist/core/whoami.d.ts.map +1 -1
- package/dist/core/whoami.js +14 -0
- package/dist/core/whoami.js.map +1 -1
- package/dist/core/write-pipeline.d.ts +48 -0
- package/dist/core/write-pipeline.d.ts.map +1 -1
- package/dist/core/write-pipeline.js +80 -3
- package/dist/core/write-pipeline.js.map +1 -1
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +27 -4
- package/dist/engine/activation.js.map +1 -1
- package/dist/engine/consolidation.d.ts.map +1 -1
- package/dist/engine/consolidation.js +53 -4
- package/dist/engine/consolidation.js.map +1 -1
- package/dist/hooks/prime-query.d.ts +57 -0
- package/dist/hooks/prime-query.d.ts.map +1 -0
- package/dist/hooks/prime-query.js +388 -0
- package/dist/hooks/prime-query.js.map +1 -0
- package/dist/hooks/prime.d.ts +8 -0
- package/dist/hooks/prime.d.ts.map +1 -1
- package/dist/hooks/prime.js +21 -2
- package/dist/hooks/prime.js.map +1 -1
- package/dist/hooks/sidecar.d.ts +18 -0
- package/dist/hooks/sidecar.d.ts.map +1 -1
- package/dist/hooks/sidecar.js +58 -2
- package/dist/hooks/sidecar.js.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +157 -104
- package/dist/mcp.js.map +1 -1
- package/dist/model-daemon.d.ts +8 -0
- package/dist/model-daemon.d.ts.map +1 -0
- package/dist/model-daemon.js +45 -0
- package/dist/model-daemon.js.map +1 -0
- package/dist/storage/factory.d.ts.map +1 -1
- package/dist/storage/factory.js +5 -0
- package/dist/storage/factory.js.map +1 -1
- package/dist/storage/pglite-schema.d.ts.map +1 -1
- package/dist/storage/pglite-schema.js +176 -170
- package/dist/storage/pglite-schema.js.map +1 -1
- package/dist/storage/pglite.d.ts +5 -0
- package/dist/storage/pglite.d.ts.map +1 -1
- package/dist/storage/pglite.js +165 -153
- package/dist/storage/pglite.js.map +1 -1
- package/dist/storage/postgres.d.ts +5 -0
- package/dist/storage/postgres.d.ts.map +1 -1
- package/dist/storage/postgres.js +165 -153
- package/dist/storage/postgres.js.map +1 -1
- package/dist/storage/sqlite.d.ts +22 -0
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +415 -363
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/types/engram.d.ts +33 -0
- package/dist/types/engram.d.ts.map +1 -1
- package/dist/types/engram.js.map +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +1 -1
- package/plugin/bin/awm-mcp-launcher.cjs +2 -2
- package/plugin/skills/awm-memory/SKILL.md +11 -2
- package/src/adapters/common.ts +881 -802
- package/src/api/routes.ts +20 -0
- package/src/cli/migrate.ts +309 -307
- package/src/core/asked-value.ts +74 -0
- package/src/core/conflicts.ts +280 -0
- package/src/core/embeddings.ts +35 -10
- package/src/core/format-recall.ts +83 -25
- package/src/core/ml-worker.ts +458 -281
- package/src/core/model-daemon-client.ts +374 -0
- package/src/core/model-daemon-server.ts +344 -0
- package/src/core/model-daemon.ts +243 -0
- package/src/core/query-expander.ts +127 -126
- package/src/core/recall-config.ts +5 -0
- package/src/core/rerank-window.ts +164 -159
- package/src/core/rerank2.ts +143 -82
- package/src/core/reranker.ts +92 -12
- package/src/core/trust.ts +65 -0
- package/src/core/validity.ts +47 -0
- package/src/core/whoami.ts +136 -120
- package/src/core/write-pipeline.ts +119 -3
- package/src/engine/activation.ts +27 -4
- package/src/engine/consolidation.ts +950 -899
- package/src/hooks/prime-query.ts +375 -0
- package/src/hooks/prime.ts +25 -2
- package/src/hooks/sidecar.ts +57 -3
- package/src/index.ts +258 -248
- package/src/mcp.ts +1529 -1475
- package/src/model-daemon.ts +48 -0
- package/src/storage/factory.ts +25 -19
- package/src/storage/pglite-schema.ts +199 -193
- package/src/storage/pglite.ts +1513 -1498
- package/src/storage/postgres.ts +1613 -1598
- package/src/storage/sqlite.ts +2069 -2019
- package/src/types/engram.ts +30 -0
package/dist/core/reranker.d.ts
CHANGED
|
@@ -10,6 +10,25 @@
|
|
|
10
10
|
* AWM 0.8.x: inference dispatches through ml-worker.ts (currently in-process
|
|
11
11
|
* — see ml-worker.ts for the worker_threads → in-process revert rationale).
|
|
12
12
|
*/
|
|
13
|
+
import { type PreTrainedTokenizer } from '@huggingface/transformers';
|
|
14
|
+
/**
|
|
15
|
+
* The query the cross-encoder sees: unchanged when it fits the cap, else its first and
|
|
16
|
+
* last halves. Both ends, because a pasted prompt puts the question either before the
|
|
17
|
+
* paste or after it. Special tokens typed into a long query ([SEP], [UNK]) are dropped by
|
|
18
|
+
* the decode; a query under the cap passes through untouched.
|
|
19
|
+
*/
|
|
20
|
+
export declare function capRerankQuery(tok: PreTrainedTokenizer, query: string, maxTokens?: number): string;
|
|
21
|
+
/** Exported with its caps as parameters so tests can compare settings in one process. */
|
|
22
|
+
export declare function inProcessRerank(args: {
|
|
23
|
+
query: string;
|
|
24
|
+
passages: string[];
|
|
25
|
+
}, caps?: {
|
|
26
|
+
batch?: number;
|
|
27
|
+
queryTokens?: number;
|
|
28
|
+
}): Promise<Array<{
|
|
29
|
+
index: number;
|
|
30
|
+
score: number;
|
|
31
|
+
}>>;
|
|
13
32
|
/** Kept for backwards compat. */
|
|
14
33
|
export declare function getReranker(): Promise<any>;
|
|
15
34
|
export interface RerankResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reranker.d.ts","sourceRoot":"","sources":["../../src/core/reranker.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"reranker.d.ts","sourceRoot":"","sources":["../../src/core/reranker.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,2BAA2B,CAAC;AA+FnC;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,SAAsB,GAAG,MAAM,CAY/G;AAoDD,yFAAyF;AACzF,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,EAC3C,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAalD;AAQD,iCAAiC;AACjC,wBAAsB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,CAGhD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAGvF"}
|
package/dist/core/reranker.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* — see ml-worker.ts for the worker_threads → in-process revert rationale).
|
|
14
14
|
*/
|
|
15
15
|
import { AutoTokenizer, AutoModelForSequenceClassification, } from '@huggingface/transformers';
|
|
16
|
-
import { dispatchRerank, registerInProcessHandlers } from './ml-worker.js';
|
|
16
|
+
import { dispatchRerank, registerInferenceConfig, registerInProcessHandlers } from './ml-worker.js';
|
|
17
17
|
import { ensureModelCacheDir } from './model-cache.js';
|
|
18
18
|
const DEFAULT_MODEL = 'Xenova/ms-marco-MiniLM-L-6-v2';
|
|
19
19
|
const MODEL_ID = process.env.AWM_RERANKER_MODEL || DEFAULT_MODEL;
|
|
@@ -35,7 +35,20 @@ const MODEL_ID = process.env.AWM_RERANKER_MODEL || DEFAULT_MODEL;
|
|
|
35
35
|
* is untouched because it is a product decision, not because the cost is
|
|
36
36
|
* unknown; see docs/recall-latency.md.
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
// Default q8 since 0.19 (Robert's decision, 2026-10-19, after the speed review). The
|
|
39
|
+
// cross-encoder is ~80% of a warm recall; q8 cut its p50 by 35–45% in an interleaved
|
|
40
|
+
// in-process comparison (378–492 ms against 684–1,051 ms for fp32) and 29–34% of total
|
|
41
|
+
// recall in the 2026-10-08 sweep, for 0.0 pp on identifier queries and −0.9 pp on topic
|
|
42
|
+
// queries with success@5 and abstention unchanged. Batch size 4/8/16 made no consistent
|
|
43
|
+
// difference in the same comparison, so RERANK_BATCH stays at 8. `AWM_RERANKER_DTYPE=fp32`
|
|
44
|
+
// restores the 0.18 ranker; every number published before 0.19 stands at fp32.
|
|
45
|
+
// One property changes at q8: a pair's score depends slightly on the other pairs in its
|
|
46
|
+
// batch (dynamic quantisation scales activations per batch) — measured max 0.00105 over 80
|
|
47
|
+
// pairs, top-1 unchanged, the order of near-zero tail scores reshuffled. fp32 is exact to
|
|
48
|
+
// 1e-5. For a given query and store the pool and its chunks are deterministic, so results
|
|
49
|
+
// are reproducible; what is lost is batch-independence, which tests/core/onnx-shape-caps
|
|
50
|
+
// asserts exactly at fp32 and to 5e-3 at q8.
|
|
51
|
+
const DTYPE = (process.env.AWM_RERANKER_DTYPE || 'q8');
|
|
39
52
|
// --- In-process fallback ---
|
|
40
53
|
let tokenizer = null;
|
|
41
54
|
let model = null;
|
|
@@ -56,11 +69,60 @@ async function ensureLoaded() {
|
|
|
56
69
|
function sigmoid(x) {
|
|
57
70
|
return 1 / (1 + Math.exp(-x));
|
|
58
71
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Input-shape caps for the cross-encoder. They exist for MEMORY, and one of them also
|
|
74
|
+
* fixes RANKING.
|
|
75
|
+
*
|
|
76
|
+
* onnxruntime-node keeps a CPU memory arena per model that grows to the largest tensor
|
|
77
|
+
* it has ever run and never shrinks. A cross-encoder's attention tensor is
|
|
78
|
+
* batch x heads x seq x seq floats, so its size is quadratic in the padded pair length.
|
|
79
|
+
* Measured 2026-10-16 on AWM 0.17.0: six Claude Code sessions held 13.2 GB, JS heap flat
|
|
80
|
+
* at ~85 MB, and one process reranking 24 long pairs kept ~1.75 GB after going idle.
|
|
81
|
+
* The shapes come from the prime hook, which recalls with the WHOLE user prompt (pastes
|
|
82
|
+
* included), and from recall's 24-40 passage pool: 40 pairs at 512 tokens make one
|
|
83
|
+
* attention tensor of 40 x 12 x 512 x 512 x 4 B = ~500 MB.
|
|
84
|
+
*
|
|
85
|
+
* - AWM_RERANK_BATCH (default 8): passages are scored in chunks. A pair's score depends
|
|
86
|
+
* only on that pair (padding is masked), so this changes memory, not order.
|
|
87
|
+
* - AWM_RERANK_QUERY_TOKENS (default 128): a longer query keeps its first and last
|
|
88
|
+
* halves. transformers.js truncates a too-long pair by cutting tokens off the END,
|
|
89
|
+
* which is the passage: before this cap, a ~510-token query left the passage no tokens
|
|
90
|
+
* at all, and every memory was scored against the query alone. Passages are already
|
|
91
|
+
* capped at ~400 chars (rerank-window.ts), so a 128-token query typically keeps a
|
|
92
|
+
* pair under ~260 tokens (more for CJK text or a raised AWM_RERANK_TRUNC).
|
|
93
|
+
*
|
|
94
|
+
* An explicit 0 disables a cap. Anything else that is not a non-negative integer (empty,
|
|
95
|
+
* 'off', -1) falls back to the default, as AWM_RERANK_TRUNC does: a typo must not quietly
|
|
96
|
+
* bring back the unbounded shape.
|
|
97
|
+
*/
|
|
98
|
+
function shapeCap(name, fallback) {
|
|
99
|
+
const v = Number(process.env[name]?.trim() || NaN);
|
|
100
|
+
return Number.isInteger(v) && v >= 0 ? v : fallback;
|
|
101
|
+
}
|
|
102
|
+
const RERANK_BATCH = shapeCap('AWM_RERANK_BATCH', 8);
|
|
103
|
+
const RERANK_QUERY_TOKENS = shapeCap('AWM_RERANK_QUERY_TOKENS', 128);
|
|
104
|
+
/**
|
|
105
|
+
* The query the cross-encoder sees: unchanged when it fits the cap, else its first and
|
|
106
|
+
* last halves. Both ends, because a pasted prompt puts the question either before the
|
|
107
|
+
* paste or after it. Special tokens typed into a long query ([SEP], [UNK]) are dropped by
|
|
108
|
+
* the decode; a query under the cap passes through untouched.
|
|
109
|
+
*/
|
|
110
|
+
export function capRerankQuery(tok, query, maxTokens = RERANK_QUERY_TOKENS) {
|
|
111
|
+
if (maxTokens <= 0)
|
|
112
|
+
return query;
|
|
113
|
+
const ids = tok.encode(query, { add_special_tokens: false });
|
|
114
|
+
if (ids.length <= maxTokens)
|
|
115
|
+
return query;
|
|
116
|
+
const head = Math.ceil(maxTokens / 2);
|
|
117
|
+
const tail = maxTokens - head;
|
|
118
|
+
const decode = (part) => tok.decode(part, { skip_special_tokens: true, clean_up_tokenization_spaces: true });
|
|
119
|
+
// A tail that starts mid-word decodes with a leading '##' continuation marker, which
|
|
120
|
+
// would re-encode as two stray '#' tokens.
|
|
121
|
+
return tail > 0
|
|
122
|
+
? `${decode(ids.slice(0, head))} ${decode(ids.slice(ids.length - tail)).replace(/^##/, '')}`
|
|
123
|
+
: decode(ids.slice(0, head));
|
|
124
|
+
}
|
|
125
|
+
async function scoreChunk(query, passages, offset) {
|
|
64
126
|
// Batch path
|
|
65
127
|
try {
|
|
66
128
|
const queries = passages.map(() => query);
|
|
@@ -83,9 +145,8 @@ async function inProcessRerank(args) {
|
|
|
83
145
|
const results = [];
|
|
84
146
|
for (let i = 0; i < passages.length; i++) {
|
|
85
147
|
const rawLogit = Number(data[i] ?? 0);
|
|
86
|
-
results.push({ index: i, score: sigmoid(rawLogit) });
|
|
148
|
+
results.push({ index: offset + i, score: sigmoid(rawLogit) });
|
|
87
149
|
}
|
|
88
|
-
results.sort((a, b) => b.score - a.score);
|
|
89
150
|
return results;
|
|
90
151
|
}
|
|
91
152
|
catch {
|
|
@@ -103,18 +164,34 @@ async function inProcessRerank(args) {
|
|
|
103
164
|
const output = await model(inputs);
|
|
104
165
|
const logits = output.logits ?? output.last_hidden_state;
|
|
105
166
|
const rawLogit = logits.data[0];
|
|
106
|
-
results.push({ index: i, score: sigmoid(rawLogit) });
|
|
167
|
+
results.push({ index: offset + i, score: sigmoid(rawLogit) });
|
|
107
168
|
}
|
|
108
169
|
catch {
|
|
109
|
-
results.push({ index: i, score: 0 });
|
|
170
|
+
results.push({ index: offset + i, score: 0 });
|
|
110
171
|
}
|
|
111
172
|
}
|
|
112
|
-
results.sort((a, b) => b.score - a.score);
|
|
113
173
|
return results;
|
|
114
174
|
}
|
|
115
175
|
}
|
|
176
|
+
/** Exported with its caps as parameters so tests can compare settings in one process. */
|
|
177
|
+
export async function inProcessRerank(args, caps = {}) {
|
|
178
|
+
const { passages } = args;
|
|
179
|
+
if (passages.length === 0)
|
|
180
|
+
return [];
|
|
181
|
+
await ensureLoaded();
|
|
182
|
+
const query = capRerankQuery(tokenizer, args.query, caps.queryTokens ?? RERANK_QUERY_TOKENS);
|
|
183
|
+
const batch = caps.batch ?? RERANK_BATCH;
|
|
184
|
+
const size = batch > 0 ? batch : passages.length;
|
|
185
|
+
const results = [];
|
|
186
|
+
for (let b = 0; b < passages.length; b += size) {
|
|
187
|
+
results.push(...await scoreChunk(query, passages.slice(b, b + size), b));
|
|
188
|
+
}
|
|
189
|
+
results.sort((a, b) => b.score - a.score);
|
|
190
|
+
return results;
|
|
191
|
+
}
|
|
116
192
|
// Register the in-process handler with the pool
|
|
117
|
-
registerInProcessHandlers({ rerank: inProcessRerank });
|
|
193
|
+
registerInProcessHandlers({ rerank: (args) => inProcessRerank(args) });
|
|
194
|
+
registerInferenceConfig({ rerankModel: MODEL_ID, rerankDtype: DTYPE, rerankBatch: RERANK_BATCH, rerankQueryTokens: RERANK_QUERY_TOKENS });
|
|
118
195
|
// --- Public API ---
|
|
119
196
|
/** Kept for backwards compat. */
|
|
120
197
|
export async function getReranker() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reranker.js","sourceRoot":"","sources":["../../src/core/reranker.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AACtC;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,aAAa,EACb,kCAAkC,GAGnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"reranker.js","sourceRoot":"","sources":["../../src/core/reranker.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AACtC;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,aAAa,EACb,kCAAkC,GAGnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM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a,EAAE,QAAkB;IAC5D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trust tiers on writes and memories, and the one rule the write pipeline
|
|
3
|
+
* applies with them: a merge or a replacement must never RAISE the trust of
|
|
4
|
+
* text, and must never retire a more-trusted memory on the word of a
|
|
5
|
+
* less-trusted write.
|
|
6
|
+
*
|
|
7
|
+
* Found by MWA BL-17 (2026-10-14/15), five isolated-review rounds with
|
|
8
|
+
* probes: the pipeline merged a write into an existing memory on concept
|
|
9
|
+
* equality and the merged engram KEPT THE OLD ENGRAM'S TAGS — so a poisoned
|
|
10
|
+
* skill merged into a clean one came back trust=medium and primeable; a
|
|
11
|
+
* planted untrusted decoy under the same concept let a poisoned near-copy
|
|
12
|
+
* merge into the trusted fact; an archived trusted fact was revived with
|
|
13
|
+
* poisoned text merged in; and an R3 "correction" (eventType surprise) from
|
|
14
|
+
* untrusted text retired a trusted memory. MWA works around all of it in its
|
|
15
|
+
* own wrapper. Any other client writing mixed-trust content was exposed.
|
|
16
|
+
*
|
|
17
|
+
* AWM has no trust model of its own, and this does not add one. It reads the
|
|
18
|
+
* tag MWA's memory spine already writes (`trust=<tier>`) and refuses the
|
|
19
|
+
* dangerous direction. The write is still stored — as its own engram, with
|
|
20
|
+
* its own tags — so nothing is lost and the conflict mark can say the two
|
|
21
|
+
* disagree. Untagged writes and memories are unaffected: the rule only fires
|
|
22
|
+
* when the write is EXPLICITLY untrusted, or when both sides carry a tier and
|
|
23
|
+
* the write's is lower.
|
|
24
|
+
*/
|
|
25
|
+
/** The tier a `trust=<tier>` tag declares, or null when there is none. */
|
|
26
|
+
export declare function trustTier(tags: readonly string[] | null | undefined): number | null;
|
|
27
|
+
/**
|
|
28
|
+
* True when `writeTags` must not merge into, supersede or revive a memory
|
|
29
|
+
* carrying `targetTags`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergeBlockedByTrust(writeTags: readonly string[] | null | undefined, targetTags: readonly string[] | null | undefined): boolean;
|
|
32
|
+
//# sourceMappingURL=trust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/core/trust.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAUH,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAYnF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,EAC/C,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAC/C,OAAO,CAOT"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Trust tiers on writes and memories, and the one rule the write pipeline
|
|
5
|
+
* applies with them: a merge or a replacement must never RAISE the trust of
|
|
6
|
+
* text, and must never retire a more-trusted memory on the word of a
|
|
7
|
+
* less-trusted write.
|
|
8
|
+
*
|
|
9
|
+
* Found by MWA BL-17 (2026-10-14/15), five isolated-review rounds with
|
|
10
|
+
* probes: the pipeline merged a write into an existing memory on concept
|
|
11
|
+
* equality and the merged engram KEPT THE OLD ENGRAM'S TAGS — so a poisoned
|
|
12
|
+
* skill merged into a clean one came back trust=medium and primeable; a
|
|
13
|
+
* planted untrusted decoy under the same concept let a poisoned near-copy
|
|
14
|
+
* merge into the trusted fact; an archived trusted fact was revived with
|
|
15
|
+
* poisoned text merged in; and an R3 "correction" (eventType surprise) from
|
|
16
|
+
* untrusted text retired a trusted memory. MWA works around all of it in its
|
|
17
|
+
* own wrapper. Any other client writing mixed-trust content was exposed.
|
|
18
|
+
*
|
|
19
|
+
* AWM has no trust model of its own, and this does not add one. It reads the
|
|
20
|
+
* tag MWA's memory spine already writes (`trust=<tier>`) and refuses the
|
|
21
|
+
* dangerous direction. The write is still stored — as its own engram, with
|
|
22
|
+
* its own tags — so nothing is lost and the conflict mark can say the two
|
|
23
|
+
* disagree. Untagged writes and memories are unaffected: the rule only fires
|
|
24
|
+
* when the write is EXPLICITLY untrusted, or when both sides carry a tier and
|
|
25
|
+
* the write's is lower.
|
|
26
|
+
*/
|
|
27
|
+
/** Ordered tiers; higher is more trusted. */
|
|
28
|
+
const TIERS = {
|
|
29
|
+
untrusted: 0, none: 0, quarantine: 0,
|
|
30
|
+
low: 1,
|
|
31
|
+
medium: 2, med: 2,
|
|
32
|
+
high: 3, trusted: 3, verified: 3, owner: 3,
|
|
33
|
+
};
|
|
34
|
+
/** The tier a `trust=<tier>` tag declares, or null when there is none. */
|
|
35
|
+
export function trustTier(tags) {
|
|
36
|
+
if (!tags)
|
|
37
|
+
return null;
|
|
38
|
+
let found = null;
|
|
39
|
+
for (const t of tags) {
|
|
40
|
+
const m = /^trust=([a-z]+)$/i.exec(t.trim());
|
|
41
|
+
if (!m)
|
|
42
|
+
continue;
|
|
43
|
+
const v = TIERS[m[1].toLowerCase()];
|
|
44
|
+
if (v === undefined)
|
|
45
|
+
continue;
|
|
46
|
+
// Several tags: the lowest wins — a memory is as trusted as its least trusted label.
|
|
47
|
+
found = found === null ? v : Math.min(found, v);
|
|
48
|
+
}
|
|
49
|
+
return found;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* True when `writeTags` must not merge into, supersede or revive a memory
|
|
53
|
+
* carrying `targetTags`.
|
|
54
|
+
*/
|
|
55
|
+
export function mergeBlockedByTrust(writeTags, targetTags) {
|
|
56
|
+
const w = trustTier(writeTags);
|
|
57
|
+
if (w === null)
|
|
58
|
+
return false; // untagged write: no rule
|
|
59
|
+
const t = trustTier(targetTags);
|
|
60
|
+
if (w === 0)
|
|
61
|
+
return t === null || t > 0; // explicitly untrusted: only into untrusted
|
|
62
|
+
if (t === null)
|
|
63
|
+
return false; // tagged write, untagged target: no rule
|
|
64
|
+
return w < t;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.js","sourceRoot":"","sources":["../../src/core/trust.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AACtC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,6CAA6C;AAC7C,MAAM,KAAK,GAA2B;IACpC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;IACpC,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;CAC3C,CAAC;AAEF,0EAA0E;AAC1E,MAAM,UAAU,SAAS,CAAC,IAA0C;IAClE,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,KAAK,GAAkB,IAAI,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC9B,qFAAqF;QACrF,KAAK,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAA+C,EAC/C,UAAgD;IAEhD,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAkB,0BAA0B;IACzE,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAO,4CAA4C;IAC3F,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAkB,yCAAyC;IACxF,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal validity (D8) — the one place that decides whether a memory's
|
|
3
|
+
* `valid_from` / `valid_to` window holds at a given moment.
|
|
4
|
+
*
|
|
5
|
+
* Until 2026-10-19 nothing read these fields except the two recall formatters,
|
|
6
|
+
* which printed `[valid until …]` on expired memories exactly as on current
|
|
7
|
+
* ones. The live store was serving 482 memories past their `valid_to` as
|
|
8
|
+
* current (97 active, 385 archived). The guidance given to agents ("use
|
|
9
|
+
* `valid_to` … so the memory expires") promised behaviour the code did not have.
|
|
10
|
+
*
|
|
11
|
+
* Ranking (activation.ts Phase 8c), the MCP recall format and the prime hook
|
|
12
|
+
* all go through here so they cannot disagree about what "expired" means.
|
|
13
|
+
*/
|
|
14
|
+
export type ValidityState = 'current' | 'expired' | 'not-yet-valid';
|
|
15
|
+
/** The fields this needs — any engram-shaped object qualifies. */
|
|
16
|
+
export interface TemporallyBounded {
|
|
17
|
+
validFrom?: string | null;
|
|
18
|
+
validTo?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function validityState(e: TemporallyBounded, now?: number): ValidityState;
|
|
21
|
+
//# sourceMappingURL=validity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../src/core/validity.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC;AAEpE,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAcD,wBAAgB,aAAa,CAAC,CAAC,EAAE,iBAAiB,EAAE,GAAG,GAAE,MAAmB,GAAG,aAAa,CAU3F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Temporal validity (D8) — the one place that decides whether a memory's
|
|
5
|
+
* `valid_from` / `valid_to` window holds at a given moment.
|
|
6
|
+
*
|
|
7
|
+
* Until 2026-10-19 nothing read these fields except the two recall formatters,
|
|
8
|
+
* which printed `[valid until …]` on expired memories exactly as on current
|
|
9
|
+
* ones. The live store was serving 482 memories past their `valid_to` as
|
|
10
|
+
* current (97 active, 385 archived). The guidance given to agents ("use
|
|
11
|
+
* `valid_to` … so the memory expires") promised behaviour the code did not have.
|
|
12
|
+
*
|
|
13
|
+
* Ranking (activation.ts Phase 8c), the MCP recall format and the prime hook
|
|
14
|
+
* all go through here so they cannot disagree about what "expired" means.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A date-only `valid_to` ("2026-01-15") means "through that day", so it is
|
|
18
|
+
* compared against the END of that day in UTC. A full datetime is taken as
|
|
19
|
+
* written. An unparseable value is ignored: a bad bound must not hide a memory.
|
|
20
|
+
*/
|
|
21
|
+
function boundMs(value, endOfDay) {
|
|
22
|
+
const t = Date.parse(value);
|
|
23
|
+
if (!Number.isFinite(t))
|
|
24
|
+
return NaN;
|
|
25
|
+
const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(value.trim());
|
|
26
|
+
return dateOnly && endOfDay ? t + 86_400_000 - 1 : t;
|
|
27
|
+
}
|
|
28
|
+
export function validityState(e, now = Date.now()) {
|
|
29
|
+
if (e.validTo) {
|
|
30
|
+
const until = boundMs(e.validTo, true);
|
|
31
|
+
if (Number.isFinite(until) && now > until)
|
|
32
|
+
return 'expired';
|
|
33
|
+
}
|
|
34
|
+
if (e.validFrom) {
|
|
35
|
+
const from = boundMs(e.validFrom, false);
|
|
36
|
+
if (Number.isFinite(from) && now < from)
|
|
37
|
+
return 'not-yet-valid';
|
|
38
|
+
}
|
|
39
|
+
return 'current';
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=validity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validity.js","sourceRoot":"","sources":["../../src/core/validity.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AACtC;;;;;;;;;;;;GAYG;AAUH;;;;GAIG;AACH,SAAS,OAAO,CAAC,KAAa,EAAE,QAAiB;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IACpC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,OAAO,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,CAAoB,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IAC1E,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACvC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,KAAK;YAAE,OAAO,SAAS,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI;YAAE,OAAO,eAAe,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/core/whoami.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { modelDaemonStatus } from './ml-worker.js';
|
|
1
2
|
export interface WhoamiInfo {
|
|
2
3
|
agentId: string;
|
|
3
4
|
workspace: string | null;
|
|
@@ -23,6 +24,8 @@ export interface WhoamiInfo {
|
|
|
23
24
|
fingerprint: string;
|
|
24
25
|
flags: Record<string, string>;
|
|
25
26
|
};
|
|
27
|
+
/** Where inference runs: this process, or the shared model daemon (AWM_MODEL_DAEMON=1). */
|
|
28
|
+
models: ReturnType<typeof modelDaemonStatus>;
|
|
26
29
|
siblingAgents: string[];
|
|
27
30
|
}
|
|
28
31
|
/** Store subset whoami needs — every backend implements listAgentIds. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/core/whoami.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/core/whoami.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC3D;;;;;;OAMG;IACH,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IAC/D,2FAA2F;IAC3F,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,YAAY,IAAI,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC9C;AASD,wBAAsB,WAAW,CAC/B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,KAAK,GAAG,MAAM;AACvB;;;;;;GAMG;AACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,OAAO,CAAC,UAAU,CAAC,CA6BrB;AAaD,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAoBlD"}
|
package/dist/core/whoami.js
CHANGED
|
@@ -18,6 +18,7 @@ import { VERSION } from '../version.js';
|
|
|
18
18
|
import { getConfiguredBackend, getConfiguredPath } from '../storage/factory.js';
|
|
19
19
|
import { activeRecallConfig, recallConfigFingerprint } from './recall-config.js';
|
|
20
20
|
import { embeddingHealth } from './embeddings.js';
|
|
21
|
+
import { modelDaemonStatus } from './ml-worker.js';
|
|
21
22
|
function packageRoot() {
|
|
22
23
|
// src/core/whoami.ts (dev) and dist/core/whoami.js (build) both sit two
|
|
23
24
|
// levels below the package root.
|
|
@@ -59,9 +60,21 @@ boundHookPort) {
|
|
|
59
60
|
: (Number.isFinite(hookPort) && hookPort > 0 ? hookPort : null),
|
|
60
61
|
},
|
|
61
62
|
recall: { fingerprint: recallConfigFingerprint(), flags: activeRecallConfig() },
|
|
63
|
+
models: modelDaemonStatus(),
|
|
62
64
|
siblingAgents: siblings,
|
|
63
65
|
};
|
|
64
66
|
}
|
|
67
|
+
function formatModels(m) {
|
|
68
|
+
if (!m.enabled)
|
|
69
|
+
return 'in this process';
|
|
70
|
+
const fallback = m.fallbacks
|
|
71
|
+
? ` · ${m.fallbacks} fallback(s) to in-process, last: ${m.lastFallbackReason} at ${m.lastFallbackAt}`
|
|
72
|
+
: '';
|
|
73
|
+
const where = m.mode === 'daemon' ? `shared daemon pid ${m.daemonPid}`
|
|
74
|
+
: m.mode === 'in-process-fallback' ? 'in this process (daemon unavailable)'
|
|
75
|
+
: 'shared daemon (not connected yet)';
|
|
76
|
+
return `${where} · fingerprint ${m.fingerprint} · ${m.requests} request(s)${fallback}`;
|
|
77
|
+
}
|
|
65
78
|
/** Human-readable rendering for the MCP tool response. */
|
|
66
79
|
export function formatWhoami(w) {
|
|
67
80
|
return [
|
|
@@ -72,6 +85,7 @@ export function formatWhoami(w) {
|
|
|
72
85
|
`Code: ${w.codePath} (pid ${w.pid})`,
|
|
73
86
|
`Ports: http=${w.ports.http ?? 'off'} hookSidecar=${w.ports.hookSidecar ?? 'off'}`,
|
|
74
87
|
`Recall config: ${w.recall.fingerprint}`,
|
|
88
|
+
`Models: ${formatModels(w.models)}`,
|
|
75
89
|
...(embeddingHealth().dimensionMismatches > 0
|
|
76
90
|
? [`\u26a0 EMBEDDING INTEGRITY: ${embeddingHealth().dimensionMismatches} dimension mismatches ` +
|
|
77
91
|
`(expected ${embeddingHealth().expectedDimensions}d). Affected memories score 0 on the ` +
|
package/dist/core/whoami.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/core/whoami.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AAEtC;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/core/whoami.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AAEtC;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA+BnD,SAAS,WAAW;IAClB,wEAAwE;IACxE,iCAAiC;IACjC,MAAM,IAA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AC,gBAAgB,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACzE,SAAS,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,eAAe,CAAC,CAAC,OAAO,EAAE;QACjE,YAAY,CAAC,CAAC,OAAO,EAAE;QACvB,UAAU,CAAC,CAAC,SAAS,EAAE;QACvB,SAAS,CAAC,CAAC,QAAQ,SAAS,CAAC,CAAC,GAAG,GAAG;QACpC,eAAe,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,gBAAgB,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,EAAE;QAClF,kBAAkB,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,WAAW,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;QACnC,GAAG,CAAC,eAAe,EAAE,CAAC,mBAAmB,GAAG,CAAC;YAC3C,CAAC,CAAC,CAAC,+BAA+B,eAAe,EAAE,CAAC,mBAAmB,wBAAwB;oBAC5F,aAAa,eAAe,EAAE,CAAC,kBAAkB,uCAAuC;oBACxF,qFAAqF;oBACrF,wCAAwC,CAAC;YAC5C,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC,aAAa,CAAC,MAAM;YACpB,CAAC,CAAC,uCAAuC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,OAAO,6GAA6G;YACpN,CAAC,CAAC,0CAA0C;KAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -53,12 +53,41 @@ export interface WriteInput {
|
|
|
53
53
|
eventType?: SalienceEventType;
|
|
54
54
|
surprise?: number;
|
|
55
55
|
decisionMade?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Caller-declared purpose of the write: 'decision' | 'question' | 'todo' |
|
|
58
|
+
* 'finding' | 'context'. Stored as an `intent=` tag by the callers, and read HERE
|
|
59
|
+
* so a declared decision reaches the salience filter.
|
|
60
|
+
*
|
|
61
|
+
* It did not, before 2026-10-12: `intent` became a tag and nothing else, while the
|
|
62
|
+
* redundant `decisionMade` boolean was the only wired path, so a caller following
|
|
63
|
+
* the documented tagging discipline got no salience credit for saying this was a
|
|
64
|
+
* decision. Measured over all 496 discarded writes in the live store
|
|
65
|
+
* (`low-salience`, `work`+`personal`): those tagged `intent=decision` were later
|
|
66
|
+
* recalled at **77.3% against a 38.1% base rate**, +41pp — the strongest
|
|
67
|
+
* discriminator of any feature tested, discarded anyway.
|
|
68
|
+
*
|
|
69
|
+
* Mapped in the pipeline rather than at each call site so both write surfaces, and
|
|
70
|
+
* any future one, inherit it; widening the content-based operational-verb list was
|
|
71
|
+
* tested on the same population and rejected, because every candidate token scored
|
|
72
|
+
* at the base rate.
|
|
73
|
+
*/
|
|
74
|
+
intent?: string;
|
|
56
75
|
causalDepth?: number;
|
|
57
76
|
resolutionEffort?: number;
|
|
58
77
|
/** Confidence override. When unset, defaults from disposition + eventType priors. */
|
|
59
78
|
confidence?: number;
|
|
60
79
|
/** Explicit supersession requested by caller (independent of correction-on-match). */
|
|
61
80
|
supersedes?: string;
|
|
81
|
+
/**
|
|
82
|
+
* This write corrects an existing memory whose id the caller does not have
|
|
83
|
+
* (2026-10-19). The closest active memory about the same thing — the same
|
|
84
|
+
* concept, else the novelty match when it is close enough — is superseded,
|
|
85
|
+
* the correction goes active at no less than that memory's confidence, and
|
|
86
|
+
* the result says what was replaced (`correctionOf`). Never reinforce-merges.
|
|
87
|
+
* With nothing close enough, the write is stored as new and `correctionOf`
|
|
88
|
+
* is null. An explicit `supersedes` outranks this.
|
|
89
|
+
*/
|
|
90
|
+
correction?: boolean;
|
|
62
91
|
/** Workspace scope for cross-agent novelty (v0.5.4+ stores only). */
|
|
63
92
|
workspace?: string | null;
|
|
64
93
|
/** Set to false to skip the reinforce/supersede branching and always create. */
|
|
@@ -103,6 +132,25 @@ export interface WriteResult {
|
|
|
103
132
|
supersedeOf?: {
|
|
104
133
|
id: string;
|
|
105
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Set when the write asked `correction: true`: the memory it replaced, or
|
|
137
|
+
* null when nothing close enough existed and the write was stored as new.
|
|
138
|
+
*/
|
|
139
|
+
correctionOf?: {
|
|
140
|
+
id: string;
|
|
141
|
+
concept: string;
|
|
142
|
+
matchScore: number;
|
|
143
|
+
} | null;
|
|
144
|
+
/**
|
|
145
|
+
* Set when a merge, supersede, revive or correction was refused because the
|
|
146
|
+
* write is less trusted than the memory it matched (src/core/trust.ts). The
|
|
147
|
+
* write was stored as its own engram instead.
|
|
148
|
+
*/
|
|
149
|
+
trustBlocked?: {
|
|
150
|
+
matchedId: string;
|
|
151
|
+
writeTrust: number | null;
|
|
152
|
+
matchedTrust: number | null;
|
|
153
|
+
};
|
|
106
154
|
}
|
|
107
155
|
export interface WritePipelineEngines {
|
|
108
156
|
store: EngramStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-pipeline.d.ts","sourceRoot":"","sources":["../../src/core/write-pipeline.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-pipeline.d.ts","sourceRoot":"","sources":["../../src/core/write-pipeline.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE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