Agents Best Practices
Use this skill when the user asks how to build, improve, debug, or evaluate an agentic harness. This is a general-purpose agent architecture skill. Coding agents are one subdomain only; apply the same principles to research, finance, legal, support, operations, sales, healthcare, education, data analysis, procurement, and workflow automation agents.
Core stance
An agent harness is the control plane around a model. The model proposes actions; the harness validates, authorizes, executes, records, summarizes, and returns observations. Keep the loop simple and make the runtime rigorous.
Default architecture:
user/task
-> instruction and context builder
-> model call
-> tool/action proposal
-> schema validation
-> permission decision
-> execution or approval pause
-> structured observation
-> context update
-> repeat within budget or finish
When to activate this skill
Use this skill for prompts involving any of these intents:
- build an agent, agentic workflow, AI worker, autonomous assistant, or harness;
- create a domain-specific MVP agent design, starter harness, implementation blueprint, or first production-safe version;
- choose between OpenAI, Anthropic, OpenAI-compatible APIs, direct tool loops, hosted tools, or SDKs;
- design tools, permissions, guardrails, approval flows, or sandboxing;
- design agent-rendered interfaces, record provenance, cumulative business limits, or user-memory lifecycles;
- design an agent for a partially known or changing environment using capability discovery, safe probing, runtime binding, schema verification, or drift invalidation;
- reduce code-mode or programmatic-tool latency through speculative execution, partial-program analysis, futures, exact claim semantics, or cancellation of unused work;
- create planning mode, workflow orchestration, goal mode, todo tracking, or long-running task behavior;
- add context compaction, memory, retrieval, scoped instructions, or prompt hierarchies;
- design a recursive language model (RLM), programmable-context runtime, self-refining or continual harness, retained child agents, daemon-backed or scheduled agent, or executable skills;
- attach Agent Skills, reusable workflows, MCP servers, external connectors, or tool search;
- design agent communication through public boards with explicit public-audience disclosure, user approval, and outbound-data controls;
- audit an existing agent for reliability, cost, prompt-cache hit rate, safety, latency, or observability;
- create system prompts or developer instructions for a domain-specific agent;
- make source-of-truth knowledge, validation signals, logs, metrics, or workflow state legible to an agent.
Do not use this skill for ordinary single-turn writing, translation, or Q&A unless the user is asking about the design of an agent that will perform those tasks.
How to use this skill
First, identify the user's design problem:
- Domain: what work the agent performs.
- Autonomy level: answer-only, draft-only, approval-gated action, or autonomous action within policy.
- Risk level: read-only, internal write, external communication, financial, legal, healthcare, security, destructive, or privileged.
- State duration: single turn, multi-turn session, resumable workflow, or long-running goal.
- Tool surface: internal APIs, hosted tools, MCP/external connectors, browser, sandbox, filesystem, database, communication, or computation.
- Validation: what proves the task is complete.
Then load the most relevant reference files, not all files by default. If the user asks to make or build an agent for a domain, default to MVP Builder Mode.
MVP Builder Mode
When the user asks to make, build, design, scaffold, or specify an agent for a domain, produce a concrete domain-specific MVP harness blueprint, not only advice. Use mvp-agent-blueprint.md as the primary reference and load other references as needed.
Default behavior:
- Infer a reasonable first version from the user's domain and stated constraints.
- State assumptions briefly instead of blocking on missing details.
- Design the smallest safe harness that can accomplish useful work.
- Include the core agentic loop, tool registry, permission matrix, context/memory/compaction, planning mode, goal-like loop criteria, skills/connectors, prompt-cache/cost strategy, observability, evals, and launch path.
- Mark high-risk actions as draft-only or approval-gated by default.
- Keep the MVP to the smallest reliable single-loop harness unless the user explicitly asks for a broader architecture.
Environment-Adaptive Tool Mode
Use this mode when the useful tool catalogue, schemas, versions, or implementations are late-bound rather than fully configured before the run. Read environment-adaptive-tools.md together with the standard tool, connector, security, and eval references.
Require a small trusted bootstrap interface, host-owned capability ledger, provenance-labeled descriptors, bounded read-only or isolated probes, opaque scope-and-version bindings, call-time permission checks, and drift invalidation. Discovery, generated code, and inferred schemas must never grant authority. Keep this post-MVP unless adapting to changing environments is the product's primary job; even then, establish a fixed read-only baseline first.
Advanced Recursive and Continual Harness Mode
Use this mode only when the user explicitly asks for programmable context, recursive execution, retained children, continual refinement, executable skills, or daemon/scheduled autonomy. Treat it as post-MVP: establish a measured single-loop baseline first, then read self-refining-recursive-harnesses.md together with the context, workflow, permission, security, and eval references.
Make the context representation, recursive unit, mutable state, promotion scope, lifecycle, budgets, validation probes, and rollback path explicit. Keep base authority, permission enforcement, credentials, budgets, and evaluation policy outside the mutable surface.
Experimental Speculative Tool Execution Mode
Use this mode only when the user explicitly asks to reduce latency by launching tool work before a generated program or action is complete. Establish measured sequential and ordinary committed-parallel baselines first, then read speculative-tool-execution.md together with the loop, tool, security, and eval references.
Require host-owned eligibility, permission at physical dispatch, isolated disposable state, exact versioned claim identity, occurrence-safe handling of stochastic calls, separate waste and cost budgets, confirmed cancellation accounting, and task-parity evaluation. Partial model output never grants authority, and risky or approval-gated effects must not execute speculatively.
Reference map
- Read mvp-agent-blueprint.md first when the user asks to create a new domain-specific agent or MVP harness.
- Read coding-agents.md when the requested agent reads, edits, tests, reviews, migrates, or opens changes against a software repository.
- Read architecture.md for the full harness model and component boundaries.
- Read agent-legibility-feedback-loops.md for source-of-truth knowledge bases, agent-legible environments, validation loops, mechanical invariants, and recurring cleanup.
- Read agentic-loop.md for the provider-neutral loop, step budgets, retries, and loop variants.
- Read speculative-tool-execution.md when an advanced code-mode or programmatic-tool harness should prelaunch eligible work during generation while retaining completed-program authority and occurrence-aware claiming.
- Read tools-and-permissions.md for tool contracts, record provenance, presentation receipts, resulting-state limits, approval logic, structured results, and sandboxing.
- Read environment-adaptive-tools.md when the tool environment is partially known or changes at runtime and needs bootstrap discovery, schema validation, safe probing, exact binding, or drift handling.
- Read context-memory-compaction.md for context assembly, user-memory lifecycle and source eligibility, layered retrieval, auto-compaction, and handoff summaries.
- Read prompt-caching-and-cost.md for stable-prefix design, cache-aware context ordering, compaction/cache tradeoffs, telemetry, and cost control.
- Read planning-and-goals.md for planning mode, approval-gated execution, goals, checkpoints, and stopping conditions.
- Read workflow-orchestration.md for planner-generated workflows, bounded work packets, worker/verifier contexts, integration, durable workflow state, and orchestration anti-patterns.
- Read self-refining-recursive-harnesses.md for strict RLM and RLM-inspired patterns, programmable context, recursive execution units, retained children, continual refinement, executable skills, and long-running lifecycle controls.
- Read skills-and-connectors.md for Agent Skills, progressive disclosure, predictive loading, MCP, external connectors, tool search, and attachment strategy. For public-board communication, use its public disclosure and publication contract.
- Read system-prompts-instructions.md for system/developer/user instruction hierarchy and prompt templates.
- Read provider-api-patterns.md for OpenAI, Anthropic, and OpenAI-compatible API implementation patterns.
- Read security-observability.md for guardrails, threat models, approval records, trace design, launch safety gates, and incident response.
- Read evals.md for evaluation strategy, runtime-state fixtures, cross-capability cases, safety trace invariants, model/configuration sweeps, and eval-driven launch criteria.
- Read checklists.md for condensed implementation and audit checklists.
- Read source-links.md for official links and provider-specific references.
- Read coverage-audit.md to verify the skill covers the requested harness topics.
Default answer structure when advising a user
When the user asks for guidance, produce a concrete architecture, not generic principles:
- MVP boundary: smallest useful version, assumptions, non-goals, and launch criteria.
- Harness boundary: what the model does versus what application code does.
- Loop: how model calls, tool calls, tool results, stopping, and retries work.
- Instructions: system/developer/user instruction hierarchy and scoped memory.
- Tools: tool registry, schemas, outputs, risk classes, permissions, and approval points.
- Environment adaptation, when requested: stable bootstrap, discovery, descriptor provenance, safe probes, exact bindings, drift invalidation, and fallback.
- Context: retrieval, memory, summarization, cache-aware ordering, compaction triggers, and rehydration.
- Planning/goals: when to enter planning mode, when to run a goal-like loop, and how to stop.
- Workflow orchestration: when to decompose into durable work packets, worker contexts, verifier contexts, and integration.
- Skills/connectors: how skills and MCP/external connectors are discovered, loaded, permissioned, and audited; when public-board communication is requested, make the public audience and publication approval explicit.
- Safety: prompt injection boundaries, secrets, sandboxing, data access, and guardrails.
- Observability: traces, metrics, replay, auditability, and incident readiness.
- Evals: test cases, failure probes, trace grading, regression suites, and launch criteria.
- Rollout: minimal viable harness first, then add autonomy only when measured results justify it.
- Legibility loop: source-of-truth artifacts, validation signals, feedback capture, and recurring cleanup.
- Advanced recursive/continual profile, when requested: context handles, recursive unit, retained lifecycle, mutable state boundary, observed validation, promotion, and rollback.
- Experimental speculative execution, when requested: eligibility, exact claim identity, isolated state, waste budgets, cancellation evidence, and parity evaluation against speculation-off.
Non-negotiable principles
- The model does not execute actions directly; the harness does.
- Every tool call must receive a tool result, even if the result is denial, timeout, error, or abort.
- Every risky side effect needs runtime policy enforcement outside the model.
- Draft and commit should be separate for external, financial, destructive, security, or regulated actions.
- Tool schemas must be narrow, typed, validated locally, and auditable.
- A changing capability catalogue must enter through a trusted bootstrap contract; discovery, schema inference, and generated helpers never create permissions.
- Context should be informative, tight, and cache-aware; retrieve and attach just in time.
- Skills and external connectors should use progressive disclosure; do not expose every capability up front.
- Public-board posts are public external disclosures, not private agent memory; make this visible to the agent and user, and enforce publication approval in the host.
- Auto-compaction should preserve working state, not conversational prose.
- Long-running goals need budgets, checkpoints, and a measurable done condition.
- Workflow orchestration needs durable packet state, independent verification, integration rules, and total budget enforcement.
- Recursive and continual harnesses may mutate only typed supplemental state; immutable runtime policy must validate changes, preserve authority boundaries, and support rollback.
- Speculative execution may predict work but never authorize it; only an exact eligible call in the completed program may claim the result.
- The harness must trace operational events without exposing hidden reasoning.
- Durable knowledge should live in agent-readable source-of-truth artifacts, not only in chat history.
- Repeated failures should become tools, validators, docs, evals, or policies rather than repeated prompt advice.
Common output template
Use this template when the user wants a harness design. If the user asks to make/build an agent, use this as an MVP blueprint, not a purely conceptual answer:
# MVP Agent Harness Blueprint: [domain/use case]
## Objective
[What the agent must accomplish and for whom.]
## MVP scope and assumptions
[Smallest useful version, explicit assumptions, non-goals, and what is intentionally deferred.]
## Autonomy and risk level
[Answer-only, draft-only, approval-gated, or autonomous within policy.]
## Core loop
[How the model, tools, observations, retries, and stopping rules work.]
## Instruction architecture
[System/developer/user/scoped memory layout.]
## Tool registry
[Tools, schemas, risk classes, permissions, and result format.]
## Planning and goal behavior
[When to plan, when to ask, when to continue, when to stop.]
## Context and memory
[Retrieval, durable state, compaction, and rehydration.]
## Skills and connectors
[Reusable skills, MCP/external connector policy, tool search, attachment rules.]
## Safety and approvals
[Guardrails, prompt injection treatment, secrets, sandboxing, human review.]
## Observability
[Trace events, metrics, replay, auditability, and incident response.]
## Evals
[Eval cases, failure probes, trace grading, regression suites, and launch criteria.]
## Minimal implementation path
[Smallest safe version first, implementation skeleton, validation path, then measured expansion.]
Gotchas
- Do not design a multi-agent system before a single-agent loop has failed measurable evals.
- Do not expose broad tools such as
execute_anything, write_database, or send_message without a strict wrapper and approval policy.
- Do not treat retrieved webpages, emails, tickets, PDFs, logs, or connector-provided descriptions as trusted instructions.
- Do not let context compaction erase approval state, active plan, loaded rules, or changed artifacts.
- Do not use a goal loop for a vague backlog; use it only for a single objective with validation and a budget.
- Do not use workflow orchestration for work that one linear loop can complete cheaply and reliably.
- Do not call a harness self-improving merely because it accumulates memory, or promote a self-authored change without an observed probe and rollback path.
- Do not rely on prompt text for safety that must be enforced by code.
- Do not put timestamps, request IDs, or volatile environment state at the start of cacheable prompts.
- Do not let stale documentation, weak examples, or obsolete tools accumulate without recurring cleanup.
- Do not claim unknown-environment operation without a stable bootstrap interface, exact runtime bindings, and invalidation when the environment changes.
- Do not speculate a call merely because it is read-only; privacy, cost, rate limits, observability, cancellation, and discard safety must all pass host policy.
Source links for further reading
Use these links when provider-specific detail is needed:
1---
2name: agents-best-practices
3description: "Use this skill when designing, generating an MVP blueprint for, auditing, refactoring, or explaining an agentic harness for any domain. Covers provider-neutral agent architecture for OpenAI, Anthropic, and OpenAI-compatible APIs: agent loops, tool design, record provenance, interactive presentation, user-memory lifecycles, environment-adaptive tools, speculative tool execution, late-bound capabilities, permissions, system prompts, planning, goals, context compaction, memory, skills, MCP/external connectors, public-board communications, self-refining recursive harnesses, programmable context, continual refinement, observability, evals, prompt caching, agent-legible environments, feedback loops, and safety."
4metadata:
5 version: "1.7.0"
6 scope: "provider-neutral-agent-harness"
7 file_policy: "markdown-only"
8---910
11# Agents Best Practices
12
13Use this skill when the user asks how to build, improve, debug, or evaluate an agentic harness. This is a general-purpose agent architecture skill. Coding agents are one subdomain only; apply the same principles to research, finance, legal, support, operations, sales, healthcare, education, data analysis, procurement, and workflow automation agents.
14
15## Core stance
16
17An agent harness is the control plane around a model. The model proposes actions; the harness validates, authorizes, executes, records, summarizes, and returns observations. Keep the loop simple and make the runtime rigorous.
18
19Default architecture:
20
21```text
22user/task
23 -> instruction and context builder
24 -> model call
25 -> tool/action proposal
26 -> schema validation
27 -> permission decision
28 -> execution or approval pause
29 -> structured observation
30 -> context update
31 -> repeat within budget or finish
32```
33
34## When to activate this skill
35
36Use this skill for prompts involving any of these intents:
37
38- build an agent, agentic workflow, AI worker, autonomous assistant, or harness;
39- create a domain-specific MVP agent design, starter harness, implementation blueprint, or first production-safe version;
40- choose between OpenAI, Anthropic, OpenAI-compatible APIs, direct tool loops, hosted tools, or SDKs;
41- design tools, permissions, guardrails, approval flows, or sandboxing;
42- design agent-rendered interfaces, record provenance, cumulative business limits, or user-memory lifecycles;
43- design an agent for a partially known or changing environment using capability discovery, safe probing, runtime binding, schema verification, or drift invalidation;
44- reduce code-mode or programmatic-tool latency through speculative execution, partial-program analysis, futures, exact claim semantics, or cancellation of unused work;
45- create planning mode, workflow orchestration, goal mode, todo tracking, or long-running task behavior;
46- add context compaction, memory, retrieval, scoped instructions, or prompt hierarchies;
47- design a recursive language model (RLM), programmable-context runtime, self-refining or continual harness, retained child agents, daemon-backed or scheduled agent, or executable skills;
48- attach Agent Skills, reusable workflows, MCP servers, external connectors, or tool search;
49- design agent communication through public boards with explicit public-audience disclosure, user approval, and outbound-data controls;
50- audit an existing agent for reliability, cost, prompt-cache hit rate, safety, latency, or observability;
51- create system prompts or developer instructions for a domain-specific agent;
52- make source-of-truth knowledge, validation signals, logs, metrics, or workflow state legible to an agent.
53
54Do not use this skill for ordinary single-turn writing, translation, or Q&A unless the user is asking about the design of an agent that will perform those tasks.
55
56## How to use this skill
57
58First, identify the user's design problem:
59
601. **Domain**: what work the agent performs.
612. **Autonomy level**: answer-only, draft-only, approval-gated action, or autonomous action within policy.
623. **Risk level**: read-only, internal write, external communication, financial, legal, healthcare, security, destructive, or privileged.
634. **State duration**: single turn, multi-turn session, resumable workflow, or long-running goal.
645. **Tool surface**: internal APIs, hosted tools, MCP/external connectors, browser, sandbox, filesystem, database, communication, or computation.
656. **Validation**: what proves the task is complete.
66
67Then load the most relevant reference files, not all files by default. If the user asks to make or build an agent for a domain, default to MVP Builder Mode.
68
69## MVP Builder Mode
70
71When the user asks to make, build, design, scaffold, or specify an agent for a domain, produce a concrete domain-specific MVP harness blueprint, not only advice. Use [mvp-agent-blueprint.md](references/mvp-agent-blueprint.md) as the primary reference and load other references as needed.
72
73Default behavior:
74
751. Infer a reasonable first version from the user's domain and stated constraints.
762. State assumptions briefly instead of blocking on missing details.
773. Design the smallest safe harness that can accomplish useful work.
784. Include the core agentic loop, tool registry, permission matrix, context/memory/compaction, planning mode, goal-like loop criteria, skills/connectors, prompt-cache/cost strategy, observability, evals, and launch path.
795. Mark high-risk actions as draft-only or approval-gated by default.
806. Keep the MVP to the smallest reliable single-loop harness unless the user explicitly asks for a broader architecture.
81
82## Environment-Adaptive Tool Mode
83
84Use this mode when the useful tool catalogue, schemas, versions, or implementations are late-bound rather than fully configured before the run. Read [environment-adaptive-tools.md](references/environment-adaptive-tools.md) together with the standard tool, connector, security, and eval references.
85
86Require a small trusted bootstrap interface, host-owned capability ledger, provenance-labeled descriptors, bounded read-only or isolated probes, opaque scope-and-version bindings, call-time permission checks, and drift invalidation. Discovery, generated code, and inferred schemas must never grant authority. Keep this post-MVP unless adapting to changing environments is the product's primary job; even then, establish a fixed read-only baseline first.
87
88## Advanced Recursive and Continual Harness Mode
89
90Use this mode only when the user explicitly asks for programmable context, recursive execution, retained children, continual refinement, executable skills, or daemon/scheduled autonomy. Treat it as post-MVP: establish a measured single-loop baseline first, then read [self-refining-recursive-harnesses.md](references/self-refining-recursive-harnesses.md) together with the context, workflow, permission, security, and eval references.
91
92Make the context representation, recursive unit, mutable state, promotion scope, lifecycle, budgets, validation probes, and rollback path explicit. Keep base authority, permission enforcement, credentials, budgets, and evaluation policy outside the mutable surface.
93
94## Experimental Speculative Tool Execution Mode
95
96Use this mode only when the user explicitly asks to reduce latency by launching tool work before a generated program or action is complete. Establish measured sequential and ordinary committed-parallel baselines first, then read [speculative-tool-execution.md](references/speculative-tool-execution.md) together with the loop, tool, security, and eval references.
97
98Require host-owned eligibility, permission at physical dispatch, isolated disposable state, exact versioned claim identity, occurrence-safe handling of stochastic calls, separate waste and cost budgets, confirmed cancellation accounting, and task-parity evaluation. Partial model output never grants authority, and risky or approval-gated effects must not execute speculatively.
99
100## Reference map
101
102- Read [mvp-agent-blueprint.md](references/mvp-agent-blueprint.md) first when the user asks to create a new domain-specific agent or MVP harness.
103- Read [coding-agents.md](references/coding-agents.md) when the requested agent reads, edits, tests, reviews, migrates, or opens changes against a software repository.
104- Read [architecture.md](references/architecture.md) for the full harness model and component boundaries.
105- Read [agent-legibility-feedback-loops.md](references/agent-legibility-feedback-loops.md) for source-of-truth knowledge bases, agent-legible environments, validation loops, mechanical invariants, and recurring cleanup.
106- Read [agentic-loop.md](references/agentic-loop.md) for the provider-neutral loop, step budgets, retries, and loop variants.
107- Read [speculative-tool-execution.md](references/speculative-tool-execution.md) when an advanced code-mode or programmatic-tool harness should prelaunch eligible work during generation while retaining completed-program authority and occurrence-aware claiming.
108- Read [tools-and-permissions.md](references/tools-and-permissions.md) for tool contracts, record provenance, presentation receipts, resulting-state limits, approval logic, structured results, and sandboxing.
109- Read [environment-adaptive-tools.md](references/environment-adaptive-tools.md) when the tool environment is partially known or changes at runtime and needs bootstrap discovery, schema validation, safe probing, exact binding, or drift handling.
110- Read [context-memory-compaction.md](references/context-memory-compaction.md) for context assembly, user-memory lifecycle and source eligibility, layered retrieval, auto-compaction, and handoff summaries.
111- Read [prompt-caching-and-cost.md](references/prompt-caching-and-cost.md) for stable-prefix design, cache-aware context ordering, compaction/cache tradeoffs, telemetry, and cost control.
112- Read [planning-and-goals.md](references/planning-and-goals.md) for planning mode, approval-gated execution, goals, checkpoints, and stopping conditions.
113- Read [workflow-orchestration.md](references/workflow-orchestration.md) for planner-generated workflows, bounded work packets, worker/verifier contexts, integration, durable workflow state, and orchestration anti-patterns.
114- Read [self-refining-recursive-harnesses.md](references/self-refining-recursive-harnesses.md) for strict RLM and RLM-inspired patterns, programmable context, recursive execution units, retained children, continual refinement, executable skills, and long-running lifecycle controls.
115- Read [skills-and-connectors.md](references/skills-and-connectors.md) for Agent Skills, progressive disclosure, predictive loading, MCP, external connectors, tool search, and attachment strategy. For public-board communication, use its [public disclosure and publication contract](references/skills-and-connectors.md#agent-communication-via-public-boards).
116- Read [system-prompts-instructions.md](references/system-prompts-instructions.md) for system/developer/user instruction hierarchy and prompt templates.
117- Read [provider-api-patterns.md](references/provider-api-patterns.md) for OpenAI, Anthropic, and OpenAI-compatible API implementation patterns.
118- Read [security-observability.md](references/security-observability.md) for guardrails, threat models, approval records, trace design, launch safety gates, and incident response.
119- Read [evals.md](references/evals.md) for evaluation strategy, runtime-state fixtures, cross-capability cases, safety trace invariants, model/configuration sweeps, and eval-driven launch criteria.
120- Read [checklists.md](references/checklists.md) for condensed implementation and audit checklists.
121- Read [source-links.md](references/source-links.md) for official links and provider-specific references.
122- Read [coverage-audit.md](references/coverage-audit.md) to verify the skill covers the requested harness topics.
123
124## Default answer structure when advising a user
125
126When the user asks for guidance, produce a concrete architecture, not generic principles:
127
1280. **MVP boundary**: smallest useful version, assumptions, non-goals, and launch criteria.
1291. **Harness boundary**: what the model does versus what application code does.
1302. **Loop**: how model calls, tool calls, tool results, stopping, and retries work.
1313. **Instructions**: system/developer/user instruction hierarchy and scoped memory.
1324. **Tools**: tool registry, schemas, outputs, risk classes, permissions, and approval points.
1335. **Environment adaptation, when requested**: stable bootstrap, discovery, descriptor provenance, safe probes, exact bindings, drift invalidation, and fallback.
1346. **Context**: retrieval, memory, summarization, cache-aware ordering, compaction triggers, and rehydration.
1357. **Planning/goals**: when to enter planning mode, when to run a goal-like loop, and how to stop.
1368. **Workflow orchestration**: when to decompose into durable work packets, worker contexts, verifier contexts, and integration.
1379. **Skills/connectors**: how skills and MCP/external connectors are discovered, loaded, permissioned, and audited; when public-board communication is requested, make the public audience and publication approval explicit.
13810. **Safety**: prompt injection boundaries, secrets, sandboxing, data access, and guardrails.
13911. **Observability**: traces, metrics, replay, auditability, and incident readiness.
14012. **Evals**: test cases, failure probes, trace grading, regression suites, and launch criteria.
14113. **Rollout**: minimal viable harness first, then add autonomy only when measured results justify it.
14214. **Legibility loop**: source-of-truth artifacts, validation signals, feedback capture, and recurring cleanup.
14315. **Advanced recursive/continual profile, when requested**: context handles, recursive unit, retained lifecycle, mutable state boundary, observed validation, promotion, and rollback.
14416. **Experimental speculative execution, when requested**: eligibility, exact claim identity, isolated state, waste budgets, cancellation evidence, and parity evaluation against speculation-off.
145
146## Non-negotiable principles
147
148- The model does not execute actions directly; the harness does.
149- Every tool call must receive a tool result, even if the result is denial, timeout, error, or abort.
150- Every risky side effect needs runtime policy enforcement outside the model.
151- Draft and commit should be separate for external, financial, destructive, security, or regulated actions.
152- Tool schemas must be narrow, typed, validated locally, and auditable.
153- A changing capability catalogue must enter through a trusted bootstrap contract; discovery, schema inference, and generated helpers never create permissions.
154- Context should be informative, tight, and cache-aware; retrieve and attach just in time.
155- Skills and external connectors should use progressive disclosure; do not expose every capability up front.
156- Public-board posts are public external disclosures, not private agent memory; make this visible to the agent and user, and enforce publication approval in the host.
157- Auto-compaction should preserve working state, not conversational prose.
158- Long-running goals need budgets, checkpoints, and a measurable done condition.
159- Workflow orchestration needs durable packet state, independent verification, integration rules, and total budget enforcement.
160- Recursive and continual harnesses may mutate only typed supplemental state; immutable runtime policy must validate changes, preserve authority boundaries, and support rollback.
161- Speculative execution may predict work but never authorize it; only an exact eligible call in the completed program may claim the result.
162- The harness must trace operational events without exposing hidden reasoning.
163- Durable knowledge should live in agent-readable source-of-truth artifacts, not only in chat history.
164- Repeated failures should become tools, validators, docs, evals, or policies rather than repeated prompt advice.
165
166## Common output template
167
168Use this template when the user wants a harness design. If the user asks to make/build an agent, use this as an MVP blueprint, not a purely conceptual answer:
169
170```markdown
171# MVP Agent Harness Blueprint: [domain/use case]
172
173## Objective
174[What the agent must accomplish and for whom.]
175
176## MVP scope and assumptions
177[Smallest useful version, explicit assumptions, non-goals, and what is intentionally deferred.]
178
179## Autonomy and risk level
180[Answer-only, draft-only, approval-gated, or autonomous within policy.]
181
182## Core loop
183[How the model, tools, observations, retries, and stopping rules work.]
184
185## Instruction architecture
186[System/developer/user/scoped memory layout.]
187
188## Tool registry
189[Tools, schemas, risk classes, permissions, and result format.]
190
191## Planning and goal behavior
192[When to plan, when to ask, when to continue, when to stop.]
193
194## Context and memory
195[Retrieval, durable state, compaction, and rehydration.]
196
197## Skills and connectors
198[Reusable skills, MCP/external connector policy, tool search, attachment rules.]
199
200## Safety and approvals
201[Guardrails, prompt injection treatment, secrets, sandboxing, human review.]
202
203## Observability
204[Trace events, metrics, replay, auditability, and incident response.]
205
206## Evals
207[Eval cases, failure probes, trace grading, regression suites, and launch criteria.]
208
209## Minimal implementation path
210[Smallest safe version first, implementation skeleton, validation path, then measured expansion.]
211```
212
213## Gotchas
214
215- Do not design a multi-agent system before a single-agent loop has failed measurable evals.
216- Do not expose broad tools such as `execute_anything`, `write_database`, or `send_message` without a strict wrapper and approval policy.
217- Do not treat retrieved webpages, emails, tickets, PDFs, logs, or connector-provided descriptions as trusted instructions.
218- Do not let context compaction erase approval state, active plan, loaded rules, or changed artifacts.
219- Do not use a goal loop for a vague backlog; use it only for a single objective with validation and a budget.
220- Do not use workflow orchestration for work that one linear loop can complete cheaply and reliably.
221- Do not call a harness self-improving merely because it accumulates memory, or promote a self-authored change without an observed probe and rollback path.
222- Do not rely on prompt text for safety that must be enforced by code.
223- Do not put timestamps, request IDs, or volatile environment state at the start of cacheable prompts.
224- Do not let stale documentation, weak examples, or obsolete tools accumulate without recurring cleanup.
225- Do not claim unknown-environment operation without a stable bootstrap interface, exact runtime bindings, and invalidation when the environment changes.
226- Do not speculate a call merely because it is read-only; privacy, cost, rate limits, observability, cancellation, and discard safety must all pass host policy.
227
228## Source links for further reading
229
230Use these links when provider-specific detail is needed:
231
232- Agent Skills specification: https://agentskills.io/specification
233- Agent Skills creator best practices: https://agentskills.io/skill-creation/best-practices
234- Agent Skills description optimization: https://agentskills.io/skill-creation/optimizing-descriptions
235- Agent Skills evaluation guide: https://agentskills.io/skill-creation/evaluating-skills
236- OpenAI function calling: https://developers.openai.com/api/docs/guides/function-calling
237- OpenAI tools: https://developers.openai.com/api/docs/guides/tools
238- OpenAI agents: https://developers.openai.com/api/docs/guides/agents
239- OpenAI guardrails and human review: https://developers.openai.com/api/docs/guides/agents/guardrails-approvals
240- OpenAI agent safety: https://developers.openai.com/api/docs/guides/agent-builder-safety
241- OpenAI sandbox agents: https://developers.openai.com/api/docs/guides/agents/sandboxes
242- OpenAI Responses migration: https://developers.openai.com/api/docs/guides/migrate-to-responses
243- OpenAI prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
244- OpenAI Prompt Caching 201: https://developers.openai.com/cookbook/examples/prompt_caching_201
245- OpenAI harness engineering article: https://openai.com/index/harness-engineering/
246- Anthropic building effective agents: https://www.anthropic.com/research/building-effective-agents
247- Anthropic effective context engineering: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
248- Anthropic writing effective tools for agents: https://www.anthropic.com/engineering/writing-tools-for-agents
249- Anthropic long-running harnesses: https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
250- Anthropic code execution with MCP: https://www.anthropic.com/engineering/code-execution-with-mcp
251- MCP specification: https://modelcontextprotocol.io/specification/2026-07-28