Build Agent Skill

This skill helps you design and build a production-grade AI agent harness. It applies the architecture patterns in SPEC.md to your specific use case — either scaffolding a new project or auditing an existing one.

First Action (Required)

Before anything else, read SPEC.md. Look for it at:

  1. agent-harness-kit/SPEC.md (if the kit folder is in the project)
  2. SPEC.md at the project root (if it was copied there)

Do not proceed until you have read the spec. All design guidance lives there.

Intake

Ask the following questions before making any recommendations:

  1. What does the agent do? (one sentence — what task is it performing autonomously?)
  2. What tools does it need? (files, shell, network, database, APIs — list them)
  3. What side effects does it have? (what can it change, delete, or send?)
  4. What permission model do you need? (who approves actions, and which ones?)
  5. Is there existing code to work with, or are you starting fresh?

If starting fresh → Scaffold Mode If existing code → Audit Mode


Scaffold Mode (New Project)

Walk through the six components in dependency order. For each component, apply the relevant spec section before generating any code.

Step 1 — Dialog Loop Read: Spec § Component 1

Step 2 — Tool System Read: Spec § Component 2

Step 3 — Permission Pipeline Read: Spec § Component 3

Step 4 — Context Management Read: Spec § Component 6

Step 5 — Memory System (if the agent needs cross-session persistence) Read: Spec § Component 5

Step 6 — Hook System (if operators need to customize behavior) Read: Spec § Component 7


Audit Mode (Existing Code)

Read the existing agent code, then check it against the spec. Generate a gap report.

For each component in the spec:

Output format for each finding:

Component: [name]
Status: [✅ compliant | ⚠️ partial | ❌ missing | 🔴 anti-pattern]
Finding: [one sentence]
Spec reference: § Component N
Action: [what to fix, or "none required"]

Prioritize findings: 🔴 anti-patterns first, ❌ missing components second, ⚠️ partial implementations third.


Anti-Pattern Audit (Run at End of Every Session)

After scaffold or audit mode completes, run through this list explicitly:

Loop

Tools

Permissions

Context

Memory

Multi-Agent (if sub-agents are used)

Report any violations with spec section reference and suggested fix.


Code Output Conventions

Example:

// Spec § Component 1: AsyncGenerator as loop signature
async function* dialogLoop(
  initialMessage: string,
  deps: QueryDeps
): AsyncGenerator<StreamEvent> {
  // ...
}