Harness Engineering
As of 2026-11-12, harness engineering is the work of building and maintaining the environment around a model: the instructions an agent reads, the tools and permissions it can use, the tests and linters that tell it whether a change is sound, and the files that carry progress into the next session. It is the third generation: beyond Prompt Engineering and Context Engineering, the 2026 paradigm for building reliable AI agent systems moves the engineer's work to designing environments, specifying intent and building feedback loops.
One key for Claude, GPT and Chinese models — put what this page describes into practice.
- Billed per token — live rates on /models
- Pay by card (Visa / Mastercard), Apple Pay, Google Pay or crypto
- Self-service: top up and activate instantly
Updated 2026-11-13
Three Generations of Engineering Paradigms
From 'how to write better prompts' to 'how to build reliable agent systems'
Prompt Engineering
Focused on crafting better input instructions
Context Engineering
Designing what the model can 'see' — memory, tools, documents
Harness Engineering
Designing the complete environment for agent execution: constraints, feedback loops, lifecycle management
The Core Formula: Agent = Model + Harness
If you are not the model, you are part of the harness. The harness is all the infrastructure that makes an AI agent run reliably — CLAUDE.md, MCP tools, Hooks automation, permission constraints, feedback mechanisms.
Agent
Model
Harness
The Four Components of a Harness
Constraints
Define what the agent can and cannot do. Claude Code's permission settings, tool access control, project specs in CLAUDE.md
Feedback Loops
Let the agent know if tasks succeeded. Test results, code lint, CI/CD signals, human review checkpoints
Context Scaffolding
Provide the agent with just the right information. CLAUDE.md project memory, MCP tool integrations, RAG document retrieval
Lifecycle Management
Manage agent startup, execution, and shutdown. Hooks automation, task queues, error handling, session persistence
QCode Team Edition: Ready-Made Harness Infrastructure
QCode Team Edition provides an independent admin dashboard, sub-API Key permission management, and usage monitoring — a complete Harness out of the box. Let your team focus on business logic, not infrastructure.
Start Building Your AI HarnessHarness engineering in practice: where the term comes from, what a harness contains, and how to start
Where the term comes from
Harness engineering is the work of building everything around a model that lets an agent do reliable work. On 2026-02-11 OpenAI published Harness engineering: leveraging Codex in an agent-first world, describing a team that built an internal product with Codex and no manually written code. Its summary line is Humans steer. Agents execute., and it says the team's primary job became to design environments, specify intent, and build feedback loops that allow Codex agents to do reliable work.
Anthropic uses the same word. Its engineering article Effective harnesses for long-running agents, published 2025-11-26, calls the Claude Agent SDK a powerful, general-purpose agent harness, and a Claude blog post from 2026-06-02 says that with dynamic workflows Claude can now write its own harness on the fly.
Four practices from OpenAI's write-up
The article also cautions that this behaviour depends heavily on that repository's structure and tooling and should not be assumed to generalize without similar investment.
- A map, not a manual: keep AGENTS.md short (OpenAI's is roughly 100 lines) and use it as a table of contents pointing to deeper docs in the repository. In the article's words: give Codex a map, not a 1,000-page instruction manual.
- The repository is the system of record: anything the agent cannot access in context while running effectively does not exist for it, so design docs, execution plans and the tech-debt tracker are versioned in the repo.
- Enforce architecture mechanically: custom linters and structural tests enforce dependency directions, structured logging and file-size limits, and the lint error messages carry remediation instructions for the agent.
- Continuous garbage collection: golden principles live in the repo, and recurring background Codex tasks scan for deviations and open small refactoring pull requests.
Anthropic's harness for long-running agents
Anthropic's approach has two parts. An initializer agent sets up the environment on the first run: an init.sh script, a claude-progress.txt file logging what agents have done, and an initial git commit. In every later session a coding agent makes incremental progress, one feature at a time, and ends with a git commit and a progress update.
The feature list is JSON, which the article says the model is less likely to inappropriately change or overwrite than Markdown; every feature starts as failing and is marked passing only after careful testing. The article also reports that giving Claude testing tools such as browser automation, and asking it to test end to end as a human user would, dramatically improved performance.
Build a first harness in Claude Code or Codex
All of this is local configuration and works the same whichever model service you use. With QCode, Claude Code and the Claude Agent SDK use ANTHROPIC_BASE_URL=https://api.qcode.cc/api, Codex uses base_url = https://api.qcode.cc/openai in config.toml, and one key starting with cr_ works for both. Billing is per token; per-model rates are listed on /models.
- Instructions: Claude Code reads CLAUDE.md at the start of every session (/init drafts one); Codex reads AGENTS.md, with ~/.codex/AGENTS.md as the global layer and project files layered on top, up to 32 KiB combined by default.
- Constraints: Claude Code permission rules are evaluated in the order deny, then ask, then allow; in Codex, sandbox and approval settings are set on the parent session and subagents inherit them.
- Feedback: Claude Code hooks run at points such as PreToolUse, PostToolUse and Stop, and a PreToolUse hook that exits with code 2 blocks the tool call; Codex also offers PreToolUse, PostToolUse and Stop hooks.
- Reuse: package a fixed procedure as a skill (a SKILL.md file), or let Claude Code build a task-specific harness with a dynamic workflow.
- Continuity: keep a progress file and git commits, as in Anthropic's setup, so the next session can pick up where the last one stopped.
Harness engineering FAQ
What is harness engineering?
As of 2026-11-12, harness engineering means designing the environment an AI agent works in so that it produces reliable results: the instructions it reads, the tools and permissions it has, feedback loops such as tests and linters, and how progress is recorded across sessions. OpenAI used the term as the title of its 2026-02-11 article Harness engineering: leveraging Codex in an agent-first world.
How is harness engineering different from prompt and context engineering?
Prompt engineering is about how the instructions are worded, and context engineering about what the model can see. Harness engineering covers the whole working environment: constraints, feedback loops, memory across sessions and lifecycle control. In OpenAI's framing, the engineers' job shifts to designing environments, specifying intent and building feedback loops.
Is Claude Code itself a harness?
Yes. Anthropic's engineering blog calls the Claude Agent SDK a general-purpose agent harness, and the Claude blog describes the default Claude Code harness as built for coding. What you add on top of it, such as CLAUDE.md, permissions, hooks, skills and workflows, is your project's own harness.
What are the components of a harness?
A practical checklist: an instruction file (CLAUDE.md or AGENTS.md) that works as a map; permission rules or a sandbox; feedback from tests, linters, CI and hooks; a progress file plus git history so a new session can catch up quickly; and reusable procedures such as skills or saved workflows.
Where should I start?
Write a short CLAUDE.md or AGENTS.md that points to deeper docs, add a hook or CI check that runs your tests, break the work into one feature per session, and keep a progress file the agent updates at the end of each session. Add more structure once you see the agent fail in a repeatable way.
How do I pay for QCode to run Claude Code and Codex?
With credit cards (Visa, Mastercard), Apple Pay, Google Pay, Alipay, WeChat Pay or cryptocurrency across several coins and networks. One key calls Claude, GPT and leading Chinese models; setup is fully self-serve and takes a few minutes.
Start Building Your AI Harness
QCode Team Edition provides an independent admin dashboard, sub-API Key permission management, and usage monitoring — a complete Harness out of the box. Let your team focus on business logic, not infrastructure.