test-repo/openclaw-context-management-guide.md

2.8 KiB

How to Never Hit OpenClaw's 150K Context Limit

Source: X Thread by Johann Sathianathen
Date: February 21, 2026
URL: https://x.com/johann_sath/status/2025440759416045702


The Problem

Most OpenClaw users hit 150K context in a single conversation and wonder why their agent gets dumber. The solution isn't a bigger window—it's never needing one.


The 5 Strategies

1. Add "Orchestrator" Pattern to SOUL.md

File: SOUL.md
Add: "You are the orchestrator. Subagents execute."

Why it works:

  • Main session stays lean
  • Heavy work runs in fresh context windows
  • Subagents spawn, work, report back, context dies

Result: Main session runs 24/7 without bloat


2. Use BRAIN.md as External Memory

File: BRAIN.md
Pattern: Agent reads & writes instead of remembering everything in-context

Why it works:

  • Offloads memory from context to disk
  • Agent references files instead of recalling
  • Structured storage for complex state

3. Set Up Heartbeats

Pattern: Fast check-ins (<3s) that don't load files unless you're idle

Implementation:

  • Only check critical items
  • Skip file reads unless necessary
  • Batch multiple checks together

Benefit: Keeps session responsive without context bloat


4. Run Cron Jobs Isolated

Pattern: Each cron job gets its own session

Why it works:

  • Never bloats main thread
  • Independent execution contexts
  • Parallel processing without interference

5. Delegate Everything to Subagents

Pattern: Subagent spawns → does work → reports back → context dies

Flow:

  1. Main session identifies task
  2. Spawns subagent with specific goal
  3. Subagent completes work in isolation
  4. Reports results back
  5. Subagent context garbage collected

The Result

Johann's main session:

  • Runs 24/7
  • Rarely passes 30K context
  • Stays responsive and smart

Key insight: The trick isn't a bigger window. It's never needing one.


Implementation Checklist

  • Add orchestrator pattern to SOUL.md
  • Create/improve BRAIN.md for external memory
  • Audit heartbeats for efficiency (<3s checks)
  • Review cron jobs for isolation
  • Identify opportunities for subagent delegation

  • SOUL.md Guide: https://soul.md (defining AI identity)
  • Johann's Weekly Newsletter: https://johann.fyi
  • Author: Building dmpro.ai (ex-Cisco), 1x exit, founder @jars_global

Key Takeaway

Context management isn't about having more—it's about using less by:

  1. Orchestrating instead of executing
  2. Externalizing memory
  3. Efficient polling
  4. Isolated scheduling
  5. Delegating to subagents

Compiled from X thread by Johann Sathianathen
Engagement: 5 replies, 5 reposts, 60 likes, 199 bookmarks, 5,198 views