@michelj/context-guard 0.4.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/Coordinator.md +88 -0
  2. package/Executor.md +53 -0
  3. package/README.md +89 -224
  4. package/README.zh-CN.md +89 -224
  5. package/SKILL.md +26 -684
  6. package/THIRD_PARTY_NOTICES.md +47 -0
  7. package/Tester.md +53 -0
  8. package/agents/openai.yaml +2 -2
  9. package/bin/build-runtime.mjs +96 -0
  10. package/bin/context-guard-skill.js +399 -78
  11. package/bin/postinstall.js +2 -2
  12. package/hooks.json +89 -13
  13. package/licenses/JSONParse-MIT.txt +24 -0
  14. package/licenses/Marked-MIT.txt +44 -0
  15. package/licenses/Portless-Apache-2.0.txt +201 -0
  16. package/package.json +35 -6
  17. package/prototype/LICENSES/Marked-MIT.txt +44 -0
  18. package/prototype/LICENSES/Ready-redistribution.txt +14 -0
  19. package/prototype/attachments.mjs +75 -0
  20. package/prototype/coordinator-markdown.mjs +283 -0
  21. package/prototype/coordinator-working-blot.mjs +124 -0
  22. package/prototype/vendor/marked.mjs +2189 -0
  23. package/prototype/workbench-app.js +5197 -0
  24. package/prototype/workbench-data.js +33 -0
  25. package/prototype/workbench-sync.mjs +898 -0
  26. package/prototype/workbench.css +1050 -0
  27. package/prototype/workbench.html +211 -0
  28. package/prototype/working-blot-atlas.png +0 -0
  29. package/references/agent-handoff.md +40 -0
  30. package/references/claude-runtime.md +120 -0
  31. package/references/cloud-sync-interface.md +66 -0
  32. package/references/design-current.md +14 -0
  33. package/references/map-mount.md +41 -0
  34. package/references/map-read.md +50 -0
  35. package/references/memory-definition.md +120 -0
  36. package/references/memory-filesystem-v2/Bug.en.md +162 -0
  37. package/references/memory-filesystem-v2/Bug.md +162 -0
  38. package/references/memory-filesystem-v2/Bug_Coordinater.md +8 -0
  39. package/references/memory-filesystem-v2/Bug_Executor.md +8 -0
  40. package/references/memory-filesystem-v2/Bug_Tester.md +7 -0
  41. package/references/memory-filesystem-v2/Idea.en.md +36 -0
  42. package/references/memory-filesystem-v2/Idea.md +36 -0
  43. package/references/memory-filesystem-v2/Node_Module_Index.en.md +88 -0
  44. package/references/memory-filesystem-v2/Node_Module_Index.md +88 -0
  45. package/references/memory-filesystem-v2/README.md +60 -0
  46. package/references/memory-filesystem-v2/Todo.en.md +137 -0
  47. package/references/memory-filesystem-v2/Todo.md +137 -0
  48. package/references/memory-filesystem-v2/Todo_Coordinater.md +7 -0
  49. package/references/memory-filesystem-v2/Todo_Executor.md +7 -0
  50. package/references/memory-filesystem-v2/Todo_Tester.md +7 -0
  51. package/references/named-workbench.md +124 -0
  52. package/references/plan-review.md +12 -0
  53. package/references/server-memory.md +276 -0
  54. package/references/test-check.md +7 -0
  55. package/references/user-reply.md +38 -0
  56. package/references/workbench-interface.md +531 -0
  57. package/roles.md +13 -0
  58. package/scripts/context_guard.py +1366 -7602
  59. package/scripts/context_guard_hook.py +1960 -711
  60. package/scripts/map_owns.py +699 -0
  61. package/scripts/shared/LICENSES/JSONParse-MIT.txt +24 -0
  62. package/scripts/shared/filesystem-v2.mjs +430 -0
  63. package/scripts/shared/io.mjs +117 -0
  64. package/scripts/shared/map-model.mjs +506 -0
  65. package/scripts/shared/memory-schema.mjs +13 -0
  66. package/scripts/shared/protocol-blobs.mjs +112 -0
  67. package/scripts/shared/protocol-map.mjs +146 -0
  68. package/scripts/shared/protocol-snapshots.mjs +84 -0
  69. package/scripts/shared/protocol-store.mjs +624 -0
  70. package/scripts/shared/protocol-workflow.mjs +226 -0
  71. package/scripts/shared/protocol.mjs +125 -0
  72. package/scripts/shared/vendor/jsonparse.cjs +413 -0
  73. package/scripts/workbench/access.mjs +496 -0
  74. package/scripts/workbench/attachments.mjs +92 -0
  75. package/scripts/workbench/browser-login.mjs +78 -0
  76. package/scripts/workbench/claude-runtime.mjs +372 -0
  77. package/scripts/workbench/cli.mjs +980 -0
  78. package/scripts/workbench/device-heartbeat.mjs +72 -0
  79. package/scripts/workbench/hook-status.mjs +38 -0
  80. package/scripts/workbench/inbox.mjs +155 -0
  81. package/scripts/workbench/journal.mjs +56 -0
  82. package/scripts/workbench/memory-merge.mjs +65 -0
  83. package/scripts/workbench/memory.mjs +252 -0
  84. package/scripts/workbench/named-proxy.mjs +108 -0
  85. package/scripts/workbench/named.mjs +152 -0
  86. package/scripts/workbench/portless-routes.mjs +51 -0
  87. package/scripts/workbench/project.mjs +327 -0
  88. package/scripts/workbench/projections.mjs +68 -0
  89. package/scripts/workbench/protocol-client.mjs +165 -0
  90. package/scripts/workbench/protocol-delivery.mjs +133 -0
  91. package/scripts/workbench/protocol-device.mjs +316 -0
  92. package/scripts/workbench/protocol-events.mjs +53 -0
  93. package/scripts/workbench/protocol-repository.mjs +58 -0
  94. package/scripts/workbench/reconcile.mjs +244 -0
  95. package/scripts/workbench/registry.mjs +111 -0
  96. package/scripts/workbench/runtime.mjs +54 -0
  97. package/scripts/workbench/server.mjs +1171 -0
  98. package/scripts/workbench/store.mjs +243 -0
  99. package/scripts/workbench/sync-coordinator.mjs +518 -0
  100. package/scripts/workbench/sync.mjs +86 -0
  101. package/references/context-template.md +0 -341
  102. package/references/feature-chain-methodology.md +0 -228
  103. package/references/register-template.md +0 -85
  104. package/references/task-case-template.md +0 -63
  105. package/tests/BC-20260618-063.sh +0 -116
  106. package/tests/BC-20260618-065.sh +0 -66
  107. package/tests/BC-20260626-080.sh +0 -48
  108. package/tests/BC-20260626-081.sh +0 -40
  109. package/tests/BC-20260626-082.sh +0 -32
  110. package/tests/BC-20260626-083.sh +0 -66
  111. package/tests/BC-20260627-084.sh +0 -74
  112. package/tests/BC-20260630-086.sh +0 -50
  113. package/tests/BC-20260630-087.sh +0 -103
  114. package/tests/BC-20260630-088.sh +0 -32
  115. package/tests/BC-20260630-089.sh +0 -63
  116. package/tests/BC-20260701-090.sh +0 -84
  117. package/tests/BC-20260702-096.sh +0 -48
  118. package/tests/BC-20260706-098.sh +0 -66
  119. package/tests/BC-20260707-099.sh +0 -47
  120. package/tests/BC-20260707-100.sh +0 -46
  121. package/tests/BC-20260707-101.sh +0 -47
  122. package/tests/BC-20260707-102.sh +0 -68
  123. package/tests/BC-20260707-103.sh +0 -59
  124. package/tests/BC-20260707-104.sh +0 -103
  125. package/tests/BC-20260707-105.sh +0 -109
  126. package/tests/BC-20260707-106.sh +0 -80
  127. package/tests/BC-20260707-107.sh +0 -74
  128. package/tests/BC-20260707-108.sh +0 -48
  129. package/tests/BC-20260707-109.sh +0 -56
  130. package/tests/BC-20260707-110.sh +0 -71
  131. package/tests/BC-20260707-111.sh +0 -70
  132. package/tests/BC-20260707-112.sh +0 -45
  133. package/tests/BC-20260707-113.sh +0 -73
  134. package/tests/BC-20260707-115.sh +0 -77
  135. package/tests/BC-20260707-116.sh +0 -77
  136. package/tests/BC-20260707-118.sh +0 -115
  137. package/tests/BC-20260707-119.sh +0 -47
  138. package/tests/BC-20260707-120.sh +0 -60
  139. package/tests/BC-20260707-121.sh +0 -66
  140. package/tests/BC-20260707-122.sh +0 -48
  141. package/tests/BC-20260707-123.sh +0 -43
  142. package/tests/BC-20260707-124.sh +0 -56
  143. package/tests/BC-20260707-125.sh +0 -64
  144. package/tests/BC-20260707-126.sh +0 -80
  145. package/tests/BC-20260707-127.sh +0 -88
  146. package/tests/BC-20260707-129.sh +0 -59
  147. package/tests/BC-20260707-130.sh +0 -69
  148. package/tests/BC-20260707-131.sh +0 -140
  149. package/tests/BC-20260707-132.sh +0 -150
  150. package/tests/BC-20260707-133.sh +0 -70
  151. package/tests/BC-20260708-136.sh +0 -210
  152. package/tests/BC-20260708-137.sh +0 -106
  153. package/tests/BC-20260708-138.sh +0 -168
  154. package/tests/BC-20260708-139.sh +0 -79
  155. package/tests/BC-20260709-002.sh +0 -63
  156. package/tests/BC-20260709-003.sh +0 -239
  157. package/tests/BC-20260709-006.sh +0 -76
  158. package/tests/BC-20260709-008.sh +0 -168
  159. package/tests/BC-20260710-001.sh +0 -61
  160. package/tests/BC-20260710-002.sh +0 -111
  161. package/tests/npm-install-smoke.sh +0 -53
package/README.zh-CN.md CHANGED
@@ -1,302 +1,167 @@
1
- # Context Guard Skill
1
+ [官网与交互演示](https://michel-johnson.github.io/Context-Guard-Skill/?lang=zh)
2
2
 
3
- 语言:[English](README.md) | **中文**
3
+ # Context Guard
4
4
 
5
- Context Guard 是一个给 Codex 用的项目记忆 skill。它把任务主线、支线、bad case 和验证链路保存在项目自己的 `.codex/context/` 里,让 Codex 在不同 session 之间也能知道“现在做到哪里、踩过哪些坑、下次怎么检查”。
6
-
7
- ## 能做什么
8
-
9
- - **维护项目 context**:自动创建并更新 `.codex/context/`。
10
- - **保留用户原话**:把短用户指令、约束、偏好、路线提示和 bad case 反馈写入 `user-messages.md`。
11
- - **敏感信息只留本地**:公开 context 里只保留脱敏指针,真正需要复用的凭据只放在 `.codex/context/private/`。
12
- - **记录路线图**:维护主线、支线、分叉节点和当前进度。
13
- - **记录 bad case**:保存问题现象、触发条件、原因、修复方式和防复发检查。
14
- - **生成 Roadmap HTML**:支持卡片和高密度紧凑总览,点击节点看详情。
15
- - **区分人类视图和 agent 视图**:HTML 给人看,Markdown/JSON 给 Codex 读取。
16
- - **支持多语言记录**:按项目偏好用中文或英文写 context。
17
- - **处理任务切换**:遇到新方向、支线任务或中断任务时,帮助 Codex park/resume。
18
- - **绑定 Subagent 项目**:把 agent ID 绑定到实际本地项目根目录,避免 context 写回父工作区或 SSH 服务器。
19
- - **沉淀真实修复**:优先保存 Subagent 实际发现的问题、根因、修复和验证;重复完成事件不会重复建节点。
20
- - **测试由人类设计**:Codex 只复用已确认检查,或提出草案等待用户确认,不静默创建长期测试。
21
- - **用功能链覆盖 bad case**:优先把多个 bad case 挂到同一条真实功能/工作流测试链上,而不是为每个 bad case 单独造测试。
22
- - **默认运行已确认测试**:用户创建或确认的测试,默认每次开发结束都要运行;只有用户说明不必每次运行时才降频。
23
- - **提供测试中台入口**:`dev-complete` 会统一运行已确认的 always-run 测试,成功清理临时产物,失败保留证据。
5
+ 语言:[English](README.md) | **中文**
24
6
 
25
- ## 安装
7
+ **下一代人与编码 Agent 的协作层。**
26
8
 
27
- 使用 npx 安装:
9
+ 多数工具仍把 *对话* 当成工作场所。线程即记忆、即审批面、即项目。对话一结束,下一个 Agent 从零开始。聊天里的一句「好」既不是授权,也不是发布,更不是可复用的记录。
28
10
 
29
- ```bash
30
- npx @michelj/context-guard install
31
- ```
11
+ Context Guard 把 **项目** 当成工作场所:
32
12
 
33
- 也可以全局安装,让 npm 包自动把 skill 复制到 Codex 的 skill 目录:
13
+ 1. **一张共享 Map** — 模块、职责、Bug、待办和验证落在同一份耐久结构上。现行存储法是 [`fs-v2`](references/design-current.md)。
14
+ 2. **隔离的 Session** — 每次执行写自己的 Session。对话不是 Main。用户把 Coordinator 挂到节点上时,挂载不写入 Main。执行 Session 要等该事项的 brief 获批后才创建。
15
+ 3. **人只跟 Coordinator 说话** — Cloud Coordinator、本地工作台 Coordinator,或 Codex Session 当 Coordinator。确认和「去做」发生在那里。干活的 Session 不对人说。灰卡切片是以后的事,不是当前默认。
16
+ 4. **发布进 Main** — 人审核过的工作才进已提交的 main 基线。Session 草稿仍是草稿,直到过门禁。人可以直接改 Main 上的 TODO。
34
17
 
35
- ```bash
36
- npm install -g @michelj/context-guard --registry=https://registry.npmjs.org
37
- ```
18
+ 它作为 Skill 安装到 **Codex**、**Cursor** 和 **Claude**。这一轮不开发新 Hook。
38
19
 
39
- 只有当你明确希望安装 Codex 生命周期 hook 提醒时,才加 `--with-hooks`:
20
+ [仓库文档与文件布局](docs/README.md) · [一页 Skill](SKILL.md)
40
21
 
41
- ```bash
42
- npx @michelj/context-guard install --with-hooks
43
- ```
22
+ ## 为什么这是另一种范式
44
23
 
45
- 该命令也会在 `~/.codex/config.toml` 中启用当前的 `[features] hooks = true`,并把已弃用的 `codex_hooks` 别名安全迁移,同时保留其他配置。
24
+ | 把对话当工作场所 | Context Guard |
25
+ | --- | --- |
26
+ | 历史在线程里 | 结构在 Map 上 |
27
+ | 下一轮从零开始 | 下一轮打开同一张 Map |
28
+ | 随便一个聊天里说「看起来可以」 | 人跟 Coordinator 确认 |
29
+ | Agent 看见什么取决于粘贴了什么 | 执行 Agent 绑定到对应 TODO/Bug |
30
+ | 记忆是对文件的检索 | 记忆是带版本与发布的项目状态 |
46
31
 
47
- npm 包正式发布前,也可以直接从 GitHub 使用:
32
+ 这不是又一份 prompt 包、RAG 目录,或「记住这个」插件。它是软件工作的 **人–Agent 操作环**:定位节点、确认意图、在 Session 中执行、验证,然后发布。
48
33
 
49
- ```bash
50
- npx github:Michel-Johnson/Context-Guard-Skill install
51
- ```
34
+ Coordinator / Executor / Tester 的角色提示词用于拆开规划、执行和检查。角色文本不等于协议权限。自动多 Agent 编排仍在推进;产品本身是协作契约(Map、Session、授权、人确认、Main)。
52
35
 
53
- 也支持手动安装:
36
+ ## 看工作台
54
37
 
55
- ```bash
56
- git clone git@github.com:Michel-Johnson/Context-Guard-Skill.git
57
- cd Context-Guard-Skill
58
- mkdir -p ~/.codex/skills/context-guard
59
- rsync -a --delete \
60
- SKILL.md README.md README.zh-CN.md agents references scripts tests \
61
- ~/.codex/skills/context-guard/
62
- ```
38
+ 人在工作台里看 Map。Coordinator 可以定位、游览和改结构。干活的 Session 不对人说话。
63
39
 
64
- 安装后 Codex 应该能发现:
40
+ **云端:** 配置 Cloud 后,它是唯一的人类工作台前端。本地服务负责同步和宿主投递。私有部署需要浏览器登录。设备每个项目登录一次,新 Session 复用该连接。
65
41
 
66
- ```text
67
- ~/.codex/skills/context-guard/SKILL.md
68
- ```
42
+ **本地:** 校验真实 Session 绑定并复用项目已有服务。首次配置、身份歧义和工作树迁移才需要人选择;已连接项目的新 Session 不必再选。
69
43
 
70
- ## Context 保存在哪里
44
+ ### 总览
71
45
 
72
- Context 必须保存在当前打开的本地项目里:
46
+ 第一页 4–8 张主干模块卡。点一张进入。未修 Bug 在右侧列表。
73
47
 
74
- ```text
75
- <Codex 打开的项目根目录>/.codex/context/
76
- ```
48
+ ![工作台总览](docs/shots/workbench/overview.png)
77
49
 
78
- 不要把 context 写到:
50
+ ### 进入模块
79
51
 
80
- - skill 安装目录
81
- - chat/thread 名称对应的目录
82
- - 临时目录
83
- - SSH 远程服务器路径
52
+ 开工单元挂在模块下面,只画从属实线。
84
53
 
85
- 对后续工作有价值的短用户消息会保存在:
54
+ ![模块内部](docs/shots/workbench/module.png)
86
55
 
87
- ```text
88
- <Codex 打开的项目根目录>/.codex/context/user-messages.md
89
- ```
56
+ ### 模块关系
90
57
 
91
- 如果用户提供了后续需要复用的凭据,Context Guard 只会在公开 context 中记录脱敏指针。原始凭据必须只保存在本地私有目录:
58
+ 「关系」高亮生产/消费伙伴,其余变暗,不会进入该模块。
92
59
 
93
- ```text
94
- <Codex 打开的项目根目录>/.codex/context/private/
95
- ```
60
+ ![模块关系](docs/shots/workbench/relations.png)
96
61
 
97
- 如果手动运行脚本,建议显式传入项目根目录:
62
+ ### 会话流动
98
63
 
99
- ```bash
100
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
101
- ```
64
+ 点一条挂了会话的 Bug。从根到该节点的链路亮起来,当前会话沿线流动。
102
65
 
103
- 注册一个用户已确认的自动化测试:
66
+ ![会话流动](docs/shots/workbench/session-flow.png)
104
67
 
105
- ```bash
106
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-add \
107
- --root /path/to/project \
108
- --title "Markdown 预览渲染" \
109
- --command-text "npm test"
110
- ```
68
+ ### 授权模式
111
69
 
112
- 创建一条待确认的功能链测试草案:
70
+ 「授权模式」可以标切片。灰卡可见范围是以后的事,不是当前默认。新 Session 默认看见自己这张 Session Map。
113
71
 
114
- ```bash
115
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-add \
116
- --root /path/to/project \
117
- --title "GPU 监控按钮" \
118
- --entry "点击 GPU 监控按钮" \
119
- --exit-check "打开包含有效 grafana_url 的监控页"
120
- ```
72
+ ![授权模式](docs/shots/workbench/auth-mode.png)
121
73
 
122
- 把 bad case 挂到功能链的具体环节:
74
+ 顶栏最右 **设置** 里切界面语言和主题。地图上的标题、用途、记忆仍按写入时的语言。
123
75
 
124
- ```bash
125
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-attach-bc \
126
- --root /path/to/project \
127
- --chain-id FC-... \
128
- --node-title "后端返回监控 URL" \
129
- --bad-case BC-... \
130
- --check "grafana_url 不为空,前端不会卡住"
131
- ```
76
+ ## 安装
132
77
 
133
- 用户确认流程后,再批准同一条功能链:
78
+ 使用 npx 安装。安装器会检测 Codex、Cursor 和 Claude,把 Skill 与生命周期 Hook 一起安装并安全合并现有配置:
134
79
 
135
80
  ```bash
136
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-approve \
137
- --root /path/to/project \
138
- --chain-id FC-... \
139
- --command-text "npm test -- gpu-monitor"
140
- ```
141
-
142
- 功能链命令可以输出 checkpoint 标记,让测试中台知道具体哪一步失败:
143
-
144
- ```text
145
- CG_CHECKPOINT:后端返回监控 URL:PASS
146
- CG_CHECKPOINT:前端打开监控页:FAIL:缺少 grafana_url
81
+ npx @michelj/context-guard install
147
82
  ```
148
83
 
149
- 标记里的 checkpoint 名称必须匹配已登记的功能链节点;未知名称会被当成测试链路错误。已批准的功能链默认必须报告每个已登记 checkpoint,除非该 checkpoint 被明确标为 optional。
150
-
151
- 如果某个 checkpoint 不适合每次都跑,显式标为 optional:
84
+ 也可以全局安装:
152
85
 
153
86
  ```bash
154
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-set-checkpoint \
155
- --root /path/to/project \
156
- --chain-id FC-... \
157
- --node-title "前端打开监控页" \
158
- --required optional \
159
- --reason "只在浏览器集成环境运行"
87
+ npm install -g @michelj/context-guard --registry=https://registry.npmjs.org
160
88
  ```
161
89
 
162
- 查看每条功能链哪些 checkpoint 必跑、哪些可选:
90
+ 强制安装到三类客户端:
163
91
 
164
92
  ```bash
165
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-list \
166
- --root /path/to/project \
167
- --verbose
93
+ npx @michelj/context-guard install --platform all
168
94
  ```
169
95
 
170
- 如果用户说这条链不需要每次都跑,修改运行频率:
96
+ 默认会安装 Hook。只要 Skill:
171
97
 
172
98
  ```bash
173
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-set-policy \
174
- --root /path/to/project \
175
- --chain-id FC-... \
176
- --run-policy relevant-only \
177
- --reason "只在修改 GPU 监控流程时运行"
99
+ npx @michelj/context-guard install --no-hooks
178
100
  ```
179
101
 
180
- 开发完成后交给测试中台:
102
+ 默认目录分别是 `~/.codex/skills/context-guard`、`~/.cursor/skills/context-guard` 和 `~/.claude/skills/context-guard`。安装器会备份并合并现有 Hook/Settings;对 Codex 还会启用 `[features] hooks = true`。
181
103
 
182
- ```bash
183
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py dev-complete --root /path/to/project --jobs 2
184
- ```
185
-
186
- 查看只读测试中台页面:
104
+ npm 包正式发布前:
187
105
 
188
106
  ```bash
189
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-test-hub --root /path/to/project --open
107
+ npx github:Michel-Johnson/Context-Guard-Skill install
190
108
  ```
191
109
 
192
- 简单管理测试:
110
+ 安装后,相应客户端应能在上述 Skill 目录发现 `SKILL.md`。
111
+
112
+ 然后,在真实项目里:
193
113
 
194
114
  ```bash
195
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-list --root /path/to/project
196
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-disable --root /path/to/project --test-id TC-... --reason "暂时不需要每次运行"
197
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-enable --root /path/to/project --test-id TC-...
198
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-set-policy --root /path/to/project --test-id TC-... --run-policy relevant-only --reason "只和编辑器改动相关"
199
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-remove --root /path/to/project --test-id TC-...
115
+ context-guard workbench --root /path/to/project --session <真实-session-id>
116
+ context-guard doctor --platform cursor --root /path/to/project
200
117
  ```
201
118
 
202
- ## 常用方式
119
+ 本地入口默认是 `http://项目名.localhost:1355`。绑定钉住命名 URL、Git 项目、后端和 Session;不会因为更新的任务自动切换。见 [命名工作台](references/named-workbench.md)。
203
120
 
204
- 让 Codex 启用并维护 context:
121
+ ## 一轮怎么走
205
122
 
206
- ```text
207
- Use $context-guard to maintain this task context.
208
- ```
123
+ 1. **打开 Map** — 首次使用:人和 Agent 一起锁定第一层(卡名要一眼能看懂),再拆第二层、第三层。之后的 Session 打开这张图。
124
+ 2. **绑定 Session** — `context-guard workbench --root <项目> --session <真实-session-id>`。
125
+ 3. **授权切片** — 人标出这次 Session 可以读什么。
126
+ 4. **开工** — Agent 用 `map read` 读,用 `map apply` 写,必须带真实会话、基准版本和稳定操作编号。聊天附和不会写 Map。
127
+ 5. **确认** — 普通提案在工作台等待。
128
+ 6. **发布** — 经过验证的 Session 工作可以进入 Main。Session 草稿不是 Main。
209
129
 
210
- 展示当前路线图:
130
+ 第一次 Session 若记录语言仍未设定,Hook 会要求 Agent 先问「中文还是 English」,保存后后续 Session 不再问。
211
131
 
212
132
  ```text
213
- Use $context-guard to show the roadmap.
133
+ Use $context-guard. 共享 Map、隔离 Session、人确认、发布进 Main。
214
134
  ```
215
135
 
216
- 初始化项目 context:
136
+ 常用命令:
217
137
 
218
138
  ```bash
219
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py init --root /path/to/project
139
+ context-guard workbench --binding-status --root /path/to/project --session <真实-session-id>
140
+ context-guard workbench --list --root /path/to/project
141
+ context-guard map read --root /path/to/project --session <真实-session-id> --node <id>
142
+ context-guard doctor --platform codex --root /path/to/project
220
143
  ```
221
144
 
222
- 设置记录语言:
145
+ `record-bad-case` / `record-bad-case-fix` 关闭失败/修复闭环。`archive-session` 把耐久的 Session 结果写到 `owns` 覆盖且已确认的 Map 节点上;没有归属的文件保持未分类,直到人确认归属。
223
146
 
224
- ```bash
225
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py set-language --root /path/to/project --language 中文
226
- ```
227
-
228
- 生成路线图:
147
+ Codex 安装 11 个生命周期 Hook(不含 `SessionEnd`)。它们在推理边界投递真实 Map、授权、待办/Bug 和其他 Session 的变更。用户的新要求写成 Map TODO。`TODO.md` 只由人维护。
229
148
 
230
- ```bash
231
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
232
- ```
149
+ ## 云端
233
150
 
234
- 也可以用 npm CLI 作为轻量封装:
151
+ 配置 Cloud 后,它是唯一的人类工作台前端。同步基于事件(项目级 SSE),不是定时全量覆盖。开发前 `sync prepare`,验证后 `sync finish`。不相交的变更会重放;重叠的节点、字段或文件返回 `WORK_IMPACT` 并保持未验证。
235
152
 
236
- ```bash
237
- npx @michelj/context-guard show-roadmap --root /path/to/project
238
- ```
153
+ 服务端、Slack 和部署维护在独立的 [Context Guard Cloud](https://github.com/Michel-Johnson/Context-Guard-Cloud) 仓库。本仓库只维护 Skill、本地后端和宿主适配;公共运行库、工作台页面和角色资料由固定 Cloud 发布包生成。开发和打包前执行 `npm ci --ignore-scripts`、`npm run build:runtime`,不要修改生成文件。连接:[Cloud Sync](references/cloud-sync-interface.md)。记忆权威:[服务器记忆](references/server-memory.md)。
239
154
 
240
- 创建支线任务:
155
+ ## 文档
241
156
 
242
- ```bash
243
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py create-branch-task \
244
- --root /path/to/project \
245
- --title "支线任务标题" \
246
- --branch "支线名称" \
247
- --parent-node NODE-YYYYMMDD-001
248
- ```
157
+ | 主题 | 入口 |
158
+ | --- | --- |
159
+ | Skill(一页,给 Agent) | [SKILL.md](SKILL.md) |
160
+ | 文档索引 | [docs/README.md](docs/README.md) |
161
+ | 工作台 / Map CLI | [工作台接口](references/workbench-interface.md) |
162
+ | 角色(Coordinator / Executor / Tester) | [roles.md](roles.md) |
163
+ | npm 发布 | [发布手册](docs/npm-release-runbook.md) |
249
164
 
250
- 记录路线图节点:
251
-
252
- ```bash
253
- python3 ~/.codex/skills/context-guard/scripts/context_guard.py checkpoint-roadmap-node \
254
- --root /path/to/project \
255
- --title "给 Codex 看的源标题" \
256
- --display-title "给用户看的短标题" \
257
- --user-request "用户实际提出的问题" \
258
- --progress-summary "当前进展" \
259
- --method-summary "采取的方法" \
260
- --branch Main \
261
- --level major \
262
- --outcome "结果"
263
- ```
264
-
265
- ## 主要文件
266
-
267
- ```text
268
- .codex/context/
269
- |-- index.md # 快速索引和当前任务
270
- |-- roadmap.md # agent 可读路线图
271
- |-- bad-cases.md # bad case 登记表
272
- |-- preferences.json # 语言和项目偏好
273
- |-- roadmap/
274
- | |-- roadmap.html # 用户查看的路线图
275
- | |-- roadmap.md # agent 快速读取版
276
- | `-- roadmap.json # 结构化索引
277
- |-- tasks/ # 任务级 context
278
- |-- task-cases/ # 任务导向测试 case
279
- |-- test-hub/ # 测试注册表、最近结果和失败证据
280
- `-- bad-case-tests/ # 可复用 bad case 检查脚本
281
- ```
165
+ 本仓库把 **源码** 放在 GitHub `main`,把 **开发记忆** 放在用户指定的私有服务器。整个 `.codex/` 不进 Git 或 npm。其他项目不会继承本仓库的服务器配置。见 [RULE.md](RULE.md)。
282
166
 
283
- ## 使用原则
284
-
285
- - 路线图只记录关键进展,不记录每个小动作。
286
- - 用户看的标题要像人话,不要像实现日志。
287
- - bad case 要能帮助未来避免复发。
288
- - 测试设计权属于人类;Codex 可以执行已确认检查,或提出待确认草案。
289
- - 当任务容易复发或适合沉淀为流程检查时,Codex 应温和提醒用户是否创建测试任务,但不能擅自创建长期测试。
290
- - 测试的长期单位优先是功能链:一个明确入口、一段真实流程、多个检查点、覆盖多个 bad case。
291
- - 新 bad case 优先挂到已有功能链节点;没有匹配功能链时,再提出新的功能链草案。
292
- - 功能链默认是 `proposed` 草案;用户确认后,用 `feature-chain-approve` 在检查覆盖完整时再批准。
293
- - 用户确认的测试默认是 `every-dev-completion`;只有用户要求时,Codex 才能改成其他运行频率。
294
- - 已确认的自动化测试应进入 `.codex/context/test-hub/registry.json` 或 `.codex/context/test-hub/feature-chains.json`,由 `dev-complete` 统一调度。
295
- - 测试中台保持简单:一个注册表、一个 `dev-complete` runner、一个最近结果、一个只读 HTML 状态页和几个管理命令。
296
- - Codex 最终总结必须说明当前测试中台结果:已确认的 always-run 测试是否全部通过、失败、阻塞,或当前没有这类测试。
297
- - 测试链路优先复用已有命令、脚本、截图或人工检查。
298
- - 不要为了每个 bad case 都新写脚本。
299
- - 前端或 HTML 改动结束前,应实际查看页面或截图,确认没有明显视觉错误。
300
- - 任何新的长期测试 case 都先写简短草案,让用户确认后再变成 active 测试。
301
-
302
- 详细行为规则见 [`SKILL.md`](SKILL.md)。
167
+ 本地 `.codex/context/` 是兼容缓存和草稿,不是第二份权威。Cloud Agent 阅读面正迁向 [Memory Filesystem v2](references/memory-filesystem-v2/README.md) 的 node/module Markdown;在该投影真正暴露之前,不要假装能直接读取服务器私有文件。