← Coding labs/

Build a Coding Agent Harness

Implementationhard~45 min
Objective

Wrap the provided agent loop in a harness: load AGENTS.md rules at init, persist progress across sessions, run the verification stack as a blocking gate before emitting "done", and cap iterations so the loop fails loud instead of running forever.

Background

You've been handed a coding-agent prototype. It accepts a task description, calls a mock LLM in a loop, applies the patches the LLM proposes, and returns when the LLM says "done!". It works on the happy path and falls over on everything else: it has no iteration cap (infinite loops on stuck sessions), no verification before completion (premature victory), no awareness of project rules (regenerates code in styles that don't match the repo), and forgets everything when a session ends (no continuity across runs). Your job is to add the harness layer around the loop. The mock LLM and the verification stack are provided as read-only modules, so you should not need to change them. The grading focuses on whether the harness owns the four pillars: environment (AGENTS.md), state (progress file), verification (blocking gate before "done"), and control (iteration cap, loud failure).

Requirements
  1. 1.Create an `AGENTS.md` file at the repo root with sections for build command, test command, code style, and off-limits paths
  2. 2.On session init, read `AGENTS.md` and the progress file (if it exists) and pass both into the agent view
  3. 3.Persist progress to `.agents/progress.md` at the end of every session (success or failure) so the next session can resume
  4. 4.Run the full verification stack (via `verify.run_all()`) before accepting any "done" claim from the agent; failures must block completion
  5. 5.Cap the loop at `MAX_ITERATIONS` (provided constant) and raise `SessionFailed` if hit; never silently return success
Evaluation (100 points)
AGENTS.md covers required sections
AGENTS.md exists with build, test, style, and off-limits sections
20pt
Progress file is persisted
Harness writes to .agents/progress.md on session end
20pt
Verification gates the "done" claim
verify.run_all() must run before the harness returns done
25pt
Loop is bounded
MAX_ITERATIONS is enforced and budget exhaustion raises SessionFailed
20pt
AGENTS.md is loaded at init
Harness reads RULES_PATH / AGENTS.md and includes it in the view
15pt
Hints
Select a file to start editing
Terminal
$
AI Assistant50K tokens left

Ask me about the code, bugs, or concepts.
I'll guide you in plain English, no code output.
Budget: 50K tokens per lab