{
  "schema_version": "ai_agent_telegram_action_required_digest_policy_v1",
  "generated_at": "2026-06-11T23:58:00+08:00",
  "program_status": {
    "overall_completion_percent": 68,
    "current_priority": "P2",
    "current_task_id": "P2-402D",
    "next_task_id": "P2-402E",
    "read_only_mode": true,
    "runtime_authority": "policy_only_no_telegram_send_or_route_change",
    "status_note": "P2-402D 建立 Telegram action-required digest policy；本波只定義 critical / action-required / failure-only digest 規則，不送 Telegram、不寫 Gateway queue、不改 Alertmanager route、不改 receiver、不觸發 workflow。"
  },
  "source_refs": [
    "docs/evaluations/ai_agent_proactive_operations_contract_2026-06-11.json",
    "docs/evaluations/ai_agent_version_freshness_snapshot_2026-06-11.json",
    "docs/evaluations/ai_agent_tool_adoption_approval_package_2026-06-11.json",
    "docs/evaluations/service_health_failure_notification_policy_2026-06-05.json",
    "docs/evaluations/backup_notification_policy_2026-06-04.json",
    "docs/LOGBOOK.md"
  ],
  "trigger_categories": [
    {
      "category_id": "success_noise",
      "owner_agent": "Hermes",
      "policy_intent": "成功、完成、已驗證、只讀快照更新不得即時送 Telegram；只能留在 committed evidence 或日摘要。",
      "blocked_now": [
        "成功巡檢即時 Telegram",
        "成功掃描即時 Telegram",
        "只讀 snapshot 完成即時 Telegram"
      ]
    },
    {
      "category_id": "version_watch_failure",
      "owner_agent": "Hermes",
      "policy_intent": "版本來源連續失敗、資料過期、watch source 失聯時產生 action-required digest 草案。",
      "blocked_now": [
        "直接寫 Telegram Gateway queue",
        "直接送 Bot",
        "觸發外部 registry lookup"
      ]
    },
    {
      "category_id": "critical_security_or_eol",
      "owner_agent": "OpenClaw",
      "policy_intent": "critical CVE、EOL approaching、production incompatibility risk 才可進 failure escalation digest 草案。",
      "blocked_now": [
        "下載 vulnerability DB",
        "掃描 live image",
        "升級套件或 image"
      ]
    },
    {
      "category_id": "tool_adoption_approval_required",
      "owner_agent": "OpenClaw",
      "policy_intent": "Renovate / OSV-Scanner / Trivy / Syft / Grype 採用需要人類批准時，僅產 action-required digest 草案。",
      "blocked_now": [
        "安裝工具",
        "改 CI workflow",
        "建立 Gitea PR"
      ]
    },
    {
      "category_id": "telegram_delivery_silence",
      "owner_agent": "OpenClaw",
      "policy_intent": "Telegram delivery silence、fallback gap、callback failure 屬於告警必到風險，進 failure escalation digest 草案。",
      "blocked_now": [
        "直接發測試訊息",
        "改 receiver",
        "改 Alertmanager route"
      ]
    }
  ],
  "digest_channels": [
    {
      "channel_id": "telegram_ops_digest_draft",
      "purpose": "Telegram action-required / failure-only digest 草案；P2-402D 只定義政策，不送出。",
      "success_immediate_allowed": false,
      "direct_send_allowed": false,
      "queue_write_allowed": false,
      "requires_telegram_gateway_e2e": true
    },
    {
      "channel_id": "awooop_action_queue_draft",
      "purpose": "AwoooP action-required queue 草案；本波不寫 event、不建立 operator task。",
      "success_immediate_allowed": false,
      "direct_send_allowed": false,
      "queue_write_allowed": false,
      "requires_telegram_gateway_e2e": false
    },
    {
      "channel_id": "daily_km_digest_only",
      "purpose": "成功與資訊性訊號只能進每日 KM / LOGBOOK 摘要草案。",
      "success_immediate_allowed": false,
      "direct_send_allowed": false,
      "queue_write_allowed": false,
      "requires_telegram_gateway_e2e": false
    }
  ],
  "digest_rules": [
    {
      "rule_id": "repo_only_freshness_snapshot_success",
      "category_id": "success_noise",
      "signal_state": "success",
      "severity": "info",
      "decision": "suppress_success_noise",
      "owner_agent": "Hermes",
      "required_evidence": [
        "committed snapshot ref",
        "rollup counters"
      ],
      "channels": [
        "daily_km_digest_only"
      ],
      "requires_openclaw_review": false,
      "telegram_direct_send_allowed": false,
      "next_action": "只寫 LOGBOOK / KM 摘要草案，不送 Telegram。"
    },
    {
      "rule_id": "tool_adoption_package_completed_success",
      "category_id": "success_noise",
      "signal_state": "verified",
      "severity": "info",
      "decision": "suppress_success_noise",
      "owner_agent": "Hermes",
      "required_evidence": [
        "schema ref",
        "API verification ref"
      ],
      "channels": [
        "daily_km_digest_only"
      ],
      "requires_openclaw_review": false,
      "telegram_direct_send_allowed": false,
      "next_action": "保留 committed evidence，不發成功洗版。"
    },
    {
      "rule_id": "version_watch_source_failed",
      "category_id": "version_watch_failure",
      "signal_state": "failed",
      "severity": "warning",
      "decision": "draft_failure_escalation_digest",
      "owner_agent": "Hermes",
      "required_evidence": [
        "source_id",
        "last_success_at",
        "failure_count",
        "fallback_source"
      ],
      "channels": [
        "telegram_ops_digest_draft",
        "awooop_action_queue_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "OpenClaw 確認是否升級為 action-required Telegram digest。"
    },
    {
      "rule_id": "critical_cve_or_eol_requires_owner",
      "category_id": "critical_security_or_eol",
      "signal_state": "critical",
      "severity": "critical",
      "decision": "draft_failure_escalation_digest",
      "owner_agent": "OpenClaw",
      "required_evidence": [
        "official advisory ref",
        "affected component",
        "blast radius",
        "rollback plan"
      ],
      "channels": [
        "telegram_ops_digest_draft",
        "awooop_action_queue_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "產生 owner packet 與批准包；未批准不得升級。"
    },
    {
      "rule_id": "telegram_delivery_silence_detected",
      "category_id": "telegram_delivery_silence",
      "signal_state": "failed",
      "severity": "critical",
      "decision": "draft_failure_escalation_digest",
      "owner_agent": "OpenClaw",
      "required_evidence": [
        "delivery route",
        "last_successful_send",
        "fallback path",
        "failed callback evidence"
      ],
      "channels": [
        "telegram_ops_digest_draft",
        "awooop_action_queue_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "保留告警必到 fallback 檢查；本波不直接送測試訊息。"
    },
    {
      "rule_id": "tool_install_or_ci_change_needs_approval",
      "category_id": "tool_adoption_approval_required",
      "signal_state": "action_required",
      "severity": "warning",
      "decision": "draft_action_required_digest",
      "owner_agent": "OpenClaw",
      "required_evidence": [
        "tool_id",
        "approval_requirements",
        "secret_storage_plan",
        "rollback_plan"
      ],
      "channels": [
        "telegram_ops_digest_draft",
        "awooop_action_queue_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "要求 operator approval id；未批准不得安裝工具或改 CI。"
    },
    {
      "rule_id": "scanner_disagreement_needs_review",
      "category_id": "tool_adoption_approval_required",
      "signal_state": "action_required",
      "severity": "warning",
      "decision": "draft_action_required_digest",
      "owner_agent": "NemoTron",
      "required_evidence": [
        "scanner_a_ref",
        "scanner_b_ref",
        "disagreement_summary",
        "affected package or image"
      ],
      "channels": [
        "telegram_ops_digest_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "NemoTron 產生離線 replay / assumption note，OpenClaw 仲裁是否 action-required。"
    },
    {
      "rule_id": "no_executable_repair_candidate_after_approval",
      "category_id": "telegram_delivery_silence",
      "signal_state": "blocked",
      "severity": "warning",
      "decision": "draft_action_required_digest",
      "owner_agent": "OpenClaw",
      "required_evidence": [
        "incident_id",
        "approval_id",
        "latest_action",
        "repair_candidate_gap"
      ],
      "channels": [
        "telegram_ops_digest_draft",
        "awooop_action_queue_draft"
      ],
      "requires_openclaw_review": true,
      "telegram_direct_send_allowed": false,
      "next_action": "標記 no-action / non-executable，避免誤導 operator 以為已執行修復。"
    }
  ],
  "message_template_contract": {
    "required_fields": [
      "stage",
      "severity",
      "target_id",
      "evidence_ref",
      "blocked_reason",
      "next_action",
      "owner_agent",
      "approval_gate"
    ],
    "forbidden_fields": [
      "secret_value",
      "token",
      "authorization_header",
      "work_window_transcript",
      "codex_user_message",
      "prompt_text",
      "chain_of_thought",
      "session_id",
      "browser_context"
    ],
    "success_message_policy": "成功、完成、已驗證、只讀快照更新不得即時送 Telegram / AwoooP；只能進每日摘要或 LOGBOOK。",
    "action_required_message_policy": "只允許輸出 evidence ref、blocked reason、next action、owner agent、approval gate；本波不送出。",
    "failure_message_policy": "只有 failed / blocked / critical 且具備 evidence ref 與 OpenClaw review gate 時，才可成為 failure escalation digest 草案。"
  },
  "rate_limit_policy": {
    "success_policy": "成功巡檢、成功掃描、成功快照不得即時 Telegram 洗版。",
    "digest_window_minutes": 30,
    "dedupe_key_fields": [
      "category_id",
      "target_id",
      "evidence_ref",
      "owner_agent"
    ],
    "max_digest_items": 10,
    "fallback_policy": "若 Telegram Gateway 或 callback 失敗，保留 AwoooP / LOGBOOK evidence refs 與 fallback gap，不直接重送 Bot。"
  },
  "display_redaction_contract": {
    "conversation_transcript_display_allowed": false,
    "redaction_required": true,
    "allowed_frontend_fields": [
      "政策規則摘要",
      "已提交證據參照",
      "blocked reason",
      "next action",
      "owner agent",
      "approval gate"
    ],
    "forbidden_frontend_content": [
      "未核准內部內容",
      "未脫敏操作紀錄",
      "未核准決策細節",
      "工作階段脈絡",
      "機密 / 權杖 / 授權標頭"
    ]
  },
  "agent_roles": [
    {
      "agent_id": "hermes",
      "digest_responsibility": "彙整 repo-only freshness、source failure、工具採用 evidence refs 與每日摘要草案。",
      "blocked_now": [
        "直接發 Telegram",
        "寫 Telegram Gateway queue",
        "觸發 workflow"
      ]
    },
    {
      "agent_id": "openclaw",
      "digest_responsibility": "仲裁 critical / action-required / failure-only digest 草案，確認 blast radius、rollback 與 approval gate。",
      "blocked_now": [
        "自行批准 Telegram 發送",
        "改 route / receiver",
        "把成功訊息升級為告警"
      ]
    },
    {
      "agent_id": "nemotron",
      "digest_responsibility": "針對 scanner disagreement、AI Agent / model / prompt / tool-call risk 產生離線 replay note。",
      "blocked_now": [
        "呼叫付費模型",
        "新增 SDK",
        "開 shadow / canary"
      ]
    }
  ],
  "operation_boundaries": {
    "read_only_policy_allowed": true,
    "telegram_direct_send_allowed": false,
    "telegram_test_message_allowed": false,
    "telegram_gateway_queue_write_allowed": false,
    "alertmanager_route_change_allowed": false,
    "telegram_receiver_change_allowed": false,
    "awooop_event_write_allowed": false,
    "workflow_trigger_allowed": false,
    "external_scan_allowed": false,
    "runtime_execution_allowed": false,
    "secret_plaintext_allowed": false,
    "conversation_transcript_allowed": false
  },
  "approval_boundaries": {
    "telegram_digest_send_approved": false,
    "telegram_gateway_queue_write_approved": false,
    "telegram_route_change_approved": false,
    "alertmanager_receiver_change_approved": false,
    "awooop_event_write_approved": false,
    "workflow_trigger_approved": false,
    "runtime_execution_approved": false,
    "secret_plaintext_approved": false
  },
  "rollups": {
    "rule_count": 8,
    "channel_count": 3,
    "trigger_category_count": 5,
    "by_decision": {
      "suppress_success_noise": 2,
      "draft_failure_escalation_digest": 3,
      "draft_action_required_digest": 3
    },
    "action_required_rule_ids": [
      "tool_install_or_ci_change_needs_approval",
      "scanner_disagreement_needs_review",
      "no_executable_repair_candidate_after_approval"
    ],
    "failure_escalation_rule_ids": [
      "version_watch_source_failed",
      "critical_cve_or_eol_requires_owner",
      "telegram_delivery_silence_detected"
    ],
    "suppressed_success_rule_ids": [
      "repo_only_freshness_snapshot_success",
      "tool_adoption_package_completed_success"
    ],
    "telegram_direct_send_allowed_count": 0,
    "telegram_gateway_queue_write_allowed_count": 0,
    "route_change_allowed_count": 0,
    "conversation_transcript_allowed_count": 0,
    "next_approval_task_ids": [
      "P2-402E",
      "P2-402F",
      "P2-402G"
    ]
  }
}
