@a9i5k4/dsh-auto-memory 3.1.5 → 3.1.6
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/docs/CONTINUITY-FLOW.md +6 -6
- package/docs/HANDBOOK.md +54 -53
- package/docs/M-CM-PLAN.md +1 -1
- package/docs/M-CM-STATE.md +1 -1
- package/docs/M-CM7-HANDOFF-LAYERED-RETRIEVAL.md +1 -1
- package/docs/M3B-CONTRACT.md +7 -7
- package/docs/M7-AUTONOMOUS-STATE.md +1 -1
- package/docs/M7-TASKSET-DISPATCH.md +1 -1
- package/docs/PROMPT-PACK-LAYERED-RECALL.md +3 -3
- package/docs/PROMPT-SET-STRICT.md +3 -3
- package/docs/RELEASE-GO-NOGO.md +1 -1
- package/docs/STATUS-BOARD.md +1 -1
- package/docs/USER-GUIDE.en.md +21 -21
- package/docs/USER-GUIDE.zh-CN.md +21 -21
- package/docs/WHITEPAPER.md +1 -1
- package/docs/prompts/FIX-AGENT-P12-FULL-REGRESSION.md +1 -1
- package/docs/prompts/LIVE-VERIFY-ZCODE.md +2 -2
- package/docs/prompts/P2-semantic-recall.md +2 -2
- package/docs/prompts/P7-write-fix.md +1 -1
- package/docs/prompts/ZCODE-DROPIN.md +1 -1
- package/lib/acceptance.js +6 -6
- package/lib/activation-host.js +15 -14
- package/lib/activation-inbox-state.js +4 -4
- package/lib/activation-inbox.js +44 -44
- package/lib/board-mode.js +3 -3
- package/lib/client.js +193 -34
- package/lib/config-io.js +12 -12
- package/lib/context-bridge.js +22 -22
- package/lib/context-host.js +24 -23
- package/lib/datadir.js +95 -0
- package/lib/degrade.js +21 -21
- package/lib/dsh-home.js +8 -8
- package/lib/engine-identity.js +12 -12
- package/lib/engine-switch.js +3 -3
- package/lib/episodic-store.js +13 -13
- package/lib/evidence-agg.js +4 -4
- package/lib/evidence-store.js +12 -12
- package/lib/fact-store.js +47 -47
- package/lib/handoff-anchor.js +4 -4
- package/lib/hub-io.js +356 -3
- package/lib/index-sync.js +5 -5
- package/lib/index.js +381 -236
- package/lib/intent-clean-safe.js +3 -3
- package/lib/intent-clean.js +1 -1
- package/lib/l0-extract.js +15 -15
- package/lib/l0-index-sync.js +8 -8
- package/lib/l0-index.js +11 -11
- package/lib/ledger-criteria.js +8 -8
- package/lib/m4-corpus.js +1 -1
- package/lib/m7-index-sync-host.js +2 -2
- package/lib/m7-wire.js +24 -24
- package/lib/memory-anchor.js +1 -1
- package/lib/memory-envelope.js +15 -15
- package/lib/memory-hub.js +95 -50
- package/lib/memory-importance.js +7 -7
- package/lib/memory-mutation.js +5 -5
- package/lib/note-status-apply.js +2 -2
- package/lib/note-status.js +7 -7
- package/lib/policies/activation_policy_v2.json +2 -2
- package/lib/policies/recall_intent_lr_v1.json +1 -1
- package/lib/procedure-observation.js +2 -2
- package/lib/procedure-store.js +117 -28
- package/lib/python-setup.js +6 -5
- package/lib/python-sidecar-client.js +26 -26
- package/lib/recall-fusion.js +12 -12
- package/lib/recall-stats.js +36 -1
- package/lib/rerank-host.js +11 -11
- package/lib/rules-edit.js +9 -9
- package/lib/rules-layer.js +26 -26
- package/lib/semantic-decide.js +7 -7
- package/lib/semantic-js.js +13 -13
- package/lib/shadow-host.js +7 -6
- package/lib/shadow-retrieval.js +40 -40
- package/lib/skill-export-host.js +7 -7
- package/lib/skill-export.js +6 -6
- package/lib/state-commit.js +10 -10
- package/lib/storage-manage.js +6 -6
- package/lib/tier-layer-inject.js +28 -28
- package/lib/tier0-catalog.js +4 -4
- package/lib/wb-contract.js +45 -45
- package/lib/wb-sidecar.js +11 -11
- package/package.json +3 -4
- package/python/m7_activation_features_v2.py +7 -7
- package/python/m7_embedding_v1.py +12 -12
- package/python/policies/activation_policy_v2.json +2 -2
- package/python/policies/decision-record-activation-v2-delta-exp-override-20260824.json +1 -1
- package/python/policies/decision-record-reasoning-kind-admission-20260826.json +2 -2
- package/python/policies/decision-record-stale-gate-per-candidate-20260825.json +2 -2
- package/python/policies/recall_intent_lr_v1.json +1 -1
- package/python/verify_policy_artifact.py +3 -3
- package/python/worker_semantic_v1.py +18 -18
- package/python/worker_v1.py +18 -18
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
"""M7 activation features pre v2 (policy:
|
|
3
|
+
"""M7 activation features pre v2 (policy: activation_policy_pre_v2).
|
|
4
4
|
|
|
5
5
|
Round-1 implementation of the two-lane activation eligibility decision.
|
|
6
6
|
Pure stdlib; deterministic; NO pickle/joblib/sklearn at runtime — the
|
|
7
7
|
calibrated intent head is reproduced from the auditable JSON artifact
|
|
8
|
-
python/policies/
|
|
8
|
+
python/policies/recall_intent_lr_pre_v1.json (vocabulary + IDF + logistic
|
|
9
9
|
regression coefficients/intercept + Platt calibration), exported by the
|
|
10
10
|
calibration pipeline (runId label-review-cal20260824-1954).
|
|
11
11
|
|
|
@@ -48,9 +48,9 @@ import math
|
|
|
48
48
|
import os
|
|
49
49
|
import re
|
|
50
50
|
|
|
51
|
-
FEATURES_POLICY_VERSION = '
|
|
52
|
-
INTENT_POLICY_VERSION = '
|
|
53
|
-
ACTIVATION_POLICY_VERSION = '
|
|
51
|
+
FEATURES_POLICY_VERSION = 'activation_features_pre_v2'
|
|
52
|
+
INTENT_POLICY_VERSION = 'recall_intent_lr_pre_v1'
|
|
53
|
+
ACTIVATION_POLICY_VERSION = 'activation_policy_pre_v2'
|
|
54
54
|
|
|
55
55
|
INTERROG = ['什么', '如何', '怎么', '哪些', '哪个', '为什么', '多少', '吗',
|
|
56
56
|
'呢', '啥', 'recall', 'what', 'how', 'which', 'when', 'where',
|
|
@@ -375,8 +375,8 @@ if __name__ == '__main__':
|
|
|
375
375
|
here = os.path.dirname(os.path.abspath(__file__))
|
|
376
376
|
pol_dir = os.path.join(here, 'policies')
|
|
377
377
|
loaded = load_and_verify_policy(
|
|
378
|
-
os.path.join(pol_dir, '
|
|
379
|
-
os.path.join(pol_dir, '
|
|
378
|
+
os.path.join(pol_dir, 'recall_intent_lr_pre_v1.json'),
|
|
379
|
+
os.path.join(pol_dir, 'activation_policy_pre_v2.json'))
|
|
380
380
|
demo_rows = [
|
|
381
381
|
{'id': 'demo-recall', 'text': '之前为什么选 BGE-M3?',
|
|
382
382
|
'denseTop': 0.72, 'margin': 0.10, 'containment': 0.55, 'mark': 1,
|
|
@@ -6,17 +6,17 @@ Pure re-implementation of the frozen policy for the production sidecar path
|
|
|
6
6
|
(the benchmark rig lives separately under python/bench/ and stays untouched):
|
|
7
7
|
|
|
8
8
|
provider bge-m3 pinned revision, CLS pooling, L2-normalized float32
|
|
9
|
-
chunk policy
|
|
9
|
+
chunk policy m7_chunk_pre_v1 = para-512-noov (tokenizer id space,
|
|
10
10
|
greedy paragraph packing, oversized paragraph hard-split,
|
|
11
11
|
no overlap; special tokens added by the model tokenizer)
|
|
12
12
|
identity provider/model/revision/dimension/normalization/policyVersion
|
|
13
13
|
-> configHash; mismatch = stale = full rebuild
|
|
14
14
|
|
|
15
15
|
Providers:
|
|
16
|
-
hash-v1 deterministic stdlib-only embedding (sha256-seeded bag of
|
|
16
|
+
hash-pre-v1 deterministic stdlib-only embedding (sha256-seeded bag of
|
|
17
17
|
token-trigram dims). Zero dependencies, zero network. Used
|
|
18
18
|
by CI and offline protocol tests. NOT a quality provider.
|
|
19
|
-
bge-m3-v1 real model via transformers (lazy import; requires the
|
|
19
|
+
bge-m3-pre-v1 real model via transformers (lazy import; requires the
|
|
20
20
|
pinned local snapshot dir passed in the embedding config).
|
|
21
21
|
|
|
22
22
|
No DSH file reads; no writes except what the worker explicitly passes in.
|
|
@@ -25,15 +25,15 @@ import hashlib
|
|
|
25
25
|
import json
|
|
26
26
|
import re
|
|
27
27
|
|
|
28
|
-
PROVIDER_REAL = 'bge-m3-v1'
|
|
29
|
-
PROVIDER_REAL_INT8 = 'bge-m3-onnx-int8-v1'
|
|
30
|
-
PROVIDER_HASH = 'hash-v1'
|
|
31
|
-
CHUNK_POLICY_VERSION = '
|
|
28
|
+
PROVIDER_REAL = 'bge-m3-pre-v1'
|
|
29
|
+
PROVIDER_REAL_INT8 = 'bge-m3-onnx-int8-pre-v1'
|
|
30
|
+
PROVIDER_HASH = 'hash-pre-v1'
|
|
31
|
+
CHUNK_POLICY_VERSION = 'm7_chunk_pre_v1'
|
|
32
32
|
CHUNK_MAX_TOKENS = 512
|
|
33
33
|
QUERY_MAX_TOKENS = 256
|
|
34
34
|
DIMENSION = 1024
|
|
35
35
|
|
|
36
|
-
RE_CHUNK = re.compile(r'^
|
|
36
|
+
RE_CHUNK = re.compile(r'^chk_pre_[0-9a-f]{16,}$')
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def sha_hex(data):
|
|
@@ -73,8 +73,8 @@ def config_hash(provider, model_revision, dimension):
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
def chunk_id_for(memory_id, record_digest, ordinal):
|
|
76
|
-
return '
|
|
77
|
-
('m7-chunk-v1\u0000' + memory_id + '\u0000' + record_digest +
|
|
76
|
+
return 'chk_pre_' + sha_hex(
|
|
77
|
+
('m7-chunk-pre-v1\u0000' + memory_id + '\u0000' + record_digest +
|
|
78
78
|
'\u0000' + str(ordinal)).encode('utf-8'))[:32]
|
|
79
79
|
|
|
80
80
|
|
|
@@ -359,8 +359,8 @@ def identity_block(provider, config):
|
|
|
359
359
|
dtype = 'int8-dynamic-onnx'
|
|
360
360
|
return {
|
|
361
361
|
'schemaVersion': 1,
|
|
362
|
-
'namespace': 'dsh-auto-memory',
|
|
363
|
-
'policyVersion': '
|
|
362
|
+
'namespace': 'dsh-auto-memory-pre',
|
|
363
|
+
'policyVersion': 'semantic_vectors_pre_v1',
|
|
364
364
|
'provider': provider,
|
|
365
365
|
'model': model_name,
|
|
366
366
|
'modelRevision': str(config.get('modelRevision') or 'hash'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"policyVersion": "
|
|
4
|
-
"parentPolicyVersion": "
|
|
3
|
+
"policyVersion": "activation_policy_pre_v2",
|
|
4
|
+
"parentPolicyVersion": "m7_semantic_threshold_pre_v1",
|
|
5
5
|
"createdAt": "2026-08-25",
|
|
6
6
|
"runId": "label-review-cal20260824-1954",
|
|
7
7
|
"goldDigest": "e74ccdcda998ae51596adf8119c818ac84fc52a4fa657fd687daeda7d14a072d",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"decisionId": "activation-v2-delta-exp-override-20260824",
|
|
4
|
-
"policyVersion": "
|
|
4
|
+
"policyVersion": "activation_policy_pre_v2",
|
|
5
5
|
"previousDeltaExp": 0.02,
|
|
6
6
|
"approvedDeltaExp": 0.03,
|
|
7
7
|
"reason": "production completeness semantics exposed cal-0008 prefetch-to-emit violation at 0.02",
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"summary": "'reasoning' admitted as a legal Segment kind (weight 0.5 in lexical query plan), superseding the M4/M5-era rule that reasoning never enters context.",
|
|
8
8
|
"trigger": "controlled live shadow round 2: envelope drops 'trigger:invalid:kind' + 'window:invalid:kind' — the new CoT segments (kind='reasoning') were rejected by the M5 whitelist ['user','tool_call','tool_result','assistant']",
|
|
9
9
|
"change": [
|
|
10
|
-
"lib/context-bridge.js: segment kind whitelist + 'reasoning'",
|
|
11
|
-
"lib/shadow-retrieval.js: trigger.kind whitelist + 'reasoning'; query-plan origin map adds 'reasoning' at weight 0.5 (between recent-user 0.8 and tool-result 0.6... actually below tool-result, above assistant 0.2)",
|
|
10
|
+
"lib/context-bridge-pre.js: segment kind whitelist + 'reasoning'",
|
|
11
|
+
"lib/shadow-retrieval-pre.js: trigger.kind whitelist + 'reasoning'; query-plan origin map adds 'reasoning' at weight 0.5 (between recent-user 0.8 and tool-result 0.6... actually below tool-result, above assistant 0.2)",
|
|
12
12
|
"smoke-test-m51-pre.mjs: old rejection assertion replaced with admission assertion"
|
|
13
13
|
],
|
|
14
14
|
"safety": [
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"rootCause": "worker constructed hardGates.stale as any(e.freshness=='stale' for e in payload.evidence); on real traffic every context_push carries >=1 stale evidence entry (anchored files updated today -> all M5 historical evidence judged stale), so fv2 was permanently muted"
|
|
12
12
|
},
|
|
13
13
|
"change": {
|
|
14
|
-
"file": "python/
|
|
14
|
+
"file": "python/worker_semantic_pre_v1.py (_fv2_shadow_decide gate construction only)",
|
|
15
15
|
"semantics": "stale/correction gates fire ONLY when the affected evidence memoryId is among the CURRENT top-K candidates; unrelated evidence never gates",
|
|
16
16
|
"untouched": [
|
|
17
|
-
"
|
|
17
|
+
"m7_activation_features_pre_v2.py (decision core unchanged)",
|
|
18
18
|
"python/policies/*.json (versions, configHashes unchanged: activation cfgh_31e6d977..., intent cfgh_69465e69...)",
|
|
19
19
|
"golden-parity-fixtures-v1.jsonl (fixtures carry explicit hardGates inputs; all False -> zero output drift)"
|
|
20
20
|
]
|