openclaw - 💡(How to fix) Fix Feature request: slim-mode / pass --bare to claude-cli backend so sub-Opus Claude models fit the context window [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70774Fetched 2026-04-24 05:53:51
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

On hosts where the claude-cli provider is used, the session scaffold currently exceeds ~200k tokens before any user prompt is added. This makes every Claude model with <200k context (claude-sonnet-4-6 at 195k, claude-haiku-4-5 at 200k) unusable — requests silently fail with FailoverError: Prompt is too long and fall back to openai-codex/gpt-5.4 (or further down the fallback chain). Opus-4-7 (1024k) and non-Claude models with big windows still work, but the cheaper/faster Claude options are effectively off-limits.

Error Message

$ openclaw capability model run --model claude-cli/claude-haiku-4-5 --prompt "hi"

[agent/cli-backend] claude skill plugin skipped missing skill file: ... [agent/cli-backend] cli exec: provider=claude-cli model=claude-haiku-4-5 promptChars=2 [agent/cli-backend] claude live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1 [agent/cli-backend] claude live session turn failed: provider=claude-cli model=claude-haiku-4-5 durationMs=3699 error=FailoverError FailoverError: Prompt is too long

Root Cause

Root cause (investigated)

Code Example

$ openclaw capability model run --model claude-cli/claude-haiku-4-5 --prompt "hi"

[agent/cli-backend] claude skill plugin skipped missing skill file: ...
[agent/cli-backend] cli exec: provider=claude-cli model=claude-haiku-4-5 promptChars=2
[agent/cli-backend] claude live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1
[agent/cli-backend] claude live session turn failed: provider=claude-cli model=claude-haiku-4-5 durationMs=3699 error=FailoverError
FailoverError: Prompt is too long
RAW_BUFFERClick to expand / collapse

Summary

On hosts where the claude-cli provider is used, the session scaffold currently exceeds ~200k tokens before any user prompt is added. This makes every Claude model with <200k context (claude-sonnet-4-6 at 195k, claude-haiku-4-5 at 200k) unusable — requests silently fail with FailoverError: Prompt is too long and fall back to openai-codex/gpt-5.4 (or further down the fallback chain). Opus-4-7 (1024k) and non-Claude models with big windows still work, but the cheaper/faster Claude options are effectively off-limits.

Reproduction

Any plain invocation of a sub-Opus Claude model via the claude-cli provider, with a minimal 2-char prompt:

$ openclaw capability model run --model claude-cli/claude-haiku-4-5 --prompt "hi"

[agent/cli-backend] claude skill plugin skipped missing skill file: ...
[agent/cli-backend] cli exec: provider=claude-cli model=claude-haiku-4-5 promptChars=2
[agent/cli-backend] claude live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1
[agent/cli-backend] claude live session turn failed: provider=claude-cli model=claude-haiku-4-5 durationMs=3699 error=FailoverError
FailoverError: Prompt is too long

Same command with --model claude-cli/claude-opus-4-7 succeeds. The determining factor is context-window size, not the model itself.

Root cause (investigated)

Claude Code's CLI, which the claude-cli backend invokes under the hood, defaults to:

  • Auto-discovering CLAUDE.md files up the directory tree
  • Loading hooks, plugin sync, auto-memory, background prefetches
  • Auto-attaching workspace content

On a host with busy workspaces (e.g. large workspace/memory/, many installed skills, CLAUDE.md files scattered in parent dirs), this scaffold alone exceeds 200k tokens. Skill-loading alone is not the culprit — I reproduced the overflow after moving all skill files out of the watched dirs.

Claude Code already ships a --bare flag that skips all of this (hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, CLAUDE.md auto-discovery). It's designed for exactly this scenario.

Proposed fix

Add a config key in openclaw.json (suggested location: models.providers.claude-cli.slim or agents.defaults.slimMode) that, when set to true, causes the claude-cli backend to invoke the underlying claude binary with --bare. Default false to preserve current behaviour.

Alternative: a per-invocation slim: true flag on payload in cron jobs / agent turns for fine-grained control.

Impact

This would unlock sonnet-4.6 and haiku-4-5 for cron jobs and one-shot inference on hosts where the harness currently bloats past those models' context windows. Opus is overkill (and far more expensive) for the many cron wrappers that just need to run a script and alert.

Host context (for reference)

  • OpenClaw 2026.4.22
  • Claude Code CLI from @anthropic-ai/claude-code
  • Error reproduces with the workspace config trimmed (dead tool-groups removed, legacy compaction fields dropped, compaction model prefix corrected, shieldcortex uninstalled)

extent analysis

TL;DR

Add a slim config key to openclaw.json to enable the --bare flag for the claude-cli backend, reducing the session scaffold size.

Guidance

  • Set models.providers.claude-cli.slim to true in openclaw.json to invoke the claude binary with --bare and reduce the session scaffold size.
  • Alternatively, use a per-invocation slim: true flag on payload in cron jobs or agent turns for fine-grained control.
  • Verify the fix by running a sub-Opus Claude model via the claude-cli provider with a minimal prompt and checking for successful execution without the FailoverError.
  • Test with different models, such as claude-sonnet-4-6 and claude-haiku-4-5, to ensure they are no longer exceeding the context window size.

Example

No code snippet is provided as it is not necessary for this fix.

Notes

This fix assumes that the --bare flag is sufficient to reduce the session scaffold size below the 200k token limit. If issues persist, further investigation into the workspace configuration and CLAUDE.md files may be necessary.

Recommendation

Apply the workaround by adding the slim config key to openclaw.json and setting it to true, as this will allow the use of cheaper and faster Claude models without exceeding the context window size.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING