Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Gate?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sheldon-92-gate)
---
name: gate
description: Execute TAD Quality Gate. Gate 1 (pre-design), Gate 2 (pre-handoff), Gate 3 (post-implementation), Gate 4 (acceptance).
---
# /gate Command (Execute Quality Gate)
# Note: Gate 3/4 will NOT pass without their respective evidence files in .tad/evidence/reviews/
## 🎯 自动触发条件
**Claude 应主动调用此 skill 的场景:**
### 必须执行 Gate 的时机
- **Gate 1**: 逐块回放(per-block playback)经人确认后,**进入设计前**(Cora: 派发 intake 之前)
- **Gate 2**: Alex 完成设计,**创建 handoff 前**
- **Gate 3**: 实现并提交后 — the run reviewer(不是 builder)
- **Gate 4**: Gate 3 之后 — the acceptor (Alex that took no part)
### ⚠️ 强制规则
```
规则 1: Alex 创建 handoff → 必须先执行 Gate 2
规则 2: Blake 完成实现并提交 → 必须有 Gate 3(run reviewer 写 verdict)
规则 3: Gate 3 通过 → 必须有 Gate 4(acceptor 真实使用验收)
规则 4: Gate 不通过 → 阻塞下一步,必须修复
```
### 如何激活
```
场景 1: Alex 准备创建 handoff
Alex: 设计已完成,准备创建 handoff
→ 必须先调用 /gate 2
[调用 Skill tool with skill="tad-gate" args="2"]
场景 2: Blake 实现完成
Blake: 代码已实现,准备提交
→ 必须先调用 /gate 3
[调用 Skill tool with skill="tad-gate" args="3"]
```
**核心原则**: Gate 是强制检查点,不可跳过
---
When this command is triggered, execute the appropriate quality gate based on current context:
## Gate Detection and Execution
```
Quality Gate Execution
======================
Detecting current context...
Available Gates:
1. Gate 1: Requirements Clarity (playback + format script, before design)
2. Gate 2: Design Completeness (Agent A - Before handoff)
3. Gate 3: Implementation Quality (run reviewer, not the builder - After coding)
4. Gate 4: Acceptance (Alex acceptor that took no part, after Gate 3)
Which gate to execute? (1-4):
```
## Gate 1: Requirements Clarity (the human + Alex + format script)
# ═══ Gate Checklist Items (inline — derived from canonical) ═══
# Canonical source: .tad/gates/gate-canonical-checklist.md
# Edit canonical FIRST, then sync here. Drift check: diff canonical vs this section.
```yaml
When: after the per-block playback is confirmed, before design (Cora: before the intake dispatch)
Owner: the human (content: per-block playback) + Alex (content: "can design from it") + gate1-format-check.sh (format)
Checklist (4 conditions):
- [ ] What the human gets / Not wanted — the Result contract lines `What the human gets:` and `Not wanted:`
- [ ] Done check per deliverable — a `Done check` block in `## Requirement` (handoff: §1.5) that can judge done / not done
- [ ] Decisions for the human listed; Premise and size (blast radius) stated
- [ ] Estimate stated — **Budget** as `estimate <N>`
Checked_by: "format (the record line `playback confirmed: \"<his words>\"` included) -> bash .tad/hooks/lib/gate1-format-check.sh <Epic | handoff | journal> (advisory, exit 1 = something missing); content -> his confirmed playback and Alex's line 'can design from it' (or the block it cannot). No self-score."
Output: the script's OK / MISSING lines
```
## Gate 2: Design Completeness (Alex) - **MANDATORY** 🔴
# ═══ Gate Checklist Items (inline — derived from canonical) ═══
# Canonical source: .tad/gates/gate-canonical-checklist.md
# Edit canonical FIRST, then sync here. Drift check: diff canonical vs this section.
```yaml
When: Before creating handoff (BLOCKING)
Owner: Agent A (Alex)
Critical Check (10 items):
- [ ] Gate 2 review complete — two reviewers with different lenses (consistency + risk or fit; .tad/templates/review-contract.md).
- [ ] All P0 resolved
- [ ] §9.1 Methods legal — command | path-check | fixture | rubric-spawn | light-tier N/A; prose-only illegal (Gate 3 row FAIL), empty §9.1 still BLOCKS (consistency lens baseline run). AC 字面 dry-run 常设化:consistency 评审文件须含 `## AC dry-run (baseline)` 表(逐 §9.1 行:字面命令|baseline 实跑结果|预期形态(该失败且失败理由对/该通过)|match y/n);§9.1 有行而表中无对应行=该轮 Gate 2 不完整(既有门的完备性规则,不新设门)。命令文本的常设预检 linter 点名 `.tad/hooks/lib/verify-ac-commands.sh`:严格按其头部纪律——advisory、exit 恒 0、不注册任何 hook、不作拦截;字面实跑仍由评审人做,不造自动执行器. Why ME: 只检查"验证方法合法"
- [ ] Decisions with acceptance; code bound kept — every decision names how it is accepted (a §9.1 row or a real_path id); no fenced block over 15 lines and at most 80 fenced lines in all (handoff-creation-protocol step1 `code_bound`). Why ME: 只检查"决策可验收、代码量不越界"
- [ ] Handoff header form [handoff-header-form] — 新合同机械核验三点:① 首行须为 `---`;② `dispatch_id` 位于 front matter 块内(首行 `---` 与其闭合 `---` 之间);③ §9.1 表头须为形态 A(`| # | Acceptance Criterion | Verification Type | Verification Method | Expected Evidence | Verified Output (Alex step1d) |`)。三点全为盘面事实、评审人机械可判;不合规时合同退回改形,不靠检查器容忍过门。存量豁免:本行只约束本行落地后进入 Gate 2 的新合同,已在野的存量 handoff 与评审件不回改,gate3-check.sh 的定位层容忍不撤销、只服务存量件。 Why ME: 只检查"新合同头形三点是否合规"
- [ ] Architecture complete
- [ ] Components specified
- [ ] Functions verified
- [ ] Data flow mapped
- [ ] Risk card for high-risk handoffs — 高风险 handoff(触发项:L3 动作(含删除、密钥、公网、生产)/跨仓或跨席位写/引入新连接器、MCP 或依赖/不可逆动作/涉及金额/对外动作,以及 PM 判断为高风险者)附风险卡(模板 `.tad/templates/dispatch-risk-card.md`,落盘 `.tad/evidence/risk-cards/risk-<task_id>.md`),证伪式假设表逐条成立(假设句+证伪信号+动作三列齐);非高风险须在 Gate 2 节写明触发项核对结论. Why ME: 只检查"高风险派发的关键假设是否写明且可证伪"
- [ ] Load points declared — 本次新增/修改的每条规程、模板、文件逐项写明装载点位(装载面+触发时点);无装载点位的项判设计未完成. Why ME: 只检查"写下的东西读不读得到"
Evidence: Record in handoff header
Output Format:
### Gate 2 Result
| Item | Status | Note |
|------|--------|------|
| Architecture | ✅ Pass | ... |
| Components | ✅ Pass | ... |
| Functions | ⚠️ Partial | 缺少 xxx |
| Data Flow | ✅ Pass | ... |
```
# ⚠️ FAILURE-PATH TABLE CHECK — Gate 2 (handoff §8.7; levels in .tad/templates/review-contract.md §5 "Failure-path table")
```yaml
failure_path_table_check:
applies_when: "The failure-path table (handoff §8.7) is required when the change alters code that writes, copies, syncs, installs, upgrades or rolls back files in a user project or a downstream repo (tad.sh, tad-update.sh, any installer, sync or rollback script); a change that only adds or edits tests or fixtures that run such code inside a throw-away sandbox does not by itself make it required."
who: "The consistency lens checks it on every handoff, whatever its risk_triggers (review-contract.md §5). The risk lens data section, when it runs, reads the rows again with the same levels: a second reader, never the only one."
applicability: "The sentence above holds but §8.7 is missing or says `not applicable` → P0. It does not hold and §8.7 is missing altogether → P1. It holds and risk_triggers lacks `data` → P1 (a wrong trigger, review-contract.md §5)."
rows: "A class (write, sync, rollback) with no row, or a row without the verbatim output or the exit code → P0; the one exception is a per-class `not applicable: <reason>` row (`| n/a | <class> | not applicable: <reason> | | | | |`), which holds the class and a reason instead of the output and the exit. A paraphrased output where the code prints a fixed line → P1."
rows_per_failure_point: "The table has one row per failure point the change adds or alters (for example a new snapshot, cleanup, staging or stamp step), in the nearest class, and at least one row per class that applies; a row copied from an existing fixture case for code the change does not touch does not cover a new failure point: a failure point the change adds with no row of its own → P0 (review-contract.md §5 'per failure point')."
class_not_applicable: "A class that this change does not touch gets one row `| n/a | <class> | not applicable: <reason> | | | | |` in place of its FP rows; such a class is neither missing nor run, and the id_check line lists it after `not applicable:`. The consistency lens judges the reason: an n/a row with no reason, or a reason that does not hold (the change does alter that class's path) → P0. An `n/a` row with an empty reason (an empty third cell, or nothing after `not applicable:`) is not accepted: the id_check line does not flag it, so the reviewer reports it (P0). Such a row is not the whole-section `not applicable` line of the applicability rule above. The reason is checked again at Gate 3, see the Gate 3 FAILURE-PATH RUN block."
ac_reading: "For review-contract.md §3 a §8.7 row counts as an acceptance criterion, so a missing or incomplete row blocks an AC."
scope: "Applies to handoffs entering Gate 2 after this block lands; handoffs already past Gate 2 are not re-reviewed. No item is added to the Gate 2 checklist above or to gate-canonical-checklist.md."
```
# ⚠️ RESEARCH TRUTH CHECK — Gate 2 (handoff §8.8; levels in .tad/templates/review-contract.md §5 "Research truth check")
```yaml
research_truth_check:
applies_when: "The research truth check (handoff §8.8) is required when the deliverable states facts about sources outside this repo that its reader will rely on (a report, review, benchmark, survey or comparison, usually task_type research or deliverable); a deliverable whose every claim is about files of this repo, each checked by a §9.1 command, does not by itself make it required."
who: "The consistency lens checks it on every handoff, whatever its risk_triggers (review-contract.md §5). The risk lens domain section, when it runs, reads §8.8 again with the same levels: a second reader, never the only one."
applicability: "The sentence above clearly holds (a report, review, benchmark, survey or comparison about outside sources) and §8.8 is missing or says `not applicable` → P0. The sentence is arguable and §8.8 gives a `not applicable:` reason saying why → at most P1, judged on that reason. Arguable and §8.8 missing → at most P1. The sentence does not hold → no finding."
rows: "A live third-party claim class with no TC row; a TC row lacking its claim class, read method, population or ledger column; a read method that reads part of a source where the whole is readable (one API field, the body only, an excerpt); a sample for a class with no low-risk reason → P0."
load_bearing: "A TC row that cites no §9.1 row, or cites one whose command does not read `$V` (the run lens's verdict file of the current round, Gate 3 RESEARCH TRUTH READ order) → P0."
ac_reading: "For review-contract.md §3 a TC row counts as an acceptance criterion, so a missing or not load-bearing TC row blocks an AC."
scope: "Applies to handoffs entering Gate 2 after this block lands; handoffs already past Gate 2 are not re-reviewed. No item is added to the Gate 2 checklist above or to gate-canonical-checklist.md."
```
# ⚠️ NO-PROGRESS COUNTER — Gate 2 (BLOCKING; shared definitions in the NO-PROGRESS block after Gate 4)
```yaml
no_progress_counter_gate2:
1_read_on_entry: "On entering Gate 2, Read the MAIN-WORKTREE handoff's ## Gate Rounds and derive G2/TOTAL_ROUNDS/GRANT. At threshold (G2 >= 3 or TOTAL_ROUNDS >= 6) → emit the NO-PROGRESS CIRCUIT BREAKER report and STOP; do not run this gate."
2_boundary_row: "Append this gate's boundary rows at stage boundaries: a review-batch row after each expert review batch (handoff-creation-protocol steps 2/3), then a gate2 row when this gate concludes. Append BEFORE the stage runs with verdict=RUNNING; set the verdict in place when it concludes. If a tail RUNNING row for this stage is already open, fill its verdict instead of adding a row."
3_monotonic: "Rows are append-only; the ONLY in-place edit is RUNNING→terminal verdict. A derived value smaller than the previous one, a reverse edit, or editing any other column → STOP and report."
4_path: "The path always resolves to the MAIN-WORKTREE absolute path — .tad/active/handoffs/ is not git-tracked and does not exist inside a worktree."
5_reviewer_invisibility: "Reviewers spawned for this gate MUST skip the ## Gate Rounds section when reading the handoff (the GATE-ROUNDS-BEGIN/END block and the table after it): it is breaker bookkeeping, not requirements; reading it creates preview anchoring and contaminates the breaker report's same-root-cause diagnosis."
```
> On the conductor path (Cora's runs) rules 1 and 2 of this block are not run: nobody appends rows to the handoff's `## Gate Rounds` table and the derived count stops nothing; the round record is `cora-check.sh rounds` (gate_rounds_carrier `conductor_path`). Rules 1 and 2 are the direct-mode path.
## Gate 3: Implementation Quality (run reviewer, not the builder) - **MANDATORY** 🔴
> Gate 3 is UNIVERSAL across all task_types. Its checks come from the active handoff's
> §9.1 Spec Compliance Checklist (the PRIMARY VERIFICATION SOURCE), not from hardcoded
> tsc/test/lint. When any §9.1 AC references rubric scoring or an independent judge, the
> `## Rubric Evaluation Protocol` section below ACTIVATES.
# ⚠️ NO-PROGRESS COUNTER — Gate 3 (BLOCKING; shared definitions in the NO-PROGRESS block after Gate 4)
```yaml
no_progress_counter_gate3:
1_read_on_entry: "On entering Gate 3, Read the MAIN-WORKTREE handoff's ## Gate Rounds and derive G3/TOTAL_ROUNDS/GRANT. At threshold (G3 >= 3 or TOTAL_ROUNDS >= 6) → emit the NO-PROGRESS CIRCUIT BREAKER report and STOP; do not run this gate."
2_boundary_row: "The layer2 boundary rows are appended by Blake's loop machinery at round boundaries (blake/SKILL.md round_dispatch_guards): a row when a round STARTS (verdict=RUNNING), its verdict set in place when the round closes. Whoever closes a round without machinery (manual run) appends the gate3 row the same way. If a tail RUNNING row is already open, fill its verdict instead of adding a row."
3_monotonic: "Rows are append-only; the ONLY in-place edit is RUNNING→terminal verdict. A derived value smaller than the previous one, a reverse edit, or editing any other column → STOP and report."
4_path: "The path always resolves to the MAIN-WORKTREE absolute path — .tad/active/handoffs/ is not git-tracked and does not exist inside a worktree."
5_reviewer_invisibility: "Gate 3's fresh reviewers MUST skip the ## Gate Rounds section when reading the handoff (the GATE-ROUNDS-BEGIN/END block and the table after it): it is breaker bookkeeping, not requirements; reading it creates preview anchoring and contaminates the breaker report's same-root-cause diagnosis."
```
> On the conductor path (Cora's runs) rules 1 and 2 of this block are not run: nobody appends rows to the handoff's `## Gate Rounds` table and the derived count stops nothing; the round record is `cora-check.sh rounds` (gate_rounds_carrier `conductor_path`). Rules 1 and 2 are the direct-mode path.
```yaml
When: After implementation (BLOCKING)
Owner: the Gate 3 run reviewer (not the builder; Blake prepares)
# The run reviewer applies this Gate 3 section as its checklist (review contract §5 run).
# ⚠️ PREREQUISITE CHECK (BLOCKING)
Prerequisite:
check: "Completion Report 是否存在?"
location: ".tad/active/handoffs/COMPLETION-*.md"
if_missing:
action: "BLOCK Gate 3"
message: |
⚠️ Gate 3 无法执行 - 缺少 Completion Report
必须先创建 Completion Report 才能执行 Gate 3。
请执行 *complete 命令创建报告,然后重新执行 Gate 3。
Completion Report 应包含:
- 实际完成的任务列表
- 与 Handoff 计划的差异
- 遇到的问题和解决方案
- 测试执行结果
result: "BLOCKED - 等待 Completion Report"
if_exists:
action: "继续执行 Gate 3 检查项"
# ⚠️ FRICTION STATUS VERIFICATION (BLOCKING) — TAD Friction Protocol (2026-06-10)
Friction_Status_Check:
description: "Verify completion report contains Friction Status table and no unresolved BLOCKED rows."
process:
step1: "Read completion report and locate '## Friction Status' or '## ⚠️ Friction Status' section."
step2: "If section is missing → WARN but do not BLOCK Gate 3 (backward compat for pre-Friction-Protocol handoffs that lack the section)."
step3: "If section exists, scan each row's Status column:"
step4_decision: |
- Any row with Status = BLOCKED → BLOCK Gate 3. Message:
"⚠️ Gate 3 cannot PASS — unresolved BLOCKED friction: {friction_point}. Resolve or escalate before re-running Gate 3."
- Any row with Status = DEGRADED_WITH_APPROVAL → verify the 'Approval / Substitute Evidence' cell
contains approval source, date/context, accepted risk, and rationale. If evidence is missing or
vague → WARN (advisory, not blocking — human judges adequacy at Gate 4).
- Any row with Status = EQUIVALENT_SUBSTITUTE → verify the 'Approval / Substitute Evidence' cell
describes the replacement, why it is equivalent, and an evidence path. If missing → WARN.
- READY and NOT_APPLICABLE_WITH_REASON rows pass without further check.
blocking_rule: "Unresolved BLOCKED row = BLOCK Gate 3. Other statuses are advisory warnings. Missing Friction Status section = WARN only (backward compat for pre-Friction-Protocol handoffs)."
optional_advisory_checker: |
Optional advisory smoke alarm (Phase 2):
bash .tad/hooks/lib/friction-status-check.sh <completion-report.md>
Reports missing/malformed Friction Status evidence, blocked-as-pass, and
verdict/prose/checklist mismatches. Advisory only — exit 0 clean, exit 1 warnings.
This script must not be registered as a hook or added to settings.
# ⚠️ §9.1 SPEC COMPLIANCE VERIFICATION (BLOCKING) — PRIMARY VERIFICATION SOURCE
# This REPLACES the former hardcoded test-runner + Acceptance_Verification blocks.
# Gate 3 no longer hardcodes tsc/test/lint — those become Alex-generated §9.1 AC rows
# for dev projects (Backward Compatibility §10.3). The Gate executes whatever §9.1 declares.
Spec_Compliance_Verification:
description: "Gate 3 的主验证源是 Handoff 的 §9.1 Spec Compliance Checklist 表格。逐行执行 Verification Method,对比 Expected Evidence,判断 pass/fail。"
source: "active handoff 的 §9.1 Spec Compliance Checklist(每行:AC 编号 + Verification Method + Expected Evidence)"
process:
step1: "The independent run reviewer (review contract §5 run) reads the active handoff 的 §9.1 表格 and runs every row itself, by hand, in one throwaway copy of the project (a git worktree or clone in scratch, deleted after); no script executes handoff commands. `bash .tad/hooks/lib/gate3-check.sh <handoff> <its verdict file>` only checks the evidence (AC table, real paths, not-run list)"
step2_classify: "classify Method legality before execute — each landing row's Verification Method cell is LEGAL iff exactly one of: runnable command in backticks | evidence path-check | fixture runner | rubric-spawn | light-tier N/A with reason. prose-only Verification Method = FAIL for that row (present-but-prose is NOT the Empty Guard — it is a row FAIL → cannot Gate 3 PASS)."
step3: "对每个 LEGAL 行,实际执行其 Verification Method(grep/命令/脚本);ILLEGAL 行直接记 FAIL,不执行"
step4: "对比执行结果与 Expected Evidence → 标记该行 pass / fail"
step5_decision: |
IF 任何一行 FAIL → BLOCK Gate 3(不是 silent pass)。
IF §9.1 含 test 类 AC(如 npm test / pytest)→ 运行该命令;可选调用 test-runner subagent 补充覆盖率视角。
IF 所有行 pass → 继续 Gate 3 后续检查项。
rubric_ac_trigger: |
激活下方 ## Rubric Evaluation Protocol section,当满足以下任一(fail-safe — 强信号强制激活):
(a) §9.1 中存在引用 rubric 评分 / 独立 judge 的 AC(如 'spawn independent judge per Rubric Evaluation Protocol');OR
(b) FRONTMATTER BACKSTOP: handoff frontmatter 是 `task_type: deliverable` 或有非空 `rubric_ref`。
⚠️ backstop 防止一个 rubric handoff 因为 Alex 没写触发短语就 bypass Judge_Not_Producer —— 强信号
(task_type: deliverable / rubric_ref) 无条件激活 protocol,不依赖 §9.1 措辞是否精确。
note: |
dev 项目:Alex 在 §9.1 自动生成 npm test / npx tsc --noEmit / eslint / git diff --stat 等 AC 行(Alex step1_ac_generation)。
非 dev 项目(播客/内容/电商):§9.1 是域特定 AC(如 'python scripts/measure_consistency.py EP04 | grep overall' → > 70)。
无论哪种,Gate 3 都逐行执行 §9.1 的 Verification Method —— 验证逻辑不再硬编码在 Gate 里。
violations:
- "VIOLATION: marking a §9.1 row 'pass' without actually executing its Verification Method (paper acceptance — the AC-driven gate's core anti-pattern)."
- "VIOLATION: skipping a §9.1 row because it 'looks obviously true' — every row's Verification Method MUST run."
# ⚠️ §9.1 EMPTY GUARD (BLOCKING) — FR7 safety net for AC-driven switch
Spec_Compliance_Empty_Guard:
check: "active handoff 的 §9.1 Spec Compliance Checklist 表格是否为空或缺失?"
if_empty_or_missing:
action: "BLOCK Gate 3"
message: |
⚠️ No verification criteria found in §9.1. Alex must populate the Spec Compliance Checklist.
从 hardcoded 切换到 AC-driven 后,空 §9.1 不能 silent pass —— 否则 Gate 失去全部检查内容。
Alex 必须在 §9.1 填写至少一行可执行的 Verification Method,然后重新执行 Gate 3。
rationale: "empty §9.1 → BLOCK 是 AC-driven 架构的必需安全网(VIOLATION:空 §9.1 当作 pass = Gate 形同虚设)。"
# ⚠️ FAILURE-PATH RUN (BLOCKING when handoff §8.7 has rows)
Failure_Path_Run:
applies_when: "The handoff's §8.7 Failure Paths table has rows (Gate 2 FAILURE-PATH TABLE CHECK; review-contract.md §5 'Failure-path table')."
run: "The run reviewer runs each §8.7 row's fixture case by hand in its throwaway copy (reading the fixture first), never in the project folder; the fixture's own sandbox under the system temp directory is allowed."
record: "In its verdict file it writes a section headed '## Failure paths' with one row per §8.7 id, same ids: | id | fixture case | expected exit | actual exit | expected output | actual output | result |"
fail_row: "A row whose actual output lacks an expected line (variable parts excepted) or whose exit differs is a FAIL row and a P0 (it blocks that acceptance item)."
not_run: "A row it cannot run (only for the reasons review-contract.md §6 allows): `not-run` in the result cell plus `- FP<n> not-run: <reason>` under ## Not run (gate3-check.sh accepts any id with a reason)."
not_applicable: "§8.7 says `not applicable` → one line `failure paths: not applicable — <the handoff's reason>` in the verdict file."
class_not_applicable: "A class that this change does not touch gets one row `| n/a | <class> | not applicable: <reason> | | | | |` in place of its FP rows; such a class is neither missing nor run, and the id_check line lists it after `not applicable:`. The run reviewer writes no row for such a class in ## Failure paths. At Gate 3 the consistency lens reads each `not applicable` reason (the whole-section line and every per-class row) against the change as built, the files the completion report lists; a built change that touches a class whose reason says it does not → P0. This is checked at Gate 3 as well as at Gate 2; the Gate 4 acceptor reads the Gate 3 consistency file for it. An `n/a` row with an empty reason (an empty third cell, or nothing after `not applicable:`) is not accepted: the id_check line does not flag it, so the reviewer reports it (P0)."
n_a_reasons_record: "When §8.7 holds any `not applicable` reason (the whole-section line or a per-class row), the Gate 3 consistency file states one line per reason it read, `n/a-reasons: <class, or all> holds | contradicted by <file>` (what the reason was read against: the change as built, the files the completion report lists); the Gate 4 acceptor reads these lines (Gate 4 FAILURE-PATH COUNT n_a_reasons_missing)."
id_check_other_lines: "The id_check line finds §8.7 by a heading of any ## level numbered 8.7 or starting 'Failure Paths'. It prints `failure-paths: NO-SECTION …` when there is no such heading and `failure-paths: EMPTY-SECTION …` when the section has no FP row and is not marked not applicable as a whole or for all three classes. Neither is a match (exit 1): the reviewer reads the handoff's §8.7 by eye, and FP rows under another heading, or a change the Gate 2 applies_when sentence covers, → the run lens is FAIL (P0). `ids match (0 rows)` is printed only when §8.7 says not applicable."
id_check_usage: "Run the line below as /bin/bash -c \"<that line>\" _ <handoff> <own verdict file> and paste its output line under the table. MISMATCH (an id missing, extra, or the section absent while §8.7 has rows) → the run lens is FAIL (P0). The Gate 4 acceptor runs the same line (FAILURE-PATH COUNT). The verdict skeleton and gate3-check.sh are not changed."
id_check: |
[ -f "$1" ] && [ -f "$2" ] || { echo "failure-paths: usage: <handoff> <verdict file>"; exit 2; }; ids() { awk -v s="$2" '$0==s{on=1;next} on&&/^## /{exit} on&&/^\| FP[0-9]+ \|/{print $2}' "$1" | LC_ALL=C sort -u; }; h=$(awk '/^##+ /{match($0,/^#+/); if(on&&RLENGTH<=lv) exit; t=tolower($0); if(!on&&(t~/^##+ +8\.7([^0-9]|$)/||t~/^##+ +([0-9.]+ +)?failure[ -]paths?([^a-z]|$)/)){on=1; lv=RLENGTH; print "S"; next}} !on{next} /^\| *FP[0-9]+ *\|/{split($0,c,"|"); gsub(/ /,"",c[2]); print "I " c[2]; next} /^\| *n\/a *\|/{split($0,c,"|"); gsub(/ /,"",c[3]); if(c[4]~/^ *not applicable: /) print "N " tolower(c[3]); next} /^`?not applicable: /{print "A"}' "$1"); a=$(printf '%s\n' "$h" | sed -n 's/^I //p' | LC_ALL=C sort -u); n=$(printf '%s\n' "$h" | sed -n 's/^N //p' | LC_ALL=C sort -u | tr '\n' ' ' | sed 's/ $//'); b=$(ids "$2" '## Failure paths'); x=; [ -n "$n" ] && x="; not applicable: $n"; printf '%s\n' "$h" | grep -qx S || { echo "failure-paths: NO-SECTION the handoff has no §8.7 Failure Paths heading"; exit 1; }; if [ -z "$a" ] && [ -z "$b" ] && ! { printf '%s\n' "$h" | grep -qx A || [ "$n" = "rollback sync write" ]; }; then echo "failure-paths: EMPTY-SECTION §8.7 has no FP row and is not marked not applicable as a whole or for all three classes$x"; exit 1; fi; if [ "$a" = "$b" ]; then echo "failure-paths: ids match ($(printf '%s' "$a" | grep -c .) rows$x)"; else echo "failure-paths: MISMATCH handoff=[$(echo $a)] verdict=[$(echo $b)]$x"; exit 1; fi
# ⚠️ RESEARCH TRUTH READ (BLOCKING when handoff §8.8 has rows)
Research_Truth_Read:
applies_when: "The handoff's §8.8 Research Truth Check has TC rows (Gate 2 RESEARCH TRUTH CHECK; review-contract.md §5 'Research truth check')."
read: "The run reviewer reads every claim of each TC population from the source itself, whole, by that row's read method, as of its own run; the ledger says where to look, it is not the reading. A sample only where §8.8 writes `sample <n>` with a reason, read the same way."
record: "In its verdict file it writes a section headed '## Truth read': | id | claim | TC | source read whole (what, as of) | rests on (quote or event: who, role, date) | holds |. `id` is one token, the ledger's row id or `TC<n>-<m>`, the claim text in its own column; holds is `yes`, `no` or `not-run`."
order: "The run lens writes ## Truth read into its verdict file of this round (`-r<k>` from round 2) before it runs the truth row, then copies that file into its throwaway copy at the same relative path and runs the row there with V set to that path: never a copy made before the write, never an earlier round's file."
fail_row: "`no` (the claim is stronger than or contrary to the source) → a P0 blocking the Result-contract deliverable; that TC's §9.1 row FAILs."
unreachable_source: "A claim whose live source the run reviewer cannot reach read-only is one P0 and the verdict is FAIL (it blocks the Result-contract deliverable, which would carry a claim nobody checked): its holds cell is `not-run`, that TC's §9.1 row FAILs, no `## Not run` or `## Blocked` line and no PARTIAL is written for it, and the existing routing sends it to rework, which removes the claim from the deliverable (a claim left in place, even marked unverified, is read again next round and fails again). The read itself is review work, not a §9.1 command, so review-contract.md §6's outward rule does not make it not-run. This covers a public live source that does not answer or has gone; a source that needs the human's own account or a capability the reviewer lacks stays under review-contract.md §6's not-run rule."
unchanged: "The verdict skeleton and gate3-check.sh are not changed for this."
# ⚠️ DEV REGRESSION FLOOR (smoke alarm, WARN-not-BLOCK) — FR6 zero-regression backstop
# The empty guard only catches a FULLY empty §9.1. It does NOT catch a present-but-thin §9.1
# that omits the tsc/test/lint rows Alex was supposed to auto-generate (alex step1_ac_generation).
# Without this, a code handoff could PASS Gate 3 with tsc/test NEVER run — the old hardcoded
# test-runner floor's exact failure mode. Soft reminder per "Mechanical Enforcement Rejected on
# Single-User CLI" (smoke alarm, not a hook). Aligns with the project principle that a global/
# presence check is blind to must-cover loss when stripping also satisfies it.
Spec_Compliance_Dev_Floor:
applies_when: "active handoff frontmatter task_type IN {code, mixed} AND §6 Files to Modify touches buildable files (.ts/.tsx/.js/.jsx/.py or a project with package.json/tsconfig/pyproject.toml)"
check: "Does §9.1 contain at least one compile/test row? (a Verification Method with a tsc / test / pytest / build / lint token)"
if_missing:
action: "WARN (not BLOCK) — surface to human, do not silently pass"
message: |
⚠️ task_type={code|mixed} handoff touches buildable files but §9.1 has no tsc/test/lint row.
The AC-driven Gate cannot regression-check what §9.1 never declared. Confirm this is
intentional (e.g. a pure-config edit) or ask Alex to add the missing dev-floor ACs
(alex step1_ac_generation) before accepting Gate 3.
not_blocking_rationale: "WARN not BLOCK — a legitimate pure-config/doc code-handoff may have no compile row. Human confirms; the gate must not hard-fail on a false positive (smoke alarm, not fire suppressor)."
# ⚠️ RISK TRANSLATION CHECK (Cognitive Firewall - Pillar 3)
Risk_Translation:
description: "Detect fatal operations and translate code changes to business consequences"
config: ".tad/config-quality.yaml → fatal_operations"
blocking: "Only for critical severity (forced_review = true)"
check_process:
step0_handoff_intent: "Read handoff task descriptions — operations matching handoff intent are EXPECTED, not blocked (P0-3 FIX)"
step1: "Read config-quality.yaml fatal_operations (universal_preset + project_custom)"
step2: "Scan all changed files against safety_net paths and patterns"
step2b: "For each match, cross-check against step0 handoff intent — skip EXPECTED operations"
step3: "For remaining matches, generate risk translation (one-liner + risk card)"
step4_decision: |
IF critical matches found:
→ BLOCK Gate until human reviews and approves
→ Present risk cards to human
→ Human must explicitly approve: "I understand the risk, proceed"
IF high matches found:
→ WARNING but not blocking
→ Include in Gate output for human awareness
IF no matches:
→ PASS (note: "No fatal operations detected")
output_format:
gate3_addition: |
#### Risk Translation (Cognitive Firewall)
| # | Operation | Severity | Business Impact | Human Review |
|---|-----------|----------|-----------------|--------------|
| 1 | {op} | 🔴 Critical | {impact} | ✅ Approved / ⏳ Pending |
{If critical items: show risk cards below the table}
# ⚠️ GIT COMMIT VERIFICATION CHECK (BLOCKING)
Git_Commit_Verification:
check: "Implementation changes committed to git?"
method: "Check completion report for commit hash, AND verify via git log"
if_missing:
action: "BLOCK Gate 3"
message: |
⚠️ Gate 3 无法通过 - 实现代码未 commit
Blake 必须在 Gate 3 之前执行 git commit (step3c)。
请执行 step3c (Git Commit Implementation) 然后重新执行 Gate 3。
if_exists:
checks:
- "commit_hash is not empty and not 'NONE' (unless doc-only handoff)"
- "If commit_hash is a real hash: verify via `git log --oneline -1 {hash}` returns valid output"
- "If commit_hash is 'NONE': verify handoff has no 'Files to Create/Modify' entries (truly doc-only)"
on_valid: "PASS"
on_invalid: "BLOCK - commit hash not found in git history or doc-only claim invalid"
# Gate 3 检查项(Prerequisite, §9.1 Spec Compliance, Empty Guard 要求通过后执行)
# ═══ Gate Checklist Items (inline — derived from canonical) ═══
# Canonical source: .tad/gates/gate-canonical-checklist.md
# Edit canonical FIRST, then sync here. Drift check: diff canonical vs this section.
# MECE: verified 2026-10-19 — 10 items check 10 distinct artifacts
Critical Check (10 items):
- [ ] Code/deliverable complete (all handoff tasks done; Ralph COMPLETED on the final commit with every review-contract §8 lens covered; ESCALATED_TO_ALEX/BLOCKED_STATE/BLOCKED_RISK/ABORTED/NOT_RUN are not clean completion)
- [ ] §9.1 Spec Compliance: every row's Verification Method executed and matches Expected Evidence (any FAIL → BLOCK; empty §9.1 → BLOCK)
- [ ] Evidence files exist per the handoff's Required Evidence Manifest; preserve original severity/raw findings plus independent checked-input disposition ledger: fixed / pre-existing / dismissed count as addressed only after relevant independent recognition. pre-existing requires baseline proof, no task introduction/aggravation/new exposure, no AC violation or unresolved serious safety/delivery risk; dismissed needs counterevidence. Blake proposals remain open. Pure out-of-scope serious risk goes to Alex/human. Unmet AC/missing evidence/evidence veto still block.
- [ ] Evidence replayable (advisory, WARN-not-BLOCK): 证据采集命令重跑两次应 0 diff。
若重跑产生全量改动(随机 ID / 时间戳 / commit SHA 入了证据体)→ WARN:
任何改动都会触发全量重采,reviewer 无法 diff 只能重读全文,代价随轮数线性放大。
建议先修证据管道(把不确定性字段移出证据体或固定种子)再继续。
- [ ] Code metrics(记账,仅试点链):试点名单内的链,证据集中有 code-metrics 运行记录或合格 not-run 理由;缺失、或 not-run 理由不合格(枚举外理由/缺写入者/缺日期),同样只记 pilot coverage gap,不单独构成 Gate 3 的 FAIL/P0/PARTIAL/CONDITIONAL;非试点链无记录义务;本批内指标数值不决定 verdict。注:本节『试点链』指代码指标记账的试点名单,与 Gate 2『Pilot declared』的同构单元先行 pilot 不是一事,勿混。
- [ ] Git commit done (commit hash recorded, or NONE for doc-only)
- [ ] Knowledge Assessment complete (BLOCKING - must answer explicitly)
- [ ] Provenance non-empty (advisory, WARN-not-BLOCK): ≥1 provenance row per CREATE file
- [ ] ACs re-run by the run reviewer in one throwaway project copy — its verdict file's `## AC runs` table has every §9.1 AC row (or a not-run reason); every row compared with Expected Evidence
- [ ] Real paths covered — every real_path has a run row or "not-run: <reason>" (gate3-check.sh exit 0)
Evidence: Record in completion report + evidence file
Output Format:
### Gate 3 Result
#### Prerequisite
| Check | Status |
|-------|--------|
| Completion Report | ✅ 存在 |
#### §9.1 Spec Compliance (PRIMARY VERIFICATION SOURCE)
| AC# | Verification Method | Expected | Actual | Status |
|-----|---------------------|----------|--------|--------|
| AC1 | {command from §9.1} | {expected} | {actual} | ✅ Pass / ❌ Fail |
| ... | (one row per §9.1 AC — empty §9.1 → BLOCK) | | | |
#### Git Commit Verification
| Check | Status | Detail |
|-------|--------|--------|
| Changes committed | ✅ / ❌ | commit_hash: {hash} or NONE (doc-only) |
#### Quality Checks
| Item | Status | Note |
|------|--------|------|
| Code/Deliverable Complete | ✅ Pass | final commit, every review-contract §8 lens covered; no blocked/escalated/aborted/NOT_RUN |
| §9.1 all rows pass | ✅ Pass | {P} pass, {F} fail (any fail → BLOCK) |
| Evidence | ✅ Pass | Manifest + original severity/raw findings + independent disposition proof/input; valid unresolved blockers only; unmet AC/evidence veto still block |
#### Knowledge Assessment (MANDATORY - must answer)
| Question | Answer | Evidence |
|----------|--------|----------|
| New discoveries? | ✅ Yes / ❌ No | — |
| If Yes: written to | evidence/journal/{handoff-slug}-{date}.md | Journal entry path |
| If No: reason | {why no new discovery} | — |
⚠️ "Yes" without a journal file path = Gate 3 FAIL.
Blake writes to evidence/journal/ (raw journal). Distillation to project-knowledge/ is Alex's Gate 4 task.
Completion report references the journal entry, it does not contain the entry.
# ⚠️ KNOWLEDGE ASSESSMENT (BLOCKING - Part of Gate 3)
# 必须在 Gate 结果表格中显式回答,不可跳过
Knowledge_Assessment:
blocking: true
description: "Gate 3 无法 PASS 除非 Knowledge Assessment 表格已填写"
mandatory_questions:
- question: "本次实现是否有新发现?"
must_answer: true
options:
- "✅ Yes - 有新发现"
- "❌ No - 常规实现,无特殊发现"
- question: "如果有,属于哪个类别?"
must_answer: "if previous is Yes"
options: "从 .tad/project-knowledge/ 目录读取"
- question: "一句话总结"
must_answer: true
note: "即使无新发现,也要写明原因(如:常规 CRUD 实现)"
evaluation_criteria:
should_record_if:
- "遇到了意外问题并解决(surprise factor)"
- "发现了可复用的模式或反模式"
- "做出了影响未来开发的技术决策"
- "同类问题可能再次出现(recurrence)"
- "花了 >30 分钟解决的问题"
can_skip_if:
- "纯粹的 CRUD 操作"
- "完全按照 handoff 执行,无任何偏差"
- "已有完全相同的记录"
if_new_discovery:
step1: "确定 journal 路径: evidence/journal/{handoff-slug}-{date}.md"
step2: "追加到 journal(创建或 append)。格式自由——要点列表、散文、关键数值皆可。"
step3: "Blake 写入 evidence/journal/,不直接写 project-knowledge/(成品提炼是 Alex Gate 4 的工作)"
step4: "使用自由格式(journal)"
step5_verify: "在 Gate 3 表格的 Evidence 列填写:evidence/journal/ 文件路径。无此信息 = Gate FAIL"
completion_report_rule: |
Completion report 的 Knowledge Assessment 节只写引用:
"Journal entry added: evidence/journal/{slug}-{date}.md"
成品提炼在 Alex Gate 4 distillation loop 中完成,不在 Gate 3。
entry_format: |
自由格式(journal)——要点列表、散文、关键数值皆可。
无 schema 约束。append-only。
violation: "Gate 3 结果表格中没有 Knowledge Assessment 部分 = VIOLATION = Gate 无效"
# ⚠️ GATE 3 POST-STEP — gate3_verdict marker (UNIVERSAL — all task_types)
# Promoted from the former deliverable-only marker to a universal post-step (P1 step 7).
# This runs for EVERY task_type (code / yaml / research / e2e / mixed / doc-only), not just rubric ACs.
Gate3_Verdict_Marker:
who: |
The Gate 3 run reviewer writes the marker (it wrote the Gate 3 verdict) — never the builder, never Cora.
A rubric judge is a distinct subagent dispatched before it by Blake (direct) or Cora (run); the run reviewer
reads the judge's verdict line for those rows.
Single rule: the Gate 3 run reviewer owns the marker; the judge is always a distinct sub-agent."
when: "AFTER the Gate 3 verdict is computed, as a Gate 3 post-step (all task_types)."
action: |
Edit the completion report's `gate3_verdict:` frontmatter to the Gate 3 verdict
LOWERCASED — one of pass | fail | partial (PARTIAL→partial). Mirrors blake
completion_protocol.step4b_gate3_verdict_marker. For rubric/judge §9.1 ACs the value
derives from the Rubric Evaluation Protocol's Verdict_Mapping output.
Without this, emit_gate_result hits the empty-skip → ZERO gate_result telemetry
(the paper-machine failure) for ANY task_type, not only deliverables.
allowlist: "pass | fail | partial (post-write-sync.sh emits gate_result only for these exact lowercase values)."
timing_note: "The completion report is written BEFORE the verdict exists, so gate3_verdict is empty at creation; the Gate 3 executor writes it as this post-step Edit, which re-triggers post-write-sync.sh to emit the gate_result event."
# ⚠️ POST-PASS ACTIONS
Post_Pass_Actions:
trigger: "Gate 3 所有检查项 PASS(包括 Knowledge Assessment)"
update_next_md:
action: "更新 NEXT.md 反映实现完成状态"
steps:
- "标记已完成的实现任务为 [x]"
- "添加测试/集成相关的后续任务"
- "移动阻塞项到 Blocked 分类(如有)"
format: "English only"
```
## Rubric Evaluation Protocol
> UNIVERSAL Gate section (not deliverable-only). ACTIVATES when any §9.1 AC references rubric
> scoring or an independent judge (e.g. a §9.1 AC whose Verification Method is "spawn independent
> judge per Rubric Evaluation Protocol against rubric X → verdict: PASS"). Applies to ANY task_type
> whose §9.1 contains such an AC — not just `task_type: deliverable`. When no §9.1 AC references a
> rubric/judge, this section is inert (skipped). The SAFETY logic below is migrated byte-exact from
> the former Gate 3 deliverable branch — it is the anti-self-scoring backbone for rubric-based ACs.
```yaml
Activation: "Triggered from Gate 3 Spec_Compliance_Verification.rubric_ac_trigger — a §9.1 AC references rubric scoring / independent judge. Otherwise inert (no rubric AC → skip)."
Owner: "Gate/Conductor executes (spawns the judge); the producing agent revises on PARTIAL/FAIL"
# ⚠️ judge ≠ producer (BLOCKING) — contract §C — anti-self-scoring backbone (migrated byte-exact)
Judge_Not_Producer:
hard_rule: |
The deliverable is produced by ONE agent (a Conductor-spawned producer sub-agent /
the Conductor). The rubric score is computed by a SEPARATE judge sub-agent, spawned
fresh by the gate/Conductor, whose prompt references ONLY {deliverable_paths} +
{rubric_ref} + {pass_threshold}. judge ≠ producer is defined relative to THIS producer
(if the Conductor itself produced, the judge MUST be a distinct sub-agent).
why: "self-enhancement bias ~10-15% inflation when an agent scores its own output (ai-evaluation: Judge ≠ Optimizer/Producer). A self-scored rubric is validation theater."
forbidden:
- "VIOLATION: the producing agent (or same session/persona) computes the rubric score for its own deliverable."
- "VIOLATION: passing the producer's reasoning / 'why this is good' notes into the judge prompt."
- "VIOLATION: reusing the producer sub-agent (or its conversation) as the judge."
- "VIOLATION (artifact-channel): the judge crediting self-assessment / quality-claim prose embedded INSIDE the artifact (self-praise, a producer-written self-scored rubric table). The judge scores on RUBRIC EVIDENCE it independently derives from the artifact's substance — NOT on the artifact's own claims about its quality. Self-praise in the artifact is ignored, not credited."
- "VIOLATION: 'the producer already self-scored, so skip the judge' rationalization (the 'Express → exempt' anti-pattern applied to scoring)."
# ⚠️ RUBRIC + THRESHOLD RESOLUTION (BLOCKING) — contract §A.2 precedence
Rubric_Resolution:
description: "Resolve rubric_ref + pass_threshold + partial_threshold + verdict_shape before spawning the judge"
precedence:
step1: "If handoff frontmatter sets rubric_ref and/or pass_threshold → frontmatter values WIN (per-handoff override)"
step2: "Else fall back to .tad/capability-packs/deliverable-rubrics.yaml row keyed by frontmatter `pack`"
step3: "If BOTH absent (no frontmatter value AND no registry row / null) → BLOCK Gate 3"
registry_read: |
Read the registry row for the handoff's `pack` (when falling back per step2):
yq '.packs.<pack>' .tad/capability-packs/deliverable-rubrics.yaml
Resolve from that row: rubric_ref, pass_threshold, partial_threshold, verdict_shape.
(Frontmatter values, when present, override the corresponding registry fields per step1.)
if_unresolved:
action: "BLOCK Gate 3"
message: "deliverable handoff has no resolvable rubric_ref + pass_threshold (set in frontmatter or register the pack in deliverable-rubrics.yaml). No silent default."
partial_threshold: "from deliverable-rubrics.yaml row (default 0.60 if omitted)"
# ⚠️ VERDICT SHAPE GUARD (BLOCKING) — unknown shape must never be silently mis-scored
verdict_shape_guard:
rule: "If the resolved verdict_shape NOT IN {weighted, categorical, checklist} → BLOCK Gate 3"
supported: [weighted, categorical, checklist]
message: "Unknown verdict_shape — supported: weighted (0-1 ladder), categorical (rigor band), checklist (export-spec pass/fail). An unrecognized shape must NOT be silently mis-scored."
violation: "VIOLATION: silently scoring an unrecognized verdict_shape instead of BLOCKING — an unknown shape has no defined pass semantics."
# ⚠️ REQUIRED JUDGE SUBAGENT (BLOCKING) — independent judge for rubric/judge §9.1 ACs
Required_Judge:
subagent: "judge (a FRESH independent sub-agent — NOT the producer)"
action: "MUST spawn an independent judge sub-agent before a rubric/judge §9.1 AC can pass"
# contract §B.3 — judge prompt is constructed from FILE PATHS ONLY:
judge_inputs:
- "deliverable_paths — artifact file path(s) to evaluate (judge reads them)"
- "rubric_ref — rubric file path (judge reads + applies it)"
- "pass_threshold — numeric threshold (resolved per Rubric_Resolution)"
conductor_path_handoff: "On the conductor path (Cora, conductor-protocol step_Y6 1b) the judge prompt may name the handoff path, only to locate the rubric AC rows, their rubric and pass threshold; the three inputs above stay the only content, and no producer reasoning is passed."
judge_prompt_constraint: |
Blue-team framing: "You are an independent reviewer. Score the artifact at {deliverable_paths}
against the rubric at {rubric_ref}. Report per the resolved verdict_shape (see judge_prompt_by_shape) + the machine-readable verdict line."
The judge prompt MUST NOT include the producer's reasoning, chat transcript, persona,
identity, or any "this is good because…" framing.
judge_prompt_by_shape: |
weighted → "Report dimension scores + weighted average + verdict." (existing)
categorical→ "Assign a RIGOR band (rigorous|partial|superficial) per the rubric, then map
to verdict. Score the RIGOR of the analysis ONLY — a rigorously-argued KILL
is rigorous; do NOT reward/punish the BUILD/PIVOT/KILL conclusion. Emit
`band:`, `content_verdict:` (recorded, not gate-determining), and `verdict:`."
checklist → "Evaluate each required/optional export-spec item pass/fail per the rubric,
then map to verdict. Emit the item table and `verdict:`."
All shapes keep judge≠producer + file-paths-only (no producer reasoning/persona/identity).
output_to: ".tad/evidence/reviews/{date}-rubric-eval-{task}.md"
output_format: # contract §B.4
- "Scores table: | # | Dimension | Weight | Score (0-1) | Notes | (one row per rubric dimension)"
- "weighted_score = Σ(score_i × weight_i) shown with the arithmetic"
- "For verdict_shape categorical/checklist the weighted_score arithmetic bullet is replaced by the band line / item table respectively; the `verdict:` machine-readable line is REQUIRED for ALL shapes (shape-agnostic Gate 4 token)."
- "MUST contain an EXACT machine-readable verdict line (own line, lowercase key, uppercase value, NO bold/emoji): `verdict: PASS` | `verdict: PARTIAL` | `verdict: FAIL` — this is the token Gate 4 greps (^verdict: ). The human-readable verdict prose may appear separately."
- "Top-3 strengths / top-3 weaknesses (actionable)"
- "MUST state: 'Judge: independent sub-agent; producer identity not provided.'"
output_format_constraint: |
⚠️ The rubric-eval file's weaknesses MUST NOT use the ^#+ *P[0-9]- heading form
(e.g. NOT '### P0-1', '## P1-2'). post-write-sync.sh expert_review_finding counts
heading-form P<n>- labels → a P-label heading here self-triggers false P0/P1 telemetry
(the documented "Parser Self-Trigger" failure). Use plain prose ("Weakness 1: …") or a
| # | Weakness | Severity | table cell — never a P-label heading.
if_not_called:
action: "BLOCK Gate 3"
message: |
⚠️ Gate 3 无法通过 - 缺少独立 judge 的 rubric-eval 审查
必须 spawn 一个 fresh 独立 judge sub-agent,输出到
.tad/evidence/reviews/{date}-rubric-eval-{task}.md,然后重新执行 Gate 3。
conductor_path_judge_unusable_gate3: "On the conductor path the case 'judge unusable twice' is governed by the `conductor_path_judge_unusable` key (Rubric_Gate4_Prerequisite): the run file marks the rubric AC not-run and this BLOCK does not apply to that case."
# ⚠️ VERDICT MAPPING — contract §B.5
Verdict_Mapping:
rule: |
IF weighted_score ≥ pass_threshold → PASS
ELSE IF weighted_score ≥ partial_threshold → PARTIAL (default partial_threshold = 0.60)
ELSE → FAIL
# ── verdict_shape: categorical (e.g. product-thinking BUILD/PIVOT/KILL) ──
categorical:
rule: |
The judge assigns a RIGOR band from the rubric: rigorous | partial | superficial.
rigorous → PASS · partial → PARTIAL · superficial → FAIL
rigor_independence: |
⚠️ The band scores the RIGOR of the analysis, NOT its content conclusion. For
BUILD/PIVOT/KILL packs: a rigorously-argued KILL is `rigorous` (PASS); a hand-wavy
BUILD is `superficial` (FAIL). The judge MUST NOT raise or lower the band based on
whether the artifact concluded BUILD vs PIVOT vs KILL.
decoupling_firewall: |
(P1-1 hardening — structural, not just prose:)
1. ORDER OF EMISSION: the judge MUST write `band:` WITH its per-dimension rigor
justification BEFORE it states `content_verdict:`. The band is committed before the
conclusion is named, so the conclusion cannot anchor the band.
2. CONCLUSION-NEUTRAL CRITERIA: the rubric's band criteria (Phase 2) MUST be phrased
about rigor (evidence depth, fatal-flaw coverage, FACT/ASSUMPTION discipline,
adapter use) — NEVER "concludes BUILD" / "is optimistic".
3. SWAP TEST (stated in the judge prompt): "If you flipped this artifact's final
BUILD/PIVOT/KILL word and changed nothing else, would the band change? If yes, you
are scoring the conclusion — re-score on rigor only."
extra_output: |
The rubric-eval ALSO emits (own lines, for traceability — NOT gate-determining):
band: rigorous|partial|superficial
content_verdict: BUILD|PIVOT|KILL (the artifact's own conclusion; recorded, never maps to gate verdict)
The machine-readable `verdict: PASS|PARTIAL|FAIL` line (derived from band) remains the Gate 4 token.
⚠️ `band:` (with justification) MUST appear ABOVE `content_verdict:` in the file (order firewall).
# ── verdict_shape: checklist (e.g. ai-voice / video-creation export specs) ──
checklist:
malformed_guard: |
(P1-2 guard:) the rubric MUST define ≥1 REQUIRED item. A checklist rubric with zero
required items → BLOCK Gate 3 ("malformed checklist rubric — cannot ever FAIL, define
≥1 required item"). This prevents an all-optional rubric from becoming a gate that
always PASSes.
rule: |
The rubric lists REQUIRED items + OPTIONAL items (export-spec pass/fail: dB / format / duration).
ALL required pass → PASS
ALL required pass, ≥1 optional fail → PARTIAL
ANY required fail → FAIL
evidence_independence: |
(P1-2 artifact-channel guard:) the judge derives each item's pass/fail from the
artifact's substance / measurable specs it independently checks — NEVER from the
artifact's own claim that it passed (same Judge_Not_Producer artifact-channel rule).
extra_output: |
The rubric-eval emits a per-item | item | required? | pass/fail | table; the
`verdict:` line is derived per the rule above.
on_pass: "Gate 3 proceeds (KA + git checks)."
on_partial_or_fail: "BLOCK Gate 3; the producer (§B.6) revises and re-runs — a FRESH judge re-scores the revised artifact (each re-score is a new judge spawn)."
# Rubric AC integration (how a rubric/judge §9.1 AC resolves)
Rubric_AC_Integration:
description: "When a §9.1 AC references a rubric/judge, its row pass/fail is decided by this protocol, not by a plain grep."
flow: |
1. Resolve rubric_ref + threshold + verdict_shape (Rubric_Resolution).
2. Spawn the independent judge (Required_Judge) — judge ≠ producer (Judge_Not_Producer).
3. Map judge output → verdict (Verdict_Mapping).
4. The §9.1 AC passes IFF the judge's machine-readable line is `verdict: PASS`; PARTIAL/FAIL → that §9.1 row FAILs → BLOCK Gate 3.
rubric_eval_evidence: ".tad/evidence/reviews/{date}-rubric-eval-{task}.md (verdict PASS) — listed in the handoff's Required Evidence Manifest."
gate3_verdict: "The overall Gate 3 verdict is recorded via the universal Gate3_Verdict_Marker (Gate 3 code path post-step). The rubric judge verdict feeds that marker when the §9.1 ACs are rubric-based."
note: "Prerequisite / Git Commit / Knowledge Assessment are NOT re-declared here — the universal Gate 3 block already enforces them for ALL task_types (no deliverable-only duplication)."
```
## Gate 4: Acceptance (Alex acceptor that took no part) - **MANDATORY** 🔴
> Gate 4 is one acceptor on every path and task_type: an Alex subagent that took no part in the
> design or the build does once, for real, what the human will do with the result (or drives a
> browser), and hands him a verdict plus 3-5 evidence lines. The Gate 3 lenses, including the
> domain lens when risk_triggers lists security, data or money, are its prerequisite; for rubric
> ACs the Gate 3 judge verdict PASS is the prerequisite (see Rubric Evaluation Protocol).
# ⚠️ NO-PROGRESS COUNTER — Gate 4 (BLOCKING; shared definitions in the NO-PROGRESS block below)
```yaml
no_progress_counter_gate4:
1_read_on_entry: "On entering Gate 4, Read the MAIN-WORKTREE handoff's ## Gate Rounds and derive G4/TOTAL_ROUNDS/GRANT. At threshold (G4 >= 3 or TOTAL_ROUNDS >= 6) → emit the NO-PROGRESS CIRCUIT BREAKER report and STOP; do not run this gate (acceptance-protocol step2b)."
2_boundary_row: "Append the gate4 boundary row BEFORE the acceptance run (verdict=RUNNING); set its verdict in place when the run concludes (acceptance-protocol step3b). If a tail RUNNING row for this gate is already open, fill its verdict instead of adding a row."
3_monotonic: "Rows are append-only; the ONLY in-place edit is RUNNING→terminal verdict. A derived value smaller than the previous one, a reverse edit, or editing any other column → STOP and report."
4_path: "The path always resolves to the MAIN-WORKTREE absolute path — .tad/active/handoffs/ is not git-tracked and does not exist inside a worktree."
5_reviewer_invisibility: "The Gate 4 acceptor MUST skip the ## Gate Rounds section when reading the handoff (the GATE-ROUNDS-BEGIN/END block and the table after it): it is breaker bookkeeping, not requirements; reading it creates preview anchoring and contaminates the breaker report's same-root-cause diagnosis."
```
> On the conductor path (Cora's runs) rules 1 and 2 of this block are not run: nobody appends rows to the handoff's `## Gate Rounds` table and the derived count stops nothing; the round record is `cora-check.sh rounds` (gate_rounds_carrier `conductor_path`). Rules 1 and 2 are the direct-mode path.
```yaml
When: After Gate 3 (BLOCKING)
Owner: an Alex acceptor that took no part — dispatched by Cora in her runs, by the designing Alex at *accept in direct mode; never Blake, never the designer
# ⚠️ PREREQUISITE CHECK (BLOCKING)
Prerequisite:
check: "Gate 3 是否已通过?"
evidence: |
Gate 3 PASS evidence exists. For code/mixed handoffs this is the §9.1-driven Gate 3
result + any test/review evidence the §9.1 ACs declared. For rubric-based handoffs it is
.tad/evidence/reviews/*-rubric-eval-*.md with the machine-readable line `verdict: PASS`.
if_missing:
action: "BLOCK Gate 4"
message: |
⚠️ Gate 4 无法执行 - Gate 3 未完成
必须先完成 Gate 3(§9.1 全行 pass,rubric AC 须 verdict: PASS)。
result: "BLOCKED - 等待 Gate 3 完成"
conductor_path_judge_unusable_note: "On the conductor path the case 'judge unusable twice' is governed by the `conductor_path_judge_unusable` key (Rubric_Gate4_Prerequisite): that case does not block here."
# ⚠️ FRICTION STATUS REVIEW — Gate 4 (TAD Friction Protocol (2026-06-10))
Gate4_Friction_Review:
description: "Alex reviews Blake's Friction Status table for business acceptance blockers and evidence completeness."
process:
step1: "Read completion report Friction Status table."
step2: "If table is missing → WARN (backward compat for pre-Friction-Protocol handoffs)."
step3: |
For each row:
- BLOCKED → Gate 4 cannot accept. Alex must resolve or return to Blake.
- DEGRADED_WITH_APPROVAL → verify approval source, date/context, accepted risk, rationale
are present and substantiated. Unsubstantiated degradation prevents acceptance.
- EQUIVALENT_SUBSTITUTE → verify replacement description, equivalence reasoning, and
evidence path. Self-review as substitute for expert review → REJECT.
- READY / NOT_APPLICABLE_WITH_REASON → accepted.
note: "Alex does NOT re-perform Gate 3 technical validation. This is business-acceptance review of friction handling evidence. Friction_Review does not waive Method recompute — friction review never substitutes for re-running the §9.1 Verification Methods."
optional_advisory_checker: |
Optional advisory smoke alarm (Phase 2):
bash .tad/hooks/lib/friction-status-check.sh <completion-report.md>
Same tool as Gate 3 advisory. Alex may run it before Gate 4 acceptance to catch report drift.
# ⚠️ ACCEPTANCE BY REAL USE (BLOCKING) — one acceptor, every path and task_type
Acceptance_By_Real_Use:
rule: "MANDATORY: acceptance by real use — reading files is not acceptance (no paper acceptance); for protocol or prompt text the real use is a named scenario walk quoting file:line (contract §6)"
duties:
1: "Reads ## Requirement, the Result contract and Assumptions (Epic; direct: handoff §1.5 and §9), the Gate 3 files, the completion report. Runs `gate3-check.sh <handoff> <Gate 3 run file>`: MISSING or UNEXPLAINED → FAIL."
2: "Acts as the human: lists what he will do with the result, and does each once for real (install, build, call, open the page) in a scratch location — or drives a browser where its own tool list has one (Claude Code examples: the Browser pane, Claude in Chrome, a Playwright MCP); protocol text: named scenario walks quoting file:line. Evidence (screenshots, run logs, quoted lines) under .tad/evidence/yolo/{slug}/phase{N}-gate4/ (Cora) or .tad/evidence/reviews/alex/<slug>/gate4/ (direct). One real use per path, never a batch or a measurement (contract §6)."
3: "Judges against ## Requirement + Result contract (a departure names the requirement line). Recomputes quantitative ACs from raw files (AR-005) and any PARTIAL in play ([A089]); every other §9.1 row is read from the `## AC runs` table of the Gate 3 run file, not re-run. A self-report that disagrees with disk counts as failed ([A037])."
4: "What only the human can do — a real device, a payment, his own account login — goes under `## For the human` as `Needs you: <item> — <reason>` (the same rule as Cora's Why not me: before any ask the acceptor checks that neither it nor a subagent nor another facility can do it); no other item is asked of him. No browser tool on this harness/subagent: `not-run: no browser tool on <harness>` under `## Not run` and as a `Not run:` line in `## For the human` (shown to him, never asked; not a `Needs you:` item); the verdict is given on what ran, and a UI deliverable whose real use did not run caps it at CONDITIONAL (a carried item, contract §7). The dispatcher (Cora step_Y7 3; Alex at *accept step3) re-dispatches the acceptor once on a subagent whose tool list has a browser when the harness offers one, before relaying. Installing a browser tool is a new dependency: a question (risk card [A036], pinned version, lock file), never silent and never a precondition. A paid run (billed separately in real money; a plan session is not one): stop — Cora run: class 3 question (stop reason 3); direct: Alex asks the human."
5: "Release (the Result contract or phase includes a tag or publish): applies the rule stated here in full (origin: the 2026-10-16 ruling in `.tad/project-knowledge/rulings/human-rulings.md`, if it exists) — installs the release archive shape (git archive of the release commit) end to end into a throwaway project before the tag. The real download install right after the tag is run by the party that pushes the tag (the release step, under the same confirmation as the tag), never handed to the human; the acceptor records it under `## Not run` as `not-run: after the tag — run by the release step (human-rulings.md 2026-10-16)` and as a `Not run:` line in `## For the human`."
6: "Report (`lens: acceptor` header) ends with `## For the human`: line 1 `verdict: <…> — <one sentence>`; then 3–5 evidence lines, each a real run written `real use: <evidence path under the gate4 dir> — <what it showed>` (the same pointer as its `#### Real use` row); then `Needs you:` items, `Not run:` items, `Assumptions:`, `Open P1:`. Knowledge Assessment and `## Knowledge candidates` unchanged. When at least one path the human will use did not run (a not-run item, a login only he has, a release's `not-run: after the tag`) the section also carries `light acceptance: <reason>`, shown to him. Cora (or Alex in direct *accept) checks both with `/bin/bash .tad/hooks/lib/cora-check.sh gate4-record <report>` from the repo root; a report with neither is incomplete and is re-dispatched."
violation: "VIOLATION: a Gate 4 PASS while a security, data or money trigger has no Gate 3 domain review file; the domain lens MUST NOT be skipped by leaving a trigger the change has off the list."
Gate3_Evidence_Check:
rule: "Gate 3 files present for every lens of contract §8 — run, consistency, and domain when risk_triggers lists security/data/money; `gate3-check.sh <handoff> <run file>` exit 0 (AC table complete, every real_path run or not-run with a reason); FAIL enumerates what is missing."
# ⚠️ FAILURE-PATH COUNT — Gate 4 (BLOCKING when handoff §8.7 has rows)
Gate4_Failure_Path_Count:
rule: "The acceptor runs the id_check line of the Gate 3 FAILURE-PATH RUN block on the handoff and the Gate 3 run file (/bin/bash -c \"<that line>\" _ <handoff> <Gate 3 run file>) and puts its output line in the report."
fail: "MISMATCH, or a FAIL row in the run file's ## Failure paths table, → that acceptance item FAIL (P0)."
not_applicable: "§8.7 says `not applicable` → the run file carries `failure paths: not applicable — <reason>`; the id_check line then prints `ids match (0 rows)`."
class_not_applicable: "A class that this change does not touch gets one row `| n/a | <class> | not applicable: <reason> | | | | |` in place of its FP rows; such a class is neither missing nor run, and the id_check line lists it after `not applicable:`. NO-SECTION or EMPTY-SECTION from the id_check line is never a match: the acceptor reads §8.7 by eye, as the run lens does (FAILURE-PATH RUN id_check_other_lines). The Gate 3 consistency lens has read each `not applicable` reason against the change as built (FAILURE-PATH RUN class_not_applicable): the acceptor reads the Gate 3 consistency file for it and a P0 there is a P0 here."
n_a_reasons_missing: "When §8.7 holds a `not applicable` reason and the Gate 3 consistency file has no `n/a-reasons:` line for it (Gate 3 FAILURE-PATH RUN n_a_reasons_record), the acceptor treats that reason as not checked and reports it. An `n/a` row with an empty reason (an empty third cell, or nothing after `not applicable:`) is not accepted here either: the id_check line does not flag it, so the acceptor reports it (P0)."
# Feedback Collection Check (BLOCKING — Phase 3, 2026-06-10)
# Conditional: only applies when handoff §8.5 feedback_required: true.
# Upgraded from SOFT (Phase 2) to BLOCKING (Phase 3) after E2E dogfood validated the flow.
Gate4_Feedback_Check:
description: "Verify feedback collection for non-code artifacts"
trigger: "Handoff §8.5 feedback_required: true"
skip_if: "§8.5 absent, feedback_required: false, or N/A"
blocking: true
checks:
- "Feedback HTML was generated (path exists in completion report)"
- "If human filled out feedback: JSON was exported and processed by Alex"
- "If human did NOT fill out feedback: explicit human approval to skip (escape valve — human can always override)"
on_fail: |
If feedback_required was true but feedback was not collected AND human did NOT approve skip:
"❌ FEEDBACK CHECK FAIL: Handoff marked feedback_required: true but no feedback
was collected. Gate 4 BLOCKED. Either: (a) collect feedback, or (b) explicitly approve skip."
escape_valve: |
Human can always say "skip feedback for this handoff" — record the approval in
Gate 4 report as "Feedback skipped: human approved at [timestamp]" and proceed.
The blocking check prevents SILENT skipping, not intentional skipping.
# ⚠️ DECISION COMPLIANCE CHECK (Cognitive Firewall - Pillar 1 verification)
Decision_Compliance:
description: "Verify implementation follows the technical decisions made by human during design"
blocking: false # Warning only, not blocking
check_process:
step1: "Read handoff Decision Summary section"
step2: "For each recorded decision, verify implementation matches the chosen option"
step3: "Flag any deviations"
if_deviation:
action: "WARNING - explain why implementation deviated from agreed decision"
human_action: "Human decides: accept deviation or request fix"
output_format:
gate4_addition: |
#### Decision Compliance Check
| # | Decision from Handoff | Implementation Match | Status |
|---|----------------------|---------------------|--------|
| 1 | {decision title} | {does code match decision?} | ✅/❌ |
# Gate 4 检查项(Prerequisite 和 Gate3_Evidence_Check 通过后执行)
# ═══ Gate Checklist Items (inline — derived from canonical) ═══
# Canonical source: .tad/gates/gate-canonical-checklist.md
# Edit canonical FIRST, then sync here. Drift check: diff canonical vs this section.
Critical Check (4 items):
- [ ] Acceptance by real use — what the human will do, done once for real or in a browser; evidence under the gate4 dir, reported in `## For the human` as `real use: <evidence path> — <what it showed>`, and an unrun path adds `light acceptance: <reason>`; judged against ## Requirement + Result contract
- [ ] Gate 3 evidence complete — every contract §8 lens file, gate3-check.sh exit 0 on the run file (FAIL enumerates missing)
- [ ] Issues — every P0 resolved; a finding keeps its original severity and closes only when a reviewer of that lens (never the builder) recognizes it as fixed / pre-existing / dismissed with proof; reopening needs explicit new evidence; open P1, Assumptions, not-run items and human-only items (real device, payment, own account login, with reason) listed for the human
- [ ] Knowledge Assessment complete — distillation loop or "no new discovery"
# Fail-close: cannot Gate 4 PASS if the Gate 3 run file's `## AC runs` table is missing or a row is neither run nor recorded not-run; Blake summary is not Gate 4 evidence; a self-report that disagrees with the run reviewer's AC runs → that item FAIL and gate4_delta.
Trust_Curve_Judgment: |
Do not expand parallelism, add bots, or claim an unverified capability until that capability's evidence chain has actually run — the Gate 3 §9.1 rows re-run by the run reviewer and the Gate 4 real use are the chain. A green verdict on prose-only verification is validation theater, not trust. This is judgment applied at each Gate, not a checklist row and not an L1 principle.
Evidence: Record in NEXT.md or completion report + evidence files
Output Format:
### Gate 4 Result
#### Prerequisite
| Check | Status |
|-------|--------|
| Gate 3 Passed | ✅ Yes |
| Gate 3 Evidence | ✅ Exists (§9.1-driven result for code/mixed, or rubric-eval verdict: PASS) |
#### Real use
| What the human will do | What was done | Result | Evidence pointer |
|------------------------|---------------|--------|------------------|
| {action} | {run / browser} | ✅/❌ | {gate4 dir file} |
#### Gate 3 evidence
| Item | Status | Note |
|------|--------|------|
| Lens files (run, consistency, domain if listed) | ✅ Present | {files} |
| gate3-check.sh (AC runs, real paths, not-run list) | ✅ exit 0 | {output} |
#### For the human
| Item | Content |
|------|---------|
| verdict | {PASS / CONDITIONAL / FAIL} — {one sentence} |
| evidence (3-5 lines) | real use: <evidence path> — <what it showed>; light acceptance: <reason> (when a path did not run) |
| Needs you / Not run / Assumptions / Open P1 | {items with reasons} |
#### Knowledge Assessment (MANDATORY - must answer)
| Question | Answer | Evidence |
|----------|--------|----------|
| New discoveries? | ✅ Yes / ❌ No | — |
| If Yes: written to | .tad/project-knowledge/{category}.md | Entry title: "### {title} - {date}" |
| If No: reason | {why no new discovery} | — |
⚠️ Alex writes business/architecture discoveries. Blake writes implementation discoveries.
No overlap: Blake owns Gate 3 knowledge, Alex owns Gate 4 knowledge.
Tiebreaker: HOW code works (tool quirks, build issues, API gotchas) → Blake Gate 3.
WHY a design should change (architecture patterns, requirement gaps) → Alex Gate 4.
# ⚠️ KNOWLEDGE ASSESSMENT (BLOCKING - Part of Gate 4)
# 必须在 Gate 结果表格中显式回答,不可跳过
Knowledge_Assessment_Gate4:
blocking: true
description: "Gate 4 无法 PASS 除非 Knowledge Assessment 表格已填写"
mandatory_questions:
- question: "Blake Gate 3 journal 是否已验证?(evidence/journal/ 文件存在)"
must_answer: true
options:
- "✅ Yes - 已验证 journal 条目存在"
- "⚠️ Blake said Yes but journal missing - BLOCK"
- "N/A - Blake said No (no discovery)"
- question: "本次审查是否有新发现?"
must_answer: true
options:
- "✅ Yes - 有新发现"
- "❌ No - 常规审查,无特殊发现"
- question: "如果有,属于哪个类别?"
must_answer: "if previous is Yes"
options: "从 .tad/project-knowledge/ 目录读取"
- question: "一句话总结"
must_answer: true
note: "即使无新发现,也要写明原因"
evaluation_criteria:
should_record_if:
- "发现了重复出现的代码质量问题"
- "发现了新的安全/性能风险模式"
- "做出了影响项目的架构决策"
- "审查中发现的最佳实践或反模式"
- "subagent 提出了重要的改进建议"
can_skip_if:
- "所有 subagent 结果都是 PASS,无特殊发现"
- "已有完全相同的记录"
if_new_discovery:
step1: "读取 .tad/project-knowledge/ 目录,列出所有可用类别"
step2: "确定分类(或选择创建新类别)"
step3: "写入对应的 .tad/project-knowledge/{category}.md"
step4: "使用标准格式"
step5_verify: "在 Gate 4 表格的 Evidence 列填写:文件路径 + 条目标题。无此信息 = Gate FAIL"
acceptance_report_rule: |
Gate 4 验收报告的 Knowledge Assessment 节只写引用:
"New discovery recorded: .tad/project-knowledge/{category}.md → '### {title}'"
完整内容在 project-knowledge 文件中,不在验收报告中重复。
violation: "Gate 4 结果表格中没有 Knowledge Assessment 部分 = VIOLATION = Gate 无效"
# ⚠️ POST-PASS ACTIONS
Post_Pass_Actions:
trigger: "Gate 4 所有检查项 PASS(包括 Knowledge Assessment)"
update_next_md:
action: "更新 NEXT.md 反映交付完成状态"
steps:
- "标记已交付任务为 [x]"
- "添加用户反馈收集任务(如适用)"
- "清理已完成的相关任务"
format: "English only"
remind_accept:
action: "提示 Alex 执行 *accept 完成归档流程"
message: |
Gate 4 通过!任务已准备交付。
⚠️ 提醒:Alex 需要执行 *accept 命令完成:
- 评估配对测试(UI/用户流变更时建议)
- 归档 handoff 和 completion report
- 更新 PROJECT_CONTEXT.md
- 确认 NEXT.md 状态
```
## NO-PROGRESS CIRCUIT BREAKER — Shared Definitions (Gate 2 / Gate 3 / Gate 4)
> One definition source for all three gates. The per-gate NO-PROGRESS COUNTER blocks above
> carry the entry behavior; this block carries the carrier, the derivation, the breaker
> report template and the grant conditions. Origin: the lite channel's repair-round cap
> (blake-lite `## Lite Progress`) proved the immunity comes from boundary-append — write the
> row at the stage boundary, before the next stage runs — not from the number 3. The full
> channel previously counted only error-shaped rounds (consecutive_same_error), which any
> stream of non-repeating failures defeats; this breaker counts rounds, not errors.
```yaml
gate_rounds_carrier:
location: "The handoff file itself, a `## Gate Rounds` section created at handoff creation (handoff-creation-protocol step1). The handoff is the one artifact every gate reads and writes, and .tad/active/handoffs/ lives outside git and outside any worktree — so the count survives compaction, interruption and session loss with no separate state file to lose."
skeleton: |
The section is delimited by <!-- GATE-ROUNDS-BEGIN --> / <!-- GATE-ROUNDS-END --> and
contains, in order: the schema line `GATE-ROUNDS-SCHEMA: v1`, the three derivation
lines below (verbatim), then the table:
| 时间 | Gate | verdict | 类别 | 记录者 |
|---|---|---|---|---|
Boundary enumeration: design (Alex, at creation) / review-batch (Alex, after each
expert review batch) / gate2 (Alex) / implement (Blake) / ac (Blake) / layer2 (Blake,
per Layer 2 round) / gate3 (whoever closes the round) / gate4 (Alex acceptor side).
Counter mapping: design, review-batch and gate2 rows count toward Gate 2; implement,
ac, layer2 and gate3 rows count toward Gate 3; gate4 rows count toward Gate 4.
A row is appended BEFORE its stage runs with verdict=RUNNING; when the stage concludes
its verdict is set in place. RUNNING→terminal is the ONLY in-place edit ever allowed in
this table; every other change is append-only. `类别` is a MECHANICAL category only
(e.g. test-failure) — never a root-cause judgement; root-cause judgement belongs to the
breaker report, written after the stop.
derivation: |
GATE-ROUNDS-DERIVATION: v1
G{n} = rows for Gate n AFTER the most recent HUMAN-GRANTED-CONTINUE row (or from the
table start when there is none) whose verdict is NOT IN {PASS, RUNNING,
HUMAN-GRANTED-CONTINUE}. A GRANT row therefore zeroes every G{n}; verdicts before it
stay in the table and still count toward TOTAL_ROUNDS.
TOTAL_ROUNDS = ALL rows whose verdict is NOT IN {PASS, RUNNING,
HUMAN-GRANTED-CONTINUE} — the lifetime sum of the three gates' non-PASS rounds. It
NEVER decreases: a PASS row is recorded (it proves a stage ran) but is not a repair
round, and interleaved PASSes leave every count exactly where it was. (Deviation from
the archived 2026-08-04 design, flagged for review: its TOTAL also counted PASS rows,
which would fire the backstop on a flawless multi-stage handoff; its G{n} formula is
kept verbatim.)
GRANT = rows whose verdict IS HUMAN-GRANTED-CONTINUE.
Counts are DERIVED from the rows on every read. There is no stored counter anywhere;
a stored number that disagrees with the derivation loses to the derivation.
thresholds: "Breaker fires when any G{n} >= 3 OR TOTAL_ROUNDS >= 6, checked on entering a gate and whenever a boundary row's verdict is set. PASS never resets any count."
conductor_path: "On the conductor path (Cora runs the gates by dispatching reviewers) nobody appends rows to this table and Cora edits no handoff: the round-numbered review files are the record. /bin/bash .tad/hooks/lib/cora-check.sh rounds <the Epic> <phase N> (repo root) derives G2, G3, G4 and TOTAL_ROUNDS from them by the derivation above (a round of a gate counts when any of its files has a verdict that is not PASS, so a CONDITIONAL round counts; no GRANT row exists on this path) and prints those counts only. Cora is its only reader, each time conductor-protocol step_Y7 item 1 runs (so again after a Gate 4 rework), before the Gate 4 dispatch, into her journal (conductor-protocol rounds_record); reviewers and the Gate 4 acceptor neither run nor read it, and the derived count stops nothing on this path (review contract §7: a round count alone never stops a Cora run). The gate4 row on this path is the gate report file itself: the Gate 4 acceptor appends no row and skips the table (rule 5). In direct mode the gate4 row is appended by the Alex who dispatches the acceptor (acceptance-protocol step2b, step3b), never by the acceptor. The handoff's table keeps the design row its designer appends at creation."
```
### NO-PROGRESS CIRCUIT BREAKER report (the one template, shared by Gate 2/3/4)
```
【NO-PROGRESS CIRCUIT BREAKER】 Gate {2|3|4} 已达 3/3 轮(或全程 {TOTAL} 轮),严格计数熔断。
已完成轮次:
R1: {verdict} — {三行内:问题 id + 类别 + 一行事实}
R2: {verdict} — {...}
R3: {verdict} — {...}
未解决项(用问题 id 指称,不重新论证对错):
- {...}
我的诊断(机械类别级,不是根因定论):
三轮类别分布:{如 test-failure×2, content-conflict×1}
是否同一根因:{是/否/无法判定} — {一句依据}
已尝试的修复路线(每条一行,不评价):
- {...}
我的推荐(人决定):
{A/B/C 三个动作不同、后果不同、且都可执行的选项 —— 给选项,不给结论}
⛔ 已停止。等待人裁定。
```
Rules for the report: the three options must differ in action and consequence and each must
be executable; a recommendation phrased as a conclusion ("建议判定不通过") is forbidden —
option framing only ("通过并归档本 handoff" is a legal option). When this is the second or
later grant on the same handoff (GRANT >= 1 already), the first line gains:
`⚠️ 这是本 handoff 第 {GRANT+1} 次续行授权后的再次熔断(人此前已授权 {GRANT} 次)`.
```yaml
grant_conditions: "A HUMAN-GRANTED-CONTINUE row is valid only when ALL five hold:"
1_human_turn: "A real human turn in the transcript explicitly approves continuing THIS handoff (a same-reply self-approval is not a human turn)."
2_verbatim: "The row's 类别 column carries the human's verbatim words (a quote, not a paraphrase)."
3_hook_crosscheck: "Read-side assertion, checked when the row is WRITTEN: in harnesses with the askuser-capture hook, .tad/evidence/decisions/{YYYY-MM}.jsonl must contain a kind=askuser_decision line with decision=approve whose ts falls inside the breaker-report→grant window; the row cites that ts as its cross-key. A grant row with no such line is invalid — breaker state unchanged, and the invalid row itself is reported. (Agents never WRITE that directory: mandatory.no_decision_log_write.)"
4_transcript_only_branch: "In a harness with no hook, mark the row `transcript-only (no hook)` and DO NOT hard-stop on it: continue, but flag UNVERIFIED-BY-EXECUTION wherever the grant is relied on."
5_cap: "At most 2 grant rows per handoff. Beyond that, only a human editing the handoff directly continues the work."
effect: "A valid grant row zeroes every G{n} positionally (derivation above); TOTAL_ROUNDS never decreases. A grant row may explicitly re-attribute a batch of unresolved findings to another Gate (mandatory.no_gate_reattribution's only exception)."
```
## Gate 4 — Rubric-Based Handoffs (universal, no separate branch)
> NOT a separate routing branch — the universal Gate 4 above is HYBRID and handles all
> task_types. This section only documents the rubric-lane SPECIFICS that the hybrid Gate 4
> applies when the handoff's §9.1 ACs are rubric-based (report/audio/video artifacts).
```yaml
# ⚠️ RUBRIC-LANE PREREQUISITE (BLOCKING) — when §9.1 ACs are rubric-based
Rubric_Gate4_Prerequisite:
check: "Gate 3 rubric verdict 是否 PASS?"
evidence: ".tad/evidence/reviews/*-rubric-eval-*.md exists with the exact machine-readable line `verdict: PASS`"
verify_command: "grep -E '^verdict: PASS' .tad/evidence/reviews/*-rubric-eval-*.md"
verify_note: "Greps the EXACT lowercase-key/uppercase-value token the judge writes (Rubric Evaluation Protocol Required_Judge.output_format). The bold/emoji human form `**Verdict**: ✅ PASS` is NOT matched by this anchor — the machine-readable line is required."
conductor_path_evidence: "On the conductor path the judge's file is .tad/evidence/yolo/<epic-slug>/phase<N>-rubric-verdict.md (the latest -r<k>; conductor-protocol per_phase_files, step_Y6 1b): a `verdict: PASS` line there satisfies this prerequisite as the reviews/*-rubric-eval-*.md file does; either path satisfies it."
conductor_path_judge_unusable: "On the conductor path, when the judge was unusable twice and the Gate 3 run file marks the rubric AC not-run for that reason, the Gate 4 prerequisite does not block; the acceptor lists the rubric AC as not judged in its section for the human, and the verdict cannot be a plain PASS on that AC."
shape_agnostic_note: "The `^verdict: PASS` token is shape-agnostic — weighted/categorical/checklist all emit it. Gate 4 needs no per-shape branch."
if_missing:
action: "BLOCK Gate 4"
message: |
⚠️ Gate 4 无法执行 - 一个 rubric-based §9.1 AC 的 Gate 3 未通过
必须先有 rubric-eval 证据且含 machine-readable 行 `verdict: PASS`。
result: "BLOCKED - 等待 rubric AC 的 Gate 3 PASS"
# Evidence File Naming (rubric-eval) — rubric-eval is a DISTINCT type (own glob *-rubric-eval-*)
Evidence_Naming_RubricEval:
pattern: ".tad/evidence/reviews/{YYYY-MM-DD}-{type}-{brief-description}.md"
types: [rubric-eval] # DISTINCT evidence type — MUST NOT be aliased to testing-review/code-review
example: "2026-05-31-rubric-eval-soy-sauce-report.md"
# Code subagents N/A for rubric artifacts (handled by Structural_Subagent_Conditionality above)
Rubric_No_Code_Subagents:
rule: "When §9.1 ACs are rubric-based (no code surface) the security/performance/code subagents are N/A; the rubric-eval verdict: PASS is the structural prerequisite. ux-expert-reviewer stays conditional ('if UI involved')."
# Business acceptance + Knowledge Assessment are the UNIVERSAL Gate 4 blocks above — not re-declared here.
# (The hybrid Gate 4 Knowledge_Assessment_Gate4 BLOCKING/VIOLATION rule applies to ALL task_types,
# including rubric-based ones — no deliverable-only duplication.)
```
## Interactive Gate Execution
For each gate, use 0-9 options format:
```
Gate [N]: [Name] Execution
Status Check:
✅ [Criterion]: Pass
❌ [Criterion]: Fail - [Issue]
⚠️ [Criterion]: Warning - [Concern]
Please select action (0-8) or 9 to pass gate:
0. Review checklist again
1. Fix failing items
2. Collect more evidence
3. Run additional tests
4. Use sub-agent for help
5. Document issues found
6. Request clarification
7. Partial pass with notes
8. Fail gate (restart phase)
9. Pass gate (all criteria met)
Select 0-9:
```
## Violation Handling
```
⚠️ GATE VIOLATION DETECTED ⚠️
Type: Attempting to skip Gate [N]
Required: Must execute gate before proceeding
Action: BLOCKED until gate executed
To continue:
1. Execute gate properly
2. Address any failures
3. Collect evidence
4. Get pass result
```
# Universal Violation Recovery Protocol (applies to all gates)
Violation_Recovery:
step1: "立即停止当前操作"
step2: "调用正确的 agent/command(如应走 /blake 的用 /blake)"
step3: "按规范流程从头重新执行"
principle: "违反任何规则 → 停止 → 纠正 → 重做"
[[LLM: This command executes the appropriate quality gate based on current agent and project phase. Gates are mandatory checkpoints that ensure quality.]]