# /harness-engineering: Build autonomous agent loops that cannot game their metric

Source: https://trendhub.net/skills/muratcankoylan-agent-skills-for-context-engineering/harness-engineering
Skill folder: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/harness-engineering
Pack: Agent Skills for Context Engineering (https://trendhub.net/skills/muratcankoylan-agent-skills-for-context-engineering)
Works with: Claude Code (plugin marketplace), Cursor, Codex, Claude Code (single skill copy)

This skill designs the control system around an autonomous agent. It sorts every file and action into four classes (locked, editable, append-only, or reserved for a human), requires fast and hard-to-game feedback, keeps state in durable logs, and adds novelty, pruning and rollback rules. Agents may prepare pull requests, but merging, deploying and credentials stay with a person.

## When to use it

- You want an agent to run experiments or research for hours with little supervision.
- An optimizing agent has started tweaking the benchmark instead of the work.
- You are building a background agent that opens pull requests.

## How it works

1. **Define surfaces**: States the objective in one sentence and assigns every file or action to locked, editable, append-only or human-controlled.
2. **Set feedback and states**: Chooses a metric, rubric, tests or human review, and defines keep, discard, crash, timeout and review outcomes.
3. **Log durably**: Creates a thread log and results files before the loop starts, recording failures and rejected ideas too.
4. **Add search discipline**: Requires novelty checks, pruning rounds and scheduled source refreshes, and prefers simpler candidates at equal quality.
5. **Validate the harness**: Runs the harness against a known good artifact and a known bad one before letting it loose.

## What it steers the agent away from

- Agents editing the evaluator and then scoring themselves with it.
- Plans kept only in chat that vanish after compaction.
- Treating permission to prepare a PR as permission to merge it.

## What it can touch

Instructions only; it shapes how you lay out loop files, logs and approval rules.

## Pairs well with

- `/evaluation`
- `/filesystem-context`
- `/self-improvement-loops`

## Questions

### What is the minimal example it builds on?

Karpathy's autoresearch setup: one editable file, a locked evaluation file, a fixed time budget, one metric, git rollback and a results log.

### Can monitoring agents act on what they see?

The skill keeps them read-only by default and asks them to cite the files behind each claim.
