Connect Clawsmith to your coding agent. Ship products like crazy.Unlimited usage during betaGet API Key →
← Back to ideas
clawsmith.com/idea/prune-openclaw-workspace-injection-to-relevant-files-per-message
IdeaCompetitivePLUGINOPEN-SOURCECOST-OPTIMIZATIONLive

A plugin that prunes OpenClaw's 40K-token workspace injection down to only the files relevant to each message, cutting baseline API costs by 60-80%

OpenClaw injects the entire workspace context (SOUL.md, agent configs, skill descriptions, tool declarations) into every single message, consuming 40,000+ tokens before the user even types a word. This fixed overhead makes smaller models unusable (they hit context limits immediately) and multiplies API costs 3-5x for conversational sessions. This plugin intercepts the context assembly step and applies relevance filtering, only including workspace files and tool declarations that match the current message's intent, dropping the baseline from 40K to under 10K tokens.

Demand Breakdown

GitHub
217

Gap Assessment

CompetitiveMultiple tools exist but differentiation opportunities remain

4 tools exist (lossless-claw, OpenClaw-Token-Optimizer, ClawRouter, maxHistoryMessages (built-in)) but gaps remain: Only compresses history, does not touch baseline workspace injection or tool declaration bloat. The 40K baseline persists even with lossless-claw active.; Works at the routing and scheduling level, not at the context assembly level. Cannot prune workspace files or tool declarations from the prompt..

Features4 agent-ready prompts

Context interceptor plugin that hooks into OpenClaw's pre-prompt assembly and replaces the full workspace dump with a relevance-filtered subset
Token budget dashboard that shows per-message breakdown of baseline vs. history vs. user content with before/after comparison when the plugin is active
Skill-aware tool declaration pruner that removes tool definitions for inactive or irrelevant skills from each prompt, reducing the tool overhead from 15K+ tokens to only what's needed
Model compatibility checker that warns when baseline context exceeds a model's effective window and suggests which files to exclude for smaller models

Competitive LandscapeFREE

ProductDoesMissing
lossless-clawCompresses conversation history without losing critical information via a Context Engine pluginOnly compresses history, does not touch baseline workspace injection or tool declaration bloat. The 40K baseline persists even with lossless-claw active.
OpenClaw-Token-OptimizerGeneral token optimization skill combining model routing, heartbeat tuning, and usage trackingWorks at the routing and scheduling level, not at the context assembly level. Cannot prune workspace files or tool declarations from the prompt.
ClawRouterSmart LLM router that reduces costs by routing simple tasks to cheaper modelsRouting alone doesn't fix baseline bloat. A 40K-token baseline still goes to the cheap model, just at a lower per-token rate. The waste is the same tokens, just cheaper.
maxHistoryMessages (built-in)Limits conversation history to N messages to reduce context growth over timeOnly limits history messages, not the system prompt or workspace injection. Baseline stays at 40K+ regardless of history settings.

Sign in to unlock full access.