← Back to Skills Marketplace
jzocb

Context Doctor

by jzOcb · GitHub ↗ · v1.2.0
cross-platform ✓ Security Clean
1926
Downloads
1
Stars
30
Active Installs
4
Versions
Install in OpenClaw
/install context-doctor
Description
Visualize and diagnose OpenClaw context window usage. Generates a terminal-rendered breakdown showing workspace files (status, chars, tokens), installed skil...
README (SKILL.md)

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

Signal Meaning Action
🔴 TRUNCATED File exceeded max chars, silently cut Reduce file size or split content
🟡 MISSING File not found or broken symlink Check path, fix symlink target
🟢 Bootstrap \x3C10% Healthy No action needed
🟠 Bootstrap >15% Heavy Review 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.

Usage Guidance
Install this if you want a local OpenClaw context-usage report. Review any terminal, JSON, PNG, or SVG output before sharing it, because it may reveal local workspace paths, installed skill names, and the presence or size of personal context files.
Capability Assessment
Purpose & Capability
The Python script’s behavior matches the stated purpose: it detects an OpenClaw workspace, checks fixed bootstrap files, inventories installed SKILL.md files, estimates token usage, and optionally renders text, JSON, or PNG output.
Instruction Scope
The skill asks the agent to run a local script and optionally generate a PNG; this is disclosed and user-directed, but reports may expose local paths, file status, file sizes, and installed skill names.
Install Mechanism
There is no hidden installer or automatic setup. PNG export may require optional local dependencies such as rich, rsvg-convert, or cairosvg.
Credentials
Use of OPENCLAW_WORKSPACE, openclaw config/version commands, local file reads, and optional PNG writes is proportionate to context diagnostics; no network access or credential collection was found.
Persistence & Privilege
No background process, privilege escalation, credential/session handling, destructive mutation, or automatic persistence was found. PNG mode writes only to the requested output path and removes its temporary SVG when conversion succeeds.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install context-doctor
  3. After installation, invoke the skill by name or use /context-doctor
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.2.0
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.
v1.1.1
Codex review fixes: PTY robustness (timeout, fd cleanup, no zombies), nested ANSI color handling, path validation, sys.executable compat
v1.1.0
Add --png flag: render colored terminal visualization as PNG image directly, no terminal needed. Agents can generate and send context health images in chat.
v1.0.0
Initial release: terminal visualization of OpenClaw context window usage, workspace file health checks, token budget breakdown, JSON output mode
Metadata
Slug context-doctor
Version 1.2.0
License
All-time Installs 30
Active Installs 30
Total Versions 4
Frequently Asked Questions

What is Context Doctor?

Visualize and diagnose OpenClaw context window usage. Generates a terminal-rendered breakdown showing workspace files (status, chars, tokens), installed skil... It is an AI Agent Skill for Claude Code / OpenClaw, with 1926 downloads so far.

How do I install Context Doctor?

Run "/install context-doctor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Context Doctor free?

Yes, Context Doctor is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Context Doctor support?

Context Doctor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Context Doctor?

It is built and maintained by jzOcb (@jzocb); the current version is v1.2.0.

💬 Comments