{"skill":{"slug":"context-doctor","displayName":"Context Doctor","summary":"Visualize and diagnose OpenClaw context window usage. Generates a terminal-rendered breakdown showing workspace files (status, chars, tokens), installed skil...","description":"---\nname: context-doctor\ndescription: >\n  Visualize and diagnose OpenClaw context window usage. Generates a terminal-rendered\n  breakdown showing workspace files (status, chars, tokens), installed skills inventory,\n  and token budget allocation across bootstrap components. Use when: (1) user asks about\n  context window health or token usage, (2) debugging agent quality degradation (\"agent\n  got dumber\"), (3) after editing workspace files to verify impact, (4) auditing bootstrap\n  overhead. NOT for: conversation history analysis, model selection, or cost tracking.\n---\n\n# Context Doctor\n\nDiagnose and visualize how the context window budget is allocated.\n\n## Quick Start\n\nRun the visualization script:\n\n```bash\npython3 scripts/context-doctor.py\n```\n\nThe script auto-detects:\n- Workspace path (`~/.openclaw/workspace` or `OPENCLAW_WORKSPACE` env)\n- OpenClaw version (via `openclaw --version`)\n- Installed skills (system + workspace)\n- Bootstrap file sizes and status\n\n## Output Sections\n\n### 1. Workspace Files\nShows each bootstrap file with:\n- **Status**: ✓ OK / ✗ MISSING / ⚠ TRUNCATED (symlink target missing = MISSING)\n- **Characters & Tokens**: Raw size and estimated token count (chars/4)\n- **Visual bar**: Proportional to file size\n\n### 2. Installed Skills\nLists all discovered SKILL.md files from system and workspace skill directories.\nSkills are loaded on-demand, not in bootstrap — shown for awareness only.\n\n### 3. Token Budget\nBreaks down bootstrap overhead:\n- System Prompt (framework)\n- Workspace Files (from scan)\n- Skills List (metadata descriptions)\n- Tool Schemas + Summaries\n\nShows total bootstrap % vs free conversation space.\n\n## Diagnostic Signals\n\n| Signal | Meaning | Action |\n|--------|---------|--------|\n| 🔴 TRUNCATED | File exceeded max chars, silently cut | Reduce file size or split content |\n| 🟡 MISSING | File not found or broken symlink | Check path, fix symlink target |\n| 🟢 Bootstrap <10% | Healthy | No action needed |\n| 🟠 Bootstrap >15% | Heavy | Review workspace files for bloat |\n\n## Image Output (for chat / sharing)\n\nGenerate a PNG image directly — no terminal screenshot needed:\n\n```bash\npython3 scripts/context-doctor.py --png /tmp/context-doctor.png\n```\n\nThe script renders a colored terminal-style image via Rich SVG export.\nRequires: `rich` (pip3 install rich) + one of: `rsvg-convert` (brew install librsvg) or `cairosvg` (pip3 install cairosvg).\n\n**Agent workflow**: When a user asks about context health in chat, run with `--png` and send the image directly. The output path is printed to stdout on success.\n","tags":{"latest":"1.2.0"},"stats":{"comments":0,"downloads":1923,"installsAllTime":30,"installsCurrent":30,"stars":1,"versions":4},"createdAt":1772974155929,"updatedAt":1778491777153},"latestVersion":{"version":"1.2.0","createdAt":1772982140692,"changelog":"feat: --summary flag for concise text output (emoji, health verdict, top files, budget). --png --summary combo for agent chat workflow. Fix: ANSI leak in PNG mode. Add --png/--json mutual exclusion.","license":null},"metadata":null,"owner":{"handle":"jzocb","userId":"s171w51c7np1cprte4r1ab11vs83g4bd","displayName":"jzOcb","image":"https://avatars.githubusercontent.com/u/258660657?v=4"},"moderation":null}