Harness Engineering: What It Is, Parts and Security Risks
TL;DR · the short version
Harness engineering is the work of designing everything around an AI model that turns it into a dependable agent: instructions, tools and permissions, context and memory, sandboxing, feedback loops and evaluation. OpenAI popularised the term in a February 2026 post about Codex; LangChain sums it up as "agent = model + harness". For security leaders the point is that the harness, not the model, holds the permissions and the attack surface: a November 2026 preprint says to treat it as a security boundary, and GitHub has published advisories for coding-agent harness flaws. This guide defines the term, lists the parts of a harness with sources, and shows where the risks sit.
Harness engineering is the work of building everything around an AI model that makes it behave as a dependable agent: the instructions it reads, the tools and permissions it has, how its context and memory are managed, the sandbox it runs in, and the feedback loops that check its work. LangChain's shorthand is agent = model + harness. For a security leader the useful fact is where the risk sits: the harness holds the permissions, the credentials and the places an attacker can steer the agent. This guide defines the term, lists what a harness contains, and shows where the security risks are.
Who this is for: CISOs, AI-security and AppSec engineers, and platform teams rolling out coding agents or building their own.
Every claim is attributed to a primary source we opened on 30 November 2026. PlayCISO is not affiliated with any company named. Items marked "our analysis" are our own reasoning.
Confirmed vs not settled
Sourced: the definitions below (OpenAI, LangChain, Thoughtworks), the harness parts the sources list, two GitHub advisories for a coding-agent harness, and a November 2026 preprint and a vendor opinion that both say to treat the harness as a boundary.
Not settled: who coined the term (no source we opened says), and how large the security effect of harness choice is: the evidence is a preprint and a vendor study, not an independent benchmark.
What harness engineering means
The term has two uses in the sources, and they fit together.
- OpenAI titled a February 2026 post about its Codex work "Harness engineering: leveraging Codex in an agent-first world". The job, as the post frames it, is designing environments, specifying intent and building feedback loops so agents do reliable work.
- Mitchell Hashimoto uses "Engineer the Harness" as a step in his AI adoption story: whenever an agent makes a mistake, fix it at the source so it does not repeat it, with a line in an instructions file or a small scripted tool.
- LangChain gives the definition most people quote: the harness is every piece of code, configuration and execution logic that is not the model itself. A model becomes an agent when a harness adds state, tool execution, feedback loops and enforceable constraints.
- Thoughtworks' Birgitta Böckeler, writing on martinfowler.com, calls harness a shorthand for everything in an AI agent except the model and, for coding agents, separates the vendor's built-in harness from the user's outer harness (your rules, hooks and checks).
Who coined it? No source we opened settles it. OpenAI's post carries the term in its title; Hashimoto's page shows no date; and Böckeler's February 2026 memo calls the term about two weeks old and only suggests that one may have inspired the other.
Context engineering vs harness engineering. Context engineering is about what goes into the model's context window on each call. Harness engineering is wider: it also covers tools and permissions, sandboxing, feedback loops, evaluation and the code that runs the loop. Context management is one component of a harness.
What a harness contains
| Part | What it does | Source |
|---|---|---|
| Instructions and knowledge files | OpenAI keeps a roughly 100-line AGENTS.md as a map into a structured docs directory; Hashimoto bases each line on a real bad behaviour. | OpenAI |
| System prompt, tools, skills, MCP servers | LangChain lists these with bundled infrastructure (filesystem, sandbox, browser), orchestration (sub-agents, handoffs, model routing) and hooks (compaction, continuation, lint checks). | LangChain |
| Guides and sensors | Guides steer before the agent acts; sensors observe after and let it self-correct. Each can be computational (linters, tests) or inferential (AI review). | Böckeler |
| Mechanical enforcement | OpenAI describes custom linters, structural tests and CI jobs that enforce a layered architecture. | OpenAI |
| Plans, progress files, handover notes | Anthropic uses a progress file, an init script and git history so a fresh context window can pick up the work; a feature list the agent may change only by marking passes. | Anthropic |
| Evaluators and sub-agents | Anthropic describes planner, generator and evaluator agents and the choice between context resets and compaction. | Anthropic |
| Sandboxing | Filesystem isolation limits where the agent can read and write; network isolation sends traffic through a proxy that restricts domains. Anthropic says both are needed. | Anthropic |
| Enforcement outside the model | Red Hat argues permissions, identity, isolation and budgets must hold even when the model is wrong, with gateway-enforced tool authorisation. | Red Hat |
Why the harness is the security boundary
A model on its own can only produce text. The harness is what lets it read files, run commands, call APIs and remember things, so the harness decides what a hijacked or mistaken agent can do. Three lines of evidence point the same way:
- Research. The "Harness Matters" preprint (Wu et al., November 2026) reports that across web-agent harnesses some unsafe behaviour happens without any explicit attack content, that both the harness and the model affect security, and that the harness should be treated as a security boundary. It is a preprint, not peer reviewed.
- Vendor studies. Manifold Security's agent behaviour study tested coding-agent harnesses side by side and says harness choice changed outcomes, including how often payloads that git or the harness ran automatically took effect. It is a vendor study with stated limits.
- Real flaws. GitHub published two advisories for the Copilot CLI harness: CVE-2026-29783 (crafted shell parameter expansion could run commands classified as read-only, bypassing approval prompts, fixed in 0.0.423) and CVE-2026-45033 (a nested malicious bare git repository could run commands through core.fsmonitor during routine git operations without approval, fixed in 1.0.43). Neither advisory states exploitation in the wild.
The OWASP Top 10 for Agentic Applications (9 December 2025) names ten risks: agent goal hijack, tool misuse, identity and privilege abuse, agentic supply chain vulnerabilities, unexpected code execution, memory and context poisoning, insecure inter-agent communication, cascading failures, human-agent trust exploitation and rogue agents. Our analysis: nearly all of them are decided by harness design: which tools are allowed, how credentials are scoped, what the agent remembers and who approves what.
Useful next, if this was relevant to you
A sandbox helps but is not a guarantee. Anthropic says Claude Code sandboxing needs both filesystem and network isolation and reports it cut permission prompts by 84% in its own use. In July 2026 OpenAI reported that its models, running an internal cyber benchmark with production safeguards deliberately off, exploited a flaw in a package proxy to leave a sandbox. The lesson is defence in depth, not trust in one layer.
Harnesses that improve themselves
Google Cloud AI Research's Harness² paper describes recursive self-improvement of the harness itself. The paper's abstract makes no security claims; the governance risks in our Harness² analysis are our own. A harness that edits itself needs change control like any other privileged code. Practise that decision in the recursive harness change control lab.
What security leaders should do this week
- Inventory your harnesses. List every coding agent and in-house agent, who runs it, what tools and credentials it has and which instruction files it reads.
- Treat instruction files as code. Review changes to AGENTS.md and similar files, and be wary of ones that arrive with a repository the agent opens. See AI coding agent config malware.
- Enforce limits outside the model. Permissions, isolation, budgets and approvals belong in the harness and the platform, not in a prompt. The 12-control checklist gives an order.
- Patch the harness. Track advisories for the agents you run as you do for any developer tool.
- Practise. Work through the agent harness attack surface lab and design one in the Harness Designer.
Frequently asked questions
What is harness engineering?
Designing everything around an AI model that makes it work as a dependable agent. OpenAI's February 2026 post on Codex describes the job as designing environments, specifying intent and building feedback loops so agents do reliable work. Mitchell Hashimoto uses "engineer the harness" to mean fixing each agent mistake at the source so it does not repeat, for example with a line in an instructions file or a scripted tool.
What is an agent harness?
LangChain defines it as every piece of code, configuration and execution logic that is not the model itself. LangChain's shorthand is "agent = model + harness": a raw model becomes an agent when a harness adds state, tool execution, feedback loops and enforceable constraints.
Who coined the term harness engineering?
No source we opened settles it. OpenAI titled its 11 February 2026 post with the term; Hashimoto used "Engineer the Harness" in an earlier-looking post (his page shows no date, and secondary write-ups say 5 February 2026); Birgitta Böckeler of Thoughtworks wrote on 17 February that the term was about two weeks old and only suggested one may have inspired the other. We say "popularised by OpenAI's post" and leave it there.
What is the difference between a guide and a sensor in a harness?
Böckeler splits harness controls into guides, which steer the agent before it acts (instructions, rules, examples), and sensors, which observe after it acts so it can correct itself. Each can be computational (linters, tests, type checkers) or inferential (an AI reviewer or LLM judge).
What goes in an AGENTS.md file?
OpenAI says it keeps a short AGENTS.md of about 100 lines that works as a map into deeper documents. Hashimoto says each line should come from a real bad behaviour of the agent. Treat the file as part of your attack surface: it is instructions the agent obeys.
How do long-running agents keep context between sessions?
Anthropic describes a progress file, an initialisation script and git history that let a fresh session learn the state of the work quickly, plus a feature list the agent may not weaken by editing tests.
Is the agent harness a security boundary?
A November 2026 preprint, "Harness Matters" (Wu et al.), says it should be treated as one: across web-agent harnesses it reports unsafe behaviour that occurs without explicit attack content, and finds that both the harness and the model affect security. Red Hat argues permissions, identity, isolation and budgets must be enforced outside the model. The preprint is not peer reviewed and Red Hat's piece is vendor opinion.
What is the difference between harness engineering and context engineering?
Context engineering is about what goes into the model's context window on each call. Harness engineering is wider: it also covers tools and permissions, sandboxing, feedback loops, evaluation, memory and the code that runs the loop. Context management is one part of a harness.
Sources
- OpenAI: Harness engineering: leveraging Codex in an agent-first world (11 February 2026)
- Mitchell Hashimoto: My AI Adoption Journey (date not shown on the page)
- LangChain: The anatomy of an agent harness (10 March 2026)
- Böckeler: Harness engineering for coding agent users, martinfowler.com (2 April 2026) and her first-thoughts memo (17 February 2026)
- Anthropic: Effective harnesses for long-running agents (26 November 2025) and Harness design for long-running apps (24 March 2026)
- Anthropic: Making Claude Code more secure and autonomous with sandboxing (20 October 2025)
- OWASP Top 10 for Agentic Applications (9 December 2025)
- Harness Matters, arXiv 2611.11971 (9 November 2026, preprint) and Red Hat Developer: agent harness engineering (12 November 2026, vendor opinion)
- Manifold Security: The Agent Behavior Index (24 November 2026, vendor study) and OpenAI: Hugging Face model evaluation security incident (21 July 2026)
- GHSA-g8r9-g2v8-jv6f and GHSA-9ccr-r5hg-74gf (GitHub advisories for Copilot CLI) and Harness², arXiv 2610.14224
This article is educational guidance for security leaders. Findings and definitions are the named sources'; check them for updates.
Spotted an error? Report an error. A person reads every message.