{
  "module": "health_check",
  "version": "1.0",
  "purpose": "Tier 1 快速健康检查（每5分钟）。对 service_registry 中所有注册服务做三合一检查：PID存活 → 端口监听 → HTTP /health。异常时写 TODO 给 self_todo_executor 消费。正常时静默。",
  "ui_location": "F Tab → 定时任务 → 健康检查(5min)",

  "human_help": {
    "title": "Tier 1 健康检查",
    "description": [
      "每 5 分钟由 Windows Task Scheduler 触发，检查所有注册服务的运行状态。",
      "检查项：端口监听（netstat）+ HTTP /health 端点响应。远程服务跳过本地端口检测。",
      "PID 检查仅作为辅助信号——端口+HTTP 都正常即判定为健康。",
      "异常服务会写入 health_todos.jsonl，由自修复执行器消费。",
      "全正常时静默运行，不输出任何噪音。"
    ],
    "usage": [
      "报告文件：gateway/temp/last_health_check.json",
      "TODO 文件：gateway/temp/health_todos.jsonl",
      "日志：gateway/logs/health_check_report.log",
      "Dashboard 通过 /api/monitor 读取报告显示 Tier1 统计"
    ],
    "troubleshooting": [
      "如果定时任务未运行：检查 Windows Task Scheduler → agents-health-check",
      "如果报告未更新：检查 C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe 是否可用",
      "如果 TODO 堆积：检查 self_todo_executor 是否正常消费"
    ],
    "related": "依赖 service_registry.py（服务定义）; 输出给 self_todo_executor.py（修复消费）; 报告被 dashboard.py 读取"
  },

  "ai_spec": {
    "dependencies": [
      "service_registry.py — 服务定义（名称/端口/health URL/fix_script）",
      "Python 3.10 (C:\\Users\\hmo\\AppData\\Local\\Programs\\Python\\Python310\\python.exe)",
      "Windows Task Scheduler — 每5分钟触发"
    ],
    "constraints": [
      "PID 检查不是硬性失败条件——端口+HTTP OK 即视为健康",
      "远程服务（remote:true）跳过本地 netstat 端口检测，直接用 HTTP 判断",
      "静默原则：全正常时零输出；仅异常时写 TODO + 打印报告"
    ],
    "related_files": [
      "gateway/scripts/agents_health_check.py — 本脚本",
      "gateway/scripts/service_registry.py — 服务注册表",
      "gateway/scripts/self_todo_executor.py — TODO 消费者",
      "gateway/scripts/specs/health_check.json — 本 spec"
    ]
  }
}
