context-doctor for Openclaw

Visualize and diagnose context window allocation and token usage for AI coding agents.

jzocb
v1.2.0
Mar 8, 2026
1
2.6k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install context-doctor

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install context-doctor using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is context-doctor?

Context Doctor is a specialized diagnostic utility designed to provide deep visibility into the context window of your AI agent. By analyzing the allocation of tokens across system prompts, workspace files, and tool schemas, it helps developers understand exactly how their budget is spent and identify potential bottlenecks or bloat.

This tool is essential for maintaining high response quality and preventing the agent quality degradation that occurs when the context window becomes oversaturated or critical files are truncated. It serves as a vital component for developers building and maintaining Openclaw Skills by offering a clear terminal-rendered breakdown of the environment's health and token distribution.

context-doctor Use Cases

  • Checking context window health when agent performance seems to degrade.
  • Auditing bootstrap overhead after adding new workspace files or Openclaw Skills.
  • Verifying file status and ensuring no critical documentation is being silently truncated.
  • Generating visual reports of token distribution to share during debugging sessions.

How context-doctor Works

  1. The script initiates by auto-detecting the workspace path and the current OpenClaw version.
  2. It scans the workspace for bootstrap files and calculates their character counts and estimated token usage.
  3. It inventories all installed Openclaw Skills to provide a complete view of available tools.
  4. The utility calculates a token budget breakdown, comparing framework overhead against free conversation space.
  5. It outputs a detailed report to the terminal with status indicators for file health, including OK, MISSING, or TRUNCATED signals.
  6. Optionally, it can export this visualization as a PNG image for easier sharing in documentation or chat interfaces.

context-doctor Setup

To get started with this diagnostic tool, ensure you have the required dependencies and run the script from your terminal:

# Install visualization dependencies
pip3 install rich cairosvg

# Run the diagnostic script
python3 scripts/context-doctor.py

For macOS users, you can also install rendering support via Homebrew:

brew install librsvg

context-doctor Data Schema & Taxonomy

The tool organizes diagnostic data into several logical segments to help manage your Openclaw Skills environment:

Component Description Metadata Tracked
Workspace Files List of files in the bootstrap Status, Chars, Estimated Tokens, Size Bar
Installed Skills Inventory of SKILL.md files Location (System vs. Workspace)
Token Budget Breakdown of context allocation System Prompt, Files, Skills, Tools
Diagnostic Signals Status indicators TRUNCATED, MISSING, Healthy, Heavy

context-doctor Advanced Features

  • PNG Generation: Use the --png flag to export terminal visualizations directly to an image file for sharing.
  • Automated Detection: Automatically identifies workspace environments via environment variables or default paths.
  • Rich Integration: Utilizes the Rich library for high-fidelity SVG/PNG exports and color-coded terminal outputs.
  • Framework Auditing: Specifically tracks overhead from tool schemas and system prompts to optimize Openclaw Skills performance.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*