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.
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).
Ask me about the code, bugs, or concepts.
I'll guide you in plain English, no code output.
Budget: 50K tokens per lab