diff --git a/org/VAL_RUNBOOK.md b/org/VAL_RUNBOOK.md index 859a2ed..837ea13 100644 --- a/org/VAL_RUNBOOK.md +++ b/org/VAL_RUNBOOK.md @@ -28,6 +28,23 @@ - 成本:通过 / 需降本(建议) - 结论:放行 / 补充后放行 / 驳回 +### C.1 Sentinel 审计输入强制规则(v1) + +派发 Sentinel 前必须校验: +- 必带 `task_id` +- 必带 `audit_scope`(safety/logic/cost/full) +- 必带 `audit_payload`(inline_text / file_paths / artifact_refs 三选一或组合) +- 必带 `source_type`(inline/workspace_file/mixed) +- 必带 `requested_output_schema` + +硬拦截条件: +- 缺少 `audit_payload` -> 不派发 +- 引用文件不可读 -> 不派发 +- 正文不足 500 字 -> 退回补料 + +错误码:`SENTINEL_INPUT_CONTRACT_MISSING` +合同文件:`org/ops/sentinel_audit_contract.v1.json` + ## D. 失败处理模板(刑部) - 失败阶段: diff --git a/org/ops/sentinel_audit_contract.v1.json b/org/ops/sentinel_audit_contract.v1.json new file mode 100644 index 0000000..5f70a11 --- /dev/null +++ b/org/ops/sentinel_audit_contract.v1.json @@ -0,0 +1,44 @@ +{ + "version": "sentinel-audit-contract-v1", + "purpose": "Force complete audit input payload for Sentinel to avoid blind-audit failures.", + "required_fields": [ + "task_id", + "audit_scope", + "audit_payload", + "source_type", + "requested_output_schema" + ], + "field_rules": { + "task_id": { + "type": "string", + "min_length": 8 + }, + "audit_scope": { + "type": "string", + "allowed": ["safety", "logic", "cost", "full"] + }, + "audit_payload": { + "type": "object", + "required_any_of": ["inline_text", "file_paths", "artifact_refs"], + "min_content_chars": 500 + }, + "source_type": { + "type": "string", + "allowed": ["inline", "workspace_file", "mixed"] + }, + "requested_output_schema": { + "type": "array", + "must_include": ["decision", "scores", "issues", "must_fix", "release_conditions"] + } + }, + "gates": { + "pre_audit_validation": true, + "reject_on_missing_payload": true, + "reject_on_unreadable_file_refs": true, + "fallback_behavior": "return_input_contract_error" + }, + "input_contract_error": { + "code": "SENTINEL_INPUT_CONTRACT_MISSING", + "message": "Audit payload incomplete. Provide inline_text or readable file_paths/artifact_refs before running Sentinel." + } +} diff --git a/org/ops/sentinel_audit_contract.v1.md b/org/ops/sentinel_audit_contract.v1.md new file mode 100644 index 0000000..ea2f0f6 --- /dev/null +++ b/org/ops/sentinel_audit_contract.v1.md @@ -0,0 +1,27 @@ +# Sentinel 审计输入强制规则(v1) + +目的:避免 Sentinel 因缺少方案正文而“空跑审计”。 + +## 强制字段 +每次调用 Sentinel 前,必须包含: +- `task_id` +- `audit_scope`(safety/logic/cost/full) +- `audit_payload`(三选一或组合) + - `inline_text`(内嵌正文) + - `file_paths`(可读文件路径) + - `artifact_refs`(可定位产物引用) +- `source_type`(inline/workspace_file/mixed) +- `requested_output_schema` + +## 拦截规则 +- 缺少 `audit_payload`:直接拒绝派发 Sentinel +- `file_paths` 不可读:直接拒绝派发 Sentinel +- 正文长度不足(<500字):返回输入不完整错误 + +## 返回错误码 +`SENTINEL_INPUT_CONTRACT_MISSING` + +## 最佳实践 +- 优先使用 `mixed`:正文摘要 + 文件路径双保险 +- 高风险任务必须提供可复核文件路径 +- 审计后将结论与问题清单落盘到 Atlas 的 `decision_log/` 与 `failure_patterns/` diff --git a/org/ops/standard_parallel_v0.2.unified.json b/org/ops/standard_parallel_v0.2.unified.json index 1db2ec9..b7b661f 100644 --- a/org/ops/standard_parallel_v0.2.unified.json +++ b/org/ops/standard_parallel_v0.2.unified.json @@ -229,5 +229,17 @@ "enabled": true, "note": "User explicit instruction overrides role mapping immediately." } + }, + "contracts": { + "sentinel_audit_input": { + "enabled": true, + "version": "v1", + "contract_file": "org/ops/sentinel_audit_contract.v1.json", + "enforcement": "hard_gate", + "reject_on_missing_payload": true, + "reject_on_unreadable_refs": true, + "min_payload_chars": 500, + "error_code": "SENTINEL_INPUT_CONTRACT_MISSING" + } } } \ No newline at end of file