{
  "schema_version": "ai_agent_learning_writeback_approval_package_v1",
  "generated_at": "2026-06-11T23:59:30+08:00",
  "program_status": {
    "overall_completion_percent": 72,
    "current_priority": "P2",
    "current_task_id": "P2-403D",
    "next_task_id": "P2-403E",
    "read_only_mode": true,
    "runtime_authority": "approval_package_only_no_learning_writeback",
    "status_note": "P2-403D 已把 KM、PlayBook trust、timeline learning 與 replay score 的回寫批准包固定為只讀契約；尚未寫 KM、未更新 PlayBook trust、未寫 timeline learning、未發 Telegram、未啟動 runtime worker。"
  },
  "source_refs": [
    "docs/evaluations/ai_agent_redis_dry_run_gate_2026-06-11.json",
    "docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md",
    "docs/ai/AI_AGENT_INTERACTION_LEARNING_PROOF_2026-06-11.md"
  ],
  "learning_truth": {
    "km_write_allowed": false,
    "playbook_trust_write_allowed": false,
    "timeline_learning_write_allowed": false,
    "agent_replay_score_write_allowed": false,
    "telegram_send_allowed": false,
    "runtime_worker_allowed": false,
    "live_learning_write_count": 0,
    "live_playbook_trust_update_count": 0,
    "live_km_update_count": 0,
    "truth_note": "目前只允許產生 owner review 前的學習回寫批准包；所有 production writeback 與通知仍為 0 / false。"
  },
  "writeback_package": {
    "required_fields": [
      "learning_event_id",
      "incident_id",
      "source_stage",
      "learning_type",
      "target_surface",
      "proposed_delta_summary",
      "redacted_evidence_ref",
      "confidence_score",
      "risk_level",
      "owner_review_required",
      "rollback_plan_ref",
      "created_at"
    ],
    "forbidden_fields": [
      "secret_value",
      "credential_value",
      "raw_prompt",
      "conversation_transcript",
      "private_reasoning",
      "chain_of_thought",
      "raw_tool_output"
    ],
    "owner_review_required": true,
    "rollback_required": true,
    "operator_meaning": "每個學習回寫候選都必須說清楚來源事件、要寫到哪裡、要改什麼、信心分數、風險、證據與 rollback；owner review 前不得寫入 canonical KM 或 PlayBook trust。"
  },
  "review_gates": [
    {
      "gate_id": "km_owner_review_gate",
      "display_name": "KM owner review gate",
      "owner_agent": "hermes",
      "status": "approval_required",
      "required_evidence": "stale KM ref、incident ref、proposed delta、owner reviewer、rollback note。",
      "blocked_write_action": "knowledge_entries_write"
    },
    {
      "gate_id": "playbook_trust_gate",
      "display_name": "PlayBook trust gate",
      "owner_agent": "openclaw",
      "status": "approval_required",
      "required_evidence": "repair result、verifier result、blast radius、trust delta reason。",
      "blocked_write_action": "playbook_trust_update"
    },
    {
      "gate_id": "replay_score_gate",
      "display_name": "Replay score gate",
      "owner_agent": "nemotron",
      "status": "approval_required",
      "required_evidence": "sanitized replay fixture、idempotency key、score delta、無寫入 proof。",
      "blocked_write_action": "agent_replay_score_write"
    },
    {
      "gate_id": "timeline_learning_gate",
      "display_name": "Timeline learning gate",
      "owner_agent": "openclaw",
      "status": "contract_ready",
      "required_evidence": "incident timeline ref、stage outcome、blocked reason、next action。",
      "blocked_write_action": "timeline_learning_event_write"
    }
  ],
  "learning_lanes": [
    {
      "lane_id": "incident_to_km_draft",
      "display_name": "Incident → KM 草稿",
      "target_surface": "knowledge_base",
      "status": "approval_required",
      "owner_agent": "hermes",
      "review_owner": "km_owner",
      "required_review": "owner 必須確認引用來源、過期條目、改寫摘要與 rollback note。"
    },
    {
      "lane_id": "repair_to_playbook_trust",
      "display_name": "Repair → PlayBook trust",
      "target_surface": "playbook_trust_history",
      "status": "approval_required",
      "owner_agent": "openclaw",
      "review_owner": "sre_owner",
      "required_review": "owner 必須確認修復是否真的執行、verifier 是否通過、信任分數是否可調整。"
    },
    {
      "lane_id": "replay_to_agent_score",
      "display_name": "Replay → Agent score",
      "target_surface": "agent_replay_results",
      "status": "blocked_by_runtime_gate",
      "owner_agent": "nemotron",
      "review_owner": "ai_governance_owner",
      "required_review": "owner 必須確認 replay fixture 已脫敏、沒有 production route 影響、沒有付費 API 未授權。"
    }
  ],
  "rollback_contract": {
    "rollback_required": true,
    "rollback_steps": [
      "保留 pre-write snapshot ref",
      "保留 owner approval record",
      "每筆 writeback 必須有 idempotency key",
      "發現錯誤學習時先標記 deprecated，不直接刪 canonical",
      "rollback 後回寫 incident timeline 的 learning_reverted 事件"
    ]
  },
  "approval_boundaries": {
    "km_write_allowed": false,
    "playbook_trust_write_allowed": false,
    "timeline_learning_write_allowed": false,
    "agent_replay_score_write_allowed": false,
    "runtime_worker_allowed": false,
    "telegram_send_allowed": false,
    "secret_plaintext_allowed": false
  },
  "display_redaction_contract": {
    "redaction_required": true,
    "raw_payload_display_allowed": false,
    "private_reasoning_display_allowed": false,
    "secret_value_display_allowed": false,
    "allowed_frontend_content": [
      "learning lane",
      "target surface",
      "owner review status",
      "required evidence",
      "blocked write action",
      "rollback requirement"
    ],
    "forbidden_frontend_content": [
      "未脫敏 payload",
      "提示內容",
      "未核准內部細節",
      "機密值",
      "raw tool output"
    ],
    "frontend_display_policy": "治理頁只顯示 learning lane、目標 surface、owner review、阻擋寫入動作與 rollback 要求；未脫敏 payload、未核准內部細節、機密值與 raw tool output 不進前端。"
  },
  "rollups": {
    "review_gate_count": 4,
    "learning_lane_count": 3,
    "approval_required_gate_ids": [
      "km_owner_review_gate",
      "playbook_trust_gate",
      "replay_score_gate"
    ],
    "blocked_write_action_count": 4,
    "required_field_count": 12,
    "forbidden_field_count": 7,
    "live_write_count_total": 0
  }
}
