openclaw - 💡(How to fix) Fix [Bug]: Workspace context files silently truncated at ~12,000 characters (AGENTS.md / gateway agents)

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…

Workspace context files injected into the agent prompt (specifically AGENTS.md) are silently truncated at approximately 12,000 characters for agents running via the OpenClaw Gateway (openclaw_gateway agents). No warning is emitted, no error is raised — the file simply stops being injected mid-content, causing the agent to operate with incomplete context.

Error Message

Workspace context files injected into the agent prompt (specifically AGENTS.md) are silently truncated at approximately 12,000 characters for agents running via the OpenClaw Gateway (openclaw_gateway agents). No warning is emitted, no error is raised — the file simply stops being injected mid-content, causing the agent to operate with incomplete context. 3. Agent will be unaware of that content — no error, no warning

Root Cause

Workspace context files injected into the agent prompt (specifically AGENTS.md) are silently truncated at approximately 12,000 characters for agents running via the OpenClaw Gateway (openclaw_gateway agents). No warning is emitted, no error is raised — the file simply stops being injected mid-content, causing the agent to operate with incomplete context.

Fix Action

Workaround

We added a character-count warning comment at the top of AGENTS.md and monitor file size manually with wc -c AGENTS.md before each edit.

RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Workspace context files injected into the agent prompt (specifically AGENTS.md) are silently truncated at approximately 12,000 characters for agents running via the OpenClaw Gateway (openclaw_gateway agents). No warning is emitted, no error is raised — the file simply stops being injected mid-content, causing the agent to operate with incomplete context.

Steps to reproduce

  1. Create or grow AGENTS.md (or any injected workspace context file) beyond 12,000 characters
  2. Ask the agent to reference content from the latter portion of the file
  3. Agent will be unaware of that content — no error, no warning

Expected behavior

Either:

  • No truncation — the full file contents should be injected, or
  • Explicit warning — if a hard limit exists, the agent (and/or the user) should be notified when a file exceeds it, ideally at gateway startup or file-load time

Actual behavior

  • AGENTS.md contents beyond ~12,000 characters are invisible to the agent at runtime
  • The agent receives no indication that truncation has occurred
  • Content injected late in the file (e.g. escalation protocols, model assignments, security policies) silently disappears

OpenClaw version

2026.4.15 (041266a)

Operating system

Linux 6.8.0-110-generic (x64)

Install method

No response

Model

Anthropic opus 4.7

Provider / routing chain

openclaw_gateway

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

High — agents silently operating with incomplete instructions is a correctness and safety issue. In our case, security protocols, model integrity policies, and escalation rules defined in the latter half of AGENTS.md were being silently dropped without any indication.

Additional information

Suggested Fix

  1. Document the limit (if intentional) in the AGENTS.md template and official docs
  2. Emit a warning at gateway startup if any injected context file exceeds the limit
  3. Consider raising or removing the limit for openclaw_gateway agents to match Hermes behaviour

Workaround

We added a character-count warning comment at the top of AGENTS.md and monitor file size manually with wc -c AGENTS.md before each edit.

extent analysis

TL;DR

The issue can be mitigated by documenting the character limit, emitting a warning when the limit is exceeded, and considering removal of the limit for openclaw_gateway agents.

Guidance

  • Verify the character limit by checking the AGENTS.md file size using wc -c AGENTS.md and ensure it is below the 12,000 character threshold.
  • Add a warning comment at the top of AGENTS.md to alert users of the potential truncation issue.
  • Consider implementing a warning system at gateway startup to notify users when an injected context file exceeds the limit.
  • Review the openclaw_gateway agent configuration to determine if the character limit can be raised or removed to match the behavior of other agents like Hermes.

Example

No code snippet is provided as the issue is related to configuration and character limits rather than code.

Notes

The provided workaround of adding a character-count warning comment and manually monitoring file size can help mitigate the issue, but a more robust solution would involve implementing a warning system or removing the character limit.

Recommendation

Apply the suggested workaround of documenting the limit, emitting a warning, and considering removal of the limit, as it provides a more comprehensive solution to the issue and helps prevent silent truncation of important context files.

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…

FAQ

Expected behavior

Either:

  • No truncation — the full file contents should be injected, or
  • Explicit warning — if a hard limit exists, the agent (and/or the user) should be notified when a file exceeds it, ideally at gateway startup or file-load time

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 [Bug]: Workspace context files silently truncated at ~12,000 characters (AGENTS.md / gateway agents)