Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Context Management — Agent Comparison


title: Context Management — Agent Comparison authors:


Context Management — Agent Comparison

All analyses based on source code inspection dated 2026-04-08.

Decision Guide: Which Agent for Which Use Case

NeedBest FitWhy
Long sessions, large reposClaude Code5-tier system + 1M context option + server-side editing
Multi-provider flexibilityOpenClaude200+ LLM providers with same 5-tier system
Git-centric workflowAiderGit history as session record, commit-per-change
Privacy (local-only)OpenClawConfigurable sliding window, no cloud dependency
Multi-session workKiloCodeAgent Manager with VS Code panel + git worktrees
Fast startup, simpleOpenCodeReactive compaction, clean SQLite storage
Gemini/GCP ecosystemQwen-CodeDeep Gemini integration, JSONL crash recovery

Version Tracking

AgentVersionCommit
Aiderv0.86.3.devbdb4d9ff
Claude Code(no tag)3da7e321
OpenClaude0.1.8(fork)
OpenClawv2026.4.22781897d
OpenCodev1.3.15280eb16e
KiloCodev7.1.20cb0c58c0
Qwen-Codev0.14.0e8552294

Universal Pattern: Full History Every Call

All 7 agents send the full conversation history on every API call. There is no chunking, no delta updates, no server-side session persistence. The entire message array is serialized and sent with each chat.completions.create() request.

AgentHistory SentEvidence
Qwen-CodeFull curated Content[]geminiChat.ts: contents: requestContents
AiderFull assembled contextbase_coder.py: format_chat_chunks() → all_messages()
OpenClawFull sanitized historyattempt.ts: sanitize → validate → limitHistoryTurns() → send
OpenCodeFull non-compacted historyprompt.ts: filterCompactedEffect() → toModelMessages()
KiloCodeFull non-compacted historyprompt.ts: filterCompacted() → toModelMessages()
Claude CodeFull normalized historymessages.ts: normalizeMessagesForAPI() → queryModelWithStreaming()
OpenClaudeFull normalized historymessages.ts: normalizeMessagesForAPI() → multi-provider routing

Context Window Defaults

AgentDefaultMaxSource
Qwen-Code128K1M (Qwen3-coder-plus)Regex matching on model name (tokenLimits.ts)
AiderFrom LiteLLM registryVaries by modelLiteLLM model_prices_and_context_window.json
OpenClaw200KConfigurable per-modelDEFAULT_CONTEXT_TOKENS constant
OpenCodeFrom model configVaries by modelmodel.limit.context field
KiloCodeFrom model configVaries by modelmodel.limit.context field
Claude Code200K1M ([1m] suffix)MODEL_CONTEXT_WINDOW_DEFAULT, env var override
OpenClaude200K1M ([1m] suffix + 200+ providers)MODEL_CONTEXT_WINDOW_DEFAULT, OpenAI registry

Overflow Detection

AgentPre-emptiveReactive
Qwen-CodeToken count ≥ 70% of windowError retry (up to 10×, 60s delay)
AiderPre-send token count checkContextWindowExceededError from LiteLLM
OpenClawcontextTokenBudget comparison40+ provider error patterns matched
OpenCodeToken count ≥ context − 20K15+ provider error pattern regexes
KiloCodeToken count ≥ context − 20KProvider error matching
Claude CodeHybrid: real API usage + estimate15+ patterns + ContextOverflowError type
OpenClaudeHybrid: real API usage + estimateMulti-provider error matching + Haiku fallback

Compaction Strategy Comparison

AgentPrimary MethodTriggerKeeps
Qwen-CodeAI summarization (separate LLM call)70% usageLast 30% of conversation
AiderAsync LLM summarization of done_messages> 1/16th of context (max 8192)Tail messages (recent half)
OpenClawSliding window + pi-coding-agent auto-compactConfigurable N turns + budgetLast N user turns
OpenCodeDedicated compaction agent (no tools)Token ≥ context − 20KEverything after compaction marker
KiloCodeDedicated compaction agent (no tools)Token ≥ context − 20KEverything after compaction marker
Claude Code5-tier: microcompact → API editing → session memory → full → PTL retryToken ≥ context − 13KRecent messages (prefix-preserving)
OpenClaude5-tier (Claude Code inherited) + JSONL persistenceToken ≥ context − 13KRecent messages (prefix-preserving)

Tool Output Management

AgentStrategyLimits
Qwen-CodeNo explicit truncationNone found
AiderRepo map dynamic sizingBudgeted from context window
OpenClawTool result truncation (last resort)Overflow recovery fallback
OpenCodePer-output truncation + pruning2000 lines / 50KB; prune > 40K back
KiloCodePer-output truncation + pruning2000 lines / 50KB; prune > 40K back
Claude CodeServer-side cache_edits + content clearingCount-based thresholds from GrowthBook
OpenClaudeServer-side cache_edits + content clearingCount-based thresholds from GrowthBook

Content Filtering

AgentImages/Documents/Thoughts
Qwen-Codethought: true parts stripped from history
AiderN/A (code-focused, no image support)
OpenClawStrips images during sanitization
OpenCodeStripped during compaction → [Attached mime: filename]
KiloCodeStripped during compaction → [Attached mime: filename]
Claude CodeStripped during compaction → [image] / [document]
OpenClaudeStripped during compaction → [image] / [document]

Persistence

AgentStorage
Qwen-CodeAppend-only JSONL event logs (~/.qwen/tmp/...)
AiderJSONL session file + git history
OpenClawJSONL session file (SessionManager from pi-coding-agent)
OpenCodeSQLite (MessageTable + PartTable)
KiloCodeSQLite (MessageTable + PartTable)
Claude CodeIn-memory Message[] array
OpenClaudeIn-memory Message[] + global history.jsonl (cross-project)

Unique Innovations

AgentInnovation
Qwen-CodeTree-structured JSONL with uuid/parentUuid enabling branching and checkpointing
AiderBackground async summarization that doesn’t block the main conversation loop
OpenClawPluggable ContextEngine interface with legacy + custom implementations
OpenCodeStructured summary template (Goal/Instructions/Discoveries/Accomplished/Files)
KiloCodeNearly identical to OpenCode (shared codebase — KiloCode is a fork)
Claude CodeServer-side cache editing via Anthropic API; background session memory agent that continuously maintains a summary file
OpenClaude200+ LLM provider support with same 5-tier system; cross-project JSONL history persistence