Skip to content

P4c Host Consumption Governance:收敛宿主消费面与发布 2026-05-11.202509#33

Merged
Li-Sanze merged 19 commits into
mainfrom
plan/p4c-host-consumption-governance
May 11, 2026
Merged

P4c Host Consumption Governance:收敛宿主消费面与发布 2026-05-11.202509#33
Li-Sanze merged 19 commits into
mainfrom
plan/p4c-host-consumption-governance

Conversation

@Li-Sanze
Copy link
Copy Markdown
Collaborator

Summary

本 PR 完成 P4c Host Consumption Governance,并将本波改动整理为 release 2026-05-11.202509

核心目标是把 Codex/Claude 宿主提示、runtime 输出、status/doctor 展示从内部 route taxonomy / helper 细节 / blueprint 概念暴露,收敛到可消费的
canonical protocol / handoff 事实。

Plan / Blueprint References

  • Plan: .sopify-skills/history/2026-05/20260510_p4c_host_consumption_governance/
    • background.md
    • design.md
    • tasks.md
  • Blueprint:
    • .sopify-skills/blueprint/protocol.md:新增/强化 §8 作为宿主消费协议的权威入口
    • .sopify-skills/blueprint/design.md:将 Host Consumption Governance 从审计增量整理为稳定主题章节
    • .sopify-skills/blueprint/tasks.md:同步 P4c 完成状态和后续边界
    • .sopify-skills/history/index.md:登记 P4c archived plan

Changes

  • Prompt surface:

    • 收敛 Codex/Skills/*/AGENTS.mdClaude/Skills/*/CLAUDE.md
    • 删除大段 route table / helper index / blueprint 暴露说明
    • 改为引用 protocol.md §8 和用户可理解的 checkpoint/resume 语义
  • Runtime/output:

    • runtime/output.py
    • runtime/gate_output.py
    • 修正 loaded files 渲染为 Context block
    • 移除 route 字段外露
    • 收敛 gate status fallback、status symbol、Next hint 到 handoff/protocol 语义
  • Installer/status/doctor:

    • installer/inspection.py
    • installer/models.py
    • installer/hosts/codex.py
    • installer/hosts/claude.py
    • 将 status/doctor 文案从 raw taxonomy 转为面向人的状态标签
    • 增加 host capability enhancement declaration:continuation / interaction / audit
  • Validation:

    • 新增 scripts/check-enhancement-declaration.py
    • 增加 tests/test_runtime_output_rendering.py
    • 扩展 tests/test_installer.py
    • 扩展 tests/test_installer_status_doctor.py
  • Release:

    • 将 release metadata bump 到 2026-05-11.202509
    • 更新 CHANGELOG.md
    • 更新 README badge
    • 同步四个宿主文件的 SOPIFY_VERSION

Verification

已在本地使用 Python 3.14 跑完整 release preflight:

PATH=/opt/homebrew/opt/python@3.14/bin:$PATH bash scripts/release-preflight.sh

结果:全部通过。

- hard gate: 686 passed
- implementation-mirror: 31 passed
- install/payload bootstrap smoke: passed
- prompt runtime gate smoke: passed
- bundle runtime smoke: passed
- skill eval gate: passed

Li-Sanze added 19 commits May 10, 2026 18:32
6 slices: P4c-1 contract projection, P4c-2 enhancement declaration,
P4c-3a rendering convergence, P4c-3b first-contact/prompt convergence,
P4c-4 documentation/disclosure, P4c-5 prompt asset structural refactor (optional)

Context-Checkpoint: plan/
…d, add summary table

- Consumption matrix: all 7 deep_verified items finalized as required († removed)
- Add derived/non-normative summary table for quick reference
- Update S4 boundary: mark item 1 as resolved by P4c-1
- Update P4c prerequisites: invariant 2 and implementation item 4 marked done
- Plan tasks P4c-1 all checked
- Fix README archive pointer (P4b → P4b.5, hygiene)

Context-Checkpoint: blueprint/design.md, blueprint/tasks.md, plan/
- Add EnhancementGroup enum (CONTINUATION/INTERACTION/AUDIT) to installer/models.py
- Add declared_enhancements field to HostCapability
- Both deep_verified hosts (claude, codex) declare all three groups
- Add governance expectation table to design.md (tier → expected enhancements)
- Add scripts/check-enhancement-declaration.py (advisory, always exit 0)
- Plan tasks P4c-2 all checked

Context-Checkpoint: installer/models.py, installer/hosts/, blueprint/design.md, scripts/

Release-Sync: yes

Release-Version: 2026-05-10.203618

Release-Date: 2026-05-10
… fallback, remove route exposure

- runtime/output.py: add _collect_context_files() and render Context section
  so loaded_files are visible instead of silently dropped
- runtime/output.py: _execution_gate_line() unknown gate_status now falls
  back to 'blocked' display instead of leaking raw internal codes
- runtime/gate_output.py: remove route_name read/output from render_gate_text,
  retain only reason/preflight fields
- tests/test_runtime_output_rendering.py: 9 focused regression tests covering
  all three changes (Context block, gate fallback, route removal)

Release-Sync: yes

Release-Version: 2026-05-10.220305

Release-Date: 2026-05-10
… lookup

- _handoff_next_hint(): replace 45-line dual if-elif (route_name +
  required_host_action) with _HANDOFF_KIND_HINT dict lookup (7 kinds)
- Special cases: archive (artifact check), state_conflict (host_action
  disambig between active/cleared)
- _next_hint(): use _ROUTE_FAMILIES for pending/conflict grouping
- Dead labels removed: next_resume, next_quick_fix (4 entries)
- develop kinds (quick_fix/resume_active/exec_plan) unified to
  next_workflow as generalized human hint
- 10 regression tests covering all kind→hint mappings

Release-Sync: yes

Release-Version: 2026-05-10.225736

Release-Date: 2026-05-10
…tor thin projection

3a.1: Replace implicit _status_symbol if-else chain with explicit
      _FAMILY_SYMBOL table + _ROUTE_TO_FAMILY reverse index.
3a.5: Delete cross-session scanning in _inspect_runtime_workspace_state,
      reduce to single global snapshot projection. Remove SESSIONS_DIRNAME import.
3a.6: Delete recovered_context fallback in _execution_gate,
      _state_conflict_payload, _quarantined_items — handoff artifacts only.

Tests: +10 regression tests (symbol overrides, execution_gate handoff-only).
Remove _append_entry_guard_reason_line, _entry_guard_reason_code,
and label keys from both language dicts. These functions were never
called. The entry_guard_reason_code machine field remains alive in
gate/router/bridge contracts and tests.
- protocol.md: new §8 Deep Host Runtime Integration (§8.1-8.5)
  gate-first, post-run handoff, host boundaries, helper/state indexes
- protocol.md: Reader Map (convention_only/payload_capable/deep_verified)
- protocol.md: §3 Runtime column links to §8.2, §6 status clarified
- 4 prompt files: 14 Notes + Host Integration Contract + Runtime helpers
  replaced with 3 high-level obligations + protocol.md reference
- Role definition tightened: routes by runtime context + host capabilities
- Claude ~/.claude/ paths preserved (not regressed to ~/.codex/)
- Net: -163 lines from prompt/doc disclosure layer
- Add _STAGE_LABELS (7 entries) and _CHECKPOINT_LABELS (4 entries) maps
- render_status_text(): current_run_stage and pending_checkpoint display
  human-readable labels instead of raw taxonomy codes
- render_status_text(): state conflict line shows explanation, not raw code
- _runtime_workspace_checks(): doctor evidence format drops redundant raw
  code prefix, shows explanation @ path
- README.md: sync protocol.md title to 宿主接入规范
- 4 new tests: label mapping + deterministic conflict rendering assertions
- Fix pre-existing workspace_preflight_contract test breakage from 82886b3:
  rewrite CN/EN assertions to match new 3-obligation prompt structure
- Machine payload structure (check_id/reason_code/status) unchanged;
  evidence text (human-facing) updated
Add long-term capability convergence item alongside P4d: unified host-level
entry semantics (Inspect/Continue/Start New Work) covering same-host
cross-session and cross-host continuation. Consumes frozen contracts only,
no new machine truth, no runtime binding, no prescribed entry syntax.

Also marks P4c-3b.2 done in plan tasks.md.
…pt exposure

- Delete Routing Decision section (Entry Point Flow tree + Route Types
  table) from all 4 prompt files — machine-internal routing semantics
  should not be defined in the prompt
- Move Host Integration Contract ref (protocol.md §8) from deleted
  section to C3 Notes block
- Delete Quick Reference "Blueprint Path" line
- A6 lifecycle unchanged — file path references, not concept exposure
- Net: -140 lines across 4 prompt files
Add two user-facing perceptions to Core Philosophy / 核心理念
in all 4 prompt assets (AGENTS.md × 2 + CLAUDE.md × 2):

- Resumable / 中断可恢复: work can be interrupted and resumed
- Stops for Decisions / 决策前停车: pauses for confirmation

Pure experience language — no mechanism terms (checkpoint,
handoff, state, blueprint). KB output UX is a separate task.
- Add terminology disambiguation note to protocol.md preamble:
  document disclosure gradient ≠ KB persistence layers (L0/L1/L2/L3)
- Unify all active references from mixed naming (Layer 0→3,
  文档递进顺序, 阅读梯度) to single term: 文档披露梯度
- Updated: protocol.md, design.md, blueprint/tasks.md,
  P4c background/design/tasks
- Layer mapping table intentionally deferred — naming conflict
  resolved, mapping to be converged separately
- Skill reference section in all 4 prompt files now explicitly states:
  runtime-managed workflow skills, loaded on-demand, standalone
  invocation not supported
- Truth source pointed to builtin_catalog.generated.json
- No phase-bound claim for kb/templates (only analyze/design/develop
  are phase-bound per blueprint verification criteria)
protocol.md:
- 定义句改为'以 protocol 章节为主轴,衔接 prompt asset 与架构参考'
- 新增 4 层映射表: Protocol(§1-§3) / Lifecycle(§4-§5) / Integration(§6-§8+prompt) / Reference(design.md·ADR)
- tier↔layer 桥接: convention_only=L0-1, payload_capable=L0-1+prompt, deep_verified=L0-2
- Layer 0 定位'协议基础'; prompt asset 附加面声明
- KB 分层解耦声明保留

design.md: convention_only §1-§4→§1-§5 对齐映射表
blueprint/tasks.md: 验收(a) 更新为 finalized 分层
P4c tasks.md/design.md: 4.2 标完成 + scope/交付项同步
结构提升:
- Persistence Surface / Keep-list / Output Audit 从 #### 提升为独立 ##
- Host Capability Governance 从 280 行 #### 拆为 10 个主题 ###:
  能力梯度 / 接入判定 / 禁止消费面 / 契约消费矩阵 / 增强组合与声明 /
  官方接入画像 / Convention Quickstart / Prompt 镜像 / 模块依赖审计 /
  长期边界与后续交接
- 削减目标回归纯预算: 只留目标词汇表(5 词表) + 削减预算表

过程标签清除:
- S1/S2/S3/S4 / 综合裁定 / P4b.5 不裁死的边界 → 稳定主题名
- provenance 降为括号注释(来源: P4b.5 / P4c-1)
- 所有 L-number 交叉引用 → 章节名引用

语义零漂移: 不改结论/contract/梯度准入条件
P4c-1~4 complete, P4c-5 explicitly skipped (optional, non-blocking).
Cross-cutting invariant 5/5 PASS, red-line 6/6 no violation.

Deliverables:
- P4c-1: FeatureId projection matrix, deep_verified † eliminated
- P4c-2: Enhancement declaration/detection protocol
- P4c-3a: output/doctor/handoff rendering convergence
- P4c-3b: first-touch/prompt convergence (-140 LOC route taxonomy)
- P4c-4: protocol.md §8 single entry, doc disclosure gradient,
  builtin skill disclosure, design.md structural reorganization

Added YAML frontmatter (plan_id/lifecycle_state/archive_ready/
knowledge_sync) to align with metadata-managed archive pathway.
- CHANGELOG.md: active → archived
- tasks.md 6.4: mark as done with archive path
- design.md P4c-5: update stale line count (~466-468 → ~373)
@Li-Sanze Li-Sanze merged commit 3667c17 into main May 11, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant