Skip to content

Commit ed57992

Browse files
committed
w2.0: plan doc closure — catalog relocation + CI/prompt audit + W2 task expansion
Add W2.0a/W2.0b/W2.2b/W2.3b/W2.3c pre-flight tasks before runtime deletion. New §9b in design.md: catalog relocation decision, payload resource positioning, file migration table, field cleanup (runtime_entry/entry_kind/supports_routes). Update §9 keep-list/migration-list and §14 risk table with 3 new risks.
1 parent 420741d commit ed57992

2 files changed

Lines changed: 122 additions & 3 deletions

File tree

.sopify-skills/plan/20260605_p8_protocol_kernel_runtime_retirement/design.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,8 @@ P8 里的 CLI 不是新 runtime,只是少量辅助入口:
552552
| `sopify_writer/`(由 P6 writer 基础收敛/重命名) | 新真相源,新宿主唯一写路径 |
553553
| `sopify_contracts/`(P6 已切出) | contract schema 定义 |
554554
| `scripts/install_sopify.py` / `sopify_init.py`(解耦后) | 用户入口 |
555+
| `skills/catalog/`(由 W2.0b 从 `runtime/builtin_skill_packages/` 迁入) | builtin skill YAML 源 + generated JSON;payload resource(§9b) |
556+
| `sopify_contracts/skill_schema.py`(由 W2.0b 从 `runtime/skill_schema.py` 迁入) | skill.yaml schema 校验与常量定义 |
555557

556558
**Delete-list(激进删除)**:
557559

@@ -569,13 +571,70 @@ P8 里的 CLI 不是新 runtime,只是少量辅助入口:
569571
- `scripts/sopify_status.py` / `sopify_doctor.py` → 改为消费 `installer/inspection.py` 暴露的 contract,不调 runtime API
570572
- `tests/` 中 runtime-coupled 测试 → 按 Phase 1 经验分类:保留 contract / 删除 runtime-coupled / 迁移到 sopify_writer 测试
571573
- `canonical_writer` → `sopify_writer`(命名收敛),并与 sopify_contracts 适配 state/ 新结构(2 文件)
574+
- `runtime/builtin_skill_packages/` → `skills/catalog/`(YAML 源 + generated JSON;扁平路径,详见 §9b)
575+
- `runtime/skill_schema.py` → `sopify_contracts/skill_schema.py`(保留旧名)
576+
- `runtime/_yaml.py`(`load_yaml` 子集)→ `scripts/_yaml_subset.py`(裁剪迁移,不含 dump/写逻辑)
577+
- `scripts/generate-builtin-catalog.py` → runtime-free import + 新输入/输出路径(详见 §9b)
578+
- `.github/workflows/ci.yml` → restructure `runtime-tests` job 为 `protocol-tests` job(W2.3b)
579+
- `.github/copilot-instructions.md` → runtime-first 措辞替换为 protocol-first 入口(W2.3c)
572580

573581
**目标 LOC**:
574582

575583
- 起点:runtime ~16K LOC
576584
- 终点:runtime 0 + sopify_writer + sopify_contracts ~1,160 + installer(保留部分 ~2K)
577585
- 净效果:Sopify 真相源从 ~16K runtime 切换到 ~4K protocol+writer+installer
578586

587+
## 9b. Catalog Relocation Decision(W2.0b)
588+
589+
**背景**:`runtime/` 物理删除时会带走 builtin skill catalog 的 YAML 源、生成产物和 schema 校验器。catalog 链路必须在 W2.10 之前独立迁出,否则 CI drift check、header template 引用和 host 安装链一起断裂。
590+
591+
**Catalog post-P8 定位**:**payload resource**(选项 B)
592+
593+
- 安装时把 generated JSON 拷贝进 host payload
594+
- `payload-manifest.json` 记录 catalog 路径
595+
- `sopify_doctor` 可检查 catalog 存在性
596+
- 不做动态路由、不做 runtime loader、不让 host 每轮解析
597+
- catalog 是"安装包随身带的说明书目录",host/doctor 可以看它知道有哪些内置工作流,但它不指挥执行
598+
599+
**文件迁移表**:
600+
601+
| 源 | 目标 | 动作 |
602+
|---|---|---|
603+
| `runtime/builtin_skill_packages/*/skill.yaml` | `skills/catalog/<skill_id>/skill.yaml` | 迁移(扁平路径,去掉 `builtin_skill_packages/` 中间层) |
604+
| `runtime/builtin_catalog.generated.json` | `skills/catalog/builtin_catalog.generated.json` | 迁移 |
605+
| `runtime/skill_schema.py` | `sopify_contracts/skill_schema.py` | 迁移(保留旧名,不改为 `skill_manifest.py`) |
606+
| `runtime/_yaml.py`(`load_yaml` 子集) | `scripts/_yaml_subset.py` | 裁剪迁移(不含 `dump_yaml` / 写逻辑) |
607+
| `runtime/builtin_catalog.py` | — | 不迁移,随 runtime 退场(唯一消费者 `manifest.py` 同步退场) |
608+
| `runtime/manifest.py` | — | 不迁移,随 runtime 退场 |
609+
610+
**字段清理**:从 skill schema normalizer(`normalize_skill_manifest`)和 generated JSON 删除以下 runtime 残留字段:
611+
612+
- `runtime_entry`:runtime 入口路径,P8 后无 runtime
613+
- `entry_kind`:runtime entry 分类,P8 后无意义
614+
- `supports_routes`:runtime router 的路由分类概念,P8 后退场
615+
616+
保留字段:`id` / `names` / `descriptions` / `mode` / `handoff_kind` / `contract_version` / `triggers` / `tools` / `disallowed_tools` / `allowed_paths` / `requires_network` / `host_support` / `permission_mode` / `metadata`
617+
618+
**Post-P8 消费链**:
619+
620+
```
621+
skills/catalog/<skill_id>/skill.yaml
622+
→ scripts/generate-builtin-catalog.py(runtime-free imports)
623+
→ skills/catalog/builtin_catalog.generated.json
624+
→ CI drift check + header template 引用
625+
→ installer/payload.py 拷贝到 payload(W2.2b)
626+
→ payload-manifest.json 记录路径
627+
→ sopify_doctor 检查存在性
628+
```
629+
630+
**命名决策记录**:
631+
632+
| 决策 | 结论 | 理由 |
633+
|---|---|---|
634+
| normalizer 命名 | 保留 `skill_schema.py` | 模块定义 schema 常量(版本、模式、权限),不只校验源 manifest;`skill_manifest.py` 与 `payload-manifest.json` / `bundle manifest` 歧义 |
635+
| YAML helper 位置 | `scripts/_yaml_subset.py` | 只是生成脚本工具,不污染协议包;只保留 `load_yaml`,不迁移 registry 用的 dump/写逻辑 |
636+
| catalog YAML 路径 | `skills/catalog/<skill_id>/skill.yaml` | 扁平化,与 `skills/<lang>/skills/sopify/<skill_id>/SKILL.md` 命名习惯对齐 |
637+
579638
## 10. P8 后的 Sopify 形态
580639
581640
P8 收口后,Sopify 是一个**审计资产协议内核 + 文件资产 + 轻量安装器**:
@@ -669,6 +728,9 @@ P8 收口后,Sopify 是一个**审计资产协议内核 + 文件资产 + 轻
669728
| sopify_writer 未经历真实场景考验 | 中 | W3 Qoder proof 强制走 sopify_writer 写路径,作为硬验收 |
670729
| Qoder 试点卡在宿主能力限制 | 中 | 基线是 payload + 完整接续读写;若不能直接调库,只允许薄 writer wrapper,不扩大成 runtime CLI |
671730
| Verifier read-only 约束被绕过 | 中 | P8 只做 schema freeze + compliance;bridge enforcement 后续独立落地 |
731+
| Catalog 源链断裂(W2.10 删 runtime 时 YAML 源 + generated JSON + schema 校验器一起丢失) | 高 | W2.0b 在 W2.10 前完成迁移到 `skills/catalog/` + `sopify_contracts/skill_schema.py`;CI drift check 路径同步更新 |
732+
| CI/release-preflight 仍绑 runtime smoke(W2.10 删 runtime 后 CI 直接红) | 高 | W2.3b 在 W2.7 前 restructure CI:删除 runtime-only steps,替换为 protocol smoke,保留 catalog drift + installer smoke |
733+
| Host prompt / copilot-instructions 仍 runtime-first(dogfood 自相矛盾) | 中 | W2.3c 切 protocol-first 入口;删除不存在的 `go_plan_runtime.py` 引用 |
672734
673735
## 15. 不在 P8 的延后项(明确登记)
674736

.sopify-skills/plan/20260605_p8_protocol_kernel_runtime_retirement/tasks.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,31 @@ created: 2026-06-05
163163

164164
目标:硬切到 protocol kernel。线上用户少,不做 shadow writer,不保留 runtime compatibility layer。
165165

166+
### W2.0a Registry Snapshot
167+
168+
- [ ] Depends: W1 gate
169+
- [ ] Input: `.sopify-skills/plan/_registry.yaml`(当前全部 registry entries,当前预期 4 条)
170+
- [ ] Output: 导出当前全部 registry entries 为人类可读摘要,存入当前 P8 plan 的 `assets/registry-lifecycle-snapshot.md`(随 P8 归档时一起进 history)
171+
- [ ] Verify: 快照文件存在于 `assets/` 且包含全部 plan 的 id + lifecycle_state + 关键时间戳
172+
173+
### W2.0b Catalog Relocation + Generator Runtime-Free
174+
175+
- [ ] Depends: W1 gate
176+
- [ ] Input: `runtime/builtin_skill_packages/*/skill.yaml`(5 个 builtin skill YAML 源)
177+
- [ ] Input: `runtime/builtin_catalog.generated.json`
178+
- [ ] Input: `runtime/skill_schema.py` / `runtime/_yaml.py`
179+
- [ ] Output: 迁移 YAML 源 → `skills/catalog/<skill_id>/skill.yaml`(扁平路径,去掉 `builtin_skill_packages/` 中间层)
180+
- [ ] Output: 迁移生成产物 → `skills/catalog/builtin_catalog.generated.json`
181+
- [ ] Output: 迁移 `runtime/skill_schema.py``sopify_contracts/skill_schema.py`(保留旧名,不改为 skill_manifest.py)
182+
- [ ] Output: 创建 `scripts/_yaml_subset.py`:仅 `load_yaml` 最小解析子集,不含 `dump_yaml` / 写逻辑
183+
- [ ] Output: 改造 `scripts/generate-builtin-catalog.py`:import 改为 `sopify_contracts.skill_schema` + `_yaml_subset`;输入路径改为 `skills/catalog/*/skill.yaml`;输出路径改为 `skills/catalog/builtin_catalog.generated.json`
184+
- [ ] Output: 从 skill schema normalizer(`normalize_skill_manifest`)和 generated JSON 删除 `runtime_entry` + `entry_kind` + `supports_routes` 字段
185+
- [ ] Output: 更新 CI drift check 路径(`ci.yml:36` + `scripts/release-preflight.sh:28,70`
186+
- [ ] Output: 更新 `skills/{en,zh}/header.md.template:351` 对 generated JSON 路径的引用
187+
- [ ] Verify: `python3 scripts/generate-builtin-catalog.py` 成功输出 `skills/catalog/builtin_catalog.generated.json`
188+
- [ ] Verify: generated JSON 不含 `runtime_entry` / `entry_kind` / `supports_routes` 字段
189+
- [ ] Verify: `rg "from runtime|import runtime" scripts/generate-builtin-catalog.py` returns no matches
190+
166191
### W2.1 Extract/Keep Minimal CLI Entrypoints
167192

168193
- [ ] Depends: W1 gate
@@ -184,6 +209,16 @@ created: 2026-06-05
184209
- [ ] Verify: `rg "runtime_gate|sopify_runtime|runtime/" installer scripts/install_sopify.py` has no active dependency except retired docs/tests slated for deletion
185210
- [ ] Verify: install smoke still installs payload assets
186211

212+
### W2.2b Catalog Payload Resource
213+
214+
- [ ] Depends: W2.2, W2.0b
215+
- [ ] Input: `skills/catalog/builtin_catalog.generated.json` / `installer/payload.py` / `installer/inspection.py`
216+
- [ ] Output: `installer/payload.py` 安装时拷贝 `builtin_catalog.generated.json` 到 payload
217+
- [ ] Output: `payload-manifest.json` 记录 catalog 路径
218+
- [ ] Output: `sopify_doctor` 检查 catalog 文件存在性
219+
- [ ] Verify: install smoke 安装后 payload 目录包含 catalog JSON
220+
- [ ] Verify: `sopify_doctor` 报告 catalog 健康状态
221+
187222
### W2.3 Rename and Scope sopify_writer
188223

189224
- [ ] Depends: W1 schemas
@@ -195,6 +230,28 @@ created: 2026-06-05
195230
- [ ] Verify: no new writer CLI is introduced by default
196231
- [ ] Verify: old `canonical_writer` import path is removed; no compatibility alias by default
197232

233+
### W2.3b CI Runtime Detachment
234+
235+
- [ ] Depends: W2.3, W2.0b
236+
- [ ] Input: `.github/workflows/ci.yml` / `scripts/release-preflight.sh`
237+
- [ ] Output: restructure `runtime-tests` job 为 `protocol-tests` job:删除 runtime-only test steps,保留 catalog drift / protocol smoke / installer-payload smoke / 非 runtime 测试
238+
- [ ] Output: 删除 `check-bundle-smoke.sh` step
239+
- [ ] Output: 删除 `check-prompt-runtime-gate-smoke.py` step
240+
- [ ] Output: 替换为 `sopify_protocol_check` smoke(W1.6 已建)
241+
- [ ] Output: 保留 catalog drift check(路径已更新 by W2.0b)+ installer/payload smoke
242+
- [ ] Verify: CI pipeline 绿;无 runtime-only test step
243+
- [ ] Verify: catalog drift check 和 protocol smoke 在 CI 中正常运行
244+
245+
### W2.3c Host Prompt / Copilot Instructions Cutover
246+
247+
- [ ] Depends: W2.3b
248+
- [ ] Input: `.github/copilot-instructions.md`
249+
- [ ] Output: 清理 runtime-first 措辞(runtime gate / sopify_runtime 引用)
250+
- [ ] Output: 删除不存在的 `go_plan_runtime.py` 引用
251+
- [ ] Output: 替换为 protocol-first 入口(protocol.md + sopify_protocol_check + sopify_writer)
252+
- [ ] Verify: `rg "runtime_gate|sopify_runtime|go_plan_runtime" .github/copilot-instructions.md` returns no matches
253+
- [ ] Verify: copilot-instructions.md 不再引用 runtime-first 入口
254+
198255
### W2.4 Migrate StateStore to 2-File Model
199256

200257
- [ ] Depends: W2.3
@@ -231,7 +288,7 @@ created: 2026-06-05
231288

232289
### W2.7 Reclassify Tests
233290

234-
- [ ] Depends: W2.1-W2.6
291+
- [ ] Depends: W2.0b, W2.1-W2.3, W2.2b, W2.3b-W2.3c, W2.4-W2.6
235292
- [ ] Input: all tests importing runtime
236293
- [ ] Output: keep protocol / contracts / sopify_writer / installer / compliance tests
237294
- [ ] Output: delete runtime router/engine/gate/output tests
@@ -259,7 +316,7 @@ created: 2026-06-05
259316

260317
### W2.10 Delete runtime/ Directory
261318

262-
- [ ] Depends: W2.1-W2.9
319+
- [ ] Depends: W2.0b, W2.1-W2.3, W2.2b, W2.3b-W2.3c, W2.4-W2.9
263320
- [ ] Input: `runtime/` all files
264321
- [ ] Output: delete `runtime/`
265322
- [ ] Verify: `test ! -d runtime`
@@ -280,7 +337,7 @@ created: 2026-06-05
280337

281338
### Wave 2 Gate
282339

283-
- [ ] Depends: W2.1-W2.11
340+
- [ ] Depends: W2.0a-W2.0b, W2.1-W2.3, W2.2b, W2.3b-W2.3c, W2.4-W2.11
284341
- [ ] Verify: runtime directory absent
285342
- [ ] Verify: registry absent
286343
- [ ] Verify: no runtime imports in active code/tests

0 commit comments

Comments
 (0)