Agent Harness
Use for model-calling systems where context, tools, permissions, memory, traces, and runtime control must be explicit.
Boundaries
- Harness: prompt assembly, context building, model calls, tool calling, parsing, approvals.
- Runtime: sessions, workers, retries, queues, recovery, orchestration.
- Memory: short-term context, durable project facts, retrieval, compaction, redaction.
- Tools: schemas, adapters, execution wrappers, permission gates.
Pair with:
skills/building-agents/SKILL.mdfor broader agent-building guidanceskills/project-state/SKILL.mdfor state/memory filesskills/security/SKILL.mdfor permissions, prompt injection, secrets, and tool riskskills/verification/SKILL.mdfor evals, replay, static checks, and runtime validation
Workflow
- Map actors, model providers, tool surface, permissions, memory, session lifecycle, and high-risk actions.
- Make instruction precedence and prompt assembly inspectable.
- Keep tool schemas, arguments, return values, and errors explicit.
- Gate risky tools by action, path, scope, or approval.
- Bound execution with max steps, retries, cancellation, and timeouts.
- Persist enough trace/state to debug and replay critical flows.
- Verify with provider mocks, tool mocks, policy tests, parser recovery, and replay/eval cases.
Core Rules
- No hidden instruction injection paths.
- No vague "do everything" tools hiding side effects.
- Validate tool input before execution and output before reuse.
- Separate read-only, write, network, execution, and destructive tool classes.
- Treat stale memory, prompt injection, unsafe delegation, and over-broad permissions as first-class risks.
- Fail closed for unsafe actions; fail open only for harmless convenience helpers.
Suggested Layout
src/myapp/
├── harness/
├── runtime/
├── prompts/
├── tools/
├── permissions/
├── context/
├── memory/
├── parser/
├── evals/
├── storage/
└── traces/
Verification
- prompt assembly precedence
- provider mock and streaming behavior
- tool schema validation
- permission and approval decisions
- malformed output and parser recovery
- retry, timeout, cancellation, max-step behavior
- replay/eval fixtures for important tasks