Development · Framework
The Coding Agent Harness
Context engineering framework for making AI coding agents reliable at scale
A practitioner framework for structuring the environment, context, and guardrails around AI coding agents. Grounded in a large-scale enterprise rollout across 20,000 developers, it focuses on context budgeting and four core control levers to prevent degraded performance and hallucinations. It treats the agent as a capable hire that needs onboarding via structured rules, targeted tools, on-demand skills, and detailed specifications.
The framework
Core claim: consistent results with coding agents come not from the model/IDE but the harness — the engineered system of context, tools and guardrails around the agent. Mental model: the agent is a brilliant new hire with zero context; onboard it. Agent loop (Claude Code, Cursor, Codex): Read → Plan → Code → Validate → Iterate, all consuming a finite context window. Context consumers: system prompt/rules (injected every turn), tool definitions (each MCP server adds schemas), conversation history (linear), tool results (a big file read costs thousands of tokens), agent's own output. Context rot: accuracy degrades as the window fills; ~60% utilization may make the agent actively worse (ref: morphllm.com/context-rot). FOUR LEVERS: 1) Custom rules (cursor/rules, AGENTS.md, CLAUDE.md) — inject tech stack, architecture, naming/style, testing philosophy, codebase pitfalls, anti-patterns; exclude full API docs, obvious instructions, contradictory rules; keep under 500 lines; make modular by concern; use few-shot examples; not everything always-on — move context-heavy detail to skills. Rules are living documents improved after each agent mistake. 2) MCP servers — give the agent tools beyond file read/write: DB schema queries, internal docs/wiki, API contracts, CI/CD, Figma specs, testing its implementation; bridges agent and org knowledge, and enables validation. 3) Skills — a directory with SKILL.md bundling templates, examples, docs and executable scripts; only a short description stays in context, full content loads on demand; reference skills (knowledge) vs task skills (step-by-step); can run in isolated subagents with clean context; 'programmable, context-aware, composable units of agent behavior'. 4) Spec Driven Development — write detailed specs before any code: what, integration with existing code, edge cases, acceptance criteria, test plan; 'the spec becomes the harness', consolidating rules + guidance + acceptance criteria in one artifact; can use the agent to write specs; motivated by underspecified prompts causing predictable agent mistakes (e.g. missing idempotency). FEEDBACK LOOP: tests, linters, type checkers, builds — every pass/fail signal lets the agent self-correct, reducing human-in-the-loop. Agent hooks enforce it: a Stop hook that runs validation means the agent literally cannot finish until checks pass. AT MERCADOLIBRE (~20,000 devs, thousands of repos): org-level standardized rules per technology (9+ stacks, internal libraries, review standards; teams inherit + layer repo rules; over-specific rules can break legacy projects); internal MCP servers exposing their internal cloud/dev platform context; SDD rolling out to ~4,000 devs. Promised follow-ups: SDD in depth, and the feedback loop (hooks, review agents, Stop hook patterns).
What it's for
- Configure project-level context files like CLAUDE.md, AGENTS.md, or .cursorrules effectively
- Reduce agent hallucinations caused by context window degradation and token bloat
- Standardize AI developer tooling across large engineering teams and multiple tech stacks
- Set up automated validation hooks that force agents to self-correct before completing tasks
Key points
- Context window management strategies to avoid performance degradation at high token utilization
- Modular custom rule design kept under 500 lines and updated iteratively based on mistakes
- MCP server integration to expose internal documentation, schemas, and CI/CD tools on demand
- Skill directories that package deep reference knowledge and scripts out-of-context until needed
- Spec-Driven Development (SDD) workflow to define integration constraints and test plans upfront
- Automated feedback loops and Stop hooks using linters, types, and tests for self-correction
Pricing
Free
Details
- Type
- Framework
- Category
- Development
- Topic
- AI Coding Workflows
- Open source
- No
- Platforms
- other
- For
- Software engineers, tech leads, and platform teams rolling out AI coding tools
- Tags
- context engineering, coding agents, cursor, claude code, developer tools, prompts
Why it was saved
- @juliandeangeIis: Complete, opinionated playbook (four levers + feedback loop) grounded in a ~20,000-developer rollout; useful for teams configuring Claude Code, Cursor, Codex etc.
Related
Practical eight-step setup and workflow guide for building MVPs with Cursor
Battle-tested Claude Code workflow tips directly from the tool's creator
An 8-step framework for building apps with AI using structured documentation
A practical reference guide and configuration framework for Claude Code power users.
Agent-first control plane backed by 2,400+ curated AI developer skills
Open directory and CLI for discovering and installing AI agent skills
Updated