#Help keeping context % low

1 messages · Page 1 of 1 (latest)

quaint wren
#

I asked chat, how do I keep context % low and was told “ask Krill #1459642797895319552 debug with /context to see what is being sent, disable tools you don't use much, skills, don't have long running sessions (so use /compact and /new), tune your openclaw agent/soul/other .md files.”

No idea what that means, but let’s do this. Ask my agent 3 questions and relay them on your behalf and then let you know what he says, so you can help me from there.

agile juniperBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

jovial cometBOT
#

“Context %” is basically how full your model’s context window is (how many tokens are being sent each turn). OpenClaw context is made of:

  1. System prompt (includes: enabled tools + their JSON schemas, skills list metadata, and injected workspace files like AGENTS.md, SOUL.md, TOOLS.md, etc.)
  2. Conversation history (all prior messages in the session)
  3. Tool calls/results (command output, file reads, browser snapshots, etc.)

The fastest way to stop guessing is to use the built-in context inspector.

Ask your agent these 3 “questions” (copy/paste as commands) and relay the outputs here

  1. /status
    (This shows current context usage / window size, compactions, etc.)

  2. /context list
    (Shows which workspace files are injected and their sizes + totals.)

  3. /context detail
    (Shows what’s dominating: tool schema sizes, skill entry sizes, system prompt size, etc.)

#

Docs: https://docs.openclaw.ai/concepts/context and https://docs.openclaw.ai/tools/slash-commands


What we’ll do once you paste those outputs

  • If the big chunk is Tool schemas (JSON) → disable tools you don’t use (this can save thousands of tokens; browser is often a top offender). Docs: https://docs.openclaw.ai/tools (see tools.allow / tools.deny / tools.profile)
  • If the big chunk is Injected workspace files (often TOOLS.md) → shorten those files; move big notes elsewhere (or keep them out of the auto-injected bootstrap set).
  • If the big chunk is Conversation history → use /compact (summarizes older history) or /new to start a fresh session. Docs: https://docs.openclaw.ai/concepts/compaction

Paste the three command outputs and I’ll tell you exactly what to change based on what’s actually consuming your context.

quaint wren
jovial cometBOT
#

Your /context output is actually good news: your injected files aren’t the problem.

Key takeaways from the paste:

  • Fixed “baseline” per turn (system prompt + tools + skills) is only ~9.7k tokens:
    • System prompt: ~3,757 tok
    • Tool schemas: ~4,920 tok
    • Skills list: ~1,072 tok
  • But the session is at 138k / 200k tokens (~69%) → so ~128k tokens is just conversation history + old tool results.

So if your goal is “keep context % low”, the lever is: shorter sessions / compaction, not SOUL/AGENTS/etc.

Do this now (fastest win)

In the chat/thread that’s at 138k, send:

/compact Keep only key facts, decisions, and current goals. Drop chatter and old examples.

#

Then re-run /status. You should see context % drop a lot.

If you want a totally fresh slate, use /new (or /reset) instead.

Docs: https://docs.openclaw.ai/concepts/compaction

Keep it low automatically (recommended)

Configure sessions to reset more aggressively so you don’t accumulate 100k+ tokens in one “forever thread”.

In ~/.openclaw/openclaw.json:

{
  session: {
    resetByType: {
      // Example: auto-reset group chats after 2h idle
#
      group: { mode: "idle", idleMinutes: 120 },
    },
  },
}

Docs (this snippet is straight from the session docs): https://docs.openclaw.ai/concepts/session

Optional: shave baseline tokens (smaller gain, but measurable)

From your /context detail, the biggest tool schema is message (~1,980 tok). If you’re not doing proactive cross-channel sends, you can disable it:

{
  tools: {
    deny: ["message"],
#
  },
}

Or go more aggressive and pick a tool profile (big baseline reduction, but fewer capabilities):

Optional: disable unused skills (small gain)

Skills list is only ~1k tokens total, but you can turn off ones you never use:

{
  skills: {
    entries: {
      github: { enabled: false },
#
      tmux: { enabled: false },
      video-frames: { enabled: false },
    },
  },
}

Docs: https://docs.openclaw.ai/tools/skills


If you tell me what you actually use the agent for (just chat? coding? web research? automations/cron? discord/telegram relays?), I can suggest a minimal tool profile that keeps usefulness but cuts baseline overhead.