Skip to content

Reduce tool schema token overhead (~3,500 tok/session) #14785

@seans-openclawbot

Description

@seans-openclawbot

Problem

Every session loads the full JSON schemas for all available tools into context. Currently this costs ~3,500 tokens (13,972 chars) — a fixed tax on every single session regardless of what the user is doing.

The biggest offenders by parameter count:

Tool Approx. Share Notes
message ~30% 70+ params covering every channel (Discord guilds, threads, polls, stickers, events, etc.) even when only one channel is active
browser ~15% Nested request objects for all action types
cron ~12% Full tutorial embedded in the description field
nodes ~10% Camera, screen, location, run, invoke params all in one schema

Proposed Improvements

1. Channel-aware schema filtering (biggest single win)

The runtime already knows which channel is active (e.g. channel=telegram). Strip parameters that only apply to other channels. For example, on Telegram there is no need for guildId, autoArchiveMin, nsfw, roleIds, categoryId, threadName, rateLimitPerUser, and many other Discord/Slack-specific params.

Estimated savings: ~800–1,000 tokens.

2. Lazy / on-demand tool loading

Only inject full schemas for tools that are likely to be used. For example:

  • browser schema only when web automation is discussed
  • nodes only when device interaction comes up
  • Start with a lightweight stub; expand to full schema on first use or mention

3. Move tutorials out of tool descriptions

The cron tool description contains a full tutorial on schedule types, payload types, delivery options, and constraints. This documentation could live in a skill file or docs page loaded on-demand rather than being baked into every session's context.

4. Split mega-tools into sub-tools

Instead of one monolithic message tool with every possible action, consider splitting into focused sub-tools (message.send, message.react, message.delete, etc.) and only loading the ones relevant to the active channel and permissions.

5. General description compression

Many tool descriptions repeat information that is already conveyed by parameter names and types. Tightening descriptions while keeping them model-readable could shave tokens across the board.

Impact

At ~3,500 tokens/session, this is a meaningful chunk of context — especially as conversations grow longer and every token counts. Even a 30–40% reduction would free up ~1,000–1,400 tokens per session across all users.

Environment

  • OpenClaw latest (as of 2026-02-12)
  • Channel: Telegram (only channel active, but full multi-channel schemas loaded)
  • Tools loaded: 21 tools
  • Tool schema size: 13,972 chars / ~3,493 tokens

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions