No Plugins Needed, I Built a Fully Automated Coding Loop in OpenCode A developer built a fully automated coding loop inside OpenCode using DeepSeek-V4 models, implementing a three-loop system inspired by Andrew Ng's breakdown of Loop Engineering. The system enables autonomous code implementation, engineer feedback, and external feedback loops without plugins, achieving high-quality results at low cost. Harness Engineering https://www.dataleadsfuture.com/tag/harness-engineering/ No Plugins Needed, I Built a Fully Automated Coding Loop in OpenCode Using DeepSeek-V4 for low-cost Loop Engineering Today I want to talk about how I built an agentic coding loop inside OpenCode. People call this Loop Engineering. To show you how well this coding loop holds up, I used DeepSeek-V4-Pro and DeepSeek-V4-Flash for every example in this article. It turns out that with the right design, DeepSeek models can pull off high-quality coding loops at a very low cost. All the source code in this article is available at the end of the post. Let's get into it. Introduction If you've been following the AI agent space recently, you've probably heard the term Loop Engineering. Claude Code and OpenClaw both mention it. But nobody really explains what it means. Until Andrew Ng posted a clear breakdown of what Loop Engineering actually is. https://www.deeplearning.ai/the-batch/issue-359?ref=dataleadsfuture.com That post gave me the direction I needed to build it inside OpenCode. What Andrew Ng Says About the Coding Loop Andrew Ng's explanation centers around this diagram: Three loops, simply put: - The first loop is the code agent's implementation loop. You give the agent a product spec and a measurable target. The agent starts building features on its own, runs tests, and keeps iterating until every requirement in the spec is met. - The second loop is the engineer feedback loop. Here the engineer acts as QA for their own product. They test what the coding agent built, and check if it matches their vision. If something is off, they write a new spec and kick off another round in the first loop. - The third loop is the external feedback loop. Once the engineer is happy with the product, it goes to the open-source community or gets handed to a product team. Real user feedback comes in. The engineer collects that feedback regularly, feeds it back into the engineer feedback loop, and from there back into the code implementation loop. All three loops keep running. With AI in the mix, they push the product forward until it gets to where it needs to be. My Take on the Coding Loop The way I see it, these three loops map to two commands in Claude or Codex: /goal and /loop . /goal covers the first and second loops. Once a user writes a product requirements doc or a spec, they pass the task to the agent through the /goal command. The agent iterates on its own, runs its own tests, and opens a Pull Request. Then the engineer reviews the code and tests it manually. If everything looks good, they merge the PR and ship. Next comes the external feedback loop. You can use the /loop command to set up scheduled tasks that pull issues from GitHub or Jira on a timer. The agent turns those issues into requirement docs, and /goal takes it from there. There is a gap in the traditional understanding here. When a user calls /goal , they just pass in what they want done. How it gets done, and what the exit condition is, often gets left up to a strong reasoning model like Claude Opus or GPT 5.5 to figure out. But in a proper coding loop, you need to give the agent a product spec and a measurable completion target so it knows when to exit. Something like this: /goal Use the spec I wrote to build this chess game. Use Playwright MCP for end-to-end testing. Verify the game supports castling, pawn promotion, checkmate, stalemate, and rating calculation. Fix any bugs found during testing and re-run. Loop no more than 20 times. That is a solid starting instruction for a coding loop. It needs a goal, a verification method, and a max iteration count. And you have to write something like that every single time, either right after the /goal command or inside the spec itself. In my OpenCode version, I am not going that route. I just want to tell /goal what I want. The agent handles everything else. The rest of this article shows you how I built that enhanced /goal loop. The /loop command is a separate topic I will cover in a future post. See the Final Result First Before getting into the implementation, let me show you what the /goal command actually does in a few scenarios, from simple to complex. 1. Write a Fibonacci script This test checks whether the agent picks the best algorithm. The prompt is: /goal Write a Fibonacci calculation script with the best possible performance. 2. Build a Tower of Hanoi web game Everyone knows this game. You could honestly just prompt an LLM directly and get it built. But that predictability is exactly what makes it useful for testing whether each step of the coding loop is working correctly. The prompt is: /goal Build a playable Tower of Hanoi web game. 3. Build a chess web game Maybe you are not impressed by the Tower of Hanoi example, since a regular prompt to any frontier model can do the same thing without a coding loop. Fair. The chess game experiment is something you should actually try for yourself. The prompt is: /goal Build a playable chess web game. Include easy, medium, and hard difficulty levels. No online multiplayer needed. Use a Python backend as the AI engine. In this experiment, OpenCode first does a quick requirements check with the user after receiving the task. It offers suggestions along the way so you can just click next. Once the full requirements list is confirmed, it enters autonomous mode. It handles architecture design, builds each feature module, runs unit tests, edge case tests, and end-to-end tests. It only hands the result back to the user when everything passes. Pretty cool, right? Want to know how it works? Let's go. Building the Coding Loop Overall design OpenCode updates very fast. Almost every release breaks something or introduces small bugs. So I am not building yet another OpenCode plugin, since a plugin can easily break after an update. The good news is that OpenCode lets you define commands and agents using plain Markdown files. Write a few lines of prompts, save the file as Markdown, and drop it in the right directory. That mechanism is the foundation for building a powerful coding loop on the cheap. Let me walk you through the interaction flow of the whole loop. When a user runs /goal