Skip to main content
LLMs degrade as context windows fill up. The more history an agent accumulates, the more likely it is to lose focus, repeat mistakes, or forget earlier instructions. Twill addresses this through deliberate context management.

Sub-Agent Architecture

Instead of one agent doing everything, Twill splits work across specialized sub-agents:
  • Planning Agent — Analyzes the codebase and creates an implementation plan
  • Code Agent — Implements the approved plan step-by-step
  • Verifier Agent — Runs tests, linting, type checking, and builds
  • Critique Agent — Reviews logical correctness and alignment with the goal
Each sub-agent starts with a focused context containing only what it needs. The planning agent doesn’t carry implementation details. The code agent doesn’t carry verification logs. This keeps each agent operating in its optimal context range.

Verification Loops

After implementation, the verifier and critique agents check the work. If issues are found:
  1. Results are summarized (not dumped verbatim)
  2. Code agent receives a focused description of what to fix
  3. Agent makes corrections
  4. Verification runs again
This loop continues until everything passes. The key is that each iteration starts with a clean, relevant context—not an ever-growing log of previous attempts.

Why This Matters

A single agent running for hours will accumulate thousands of tokens of context: file contents, command outputs, error messages, previous attempts. By the time it’s debugging its third issue, it’s operating with degraded attention. Sub-agents avoid this. Each one runs, completes its task, and hands off a summary. The next agent starts fresh with exactly the context it needs.