| name | self-observe |
| description | Observe openppx runtime health with token usage, gateway/heartbeat status, error logs, and quick diagnostics. |
Self Observe Skill
Use this skill when the user asks for agent self-inspection, runtime health checks, or diagnostics such as token cost, error logs, and service status.
What To Check
- Token usage:
ppx token stats --json
ppx token stats --provider google --limit 50 --json
ppx token stats --provider openai --limit 50 --json
- Runtime status:
ppx gateway status --json
ppx heartbeat status --json
ppx cron status
ppx provider status --json
- Error logs (read-only):
tail -n 200 ~/.openppx/log/gateway.err.log
rg -n "ERROR|Error|Traceback|Exception|failed|timeout" ~/.openppx/log/gateway.err.log ~/.openppx/log/gateway.out.log ~/.openppx/log/gateway.debug.log
- SQLite quick verification (if
sqlite3 exists):
sqlite3 ~/.openppx/token_usage.db "SELECT provider, COUNT(*) AS requests, SUM(total_tokens) AS total_tokens FROM llm_token_usage_events GROUP BY provider ORDER BY total_tokens DESC;"
sqlite3 ~/.openppx/token_usage.db "SELECT response_at, provider, model, request_tokens, response_tokens, total_tokens FROM llm_token_usage_events ORDER BY response_at_ms DESC LIMIT 20;"
Fast Path
Generate one consolidated report:
bash openppx/skills/self-observe/scripts/self_status_report.sh
Output Format
When reporting to user, include:
- Runtime Summary: gateway/heartbeat/provider/cron highlights.
- Token Summary: total requests/tokens and provider split.
- Recent Errors: latest error signatures with file and timestamp.
- Risks: what might break soon (missing usage data, repeated failures, disconnected provider).
- Next Actions: concrete commands to validate/fix.
Guardrails
- Keep checks read-only by default.
- Do not delete or truncate logs unless the user explicitly asks.
- If status/log files are missing, report "not found" explicitly instead of guessing.
- Prefer structured output (
--json) first, then summarize in natural language.