---
name: 验证契约规则
scope:
  - '*'
products:
  - '*'
id: ka-hard-rule-验证契约规则
asset_kind: hard_rule
lifecycle_status: active
authority: canonical
owner_mechanism_id: mc-verifier
routes:
  - 验证契约规则
primary_triggers:
  - 验证契约规则
secondary_triggers: []
negative_triggers: []
priority: P0
specificity: 5
consumes:
  - mc-task-context-lifecycle
hard_blocks:
  - 验证未通过
  - 证据缺失
fallback: manual_required
required_evidence:
  - verification_evidence
  - test_results
version: 1.0.0
last_reviewed: '2026-05-22'
migration_note: 知识资产标准化迁移
type: hard_rule
when: 验证契约规则
status: active
---

# 验证契约规则

## 核心原则

验证策略由 execution_shape 决定，不同执行形态使用不同验证强度。

## 验证策略

1. **code_execution**: 完整 build + test
2. **single_artifact/source_extraction**: 轻量检查
3. **direct_answer**: 无需验证

## 规则

1. 验证结果必须保存到 task_context 才能标记 done/learning
2. evidence level 必须达到 E1 以上
3. 验证命令必须覆盖所有 changed_files
4. 验证失败时进入 repair_reverify 循环

## 验收标准

- [ ] generateVerifyCommands 根据 execution_shape 选择策略
- [ ] VerifyResult 包含 evidence 和 coverage
- [ ] 验证结果保存到 task_context
- [ ] repair_reverify 循环有 max_attempts 限制
