Skip to content

SlimClaw integration β€” ClawRouter under the hood + mutual blocking issueΒ #45

@evansantos

Description

@evansantos

Hey team! πŸ‘‹

I built SlimClaw β€” a token optimization plugin for OpenClaw (now on npm) β€” and integrated ClawRouter as the primary classifier in a hybrid routing setup.

What we did

ClawRouter is running under the hood in SlimClaw as the intelligence behind model routing. The integration uses a hybrid approach:

  • ClawRouter as primary classifier β€” analyzes prompt complexity and recommends the optimal model tier
  • Heuristic fallback with circuit breaker β€” kicks in if ClawRouter is unavailable
  • IRoutingProvider interface β€” abstracts routing so the classifier is swappable

The system classifies prompts into tiers (simple, mid, complex, reasoning) and maps them to models. In testing, the combined approach (windowing + routing) shows potential savings of ~97% β€” windowing cuts ~60% of tokens, routing saves ~92% on model costs, and they stack multiplicatively.

The data when we join forces

Metric SlimClaw alone ClawRouter alone Combined
Token reduction 60-80% (windowing) β€” 60-80%
Cost reduction (routing) β€” ~92% ~92%
Combined savings β€” β€” ~97%

SlimClaw handles what gets sent (trimming history, caching, breakpoints). ClawRouter handles where it gets sent (picking the right model). Complementary, not competitive.

The blocking problem we both face

Here's the thing β€” we're both stuck on the same wall: OpenClaw's hooks are observation-only.

Right now SlimClaw runs in observation mode: we classify every prompt with ClawRouter, log the recommendation, calculate what we would save... but can't actually route to a different model or trim the history. The llm_input hook returns void.

There's a PR (openclaw/openclaw#20426) that adds prompt and assistantTexts mutation, but it doesn't include historyMessages or model β€” which is what we'd need for both windowing and routing to actually work.

I've been pushing for historyMessages support in openclaw/openclaw#20416 β€” the maintainer (chandika) agreed it makes sense but wants to land the current PR first, then open a follow-up.

Curious how you're approaching this on your side? Are you hitting the same limitation, or do you have a different integration path?

What each of us does differently

Concern SlimClaw ClawRouter
Context optimization βœ… Windowing, importance scoring, summarization β€”
Cache optimization βœ… Breakpoint injection, cache hit tracking β€”
Model classification Heuristic fallback βœ… Primary classifier
Cost calculation Per-request metrics + dashboard Built-in pricing
Metrics/Dashboard βœ… Real-time web dashboard Stats via API

Links

Would love to hear your thoughts on the integration and how we can push the hook mutation forward together. The combined value proposition is way stronger than either project alone. 🀝

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions