ain3sh/.agents/harness-optimization
Claude Code and agent skill by ain3sh/.agents
- community
Checking that the SKILL.md file is still in the repository.
Use when droids repeat a mistake despite guidance, skip a skill, or get steered wrong by a hook or tool: trace it to the first control-plane failure.
Install
npx vskill@latest install ain3sh/.agents/harness-optimizationSKILL.md
The same SKILL.md was published earlier as ain3sh/.agents/harness-optimization.
Harness Optimization
Treat the agent harness as a control plane: a model choice is locally rational until the loaded policy, available affordances, and runtime semantics prove otherwise. Correct failed decisions while preserving working behavior; remove representable failure states in execution protocols. This is not micro-tuning latency or token usage.
First question: did the agent disobey, or did the harness make the bad choice locally correct?
Act
| Goal | Action | |
|---|---|---|
| Preserve the incident | Stop retries. Save the transcript, exact tool input/output, hook decisions, full logs, cancellation state, and process IDs. | |
| Establish the intended contract | State one invariant covering observation, ownership, completion, and failure reporting. | |
| Trace the control plane | Walk instruction → model choice → hook rewrite/decision → executor → child process → output surface → operator response. | |
| Classify the first break | Name it as policy-induced behavior, enforcement gap, runtime drift, executor mismatch, observability distortion, split ownership, or recovery-loop amplification. | |
| Fix the owning layer | Preserve the working default; choose the narrowest sufficient correction in references/procedure.md → Choose the fix by hierarchy. | |
| Prove the fix | Replay the incident and the behavior to preserve; exercise the applicable lifecycle matrix in references/procedure.md. |
Detect
Load this skill when any of these are true:
- an agent repeats a workflow mistake after being corrected
- a skill exists for the moment but agents do not load it unprompted
- a skill says one thing while hooks or tools permit or suggest another
- backgrounding, polling, filtering, retries, compaction, or cancellation
changes the apparent result
- a hook blocks an action but emits an unusable or self-contradictory retry
- the visible failure is downstream of process, cache, registration, or output
ownership
- the proposed fix is growing regex branches, shell parsing, reminders, or
exception tables
Use root-cause-analysis for the first unintended effect, step-through for temporal state, and single-canon when replacing the broken contract. Do not use this skill for ordinary application bugs, isolated user error, or generic model latency/cost tuning.
Rules
- Never blame the model before comparing its exact choice with every loaded
instruction, hook affordance, and executor behavior.
- Never fix the final error first. Find the earliest point where the harness
made the bad path valid, attractive, invisible, or hard to recover from.
- Never split lifecycle ownership. One primitive owns setup, execution,
observation, persistence, cancellation, cleanup, and exit status.
- Never teach shell choreography when an argv protocol or typed tool can
remove the states entirely.
- Never repair arbitrary commands with case-based parsing. Accept one tiny
grammar; reject known violations and fail open on uncertainty.
- Never call an interrupted run a test failure, or a stored log complete
evidence unless live observation and process termination are also proven.
- Never accept prose or unit-only proof. Replay agent decisions for policy
fixes; exercise the registered hook and real executor for execution fixes.
Failure map
| Symptom | First question | Correct direction | |
|---|---|---|---|
| Agent repeats a forbidden command | Did policy examples still recommend or normalize it? | Fix policy and affordance before adding punishment. | |
| Hook blocks but retries stay wrong | Is the hook reconstructing arbitrary shell? | Emit one canonical grammar, not a rewritten command. | |
| Agent sleeps or polls logs | Who owns foreground completion and observation? | One attached runner owns both live output and persistence. | |
| Cancellation creates false failures | Did cancellation reach the whole child process group? | Forward, escalate, reap, and classify as interrupted. | |
| Cache sentinel exists but runtime is broken | Does the sentinel prove every required artifact? | Make creation transactional and validate the completeness invariant. | |
| Interactive works but automation dies | Do hook semantics differ by execution mode? | Test and document each mode explicitly. | |
| Source is fixed but behavior is unchanged | Is the active runtime registration/config still stale? | Verify live wiring and delete the competing owner. | |
| Fix accumulates special cases | Is the accepted language wider than required? | Shrink to one protocol and delete competing mechanisms. |
References
- Load on demand; do not reabsorb into this file:
references/procedure.md — evidence packet, actor-state trace, fix hierarchy, lifecycle verification matrix, stop conditions, and report schema.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/harness-optimization/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ain3sh/.agents/harness-optimization)