# Kimi / Moonshot Outage Triage & Recovery Agent Instructions
# Compatible with: Claude Code / OpenAI Codex CLI / Cursor / Windsurf / OpenClaw

1. Detect host OS and select the zero-dependency script:
   - macOS 27      -> kimi_outage_triage_macos27.zsh
   - Ubuntu 26.04  -> kimi_outage_triage_ubuntu2604.sh
   - Windows 11    -> kimi_outage_triage_windows11.ps1

2. Verify SHA-256 checksums against SHA256SUMS.txt before execution.

3. Execute in strict AI Agent JSON mode (zero third-party services):
   - macOS 27:
     zsh kimi_outage_triage_macos27.zsh --auto --json
   - Ubuntu 26.04:
     bash kimi_outage_triage_ubuntu2604.sh --auto --json
   - Windows 11:
     powershell -ExecutionPolicy Bypass -File .\kimi_outage_triage_windows11.ps1 -Auto -Json

4. Parse the returned single-line JSON:
   - Check upstream_status.indicator and upstream_status.degraded_components.
     If Kimi Code / Remote Control / K3.1 Pro shows partial_outage or 5xx, DO NOT hammer retries; apply exponential backoff or pause automated batch tasks.
   - Check endpoint_probes.api_kimi_ai_coding.http == "403":
     Ensure custom User-Agent headers are set and avoid generic bot UAs.
   - Check local_audit (legacy_k2_config_hits, temperature_override_hits, cn_intl_endpoint_mix, zero_byte_session_files):
     Run with --fix (or -Fix on Windows) to flush DNS and quarantine zero-byte sessions; remove unsupported temperature or stale K2 model overrides; start a fresh chat session to avoid 400 missing reasoning_content loops.
   - To roll back local config backups created by --fix, run with --clean (or -Clean).
