Hermes Agent provides a suite of diagnostic utilities for validating system configuration, troubleshooting environment issues, and monitoring service health. These tools range from hermes doctor for deep environment validation to hermes status for component health and automated API error classification for smart failover.
The diagnostic system provides visibility into the agent's runtime environment, authentication state, and service health.
| Command | Purpose | Implementation File |
|---|---|---|
hermes doctor | Comprehensive system health check and auto-repair. | hermes_cli/doctor.py1-5 |
hermes status | Quick overview of components, auth, and gateway. | hermes_cli/status.py1-5 |
hermes gateway status | Specific health and PID tracking for the gateway daemon. | hermes_cli/gateway.py73-89 |
| Error Classifier | Internal API error taxonomy for automated recovery. | agent/error_classifier.py1-10 |
Sources: hermes_cli/doctor.py1-5 hermes_cli/status.py1-5 hermes_cli/gateway.py73-89 agent/error_classifier.py1-10
The hermes doctor command performs a multi-stage validation of the Python environment, configuration files, and system services. It is designed to be "Termux-aware," adjusting its recommendations based on whether it detects an Android environment hermes_cli/doctor.py60-61
Sources: hermes_cli/doctor.py60-61 hermes_cli/doctor.py103-105 hermes_cli/doctor.py108-117 hermes_cli/doctor.py198-202 hermes_cli/doctor.py67-72 hermes_cli/doctor.py137-152
~/.hermes/.env to ensure API key checks work hermes_cli/doctor.py22-24 It specifically reads .env as UTF-8 to avoid crashes on Windows Chinese locales (GBK) tests/hermes_cli/test_doctor.py83-98_apply_doctor_tool_availability_overrides function handles special cases like kanban (gated for dispatcher-spawned workers) and honcho (available if configured, even without an active session) hermes_cli/doctor.py137-152_has_healthy_oauth_fallback_for_apikey_provider to determine if a missing API key is non-blocking because a valid OAuth session exists for MiniMax or xAI hermes_cli/doctor.py155-176pkg) versus standard Linux/macOS (using uv or brew) hermes_cli/doctor.py63-72Sources: hermes_cli/doctor.py22-24 hermes_cli/doctor.py63-72 hermes_cli/doctor.py137-152 hermes_cli/doctor.py155-176 tests/hermes_cli/test_doctor.py83-98
The hermes status command provides a real-time snapshot of the environment, configured models, and API connectivity.
resolve_requested_provider and resolve_provider to determine which LLM backend is currently active hermes_cli/status.py75-81mask_secret (imported from agent.redact) before being printed to the terminal hermes_cli/status.py32-41Sources: hermes_cli/status.py32-41 hermes_cli/status.py44-60 hermes_cli/status.py75-81
The system uses a PID-file and lock-file mechanism to track the health of the gateway daemon.
Sources: gateway/status.py69-82 gateway/status.py139-171 gateway/status.py174-176 tests/gateway/test_status.py13-23
write_pid_file uses O_CREAT | O_EXCL to prevent racing gateway instances from clobbering each other's state tests/gateway/test_status.py24-47record_start_and_check_storm implements an append-only ledger (gateway-starts.log) to detect rapid restart loops and enforce exponential backoff gateway/status.py69-121Sources: gateway/status.py69-121 gateway/status.py139-171 tests/gateway/test_status.py24-47
The ClassifiedError system provides a structured taxonomy of API failures to drive smart failover and recovery logic.
Sources: agent/error_classifier.py24-73 agent/error_classifier.py78-94
ClassifiedError includes boolean hints such as should_rotate_credential, should_compress, and should_fallback agent/error_classifier.py88-94_BILLING_PATTERNS and _BILLING_ERROR_CODES to identify confirmed credit exhaustion agent/error_classifier.py104-143Sources: agent/error_classifier.py88-94 agent/error_classifier.py104-143 agent/error_classifier.py164-171
| Symptom | Diagnostic Step | Implementation Reference |
|---|---|---|
| Gateway fails to start | Check for stale PID files or active locks | gateway/status.py66-70 |
| API keys not loading | Check .env encoding (must be UTF-8) | tests/hermes_cli/test_doctor.py83-98 |
| Gateway restart loop | Check gateway-starts.log for storm backoff | gateway/status.py62-66 |
| LLM Failures | Check ClassifiedError.reason in logs | agent/error_classifier.py24-73 |
Sources: gateway/status.py62-70 agent/error_classifier.py24-73 tests/hermes_cli/test_doctor.py83-98
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.