Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .sopify-skills/blueprint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<!-- sopify:auto:focus:start -->
- 当前活动 plan:暂无。
- history 归档:已可用;最近归档为 `../history/2026-05/20260507_p3a_contract_aligned_surface_cleanup`。
- history 归档:已可用;最近归档为 `../history/2026-05/20260508_p3b_perimeter_cleanup`。
<!-- sopify:auto:focus:end -->

## 深入阅读入口
Expand All @@ -27,5 +27,5 @@
- [Sopify 最小协议规范 (Protocol v0)](./protocol.md)
- [Skill 标准对齐蓝图](./skill-standards-refactor.md)
- [变更历史](../history/index.md)
- 最近归档:`../history/2026-05/20260507_p3a_contract_aligned_surface_cleanup`
- 最近归档:`../history/2026-05/20260508_p3b_perimeter_cleanup`
<!-- sopify:auto:read-next:end -->
2 changes: 2 additions & 0 deletions .sopify-skills/blueprint/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- 枚举 keep-list:protocol.md、gate contract(gate_receipt schema)、handoff/receipt machine truth fields、archive truth(ArchiveCheckResult / ArchiveApplyResult)、install.sh/install.ps1 contract(SOURCE_CHANNEL, SOURCE_REF)、builtin_catalog.py 导出接口(freeze 指接口契约形态——schema / entry_kind / metadata contract,不指具体 skill 枚举或文件字节;能力上下线属内容变更,不违反 freeze)、skill_eval baseline/SLO
- **冻结 persistence surface 分类**:keep-list 覆盖到目录级别(参照 design.md "Persistence Surface 分层"表),明确哪些目录属于长期知识/主链真相/凭证/可删派生,作为 P4b 减重和 P4c 宿主消费治理的红线
- 输出:design.md 加 "Frozen External Surface" 表(与 Persistence Surface 分层互补——后者分类所有持久化面,Frozen 表只冻结外部消费面的 keep-list;不重复造表)
- **Output rendering fields 分类**:逐字段审计 `runtime/output.py` 渲染层,分三类——machine truth projection(handoff/receipt 投影)/ human hint(Next 等面向人的提示)/ internal taxonomy leak(gate_status 等不应默认暴露的内部术语)。审计结果写入 Frozen External Surface 表,作为 P4c output contract convergence 的输入
- 不写代码,纯边界确认

### P4b: Runtime Surface Consolidation
Expand Down Expand Up @@ -91,6 +92,7 @@ P4a keep-list 确认后执行。先删后并,不先设计新结构。
- **宿主消费边界**:宿主只允许消费"主链机器真相"层(current_run/current_plan/current_handoff/current_clarification/current_decision)和"可审计凭证"层(gate_receipt/archive_receipt);不得消费 state/sessions/* 内部细节、last_route 等 runtime-only/derived 面(参照 design.md "Persistence Surface 分层"表)
- **验收 (a) 文档递进顺序**:渐进式披露 Layer 0 Protocol ≤120 行 → Layer 1 Gate → Layer 2 Phase → Layer 3 Reference(不进 prompt)
- **验收 (b) 运行时首接触感知**:新用户首次使用时,只感知到"中断可恢复"和"需要拍板时会停"两个语义;blueprint / checkpoint taxonomy / runtime state 等内部概念不在默认运行时路径中主动暴露。doctor/status 不主动呈现 checkpoint 分类体系,~go 入口不前置 blueprint 概念
- **Output contract convergence**:基于 P4a 审计分类,收敛 `runtime/output.py` 渲染层——① 状态符语义:定义 canonical route family → 符号映射(当前 consult=`!` 无明确约束);② Next 降级:明确为 human hint,不再混合 `required_host_action` + `route_name` 推导,宿主消费 handoff 不依赖 Next;③ Changes 重定义:`loaded_files`(恢复上下文)从 Changed(实际写入)中拆出,或重命名为 Touched/Files;④ Gate 行简化:默认输出不暴露 `gate_status`/`blocking_reason`/`plan_completion` 三元组,详细诊断留给 doctor/status
- **Builtin skill capability disclosure**:宿主文案稳定表达 builtin skill 的当前能力边界与可消费方式;AGENTS.md 只做消费投影,builtin_catalog 为唯一 truth source。当前 analyze/design/develop 是 phase-bound workflow skill(entry_kind=null, triggers=[]),不宣称 standalone invocation。若后续要支持 builtin skill 显式单独调用,必须先 formalize 独立的 invocation metadata contract / invocation syntax;在该 contract 明确前,本项只做披露,不预设其进入 P2 或单列里程碑。边界:只覆盖 builtin skill,不扩展到外部 skill discovery/routing/distribution(background.md 明确排除)

## 未完成长期项
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 变更提案: P3b Perimeter Cleanup

## 需求背景

P3a 完成了 contract-aligned surface cleanup(legacy 删除、routing 收敛)。但 P3a 后仍然残留一批外围噪音:

1. **replay / workflow-learning 已死未葬**:蓝图已判定下线(design.md consult family 已移除、background.md 已标注),但 runtime 代码仍在写入 replay 事件、builtin_catalog 仍导出 workflow-learning、README 仍提及。这会持续污染 P4 系列的减重边界。

2. **Release gate 挂死**:`release-preflight.sh` 使用 `unittest discover`,在当前环境无法正常退出,导致 release 流程断裂。

3. **Tests 缺分类**:tests 全部平铺,无法区分 contract(必保)和 implementation-mirror(P4b 可砍)。P4b 减重没有分类基础就会变成逐个判断,效率极低。

4. **README 首屏偏重**:首屏暴露 plan lifecycle / blueprint / runtime gate / checkpoint taxonomy 等内部术语,与 P4c"首接触只暴露可恢复 + 拍板"的验收目标矛盾。不在 P3b 清掉,P4c 就没有干净起点。

## 与蓝图里程碑的关系

- **P3b**(tasks.md):本方案包是 P3b 的完整执行包
- **前提**:P3a 已完成(legacy surface 已删除、routing 已收敛)
- **下游**:P4a(External Surface Freeze)依赖 P3b 清理后的干净外围面

## Plan Intake Checklist

1. **主命中里程碑**:P3b(Perimeter Cleanup)
2. **改动性质**:execution strategy / implementation wave — 不定义新 contract,只清理/下线已确认的旧面
3. **Machine truth 变更**:删除 replay route(已从 consult canonical family 移除);删除 workflow-learning skill entry(builtin_catalog.py)。不新增 machine truth
4. **Legacy surface**:replay / workflow-learning 已在 design.md 标注 P3b sunset;无需替代 contract
5. **Core promotion rule / hard max 影响**:无
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 技术设计: P3b Perimeter Cleanup

## 方案概述

1 个方案包,4 个内部切片,按依赖顺序串行执行。每切片完成后跑 `pytest` 验证。

## Scope 边界

### 在 scope 内

- Release gate 从 unittest 改 pytest
- replay 能力下线(代码 + 数据 + 文档引用)
- P3a 旧概念残留清理
- Tests 分类标注
- CHANGELOG 去文件列表化
- README 首屏降噪与 Convention 默认入口翻转

### 不在 scope 内

- 不改 gate/router 核心决策逻辑
- 不改 protocol.md 或 design.md 的 contract 定义(blueprint truth 已在之前收敛)
- 不做 P4a 级别的 external surface freeze
- 不做 README 产品重设计(只做首屏降噪,产品定位不变)
- 不改 builtin_catalog.py 的导出接口形态(只删 workflow-learning entry,schema 不变)

## 切片设计与风险

### S1: Release Gate + Evals 卫生

**变更面**:`scripts/release-preflight.sh`、`.gitignore`

**风险**:低。release-preflight.sh 是 CI 辅助脚本,改 test runner 不影响 runtime。

**验证**:`bash scripts/release-preflight.sh` 正常退出;`git status` 不再显示 `skill_eval_report.json`

### S2: Replay 下线 + 旧概念清理 + Runtime 外围残留

**变更面**:
- `runtime/replay.py`(整文件删除)
- `runtime/engine.py`(replay 事件发射 + L1704-1705 skill 映射分支移除)
- `runtime/develop_callback.py`(replay 记录移除)
- `runtime/handoff.py`(replay_session_dir 附件移除,约 L347-348)
- `runtime/output.py`(replay 展示移除)
- `runtime/builtin_catalog.py`(workflow-learning entry 删除,L92-101)
- `runtime/builtin_skill_packages/workflow-learning/skill.yaml`(整文件删除)
- `runtime/builtin_catalog.generated.json`(workflow-learning 条目移除)
- `runtime/router.py`(replay route 分支移除,L290-296)
- `.sopify-skills/replay/`(目录数据删除)
- README / README.zh-CN.md / docs 中 replay / workflow-learning 引用
- tests 中 replay / workflow-learning 相关断言(test_runtime_router, test_runtime_decision, test_runtime_sample_invariant_gate, test_runtime_skill_registry, test_installer)

**风险**:中。
- 核心判断:replay 是 append-only 写入,无回读消费者。gate.py / router.py 不读 replay 数据。下线不影响主链决策。
- 潜在风险点:handoff.py 中 `replay_session_dir` 作为 artifact 附件传递。移除后需确认 handoff rendering 不因缺少字段而异常。
- 旧概念清理涉及 tests,可能有断言依赖已删 surface 的测试用例——需逐个判断是删除还是改写。

**验证(硬验收)**:
- `pytest` 全通过
- `grep -rn "replay" runtime/*.py` 无生产代码命中
- `grep -rn "workflow.learning" runtime/*.py` 无命中
- `python3 -c "from runtime.builtin_catalog import load_builtin_skills; ..."` 确认 workflow-learning 不在枚举中
- `test -f runtime/builtin_skill_packages/workflow-learning/skill.yaml` 返回不存在
- `grep -c "workflow-learning" runtime/builtin_catalog.generated.json` 输出 0
- `grep -c 'replay_session_dir' runtime/handoff.py` 输出 0;另需手动触发一次 develop → handoff 流程确认无 KeyError/AttributeError
- `grep -rn "replay" tests/*.py` 无命中或仅剩不相关字面量

### S3: Tests 分类标注

**变更面**:`tests/test_*.py`(注释或 pytest marker)

**风险**:低。只添加标注,不改测试逻辑。

**分类规则**:
| 分类 | 定义 | P4b 处置 |
|------|------|---------|
| contract | 验证外部消费面 / machine truth schema | 必保 |
| smoke | 端到端最小路径验证 | 必保 |
| distribution | 安装/分发/打包验证 | 必保 |
| implementation-mirror | 只镜像内部实现细节 | 可砍候选 |

**验证**:所有 test 文件都有明确分类标注;`pytest` 全通过;输出分类汇总

### S4: CHANGELOG 压缩 + README 首屏降噪

**变更面**:
- `CHANGELOG.md`(旧条目压缩 + 格式声明更新)
- `scripts/release-draft-changelog.py`(只产摘要)
- `CONTRIBUTING.md`(changelog 说明同步)
- `README.md` + `README.zh-CN.md`(首屏重写)

**风险**:中。
- CHANGELOG 压缩是不可逆的信息损失(旧 102 条文件列表会被压成摘要),但这些信息在 git log 中仍可追溯。
- README 首屏重写是产品叙事变更。核心约束:Convention 为默认入口,Runtime 为增强路径。.sopify-runtime 不出现在首接触面。
- 首屏降噪直接影响 P4c 验收 (b) 的前提条件。

**验证**:
- README 首屏 < 50 行
- 首屏不出现 blueprint / checkpoint taxonomy / runtime state / .sopify-runtime 等术语
- Convention 作为默认叙事出现在 Runtime 之前
- `pytest` 全通过
113 changes: 113 additions & 0 deletions .sopify-skills/history/2026-05/20260508_p3b_perimeter_cleanup/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
plan_id: 20260508_p3b_perimeter_cleanup
feature_key: p3b_perimeter_cleanup
level: standard
lifecycle_state: archived
knowledge_sync:
project: skip
background: skip
design: skip
tasks: skip
archive_ready: true
plan_status: completed
---

# 任务清单: P3b Perimeter Cleanup

## 当前阶段目标

以 P3a 完成为前提。清理外围面,为 P4 系列减重扫清障碍。1 个方案包,4 个内部切片。

## S1: Release Gate + Evals 卫生

- [x] 1.1 `release-preflight.sh`:从 `unittest discover` 改为 `pytest`
- [x] 1.2 `evals/skill_eval_report.json` 加入 `.gitignore`;baseline 和 SLO 文件保留
- [x] 1.3 验证:`bash scripts/release-preflight.sh` 正常退出
- [x] 1.4 (补) CONTRIBUTING.md / CONTRIBUTING_CN.md / scripts/sync-runtime-assets.sh 中 unittest discover 统一为 pytest

## S2: Replay 下线 + 旧概念清理 + Runtime 外围残留

### replay 能力下线

- [x] 2.1 删除 `.sopify-skills/replay/` 目录数据
- [x] 2.2 删除 `runtime/replay.py`(整文件)
- [x] 2.3 移除 `runtime/engine.py` 中 replay 事件发射(含 L1704-1705 skill 映射分支)
- [x] 2.4 移除 `runtime/develop_callback.py` 中 replay 记录
- [x] 2.5 移除 `runtime/handoff.py` 中 `replay_session_dir` 附件(约 L347-348)
- [x] 2.6 移除 `runtime/output.py` 中 replay 展示
- [x] 2.7 `runtime/builtin_catalog.py`:删除 workflow-learning skill entry(L92-101)
- [x] 2.8 删除 `runtime/builtin_skill_packages/workflow-learning/skill.yaml`
- [x] 2.9 更新 `runtime/builtin_catalog.generated.json`:移除 workflow-learning 条目(L196-201 及相关 replay 引用)
- [x] 2.10 移除 `runtime/router.py` 中 replay route 分支(L290-296)
- [x] 2.11 清 README / README.zh-CN.md / docs 中对 replay 和 workflow-learning 的引用

### 旧概念清理(P3a 已 sunset surface 残留)

- [x] 2.12 tests 中验证 P3a 已 sunset surface 的断言——更新或删除
- [x] 2.13 prompt 中引用已 sunset contract 的段落——清除(Codex/Skills + Claude/Skills CN|EN:AGENTS/CLAUDE.md 路由表/策略块/技能行、footer replay 引用、replay/ 目录条目均已移除;skills/sopify/workflow-learning/ 目录(安装链路 shipped surface)全部删除)
- [x] 2.14 handoff/output 旧兼容投影——清除
- [x] 2.15 reason phrasing / phase label 特判——清除

### replay / workflow-learning 测试引用清理

- [x] 2.16 `tests/test_runtime_router.py`:replay route 测试(L152-158, L617-651)——删除
- [x] 2.17 `tests/test_runtime_decision.py`:`replay_session_dir=None` 引用(L604)——清除
- [x] 2.18 `tests/test_runtime_sample_invariant_gate.py`:replay_required 相关断言(L92-107)——清除
- [x] 2.19 `tests/test_runtime_skill_registry.py`:workflow-learning assertIn(L61)——删除
- [x] 2.20 `tests/test_installer.py`:replay 相关引用(L895)——已清除 gitignore 断言;L1301/L1354 footer 断言已同步更新(prompt asset replay 引用已移除,断言与当前 source 对齐,注释已同步)
- [x] 2.21 验证 tests/__pycache__ 中 replay 相关 .pyc 为 0(tests/__pycache__、tests/protocol/__pycache__、tests/pytest_entries/__pycache__ 均无 replay 相关 .pyc;__pycache__ 目录本身包含其他正常缓存,不删除)

### Runtime 外围残留

- [x] 2.22 scripts / config 中对 P3a 已删 surface 的引用残留——清除(check-runtime-smoke.sh, develop_callback_runtime.py, bootstrap_workspace.py, manifest.py, checkpoint_request.py)

### S2 验证(硬验收)

- [x] 2.V1 `pytest` 全通过(684 passed, 49 subtests)
- [x] 2.V2 `grep -rn "replay" runtime/*.py | grep -v "^Binary" | grep -v __pycache__` 仅剩注释(config.py:90 sunset 注释, router.py:377 deprecated 注释)
- [x] 2.V3 `grep -rn "workflow.learning" runtime/*.py | grep -v __pycache__` 无命中
- [x] 2.V4 `python3 -c "from runtime.builtin_catalog import load_builtin_skills; from pathlib import Path; skills = load_builtin_skills(repo_root=Path('.'), language='zh-CN'); assert 'workflow-learning' not in [s.name for s in skills]"` workflow-learning 不在枚举中
- [x] 2.V5 `test -f runtime/builtin_skill_packages/workflow-learning/skill.yaml && echo FAIL || echo OK` 输出 OK
- [x] 2.V6 `grep -c "workflow-learning" runtime/builtin_catalog.generated.json` 输出 0
- [x] 2.V7 `grep -c 'replay_session_dir' runtime/handoff.py` 输出 0
- [x] 2.V8 `grep -rn "replay" tests/*.py | grep -v __pycache__` 仅剩 test_installer.py footer 字面量(prompt asset 待更新)

## S3: Tests 分类标注

- [x] 3.1 `tests/test_*.py` + `tests/protocol/test_*.py` 按 contract / smoke / distribution / implementation-mirror 标注(31 文件)
- [x] 3.2 分类汇总:contract 23 | smoke 1 | distribution 6 | implementation-mirror 1(test_runtime_knowledge_layout.py)
- [x] 3.3 验证:所有 test 文件都有 `# Test classification:` 标注;`pytest` 684 passed, 49 subtests

## S4: CHANGELOG 压缩 + README 首屏降噪

### CHANGELOG 去文件列表化

- [x] 4.1 旧 102 条自动生成条目直接压成阶段摘要(不逐条迁移)
- [x] 4.2 新条目格式只保留 Summary + Changed,不列文件
- [x] 4.3 修 `scripts/release-draft-changelog.py` 只产摘要,不产文件清单
- [x] 4.4 同步更新 `CONTRIBUTING.md` changelog 说明

### README 首屏降噪与默认入口翻转

- [x] 4.5 首屏只保留 3 件事:中断可恢复 + 需要拍板时会停 + 安装入口(首屏 34 行)
- [x] 4.6 Install 为默认入口;已在 Sopify-managed repo 为 returning-user 场景
- [x] 4.7 三步轻量表(Start → Pause → Resume)替代旧流程图,传达用户旅程但不暴露内部编排
- [x] 4.8 plan lifecycle / blueprint / runtime gate / checkpoint taxonomy / task size routing / .sopify-runtime 等内部术语降级到二级文档
- [x] 4.9 `.sopify-runtime` 只作为后台实现细节出现,不作为用户首接触概念(README 中 0 次出现)
- [x] 4.10 同步更新 README.zh-CN.md

### S4 验证

- [x] 4.V1 README 首屏 < 50 行(实际 34 行)
- [x] 4.V2 首屏不出现 blueprint / checkpoint taxonomy / runtime state / .sopify-runtime 等术语
- [x] 4.V3 Install 为默认入口(L24);"Already in a Sopify-managed repo?" 降级为 returning-user 场景(L30)
- [x] 4.V4 复用上轮 pytest 绿灯(684 passed, 49 subtests);本轮 README-only, 无可执行路径变更,未重跑

## 完成标准

- [x] `pytest` 全通过(684 passed, 49 subtests, 242s)
- [x] `release-preflight.sh` 正常退出(all checks passed, eval gate PASSED, all metrics 1.0/0.0)
- [x] `grep -rn "replay" runtime/*.py` 无生产代码命中
- [x] README 首屏符合降噪标准(38 行,Install-first,0 次 Convention mode)
- [x] 所有 test 文件有分类标注(31 文件)
- [x] CHANGELOG 无文件列表格式条目
2 changes: 1 addition & 1 deletion .sopify-skills/history/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## 索引

- `2026-05-08` [`20260508_p3b_perimeter_cleanup`](2026-05/20260508_p3b_perimeter_cleanup/) - standard - 任务清单: P3b Perimeter Cleanup
- `2026-05-08` [`20260507_p3a_contract_aligned_surface_cleanup`](2026-05/20260507_p3a_contract_aligned_surface_cleanup/) - standard - P3a Contract-Aligned Surface Cleanup: execution routing 收敛 + knowledge_sync audit trail + dead path cleanup (-88 LOC) + Runtime 减重剥离为 Px
- `2026-05-07` [`20260506_p2_local_action_contracts`](2026-05/20260506_p2_local_action_contracts/) - standard - P2 Local Action Contracts: subject binding 泛化 + side_effect_delta schema + action-effect canonical pairing(admission contract 闭合)
- `2026-05-06` [`20260506_p15_verifier_normative_slice`](2026-05/20260506_p15_verifier_normative_slice/) - standard - P1.5-D Verifier Minimum Normative Slice: protocol §6 升格 normative(verdict/evidence/source MUST)+ 消费路径 contract + design.md 引用修正
Expand All @@ -16,7 +17,6 @@
- `2026-05-04` [`20260326_phase1-2-3-plan`](2026-03/20260326_phase1-2-3-plan/) - archived - Phase 1-2-3 旧总纲(B1/B2/B3 语义,已被 P0→P4 蓝图取代)
- `2026-05-04` [`20260417_ux_perception_tuning`](2026-04/20260417_ux_perception_tuning/) - archived - UX 感知层调优(B/C 已完成,A 放弃;不独立拆包)
- `2026-05-04` [`20260429_host_prompt_governance`](2026-04/20260429_host_prompt_governance/) - archived(upstreamed) - Host Prompt Governance(核心观点已进蓝图 P3b/P4,设计推演保留供回看)

- `2026-04-30` [`20260429_standard-archive-finalize-archive-checkpoint`](2026-04/20260429_standard-archive-finalize-archive-checkpoint/) - standard - 任务清单: 为“显式主体与生命周期收敛”主题写第一子切片方案文档:新建 standard 方案包,只覆...
- `2026-05-01` [`20260501_convention_smoke`](2026-05/20260501_convention_smoke/) - smoke - Convention 模式跨宿主最小 roundtrip 验证(Host B: Claude Sonnet + Host C: Codex/GPT-5,5/5 pass)
- `2026-05-01` [`20260429_legacy_feature_cleanup`](2026-05/20260429_legacy_feature_cleanup/) - standard - Legacy Feature Cleanup: consult override 删除 + model compare 功能面移除
Expand Down
Loading
Loading