harness
Agent harness architecture — structure a project's agent context across layers for effective AI-assisted development. Covers CLAUDE.md, skills, design docs, hooks, and all artifacts that shape how an agent understands and operates in a codebase. Use when setting up or improving a project's agent configuration, when agent context feels bloated or disorganized, when onboarding a new project for AI-assisted development, or when the agent keeps losing architectural awareness mid-task. Trigger on phrases like "set up claude", "improve CLAUDE.md", "agent keeps forgetting", "context is too long", "harness setup", "organize agent context", "how should I structure my prompts". Supports arguments: `/harness audit` to evaluate an existing project's context architecture, `/harness init` to set up harness from scratch.
NPX Install
npx skill4agent add lidessen/skills harnessTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Harness Architecture
Commands
- → Read and follow
/harness auditin this skill directory. Evaluate an existing project's context architecture and suggest improvements.commands/audit.md - → Read and follow
/harness initin this skill directory. First-time project setup — bootstrap a project's harness from scratch.commands/init.md - No argument → Continue with the methodology below.
Part I: Context Architecture
The Three Layers
┌─────────────────────────────────────────────────────┐
│ L1 Architecture │
│ System shape, boundaries, invariants, principles │
│ Always in context. Small, stable, high-leverage. │
│ ≈ 100–500 tokens per artifact │
├─────────────────────────────────────────────────────┤
│ L2 Design │
│ Patterns, mechanisms, approach, task plan │
│ Loaded on activation. The working blueprint. │
│ ≈ 1000–5000 tokens per artifact │
├─────────────────────────────────────────────────────┤
│ L3 Implementation │
│ Concrete code, scripts, reference data, examples │
│ Loaded on demand. The raw material. │
│ Size varies — only what's needed right now │
└─────────────────────────────────────────────────────┘Mapping Artifacts to Layers
L1 (always present) L2 (on activation) L3 (on demand)
───────────────────── ────────────────────── ──────────────
CLAUDE.md Skill body (SKILL.md) scripts/
Skill metadata design/DESIGN.md references/
(name + description) blueprints/ assets/
Hook triggers Task plans Code files
Project-level invariants Decision records Test fixturesCLAUDE.md — the L1 anchor
- What this system is — one sentence
- How to build/test/run — the commands, nothing more
- Architectural shape — module boundaries, data flow, key patterns (or a pointer to design/ if using design-driven)
- Non-obvious conventions — things the agent can't derive from code
Skills — L1 metadata, L2 body, L3 files
- L1: +
namein frontmatter (~100 tokens). Loaded at startup for all installed skills. This is how the agent decides whether to activate a skill — make it precise.description - L2: The markdown body of SKILL.md (<5000 tokens). Loaded when activated. Contains the methodology, the loop, the principles.
- L3: Supporting files (commands/, scripts/, references/). Loaded only when the skill dispatches to them.
Context Principles
Diagnosing Layer Problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Agent forgets project architecture mid-task | L1 too thin or missing | Add architectural context to CLAUDE.md |
| Agent drowns in context, slow responses | L1 too thick — L3 details leaking up | Audit CLAUDE.md, move details to L2/L3 files |
| Agent breaks module boundaries | No design docs or CLAUDE.md lacks boundaries | Add design/ or architectural section to CLAUDE.md |
| Agent loads unnecessary files | Skill body has too many inline references | Split into supporting files, load on demand |
| Agent repeats same mistakes | Missing hook or missing L1 principle | Add a hook (mechanical) or CLAUDE.md rule (judgment) |
Part II: Agent Lifecycle
Succession over persistence
One task, one context
Hooks — lifecycle guardrails
- Prompt hooks — inject a reminder, let the agent apply judgment. Best for checks that need context awareness (layer integrity, consistency, architectural boundaries).
- Script hooks — run a command, pass or block mechanically. Best for checks that don't need judgment (linting, format validation, forbidden patterns).
Consistency after change
Meta-principle
Understand why, not just what
"If we want models to exercise good judgment across a wide range of novel situations, they need to be able to generalize — to apply broad principles rather than mechanically following specific rules." — Anthropic's constitution