Harbor harness improvement loop

From fritzprix/libr-agent · View interactive version

Harbor harness improvement loop is an AI agent skill from the GitHub repository fritzprix/libr-agent. Analyze Harbor benchmark jobs and ATIF trajectories, identify evidence-backed weaknesses across LibrAgent builtin tools, prompts, agent guidance, execution policy, and benchmark instrumentation, then design controlled improvements and rerun comparisons. Use when analyzing Harbor or Terminal-Bench re

How to use this skill

Skill file

Harbor Harness Improvement Loop

Build a repeatable benchmark → diagnosis → smallest intervention → rerun

cycle. Optimize general agent capability, not benchmark-specific shortcuts.

Analysis scope (non-negotiable)

A job in this repo is a harness test. The only question is: which tool,

prompt, handler, adapter, or telemetry contract failed?

Don't care (never diagnose, compare, or narrate): model, serving engine.

Do not put those in findings, owning layers, hypotheses, outcome commentary,

contract tables, or next-cycle.

Allowed output only:

Reconstruct intent → tool call → observation → next tool. First divergence

is a tool-pattern class. No harness contract broken → write the pattern and

stop.

Hard rules

recommending changes.

is visible. Label single-trial findings as hypotheses.

concurrency, execution mode, workspace mode, timeout/resource policy, and

verifier configuration are equivalent.

add task-specific prompt clues to improve scores.

instrumentation fix is the narrower source-of-truth solution.

tool description, and result hint.

ledgers go under .libragent/work/.

Cycle

1. Freeze the experiment contract

Record:

If these cannot be established, analyze the run but mark cross-run conclusions

as unverified.

2. Inventory and validate artifacts

Collect recursively:

Run the bundled analyzer:

python .agents/skills/harbor-harness-improvement-loop/scripts/analyze_harbor_results.py \
  jobs/<baseline> [jobs/<candidate>] \
  --output .libragent/work/harbor-harness-cycle/summary.json

The script produces descriptive metrics and explicitly labels heuristic error

signals. It does not establish causality.

Before interpretation, flag:

3. Analyze outcomes and traces

Analyze successful and failed trials separately. For each representative trace:

  1. Reconstruct the sequence: intent → tool call → observation → next tool.
  2. Find the first divergence from an efficient successful path (tool pattern).
  3. Count tool selection, invalid arguments, retries, repeated calls, oversized

outputs, missing verification, premature completion, and unrecovered errors.

  1. Compare tool sequences with successful traces for the same task family.
  2. Check token/turn/tool-call distributions; do not rely on means alone.

Read references/evidence-model.md before assigning

a root cause.

4. Map each symptom to the owning layer

Use the narrowest layer that can fix the observed contract:

| Symptom | Inspect first |

| -------------------------------------------------------- | ------------------------------------------------------------------ |

| Correct tool is unavailable or consistently not selected | tool exposure, name, description, input schema |

| Tool selected with invalid/missing arguments | schema required fields, enums, examples, validation error |

| Same failed action repeats | error recovery hint, state feedback, loop/escalation prompt |

| Tool succeeds but result misleads or bloats context | handler output, truncation/pagination, structured content, hints |

| Agent uses many micro-tools for one outcome | tool boundaries, consolidation, backend automation |

| Agent skips planning/verification across unrelated tools | assistant/system/workspace prompt |

| Prompt tokens grow or cache ratio degrades | stable/volatile prompt split, tool schema volume, repeated context |

| Correct actions still produce wrong workspace state | handler semantics, isolation/sync, process lifecycle |

| Metrics are missing or contradictory | Harbor adapter, Session API telemetry, aggregation script |

Inspect the actual schema, dispatcher, handler, response builder, prompt assembly,

and tests for the suspected layer. Use critique-builtin-tool,

lean-builtin-tool-auditor, or refactor-builtin-tool when the evidence points

to builtin implementation details.

5. Form and rank hypotheses

For every proposal record:

Prefer broad, repeated, high-confidence defects. Keep low-confidence ideas in a

backlog. Do not convert all correlations into work items.

6. Choose the smallest controlled intervention

Change one causal variable per experiment when practical. Examples:

Define acceptance criteria before editing. Preserve a held-out task set to detect

overfitting.

7. Implement and verify

After user approval:

  1. Apply the minimal change.
  2. Run focused unit/contract tests.
  3. Run focused lint or formatting checks if necessary. Never run the full pnpm refactor:validate pipeline automatically (run only if explicitly requested by the user to avoid system resource starvation).
  4. Rerun a small matched task slice.
  5. If the signal is positive and no regression appears, rerun the broader suite

with multiple attempts.

Do not call a change successful from reward alone. Compare:

8. Record and continue

Write each cycle under:

.libragent/work/harbor-harness-cycle/<cycle-id>/
├── experiment.md
├── baseline-summary.json
├── candidate-summary.json
└── analysis.md

Use references/report-template.md. End each cycle

with one decision: adopt, revert, iterate, or inconclusive.

Stop conditions

Stop and report instead of changing code when:

(report the pattern; do not invent an owner outside the harness)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.