AI · Framework
Agent Harness is the Real Product
Architectural breakdown of AI agent harnesses, scaffolds, and context management patterns.
An in-depth technical analysis examining how top coding and generalist agent teams (including Claude Code, Cursor, Manus, and SWE-Agent) engineer their runtime scaffolding. It argues that execution harnesses—covering tool design, context injection, and KV-cache optimization—matter far more to benchmark performance than model choice alone. It highlights practical harness techniques like progressive disclosure, observation compression, and progress-anchoring tools.
The framework
Core claim: 'The model is interchangeable. The harness is the product.' Evidence: Claude Opus 4.5 scores 42% on CORE-Bench with one scaffold and 78% with another; Cursor's lazy tool loading cuts token usage by 46.9%; Vercel deleted 80% of their agent's tools and it went from failing to completing tasks.
HARNESS DEFINITION (Harrison Chase/LangChain): frameworks are unopinionated abstractions; harnesses are batteries included. Harness = execution loop, tool definitions, error recovery, state management, information flow. Core loop: while(model returns tool calls): execute tool → capture result → append to context → call model again.
CLAUDE CODE ('The Model Controls the Loop'): single flat message list, ~18 primitive tools in four categories (CLI discovery: Bash/Glob/Grep/LS; file interaction: Read/Write/Edit/MultiEdit; web: WebSearch/WebFetch; orchestration: TodoWrite/Task). Primitives over integrations; ripgrep over vector DBs. Six context layers at session start (org policies, project CLAUDE.md, user settings, MEMORY.md, session history, git state); system prompt ~110+ conditional strings, ~2,896 token core. System reminders injected after every tool call (higher adherence than system-prompt instructions). TodoWrite is a no-op tool that serves as a 'progress anchor' — pure harness-level trick to keep the agent on plan.
CURSOR ('Files as the Fundamental Primitive'): five components (Router, LLM, 10+ tools, context retrieval, ReAct-style orchestrator). Model-specific harness tuning per frontier model (different tool names, prompts, guidance per model). Files as context primitive — searchable, groupable, versionable. Custom semantic search embedding model trained on agent session traces: 12.5% higher search accuracy, 2.6% higher code retention on 1,000+ file codebases.
MANUS ('KV-Cache Above All Else'): ~100:1 input-to-output token ratio. Logit masking over tool removal — all ~29 tools permanently loaded (removing tools invalidates KV-cache); per-step availability via output token probability masking; consistent prefixes (browser_*, shell_*, file_*) for group masking. Hierarchical action space: Level 1 ~20 atomic tools; Level 2 sandbox utilities via Bash (grep, ffmpeg, mcp-cli); Level 3 dynamic scripts. Biggest gains came from removing things (complex tool defs → shell, management agents → simple handoffs).
SWE-AGENT ('The Agent-Computer Interface', NeurIPS 2024): linter-gated edits (syntactically invalid edits rejected; without it performance drops 3%). Observation compression: all but last 5 observations collapsed to one line each.
OTHERS: Devin — isolated cloud VMs, Playbooks, Knowledge Management System, 67% PR merge rate (up from 34%). Windsurf — two-agent architecture (background planning agent + primary actor), cross-session 'Memories'. Aider — PageRank-based repo map via tree-sitter, binary search to fit token budget. Replit Agent — three-agent architecture (Manager, Editor, Verifier), self-healing loop: generate → execute → test with Playwright → fix → rerun.
PROGRESSIVE DISCLOSURE: borrowed from UI/UX (John Carroll at IBM, 1980s; Jakob Nielsen, 1990s). Show only what is needed now; reveal complexity on demand. Implementations: Claude Code SKILL.md pattern (skills in .claude/skills/ load only on relevance detection, unlike always-loaded CLAUDE.md); Cursor lazy MCP tool loading (tool names as static context, full definitions fetched on demand, 46.9% token reduction); Manus filesystem offloading (reversible compression: drop content if URL preserved, omit document if file path remains; todo.md rewriting pushes plan into recent attention, countering 'lost in the middle').
What it's for
- Design effective agent scaffolds, execution loops, and context layers for coding assistants
- Reduce agent token usage and improve KV-cache hit rates using progressive disclosure techniques
- Structure tool definitions and error-recovery loops to prevent agent hallucinations and task drift
Key points
- Detailed analysis of Claude Code's flat message architecture, primitive tools, and prompt injection techniques
- Breakdown of Cursor's custom semantic search embeddings and lazy MCP tool loading
- Review of Manus's KV-cache optimization strategies, logit masking, and filesystem offloading
- Architectural highlights from SWE-Agent, Devin, Windsurf, Aider, and Replit Agent
- Deep dive into progressive disclosure patterns adapted from UI/UX to keep token contexts lean
Pricing
Free
Details
- Type
- Framework
- Category
- AI
- Topic
- Agent Architecture
- Open source
- No
- Platforms
- other
- For
- AI engineers, systems architects, and developers building autonomous LLM agents.
- Tags
- ai agents, agent scaffolding, context engineering, claude code, cursor, llm architecture
Why it was saved
- @himanshutwtxs: A consolidated, source-linked reference on harness design choices of Claude Code, Cursor, Manus, SWE-Agent, Devin, Windsurf, Aider and Replit, with quantitative evidence that harness decisions outweigh model choice.
Related
Open-source capability layer giving AI agents access to browse and scrape platforms
Comparative framework of context engineering strategies across six leading AI agent companies.
Curated reading list of core engineering essays on agent context management.
Official repository for Anthropic Agent Skills and Claude Code plugin templates
Design inspiration MCP server and archive for AI coding agents.
Curated collection of skills, tools, and plugins for Claude workflows
Updated