phase-contract

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Phase Contract (internal)

阶段合约(内部)

The one authoritative owner of phase shape for this workflow. Planners lint every phase they emit against the eight rules below;
execute-phase
re-checks the same rules before any edit. Nothing else may define what a valid phase is.
本工作流中阶段形态的唯一权威定义方。规划器会针对其生成的每个阶段,按照以下八项规则进行校验;
execute-phase
在执行任何编辑前会重新检查相同规则。任何其他组件均不得定义有效阶段的标准。

When to use

使用场景

  • plan-feature-scaffold
    — lint every phase of a feature plan before emission.
  • plan-fix
    — lint every phase of a fix SPEC before commit.
  • execute-phase
    — phase-lint pre-flight guard before editing a phase.
  • Templates store the contract version + fingerprint + lint result, never the eight rules (they point here).
  • plan-feature-scaffold
    —— 在生成功能计划的每个阶段前,对其进行 lint 校验。
  • plan-fix
    —— 在提交修复 SPEC 前,对其每个阶段进行 lint 校验。
  • execute-phase
    —— 在编辑阶段前,执行阶段 lint 预检防护。
  • 模板存储合约版本、指纹以及 lint 结果,不会存储八项规则(而是指向本合约)。

The eight phase-lint rules

八项阶段 lint 规则

Every implementation phase must pass all 8 boxes before it is emitted (planner skills) or executed (
execute-phase
pre-flight). Fail-closed: any unticked box blocks emission/execution until the phase is re-cut or split.
  1. Title names ONE deliverable — FAIL if it joins nouns with
    +
    ,
    ,
    ,
    &
    ,
    and
    /
    y
    , or
    /
    .
  2. One declared layer — each phase declares exactly one of the fixed enum
    schema/db | domain | api | ui | config/infra | docs | hardening | close-out
    ; FAIL if any task's target file belongs to another. Tests for the phase's own layer belong to the phase; a test-only phase declares
    hardening
    .
  3. ≤ 8 tasks (close-out phase: ≤ 10, only the literal close-out chain).
  4. One checkbox = one deliverable — FAIL if a task contains a
    chain of implementation steps, enumerates > 3 cases/scenarios, or creates > 1 file of distinct concerns.
  5. Zero decision words — FAIL on
    Decide
    ,
    choose
    ,
    OR
    between alternatives,
    If … then <change scope>
    .
  6. No conditional scope mutation — a task may not move work between phases at runtime.
  7. No external/manual gates inside implementation phases — human/out-of-repo verifications live in the hardening/close-out phase, marked
    manual
    .
  8. Machine-checkable done-when — every phase ends with one verifiable invariant (a command + expected outcome).
每个实施阶段在生成(规划器技能)或执行(
execute-phase
预检)前,必须满足全部8项要求。采用关闭失败机制:任何未满足的项都会阻止发布/执行,直到阶段被重新划分或拆分。
  1. 标题仅命名一个交付物 —— 若标题使用
    +
    &
    and
    /
    y
    /
    连接多个名词,则校验失败。
  2. 仅声明一个层级 —— 每个阶段需明确声明固定枚举值中的一个:
    schema/db | domain | api | ui | config/infra | docs | hardening | close-out
    ;若任何任务的目标文件属于其他层级,则校验失败。阶段自身层级的测试属于该阶段;仅包含测试的阶段需声明为
    hardening
  3. 任务数 ≤ 8(收尾阶段:任务数 ≤ 10,仅包含字面意义上的收尾流程)。
  4. 一个复选框对应一个交付物 —— 若任务包含由
    连接的实施步骤链、列举超过3种情况/场景,或创建多个涉及不同关注点的文件,则校验失败。
  5. 无决策类词汇 —— 若出现
    Decide
    choose
    、备选方案间的
    OR
    If … then <change scope>
    (如果…则<变更范围>),则校验失败。
  6. 无条件性范围变更 —— 任务不得在运行时将工作在不同阶段间转移。
  7. 实施阶段内无外部/人工闸门 —— 人工或仓库外的验证需放在 hardening/收尾阶段,并标记为
    manual
  8. 可机器校验的完成条件 —— 每个阶段需以一个可验证的不变式(命令+预期结果)结尾。

Result — fixed PASS/BLOCKED output

结果——固定的 PASS/BLOCKED 输出

text
Phase-lint: PASS (8/8)
or, on the first failing box:
text
Phase-lint: BLOCKED — box <n>: <one-line reason>
A BLOCKED phase is re-cut or split; it is never emitted, committed, or executed as-is (no
--force
bypass exists for a non-atomic phase — that decision belongs to the user).
text
Phase-lint: PASS (8/8)
或在首次校验失败时输出:
text
Phase-lint: BLOCKED — box <n>: <one-line reason>
BLOCKED 状态的阶段需重新划分或拆分;不得直接发布、提交或执行(针对非原子阶段,不存在
--force
绕过选项——该决策由用户做出)。

Normalized phase fingerprint

标准化阶段指纹

Each phase's fingerprint is a deterministic string over the phase's shape:
P<n>:<layer>:<n-tasks>:<title-deliverable>
. It binds the lint result to the exact phase version a plan committed to — templates and plans record
Phase-lint: PASS (8/8) · fingerprint <fingerprint>
so later re-lints and
execute-phase
can confirm nothing in the phase shape drifted since planning.
每个阶段的指纹是基于阶段形态生成的确定性字符串:
P<n>:<layer>:<n-tasks>:<title-deliverable>
。它将 lint 结果与计划所提交的具体阶段版本绑定——模板和计划会记录
Phase-lint: PASS (8/8) · fingerprint <fingerprint>
,以便后续重新校验和
execute-phase
确认阶段形态自规划以来未发生偏离。

Guardrails

防护准则

  • Sole owner of the eight rules — planners and executor point here, never carry their own copy.
  • Never relax a rule to let a phase pass; re-cut the phase instead.
  • Docs only — no code, no branch.
  • 八项规则的唯一所有者——规划器和执行器均指向本合约,不得自行存储规则副本。
  • 不得放宽规则使阶段通过校验;应重新划分阶段。
  • 仅为文档——无代码、无分支。