@furongjun1999/dsh-memory 0.9.22 → 0.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +404 -0
- package/CHANGELOG.md +45 -0
- package/README.en.md +240 -0
- package/README.md +3 -1
- package/docs/README.md +2 -0
- package/docs/en/README.md +190 -0
- package/docs/en/TRANSLATION.md +78 -0
- package/docs/en/TRANSLATION_MANIFEST.json +170 -0
- package/docs/en/TRANSLATION_REPORT.md +11 -0
- package/docs/en/dev/README.md +10 -0
- package/docs/en/dev/coding-testing.md +72 -0
- package/docs/en/dev/switch-matrix.md +10 -0
- package/docs/en/glossary.md +97 -0
- package/docs/en/harnesses/claude.md +100 -0
- package/docs/en/harnesses/codebuddy.md +93 -0
- package/docs/en/harnesses/codex.md +88 -0
- package/docs/en/harnesses/dsh.md +84 -0
- package/docs/en/harnesses/zcode.md +42 -0
- package/docs/en/mdcg/ccg.md +32 -0
- package/docs/en/mdcg/generated-docs.md +20 -0
- package/docs/en/mdcg/guardrail-charter.md +170 -0
- package/docs/en/mdcg/mcp-tool-names.md +43 -0
- package/docs/en/mdcg/multi-harness.md +43 -0
- package/docs/en/mdcg/recall-metadata.md +30 -0
- package/docs/en/mdcg/world-model-endpoint.md +379 -0
- package/docs/en/mdcg/write-aliases.md +130 -0
- package/docs/en/ops/README.md +11 -0
- package/docs/en/ops/environment-known-issues.md +244 -0
- package/docs/en/ops/install.md +72 -0
- package/docs/en/ops/operations-troubleshooting.md +86 -0
- package/docs/en/ops/permissions-review.md +79 -0
- package/docs/en/ops/release-governance.md +49 -0
- package/docs/en/ops/tool-name-migration.md +30 -0
- package/docs/en/ops/ui-install-troubleshooting.md +53 -0
- package/docs/en/standards/ai-coding-standard-checklist.md +71 -0
- package/docs/en/standards/ai-coding-standard-lingshu.md +47 -0
- package/docs/en/standards/ai-coding-standard.md +185 -0
- package/docs/en/ui/minimal.md +62 -0
- package/docs/mdcg/cogmap_ops.md +15 -15
- package/lib/hooks.d.ts +22 -0
- package/lib/hooks.js +124 -32
- package/lib/index.js +19 -3
- package/lib/lib/console_web.mjs +30 -3
- package/lib/lib/hook_audit.d.ts +3 -2
- package/lib/lib/hook_audit.js +14 -4
- package/lib/lib/mdcg_client.d.ts +5 -2
- package/lib/lib/mdcg_client.js +8 -4
- package/lib/lib/prompt_safety.d.ts +24 -0
- package/lib/lib/prompt_safety.js +77 -1
- package/lib/lib/token_store.js +5 -2
- package/lib/tools.js +5 -3
- package/md_cg/fsutil.py +80 -25
- package/md_cg/mcp_server.py +5761 -5557
- package/md_cg/mdcg.py +570 -73
- package/md_cg/mdcos.py +36 -11
- package/md_cg/nodefile.py +147 -23
- package/md_cg/op_table.py +14 -4
- package/md_cg/reconcile.py +9 -11
- package/md_cg/rollback.py +16 -1
- package/md_cg/scrub.py +94 -14
- package/md_cg/security.py +4 -2
- package/md_cg/test_cond_term_fold.py +183 -0
- package/md_cg/test_cond_terms_colon.py +348 -0
- package/md_cg/test_generation_guard.py +63 -42
- package/md_cg/test_issue362_neg_condition.py +44 -7
- package/md_cg/test_issue39_utf8_stdio.py +3 -3
- package/md_cg/test_issue444_scrub_evidence_plaintext.py +14 -8
- package/md_cg/test_issue677_flush_batch_io.py +139 -0
- package/md_cg/test_issue677_info_fast.py +82 -0
- package/md_cg/test_issue677_remember_dedupe.py +106 -0
- package/md_cg/test_issue712_tokens_sessions_read.py +199 -0
- package/md_cg/test_issue722_strict_conditions.py +96 -0
- package/md_cg/test_issue730_narrowing_audit.py +121 -0
- package/md_cg/test_issue733_verify_override.py +193 -0
- package/md_cg/test_issue733_verify_override_and_overwrite_inherit.py +315 -0
- package/md_cg/test_issue740_filelock_fd_leak.py +218 -0
- package/md_cg/test_issue741_content_hash_same_source.py +158 -0
- package/md_cg/test_issue747_slot_contradiction.py +125 -0
- package/md_cg/test_issue754_nested_root_guard.py +197 -0
- package/md_cg/test_issue757_index_hash_compare.py +85 -0
- package/md_cg/test_issue758_disk_hash_single.py +67 -0
- package/md_cg/test_issue759_twophase_hash.py +67 -0
- package/md_cg/test_n204_n205_n226_n227_n228_n229_exit_gates.py +545 -542
- package/md_cg/test_n209_verify_write_face_gates.py +5 -2
- package/md_cg/test_neg_condition_hits.py +336 -333
- package/md_cg/test_scrub_source_line_false_positive.py +64 -0
- package/md_cg/test_twophase.py +286 -286
- package/md_cg/tokens.py +55 -7
- package/md_cg/twophase.py +15 -6
- package/md_cg/writepipe.py +35 -3
- package/package.json +137 -134
- package/scripts/workspace_index.py +2 -0
- package/src/hooks.ts +139 -33
- package/src/index.ts +19 -3
- package/src/lib/console_web.mjs +30 -3
- package/src/lib/hook_audit.ts +15 -5
- package/src/lib/mdcg_client.ts +8 -4
- package/src/lib/prompt_safety.ts +73 -1
- package/src/lib/token_store.ts +5 -2
- package/src/tools.ts +5 -3
- package/ui/minimal/integrity.json +2 -2
- package/ui/minimal/payload/lib/lib/console_web.mjs +30 -3
- package/ui/minimal/payload/src/lib/console_web.mjs +30 -3
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"source_language": "zh-CN",
|
|
4
|
+
"target_language": "en",
|
|
5
|
+
"generated_note": "docs/en/mdcg/generated-docs.md",
|
|
6
|
+
"pairs": [
|
|
7
|
+
{
|
|
8
|
+
"source": "README.md",
|
|
9
|
+
"target": "README.en.md"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"source": "CHANGELOG.md",
|
|
13
|
+
"target": "CHANGELOG.en.md"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"source": "docs/README.md",
|
|
17
|
+
"target": "docs/en/README.md"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"source": "docs/ops/README.md",
|
|
21
|
+
"target": "docs/en/ops/README.md"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"source": "docs/ops/发布与治理.md",
|
|
25
|
+
"target": "docs/en/ops/release-governance.md"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"source": "docs/ops/图形界面_安装与排障.md",
|
|
29
|
+
"target": "docs/en/ops/ui-install-troubleshooting.md"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"source": "docs/ops/安装与前置.md",
|
|
33
|
+
"target": "docs/en/ops/install.md"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"source": "docs/ops/工具名迁移_0.9.9.md",
|
|
37
|
+
"target": "docs/en/ops/tool-name-migration.md"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"source": "docs/ops/权限与复核模型.md",
|
|
41
|
+
"target": "docs/en/ops/permissions-review.md"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"source": "docs/ops/环境与已知问题.md",
|
|
45
|
+
"target": "docs/en/ops/environment-known-issues.md"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"source": "docs/ops/运维与排障.md",
|
|
49
|
+
"target": "docs/en/ops/operations-troubleshooting.md"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"source": "docs/dev/README.md",
|
|
53
|
+
"target": "docs/en/dev/README.md"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"source": "docs/dev/开关矩阵.md",
|
|
57
|
+
"target": "docs/en/dev/switch-matrix.md"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"source": "docs/dev/编码与测试约定.md",
|
|
61
|
+
"target": "docs/en/dev/coding-testing.md"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"source": "docs/mdcg/guardrail-charter.md",
|
|
65
|
+
"target": "docs/en/mdcg/guardrail-charter.md"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"source": "docs/mdcg/CCG六要素编译.md",
|
|
69
|
+
"target": "docs/en/mdcg/ccg.md"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"source": "docs/mdcg/MCP工具名口径_v1.0.md",
|
|
73
|
+
"target": "docs/en/mdcg/mcp-tool-names.md"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"source": "docs/mdcg/recall_metadata.md",
|
|
77
|
+
"target": "docs/en/mdcg/recall-metadata.md"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"source": "docs/mdcg/写入别名aliases规范_v0.6.md",
|
|
81
|
+
"target": "docs/en/mdcg/write-aliases.md"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"source": "docs/mdcg/世界模型功能端_使用与运维_v1.0.md",
|
|
85
|
+
"target": "docs/en/mdcg/world-model-endpoint.md"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"source": "docs/mdcg/多harness接入.md",
|
|
89
|
+
"target": "docs/en/mdcg/multi-harness.md"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"source": "dsh/README.md",
|
|
93
|
+
"target": "docs/en/harnesses/dsh.md"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"source": "codebuddy/README.md",
|
|
97
|
+
"target": "docs/en/harnesses/codebuddy.md"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"source": "zcode/README.md",
|
|
101
|
+
"target": "docs/en/harnesses/zcode.md"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"source": "codex/README.md",
|
|
105
|
+
"target": "docs/en/harnesses/codex.md"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"source": "claude/README.md",
|
|
109
|
+
"target": "docs/en/harnesses/claude.md"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"source": "ui/minimal/使用说明.md",
|
|
113
|
+
"target": "docs/en/ui/minimal.md"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"source": "docs/规范/AI编程通用规范.md",
|
|
117
|
+
"target": "docs/en/standards/ai-coding-standard.md"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"source": "docs/规范/AI编程通用规范_灵枢适配.md",
|
|
121
|
+
"target": "docs/en/standards/ai-coding-standard-lingshu.md"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"source": "docs/规范/AI编程通用规范_自检清单.md",
|
|
125
|
+
"target": "docs/en/standards/ai-coding-standard-checklist.md"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"scope": [
|
|
129
|
+
"README.md",
|
|
130
|
+
"CHANGELOG.md",
|
|
131
|
+
"docs/README.md",
|
|
132
|
+
"docs/ops/README.md",
|
|
133
|
+
"docs/ops/发布与治理.md",
|
|
134
|
+
"docs/ops/图形界面_安装与排障.md",
|
|
135
|
+
"docs/ops/安装与前置.md",
|
|
136
|
+
"docs/ops/工具名迁移_0.9.9.md",
|
|
137
|
+
"docs/ops/权限与复核模型.md",
|
|
138
|
+
"docs/ops/环境与已知问题.md",
|
|
139
|
+
"docs/ops/运维与排障.md",
|
|
140
|
+
"docs/dev/README.md",
|
|
141
|
+
"docs/dev/开关矩阵.md",
|
|
142
|
+
"docs/dev/编码与测试约定.md",
|
|
143
|
+
"docs/mdcg/guardrail-charter.md",
|
|
144
|
+
"docs/mdcg/CCG六要素编译.md",
|
|
145
|
+
"docs/mdcg/MCP工具名口径_v1.0.md",
|
|
146
|
+
"docs/mdcg/recall_metadata.md",
|
|
147
|
+
"docs/mdcg/写入别名aliases规范_v0.6.md",
|
|
148
|
+
"docs/mdcg/世界模型功能端_使用与运维_v1.0.md",
|
|
149
|
+
"docs/mdcg/多harness接入.md",
|
|
150
|
+
"dsh/README.md",
|
|
151
|
+
"codebuddy/README.md",
|
|
152
|
+
"zcode/README.md",
|
|
153
|
+
"codex/README.md",
|
|
154
|
+
"claude/README.md",
|
|
155
|
+
"ui/minimal/使用说明.md",
|
|
156
|
+
"docs/规范/AI编程通用规范.md",
|
|
157
|
+
"docs/规范/AI编程通用规范_灵枢适配.md",
|
|
158
|
+
"docs/规范/AI编程通用规范_自检清单.md",
|
|
159
|
+
"docs/mdcg/cogmap_ops.md",
|
|
160
|
+
"docs/mdcg/功能调用映射表_v0.1.md"
|
|
161
|
+
],
|
|
162
|
+
"exclude": [
|
|
163
|
+
"docs/mdcg/cogmap_ops.md",
|
|
164
|
+
"docs/mdcg/功能调用映射表_v0.1.md"
|
|
165
|
+
],
|
|
166
|
+
"generated": [
|
|
167
|
+
"docs/mdcg/cogmap_ops.md",
|
|
168
|
+
"docs/mdcg/功能调用映射表_v0.1.md"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
> **Languages:** [中文](../../dev/README.md) · English
|
|
2
|
+
|
|
3
|
+
# dev/ · Development and coding conventions
|
|
4
|
+
|
|
5
|
+
| Document | Contents |
|
|
6
|
+
|---|---|
|
|
7
|
+
| [Coding and testing conventions](coding-testing.md) | Build / why Python tests must use `-m` / full UTF-8 and the ★ entry-point self-guarantee / id contract v2 / Linux dual-stack verification |
|
|
8
|
+
| [Switch matrix](switch-matrix.md) | Retrieval and normalization env switches, defaults, adjudication history, and integration notes |
|
|
9
|
+
|
|
10
|
+
> Domain rules are in the [docs/ directory index](../README.md).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
> **Languages:** [中文](../../dev/编码与测试约定.md) · English
|
|
2
|
+
|
|
3
|
+
# Coding and testing conventions
|
|
4
|
+
|
|
5
|
+
> This page was split out of the original `README.md` (source: the four original README sections "Development", "Python test conventions", "Coding conventions", and "Linux verification" (L565-L637)).
|
|
6
|
+
|
|
7
|
+
## Development and build
|
|
8
|
+
|
|
9
|
+
## 🛠️ Development
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install # NODE_ENV=production 时须加 --include=dev
|
|
13
|
+
npm run build # TypeScript 编译
|
|
14
|
+
npm test # 真实集成测试(spawn 本机灵枢,验证握手/往返/注册/卸载)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> `NODE_ENV=production` (or `--omit=dev`) omits devDependencies, so `tsc`/`tsx` are not present;
|
|
18
|
+
> in that case `prepare` **skips the build and says so on stdout** (no longer making `npm install` fail entirely because `tsc` is missing),
|
|
19
|
+
> so use `npm install --include=dev` when you need a build. Also: running under `engines.node >=22.19` prints
|
|
20
|
+
> an EBADENGINE warning (informational only, non-blocking).
|
|
21
|
+
|
|
22
|
+
Tests do not depend on all DSH components: they use a minimal Cordis host (SystemPrompt + ToolRegistry + plugin) to isolate unstable surfaces.
|
|
23
|
+
|
|
24
|
+
### Python test conventions (must use `python -m`)
|
|
25
|
+
|
|
26
|
+
Tests inside packages such as `md_cg/` generally use **package-relative imports**, so they must be run as modules from the **repository root**; calling `python md_cg/test_xxx.py` directly raises ImportError (measured: 59 of 61 direct runs hit it). The one-command entry point encodes that convention (on Linux and macOS, replace `python` below with `python3`, since distributions ship no `python` by default):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m md_cg.run_tests # 全量(md_cg + compiler + swarm,按存在性发现)
|
|
30
|
+
python -m md_cg.run_tests md_cg -k p44 # 按组 / 关键字过滤
|
|
31
|
+
python -m md_cg.run_tests --jobs 1 # 串行(默认并发 4)
|
|
32
|
+
python scripts/run_tests.py # 源码树入口(等价;需 scripts/ 在)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> **The entry point lives inside the package** (`md_cg/run_tests.py`): the npm shipped surface (`files`) does not include `scripts/`,
|
|
36
|
+
> so in an installed plugin the only full-suite entry point available is the one above; in the `src/` source tree,
|
|
37
|
+
> `scripts/run_tests.py` and `npm run gate` still work (release gates are source-tree tools).
|
|
38
|
+
> The package runner **redirects subprocess output to a file** (no pipes): restricted hosts (such as the DSH file
|
|
39
|
+
> sandbox) forbid CreatePipe, so versions using `capture_output` turn every test case into a
|
|
40
|
+
> PermissionError false failure.
|
|
41
|
+
|
|
42
|
+
Equivalent single-test form: `python -m md_cg.test_p44_md_whitebox` (cwd=repository root). Exit code 0/1 feeds directly into a pre-commit gate.
|
|
43
|
+
|
|
44
|
+
## Coding conventions (all UTF-8 · commands go through python)
|
|
45
|
+
|
|
46
|
+
### Coding conventions (all UTF-8 · commands go through python)
|
|
47
|
+
|
|
48
|
+
**All text in this repository is UTF-8 (no BOM)**: source code, configuration, documentation, data, test fixtures, and also **paths and file names** (including Hive task identifiers). Chinese may appear directly in paths: this is not a suggestion, it is a convention.
|
|
49
|
+
|
|
50
|
+
> **Explicit statement for AI agents and integrators**: this is UTF-8. Access everything in this repository through **python** (`python -X utf8 ...`, equivalent to `PYTHONUTF8=1`); **do not use the console/terminal as the access channel**. The Windows console interprets received bytes according to its **code page** and renders Chinese as mojibake (measured: `控制台试验` displays as `鎺у埗鍙拌瘯楠` in a code page 936 window). **That is a display-layer problem, not a data-layer problem**: not a single character is lost. We **do not do console compatibility**: all reads, writes, and decisions work on UTF-8 bytes, and correctness does not depend on anyone's code page setting.
|
|
51
|
+
|
|
52
|
+
- **Entry-point self-guarantee**: the Python entry point checks `sys.flags.utf8_mode` at the earliest point; if it is off, it sets `PYTHONUTF8=1` / `PYTHONIOENCODING=utf-8` and restarts itself; when a restart is impossible it fails fast (no silent degradation).
|
|
53
|
+
- **Explicit over default**: in new code, `open()` / `read_text()` always pass `encoding="utf-8"` explicitly and never rely on the locale default (the default on Chinese Windows is cp936, and a bare `open()` reads and writes with it).
|
|
54
|
+
- **NFC measurement basis = reject, do not normalize silently** (see [identifier contract v2](../../plans/全中文编码与蜂巢任务标识契约_v2.0.md) §4.4 / §4.8): paths and identifiers **must already be in NFC-stable form** to be accepted. The criterion is the **block whitelist** `hive/id_charset_blocks.txt` (single source of truth: Rust embeds it at compile time via `include_str!`, and MCP and `md_cg` read the same file, **so no runtime Unicode property table is consulted and a property-table version skew between the two sides is structurally impossible**). Forms outside the table are **explicitly rejected**: forms that normalization would rewrite (CJK compatibility ideographs / fullwidth / circled letters and digits / mathematical alphanumerics / combining marks, and so on), and **letters and digits from scripts outside the whitelisted blocks** (the block selection is ASCII / Latin / Greek / Cyrillic / kana / Hangul syllables / CJK and extensions / bopomofo; see contract §4.4 for the deliberately excluded ranges). No silent rewriting is done (a zero-dependency hand-written full NFC implementation on the `hive` side is not feasible; rejection is stricter than silent normalization).
|
|
55
|
+
- **Hive task identifiers (id contract v2)**: `h_<identity>_<task>_<unit>_<number>`, for example `h_zcode端_灵枢迭代_反思单元_0001`. Three of the four slots (identity / task / unit) are **required at submission** and must not be derived silently; the number is assigned exclusively by the Rust-side allocator (fixed width of 4 digits, explicit error on overflow, no widening and no wraparound); the unit slot takes the closed set of five Hive units (recording unit / reflection unit / verification unit / output unit / life-support system). The CLI uses `--identity/--task/--unit` (env fallbacks `HIVE_JOB_IDENTITY/HIVE_JOB_TASK/HIVE_JOB_UNIT`), or `hive alloc-id` to get an id only; MCP `hive_spawn` takes the same three parameters (required). The old form `h<13-digit milliseconds>_<4-digit hex>` **remains valid** (zero migration for existing data).
|
|
56
|
+
- **The platform surface** is covered by the encoding / locale guards of the container dual-stack gate (see the next section).
|
|
57
|
+
|
|
58
|
+
## Linux verification (Docker container dual stack)
|
|
59
|
+
|
|
60
|
+
### Linux verification (Docker container dual stack, a release gate since 0.5.0)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# 栈一:rust + python 全量(cargo test / python 18 套含全部守卫 / smoke 端到端)
|
|
64
|
+
docker run --rm -v "$(pwd):/work" -w /work -e CARGO_TARGET_DIR=/tmp/target \
|
|
65
|
+
rust:bookworm bash scripts/linux_verify.sh full
|
|
66
|
+
# 栈二:node 生态(发布件 TS 编译 + node test)
|
|
67
|
+
docker run --rm -v "$(pwd):/work" -w /work node:22-bookworm bash -c \
|
|
68
|
+
"npm install --include=dev && npm run build && node --import tsx --test test/*.test.ts"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> The executor interpreter is probed by a trial run in `hive/src/exec.rs` (`python3` first, `python` as fallback), so the two commands above can be **copied as-is** with no need to pass `HIVE_PYTHON`; set it explicitly only to choose a different interpreter (an explicit value overrides the probe). Under Git Bash/MSYS you must first `export MSYS_NO_PATHCONV=1`, otherwise `/work` is rewritten to `C:/Program Files/Git/work`.
|
|
72
|
+
> Platform-difference guards are covered by the script list (encoding / locale / session filtering / SIGTERM cleanup); suites that depend on gitignored local corpora (p44 and others) are not in the container list and are covered on machines that have the corpora through the SKIP surface of `run_tests.py`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
> **Languages:** [中文](../../dev/开关矩阵.md) · English
|
|
2
|
+
|
|
3
|
+
# Retrieval switch matrix and adjudication history
|
|
4
|
+
|
|
5
|
+
> This page was split out of the original `README.md` (source: the "Do not mix up the two cross-language switches" section of the original README (L600-L611)).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
> **Do not mix up the two cross-language switches**: `MDCG_UNIFY_QUERY` (the unified normalization layer, **off by default**. On 2026-09-30 a user adjudication flipped it from "on by default" to "**off when unset, on only with an explicit `=1`**": the job of this layer is to let English queries hit Chinese nodes, and for a Chinese retrieval pool it is pure overhead.
|
|
9
|
+
> Measured on the public locomo-zh-500 question set, the default-off state gives lexical hit@1 96.4% / lexical+fuzzy 97.2%, while the on state gives 95.8% / 96.6%; when explicitly enabled, a query in any language is first normalized into a standard Chinese atom sequence, and the lexical path can then hit Chinese nodes; **on 2026-09-30 the scope was narrowed: translation normalization applies only to English content, Chinese segments are kept verbatim and never sent to the segmenter**, so Chinese keyword runs in a mixed Chinese-English query are no longer split character by character) and `MDCG_EN_ATOMS` (English-to-Chinese recall term expansion, **off by default**) are independent switches;
|
|
10
|
+
> `MDCG_SEMANTIC` (the `fm.semantic` semantic-summary path) is likewise off by default. Changing either one requires updating the dual-state assertions in `md_cg/test_en_pipeline.py` and `md_cg/test_semantic_canonical.py`; changing the normalization layer **default / three-state** behavior requires running `md_cg/test_unify_default_off.py` (three-state agreement on both sides plus a fixed-point mutation self-proof), and changing its **scope** additionally requires running `md_cg/test_unify_scope.py` (same-origin fixture with the Rust side, `md_cg/semantic/unify_fixture.json`, see `docs/hive/检索算法口径对照_v0.1.md`).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Translation glossary
|
|
2
|
+
|
|
3
|
+
> **Languages:** [中文](../README.md) · English
|
|
4
|
+
|
|
5
|
+
This glossary fixes the English vocabulary for the LINGSHU documentation. Use it consistently across every translated page. When a term is missing, add it here in the same pull request instead of inventing a synonym.
|
|
6
|
+
|
|
7
|
+
## Product and architecture
|
|
8
|
+
|
|
9
|
+
| Chinese | English | Notes |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| 灵枢 | LINGSHU | Product name. Never translate as "spiritual pivot". |
|
|
12
|
+
| 认知图 | cognitive map | The graph of memory, verification, reflection, and connection units. |
|
|
13
|
+
| 记忆卡 | memory card | A typed unit stored in the cognitive map. |
|
|
14
|
+
| 记录单元 | recording unit | Unit kind that stores raw observations. |
|
|
15
|
+
| 验证单元 | verification unit | Unit kind that records evidence and verdicts. |
|
|
16
|
+
| 反思单元 | reflection unit | Unit kind that records reflection. |
|
|
17
|
+
| 召回 | recall | Retrieve units by intent, not a raw search. |
|
|
18
|
+
| 检索 | retrieval | Lookup inside a single surface. |
|
|
19
|
+
| 落盘 | persist to disk | Write durable state. |
|
|
20
|
+
| 提交 | committed | Git commit or durable write, depending on context. |
|
|
21
|
+
| 闸门 | gate | Automated acceptance check. |
|
|
22
|
+
| 裁决 | adjudication / adjudicate | Formal verdict on a claim. |
|
|
23
|
+
| 白箱 | white-box | Inspectable internal state. |
|
|
24
|
+
| 蜂群 | swarm | Multi-agent execution mode. |
|
|
25
|
+
| 蜂巢 | hive | Concurrency engine and isolation layer. |
|
|
26
|
+
| 蜂巢并发引擎 | Hive concurrency engine | Capitalize Hive. |
|
|
27
|
+
| 世界模型 | world model | Predictive model of the workspace. |
|
|
28
|
+
| 语义时空图 | semantic spatiotemporal graph | STG. |
|
|
29
|
+
| 条件空间 | condition space | The set of conditions that make a unit valid. |
|
|
30
|
+
| 生效条件 | effective condition | Condition under which a rule is active. |
|
|
31
|
+
| 名实校验 | name-reality validation | Check that a claimed name matches observable behavior. |
|
|
32
|
+
| 写入别名 | write aliases | Accepted alternative names for write operations. |
|
|
33
|
+
| 口径 | measurement basis | The agreed definition used by a metric or contract. |
|
|
34
|
+
| 证据链 | evidence chain | Ordered evidence supporting a claim. |
|
|
35
|
+
| 双实例互验 | dual-instance cross-verification | Two independent instances check each other. |
|
|
36
|
+
| 静默降级 | silent degradation | A capability quietly stops working. |
|
|
37
|
+
| 灵枢大脑 | Lingshu Brain | Capitalize both words. |
|
|
38
|
+
| 设计者 | Designer | Capitalize when it names the trust tier. |
|
|
39
|
+
| 护栏宪章 | Guardrail Charter | Capitalize as a document title. |
|
|
40
|
+
| 工作纪律 | Engineering Discipline | Capitalize as a document title. |
|
|
41
|
+
| 协议实例 | protocol instance | |
|
|
42
|
+
| 子代理 | subagent | |
|
|
43
|
+
| 外部代理 | external agent | |
|
|
44
|
+
| 只读层 | read layer | |
|
|
45
|
+
| 写入层 | write layer | |
|
|
46
|
+
| 验证层 | verify layer | |
|
|
47
|
+
| 设计层 | design layer | |
|
|
48
|
+
| 访客 | guest | Permission role. |
|
|
49
|
+
| 设计者权限 | Designer permission | |
|
|
50
|
+
| 一致性 | consistency | |
|
|
51
|
+
| 漂移 | drift | |
|
|
52
|
+
| 回填 | backfill | |
|
|
53
|
+
| 迁移 | migration | |
|
|
54
|
+
| 灰度 | canary / gradual rollout | Prefer "canary" for releases. |
|
|
55
|
+
| 复盘 | retrospective | |
|
|
56
|
+
| 闭环 | closed loop | |
|
|
57
|
+
| 抓手 | lever | Avoid literal "grip". |
|
|
58
|
+
| 颗粒度 | granularity | |
|
|
59
|
+
| 底层逻辑 | underlying logic | |
|
|
60
|
+
| 对齐 | align | |
|
|
61
|
+
| 拉通 | align across teams | |
|
|
62
|
+
| 落地 | land / ship | Prefer "land" for plans, "ship" for releases. |
|
|
63
|
+
|
|
64
|
+
## Tool and protocol names
|
|
65
|
+
|
|
66
|
+
Keep these tokens unchanged in prose, code spans, and links:
|
|
67
|
+
|
|
68
|
+
- Tools: cg, stg, mdcg_*, md_cg, mcp_server, tools, init, recall, verify, review, protect, sustain, scrub, consolidate, insight, ccg, edges, audit.
|
|
69
|
+
- Modes: core, brain, all.
|
|
70
|
+
- Paths and commands: python -m md_cg.mcp_server, npx @furongjun1999/dsh-memory, scripts/audit_translation.py.
|
|
71
|
+
- File names and config keys are never translated.
|
|
72
|
+
- Harness names: DSH, Codex, Claude Code, CodeBuddy, ZCode.
|
|
73
|
+
|
|
74
|
+
## Style rules
|
|
75
|
+
|
|
76
|
+
1. Write in direct, technical English. Prefer imperative sentences for procedures.
|
|
77
|
+
2. Keep one sentence per source sentence where practical. Do not merge or split paragraphs unless a literal translation is unreadable.
|
|
78
|
+
3. Preserve every heading level exactly. The audit compares the ATX heading level sequence.
|
|
79
|
+
4. Copy every fenced code block byte-for-byte, including comments, language tags, and trailing spaces. The audit compares blocks exactly.
|
|
80
|
+
5. Translate prose only. Do not translate code, commands, paths, JSON keys, config keys, tool names, or version strings.
|
|
81
|
+
6. Avoid Chinese punctuation in prose. Use ASCII commas, periods, colons, semicolons, parentheses, and quotation marks.
|
|
82
|
+
7. Do not leave Han characters in prose. If a Chinese term must appear, put it in an inline code span, for example the old label.
|
|
83
|
+
8. Keep the language header as the first line: a blockquote with a Chinese link back to the source and the word English.
|
|
84
|
+
9. Rewrite relative links: point to the English target when one exists in docs/en/TRANSLATION_MANIFEST.json; otherwise point to the Chinese source. Never leave a link broken.
|
|
85
|
+
10. Preserve tables, lists, blockquotes, and admonitions. Translate cell text and list text, not code tokens.
|
|
86
|
+
11. Do not add new sections, examples, or claims. A translation may clarify grammar but must not change scope.
|
|
87
|
+
12. Keep dates, version numbers, issue numbers, and commit hashes unchanged.
|
|
88
|
+
13. When a source sentence is ambiguous, keep the ambiguity and add a translator note only if the ambiguity would cause a wrong action.
|
|
89
|
+
14. Product voice: confident, concrete, evidence-first. Avoid marketing adjectives that are absent from the source.
|
|
90
|
+
|
|
91
|
+
## Verification
|
|
92
|
+
|
|
93
|
+
Run the mechanical gate from the repository root:
|
|
94
|
+
|
|
95
|
+
python scripts/audit_translation.py --check
|
|
96
|
+
|
|
97
|
+
A translation is acceptable only when the gate reports no findings for its pair and the link checker still passes. The gate checks existence, the language header, code fences, heading levels, Han leakage, CJK punctuation, relative links, scope coverage, and generated-document handling.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
> **Languages:** [中文](../../../claude/README.md) · English
|
|
2
|
+
|
|
3
|
+
# Claude Code side · LINGSHU integration configuration
|
|
4
|
+
|
|
5
|
+
This directory = **Claude Code (Anthropic) harness-specific configuration**. Claude Code **reads `CLAUDE.md` at the project root at session start**
|
|
6
|
+
(it also supports global injection via `~/.claude/CLAUDE.md` and the private `CLAUDE.local.md` addition),
|
|
7
|
+
so this side's artifact uses the `full` variant and mirrors the ZCode / Codex sides.
|
|
8
|
+
|
|
9
|
+
## Directory contents
|
|
10
|
+
|
|
11
|
+
| File | Purpose | Nature |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `CLAUDE.md` | Full text of the 19 engineering discipline rules (injected at session start) | **Rendered artifact**; do not edit by hand |
|
|
14
|
+
| `mcp.json.example` | LINGSHU integration template: two MCP servers, `mdcg` (memory brain) + `hive` (Hive concurrency), to save as `.mcp.json` at the project root | Template |
|
|
15
|
+
| `README.md` | This file (integration guide + memory strategy) | Hand-written |
|
|
16
|
+
|
|
17
|
+
## Three-step integration
|
|
18
|
+
|
|
19
|
+
### 1. Connect the memory brain (MCP)
|
|
20
|
+
|
|
21
|
+
Copy `mcp.json.example` to the root of your project and **rename it to `.mcp.json`**, then replace the `env.PYTHONPATH`
|
|
22
|
+
placeholder (`REPLACE_WITH_ABSOLUTE_PATH_TO_dsh-memory`) with **the directory where the dsh-memory repository sits
|
|
23
|
+
on your machine**. This must be a resolvable absolute path: Python uses it to locate the `md_cg` package inside the repository,
|
|
24
|
+
and a relative path breaks when the process working directory changes.
|
|
25
|
+
|
|
26
|
+
You can also register it with the built-in Claude Code command (equivalent effect):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude mcp add mdcg --env PYTHONPATH=<本机 dsh-memory 绝对路径> --env MDCG_MCP_SURFACE=kernel \
|
|
30
|
+
--env MDCG_ACTOR=claude-code -- python -m md_cg.mcp_server
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For the tool surface, see [`../codebuddy/README.md`](codebuddy.md): `MDCG_MCP_SURFACE=kernel`
|
|
34
|
+
exposes only the two cognitive primitives `cg` / `stg`; `cg` already covers every op such as `route` / `read` / `write`,
|
|
35
|
+
so **the write path is not missing**. The `md_cg` brain ships with the repository, so no engine needs to be installed with pip.
|
|
36
|
+
|
|
37
|
+
#### 1b. Connect Hive (multi-agent concurrency + task context management)
|
|
38
|
+
|
|
39
|
+
Also write the second, same-source `mcpServers.hive` entry from `mcp.json.example` into `.mcp.json`: four tools
|
|
40
|
+
`hive_spawn` / `hive_poll` / `hive_kill` / `hive_doctor` provide **concurrent execution shared across harnesses** and
|
|
41
|
+
**task context management** (`context_files` injection, resuming on returned budget, progress card observation). Or register it with a command (equivalent effect):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
claude mcp add hive --env PYTHONPATH=<本机 dsh-memory 绝对路径> -- python -m hive.hive_mcp.mcp_server
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For semantics and boundaries, see [`../hive/README.md`](../../../hive/README.md), section 'per-harness registration'. **Deterministic tasks
|
|
48
|
+
(running commands / tests) are not on the MCP surface**; use the CLI: `hive/target/release/hive.exe submit --spec <spec.json>`.
|
|
49
|
+
|
|
50
|
+
### 2. Inject the engineering discipline
|
|
51
|
+
|
|
52
|
+
Copy `claude/CLAUDE.md` to **the root of your project** (Claude Code reads it automatically at session start);
|
|
53
|
+
it takes effect in a new session. To apply it to all projects, put it in `~/.claude/CLAUDE.md` (global injection, affects every session, use with care).
|
|
54
|
+
|
|
55
|
+
> This repository deliberately keeps the artifact in the `claude/` subdirectory and **does not put it at the root**: the repository-root `AGENTS.md` is a local private carrier
|
|
56
|
+
> (it contains machine operations notes and is ignored by `.gitignore`); and Claude Code only recognizes `CLAUDE.md` and does not read
|
|
57
|
+
> `AGENTS.md`, so its file name does not conflict with CodeBuddy (`CODEBUDDY.md`) / Codex (`AGENTS.md`).
|
|
58
|
+
> Multiple sides can coexist at the same project root without overwriting each other.
|
|
59
|
+
|
|
60
|
+
### 3. Restart the session
|
|
61
|
+
|
|
62
|
+
The discipline is **injected in full once at session start**; after a change you must create a new session for it to take effect.
|
|
63
|
+
|
|
64
|
+
## Memory strategy: record what matters, not the stream
|
|
65
|
+
|
|
66
|
+
Same as the CodeBuddy / Codex sides: **record only core changes (content / reason / location / verification conclusion) + the conversation record**;
|
|
67
|
+
never write intermediate process / trial-and-error steps / debugging details. The Claude Code side has no session hook for automatic memory,
|
|
68
|
+
so memory capture is driven by explicit archiving under discipline rule 16 (`cg(op=write, gated=true)` passes the three-question four-state gate).
|
|
69
|
+
See the 'Memory strategy' section of [`../codebuddy/README.md`](codebuddy.md).
|
|
70
|
+
|
|
71
|
+
## Write credentials (determines whether data actually persists)
|
|
72
|
+
|
|
73
|
+
`md_cg` is **fail-closed**: without a token it runs as a **read-only guest**, so reads / recall / timelines work as usual,
|
|
74
|
+
but memory writes **do not persist**. Issue a token (designer is the only role that can manage, with `clearance_cap=secret`):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python -m md_cg.tokens issue --role designer --actor claude-code
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Put the returned plaintext token into `env` in the project-root `.mcp.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
"MDCG_TOKEN": "<签发返回的明文令牌>"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
> **Do not treat `ok: true` as a successful write**: when nothing persists, the response body looks like
|
|
87
|
+
> `{"ok": true, "committed": false, "moved_to": "review_queue"}`; whether data persisted **depends only on `committed`**.
|
|
88
|
+
|
|
89
|
+
## Coexistence with other sides
|
|
90
|
+
|
|
91
|
+
Claude Code reads `CLAUDE.md` at the project root, CodeBuddy reads `CODEBUDDY.md`, and Codex / ZCode read
|
|
92
|
+
`AGENTS.md`: the file names do not conflict and can coexist at the same project root; the content is same-source (rendered from the same source of truth), so copying either one is enough.
|
|
93
|
+
|
|
94
|
+
## Maintenance (for LINGSHU maintainers)
|
|
95
|
+
|
|
96
|
+
- `CLAUDE.md` is rendered by `scripts/render_discipline.py` from the **single source of truth**, `docs/工作纪律_认知图条目_v1.1.json`;
|
|
97
|
+
see `docs/discipline/harnesses.yaml` for the matrix (`claude-code` slot).
|
|
98
|
+
- Change the discipline -> change the source of truth -> run `python scripts/render_discipline.py --target claude-code --write`
|
|
99
|
+
-> `python scripts/verify_discipline.py --target claude-code` passes -> commit.
|
|
100
|
+
- **Hand-editing `CLAUDE.md` in this directory is flagged as drift by `verify_discipline.py`**.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
> **Languages:** [中文](../../../codebuddy/README.md) · English
|
|
2
|
+
|
|
3
|
+
# CodeBuddy side · LINGSHU integration configuration
|
|
4
|
+
|
|
5
|
+
This directory = **CodeBuddy harness-specific configuration** (LINGSHU = the Lingshu memory system). It is a peer of `dsh/` and `zcode/`;
|
|
6
|
+
the shared layer (`md_cg/` brain, `data/`, `docs/`, `scripts/`) lives at the repository root and belongs to no single side.
|
|
7
|
+
|
|
8
|
+
## Directory contents
|
|
9
|
+
|
|
10
|
+
| File | Purpose | Nature |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| `CODEBUDDY.md` | Full text of the 19 engineering discipline rules (injected at session start) | **Rendered artifact**; do not edit by hand |
|
|
13
|
+
| `mcp.json` | LINGSHU integration template: two MCP servers, `mdcg` (memory brain) + `hive` (Hive concurrency), to copy into CodeBuddy settings | Template |
|
|
14
|
+
| `README.md` | This file (integration guide + memory strategy) | Hand-written |
|
|
15
|
+
|
|
16
|
+
## Three-step integration
|
|
17
|
+
|
|
18
|
+
### 1. Connect the memory brain (MCP)
|
|
19
|
+
|
|
20
|
+
Merge the `mcpServers.mdcg` section of `mcp.json` into the CodeBuddy MCP configuration, then replace
|
|
21
|
+
the `PYTHONPATH` placeholder (`REPLACE_WITH_ABSOLUTE_PATH_TO_dsh-memory`) with **the directory where the dsh-memory repository sits on your machine**.
|
|
22
|
+
This must be a resolvable absolute path: Python uses it to locate the `md_cg` package inside the repository, and a relative path breaks when the process working directory changes.
|
|
23
|
+
|
|
24
|
+
The `md_cg` brain ships with the repository, so **no engine needs to be installed with pip**; you only need Python and Node ≥ 22.19 on the machine.
|
|
25
|
+
|
|
26
|
+
> **Tool surface `MDCG_MCP_SURFACE=kernel`** (matches the default in `md_cg/mcp_server.py`): only the two cognitive primitives `cg` /
|
|
27
|
+
> `stg` are exposed; `cg` already covers every op such as `route` / `read` / `write`, so **the write path is not missing**.
|
|
28
|
+
> The fine-grained `mdcg_*` tools are visible only on the `full` surface and serve compatibility / debugging purposes; day-to-day integration does not need them enabled.
|
|
29
|
+
|
|
30
|
+
#### 1b. Connect Hive (multi-agent concurrency + task context management)
|
|
31
|
+
|
|
32
|
+
Also merge the second, same-source `mcpServers.hive` entry in `mcp.json`: four tools `hive_spawn` / `hive_poll` /
|
|
33
|
+
`hive_kill` / `hive_doctor` provide **concurrent execution shared across harnesses** and **task context management**
|
|
34
|
+
(`context_files` injection, resuming on returned budget, progress card observation). For semantics and boundaries, see
|
|
35
|
+
'per-harness registration' in [`../hive/README.md`](../../../hive/README.md).
|
|
36
|
+
|
|
37
|
+
> This depends on the Rust-side `hive.exe` and `hive/config.local.json` (executor key). If it has not been built yet, run
|
|
38
|
+
> `cd hive && cargo build --release`; if `cargo` is not on PATH, use the absolute path
|
|
39
|
+
> `"%USERPROFILE%\.cargo\bin\cargo.exe" build --release --manifest-path hive/Cargo.toml`;
|
|
40
|
+
> the first `hive_spawn` starts `serve` automatically in detached mode.
|
|
41
|
+
> **Deterministic tasks (running commands / tests) are not on the MCP surface**; use the CLI:
|
|
42
|
+
> `hive/target/release/hive.exe submit --spec <spec.json>`.
|
|
43
|
+
|
|
44
|
+
### 2. Inject the engineering discipline
|
|
45
|
+
|
|
46
|
+
Copy `CODEBUDDY.md` to **the root of your project**.
|
|
47
|
+
|
|
48
|
+
> CodeBuddy rule precedence: when `CODEBUDDY.md` exists at the root, `AGENTS.md` is **ignored**.
|
|
49
|
+
> This repository deliberately keeps the artifact in the `codebuddy/` subdirectory and **does not put it at the root**,
|
|
50
|
+
> because the repository-root `AGENTS.md` is a local private carrier (it contains machine operations notes and is ignored by `.gitignore`).
|
|
51
|
+
> Keeping it in the subdirectory lets external users take it directly without hiding the local discipline.
|
|
52
|
+
|
|
53
|
+
### 3. Restart the session
|
|
54
|
+
|
|
55
|
+
The discipline is **injected in full once at session start**; after a change you must create a new session for it to take effect.
|
|
56
|
+
|
|
57
|
+
## Memory strategy: record what matters, not the stream
|
|
58
|
+
|
|
59
|
+
LINGSHU is a memory system, but **recording everything is the same as recording nothing**, so the write side has two mechanical filters rather than relying on human discipline:
|
|
60
|
+
|
|
61
|
+
| Layer | Content | Landing point | Filter |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| **Important content** | Core changes: content / reason / location / verification conclusion | `knowledge` / `self` layer | `cg(op=write, gated=true)` passes the **three-question four-state gate**; anything other than `ACCEPT` does not persist |
|
|
64
|
+
| **Conversation record** | Session transcript | `contextual` layer | The active forgetting gate automatically `DROP`s low-entropy noise by importance threshold |
|
|
65
|
+
|
|
66
|
+
- **Rule 16** requires archiving core changes at the end of every task: this is the closed-loop entry from conversation to long-term memory.
|
|
67
|
+
- **Never** write intermediate process / trial-and-error steps / debugging details / repeated confirmations; such content pollutes retrieval and interferes with later recall.
|
|
68
|
+
- The CodeBuddy side **has no** session hook for automatic memory like DSH, so memory capture is driven by discipline (the agent explicitly calls
|
|
69
|
+
`cg(op=write, gated=true)` at the end) rather than by automatic process capture.
|
|
70
|
+
|
|
71
|
+
## Write credentials (determines whether data actually persists)
|
|
72
|
+
|
|
73
|
+
`md_cg` is **fail-closed**: without credentials the plugin runs as a **read-only guest**, so reads / recall / timelines work as usual,
|
|
74
|
+
but memory writes **do not persist**. To persist, issue a token:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python -m md_cg.tokens issue --role designer --actor codebuddy --clearance internal ^
|
|
78
|
+
--ops-allow info,route,read,write,recent,goal,identity,whitebox,verify ^
|
|
79
|
+
--layers-allow knowledge,contextual,structural,self,goals,unresolved,rejected
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then put `MDCG_TOKEN` into the `env` of `mcp.json` (or set a system environment variable and reference it).
|
|
83
|
+
|
|
84
|
+
> **Do not treat `ok: true` as a successful write**: when nothing persists, the response body looks like
|
|
85
|
+
> `{"ok": true, "committed": false, "moved_to": "review_queue"}`; whether data persisted **depends only on `committed`**.
|
|
86
|
+
|
|
87
|
+
## Maintenance (for LINGSHU maintainers)
|
|
88
|
+
|
|
89
|
+
- `CODEBUDDY.md` is rendered by `scripts/render_discipline.py` from the **single source of truth**, `docs/工作纪律_认知图条目_v1.1.json`;
|
|
90
|
+
see `docs/discipline/harnesses.yaml` for the matrix (`codebuddy` slot).
|
|
91
|
+
- Change the discipline -> change the source of truth -> run `python scripts/render_discipline.py --target codebuddy --write`
|
|
92
|
+
-> `python scripts/verify_discipline.py --target codebuddy` passes -> commit.
|
|
93
|
+
- **Hand-editing `CODEBUDDY.md` in this directory is flagged as drift by `verify_discipline.py`**.
|