How to Fix OpenClaw Response Times by Reducing Context Bloat

Problem: Silent Context Truncation Causing Slow Responses
A developer running OpenClaw 24/7 on a Mac Mini M4 experienced 10-minute response times to simple messages. Investigation revealed the workspace bootstrap file MEMORY.md was 26,421 characters (exceeding the 20,000 character limit) and being silently truncated in injected context. Approximately 47,000 characters of workspace files were being injected into every message before any user input, with MEMORY.md alone at 26,755 characters.
Root Causes Identified
- MEMORY.md contained full deployment commands, financial breakdowns, and verbose project write-ups instead of serving as an index
- Standard workspace files were bloated with duplicate content (AGENTS.md had instructions duplicating system prompts, TOOLS.md contained Telegram groups already in MEMORY.md)
- No hard caps on file sizes, allowing files to drift until hitting the default bootstrapMaxChars limit of 20,000 and getting truncated silently
File Restructuring Results
The developer restructured files using the principle that MEMORY.md should contain pointers only. If information can be looked up in a project file when needed, it doesn't belong in MEMORY.md.
- MEMORY.md: Reduced from 26,755 characters to 3,456 characters
- AGENTS.md: Reduced from 8,436 characters to 2,538 characters
- TOOLS.md: Reduced from 4,468 characters to 2,350 characters
- Total injected context: Reduced from ~47k characters to ~16k characters
Created non-standard files (PROJECTS.md, LESSONS.md, VOICE.md) for venture status, Telegram IDs, automations, and infrastructure. These files are not auto-injected but are searchable via memory_search when relevant.
Configuration Changes
Add these settings to ~/.openclaw/openclaw.json under agents.defaults:
{
"bootstrapMaxChars": 8000,
"bootstrapTotalMaxChars": 40000,
"compaction": {
"mode": "safeguard",
"reserveTokensFloor": 20000,
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000,
"systemPrompt": "Session nearing compaction. Store durable memories now.",
"prompt": "Write any lasting notes to memory/YYYY-MM-DD.md; reply with NO_REPLY if nothing to store."
}
},
"memorySearch": {
// Configuration continues from source
}
}
Research Insights
The developer researched multiple sources before implementing changes:
- OpenClaw official docs for memory.md, agent-workspace.md, compaction docs, and context docs
- r/AI_Agents post "8 Ways OpenClaw Reduces Context Loss in Long-Running Agents" with the insight: "Context is a new kind of resource, like RAM."
- r/ClaudeAI post "How I solved context loss in long-running Claude agent sessions" which introduced reserveTokensFloor and a lightweight conversation-state.md session bookmark
- Arxiv paper 2602.11988v1 on agent memory management found that context files reduce task success rates by ~3% and increase inference costs by 20%+
📖 Read the full source: r/clawdbot
👀 See Also

iOS Shortcut Workaround for Sending iPhone Photos to Cowork via iCloud Sync
A developer created an iOS Shortcut called "PhoPo" that converts iPhone photos to JPEG, resizes them, and saves them to an iCloud-synced folder that Cowork can access, enabling Claude to analyze screenshots and photos from mobile devices.

vLLM Setup and Testing on 10x NVIDIA V100 Server with 320GB VRAM
A lawyer building a local AI server for legal work shares vLLM testing results on 10x Tesla V100 SXM2 32GB GPUs, detailing what works (FP16 unquantized, bitsandbytes 4-bit) and what doesn't (GPTQ, AWQ, FlashAttention2) on Volta architecture.

Configuring OpenClaw for Smooth Agent-to-Agent Communication
A Reddit user shares specific configuration settings for OpenClaw that reduce timeouts in agent-to-agent communication, including tool visibility settings, memory directives, and workarounds for the ANNOUNCE_SKIP limitation.

Free OpenClaw Gateway with Local LLM on Oracle Cloud
A developer shares how to run OpenClaw Gateway with a local Qwen3.5 27B A3B 4-bit LLM on Oracle Cloud's free tier using a VM.Standard.A2.Flex instance with 4 OCPUs, 24GB RAM, and 200GB SSD, managed remotely via the QCAI app.