daemon-health-check
Design and implement health check, doctor command, and reconciliation logic for the daemon
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design and implement health check, doctor command, and reconciliation logic for the daemon
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Coordinate alert/event delivery to AI agents — single-queue rule, layered gates (dedup, batch, activity-defer, outage-hold), and the forbidden parallel-path pattern that causes spam
Diagnose autostart, proxy, and process issues — why things aren't starting, connecting, or recovering
Navigate the agnt codebase — find where features live, how subsystems connect, and which files own what
基于 SOC 职业分类
| name | daemon-health-check |
| description | Design and implement health check, doctor command, and reconciliation logic for the daemon |
Use this skill when implementing or modifying health check, reconciliation, or doctor functionality.
The daemon's in-memory state is a cache. Reconciliation verifies it against OS truth and fixes mismatches.
.agnt.kdl for all projects with running scripts{script → process, proxy → target, port → owner}Cross-platform requirement — every probe must go through internal/platform/:
| Probe | Linux/macOS | Windows | WSL |
|---|---|---|---|
| PID alive | kill(pid, 0) or /proc/<pid> | OpenProcess | kill(pid, 0), cmd.exe for Windows-spawned |
| Port owner | ss -tlnp / lsof -i | netstat -ano | ss for Linux, netstat.exe for Windows |
| Proxy health | TCP connect / HTTP GET | Same | Same |
| Finding | State update | Event |
|---|---|---|
| Process in daemon but PID dead | Mark Dead | Emit ScriptStopped |
| Port in use but not by our process | Flag rogue | Record PID in warning |
| Proxy in daemon but not responding | Mark unhealthy | Emit warning |
| Config expects proxy but none exists | Attempt fallback-port | Emit warning if no fallback |
| Process running, no URL detected, has fallback-port | Create proxy via fallback | Log proxy creation |
| Process producing error output | Mark Running With Errors | Surface to AI agent |
CRITICAL: Never kill a process that is producing output, even error output.
A process is stalled ONLY when ALL are true:
Error output IS activity:
Stall detection is disabled during shutdown.
MCP tool doctor (or action in overlay panel):
{"action": "doctor", "project_path": "/optional/filter"}
=== Doctor Report ===
HEALTHY (2)
backend (pid 12345): running, port 6111 ✓, proxy api ✓
frontend (pid 12346): running, port 6112 ✓, proxy web ✓
WARNINGS (1)
api proxy: created via fallback-port (URL detection failed)
ERRORS (1)
deck:dev (pid 0): dead, port 5173 held by rogue process (pid 34954)
→ action: kill rogue and restart, or skip
ACTIONS AVAILABLE
[1] Kill rogue process on port 5173 and restart deck:dev
[2] Create missing proxy for backend using fallback-port 6111
Full structured report with all fields for programmatic consumption.
When implementing health check:
internal/platform/internal/platform/internal/daemon/internal/tools/