self-diagnose

$npx mdskill add sonichi/sutando/self-diagnose

Diagnose agent state and prioritize fixes instantly.

  • Reveals errors, pending tasks, and broken workflows.
  • Integrates logs, git history, build logs, and health checks.
  • Groups findings into events, failures, and recommended actions.
  • Outputs a concise narrative and saves a detailed report.

SKILL.md

.github/skills/self-diagnoseView on GitHub ↗
---
name: self-diagnose
description: "Sutando introspection — read logs + git + memory + build log for a chosen time window and produce a concise narrative of what the agent has been doing, what's broken, and what to prioritize next."
user-invocable: true
---

# Self-Diagnose

Read Sutando's own observable state (logs, git, memory, build log, pending questions, health check, cold-review log) over a chosen window and produce a structured narrative:

- **What's been happening** — significant events, PRs shipped, tasks processed, user interactions
- **What's broken** — errors in logs, pending questions, health-check failures, 1006/1011/1007 transport events, unresolved bugs surfaced in logs
- **What I'd do next** — concrete prioritized actions grounded in what was observed

**Usage**: `/self-diagnose [--since 24h]`

ARGUMENTS: `$ARGUMENTS`

## Flow

1. **Gather.** Run `bash skills/self-diagnose/scripts/gather.sh [window]` — collects log tails, git log, build_log.md tail, pending-questions, health-check output, cold-review-log, and recent Discord activity into `/tmp/sutando-diagnose-<ts>/`.
2. **Synthesize.** Read each gathered file. Group findings under the three headings above. Be concrete: cite log lines, PR numbers, timestamps. Skip speculation.
3. **Save.** Write the report to `notes/diagnose-YYYY-MM-DD-HHMM.md` with frontmatter (`title`, `date`, `tags: [diagnose, self]`).
4. **Summarize.** Reply to the caller with a 5–10 line executive summary + path to the full report.

## Cross-node mode (resolves #421)

When Sutando works on one machine but is broken on another, the helper script
runs `gather.sh` on both sides over SSH and produces a structured comparison:

```bash
bash skills/self-diagnose/scripts/gather-remote.sh <ssh-target> [window]
# e.g.
bash skills/self-diagnose/scripts/gather-remote.sh mac-mini
bash skills/self-diagnose/scripts/gather-remote.sh user@macbook.local 6h
```

Output: `/tmp/sutando-diagnose-cross-<ts>/{local,remote,diff.md}` plus a
persisted copy at `notes/diagnose-cross-node-<YYYY-MM-DD>.md`. The comparison
report surfaces commit drift, health-check differences, voice-agent error
counts, quota state, and PR-view divergence per side.

Override the remote sutando path via `SUTANDO_REMOTE_REPO=/path/on/peer` if
the failing node's checkout isn't at the default `~/Desktop/sutando`.

**Security posture** (per #421): read-only on the remote (only gather.sh
runs there, no mutation), allowlist enforced by gather.sh's existing scope
(no `.env`, no tokens), per-session SSH (no daemon, no persistent state on
the remote).

## Default window

24 hours if unspecified. Accept: `24h`, `3d`, `1w`. Longer windows = broader scope, higher token cost.

## What a good report looks like

- Cites specific log timestamps (`18:28:16 — transport 1006 after NoteView injection`) rather than "some errors happened"
- Lists PRs by number + status (`#394 mergeable no reviews`, `#354 retention sweep open`)
- Separates recurring from one-off issues
- Prioritizes "what I'd do next" by impact and blocking, not by what's most recent

## What to skip

- Verbose log dumps — the gathered files are on disk already; just reference them
- Speculation without log evidence — "maybe the Gemini server is..." should be backed by a log line showing the close code and preceding event
- Restating CLAUDE.md / build_log.md content — those are already durable; only surface what's NEW in the window

## Related

- `notes/cold-review-capability.md` — sister capability for PR-level review
- `notes/voice-transport-1006-hypothesis.md` — example of the depth of analysis a self-diagnose report should match
- `build_log.md` — the canonical "what has been built" log; complements but doesn't replace

More from sonichi/sutando

SkillDescription
agent-registryLocal Agent Registry — a standalone, dependency-free service that tracks running Claude Code (and other) agent instances. Agents self-register on startup and heartbeat while alive; the Electron overlay and Sutando dashboard read the live list. Use when you need to know which coding agents are running, where, and since when.
bot2bot-postPost a coordination message from this bot to the shared bot2bot channel, @-mentioning the other Sutando node.
claude-codexBash wrapper around the local Codex CLI for non-interactive runs from inside Sutando (bridges, cron, scripts). For interactive code review or task hand-off from this Claude Code session, prefer the official `/codex:*` plugin commands; this skill is the file-bridge-compatible path that `discord-bridge.py` invokes for team-tier sandboxed delegation.
claude-geminiUse the local Gemini CLI from Claude Code with the user's existing Gemini authentication or API configuration. Use for large-context repo scans, multimodal analysis, second-opinion planning, or structured Gemini runs in the current workspace.
claude-routerChoose between the local Codex CLI and Gemini CLI from Claude Code. Use for automatic model selection when the user wants the best local delegate for code review, repo-wide analysis, planning, or implementation.
cross-node-syncRsync-over-ssh sync between Sutando nodes (Mac Studio and MacBook) for shared memory + notes. Optional — core runs fine without it; enables automatic cross-bot learning and note propagation by running from the proactive-loop cron on each pass.
deal-finderScan configured sources (Craigslist now; eBay + Facebook Marketplace planned) for used-item listings matching the owner's criteria. Currently configured for a Mac mini search (M2+, 16GB+, 512GB+, ≤$500, near 94566). Notify owner via SMS + Telegram on a match.
electron-overlay-dimmingReusable pattern for focus-based auto-dimming of Electron overlay windows — when the app loses focus, all overlay windows fade to a low opacity; when an overlay regains focus, they return to their configured opacity. Use when building always-on-top Electron overlays that should recede while the user works in other apps.
gemini-ttsRender text to mp3 via Google Gemini Flash TTS. Free-tier eligible (1500 req/day). Use for video narration, demo voiceovers, audio notes. Parallels openai-tts; default for make-viral-video.
macos-toolsmacOS native integrations: screen capture, calendar, reminders, contacts, email (Mail.app), Spotlight search. Use when the user asks about their screen, schedule, to-do list, contacts, or wants to send email on macOS.