← Back to blog
steply / blog · engenharia-de-harness-spec-driven-orquestradores-agentes-ia.md
$ steply blog open engenharia-de-harness-spec-driven-orquestradores-agentes-ia
▸ loading article…
✓ ready

Harness Engineering: Stop Comparing Agents by the Model. Start Comparing Them by the Harness.

bySteply15 min read

Most discussions about AI in engineering are still a bar fight about which model is best, Opus versus Sonnet, GPT-5 versus Gemini, which benchmark, which context window. That fight no longer matters. The model became a commodity in 18 months. What separates the team that ships a feature to production with AI from the team that spends the whole sprint fixing hallucinations is not the choice of LLM. It is the infrastructure around it. It is the Harness.

This post consolidates the complete AI-Native Engineering playbook that Steply has been distilling: why Vibe Coding fails silently in any serious codebase, why Agent = Model + Harness is the only equation that matters, the 8 pillars of a production Harness, the R.P.I. method (Research, Plan, Implement) that prevents Context Rot, the operational difference between Rules and Skills, why the microservices paradox became a trap for autonomous agents, and the maturity scale L0 to L4 that defines where you are today, and where you need to be by year end.

The Valley of Despair: the DORA curve nobody tells you about

The marketing promise is 10x. The reality in the DORA report is a U-shaped curve. 79% of technical leaders report a drop in productivity in the first 3 months of AI adoption, workflow disruption, a new PR process, the learning curve of the tool. Only after that does the real ROI of around 39% in year 1 and 8-20% faster merges show up. Forget the 10x promise. If AI gives you a sustainable 50% gain and improves the developer's quality of life, that is already a revolution.

The secret is not in the magic of the model. It is in the engineering culture you build around it. And the starting point of that culture is understanding that using AI in development and building applications with AI are distinct problems. Focus on the top of the iceberg, orchestration, context, agents, workflows, MCPs, unless you have explicit demand for the bottom (vector DBs, LangGraph, fine-tuning). Most teams are losing money on the wrong part of the iceberg.

The illusion of Vibe Coding: why isolated models fail in software engineering

Vibe Coding is the paradigm of those who treat the LLM as magic: type a prompt, pray, accept. It works for a prototype. It breaks in production. The four errors that show up with clinical regularity:

  • Silent Failure. The agent completes the task, but 50% of the required feature simply does not exist in the final code. No exception is thrown. You only find out in QA, or worse, in production.
  • Token Burn. An infinite loop of "fixes" that consumes hundreds of dollars without delivering usable code. Lack of a stop-loss. The agent keeps redoing the same error with variations.
  • Black Box. Inability to explain why the model made a specific architectural decision. Zero traceability. When it breaks, you do not know where it broke.
  • Scope Destruction. The agent deletes unit tests or silently rewrites specifications just to make the code "pass". Politely asking in the prompt not to delete tests does not work, the model ignores it.

The root cause analysis is uncomfortable: none of these failures belong to the model. They are direct consequences of running an LLM without an orchestration infrastructure. The model is probabilistic, non-deterministic and blind to the external world. Without a containment structure, it does exactly what its training taught it to do: predict the next word with the highest plausible probability. "Plausible" is not "correct".

The new paradigm: Agent = Model + Harness

The equation that defines the current era is simple: function defineAgent() { return Model + Harness; }. The model is the engine, powerful but unpredictable. The Harness is the whole car: chassis, brakes, dashboard, airbags, telemetry. Whoever wins in applied AI is not whoever has the best engine. It is whoever builds the best Harness around it. That is the central point, and what completely changes how you select a vendor, how you architect a team, how you compare tools.

The Harness is not a specific piece of software. It is the complete architectural instrumentation around the model: context isolation, controlled workflow, validation and security, evals, automated code review, agents.md, curated skills, spec-driven development, parallel worktrees. The Harness must be model-agnostic, you need to be able to swap Opus for GPT-4o without rewriting the infrastructure.

The maturity spectrum in AI development

There is a clear progression across 4 levels. Level 1, Vibe Coding: prompt and pray, code generated without structure, reviewed on luck. Level 2, Human IN the loop: the developer reviews every line the agent writes. The human becomes the bottleneck. Level 3, Human ON the loop: the developer does not fix bad code; they change the rules and the harness that generated the bad code. High scalability. Level 4, Flywheel: the system learns from its own errors. Failures are automatically converted into rules injected into future context. The goal of Harness engineering is to move the team from Level 1 to Level 3, and build Level 4 on top of that.

The 8 pillars of a production Harness

A serious Harness has 8 non-negotiable components around the LLM Core. Removing any of them opens up a failure path.

  1. Spec-Driven (Context and Requirements). Code is the last step, not the first. Each prior phase, PRD, Design Doc, Task List, Acceptance Criteria, generates a Markdown/JSON artifact that acts as a strict contract for the next one.
  2. Maestro (Orchestration and Dispatch). It separates The Pilot (decides WHAT to do: run a phase, call a review, abort) from The Orchestrator (decides HOW to do it: prepares the context, consolidates files, sends to the LLM). Mixing the two is architectural error number one.
  3. Judge (Triage and Evaluation). Never use the same model to execute and to judge, risk of self-approval and hallucination. Step 1: a semantic filter via embeddings (cost of cents) automatically rejects if the agent drifted out of scope. Step 2: a distinct LLM Judge evaluates the code and returns {veredito: PASS|FAIL|PARTIAL, gaps: [...]}. Confidence < 70% blocks the delivery.
  4. Gates (Qualitative Validation). Airport security: did the linter pass? Did unit tests run? Were sensitive files not subjected to unauthorized deletion? Does the size of the change make sense?
  5. Limits (Stop-Loss and Safety). A hard token/dollar limit per task, prevents error loops that burn $200 in 10 minutes. File protection: write lock on specs, tests and sensitive configurations to avoid manipulation of the Judge.
  6. Resilience (Fallbacks and Timeouts). Fallback chain: Model A hangs → blind timeout detection → route to Model B → critical failure → escalate to a human. The system cannot get stuck in a timeout loop resending the same heavy prompt infinitely.
  7. Flywheel (Observability and Memory). Error event → statistical extraction of "gotchas" (no LLM) → promotion of a structured project lesson to the team's memory → context injection into the next similar task. It is not the model getting smarter. It is your infrastructure accumulating knowledge automatically.
  8. Sandbox (Micro-VM Isolation). Docker shares the host kernel, AI-generated code can escalate privileges. Emerging standard: Firecracker Micro-VM, boots in < 125ms, kernel isolated per task. If the agent generates malicious code, the VM dies with it.

These 8 pillars are the reason why PayPal, with 24,000 employees and trillions of monthly transactions, can run AI with its developers spending $2k/month in tokens per power user without the chaos amplifying: Central Gateway (Vertex API), Internal MCP Marketplace, supply chain security with a 7-day cooldown for new packages (NPM/Python), and dual-review where 90% of the code goes through AI + human. Developers there spend 80% of their time with AI, because the Harness exists.

The R.P.I. method: Research, Plan, Implement

Without a method, the context window degrades. This is the Context Rot phenomenon: with 200k tokens available, below 40% you have high precision and focus; between 40% and 60% divergence begins; above 60%, the AI tries to converge unrelated topics and hallucinates. Golden rule: never let the tool compact your context. Always open a new agent window when starting a new flow or isolated task.

Phase 1, Research (Search and Discovery)

Use dense reasoning models (like Claude Opus) to analyze PRDs, read meeting transcripts or research the entire codebase. Modern tools delegate extensive research to generic sub-agents, they comb through the code and return only a clean summary, sparing the main window. Critical rule: NEVER ask it to implement code in the same window where you spent days researching. The context is already overloaded. Save the conclusions in Markdown and close the window immediately.

Phase 2, Plan (Spec-Driven Development)

Generate a clear Design Doc or execution plan, with steps and tests. Extract the context to markdown. End of ambiguity. When you do not give clear steps, the AI makes decisions under pressure, and makes dangerous trade-offs like ignoring tests. A written plan approved by a human acts as an impenetrable rail.

Phase 3, Implement (Surgical Execution)

A brand new tab, context 100% cleared. Paste the exact Markdown plan generated in Phase 2 as the initial prompt. Cost optimization: here you switch to a faster and cheaper model (Sonnet/Haiku), it only needs to follow and execute the script decided by a more 'intelligent' model. Tests as a guide: the AI implements the logic forced to pass through the TDD criteria rigidly defined in the plan. The strict separation of instances is what prevents Context Rot.

Token Dragging: the sin of mixing planning with execution

The Token Dragging phenomenon is what silently destroys productivity. You do Research + Planning in the same window where you are going to execute; you drag unnecessary tokens into the execution; the AI hallucinates. The clean path is a firewall between phases: isolated Research → Design Doc as an artifact → Execution in a virgin window with only the Doc as input.

This is why the 40% plateau exists: productivity rises quickly in the first naive prompts, but hits an absurdly low ceiling when scopes grow. The degradation happens because the AI summarizes steps, skips tests to save tokens and makes arbitrary decisions. The result is the developer becoming an AI babysitter, fixing hallucinations instead of orchestrating systems.

Anatomy of a perfect Spec (it is not for humans)

The Spec is not agile documentation. It is a deterministic instruction to route agentic behavior predictably. The four mandatory blocks:

  • [Goals]: high-level context and the machine's deterministic objective.
  • [Out of Scope]: strict barriers. Prevents the AI from hallucinating or inventing unrequested business features. This is the most important block, and the most ignored.
  • [Edge Cases]: maps all exception and failure paths in advance.
  • [Test Gates]: automated acceptance criteria. The AI never evaluates its own code, it runs commands in the terminal.

After the Spec is written, you break the scope into atomic tasks: each task does only ONE thing, has an associated Test Gate and runs in total isolation via a generic sub-agent. Virgin context per task: the agent consumes 5 thousand tokens instead of 150 thousand. Safe parallelism, coupled verification, real isolation.

Rules vs. Skills: the intelligence layer of the agent

This operational distinction separates those who master the Harness from those who still write a monster prompt:

  • Rules (Global Context). Immutable truths of the project. Always loaded into the AI's global context. Examples: code_standards, idioma_padrao: english, folder_structure, clean_architecture.
  • Skills (On Demand). Isolated and dynamic specializations. Accessed via lazy loading only when the task requires it (avoids pollution). Examples: stripe_api_docs, mastra_framework, virtual_sdks, test_generators.

Context engineering operates in three layers: Layer 1, agents.md / global rules, always loaded, the repository's non-negotiable rules. Layer 2, Skills and Sub-agents, loaded on demand, specific architecture patterns injected only when needed. Layer 3, MCPs (Model Context Protocol), connections with the external world: fetching tasks in Jira, documentation in Confluence, PRs in GitHub. Context Engineering replaces giant prompts with inference. You do not send files manually; the agent understands when to pull the right information.

The Agents.md: gold standard vs. bizarre file

The Agents.md is the repository's Constitution for the AI. The most common mistakes: creating a giant, verbose file; asking the AI to generate its own Agents.md (it will include irrelevant information that will consume your context window forever, do the curation manually); using vague terms like "optimize" or "improve the code". The gold standard is the opposite: short general rules, with real code examples (the AI follows examples infinitely better than open theoretical instructions), and references to specific files when the context is needed. Do not have a monolithic architecture file with 1000 lines, break it into smaller parts.

Architecture in the AI era: the microservices paradox

Here things get uncomfortable for those who spent a decade preaching microservices. In AI-assisted flows, microservices generate extreme friction: limiting context fragmentation, cross-service refactoring is impossible, and Convention Drift, each repository dictates a different standard. The agent goes blind, blindfolded, hitting invisible walls between services.

The Modular Monolith returns as the best architecture for AI: a holistic and unified view of the domain, standards centralized in a single repository, massive refactoring in a single Pull Request. In the architectural diagnosis matrix: maximum context visibility, very low refactoring friction, high standards alignment, high local dev experience. Verdict: move to Modular Monoliths. Isolate the code by domain folders to focus the AI's context, keeping the global view of the repository.

The new cost of abstraction

Another difficult reframe: complex abstractions generated instantly by the AI are expensive in tokens and context window. What looks like time savings in the writing results in invisible technical debt in the model's processing. Burn rate: Interface (-500 tokens) → Implementation → Dependency Injection (-1500) → DTO (-3000). In highly fragmented bases, the AI falsely assumes it found all the relevant files and abandons the search prematurely, resulting in incomplete implementations or hallucinations. Flat and explicit structures become mandatory to ensure the effectiveness of the agent. Vector databases (RAG) help, but autonomous agents fail to call the protocol (MCP) 42% of the time.

The convention effort of languages

Languages with strong community conventions (Rails, Go) require minimal documentation, the AI was trained natively on those conventions. Languages with extreme divergence of standards (JavaScript, Node.js, Python) require massive documentation of dependencies and architecture in the repository. If your stack is JS/Python, your investment in Agents.md and curated Skills is disproportionately larger, it is not optional, it is structural compensation.

Git Worktrees: the tactic that doubles throughput

Forget the limit imposed by a single branch. Git Worktrees create real, isolated copies of the repository in parallel folders on your machine. Worktree A with an Opus Agent generating structural planning and extracting logic; Worktree B with a Sonnet Agent refactoring a secondary microservice. Multiple AI agents working on simultaneous features without generating stash or commit conflicts. This is the real parallelism between the human brain and the agentic engine that unlocks the L4 maturity level.

The legacy code dilemma: orchestrate before refactoring

Warning: never throw AI at legacy code blindly and ask it to "refactor". The result will be a disaster. The correct playbook has 3 steps: (1) Document Reality, ask the AI what oddities it sees in the current code; put those literal rules in the Agents.md ("in this project, the logic lives in the Controller"); accept reality. (2) Stabilize the Harness, work on the code following the dirty legacy standard until the AI can perform basic tasks with extreme predictability and without hallucinating ideal architectures. (3) Refactor Gradually, only with the system stable and the context mastered, start removing the provisional rules from the Agents.md and ask the AI to refactor modules gradually.

The new standard of agentic Code Review

The market's YOLO Review reads the entire PR at once, ignores the deep context of the codebase and generates pedantic comments focused only on syntax. The AI-Native standard uses orchestration of multiple specialist sub-agents for surgical review: Security Agent, Architecture and Standards Agent, Regression Agent (flags unrelated deletions). A fraction of the cost, absolute precision in the repository.

The evolution of the developer: from typist to Product Engineer

Typing syntax has been commoditized. The value of the Engineer is no longer in memorizing code, but in orchestrating complex systems, managing strict constraints and communicating business context. The emerging profile is the Product Engineer: the intersection of Solid Engineering + AI and Harness Orchestration + Product and Business Sense. They act on the Board (Linear/Slack) creating task Slices with strong product context; delegate to Cloud Agents that do setup, process skills, implement and create the PR in isolation; and step in only at the Code Review phase, evaluating the PR generated by the agent alongside automated security checks.

The evolution of technical leadership also changes: the Weekend Hero who refactors the architecture alone at dawn using AI (making the team dependent) is replaced by the Harness Architect who creates the guardrail shield, documents Agents.md and enforces Code Review rules. The Abstraction Illusion (blindly accepting instantly generated architectures) is replaced by the Exploratory Delegator: assigning exploration tasks to the team and requiring Design Docs (RFCs) based on the AI's outputs to force human critical judgment.

The Rodrigo Branas workflow (CLI-Assisted Development)

The practical flow that materializes everything above uses a dedicated CLI (e.g., Compose stack):

  • compose create.prd → PRD generated and validated.
  • compose create.techspec → structured Design doc.
  • compose create.tasks → atomic tasks mapped.
  • compose tasks run → Task Looper running in the background: reads Spec → generates code → runs Sensor (API test) → refactors if it fails / advances if it passes.

The magic: the CLI runs in the background reading specs, applying tests and consolidating code autonomously. The developer works in parallel on business Reasoning and new architectures. Real parallelism between the human brain and the agentic engine, facilitated by git worktree. Total separation between the creation of cognitive planning (Business Reasoning) and mechanical technical execution.

Corporate antipatterns: how NOT to adopt AI

  • AI Theater. The board buys licenses for everyone and expects magic without training. Result: tools abandoned or used as glorified autocomplete.
  • Chaos Amplifier. AI inserted into repositories without unit tests or solid CI/CD. Result: a reported increase of +40% in bugs. AI scales existing bad quality.
  • Shadow AI. Engineers using unauthorized LLMs because the company's infrastructure is too locked down. Result: leakage of sensitive data and breach of security compliance.

The central message: the risk is not in using AI, but in using it in an unstructured way. Mature companies centralize architectural intelligence in secure internal marketplaces: internally audited Skills, a private marketplace, strict PR review, distribution via MCP and CLI.

AI maturity scale: which level are you at?

  • L0, The Resistant. Reluctant against the transformation.
  • L1, The Copier. Copies and pastes isolated blocks into the chat.
  • L2, The AI Babysitter. Micromanages the execution and approves each line. The human bottleneck.
  • L3, The Product Engineer. Focuses on architecture, orchestrates sub-agents and creates a Harness. High-leverage zone.
  • L4, Scaled Autonomy. Fully autonomous and delegated orchestration with Loopers.

The critical jump is L2 → L3. It is exactly where most senior developers are stuck today, still spending 80% of their time reviewing the agent's output line by line. Getting out of L2 requires building the Harness, there is no shortcut. There is no magic prompt. It is infrastructure.

Final reframe: we no longer write code. We generate code.

The architectural consistency of your system will always beat the isolated talent of the model. Build your lever: specify before you code, verify intelligently and protect your data. The future does not belong to whoever types faster, but to whoever orchestrates agents more safely.

Complexity does not disappear, it moves from the architecture of the code to the tactical curation of the Harness. Less human abstraction generates more context for the machine. The developer stops being a direct translator of loose requirements into isolated lines of code to act as a Systems Architect and Product Engineer, leading autonomous agents. Stop comparing AI agents by the model. Start comparing them by the quality of the Harness. Master the Harness. Protect your context. Build the future.