openclaw - 💡(How to fix) Fix Feature request: slim/bare mode for claude-cli backend to support sub-opus models [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#70775Fetched 2026-04-24 05:53:50
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Error Message

[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 [agent/cli-backend] claude live session turn failed: error=FailoverError FailoverError: Prompt is too long

Root Cause

A 2-character prompt ("hi") to haiku reproduces the failure. Opus-4.7 (1024k ctx), gpt-5.4, and gemini-2.5-flash work because their windows tolerate the preload.

Code Example

[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
[agent/cli-backend] claude live session turn failed: error=FailoverError
FailoverError: Prompt is too long

---

"agents": {
  "defaults": {
    "claudeCli": {
      "slimMode": true
    }
  }
}

---

{
  "payload": {
    "kind": "agentTurn",
    "model": "claude-cli/claude-sonnet-4-6",
    "slimMode": true
  }
}
RAW_BUFFERClick to expand / collapse

Problem

The claude-cli provider backend invokes the underlying Claude Code CLI without --bare, so every session rebuilds the full Claude Code harness: CLAUDE.md auto-discovery up the directory tree, hooks, plugin sync, auto-memory, background prefetches. On a reasonably active workstation this preload easily exceeds 200k tokens before any user prompt is added.

Consequence: any model in the Claude family with < 1M context — i.e. sonnet-4.6 (195k) and haiku-4.5 (200k) — immediately fails with:

[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
[agent/cli-backend] claude live session turn failed: error=FailoverError
FailoverError: Prompt is too long

A 2-character prompt ("hi") to haiku reproduces the failure. Opus-4.7 (1024k ctx), gpt-5.4, and gemini-2.5-flash work because their windows tolerate the preload.

On my host I confirmed (by moving skills out of skills.load.extraDirs temporarily) that skills are not the primary bloat — even with zero SKILL.md files present, haiku still overflows. The bulk is coming from Claude Code's default context discovery/hooks, not from OpenClaw's own configuration.

This means on workstations like mine, any cron job or agent invocation that tries to use sonnet/haiku for cost reasons silently routes to the fallback (openai-codex/gpt-5.4 in my case), which also breaks .sh execution because gpt-5.4 + toolsAllow:[exec] triggers an interactive approval prompt in cron context and the script never runs.

Proposal

Expose a config (and/or per-invocation flag) that causes the claude-cli backend to pass --bare — or equivalently --no-context-files, --no-skills, plus explicit --system-prompt-file / --mcp-config / --add-dir / --agents / --settings where OpenClaw actually wants content — to the underlying claude binary.

Something like:

"agents": {
  "defaults": {
    "claudeCli": {
      "slimMode": true
    }
  }
}

or a per-agent-turn opt-in:

{
  "payload": {
    "kind": "agentTurn",
    "model": "claude-cli/claude-sonnet-4-6",
    "slimMode": true
  }
}

That would let cron jobs and other minimal-context workloads pick sonnet/haiku without fighting the auto-discovery.

Impact

Without this, users with non-trivial workstation configs are locked into claude-cli/claude-opus-4-7 for everything, even short wrapper-style cron jobs. That has real cost implications — and silently-wrong fallbacks to other providers that don't honour the same toolsAllow semantics.

Environment

  • OpenClaw 2026.4.22 (00bd2cf)
  • Linux (Ubuntu 6.8.0-110-generic)
  • Claude Code CLI via @anthropic-ai/claude-code
  • Reproduces with a fresh openclaw capability model run --model claude-cli/claude-haiku-4-5 --prompt "hi" when the invoking user's home has a non-trivial ~/CLAUDE.md or workspace attachments.

Happy to test a proposed fix if useful.

extent analysis

TL;DR

Enable slim mode for the claude-cli backend by passing --bare or equivalent flags to reduce context discovery overhead.

Guidance

  • Verify that the issue is caused by excessive context discovery by checking the Claude Code CLI output and the workstation's ~/CLAUDE.md file.
  • Consider implementing a config option or per-invocation flag to enable slim mode for the claude-cli backend, as proposed in the issue.
  • Test the fix using a minimal context workload, such as a cron job with a short prompt, to ensure that it resolves the issue.
  • Evaluate the cost implications of using larger models like claude-opus-4-7 versus enabling slim mode for smaller models like claude-sonnet-4-6 and claude-haiku-4-5.

Example

"agents": {
  "defaults": {
    "claudeCli": {
      "slimMode": true
    }
  }
}

This example shows how to enable slim mode for the claude-cli backend using a config option.

Notes

The proposed fix assumes that the --bare flag or equivalent options are supported by the underlying Claude Code CLI. Additionally, the fix may not be applicable to all workstations or use cases, and further testing may be necessary to ensure its effectiveness.

Recommendation

Apply the proposed workaround by enabling slim mode for the claude-cli backend, as it is likely to resolve the issue and reduce costs associated with using larger models.

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

openclaw - 💡(How to fix) Fix Feature request: slim/bare mode for claude-cli backend to support sub-opus models [1 participants]