AGENT SKILL

finhub-harness-evolve

Harness evolution skill. Collects and generalises feedback on the run results of a harness in use, applies it to the agents, skills and orchestrator, captures the delta against the initial setup, and updates the change history. Always use this skill when the user asks to improve an existing harness from its run experience: 'harness retrospective', 'evolve the harness', 'evolve the finhub harness', 'apply feedback to the harness', 'improve the harness', 'the result was disappointing, fix the harness', 'fold this feedback into the harness', 'fold feedback into the harness', 'summarise harness lessons'. New harness builds, structural redesign and adding agents belong to the finhub-harness skill.

License 许可
Apache-2.0
最近更新
2026-11-12
Stars
★ 1
Forks
0

01 前言 Front Matter

name
finhub-harness-evolve
description
Harness evolution skill. Collects and generalises feedback on the run results of a harness in use, applies it to the agents, skills and orchestrator, captures the delta against the initial setup, and updates the change history. Always use this skill when the user asks to improve an existing harness from its run experience: 'harness retrospective', 'evolve the harness', 'evolve the finhub harness', 'apply feedback to the harness', 'improve the harness', 'the result was disappointing, fix the harness', 'fold this feedback into the harness', 'fold feedback into the harness', 'summarise harness lessons'. New harness builds, structural redesign and adding agents belong to the finhub-harness skill.

03 SKILL.md 正文

Harness Evolve — the evolution mechanism for harnesses

Ported from revfactory/harness v2.1.0 (Apache-2.0), translated to English and adapted for FinHub. Original: https://github.com/revfactory/harness

A harness is not a fixed artefact; it is a system that evolves. This skill captures the delta of "what worked and what did not" and feeds it back into the harness, so the next run is measurably better.

Initial harness ──▶ Use on a real project ──▶ Current harness
                                                   │
                                                   ▼ (capture the delta with evolve)
                                   Generalise feedback → apply to agents, skills, orchestrator
                                                   │
                                                   ▼
                                   Update change history → the next run starts from a better draft

Workflow

Phase 1: Collect the delta

  1. Read .claude/agents/, .claude/skills/ and CLAUDE.md (the change-history table).
  2. If this is a git repository, inspect the history of the harness files (git log --oneline -- .claude/ CLAUDE.md) to see what changed since the initial setup, when, and why.
  3. If _workspace/ exists, skim the intermediate artefacts of the most recent run for evidence of what actually executed:
    • Do the artefacts exist at the paths the orchestrator defines? (If not, the workflow was bypassed or is dead code.)
    • Does artefact quality follow the format and criteria the skills specify?
  4. Ask the user for feedback (skip if they already gave it):
    • "Is there anything in the results you would improve?"
    • "Is there anything about the agent composition or workflow you would change?"
    • Do not press if there is no feedback. But if any observation signal below is present, proactively propose improvements.
  5. Quote safely. Feedback, logs and traces can carry credentials. A prose rule cannot guarantee that none leaks; this one lowers the risk and the check in Phase 4 looks at what you wrote. (adapted from references/openharness/src/openharness/services/autodream/prompt.py:43 (MIT))
    • A secret is: an API key or token (an sk-, sk_live_, ghp_, github_pat_, xox or AIza prefix, AKIA plus 16 characters), a Bearer or Basic credential, a private-key block, a JWT (eyJ and two dotted segments), the value after api_key=, secret_key=, token=, secret= or password=, or a URL with user:password@. Treat any other string the user calls a credential the same way.
    • Never copy one into a lesson, the change history, the report, a harness file or a memory note. Replace the whole value with [REDACTED:<kind>] (api-key, bearer, private-key, jwt, password or credential-url), keeping no first or last characters, no length and no hash. Cite the file and line instead of quoting the line.
    • Not secrets: a 40-hex commit id, a UUID, a placeholder such as <TOKEN> or xxxx, and the bare word "token" or "password" with no value after it. When unsure, redact; the cost is a less specific lesson.
  6. Open the evidence before you form a lesson. Every lesson cites path:line of a file you opened in this run and says what in that line supports it: a run artefact under _workspace/ (a trace, a log, a QA report, a judge verdict) or a harness file (an agent, a skill, the orchestrator, CLAUDE.md). A missing instruction is evidenced by the file that should hold it plus a search that finds nothing (grep -c printing 0). The user's words are the symptom, not the evidence: record them as the symptom, then find the file. A note or memory from an earlier run is a point-in-time claim until you re-open its file. Every path:line you cite is a path from the project root that exists inside the project: no absolute path, no .., and never the file that holds the user's feedback. Write each cited path in full from the project root every time you mention it, for example .claude/skills/<name>/SKILL.md:17, never a bare SKILL.md:17. A request not to open the artefacts does not waive this. A lesson with no such file is unclassified (Phase 2). (adapted from references/openharness/src/openharness/skills/bundled/content/diagnose.md:28 (MIT); adapted from references/openharness/src/openharness/memory/schema.py:199 (MIT))
  7. Close an earlier pending change. Search the change history for changes still waiting on a rerun (grep -n 'pending fresh rerun' CLAUDE.md), and skip a row that a later Decision on the <date> change row already closes. For each open row, look for a run of the job its job: field names, made in a session that started after the change, whose artefact you can open. If there is one, it is that change's fresh rerun: decide it by the rules of Phase 4 step 6 and cite the artefact line. If there is none, the row stays pending and you claim nothing for it. Each decision is a new change-history row whose Change cell starts Decision on the <date> change: <keep|revise|remove> - <path>:<line>; in the report the same decision is the line Decision: <keep|revise|remove> - <path>:<line> (Phase 5). A keep changes no instruction, so a run whose only result is a keep is still a no-op run (Phase 2): its report starts with the NO-OP: line, and its one exception is that row, written after the Phase 3 backup gate for CLAUDE.md. A revise or remove is a change like any other: its LESSON line cites the rerun artefact, and Phase 3 applies.

Observation-based evolution signals (propose even without feedback):

  • Traces of the same kind of correction request two or more times.
  • A pattern of an agent repeatedly failing or retrying.
  • Traces of the user bypassing the orchestrator and working by hand (suspect an orchestrator trigger failure; candidate fix: expand the description).
  • v1 artefacts left in the orchestrator (the removed v1 team-creation and team-deletion calls, or the experimental agent-teams flag) — point to the migration procedure in the finhub-harness skill.

Where this runs. Claude Code: all of it (the files, .claude/, and a shell for the backup and the check). Claude chat and Claude Cowork: unverified for editing a file in place, running a shell, or reading CLAUDE.md and .claude/ at all; the finhub-harness surface notes record file creation as account-dependent and the change history as believed unavailable. There, ask the user to paste the files and the feedback, write the LESSON lines and the proposed text, and edit nothing; a proposal needs no backup. If the surface does let you edit a file the user supplied, the Phase 3 backup gate applies first. (adapted from references/openharness/src/openharness/services/autodream/prompt.py:24 (MIT))

Phase 2: Classify the feedback type and map it to a target

Diagnose the layer first. Before choosing a fix, put each failure in exactly one layer, using the evidence from Phase 1 step 6. (adapted from references/openharness/src/openharness/skills/bundled/content/diagnose.md:23 (MIT))

Layer The failure is here when the evidence shows The fix usually goes in
routing the wrong skill, agent, mode or input was picked, or nothing fired a skill description, the orchestrator's dispatch step
execution a step ran and a tool call failed, timed out or returned something unexpected the agent definition, the orchestrator's error table
verification an output was produced but no check caught that it was wrong, or no check ran the QA agent, the checklist
governance a rule, gate or approval step halted the run on purpose the rule's own text, a hook, the policy in CLAUDE.md
  • Between execution and governance only: a tool error caused by a deliberate rule (a deny hook, a permission policy, a scope rule, an approval step) is governance, not execution.
  • Any other failure whose evidence fits two layers (a wrong pick that a rule then blocked is routing) takes the earlier one in the order routing, execution, verification, governance, because an earlier failure explains a later one. Write one lesson line per failure and put "also: <other layer>" at the end of that same line, never on a second line; the layer field holds one value.
  • A failure that fits no layer, or has no evidence you opened, is unclassified. List it in the report with the artefact that would settle it, and edit nothing for it. (adapted from references/autogpt/classic/direct_benchmark/analyze_failures.py:75 (MIT))

Write each lesson as one line, so it can be checked: (adapted from references/autogpt/classic/original_autogpt/autogpt/agents/prompt_strategies/reflexion.py:114 (MIT))

LESSON | layer: <routing|execution|verification|governance|unclassified> | cause: <context-gap|judgment-gap> | evidence: <path>:<line> - <what in that line supports the lesson> | fix: <file to change> - <the change, with its Why>

Each lesson also names the cause of the miss, in the field right after layer:, set by its evidence rather than by doubt: cause: judgment-gap when the evidence: line cites something the failing step was handed (the brief, the design or a routed file), and the fix is a check; cause: context-gap otherwise, and the fix goes into the brief, design or route that should have carried the fact. An unclassified lesson carries its cause too. Where the finhub-harness skill's scripts are installed, run python3 <finhub-harness skill dir>/scripts/finding_tags.py check <evolve report> before the report and fix every line it refuses (exit 4); where they are not (this skill is packaged on its own), check by eye that every LESSON line has exactly one cause: with one of the two values. (adapted from references/openrig/docs/reference/wave-sdlc.md:58-62 (Apache-2.0))

Use fix: none for an unclassified lesson. Then use the table below to pick the target: the layer says where in the run the failure happened, the feedback type says what kind of change fixes it.

Feedback type Target to modify Example
Output quality The skill of the responsible agent "The analysis is too shallow" → add depth criteria to the skill
Agent role Agent definition .md "Security review is needed too" → point to the finhub-harness skill to add an agent
Workflow order Orchestrator skill "Verification should come first" → change the Phase order
Team composition Orchestrator + agents "These two could be merged" → merge the agents
Missed trigger Skill description "It did not fire on this phrasing" → expand the description
Execution mode mismatch Orchestrator "It is the same fan-out every time and it is slow" → switch to workflow mode
Scale/cost Orchestrator "It uses too many tokens" → shrink the default scale, add budget linkage

Do nothing unless the evidence calls for a change. Most runs of this skill end with no edit, and that is a correct result, not a failure. A change needs a LESSON line that is not unclassified, whose fix: names a file and whose evidence: line you opened. If no line meets all three, this is a no-op run: skip Phase 3, take no backup, add no change-history row (the decision row of Phase 1 step 7 is the one exception: it takes the backup gate for CLAUDE.md, and Phase 5 reports it like any edited file), and write the Phase 5 report with the first line NO-OP: <one sentence on what you read and why nothing justified a change>, then any unclassified LESSON lines and NOT CAPTURED lines, and run the Phase 4 secrets command on it. A request to evolve the harness is still answered; only the edit is skipped. (adapted from references/cowagent/agent/evolution/prompts.py:29-33 (MIT); a pass with nothing to say leaves no record, adapted from references/cowagent/agent/evolution/record.py:34-35 (MIT))

The finding_tags.py check of this phase exits 2 ("no record in file") on a report with no LESSON line. On a no-op run with no lesson lines that is the expected answer and not a refusal. Do not add a lesson line to make it pass. With one or more LESSON lines, the check runs as above and must exit 0.

Do not write these down as lessons. Each would harden into a rule the harness later cites against itself. (adapted from references/cowagent/agent/evolution/prompts.py:103-112 (MIT))

  • An environment failure on the user's machine: a missing binary, an unset credential, an uninstalled package. The user can fix it. It is a lesson only when the harness file that should have declared or checked that prerequisite does not, shown by a search that finds nothing (Phase 1 step 6). With no shell you cannot run that search: write search: not run on the item's NOT CAPTURED line.
  • A negative claim about a tool, surface or feature ("X does not work"). Write the observation instead (surface, command, what it printed, date) or leave it out, as the "Where this runs" paragraph of Phase 1 does for chat and Cowork.
  • A one-off narrative: what happened in this one report or job, with no class of work behind it. If Phase 3 step 1 cannot generalise it beyond this case, it is not a lesson.
  • One error that cleared on retry. The same failure in the same agent across two or more runs is still the Phase 1 signal.

Give each item you leave out one line of the report, NOT CAPTURED: <environment|negative-claim|one-off|retry> - <what>. It is not a LESSON line, so it needs no cause tag, and finding_tags.py reads only lines that begin LESSON |. List what the run showed or the user raised, never everything you checked.

Scope judgement: if the change needs a new agent, a deleted agent or an architectural redesign, do not do it in this skill; point to the finhub-harness skill (the extend-an-existing-configuration procedure in its Phase 0). Evolve focuses on adjusting the existing configuration.

Phase 3: Generalise and apply

Backup gate (before the first edit). Before you change a harness file for the first time in this run, copy it next to itself and confirm the copy matches: cp -p <file> <file>.bak && cmp <file> <file>.bak. If <file>.bak already exists, leave it alone (it may be the only copy from before an earlier evolve) and use the first unused <file>.bak.2, <file>.bak.3 and so on. One backup per file per run, taken before that run's first edit to it; a file you create has no backup and is listed as new. If the copy fails or cmp prints anything, edit nothing and say so. (adapted from references/openharness/src/openharness/services/autodream/backup.py:38 (MIT))

  1. Generalise the feedback. A narrow fix that only fits one case is overfitting. "The introduction was long in this report" should not become "keep the introduction under 10% of the whole". Find why it ran long (the skill had no length-allocation criterion) and fix it at the level of principle.

  2. Record the Why with the change. Put the reason next to the amended instruction. Knowing the reason lets the agent judge edge cases correctly.

  3. Apply changes one at a time, and run Phase 4 right after each change.

  4. Regression guard: if a fix would reverse an earlier fix in the change history, tell the user about the conflict and get confirmation. (If it was shortened before for "too long" and now the complaint is "too short", the right answer is a criterion that satisfies both.)

  5. Keep the language of the existing file. Sentences you add to agents, skills, orchestrators and CLAUDE.md are written in the language already used in the file being modified. Do not mix this skill's language into a harness written in a different language.

  6. Fix the source, not the symptom. When the evidence line shows that the cause is an instruction in a harness file that is wrong, missing or out of date, the fix: edits that file. A corrected output under _workspace/, a change-history row or a remember note does not stop the miss and never stands in for the edit. If no harness file holds the cause (the input data was wrong, say), the lesson is unclassified with fix: none, and nothing is edited for it. For a lesson that has a fix, the cause tag sets where the edit goes: into the brief, design or route that should have carried the fact (context-gap), or into a check (judgment-gap). (adapted from references/cowagent/agent/evolution/prompts.py:61-66 (MIT))

  7. Say what the change should do. For each LESSON line with a fix, write one line in the report when you make the edit, and do not reword it after a rerun, so the claim can be checked against a later run and can turn out wrong:

    CHANGE | file: <the file in fix:> | job: <the kind of run the change is for> | baseline: <path>:<line> - <the first step of that run that went wrong>, or none observed | expect: <what the next run of that job will show that the baseline did not> | weakened by: <what a rerun would show if the change does not work> | remove when: <the condition under which the change comes out again>

    One change per lesson: a change that needs a second file is a second lesson. baseline: is a line of a run you opened (Phase 1 step 6), at the first point where that run went wrong, not a later error it caused (Phase 2 takes the earlier layer for the same reason). When no run artefact shows the failure, write none observed; never make a baseline up. (adapted from references/repository_harness/.agents/skills/improve-harness/SKILL.md:61-68 (MIT); adapted from references/repository_harness/.agents/skills/improve-harness/SKILL.md:23-35 (MIT); the first failing step rather than its consequences, adapted from references/paperclip/.agents/skills/fix-failed-paperclip-run/SKILL.md:60-65 (MIT))

  8. Show the diff and get a yes for each target. Before the first edit to a skill, agent definition, orchestrator or CLAUDE.md, show the user the exact change as a fenced diff or as lines starting with + and -, name the one file it changes, and wait for an explicit yes to that file. A yes that came before the diff was shown does not count. One yes covers one file: a second file needs its own diff and its own yes, and a yes given earlier in the conversation for another file is not reused. With no answer, or a no, edit nothing, keep the LESSON line and the proposed text in the report, and say that nothing was applied. The Phase 3 backup gate runs after the yes and before the edit. (adapted from references/paperclip/server/src/services/change-consent-gate.ts:14, :48 and :117 (MIT, Paperclip AI), idea only)

Phase 4: Update the change history and verify

  1. Record the change in the change history table of CLAUDE.md:
**Change history:**
| Date | Change | Target | Reason |
|------|--------|--------|--------|
| 2026-07-19 | Added tone guide | skills/content-creator | "Too stiff" feedback |
  1. Verify the structure of the modified files (frontmatter, reference consistency).

  2. If you changed a description, run trigger verification (at least 3 should-trigger and 3 near-miss queries).

  3. Do a final check that CLAUDE.md matches the actual files.

  4. Check what you wrote. Quote the output of each check in the report:

    • Backups: ls <file>.bak* lists the backup you made for every edited file, and diff -q <backup> <file> says the two now differ.
    • Secrets: once the report file exists, run the command below whole. Copy it, do not retype it, and do not shorten the pattern; a shortened pattern is not this check. Replace <backup> and <file> and repeat the middle line for each edited file (the diff sees only the lines you added; grep a new file whole). Any output is a leak: redact it and run the command again.
    P='\bsk-[A-Za-z0-9_-]{16,}|\bgh[pousr]_[A-Za-z0-9]{20,}|\bgithub_pat_[A-Za-z0-9_]{20,}|AKIA[0-9A-Z]{16}|\bsk_(live|test)_[A-Za-z0-9]{16,}|\bAIza[A-Za-z0-9_-]{35}|\bxox[abprs]-[A-Za-z0-9-]{10,}|bearer [A-Za-z0-9._~+/=-]{16,}|\bbasic [A-Za-z0-9+/=]{20,}|-----BEGIN [A-Z ]*PRIVATE KEY-----|\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.|(api[_-]?key|secret[_-]?(access[_-]?)?key|secret|token|password)[^A-Za-z0-9:=]{0,3}[:=][^A-Za-z0-9]{0,3}[A-Za-z0-9/+_.@!#$%^&*-]{12,}|://[^/ :@]+:[^/ @]+@'
    diff <backup> <file> | grep -niE "$P"
    grep -niE "$P" _workspace/evolve-report.md
    

    The pattern flags only what it matches. It misses passwords of under 12 characters, Bearer followed by two spaces or a tab, Twilio AC SIDs, Slack webhook URLs, base64 blobs and a secret split over two lines, and it flags harmless configuration lines (an api_key read from an environment variable), which costs a re-run. It relies on GNU grep -E word boundaries (BSD grep untested). The final chat message is not grepped. So this lowers the risk and does not remove it.

  5. Fresh rerun before any claim. Steps 2-5 show that the edit is well formed, not that the job now goes better. Only a fresh rerun shows that: a run of the job: of the CHANGE line, from the same kind of input as the baseline, by an agent that has not seen this evolve run, with the change on disk.

    • Counts: a new session the user starts later; or, in Claude Code, a new subagent in this session given only the job's original input copied from the baseline artefact (never the lesson, the change or the expect: text), working on a copy. A same-session subagent does not count when the change is to a file the host may load only when a session starts (an agent definition under .claude/agents/, CLAUDE.md, a skill's description:, .claude/settings.json or a hook); whether a host reloads such a file mid-session is not verified here.
    • Does not count: re-reading the edited file and reasoning that the job would now pass; the checks of steps 2-5; doing the job yourself in this conversation; a run of another job; a run that never reached the changed instruction.
    • Decide from the rerun, set against the baseline on the outcome, the retries and how often the user had to step in: keep when it shows the expect: result and nothing in weakened by:; revise when it reached the changed instruction and the miss came back in a form that other wording in the same file could fix; remove when it shows the weakened by: evidence, meets remove when:, or made the job worse. A revise or remove is carried out as a new change (Phase 3, with its own backup and CHANGE line).
    • With no fresh rerun, which is the usual case at the end of an evolve run, write Decision: pending fresh rerun - next: <the task to run in a new session, its input, and the output line to look at>. Pending is a normal result, not a failure. End that change's change-history row (CLAUDE.md takes the Phase 3 backup gate like any harness file) with pending fresh rerun; and the job:, expect:, weakened by: and remove when: fields of its CHANGE line, separated by ; (a | would split the table cell), so that a later run can close it (Phase 1 step 7). Never edit an earlier row; a later decision is a new row. (adapted from references/repository_harness/.agents/skills/improve-harness/SKILL.md:75-84 (MIT); adapted from references/repository_harness/.agents/skills/improve-harness/SKILL.md:86-96 (MIT))

Phase 5: Evolution report

Write the report to _workspace/evolve-report.md (create _workspace/ if missing), then run the Phase 4 secrets command, whole, so that it greps that file, and give the user the same text. Where there is no shell, give it inline and write "secret check: not run".

Report only what changed. A file you edited counts as changed when diff -q <backup> <file> (Phase 4 step 5) says it differs, and it appears in the report only with that line beside it. A file this run created has no backup to compare, so it is reported as new, no backup, as the Backups line below says. Never describe a change you meant to make and did not. (adapted from references/cowagent/agent/evolution/prompts.py:39-41 (MIT))

Report to the user:

  • The captured delta (initial configuration → current) for the files you changed or created. No line for a file you read and left alone.
  • The changes applied this time and the generalisation behind each.
  • Feedback you decided not to apply, and why (if any).
  • For each change applied, its CHANGE | line and its Decision: line, and a Decision: line for each earlier pending change this run closed (Phase 1 step 7). Decision: keep - <path>:<line> cites the fresh rerun; without one the line is Decision: pending fresh rerun - next: ... (Phase 4 step 6). Say that the harness improved only beside a keep line. On a no-op run, the NO-OP: line comes first.
  • Every LESSON line. The unclassified ones are the feedback not applied, each with the artefact that would settle it. (adapted from references/deepseek_harness/.agents/notes/README.md:14 (MIT))
  • Backups: for each edited file, its backup path and the cmp result taken before the edit; each new file marked "new, no backup". To undo a change: cp <file>.bak <file>. Do not delete a backup yourself; tell the user that a .bak left under skills/ is packaged by scripts/package-plugin.sh, so it should go once the change is accepted.
  • Secret check: what the Phase 4 grep printed (nothing, or what you redacted).

Principles

  • The delta is an asset. The more change history accumulates, the more a later harness build in the same domain starts from a draft closer to release state. Never delete the history.
  • No application without generalisation. Adding one rule per case, 1:1, turns a skill into a pile of rules. Compress to principles.
  • One at a time. If you apply several changes together you cannot tell which one helped.
  • Doing nothing is a result. Where the evidence does not justify a change, say so and stop (Phase 2). A harness edited on thin evidence is worse than one left alone. (adapted from references/cowagent/agent/evolution/prompts.py:31-33 (MIT))
  • A change is a guess until a rerun shows it. Report what each change is expected to do and how it could prove wrong, and leave its decision pending until a fresh run of the same job settles it. (adapted from references/repository_harness/docs/templates/harness-improvement.md:44-49 (MIT))

FinHub additions

  1. Failure recurrence is an evolve signal. When a run's QA report (RESULT: FAIL) or a judge verdict (REJECTED > 0) recurs for the same reason twice, treat that as an evolve signal even without user feedback.
  2. Where the lesson is written. Write the generalised lesson to the project's change history, AND, if the operator uses Super Memory, as a remember call with kind:"learning" tagged with the harness name. Never write client data into either. Each is one entry: one change-history row, and one remember call of one short bullet that names the file edited. Neither restates the run or stands in for the edit, and a no-op run writes neither, except the one decision row of Phase 1 step 7. (adapted from references/cowagent/agent/evolution/prompts.py:92-93 (MIT))

04 同仓库更多 Skills