Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseCode / SDK · ActionableHabr AI→ original

How to Make an AI Agent Finish the Job: 12-Minute Autotests and Manual Merge

Agents often say "done" when the code hasn't been verified, so the author of an online shooter wrapped the model in a harness: a set of rules and checks. The agent writes code and tests, spins up the game in Docker, and runs end-to-end e2e tests, where bots play a full match that lasts about 12 minutes. The agent then opens a PR (pull request, a request to merge code), but only a human presses merge. The takeaway: trust an agent only as much as the checks it has passed.

AI-processed from Habr AI; edited by Hamidun News
How to Make an AI Agent Finish the Job: 12-Minute Autotests and Manual Merge
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1E2e tests are needed only when game logic changes, not for frontend edits
Key metric #2After roughly 60% of the context window is filled, the model's attention drops
Key metric #3Tasks live in docs/tasks as separate short md files

A neural network that writes code loves to say "done" after the very first run, even if it has broken a neighboring module. The author of an online shooter, built almost entirely with AI, solved this problem by wrapping the model in a harness: a set of rules, tools, and checks that guides the agent step by step. In his case, the agent writes code and tests, spins up the game in Docker, and runs end-to-end (e2e) tests.

In these tests, bots join the game and play a real match, which lasts about 12 minutes. After that, the agent opens a PR (pull request, a request to merge code into the main branch), and only a human presses the merge button. The approach will be useful to anyone who hands real tasks to agents and counts tokens.

What a harness is, in simple terms

The analysis is built on a formula: agent equals LLM plus harness. The model can reason, but everything else is handled by the wrapper: it runs the call loop, launches tools, assembles context, stores memory and cache, and checks the result. According to the author, the term took hold in early 2026 after texts by Mitchell Hashimoto of HashiCorp, OpenAI's report on Codex, and LangChain articles.

The author identifies five components:

  • the loop: the model is called until the task is complete or a limit is reached;
  • tools: handling the tool_call from the model and running the tool's code;
  • context: assembling the prompt with all the wrappers taken into account;
  • constraints: roles and token budgets;
  • checks: LLM as judge and guardrails.

Big players already have harnesses: Claude Code from Anthropic and Codex from OpenAI. Even uploading a file to a chat hides a lot of logic: saving it, reading it, recognizing text via OCR or a Vision model, putting it in S3, and checking whether the file fits into the context. For typical tasks, a one-shot prompt is enough. But when you need a process tailored to a specific product, a standard harness is not enough, and you have to build out your own.

How customization for a project works

The first step is a claude.md (or agents.md) file: instructions that are injected into the prompt on every request. The author gives a clear example: the rule "always start your answer with !", and the agent indeed replies "!Hello, how can I help you?" This is how basic rules get fixed so the agent almost never forgets them.

The second step is setting up tasks. You can take a framework like openspec, but for a single project in a monorepo, a /docs folder is enough. claude.md contains a rule: start with the main file in docs, which holds cross-references to the other documents (feature status, architecture). Each task is a separate small md file in docs/tasks. This saves context: according to the author's experience, after about 60% of the window is filled, the model's attention starts to "get lost," and then you need a new chat or dialogue compression with the compact skill.

The author's own pipeline is mostly linear:

  1. He sets the task in the chat and runs a grilling session (a series of clarifying questions) using a plugin with skills from Matt Pocock.
  2. The agent reads the task and, if needed, calls skills like system-design.
  3. It assembles a mockup via claude design, then writes code and tests.
  4. It prepares the release: bumps the package version and writes the changelog.
  5. It spins up the local stack in Docker and runs static checks.
  6. If server-side code for game mechanics was changed, it runs e2e: real sessions are created on the local stack, and bots with scenarios join them.
  7. It creates a PR into master, where linters run again.
  8. Only a human presses merge, after which the deployment happens.

Three conclusions and honest caveats

First, "done" has to be proven. An agent may violate an instruction, but a failing or suspiciously rewritten test in the pipeline will be visible. Unit and e2e tests, and static analyzers like SonarQube, form a layer you can trust more than the model's words.

Second, the harness grows with the project. For example, the e2e tests take about 12 minutes, the length of a match. When the author changed only the frontend or backend without touching game logic, they weren't needed, so the rule "run only when mechanics change" was added to the harness. This is a direct saving of time and tokens on every iteration.

Third, the less unnecessary context there is, the higher the chance of getting a quality solution in fewer rounds of edits. Specifications and documentation in the repository are especially useful on low-tier subscriptions, where it matters to spend as few tokens as possible on a feature.

The caveats are obvious. This is one person's experience on one project: an online shooter with bots, where e2e is easy to automate. The author himself stresses that there is no single correct pipeline: in some places it's worth sacrificing speed for checks, and in others it's worth building a prototype faster and not looking closely at code quality.

The analysis includes no metrics such as the share of successful tasks or the cost of a feature in tokens, so this is a set of practices, not a measured result. You can start small: a claude.md with basic rules, a docs folder with short task files, and a mandatory test run before every PR.

Add the rest when the agent steps on the rake once again.

Story

Key Questions Answered

What a harness is, in simple terms?

The analysis is built on a formula: agent equals LLM plus harness. The model can reason, but everything else is handled by the wrapper: it runs the call loop, launches tools, assembles context, stores memory and cache, and checks the result. According to the author, the term took hold in early 2026 after texts by Mitchell Hashimoto of HashiCorp, OpenAI's report on Codex, and LangChain articles.

How customization for a project works?

The first step is a claude.md (or agents.md) file: instructions that are injected into the prompt on every request. The author gives a clear example: the rule "always start your answer with !", and the agent indeed replies "!Hello, how can I help you?" This is how basic rules get fixed so the agent almost never forgets them. The second step is setting up tasks. You can take a framework like openspec, but for a single project in a monorepo, a /docs folder is enough.

What are the key details on Three conclusions and honest caveats?

First, "done" has to be proven. An agent may violate an instruction, but a failing or suspiciously rewritten test in the pipeline will be visible. Unit and e2e tests, and static analyzers like SonarQube, form a layer you can trust more than the model's words. Second, the harness grows with the project. For example, the e2e tests take about 12 minutes, the length of a match.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…