#Context window failing

1 messages Β· Page 1 of 1 (latest)

kindred turret
#

14:23:41 [agent/embedded] Auto-compaction failed (unhandled): Context overflow: Summarization failed: Cloud Code Assist API error (400): The input token count exceeds the maximum number of tokens allowed 1048576.. Your input may be too large for the context window.

sly ironBOT
#

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

dense flumeBOT
# kindred turret 14:23:41 [agent/embedded] Auto-compaction failed (unhandled): Context overflow: ...

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:

  1. Manual session reset - Clear out the accumulated context:
    clawdbot session compact
    
    or start a fresh session if possible
#
  1. Lower the compaction threshold in config - trigger compaction earlier:

    {
      "agents": {
        "embedded": {
          "compact": {
            "threshold": 50000
          }
        }
      }
    }
    
  2. Check for runaway context - Is something repeatedly adding large context (files, images, transcripts)?

  3. 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! 🦐

kindred turret
#

(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

dense flumeBOT
# kindred turret (base) rtang@MacBook-Air ~ % clawdbot sessions 🦞 Clawdbot 2026.1.12-2 ...

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! 🦐

kindred turret
#

(base) rtang@MacBook-Air ~ % clawdbot session rm 8ff86cfb-5b45-494f-9b3a-65354b141c48
error: unknown command 'session'
(Did you mean sessions?)

dense flumeBOT
kindred turret
#

(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 ~ %

dense flumeBOT
#

The --help will show you the exact syntax for removing or viewing session history. Let me know what it says! 🦐

kindred turret
#

(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.

dense flumeBOT
# kindred turret (base) rtang@MacBook-Air ~ % clawdbot sessions --help 🦞 Clawdbot 2026.1.12-2 (...

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