harness-engineering
Skill0 starsChanged 4 months agoMITView on GitHub
Design, build, audit, and debug AI agent harnesses — the scaffolding around a model (context delivery, tool interfaces, agent loops, planning artifacts, memory, permissions, sandboxing, verification, observability) that determines whether an agent succeeds on real tasks. Use this skill whenever the user is building an AI agent or agentic system, or when an existing agent is unreliable, even if they never say the word "harness": an agent that keeps failing, loops, or forgets instructions; running out of context / compaction problems; designing or trimming tools and MCP servers; writing AGENTS.md or CLAUDE.md files; choosing a multi-agent or orchestration pattern; setting up evals, permissions, sandboxes, or memory for agents; making long-running agent tasks survive across sessions. Also use it to review an agent setup before production ("is this agent ready to ship?").
28 other projects use a version of this.
Adopted by
Most recently taken up by
- wxxb789/hoatheir own version, first seen Nov 29, 2026
- AnonymXXX/agent-harness-engineeringtheir own version, first seen Nov 29, 2026
- AnonymXXX/codex-harness-engineeringtheir own version, first seen Nov 20, 2026
- dvy1987/agent-loomtheir own version, first seen Nov 15, 2026
- anuragsarkar97/skillstheir own version, first seen Nov 8, 2026
- Mark393295827/graph-engineering-architecturestheir own version, first seen Nov 8, 2026
Used with
Projects with it also use self-improvement-loops, bdi-mental-states and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
DVwebBiz11Skillself-improvement-loops
This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-based search over agent scaffolds, acceptance gates for self-modifying systems, and agentic context evolution where the mechanism that produces context is versioned and evolved. Route governance of a single autonomous loop (locked surfaces, durable logs, rollback, novelty gates, approval boundaries) to harness-engineering, measurement and quality-gate design to evaluation, judge design to advanced-evaluation, and remote sandbox infrastructure to hosted-agents.
Also in 4 projects that use this
Downey6689Skillbdi-mental-states
Transforms external RDF context into BDI mental states. Invoke when modeling beliefs, desires, and intentions.
Also in 5 projects that use this
Downey6689Skillhosted-agents
Guidance for hosted/sandboxed agents. Invoke when running background agents in isolated VMs or multi-client setups.
Also in 5 projects that use this
DVwebBiz11Skilllong-horizon-prompting
This skill should be used when writing, enhancing, or evaluating the launch prompt for a long-running autonomous agent or a parallel multi-agent orchestration attacking a hard problem: pseudo-formal task briefs that define terms and an exact success predicate linguistically, enumerate non-counting outcomes, set persistence rules with explicit stop and return conditions and effort floors, manage a diverse portfolio of parallel approaches with an approach registry and blocked-route bookkeeping, and gate the return on adversarial audit. Route agent topology and coordination protocols to multi-agent-patterns, runtime control surfaces and loop governance to harness-engineering, evaluator and quality-gate construction to evaluation, judge design to advanced-evaluation, and compaction or memory mechanics to context-compression and memory-systems.
Also in 4 projects that use this
AbdelrhmanAlquranSkilllatent-briefing
This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent briefing", "reduce worker tokens", "cross-agent memory without summarization", or discusses Attention Matching compaction, recursive language models with workers, or token explosion in hierarchical agents.
Also in 4 projects that use this
abdullah1854Skillcontext-degradation
Also in 5 projects that use this
- +2 more from Downey6689
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 28
- github/awesome-copilot★ 42ksame name
- muratcankoylan/Agent-Skills-for-Context-Engineering★ 18ksame name
- kangarooking/kangarooking-skills★ 779same name
- magnus919/agent-skills★ 197same name
- brake71/1c-ssl-skills★ 90same name
- docxology/template★ 25same name
- charlesanim/harness-engineering★ 20same name
- fiveonecode/agent-skills★ 20same name
- DamonZS/Claude-Codex-Pro-Tool★ 15same name
- drewid74/ai_skills★ 8same name
18 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 56
The context window is a finite, curated resource: Prefer navigation over bulk loading (search/index/pointer tools instead of whole-file …
- Distinctive: line 83
When asked to fix or improve an agent, do not start by rewriting the prompt.
- Distinctive: line 160
Read the one that matches the problem.
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Harness Engineering
Harness engineering is the discipline of designing the scaffolding that surrounds an AI agent — context delivery, tool interfaces, planning artifacts, verification loops, memory systems, permissions, and sandboxes. The unit of capability is not the model; it is agent = model + harness, and in practice the harness is usually the binding constraint:
- Harness-only changes moved LangChain's coding agent from rank 30 to top 5 on Terminal Bench 2.0 — no model swap.
- Constraining the tool space per workflow phase took local models from 2/10 to 10/10 on a SWE-bench subset (statewright).
- Harness configuration alone swings benchmark results by 5+ percentage points (Anthropic, 2026 Agentic Coding Trends), and infrastructure noise (container resources) can swing them 6+ points more.
- Harness-only tuning brought a much cheaper model within one point of a frontier model at ~1/10th the cost (LangChain/Nemotron playbook).
So when an agent misbehaves, treat it as a harness defect first and a model limitation last. Most "the model is dumb" complaints are configuration problems with a mechanical fix.
Operating principles
These recur across every serious treatment of the subject (Anthropic, OpenAI, LangChain, Fowler, Microsoft, and the research literature). Apply them before reaching for patterns.
- Every harness component encodes an assumption that the model can't do something — and those assumptions expire. When you add scaffolding, write down what capability improvement would make it unnecessary (the bundled HARNESS_CHECKLIST.md has a table for this). Design for removal, not accretion.
- If guidance wasn't in the loaded context, it didn't happen (Stripe's steering studies). Agents ignore passive documentation; they obey what is actually in the context window — system prompts, skill files, tool error messages, CLI output. Put steering where the model will actually see it, at the moment it acts.
- Never rely on compaction to preserve critical rules. Compaction keeps the current task and recent errors; it loses initial instructions, style rules, and intermediate decisions. Anything that must survive belongs in a file that is re-read or re-injected (CLAUDE.md / AGENTS.md / a plan file), not in conversation history.
- The context window is a finite, curated resource. Prefer navigation over bulk loading (search/index/pointer tools instead of whole-file reads), compress tool outputs before they enter context, and keep durable state in the filesystem. "What configuration of context produces the desired behavior?" is the design question — not "what prompt wording."
- Tool design is agent UX. Few tools, unambiguous names, minimal schemas, error messages that say what to do next, consistent return shapes. Too many MCP servers bloat context and degrade every decision; curate to roughly a dozen tools an agent actually needs (Open SWE caps at ~15).
- Make the deterministic parts deterministic. Permissions, protocol gates, schema validation, lint/test gates, and state-machine phase constraints belong in code and hooks the model cannot override — not in prompt-level trust. Multi-agent systems are distributed systems: every handoff needs typed schemas and boundary validation.
- Verification is part of the loop, not a post-hoc step. The agent must be able to run its own verification command and see the result before declaring success. Feedback must be terse: a few summary lines into context, full detail to a log file.
- Evals are the training data for harness work. You cannot tune what you cannot measure. Before iterating on a harness, define what "better" means with runnable checks; separate capability evals (low pass rate, improvement target) from regression evals (near-100%, protection target).
Workflow: diagnosing and fixing an agent
When asked to fix or improve an agent, do not start by rewriting the prompt. Work the failure back to a component:
- Reproduce and read the trace. Get the actual transcript/trace of a failure, not a description of it. Look at what was in context at the decision point that went wrong.
- Classify the failure (deepset's framework — each class maps to a different fix):
- Context failure — the agent didn't know something it needed (missing, evicted, or buried). Fix context delivery, not the model.
- Constraint failure — the agent did something it shouldn't have. Fix permissions, hooks, tool scoping, or state-machine gating.
- Verification failure — the agent believed it succeeded but hadn't. Fix the feedback loop: tests it can run, error surfaces it can read.
- Planning failure — the agent lost the thread on a long task. Fix planning artifacts, decomposition, milestones, or handoff state.
- Make the smallest harness change that addresses the class, then re-run the same scenario. One variable at a time — harness changes compound and interact (Anthropic's April 2026 postmortem traced a visible quality regression to three independent, individually-minor harness changes).
- Record the assumption. Note why the component exists and when it can be removed.
Symptom → component map
| Symptom | Likely component | Reference |
| Forgets instructions mid-task, ignores style rules after a while | Context delivery / compaction | references/context-and-memory.md |
| Burns tokens re-reading files, context fills up fast | Context delivery (navigation, output compression) | references/context-and-memory.md |
| Doesn't retain anything across sessions; repeats old mistakes | Memory & state | references/context-and-memory.md |
| Wrong tool calls, malformed arguments, flailing between tools | Tool design / tool surface size | references/tools-and-interfaces.md |
| Ignores your SDK/library conventions | Skills / steering placement | references/tools-and-interfaces.md |
| Loops, stalls, never terminates, or stops too early | Agent loop (stop conditions, budgets, loop detection) | references/loops-and-orchestration.md |
| Falls apart on long/multi-day tasks | Planning artifacts + cross-session handoff | references/loops-and-orchestration.md |
| Subagents conflict or drop work at handoffs | Orchestration (typed handoffs, topology) | references/loops-and-orchestration.md |
| Does dangerous/unwanted things; approval fatigue | Permissions, sandboxing, HITL gates | references/security-and-permissions.md |
| Claims success on broken output | Verification loop | references/verification-and-observability.md |
| "It got worse and we don't know why" | Observability + regression evals | references/verification-and-observability.md |
Building a harness from scratch
For a new agent, decide these in order — each layer constrains the next:
- Loop shape — single conversational loop, plan-then-execute, or orchestrated
subagents? Default to the simplest loop that fits; add topology only when a measured
problem demands it (
references/loops-and-orchestration.md). - Tool surface — the minimal set of well-named tools; bash + filesystem is often
better than dozens of bespoke tools (Microsoft's SRE agent went from 100+ tools to
files + grep and improved). (
references/tools-and-interfaces.md) - Context strategy — what's always in context (conventions, constraints), what's loaded on demand (progressive disclosure), what lives in files.
- Control mechanisms — permission rules, hooks, sandbox boundary, HITL gates
(
references/security-and-permissions.md). - Verification — the commands the agent runs to know it's done, wired into the loop
(
references/verification-and-observability.md). - Instrumentation — tracing from day one; you will need it the first time something
inexplicable happens (
references/verification-and-observability.md).
Then instantiate the planning artifacts:
Bundled templates
Copy from templates/ into the user's project and fill in — don't invent new formats
when these fit:
templates/AGENTS.md— project-level agent instructions: conventions, explicit tool permissions (allowed / restricted / not allowed), verification gates. Works as a base for CLAUDE.md too.templates/PLAN.md— task planning artifact: milestones each with its own verification command, scope boundaries, running decision log. Create at task start for any non-trivial task; the agent updates it during execution.templates/IMPLEMENT.md— append-only implementation log: decisions, deviations from plan, open questions. Pairs with PLAN.md on long-running work.templates/HARNESS_CHECKLIST.md— pre-production review checklist across instructions, tools, context, planning, permissions, and verification — plus the "when should this component be removed" table. Use it when asked to review or audit an agent setup.
Reference files
Read the one that matches the problem; each contains distilled design patterns followed by a curated, annotated resource list (from ai-boost/awesome-harness-engineering) for deeper research with WebFetch when you need a primary source.
references/context-and-memory.md— context delivery, compaction, prompt caching, navigation-over-loading, memory architectures, cross-session state.references/tools-and-interfaces.md— tool naming/schema/error design, MCP, skills and progressive disclosure, code-execution-over-tool-calls.references/loops-and-orchestration.md— loop anatomy and stop conditions, planning artifacts, long-horizon/multi-session patterns, multi-agent topologies, human-in-the-loop.references/security-and-permissions.md— permission models, sandboxing options, prompt injection defenses, credential isolation, the lethal trifecta.references/verification-and-observability.md— verification loops, eval design, CI integration, tracing, debugging methodology, cost controls.references/foundations-and-resources.md— canonical essays, reference implementations worth studying, meta-harness/self-improving-harness work, production case studies. Read when the user wants background, a reading list, or examples to model a design on.
Scope notes
- This skill is model-agnostic: the same discipline applies to Claude Code, Codex, custom Agent SDK apps, LangGraph/ADK/CrewAI systems, or hand-rolled loops.
- Distinguish harness engineering from prompt engineering: if the fix is "explain the task better," it's a prompt; if the fix changes what the agent can see, do, or verify — the loop, tools, context, state, or gates — it's the harness. This skill is for the latter.
- "Harness" here is the AI-agent scaffolding sense, not Harness the CI/CD company.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

