#Context window failing
1 messages Β· Page 1 of 1 (latest)
That looks like a rough context overflow issue! π¦ Let me help you unpack what's happening here.
What's going on:
The embedded agent's context got so large (>1M tokens!) that auto-compaction couldn't even run - the summarizer itself choked on the massive context trying to compress it.
Common causes:
- Lots of conversation history piled up
- Large code snippets, files, or data being processed repeatedly
- Compaction tried to run too late (context already huge)
Quick fixes to try:
- Manual session reset - Clear out the accumulated context:
or start a fresh session if possibleclawdbot session compact
-
Lower the compaction threshold in config - trigger compaction earlier:
{ "agents": { "embedded": { "compact": { "threshold": 50000 } } } } -
Check for runaway context - Is something repeatedly adding large context (files, images, transcripts)?
-
Restart the agent if you can - clears context entirely
The 1M token limit being exceeded means this built up over time. Setting a lower compaction threshold helps prevent it from getting to this point.
Let me know if you want me to dig deeper into any of these! π¦
(base) rtang@MacBook-Air ~ % clawdbot sessions
π¦ Clawdbot 2026.1.12-2 (unknown) β If you can describe it, I can probably automate itβor at least make it funnier.
Session store: /Users/rtang/.clawdbot/agents/main/sessions/sessions.json
Sessions listed: 4
Kind Key Age Model Tokens (ctx %) Flags
direct agent:main:main 2m ago gemini-3-flash 363k/1049k (35%) system id:0930d1be-3971-41ef-a710-da992757bca4
direct agent:main:subag...a593f0 41h ago gemini-3-flash-preview 237k/1049k (23%) id:8ff86cfb-5b45-494f-9b3a-65354b141c48
direct agent:main:subag...f1190b 41h ago gemini-3-pro-high - id:19ddcf98-11df-4854-9e9b-e9fd0c4d61ca
direct main 2d ago gemini-3-flash-preview 21k/1049k (2%) id:77651adb-5d7b-4b7d-93c7-9bf805f603e5
Got it! The issue is those 41-hour-old subagent sessions - they're still hanging around with 237k+ tokens each. That's your context bloat right there.
Quick fix - clean up old sessions:
# Remove those zombie subagent sessions
clawdbot session rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
clawdbot session rm 19ddcf98-11df-4854-9e9b-e9fd0c4d61ca
Or just nuke them all and start fresh:
clawdbot session clear
To prevent this going forward:
Add a cron job to auto-cleanup old sessions:
# Clean sessions older than 6 hours daily
clawdbot cron add --name "session-cleanup" --schedule "0 4 * * *" \
--command 'clawdbot session rm $(clawdbot session list --kind subagent --ago 6h --format json | jq -r ".[].id")'
Those 41-hour subagents are the culprits - they accumulated context over nearly 2 days without being cleared. Delete them and your context usage should drop back to healthy levels! π¦
(base) rtang@MacBook-Air ~ % clawdbot session rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
error: unknown command 'session'
(Did you mean sessions?)
Ah, it's sessions (plural)! Try:
clawdbot sessions rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
clawdbot sessions rm 19ddcf98-11df-4854-9e9b-e9fd0c4d61ca
Or if you want to be surgical about it - check what's in those sessions first:
clawdbot sessions history 8ff86cfb-5b45-494f-9b3a-65354b141c48
That'll show you what accumulated in there before you delete it. π¦
(base) rtang@MacBook-Air ~ % clawdbot sessions history 8ff86cfb-5b45-494f-9b3a-65354b141c48
error: too many arguments for 'sessions'. Expected 0 arguments but got 2.
(base) rtang@MacBook-Air ~ % clawdbot sessions rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
error: too many arguments for 'sessions'. Expected 0 arguments but got 2.
(base) rtang@MacBook-Air ~ %
Hmm, the CLI syntax is being finicky! Let me suggest checking the help:
clawdbot sessions --help
Or try the singular form since the error mentioned "Did you mean sessions?":
clawdbot session --help
It might use flags instead of positional args, like:
clawdbot sessions --rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
The --help will show you the exact syntax for removing or viewing session history. Let me know what it says! π¦
(base) rtang@MacBook-Air ~ % clawdbot sessions --help
π¦ Clawdbot 2026.1.12-2 (unknown) β I run on caffeine, JSON5, and the audacity of "it worked on my machine."
Usage: clawdbot sessions [options]
List stored conversation sessions
Options:
--json Output as JSON (default: false)
--verbose Verbose logging (default: false)
--store <path> Path to session store (default: resolved from config)
--active <minutes> Only show sessions updated within the past N minutes
-h, --help display help for command
Examples:
clawdbot sessions # list all sessions
clawdbot sessions --active 120 # only last 2 hours
clawdbot sessions --json # machine-readable output
clawdbot sessions --store ./tmp/sessions.json
Shows token usage per session when the agent reports it; set agents.defaults.contextTokens to see % of your model window.
Ah, clawdbot sessions is just for listing - there's no built-in delete/history commands! You'll need to manually edit the session store.
Option 1: Edit the JSON file directly
The session store is at: ~/.clawdbot/agents/main/sessions/sessions.json
Open it and delete the old subagent session entries (the two with IDs starting with 8ff86cfb- and 19ddcf98-).
Option 2: Nuclear option - clear everything
rm ~/.clawdbot/agents/main/sessions/sessions.json
clawdbot sessions # will recreate the file
Option 3: Check the file first