Skip to content

jzOcb/context-doctor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

context-doctor 🧠

Visualize and diagnose your OpenClaw context window usage.

One command to see what's eating your tokens, which files are healthy, and how much room you have left for actual conversation.

context-doctor output

Install

clawhub install context-doctor

Or clone this repo into your workspace skills directory:

git clone https://github.com/jzOcb/context-doctor.git ~/.openclaw/workspace/skills/context-doctor

Usage

Terminal (colored output)

python3 scripts/context-doctor.py

PNG image (for chat / sharing)

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

Requires: rich (pip3 install rich) + rsvg-convert (brew install librsvg) or cairosvg (pip3 install cairosvg)

JSON (pipe to other tools)

python3 scripts/context-doctor.py --json

Options

Flag Description
--workspace PATH Custom workspace path (default: auto-detect)
--ctx-size N Context window size in tokens (default: 200000)
--png PATH Output as PNG image
--json Output structured JSON
--no-color Disable ANSI colors

What it shows

πŸ“ Workspace Files

Each bootstrap file with status, character count, and token estimate:

  • βœ“ OK β€” file loaded normally
  • ⚠ TRUNCATED β€” file exceeds limit, instructions silently cut
  • βœ— MISSING β€” file not found or broken symlink

πŸ”§ Installed Skills

All discovered skills from system, workspace, and global directories. Skills are loaded on-demand (not in bootstrap), shown for awareness.

πŸ“Š Token Budget

How your context window is split:

  • System Prompt (framework)
  • Workspace Files
  • Skills List (metadata)
  • Tool Schemas + Summaries
  • Free for conversation

Health Score

Signal Meaning
🟒 <10% Healthy β€” plenty of room
🟑 10-15% Moderate β€” consider trimming
πŸ”΄ >15% Heavy β€” agent loses context early

Agent Integration

When installed as a skill, your OpenClaw agent can automatically run context-doctor when you ask about context window health. With --png, the agent generates and sends the visualization directly in chat β€” no terminal needed.

License

MIT

About

🧠 Visualize and diagnose OpenClaw context window usage β€” terminal, PNG, or JSON

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages