grandamenium/cortextos/cortext-self-diagnosis
Claude Code and agent skill by grandamenium/cortextos
- community
Checking that the SKILL.md file is still in the repository.
Diagnose cortextOS itself when the framework misbehaves — an agent has gone silent or wedged, agents are crash-looping, Telegram or agent-to-agent messages are not arriving, crons did not fire, an agent re-onboards or shows offline when it is running, the daemon died, or the whole fleet is down. Walks a structured evidence-first investigation across logs, the message bus, state markers, and daemon output, then classifies the finding as local config vs. a genuine framework bug — and for real bugs, drives a fix branch, a user-run test matrix, a PII/focus gate, and an upstream PR. Use this whenever someone asks you to debug, investigate, troubleshoot, or explain anything about cortext/cortextOS behavior, even casually (\"why did my agent stop replying\", \"is something broken\", \"cortext is acting weird\"). For stale tasks, stale goals, or workload health instead, use system-diagnostics.
Install
npx vskill@latest install grandamenium/cortextos/cortext-self-diagnosisSKILL.md
The same SKILL.md was published earlier as grandamenium/cortextos/cortext-self-diagnosis.
Cortext Self-Diagnosis
Debugging the framework you are running inside. This skill covers cortextOS infrastructure: PTY sessions, the daemon, the message bus, state markers, crons, and the Telegram path — through to an upstream fix when the cause is real.
Not this skill: stale tasks, stale goals, overdue human tasks, fleet workload health. That is system-diagnostics. The dividing line is simple — if the machinery is misbehaving, you are here; if the machinery works and the work is stuck, you are there.
The one thing that makes this different
You are debugging the system that is currently executing you. Your session is a PTY child of the daemon you are about to inspect. This has three consequences that will bite you if you forget them:
Write evidence to disk before you touch anything that restarts. A daemon restart kills and respawns your own PTY. Anything you know only in context is gone. The evidence bundle exists so your findings survive your own restart.
Never restart the daemon or your own agent without saying so first. From the user's side that looks identical to the bug — the agent goes quiet. Tell them what you are about to do, that you may drop mid-sentence, and roughly when you will be back.
You are a witness, and witnesses have blind spots. If you are the agent that is misbehaving, your account of yourself is the least reliable evidence you have. Prefer the logs to your own memory, and when the symptom is about you, say so plainly to the user and lean harder on the files.
Stance: evidence before repair
The failure mode this skill exists to prevent is the confident guess — changing a config, restarting something, declaring it fixed, and never learning what happened. It usually "works" because restarts paper over transient state, and the bug returns next week with the trail gone cold.
So: find the artifact that proves it before you touch anything. A hypothesis you cannot point at a log line for is a hunch. Say "I think" out loud when it is a hunch — users make much better decisions when they know which of your claims are load-bearing.
If the evidence genuinely does not resolve it, that is a real outcome. Say what you checked, what you ruled out, and what would settle it. That beats a fix that might be unrelated.
Phase 0 — Orient
Two minutes, before any commands.
Get the symptom concrete. "Cortext is broken" is not actionable; "opsbot stopped replying on Telegram around 2pm, still nothing" is. You need:
- Which agent(s) — one, several, or the whole fleet
- What you expected vs. what happened
- When it started, even roughly, and whether it is ongoing or over
- What changed recently — an update, a config edit, a new agent, a reboot,
a rebuild. This single question resolves a large share of cases.
Then resolve the runtime root, because everything else hangs off it:
Layout under the root (references/surface-map.md has the full map):
Daemon output lives outside the root, under PM2: ~/.pm2/logs/cortextos-daemon-out.log and -error.log.
Phase 1 — Collect evidence
Run the collector. It snapshots every surface at once into a timestamped bundle, so you are reading a consistent moment rather than files that shift under you:
It prints a bundle path. Read it there.
The script is a fast path, not the method. It knows the standard layout; it does not know your install's quirks, and it cannot tell which of 400 log lines matters. Installs drift — legacy roots, relocated logs, custom instances. When the script comes back thin or empty, that is a signal to go look by hand, not a verdict that nothing is wrong. references/surface-map.md documents each surface so you can read any of them directly:
Also run the framework's own preflight — it catches environment breakage (Node version, node-pty native module, PM2, CLI auth) faster than reading logs:
Phase 2 — Read the right surface first
Symptom routes you to the surface most likely to hold the answer. Start there, then widen. Full playbooks with confirm/refute criteria are in references/symptom-playbooks.md — read it when your symptom is on this list, as each playbook carries the specific log lines that distinguish similar-looking causes.
| Symptom | Start here | Then | |
|---|---|---|---|
| Agent silent / wedged | logs/<agent>/stdout.log tail | restarts.log, session transcript | |
| Crash looping | crashes.log, restarts.log | daemon error log, .crash_count_today | |
| Message never arrived | inbox/ inflight/ processed/ | fast-checker.log, poller logs | |
| Telegram specifically | fast-checker.log | daemon log, telegram offset, allowed-users | |
| Cron did not fire | orgs/<org>/crons.json, cron state | daemon log (scheduler lives there) | |
| Agent re-onboards | state/<agent>/ markers | restarts.log | |
| Shows offline but is up | state/<agent>/heartbeat.json | daemon log | |
| Whole fleet down | pm2 list, daemon error log | PM2 startup config | |
| Agent misbehaving, not broken | bootstrap .md, config.json, skills | enabled-agents.json |
That last row matters more than it looks. A large share of "bugs" are the agent faithfully following an instruction someone wrote. Before you go hunting in the daemon, read what the agent was actually told. These systems are suggestible and a stray line in a bootstrap file changes behavior a lot.
When cortext's own logs are clean but behavior is still wrong, the fault is often one layer down in the harness — Claude Code, Codex, or OpenCode itself, or an API error. Those surface in the session transcript, not in cortext's logs. That is the place to look when everything cortext-side appears healthy.
Phase 3 — Hypothesis, then confirmation
State the hypothesis in one sentence, in causal form: the fast-checker stopped polling at 14:02, so messages queued in inbox and never reached the PTY.
Then go find the artifact that would be true if you are right — and, just as important, the one that would be true if you are wrong. Actively look for the second one. Confirmation bias is the main way debugging goes sideways: the first plausible story absorbs every subsequent observation.
Timestamps are your strongest tool. Line up the moment the symptom started against restarts, crashes, daemon events, and message timestamps. Causes precede effects, which sounds obvious and eliminates suspects fast.
Timing trap worth knowing: after any daemon restart there is a burst of startup noise — reconnects, re-injections, heartbeat churn — that looks a lot like the original symptom. Give it ten minutes before judging whether a restart fixed anything. Calling it too early, in either direction, is one of the easier ways to waste an hour.
Phase 4 — Classify the finding (the gate)
This is the decision that determines everything downstream, and the one most worth getting right.
Most findings are not framework bugs. Ranked by how often they actually are the answer:
- Local config or state — a marker file wrong, a stale lock, a malformed
config, an agent not in enabled-agents.json, a bad token. Fix locally.
- Environment — Node version,
node-ptynot built, PM2 not set to resume
on boot, missing CLI auth, disk full. Fix locally; cortextos doctor finds most of these.
- Instruction/prompt — the agent did what its files told it to. Edit the
files, not the framework.
- Downstream harness or API — a Claude Code / Codex / OpenCode bug, a rate
limit, an upstream outage. Not cortext's to fix; worth reporting to them.
- Genuine framework bug — cortext's own code does the wrong thing given
valid inputs. Only this one earns a PR.
Before classifying something as (5), satisfy yourself on all of these:
- You can point to the specific code path in
~/cortextos/src/that is wrong - You can state the inputs that trigger it and why the current logic mishandles them
- It is not explained by local config, environment, or instructions
- It would affect anyone with the same version — not just this install
If any is shaky, it is not yet a framework bug. Say so, fix what you can locally, and note what would confirm it. Escalating a local problem to a public PR wastes maintainer attention and is difficult to walk back.
Phase 5 — Local fix
For causes 1–4, fix locally and verify against the same evidence that showed the problem. Prefer the narrowest reversible change, and tell the user what you changed and how to undo it. Before editing any config or marker, back it up.
Then confirm with fresh evidence, not with a restart and a hopeful look. The symptom must be gone in the surface where you originally saw it, and remember the ten-minute rule if a restart was involved.
Phase 6 — Upstream path
Only for cause (5), and only with the user's agreement to proceed. The full procedure is in references/upstream-pr.md; read it before starting, and read references/test-matrix.md when you get to verification. In outline:
- Branch from
upstream/main— never from whatever the local checkout sits on - Write the narrowest fix that addresses the root cause, plus a regression test
- Build a user-facing test matrix — the reproduction, then the same steps
against the rebuilt branch. references/test-matrix.md covers how to make it runnable by a human with an agent watching
- The user runs it; you observe the evidence surfaces and report honestly
- Run the PII and focus gate —
scripts/pr_gate.py, plus your own read - Stop. Present everything and get explicit approval before any push or PR
Hard boundary: nothing leaves this machine without the user saying yes to that specific action. Not a fork push, not a PR. A green test matrix and a clean gate are prerequisites for asking, never a substitute for it. If you are unsure whether something counts as outward-facing, it does — ask.
Talking to the user
Diagnosis is mostly a communication task. The user has more context than you about what changed and what is normal here, and they are the one deciding what risk to take. Bring them along.
Lead with the finding, not the walk. "Your fast-checker died at 14:02 — that's why opsbot went quiet" beats a chronological tour of what you checked. Detail goes underneath, for the people who want it.
Separate what you saw from what you infer. Observation: the log stops at 14:02. Inference: that is probably why messages stopped. Users can challenge an inference if they can see it is one.
Never paste raw log dumps as your answer. Quote the two or three lines that carry the finding. Put the bundle path underneath for anyone who wants to dig.
Ask before anything invasive — restarts, config edits, clearing state, killing sessions — and say what it will look like from their side. Restarting their orchestrator without warning during a workday is a genuinely bad surprise.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 93 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcommunity/skills/cortext-self-diagnosis/SKILL.md
Popularity
- Repository stars
- 97
- Repository forks
- 111
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grandamenium/cortextos/cortext-self-diagnosis)