What an AI Harness Is and How to Design One: Agent Harness Engineering in Practice
How an AI agent’s working environment operates, what it is made of, how to build a tailored repository harness with Agent Harness Kit, and how extensible runtimes such as DeepSeek Harness fit into the picture.
- An agent is a model plus a harness: instructions, skills, tools, a verification loop, memory and boundaries. A prompt serves one task; a harness applies to every task and every session.
- Some of the harness is only read by the model (instructions, skills); some works regardless of it (tests, permissions, branch protection, CI). A ban in
AGENTS.mdis a request, not a lock. - Always-loaded files should be short and concrete: the project’s purpose, real commands, a definition of done, boundaries and non-obvious rules. Multi-step procedures belong in skills loaded on demand.
- A good harness is a set of justified decisions with visible costs, not a sum of best practices. Every element needs a reason; anything without one should go.
- Agent Harness Kit turns those decisions into a spec: it scans the repository, asks only what it cannot read, explains what it included and left out, generates files for Codex, Claude Code, Cursor and other
AGENTS.md-compatible tools, and checks consistency in CI. - Separate a repository harness (versioned project instructions, skills and checks) from an execution harness (a host runtime such as DeepSeek Harness with Cordis plugins and Creator Mode): solve recurring workflow gaps at the lowest privilege layer first (
AGENTS.md→SKILL.md→ MCP → runtime plugin).
LEARN BY DOING
Build a reproducible coding-agent environment.
Try this yourself
Write a compact repository agent guide and one on-demand skill; specify checks for a deliberately failing change.
Evidence for your portfolio
A minimal harness and a reproducible verification checklist.
You can start with this lesson.
Same model, two very different results
Two people use the same model in the same editor. For the first, the agent guesses test commands, reports “done” without running anything, proposes in the third session a solution that was rejected a week ago, and adds dependencies without asking. For the second, the agent runs a fast check after each change, runs the full suite before finishing, remembers earlier decisions and asks before touching migrations. The difference is not the model or a clever prompt; it is the environment the model works in: the harness. The trouble is that harnesses usually happen by accident, out of copied templates, bans added in a panic and instruction files that grow until nobody knows what is in them or why.
An AGENTS.md template copied from the internet or generated with one prompt: guessed commands, dozens of generic rules, “NEVER push to main” treated as a safeguard, and three instruction files (AGENTS.md, CLAUDE.md, .cursorrules) that disagree within a month.
A harness designed from decisions: real commands from the repository, a definition of done matched to the risk, memory only where it is needed, boundaries marked as instructions or enforced outside the model, one source of truth for every tool, and a consistency check in CI.
1. What a harness is and how it differs from a prompt
A language model on its own only predicts the next piece of text. It becomes an agent when someone gives it tools (reading and editing files, a terminal, a browser, MCP servers), runs it in a “think, act, observe the result” loop, and tells it which project it is in and what the rules are. All of that surrounding environment is called the harness, hence the often-quoted equation: agent = model + harness. Part of the harness comes from the tool vendor: Codex, Claude Code and Cursor each have their own system instructions, tools and permission mechanisms. You add the rest: project instruction files, skills, verification commands, notes and rules.
The simplest way to tell a harness from a prompt is lifetime. A prompt is one message for one task: “fix this bug in the form”. A harness applies to every task and every session: it says how correctness is checked in this repository, what not to touch without asking, what was agreed last week and where the database migration procedure lives. A good prompt improves one task. A good harness improves all the following ones, and saves you from explaining the same things in every conversation.
A harness solves specific, recurring problems: the agent guesses commands, declares success without evidence, forgets earlier decisions, reads half the repository before it starts working, or performs risky operations without asking. It does not solve problems of a different kind. It will not give the model skills it lacks, fix weak tests or replace clear requirements. Nor is instruction text a security boundary: the model can misread it or ignore it.
The harness affects results, not just convenience. In “Harness²” (arXiv:2610.14224, 2026), researchers at Google Cloud AI Research showed that with the model held fixed, changes to the harness alone (instructions, skills, scripts) raised scores on all three professional benchmarks they tested. The largest gains from a single improvement step were 11.5 points on WorkBuddy-Bench, 4.5 points on JobBench and 11.8 percentage points of partial pass rate on Harvey’s legal benchmark; in some model and tool combinations the gain was only about one point. The harness edits were proposed by another model and tested over repeated automated runs, so these are benchmark results, not a promise for your project. They do make the core point: the quality of an agent’s work does not depend on the model alone.
THE KEY DISTINCTIONThe model only reads part of the harness (instructions, skills, notes). Another part works independently of it (tests, linters, tool permissions, branch protection, CI). When you design a harness, ask of every element: who enforces this?
┌──────────────────────── HARNESS ─────────────────────────┐
│ always in context: AGENTS.md / CLAUDE.md │
│ on demand: skills (SKILL.md), notes │
│ │
task ────►│ MODEL ──► chooses an action ──► TOOLS │
│ ▲ (files, terminal, MCP) │
│ │ │ │
│ └──── result: diff, log, ◄─────────┘ │
│ compiler error, test results │
│ │
│ outside the model: tool permissions, sandbox, hooks, │
│ CI, branch protection, human review │
└──────────────────────────────────────────────────────────┘2. What a good harness is made of
For work on code, a harness has six parts. First, instructions that are always loaded: AGENTS.md in Codex and Cursor, CLAUDE.md in Claude Code (which can simply import AGENTS.md). Second, skills: separate SKILL.md files with procedures that the agent first sees only as a name and a short description, loading the full text when a task calls for it. Third, tools and guidance on using them, from code search to MCP servers. Fourth, the verification loop: commands that give the agent a fast, reliable “works / doesn’t work” signal. Fifth, memory written to disk, because the agent starts every session with no recollection of the previous one. Sixth, boundaries: what the agent does not do without approval, and where that rule is actually enforced.
The Harness² paper divides the harness in a similar but finer way, into eight editable components: system prompt, guardrails, memory, tool guidance, subagents, skills, scripts and plugins that run inside the tool loop. Two observations from that work are especially practical. First, every component is a file, so every change to the harness is a diff you can review and revert. Second, the authors explicitly separate a plugin, which “enforces a behavior rather than instructs it”, from text the model only reads.
That distinction is the key to this whole lesson. Instructions and skills shape behavior but do not guarantee it. Verification commands provide evidence, provided the agent runs them and reports the result honestly, which is why in a good harness they also run in CI. Tool permissions, hooks, sandboxes, branch protection and required code review work regardless of what the model “decides”. Good design combines these layers deliberately: the instruction tells the agent what is expected, and a mechanism outside the model guards whatever would be expensive to break.
With so many mechanisms available, it is tempting to switch them all on. That is a mistake. Every element has a cost: space in the context, extra task time, one more thing to maintain, or a false sense of safety. A harness for a weekend prototype and a harness for a payments system should look different, and the difference should come from decisions, not from whichever template someone happened to copy.
Element Where In context Enforced by
-------------- ------------------------------------- --------------------- ---------------------------
Instructions AGENTS.md, CLAUDE.md (@AGENTS.md) always the model (can ignore it)
Skills .agents/skills/, .claude/skills/ name + description the model
always, body on use
Tools the AI tool, MCP servers tool descriptions the tool
Verification package.json scripts, Makefile, CI output once run compiler, tests, CI
Memory docs/agent/decisions.md, handoff.md when the agent reads the model + human review
Boundaries "Ask before" in AGENTS.md always the model (instruction)
permissions, hooks, branch protection - the tool, Git host, CI3. Context: why fewer instructions often work better
The context window is the model’s working memory: everything the agent “sees” at a given moment, including instructions, files it has read, command output and the conversation so far. It is large, but not free. An always-loaded instruction file enters the context in every session, whatever the task. Claude Code’s documentation recommends keeping a single CLAUDE.md under 200 lines, because longer files take more context and reduce how well instructions are followed. The “Lost in the Middle” study (Liu et al., 2023) showed that models use information in the middle of a long context less reliably than information at its beginning or end.
In fairness, we should also say what we do not know. There is no universal threshold of the “quality drops after 60% fill” kind, and the token-saving percentages quoted online rarely come from measurements on real projects. Models, tools and tasks differ too much. What vendor documentation and practice do support is a simple rule: the fewer generalities in always-loaded files, the more likely the agent notices and applies what actually matters.
So what belongs in AGENTS.md? One sentence on the project’s purpose. The stack and any non-obvious parts of the directory layout. Exact verification commands that actually exist. A definition of done. A list of actions that need approval. Rules that cannot be read from the code, such as “amounts are stored as integer cents”. What does not belong there? Things the model does anyway (“write readable code”), rules a linter or formatter enforces better, whole style guides, and documentation a link would cover.
Multi-step procedures belong in skills. At startup Codex shows the model only the name, description and path of each skill (by default that list takes at most about 2% of the context window) and loads the full text when a task matches. Claude Code and Cursor work similarly. This is progressive disclosure: the end-to-end testing or database migration procedure takes no space until it is needed. But a skill has a cost and a risk: its description must say clearly when to use it, or the agent will not load it.
The third source of clutter is command output. A full end-to-end run can print thousands of lines, of which a handful matter. A harness can tell the agent to use concise reporters and read only the failures. For broad searches in a large repository, delegating to a subagent helps: it reads many files in its own context and returns a short summary with paths. That is a trade-off, not a free saving: total token use goes up and a summary can miss a detail, so the agent should still open the cited lines before editing.
THE ONE-SENTENCE TESTBefore adding a rule to an always-loaded file, ask: without it, would the agent behave differently in most tasks? If not, move it into a skill or a linter, or drop it.
<!-- Before: sounds right, changes little -->
- Write clean, maintainable code following best practices.
- Always run all tests after every change.
- NEVER break production. NEVER push to main.
- Use TypeScript strictly and follow SOLID principles.
<!-- After: concrete, checkable, non-obvious -->
- Fast check, after each meaningful change: `npm run typecheck && npm run lint`
- Full check, once before reporting a task done: `npm test`
- Money is stored as integer cents; never use floating point for amounts.
- Ask before: creating, editing or running database migrations (`prisma/migrations`)4. Verification: evidence instead of claims
The most common and most expensive flaw of agents is declaring success too early. A model that never ran the tests can still write convincingly that everything works. That is why the centerpiece of a harness is the verification loop: concrete commands that give a deterministic signal, and a definition of done that says when to run which of them. Deterministic here means the same code gives the same result, regardless of how the model rates its own work.
In practice two levels are enough, sometimes three. A fast check (typecheck, linter, unit tests for one module) takes seconds and can run after every meaningful change, so the agent fixes a mistake before building on it. A full check (the whole test suite, sometimes the build) runs once, before the task is reported done. End-to-end tests are the slowest and noisiest, so it makes sense to run them when a user-facing flow has changed.
How much verification you need depends on the cost of a mistake, not on fashion. A prototype you will throw away next week does not need tests written before the code. A payments module does. In Agent Harness Kit this choice is called rigor and has three levels: light, standard and strict. Each has a visible cost: light is fast, but regressions can reach code review; standard catches them at the end of a task rather than right after the change that caused them; strict is the slowest and the most expensive in tokens, but leaves the most evidence.
Two rules are worth having at any level. First: report what you ran and the result, and never describe anything you did not run as working. Second, a stop rule: if the same check still fails after three fix attempts, stop guessing, describe what you checked and ask. Three is a heuristic, not a research finding; the point is to keep the agent from circling, piling fixes on a wrong hypothesis. For risky changes, an independent review of the diff by a subagent or a fresh session that has not seen the author’s reasoning also helps.
A case study in the Harness² paper illustrates why this works. On one JobBench task the baseline agent scored 43.1, because it never reconciled data across source files and never reopened the documents it produced to check them. Adding a general process rule (inventory the inputs, trace every figure to its source, reopen the output with a verification script) and one domain skill raised the score to 77.8. It is a single example, not a guarantee, but a typical one: the problem was not missing knowledge in the model, but a missing verification step.
NEVER WEAKEN A TESTIf a test looks wrong, the agent should say so and change it as a separate, visible step. Deleting an assertion to “get green” is the fastest way to a harness nobody can trust.
rigor While working Before "done" Cost
--------- ----------------------------- ------------------------------------ ----------------------------------
light fast check (if one exists) fast check; full suite only on regressions can reach code review
request or before a release
standard fast check after each full suite once (+E2E when a flow a regression shows up at the end
meaningful change changed); a test for changed of the task, not right after
behavior the change
strict as standard + the full suite and E2E; a failing test slower, more tokens; overkill for
verify-change skill first; independent review of throwaway code
risky changes5. Memory between sessions, and boundaries that actually hold
An agent does not remember the previous conversation. Some tools have their own memory features, but agreements that matter to the whole team should live in the repository, next to the code, where they are reviewed like any other file. The simplest and usually sufficient form is a short decision log: a date, the decision and one or two sentences of reasoning. The agent reads it before changing architecture, conventions or dependencies, and adds an entry when you settle something together.
For work that spans several sessions, a handoff note also helps: the goal, what has been done (with commit hashes), test results, the next step and questions for you. It has one serious risk: a stale note misleads more effectively than no note at all. A good harness therefore tells the agent to compare it with the Git history before trusting it, and to clear it when the work is done. If your tasks fit in one session, this mechanism is unnecessary.
Now boundaries. An “ask before…” list in AGENTS.md is useful: a well-instructed agent usually follows it and stops before a push, a deployment or a migration. But “usually” is not “always”. The model can misjudge the situation, and an instruction can get lost in a long session. Whatever would be truly expensive to break has to be enforced outside the model: branch protection and required review in your Git host, CODEOWNERS for migrations and CI workflows, no production credentials in the agent’s environment, and in the tool itself, permission rules (allow/ask/deny rules in .claude/settings.json or hooks in Claude Code, sandbox mode and approval policy in Codex).
The strongest boundaries are built into the tools themselves. The two-phase Prepare → Confirm gates described in the lesson on two-phase commits work this way: an external change requires a fresh token from a prepare_* call for exactly that payload, so it cannot happen in a single step or without a preview. It is an example of a boundary that does not depend on whether the model read and understood an instruction.
AN INSTRUCTION IS NOT A LOCKFor every “NEVER…” rule, ask: what happens if the agent breaks it, and where outside the model can I block it? If the answer is “nowhere”, the rule is a request, and you should treat it as one.
Boundary: "Do not push to main without approval"
1. Instruction (AGENTS.md) - Ask before: pushing, merging or force-pushing to shared branches
Works when the model applies it. Cost: one line of context.
2. The agent's tool Claude Code: an "ask" permission rule for git push in .claude/settings.json
Codex: sandbox mode and an approval policy
Works regardless of the model, but only in that tool.
3. The Git host Branch protection on main: pull request and review required
Works for everyone: people, agents and scripts.6. How to design your own harness: seven decisions
Start designing a harness by reversing the usual order. Instead of asking “which best practices should I add?”, ask “what does the agent need to know about this project that it cannot read from the code, and what has to happen before we consider a task finished?”. First gather facts from the repository: commands in package.json, test configuration, CI, migration directories, existing instruction files. Only then ask people, and only about what the files cannot tell you.
That leaves seven decisions that really are yours. (1) Which AI tools you use, because each reads different files. (2) The project’s purpose in one sentence. (3) Which commands give a fast signal and which a full one. (4) How much verification is worth the time and tokens at this level of risk. (5) What should survive between sessions: nothing, decisions, or the state of current work too. (6) Which actions need your approval, and which of them you can enforce outside the model. (7) Which project rules are not obvious from the code.
The same principle applies to every decision: each part of the harness should have a reason and a visible cost. If you cannot say what problem it solves, don’t add it. If it solves a problem you do not have yet, wait. The best rules come from observation: the agent made the same mistake twice, so you add one sentence that would have prevented it. Removing matters just as much: a rule that has changed nothing for months still costs context in every session.
A new project without code is a special case. There are no verification commands yet, so an honest harness says so: the agent must state clearly what it could not check, and the first task is choosing the stack and recording that decision. An elaborate testing process at this stage is theater. The harness should grow with the project: once the stack is chosen you add real commands, and once there are users you raise the verification level where it matters.
The common anti-patterns are easy to recognize. The mega-template from the internet that promises everything and fits nothing. Commands written “from memory” that do not exist in the repository. Three instruction files for three tools that contradict each other within a month. “NEVER…” lists treated as safeguards. Style rules that a formatter should enforce. And a harness nobody reviews because “it’s just markdown”, even though it changes the behavior of every agent session.
START MINIMALA one-sentence purpose, two real commands, a definition of done and three boundaries often make a better harness than a hundred-page template. Add more only when you see a concrete problem.
Decision Where the answer comes from Where it lands
------------------------------ ------------------------------ ------------------------------------------
1. AI tools you (+ traces: .claude/, which entry files and skill directories
.cursor/)
2. Project purpose you (+ package.json) first section of AGENTS.md
3. Fast / full commands the repository (scripts) Commands section
4. Verification level you: cost of a mistake Definition of done, maybe a verify-change skill
5. Memory you: how long tasks run decision log, maybe a handoff note
6. Approvals and enforcement repo (migrations, CI) + you Ask before + settings outside the model
7. Non-obvious rules you, after repeated agent Project rules (one line each)
mistakes7. Agent Harness Kit: how it is built and why
Agent Harness Kit (RolePlayingTech/agent-harness-kit) is an open-source tool that walks you through these seven decisions and turns them into a working harness. It is a single command-line program for Node.js 20+, with no dependencies, run with npx straight from GitHub. Why isn’t it enough to ask Codex or Claude Code to write AGENTS.md? Because such a file usually sounds plausible but guesses commands, adds rules nobody asked for, cannot say why each section is there, and drifts away from the project within weeks.
The kit works in five steps. scan reads the repository without running any code and returns facts with evidence, marking what was detected directly (for example a typecheck script in package.json) and what was only inferred from a convention (for example tsc --noEmit, because tsconfig.json exists). design asks only about what the scan could not establish and saves the answers in .harness/spec.json. A rule engine derives the harness modules from that spec, and explain shows the reason and the cost of each one, including those left out. build generates the files, and check verifies that everything is consistent.
A few design decisions deserve an explanation. The harness structure comes from deterministic rules, not from a model’s creativity, because the same spec should always produce the same result, one that can be tested and compared in a diff. Decisions are data in JSON rather than prose, so they can be reviewed, changed one at a time and reproduced. A module appears only when its condition holds: the verify-change skill only at strict rigor, subagent guidance only in large repositories or monorepos, a handoff note only for multi-session work. As a result, a typical outcome is an AGENTS.md of a few dozen lines and one or two skills, not seven skills for everyone.
Files go where each tool reads them. Codex reads AGENTS.md and skills in .agents/skills. Claude Code gets a CLAUDE.md that imports AGENTS.md (@AGENTS.md), so the instructions exist once, and skills in .claude/skills, because it reads no other directory. Cursor reads AGENTS.md, .agents/skills and, for compatibility, .claude/skills, which is why the kit writes skills only once when Claude Code and Cursor are combined. In October 2026 we confirmed that Codex CLI loaded a generated AGENTS.md and .agents/skills into its prompt, and that Cursor loaded AGENTS.md as project rules and listed skills from .claude/skills. Claude Code’s paths come from its documentation; we did not have a signed-in session to confirm loading. Locations change, and the kit’s tests verify the file layout, not a given client version.
Lifecycle safety was the second priority. In AGENTS.md and CLAUDE.md the kit manages only the block between the agent-harness:begin and agent-harness:end markers; everything outside it belongs to you and is never changed. .harness/lock.json records hashes of what the kit generated and is treated as untrusted: a file can be replaced only if its bytes match the record exactly. A hand edit inside a generated region stops the build without writing anything, and the same protection applies when a module is turned off or on remove: your text stays. Re-running design refreshes facts the scan can see (layout, new sensitive areas) without overwriting decisions you already made. Every write is checked against escaping the project directory and passing through symbolic links, and --dry-run shows the full diff before any change.
WHAT THE KIT DOES NOT DOIt does not choose your stack or generate an application. It does not enforce boundaries; it shows where they can be enforced. It does not promise a measured gain in quality or token savings: no such measurement exists for this tool. Its job is a well-designed, justified and consistent working environment for the agent.
repository ──► scan ──► facts with evidence (detected / inferred)
│
your answers ──► design ◄───┘ (terminal interview, --set flags, or an AI agent)
│
▼
.harness/spec.json decisions: tools, rigor, commands, memory, approvals, rules
│
▼
rule engine ──► modules: in / left out + reason + cost ──► explain
│
▼
build ──► AGENTS.md block, CLAUDE.md (@AGENTS.md), skills, decision log
│ + .harness/lock.json (what the kit wrote)
▼
check ──► drift from the spec, missing scripts, imports,
references, skill frontmatter, size (--run: runs the checks)8. Step by step: a Next.js app developed with Codex
Take a concrete situation. You are developing an invoicing app in Next.js (TypeScript, Prisma, Stripe, next-auth, Vitest, Playwright) and you use Codex. You care about code quality, avoiding regressions and keeping agreements between sessions, but you don’t want a process that runs a dozen test suites after every small change. This is exactly the examples/nextjs-codex example in the kit’s repository, so you can reproduce every step. The commands below clone the kit, enter examples/nextjs-codex/project and load the answers from ../answers.json.
Step one is npx github:RolePlayingTech/agent-harness-kit scan. The scan finds the typecheck and lint scripts (the fast check), test (the full one), test:e2e (Playwright), the prisma/migrations directory and the stripe and next-auth dependencies. All commands are marked as detected in package.json, so there is no need to ask about them. Step two is design: in the terminal you answer a few questions, and Enter accepts the value the scan proposed. For a reproducible run the example ships answers.json with those answers (design --yes --answers answers.json). Your sentence translates into: the Codex tool, standard rigor (not strict, since you don’t want a heavy process), decisions memory (a decision log, without a handoff note), and two project rules.
It gets interesting in explain. The kit includes a standard-level definition of done, concise test output (Vitest and Playwright can print a lot), the decision log, an approval list with the Prisma migrations, and the risk-areas module. That last one is a good example of a trade-off: Stripe and next-auth are areas where a mistake is costly, but asking for approval on every edit would be exactly the heavy process you don’t want. Instead, changes there go through the full checks and are listed separately in the report. If you prefer hard approval, you add payments to the approvals. Left out are the verify-change skill (part of strict rigor), the handoff note, and the monorepo and subagent guidance, each with its reason.
build --dry-run shows the diff, and build writes four files next to the spec saved by design: AGENTS.md (48 lines), the harness-maintenance skill in .agents/skills, a seeded docs/agent/decisions.md log and the lock. Finally check confirms that the scripts in AGENTS.md exist and that the generated files match the spec, and reminds you that the five “ask before” rules are instructions only. check --run would also run the configured commands: it prints them, the directory and a trust warning first, then executes them with your permissions. Below is the complete, unmodified AGENTS.md from this example.
An agent can lead the same conversation. Just tell it: “Run npx github:RolePlayingTech/agent-harness-kit design --agent and follow its instructions to set up the harness for this repository with me.” The agent receives the harness-designer protocol: it scans the repository and reads existing instruction files first, then asks only the missing questions, maps your free-form answers to spec values, shows explain and the diff, and writes files only after you agree. The structure still comes from the rule engine, not from the model’s imagination.
LOOK AT WHAT IS MISSINGThe generated file has no TDD ceremony, no subagent instructions for a small project, no handoff note and none of the generic advice the model follows anyway. That is not an oversight but a consequence of your answers, and
explainsays so explicitly.
$ git clone https://github.com/RolePlayingTech/agent-harness-kit.git
$ cd agent-harness-kit/examples/nextjs-codex/project
$ npx github:RolePlayingTech/agent-harness-kit scan
$ npx github:RolePlayingTech/agent-harness-kit design --yes --answers ../answers.json
$ npx github:RolePlayingTech/agent-harness-kit explain
$ npx github:RolePlayingTech/agent-harness-kit build --dry-run
$ npx github:RolePlayingTech/agent-harness-kit build
$ npx github:RolePlayingTech/agent-harness-kit check
--- AGENTS.md ---
# invoice-hub
<!-- agent-harness:begin -->
## Purpose
Invoicing app for small agencies: clients, invoices, Stripe payments and reminders.
## Stack and layout
- Stack: Node.js, TypeScript, Next.js, React, Prisma
- `src/app/`: App Router routes and layouts
- `prisma/`: database schema and migrations
## Commands
- Fast check, after each meaningful change: `npm run typecheck && npm run lint`
- Full check, once before reporting a task done: `npm test`
- End-to-end, before done when a user-facing flow changed: `npm run test:e2e`
## Definition of done
- Run the fast check after each meaningful change, not only at the end.
- Before reporting done, run the full check once, plus end-to-end when a user-facing flow changed.
- When you change behavior that tests already cover, update or add a test in the same change.
- Changes touching payments (code using `stripe`) or auth (code using `next-auth`): run the full check and, if a flow changed, end-to-end before done, and list those changes separately in your report.
- Report which checks you ran and their result. Never describe a check you did not run, or one that failed, as passing.
- If the same check still fails after three fix attempts, stop. Report what you tried and what you suspect, and ask how to proceed.
## Ask before
- Pushing, merging or force-pushing to shared branches
- Deploying, releasing or publishing
- Deleting files, data or branches beyond what the task requires
- Adding, removing or upgrading dependencies
- Creating, editing or running database migrations (`prisma/migrations`)
## Project rules
- Money is stored as integer cents; never use floating point for amounts.
- Server Components by default; add "use client" only for interactive leaves.
## Memory
- Before changing architecture, conventions or dependencies, read `docs/agent/decisions.md`. When you and the user settle something that should outlast the task, add an entry there.
## Working with context
- Search (for example `rg`) before opening files, and open large files by line range.
- Run long suites with concise output and read only the failures (Vitest `--reporter=dot`, Playwright `--reporter=line`; through package scripts, pass flags after `--`). Re-run a single failing test verbosely when you need detail; do not paste whole logs.
## Skills
- `harness-maintenance` (`.agents/skills/harness-maintenance/SKILL.md`): when the user wants to change how you work, or the same problem has happened twice.
## About this file
Generated by agent-harness-kit from `.harness/spec.json`. Do not edit between the agent-harness markers: change the spec and run `npx github:RolePlayingTech/agent-harness-kit build`. Notes outside the markers are preserved.
<!-- agent-harness:end -->9. How to evaluate and evolve a harness without letting it outgrow its purpose
You judge a harness by the agent’s behavior, not by the length of its files. After setting it up, give the agent three or four real tasks and watch: does it run the fast check without being reminded, does it run the full suite before “done”, does the report honestly say what was not checked, does it stop before actions on the approval list, does it consult the decision log when it should. Every “no” points to something to improve. Every “yes” without a corresponding rule suggests the rule is unnecessary.
The signals that a harness needs to change are fairly clear. You correct the same behavior a second time. A command in AGENTS.md is wrong, slow or missing. A rule never applies, or the code contradicts it. The agent ignores an important rule; in that case, rather than repeating it in capital letters, look for a way to enforce it outside the model. The project’s stage changes: a prototype becomes a product, payments arrive, a second developer or a second AI tool joins.
In Agent Harness Kit every change goes through the spec. You can re-run design (earlier answers are the defaults, so you change only what you want), edit .harness/spec.json by hand, or let the agent propose a change through the harness-maintenance skill, which tells it to show the diff and wait for your approval. Then build --dry-run, build and check. Running check in CI, ideally with --strict, stops a pull request in which someone edited a generated region by hand or changed the spec without rebuilding the files.
The hardest part is keeping the size in check. check reports the number of always-loaded lines and warns when the budget is exceeded (200 by default, following Claude Code’s documentation), but a budget is only a signal. The real discipline is the question at every review: which rule has stopped changing anything? In the spirit of the Harness² paper, change the harness in small steps and keep only what an observation can justify, even if that is just comparing how the agent handles the same task before and after a change. The authors do this automatically on benchmarks; in everyday work, honest observation and a diff in the Git history are enough.
Finally, the limitations to keep in mind. The kit’s scan is heuristic: it understands Node.js, Python, Go, Rust and Makefiles, and in other ecosystems you answer the questions yourself. check verifies consistency, not the quality of your tests. One spec covers the whole repository; the kit does not generate nested AGENTS.md files for monorepo packages. The tool is not yet published on npm, so npx github: needs git and network access. If that command prints init or audit, you are still on v2: pin a v3 commit from the repository. And last: there is no measurement showing how much this particular harness improves an agent’s work. The kit encodes practices described by tool vendors and research, but you have to judge the effect on your own project.
REVIEW A HARNESS LIKE CODEEvery change to the instructions changes the behavior of every future agent session. That is why a harness should have a spec, a diff, a review and a check in CI, exactly like the code it helps write.
# 1. Change one decision (all other answers stay as they are)
$ npx github:RolePlayingTech/agent-harness-kit design --yes --set rigor=strict
# 2. See what will change, and why
$ npx github:RolePlayingTech/agent-harness-kit explain --brief
$ npx github:RolePlayingTech/agent-harness-kit build --dry-run
Planned changes (nothing written):
update AGENTS.md (spec changed)
create .agents/skills/verify-change/SKILL.md (new file)
update .harness/lock.json (records what the kit wrote)
# 3. Write, check, commit and review like any code change
$ npx github:RolePlayingTech/agent-harness-kit build
$ npx github:RolePlayingTech/agent-harness-kit check --run
# In CI (stops a PR that edited a generated region by hand)
$ npx --yes github:RolePlayingTech/agent-harness-kit check . --strict10. Extensible execution harnesses: DeepSeek Harness, Cordis and Creator Mode
In 2026 engineering discussions, the word harness is used for two adjacent layers that are easy to conflate. Up to this point we have focused on the repository harness: files committed to Git (AGENTS.md, CLAUDE.md, SKILL.md, decision logs, check scripts) that tell any agent how a specific codebase works. Below that sits the execution harness: the host runtime that drives the model loop, dispatches tool calls, confines subprocesses, persists session history and renders the user interface. Open-source DeepSeek Harness (@deepseek-ai/dsh) is a clear example of this runtime layer.
DeepSeek Harness is built on Cordis (“A Programming Paradigm for Spatiotemporal Composability”, arXiv:2608.25512) around an “everything is a plugin” architecture with no privileged core. Model adapters (ctx.llm), the tool registry (ctx.tools), filesystem and shell seams (ctx.fs, ctx.shell, ctx.sandbox), workspace instruction loading (dsh-agent-instructions), skill discovery (dsh-skill-filesystem), the append-only session log and even agent-loop itself are plugins whose registrations are reversible effects (ctx.effect()) that unwind cleanly when unloaded. A running dsh process boots a named profile (web, headless, sdk, sdk-minimal or acp) stacked from ordered bundles (dsh-base plus a surface bundle such as dsh-web-app) and cordis.patch.yml overlays, while enforcing one core audit rule: model-visible means logged — every model-visible input is recorded in session.vN.jsonl so turns can be replayed or inspected.
That plugin architecture enables Creator Mode, where you ask the agent in chat to build and install a plugin for its own runtime. Rather than guessing internal framework APIs from training data, Creator Mode mounts two read-only introspection tools from @deepseek-ai/dsh-tool-cordis — cordis_inspect_list and cordis_inspect_query — so the agent queries live Host and Client service definitions, event maps, tool schemas and projected JSON Schemas of loaded entries before writing code. Persistent bundles are then managed through @deepseek-ai/dsh-plugin-manager (plugin_manager, or dsh plugin in the CLI): if pnpm or bundle validation fails, package.json and pnpm-lock.yaml are restored from a pre-run snapshot; with config hot-reload (dsh-hmr) enabled in the web profile, valid bundles mount in the active session (application: applied) or explicitly report restart-required.
DeepSeek published seven Creator Mode showcase prompts — including an interactive 3D Transformer visualizer, a video editing workbench, a paper reader and a conversation-usage dashboard — to illustrate how an agent can assemble both Host tools and browser UI slots. Treat them as capability demonstrations rather than one-shot guarantees: the authors note directly that several demos required multiple iterations, and the entire project is a fast-moving developer preview with explicit compatibility-breaking changes ahead.
To test it safely on a disposable repository, run npx @deepseek-ai/dsh web (by default http://127.0.0.1:3080; add --no-open on remote SSH hosts), configure a model key under Settings → Models, and click Choose workspace — a fresh Web UI keeps the session composer locked until a workspace directory is selected. Start with a narrow, read-only task whose numbers you can verify against raw session files, require the agent to inspect APIs with cordis_inspect_* first, and review the generated bundle and cordis.patch.yml diff before approving plugin_manager installation.
DeepSeek Harness: GitHub and quick start
Open-source `@deepseek-ai/dsh` runtime, launch commands and developer-preview notice.
DeepSeek Harness: Cordis, profiles, bundles and turn flow
How reversible Cordis effects, named profiles (`web`, `headless`, `sdk`, `acp`) and session logs compose the runtime.
Cordis: A Programming Paradigm for Spatiotemporal Composability
Foundational paper behind DeepSeek Harness’s effect-based plugin composition model.
DeepSeek Creator Mode: seven demo prompts
Showcase prompts for self-built plugins and the caveat that complex demos required several iterations.
DeepSeek Harness: safety notice (`SAFETY.md`)
In-process host permissions, untrusted plugin risks, sandbox limits and disposable-environment guidance.
EXPERIMENTAL CODE IS NOT A SECURITY BOUNDARYDeepSeek’s
SAFETY.mdandplugin-managerdocs are explicit: Harness is an unaudited developer preview. Installed Host plugins run in-process outside the workspace sandbox, and profile bundles persist across future sessions on that profile (even dynamicnode:vmrunners only bound synchronousvmTimeoutMsand bridge to live Cordis services). Treat installing a plugin like granting shell access: use a disposable VM or container, no production secrets, reviewed diffs and out-of-band rollback.
# 1. Inspect the exact Cordis plugin composition your machine boots
$ npx @deepseek-ai/dsh --profile web --dump-config
# 2. Launch the local Web UI (http://127.0.0.1:3080), set a model in Settings -> Models,
# click "Choose workspace", and switch the session to Creator Mode
$ npx @deepseek-ai/dsh web
Prompt for Creator Mode:
Use cordis_inspect_list and cordis_inspect_query first to inspect the real
session and projection APIs. Build a read-only session-statistics plugin
backed strictly by committed session log records — never placeholder data.
Before calling plugin_manager to install or enable the bundle, show the
files, requested permissions and cordis.patch.yml changes. After activation,
cross-check displayed counts against raw session data and show the exact
command or Plugin Manager step to disable and remove the bundle.11. Rule, skill, MCP tool or runtime plugin? Pairing Agent Harness Kit with DeepSeek Harness
Once an agent can modify its own runtime, a new design mistake appears: reaching for a custom plugin when a one-line rule or an on-demand skill would have solved the problem with zero runtime risk. Think of extensibility as a four-rung ladder ordered by blast radius. Rung 1 is an always-loaded rule in AGENTS.md for short project invariants needed in almost every task. Rung 2 is an on-demand SKILL.md for multi-step repository procedures loaded via progressive disclosure. Rung 3 is an MCP (or WebMCP) tool when the agent needs typed access to an external system behind server-enforced OAuth scopes and prepare_* → confirm_* gates. Rung 4 — a runtime plugin or Cordis bundle — belongs only where you genuinely need to alter the execution environment itself: custom UI panels, agent/* or tools/* waterfall interceptors, new model adapters or deterministic loop guards.
Because RolePlayingTech/agent-harness-kit owns Rungs 1 and 2 (plus deterministic CI checks) while DeepSeek Harness operates at Rungs 3 and 4, the two tools complement each other cleanly — provided you account for how each runtime discovers files on disk. Checking DeepSeek’s actual loader packages reveals two concrete details worth knowing before you share one repository across tools.
First, @deepseek-ai/dsh-agent-instructions (enabled by default in dsh-base with a 65,536-byte cap per chain) loads AGENTS.md and CLAUDE.md from the .git root down to the working directory and deduplicates byte-identical files, but does not interpret @path import directives. Because Agent Harness Kit writes the real rules into AGENTS.md and puts only @AGENTS.md in CLAUDE.md, DeepSeek Harness already receives the full instructions from AGENTS.md without duplication. Second, @deepseek-ai/dsh-skill-filesystem scans <projectRoot>/.dsh/skills (rank 100) and <projectRoot>/.agents/skills (rank 200) by default, watching SKILL.md frontmatter (name, description) live — it does not scan .claude/skills unless you add it to customSkillDirs.
That gives a simple, verifiable recipe in Agent Harness Kit. If your .harness/spec.json previously targeted only claude and cursor (which writes skills solely into .claude/skills), add other (or codex) to agents: npx github:RolePlayingTech/agent-harness-kit design --yes --set agents=claude,cursor,other and run build. The kit then writes identical managed skills to both .claude/skills/ and .agents/skills/, while agent-harness check --strict in CI guarantees the two copies never drift apart. One .harness/spec.json now serves Claude Code, Cursor, Codex and DeepSeek Harness out of the box.
When you do consider building a Creator Mode plugin for engineering work, evaluate it as a falsifiable hypothesis across three controlled runs of the same task: (A) baseline runtime, (B) runtime with the repository harness from Agent Harness Kit, and (C) the same setup plus one purpose-built runtime plugin. Record task correctness, executed verification commands, failed tool attempts, wall-clock time, token usage and human interventions. Keep the plugin only if Rung 4 measurably beats Rung 1–2 enough to justify maintaining executable runtime code — and never let an AI-authored plugin silently widen its own permissions or mark unexecuted checks as green.
CHOOSE THE LOWEST LAYER THAT SOLVES THE PROBLEMA text rule in
AGENTS.mdor aSKILL.mdworkflow cannot crash the host or persist hidden background privileges across other repositories; an installed profile plugin can. Move up the extension ladder only when the lower rung cannot express or enforce what you need.
Layer / Rung What it changes Blast radius Enforced by Reach for it when...
------------------------- ----------------------------- ------------------ -------------------------- ----------------------------------------------
1. AGENTS.md rule always-loaded prompt context this repository the model (+ CI lint) a 1-line project fact applies to most tasks
2. SKILL.md workflow on-demand procedure catalog this repository the model a multi-step checklist is needed occasionally
3. MCP / WebMCP tool typed external capability scoped workspace server OAuth + gates reading live state or gating external mutations
4. Runtime plugin (Cordis) host loop, UI slots, hooks entire dsh profile host process (in-process) adding custom workbench UI or loop-level guards# Include "other" (or "codex") so agent-harness-kit emits .agents/skills/*/SKILL.md,
# which @deepseek-ai/dsh-skill-filesystem discovers automatically at rank 200:
$ npx github:RolePlayingTech/agent-harness-kit design --yes --set agents=claude,cursor,other
$ npx github:RolePlayingTech/agent-harness-kit build --dry-run
$ npx github:RolePlayingTech/agent-harness-kit build
$ npx github:RolePlayingTech/agent-harness-kit check . --strict
# Resulting repository layout read across runtimes:
# AGENTS.md -> Codex, Cursor, DeepSeek Harness (dsh-agent-instructions)
# CLAUDE.md (@AGENTS.md) -> Claude Code
# .claude/skills/<skill>/SKILL.md -> Claude Code, Cursor
# .agents/skills/<skill>/SKILL.md -> Codex, DeepSeek Harness (dsh-skill-filesystem), CursorAn AGENTS.md generated with one prompt versus a harness designed with Agent Harness Kit
| Dimension | AGENTS.md generated with one prompt | Harness from Agent Harness Kit |
|---|---|---|
| Verification commands | Often guessed from conventions (for example a typecheck script that does not exist) | Read from manifests and marked detected or inferred; check reports a missing script |
| Decisions and reasons | Hidden in prose, with no reason or cost | Recorded in .harness/spec.json; explain gives the reason and cost of every included and omitted part |
| Size | Grows with every session and every “add a rule” | A module appears only when its condition holds; check watches the line budget |
| Several tools | Separate files for Codex, Claude Code and Cursor that drift apart | One source: AGENTS.md, a CLAUDE.md import, skills where each tool reads them |
| Updates | Regenerating overwrites hand-written notes | A managed block, your content outside it untouched; a hand edit inside the block stops the build |
| Boundaries | “NEVER push to main” presented as a safeguard | Marked as instructions, with a list of places where they can be enforced |
Context Window & Harness Simulator: Raw Chat vs. Bloated Context vs. Lean Harness
Only the pasted fragments. It cannot see neighbouring files, does not know the project’s commands and cannot run anything itself.
You verify every answer by hand. Broken imports and invented APIs only surface on your side.
Everything at once: style guide, generic advice, bans and procedures the current task does not need. The important rule gets lost among the unimportant ones.
Commands written from memory go stale, and “NEVER…” gives a sense of safety that nothing enforces.
Proportions are illustrative, not measured. A short AGENTS.md with the purpose, real commands, a definition of done and boundaries is always loaded; a skill loads only when the task needs it; from test output the agent reads the failures, not the whole log.
The project’s purpose, commands that actually exist, rules that are not obvious from the code, and what was agreed in earlier sessions (the decision log).
The agent checks its own work with a fast and a full check and reports the result. Boundaries that would be costly to break are enforced by CI and permissions, not just text.
It reasons and plans, but on its own it cannot see your files, cannot run a terminal and does not remember the previous session. Everything it knows about the project comes from the harness: instructions, tool results and notes on disk.
A short always-loaded file (purpose, commands, definition of done, boundaries, rules not obvious from the code) and skills with procedures the agent sees as a name and description and loads on demand. It is text: it shapes behavior but does not guarantee it.
Tools let the agent search for a symbol instead of reading a whole directory, open selected lines of a file, run a command and fetch live state from external systems through the Model Context Protocol. The tool, not the prompt, defines what they can and cannot do.
Agreements that should survive a session are written to the repository (for example docs/agent/decisions.md), and the state of multi-session work to a short note checked against the Git history. For broad searches in a large repository a subagent reads files in its own context and returns a summary, at the cost of more total tokens.
Typecheck and linter after each meaningful change, the full suite before “done”, an honest report of what was run, and a stop rule after three failed fix attempts. A test result does not depend on how the model rates its own work, which is why the same commands also run in CI.
An “ask before” list in AGENTS.md is an instruction. Real boundaries come from mechanisms outside the model: branch protection and required review, CODEOWNERS, no production credentials in the agent’s environment, tool permission rules, and Prepare → Confirm gates built into MCP tools, as in MUMRO.
One sentence needed in almost every task — for example “store money in integer cents” or the fast check command npm run check. Zero executable host code; Agent Harness Kit keeps this block in a single source of truth.
A multi-step procedure loaded on demand (for example session handoff, database migration or strict-rigor change verification). With agents=claude,cursor,other, Agent Harness Kit writes skills to both directories so Claude Code, Cursor, Codex and DeepSeek Harness all discover them automatically.
Typed access to an external system (for example reading analytics, saving a draft or two-phase publishing in MUMRO). Permission boundaries are enforced by the remote tool server rather than a prompt or an in-process editor plugin.
Modifying the execution runtime itself — for example a Cordis bundle built in DeepSeek Harness Creator Mode (API discovery via cordis_inspect_*, persistent profile installation via plugin_manager). Unlocks custom UI panels and loop hooks, but code runs in-process on the host and persists across profile sessions.
The same method applied to the code this site is built from
MUMRO Academy is a static Astro site with bilingual content, Playwright tests and a script that verifies SEO and structured data after the build. Its harness was created earlier with the previous version of the kit (v2). We ran a copy of the repository through v3 to see what the tool would say about an existing, “living” harness.
scandetected Astro and TypeScript,astro checkas the fast check, Playwright asnpm test, and thedeploydirectory and CI workflows as areas needing approval. It did not propose a separate E2E command, because it noticed thatnpm testalready runs Playwright.- In
designwe set the full check tonpm run build && npm test, because the build runs the SEO and JSON-LD contracts, and added the one truly non-obvious rule: structural parity between EN and PL content. buildappended a managed block below the existingAGENTS.md, keeping all of its content, and created aCLAUDE.mdwith the import.checkfound two real problems in the old harness:npm run buildrepeated in the hand-written notes and in the block, and seven v2 skills copied into both.agents/skillsand.claude/skills, which can drift apart if only one copy is edited.
Workflow outcome: The tool did what it promises: it found facts, invented no commands and pointed to specific duplicates to remove. We did not measure whether the agent works better after the change; that requires observation on real tasks.
MUMRO is a harness for agents working with brands, content and marketing.
The same principles apply beyond code. An agent preparing a campaign also needs context loaded on demand instead of pasted documents, a safe place for drafts, and boundaries that do not depend only on whether the model read an instruction. MUMRO provides them as MCP tools.
- Context on demand through MCP (
get_workspace_context,get_content_strategy, cohort results) instead of pasting whole documents into the conversation. - Drafts in the workspace (
create_publication_draft,create_article_draft) separated from publishing by two-phaseprepare_*→confirm_*gates, which are part of the tool interface rather than an instruction in a prompt. - Operational boundaries: autonomy levels, quiet hours, credit limits and a Stop switch.