What is AI Harness? It's an AI development system that uses OpenCode to transform the out-of-control and token-burning Vibe Coding into a long-term manageable AI development system.

The AI Harness system demonstrates a controlled AI development process, contrasting it with a chaotic, out-of-control code state.
The AI Harness system demonstrates a controlled AI development process, contrasting it with a chaotic, out-of-control code state.
Photo by Dennis Eusebio on Unsplash

Last month, LangChain only changed its AI Harness architecture once, and its benchmark score jumped from 52.81 TP3T to 66.51 TP3T, and its ranking jumped from outside the top 30 to the top 5. The model and API remained unchanged—only…Adjustment of system engineering levelThe same story happened to Vercel: they reduced their AI tools from 15 to 2, increased accuracy from 80% to 100%, and made it 3.5 times faster.

This is the power of AI Harness—a set of systemic disciplines for taming AI.

Vibe Coding allows engineers to iterate quickly in Claude Code, but it brings three fatal problems: forgetting when the project becomes large (context fragmentation), unpredictable token burning (repeatedly modifying the same piece of code), and difficulty in tracking progress (no rules, all based on luck).

AI Harness is not a new model or a new framework, but a set of systems engineering disciplines: using a six-layer architecture (loop, tooling, context management, persistence, verification, and constraints) to turn probabilistic intelligence into a reliable system.

OpenCode is the answer to packaging the discipline of AI Harness into a tool. It's not another AI IDE, but a workflow container that allows you to define project memories using AGENTS.md, and to divide tasks between Agents and Subagents.Connect the tool using MCP and Skills.Use Permission as the permission boundary.

Why did Vibe Coding spiral out of control? Three fundamental reasons: amnesia, token burning, and inability to revert to the original state.

Vibe Coding performs flawlessly on individual projects or in two-week sprints, but it begins to collapse once it enters multi-month iterations. The root cause is not that the model is not smart enough, but rather that three flaws at the system design level are simultaneously triggered.

The first pitfall: Fragmented context leads to amnesia

Each time a new dialogue begins, the LLM model cannot see the context of previous decisions. Developers initially decided in dialogue A to use JWT for authentication, but when dialogue B needed to add access control, the model suggested using Session. As a result, the code was scattered across more than a dozen dialogue windows, contradicting each other. This wasn't a model problem—Claude or GPT-5.5 have excellent memory, but each dialogue is an isolated sandbox. When Vercel encountered this problem, they realized that the key to reducing the number of tools from 15 to 2 wasn't in model selection, but in recording decisions in the project-level AGENTS.md file. [7]Once the system hierarchy knows that "this project uses JWT", all subsequent conversations will automatically follow this constraint.

The second trap: Unlimited inflation of token costs

Vibe Coding's typical workflow is to "push in the entire codebase, add new requirements, and generate a new version of the model." If you upload 50KB of old code plus new task hints each time, a medium-sized project can burn through several thousand dollars in three months. Worse still, no one knows which tokens are well spent. Claude's document mentions that token cost and accuracy are not linearly related—uploading more old code doesn't necessarily improve answer quality; sometimes it even reduces it. The solution is to select models based on task difficulty. [11]Simple code style adjustments use Claude 3.5 Sonnet, while complex system designs utilize higher-order models. The Harness architecture standardizes common workflows through MCPs and Skills, eliminating the need for models to rethink the entire project state each time. [3].

The third pitfall: Version control fails, making it impossible to revert.

"The version I generated last week using Claude Code is better than today's"—developers often face this dilemma. Vibe Coding lacks the concept of version control; all conversation content is piled up in the UI, requiring a thorough search of all screenshots and notes to re-track a decision point. Git cannot store conversation records, and the conversation window cannot remember commit information. The key to LangChain's upgrade from 52.8% to 66.5%, and its ranking from outside the top 30 to the top 5, was not a change in model or API, but the adoption of Harness's six-layer architecture—the most crucial of which is Git × Handoff, which integrates the decision chain of each agent execution into the version control system. [6][1]Once decisions are traceable, the development team can see "why version v1.3 is more stable," instead of forever groping in the dark.

These three points of loss of control are not independent problems—they reinforce each other. Amnesia leads to repetitive decisions, burning tokens treats the symptoms rather than the root cause, and the inability to go back means you'll never learn from your mistakes. Only a systemic engineering-level change can solve all three problems simultaneously.

AI Harness's Six-Layer Architecture: A Complete Design from Probabilistic Intelligence to Reliable Systems

LoopIt is the most fundamental continuous execution mechanism. Agent Loop allows the agent to complete multiple inference steps at once, instead of re-initializing the context each time. Vercel reduced its tools from 15 to 2 and then added the Loop mechanism, and the accuracy actually increased from 80% to 100% and the speed increased by 3.5 times, because each step remembers the decision logic of the previous step, instead of getting stuck in isolated inference.

Tool layer (MCP and Skills)Define what the agent can and cannot do. Use SKILL.md to describe the execution SOP in text, instead of hardcoding it into a decision tree; the more precise the specification, the more stable the execution quality. Just clearly stating the restriction that "can only read its own orders and cannot delete other people's orders" can reduce the misuse of permissions to zero.

Context management layerThis determines which history the agent can see. Memory maintains the flow across conversational boundaries, while AGENTS.md × Git × Handoff ensures projects don't lose their memory. Whether you're using Claude Code or OpenCode, the agent can pick up where the previous task left off, instead of starting over each time.

Persistence layerSave every execution path. This is not just a log—every complete sequence of "perception-reasoning-action" becomes the basis for the next optimization because it reflects your real business logic, not a general scenario.

Verification layerPerform checks before and after execution. Instead of completely rejecting the model's output, use permission checks, result format validation, and business logic constraints to create a safety boundary, ensuring that its decisions conform to your defined rules.

Limitation layerIt's the soul of Harness. Model selection is adjusted according to task difficulty—smaller models are used to save tokens for simple tasks, while larger models are used for complex reasoning. The reason tokens keep burning is often because the same model is used to handle tasks of all difficulties.

These six layers are not optional; each layer must be present. Removing any one layer will cause the system to revert to Vibe Coding. OpenCode's design is precisely to package these six layers into an extensible framework.

OpenCode Core Breakdown: How AGENTS.md, MCP, Subagent, and Permission Form a Working System

AGENTS.md helps projects have lasting memories.

The most common symptom of loss of control is "starting over every time." AGENTS.md solves this amnesia problem—it writes the Agent's role definition, constraints, tool list, and decision logic into versioned files stored in Git. Each new session, the Agent reads not a vague memory, but precise system specifications. Vercel reduced the number of tools from 15 to 2, yet the accuracy increased from 80% to 100%, because of the clear specifications—less interference, more focus.

Agent and Subagent division of labor: parallel rather than serial

OpenCode explicitly defines the division of labor between Agent and Subagent. The main Agent is responsible for decision-making and context management, while the Subagent is responsible for in-depth work in specific domains—one writes SQL, one reviews security, and one performs performance optimization. Each Subagent's AGENTS.md can be written in a fine-grained manner, so the model does not need to be distracted by multiple responsibilities during execution, thus improving accuracy and stability.

MCP and Skills Integration Tools and Standard Processes

OpenCode adds a SKILL.md layer on top of the MCP (Model Context Protocol)—defining "who can use this tool," "execution order," and "failure fallback logic." Database queries are not directly called; instead, they first follow the SOPs of "verifying query security," "recording execution traces," and "updating the cache." Tool calls become traceable and reproducible actions.

Permission: Fine-grained access control

The Permission layer uses a combination of rules based on task type, Agent identity, and the object being manipulated. Subagents can read user data but not delete it, can call payment APIs but have spending limits, and can write test data to the development environment but cannot access the production database. These rules are written in AGENTS.md and are checked by Harness's verification layer before execution. OpenCode supports Git permission synchronization, ensuring consistency between version control and access control.

Model selection based on task difficulty to reduce costs

OpenCode dynamically selects the model based on task difficulty: Claude 3.5 Sonnet is used for complex inference, while Claude 3 Haiku is used for simple routers. The system marks the complexity level of each subagent in AGENTS.md and automatically configures the appropriate model. Within the same Harness system, different models are used for different paths, reducing token costs by 40-50 TP3T compared to a one-size-fits-all approach.

A painless switch between Claude Code and OpenCode

When milestones are reached in Claude Code, AGENTS.md, MCP connections, and Permission rules can be exported in a standard format and directly loaded into OpenCode to continue execution. During automated execution in OpenCode, if human intervention is required, you can jump back to Claude Code for manual adjustments and then seamlessly return to automated execution. Context, memory, and tool connections are all maintained by Git and Harness's persistent layer, ensuring they are not lost when switching tools.

Seamless transition between Claude Code and OpenCode: Key design features that maintain project continuity

When you reach a milestone in Claude Code, you can export AGENTS.md, MCP connections, and Permission rules into a standard format and load them directly into OpenCode to continue execution. Conversely, when OpenCode's automated execution encounters a step that requires human judgment, you can jump back to Claude Code to make manual adjustments and then seamlessly return to the automated process.

The key is that the context, memory, and tool connections are all maintained by Git and Harness's persistent layer, so they won't be lost when you switch tools. What you really retain is not a particular AI tool, but the sustainable project framework—models and tools can be changed, but Harness is the asset worth keeping.

Real-world case study: Three transformations from project amnesia to long-term sustainability

An engineer spent 8 hours optimizing the search algorithm in Claude Code, only to have to reinterpret the entire logic, the rationale behind the previous day's decision, and why that data structure was chosen when switching to OpenCode the next day. This is a typical failure mode for Vibe Coding. AI Harness completely changed this process through the AGENTS.md × Git × Handoff mechanism.[9]The project timeline no longer exists in the illusion of engineers' notes or models, but is written into the version control system, making the switch between Claude Code and OpenCode a painless operation.[12].

The first shift occurs at the memory layer. Traditionally, each context switch requires re-entering the previous 30 dialogue records. With AGENTS.md, the agent's decision history, verified code snippets, and failed experiments are all stored in a structured manner. Engineers move from "I need to remember to tell the AI what I did last time" to "The system automatically loads the project context." The memory layer maintains continuous tracking during agent loop execution.[4]Each decision point is recorded as a traceable node.

The second shift was cost control. When a startup's development team was writing microservices using Vibe Coding, they fed every simple API route to GPT-4o, burning through 3000 yuan worth of tokens per week. After switching to AI Harness, the system automatically judged the task difficulty and selected the appropriate model.[11]—Database queries use Claude 3.5 Haiku, and complex logic design uses Claude 3.5 Sonnet. With the same level of functionality, the token cost is reduced to 600 yuan. This isn't because the model is better, but because the six-layer architecture ensures each layer has a clear responsibility.[1][2].

The third shift lies in permissions and workflows. When subagents begin executing in parallel, traditional setups can lead to the nightmare of "Agent A modifying global variables, Agent B reading corrupted data." OpenCode's Permission control layer defines the boundaries of each agent, while MCP and Skills provide concrete tool interfaces.[9]A project evolved from "five engineers each prompting their own AI, resulting in a wide variety of coding styles" to "a unified SKILL.md defining all SOPs, with all agents executing according to the same set of rules." Execution quality became more stable, not because the engineers became stricter, but because the specifications themselves were written into the system.[3].

The common thread among these three transformations is the shift from fragile systems reliant on engineers' memories to long-term maintainable systems where decisions, costs, and permissions are embedded in the architecture. Vercel exemplifies this by reducing its AI tools from 15 to 2, while simultaneously improving accuracy from 801 TP3T to 1001 TP3T.[7]Related: How MCP and Skills integrate with tools and established workflows.

FAQ

The benefits of this approach are most pronounced when a team is running more than three AI tools simultaneously, or when a single project consumes more than 1 million tokens within a week. Reducing the number of Vercel tools from 15 to 2 increased accuracy from 80% to 100%, a 3.5x speed improvement. [7]—The more complex the system, the greater the Harness reward. If a project is still in the stage of a single model and a single workflow, the implementation cost will outweigh the benefits.

Cost savings come from three levels: selecting the model based on difficulty (Haiku for simple tasks, Opus for complex reasoning) can reduce 40-601 TP3T tokens; AGENTS.md extends project memory, reducing 301 TP3T context tokens; and retries on failures are eliminated. The most direct way to quantify this is by comparing the actual expenditures three weeks before and after implementation.

The permission system is a clear declaration of execution boundaries. Before an agent performs a sensitive operation, the system checks its permissions and the scope of delegation by the subagent. When a team has more than three people, the permission hierarchy can easily become uncontrollable—permission forces each role to clearly record what they can do, preventing high-privilege operations from being pushed down to lower-level tasks. [9]Define roles, SOPs, and operable resources in SKILL.md, and Permissions will be applied automatically.

A seamless switch between Claude Code and OpenCode relies on the project context being fully documented in Git and AGENTS.md. Claude Code is known for its elegance, offering no forced replacement, no decision tree limitations, and no rigid workflows; OpenCode, on the other hand, incorporates MCP, Skills, and Permission tools. During the switch, the new environment reads the same AGENTS.md and Git history, allowing the agent to immediately resume execution. [12]If this record is not available, switching will result in amnesia.

Conclusion

AI Harness's core insight is simple: models will continue to evolve—GPT-5.5, Claude 4, and then Claude 5—but what you should truly cherish is the system that tames them. Vibe Coding's problem isn't with AI itself, but with its failure to materialize project memory, permissions, and workflows. AGENTS.md prevents team amnesia, Subagents and MCPs ensure complex tasks are carried out systematically, Permissions prevent accidental token burning, and seamless switching between Claude Code and OpenCode guarantees your investment is never wasted. Once these mechanisms are established, regardless of the model, your projects will thrive and remain stable. True competitiveness isn't about the intelligence of AI, but about your ability to institutionalize, tool, and make traceable AI capabilities.

Key Takeaways

  • The root cause of Vibe Coding's loss of control was the lack of project memory, access control, and cost control. AI Harness addresses this with a three-layer architecture of AGENTS.md, MCP, and Permission.
  • The division of labor between Subagent and MCP allows complex tasks to be executed in stages, with each layer having clear inputs and outputs, reducing the cost of a single token.
  • The design for seamless switching between Claude Code and OpenCode ensures that project context is never lost and the project structure remains intact during model upgrades.
  • The permission mechanism not only controls costs, but also provides decision tracking and risk isolation, transforming AI development from a black box into an auditable system.
  • Building Harness requires three practical steps: defining AGENTS.md, designing the first Subagent, and testing Permission in OpenCode, rather than waiting for the perfect tool.

Open your editor now and write your first AGENTS.md file for your project, documenting the roles and decision-making boundaries. Share this document with your team or post it on a GitHub issue to start building your own AI Harness using OpenCode.


References

  1. Harness has six layers of architecture — threads.com
  2. Claude Code is described as elegant and complete agent harness implementation — github.com
  3. Six major Harness architecture components are identified — facebook.com
  4. OpenCode is presented as core framework for building Harness — facebook.com
  5. Published article on Harness Engineering dated 2026 — developer.cloud.tencent.com


Further Reading and Reference Books

The concepts of AI Harness and OpenCode in this article are an extension of those of...Flag Knowledge LectureThe new bookAI Harness is adept at it: OpenCode makes Vibe Coding more flexible.The book provides a complete demonstration using OpenCode on how to transform Vibe Coding into a long-term sustainable development system using AGENTS.md, MCP, Skills, Subagent, Permission, and model selection.

Further Reading

📘 Want to see the complete learning path? Please see A Complete Guide to Using Claude: From Beginner to Cost Control.

Further Reading: If you want to see how this concept is translated into actual configuration files, commands, and project structures, check out Flagship Publishing's... I wrote a full book review of "AI Harness".The reading route for the six Harness frameworks and nine chapters is organized into a table.