context-doctor

Visualize and diagnose OpenClaw context window usage. Generates a terminal-rendered breakdown showing workspace files (status, chars, tokens), installed skills inventory, and token budget allocation across bootstrap components. Use when: (1) user asks about context window health or token usage, (2) debugging agent quality degradation ("agent got dumber"), (3) after editing workspace files to verify impact, (4) auditing bootstrap overhead. NOT for: conversation history analysis, model selection, or cost tracking.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "context-doctor" with this command: npx skills add jzocb/context-doctor/jzocb-context-doctor-context-doctor

Context Doctor

Diagnose and visualize how the context window budget is allocated.

Quick Start

Run the visualization script:

python3 scripts/context-doctor.py

The script auto-detects:

  • Workspace path (~/.openclaw/workspace or OPENCLAW_WORKSPACE env)
  • OpenClaw version (via openclaw --version)
  • Installed skills (system + workspace)
  • Bootstrap file sizes and status

Output Sections

1. Workspace Files

Shows each bootstrap file with:

  • Status: ✓ OK / ✗ MISSING / ⚠ TRUNCATED (symlink target missing = MISSING)
  • Characters & Tokens: Raw size and estimated token count (chars/4)
  • Visual bar: Proportional to file size

2. Installed Skills

Lists all discovered SKILL.md files from system and workspace skill directories. Skills are loaded on-demand, not in bootstrap — shown for awareness only.

3. Token Budget

Breaks down bootstrap overhead:

  • System Prompt (framework)
  • Workspace Files (from scan)
  • Skills List (metadata descriptions)
  • Tool Schemas + Summaries

Shows total bootstrap % vs free conversation space.

Diagnostic Signals

SignalMeaningAction
🔴 TRUNCATEDFile exceeded max chars, silently cutReduce file size or split content
🟡 MISSINGFile not found or broken symlinkCheck path, fix symlink target
🟢 Bootstrap <10%HealthyNo action needed
🟠 Bootstrap >15%HeavyReview workspace files for bloat

Image Output (for chat / sharing)

Generate a PNG image directly — no terminal screenshot needed:

python3 scripts/context-doctor.py --png /tmp/context-doctor.png

The script renders a colored terminal-style image via Rich SVG export. Requires: rich (pip3 install rich) + one of: rsvg-convert (brew install librsvg) or cairosvg (pip3 install cairosvg).

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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

memory-management

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

agent-guardrails

No summary provided by upstream source.

Repository SourceNeeds Review
Security

compliance-evidence-assembler

把审计所需证据整理成目录、清单和缺失项,便于后续评审。;use for compliance, evidence, audit workflows;do not use for 伪造证据, 替代正式审计结论.

Archived SourceRecently Updated
Security

skillguard-hardened

Security guard for OpenClaw skills, developed and maintained by rose北港(小红帽 / 猫猫帽帽). Audits installed or incoming skills with local rules plus Zenmux AI intent review, then recommends pass, warn, block, or quarantine.

Archived SourceRecently Updated