Skip to content

Blocked: Active optimization requires OpenClaw hook mutation support #1

@evansantos

Description

@evansantos

Context

SlimClaw is currently running in shadow mode only — measuring potential savings but unable to actually optimize requests.

The Problem

OpenClaw's llm_input and llm_output hooks are observation-only (return void). We cannot:

  • Modify historyMessages (for windowing)
  • Change model (for routing)
  • Mutate systemPrompt at the right scope

Upstream Issue

I've commented on the OpenClaw feature request for this:
[Feature]: Make llm_input / llm_output modifying hooks for middleware patterns
openclaw/openclaw#20416 (comment)

The proposed API would give us:

type PluginHookLlmInputResult = {
  prompt?: string;
  historyMessages?: unknown[];  // ← What we need!
  systemPrompt?: string;
  model?: string;               // ← For routing
};

Current Workaround

SlimClaw tracks metrics and reports what could be saved. Users can leverage OpenClaw's built-in alternatives:

  • contextPruning config for windowing-like behavior
  • compaction config for automatic context management

Next Steps

  1. Monitor [Feature]: Make llm_input / llm_output modifying hooks for middleware patterns (PII redaction, guardrails, content filtering) openclaw/openclaw#20416 for progress
  2. When mutation hooks land, implement active optimization
  3. Consider contributing a PR to OpenClaw if maintainers are open to it

Labels

  • blocked
  • upstream
  • enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedBlocked by external dependencyenhancementNew feature or requestupstreamDepends on upstream project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions