All insights
AI Product Building AI Agents Coding Tools

One session per contract beats long-running agent sessions

Fresh context per task contract outperforms 24-hour agent sessions because cross-contract context bloat degrades performance by construction

@systematicls — How To Be A World-Class Agentic Engineer · · 4 connections

Long-running 24-hour agent sessions force context bloat by introducing context from unrelated contracts into the same session. The better architecture: define task contracts (with tests, screenshots, and verification criteria as completion conditions), use stop-hooks to prevent termination until the contract is fulfilled, and create a new session for each contract. An orchestration layer handles spawning new contracts whenever something needs to be done and creating fresh sessions to work on them.

This extends Autonomous coding loops need small stories and fast feedback to work with a specific mechanism — the contract as the unit of work and the session boundary as the context hygiene tool. The stop-hook pattern ensures agents reach genuine completion rather than implementing stubs, connecting to Spec files are external memory that survives context resets where the spec IS the contract. The orchestration layer that spawns sessions per contract is a lightweight instance of An orchestrator agent that manages other agents solves the parallel coordination problem without human bottleneck.