agentleFS
maroffomaroffo/claude-forge/skills/harness-mechanic/SKILL.md

harness-mechanic

Skill17 starsChanged 52 days agoMITView on GitHub

Harness optimization: analyze execution traces, propose rule/skill improvements. Use when user says optimize harness, harness review, improve rules, meta-harness, or /harness-mechanic. Not for trace capture (use harness-trace).

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read ALL available traces: before proposing. Anecdotal sampling produces vibes-based tweaks.

    line 31
  2. Distinctive:

    Evidence or silence: Every proposal carries trace line numbers / session IDs.

    line 33
  3. Very specific:

    Read latest token baseline: quality_reports/token_baselines/

    line 40
  4. Very specific:

    Read recent traces: quality_reports/traces/ (last 10 sessions minimum)

    line 41
  5. Very specific:

    Read prior contracts: quality_reports/harness_changes/*.md (avoid re-proposing the same change)

    line 42
  6. Distinctive:

    Run the 5-stage loop above

    line 43
  7. Very specific:

    If approved: apply changes, copy draft contract into quality_reports/harness_changes/, then run /skill-forge review on modified skills

    line 45
  8. Distinctive:

    After a milestone week with many orchestrator sessions.

    line 68
  9. Distinctive:

    When the review loop is stuck (score < 80 after 2+ rounds across multiple tasks, not just one).

    line 69
  10. Distinctive:

    After noticing recurring failure patterns across sessions.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ABOUTME: Harness optimization through execution trace analysis

ABOUTME: Evidence-based proposals for improving rules, skills, and agent definitions

Harness Mechanic

An Evolution Agent (paper §3.5.2 of arxiv 2605.18747 "Code as Agent Harness") for the claude-forge runtime. Reads execution traces, token baselines, and prior change contracts; proposes evidence-backed edits to hooks/, rules/, skills/, and agents/.

Prior art (load-bearing references)

  • Meta-Harness (arxiv 2603.28052): outer-loop search over harness code via an agentic proposer that reads source, scores, and traces of all prior candidates from a filesystem. Reported +7.7 pts on text classification with 4× fewer context tokens, +4.7 on IMO problems, beats hand-engineered TerminalBench-2 baselines. The proposer-with-filesystem-access pattern is our blueprint: quality_reports/traces/, quality_reports/token_baselines/, and quality_reports/harness_changes/ ARE that filesystem.
  • AutoHarness (arxiv 2603.03329): iterative refinement of code harnesses from environment feedback. Less directly applicable (their domain is games, ours is text/orchestrator), but the principle (smaller-model + synthesized harness beats larger model) is the upper bound we're chasing.
  • Code as Agent Harness (arxiv 2605.18747) §3.5: defines the 5-stage Evolution Agent loop this skill implements.

The 5-stage loop (paper §3.5.2)

#StageWhat this skill does
1ObserveRead trace JSONL (quality_reports/traces/, schema v2; see harness-trace). Read token baseline TSV. Read prior change contracts (quality_reports/harness_changes/) for context on what's already been tried.
2DiagnoseAttribute cost/latency/invalid-actions/test-failures/permission-denials to specific harness components. Cluster across sessions: a failure mode in 1 trace is anecdote; in 5+, it's a pattern.
3ProposeConcrete edit: rewrite tool description, change context-packing rule, add a linter, modify retry limit, insert HITL gate, adjust routing pattern. Every proposal must carry a draft change contract (see quality_reports/harness_changes/TEMPLATE.md).
4EvaluateReplay against held-out traces if available; otherwise propose the smallest measurement that would falsify (matches the contract's Falsification field). A mutation no measurement has checked is still a hypothesis, so it does not reach Promote.
5PromoteOnly after user approval AND a populated change contract. Apply via standard skill edit flow. The contract's Result section gets filled in 10–20 sessions later.

Quality bar

  • Read ALL available traces before proposing. Anecdotal sampling produces vibes-based tweaks.
  • One change = one failure mode (mirrors the change-contract rule). Bundling makes falsification ambiguous.
  • Evidence or silence. Every proposal carries trace line numbers / session IDs. No speculation.
  • Telemetry-only failures (cost, latency, denials) are first-class targets, not just task failures. Paper §3.5.1: "token-cost traces reveal when retrieval or reflection stages consume budget without improving verification outcomes."

Workflow

On-demand: /harness-mechanic

  1. Read latest token baseline: quality_reports/token_baselines/
  2. Read recent traces: quality_reports/traces/ (last 10 sessions minimum)
  3. Read prior contracts: quality_reports/harness_changes/*.md (avoid re-proposing the same change)
  4. Run the 5-stage loop above
  5. Present proposals + draft change contracts for approval
  6. If approved: apply changes, copy draft contract into quality_reports/harness_changes/, then run /skill-forge review on modified skills

Prerequisites

CheckHow
Traces existls quality_reports/traces/*.jsonl
Schema is v2Latest traces should have "v":2 (see harness-trace SKILL.md)
Baseline existsls quality_reports/token_baselines/*.tsv
No traces?Run harness-trace extract on recent sessions first
No baseline?Run harness-trace baseline --base-dir . first

Governance (paper §3.5.3)

This skill is itself subject to the PEV (plan-execute-verify) loop. Treat every proposal as a code change to a safety-critical runtime:

  • Changes to permission boundaries, network access, credential handling, or hook behavior → require HITL approval before activation. No exceptions.
  • Changes to prompt/instruction text → can proceed with normal review, but still need a change contract.
  • Changes that expand the permission surface (e.g. relax a deny rule, broaden an allowlist) → 🔴 always, contract mandatory.

When to run

  • Weekly review (e.g. Friday end-of-day).
  • After a milestone week with many orchestrator sessions.
  • When the review loop is stuck (score < 80 after 2+ rounds across multiple tasks, not just one).
  • After noticing recurring failure patterns across sessions.

Common issues

IssueAction
No traces availableExtract from session JSONL: harness-trace extract
Fewer than 5 sessions of tracesDefer: sample too small, retry next week.
All scores high, no patternsSkip; harness is working well. Note this in a short log entry.
Baseline missingRun harness-trace baseline
Proposal seems risky🔴 by default; reject and ask for alternatives.
Composite tasks fail but steps look OKUse cascade analysis: check atomic skill metrics (LOCALIZE precision, REPRODUCE success, review_validity) to find the root skill deficiency.
Same skill weak across sessionsTarget the corresponding orchestrator step or agent prompt, not broad rule changes.
Token cost regression with no quality gainPaper §3.5.1: this is a first-class signal. Likely retrieval/reflection bloat; propose a context-packing rule.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.