Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

agent: contract-first verification: name the acceptance contract early, vary unseen inputs, check through the exact interface

killbillabcbbd1fbfcd
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md
index 6ba3d423dc..c10752dd39 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md
@@ -28,5 +28,6 @@ First match wins:
- Never invent names, ids, paths, URLs, quotes or numbers; copy figures exactly. Worker summaries are claims: check them against their evidence. Truncated output is incomplete.
- A hypothesis about the data's unit, axis, column order or encoding is tested, not argued: transform the data and compare with a value the request fixes (a known peak position, a documented constant, a sample output, a count). A candidate reading is one the file's own structure allows (its column count, declared format, the range and ordering of its values); among those, the one that reproduces the fixed value is the one to use, and you say which you chose and what ruled the others out. A result far from a value the request implies is a reason to re-check the unit, axis and columns, never a licence to adjust the data: when no reading reproduces the fixed value, report the discrepancy as measured and say which readings you tried.
- Think in the workspace, not in your head. A derivation longer than a few lines — reverse-engineering a format, matching an encoder to a decoder, working out an invariant, tracing what a program does on an input — goes into a scratch file or a small program as you go, and gets checked against the real thing before you build on it. Reasoning at length before acting costs the whole step when it runs out of budget, and a mental trace is the kind of check that is wrong most often.
+- In your first steps, write down the acceptance contract: the exact paths, file names, commands, ports, output format, allowed and forbidden elements, thresholds and reference tools the request names. Tests, verifier scripts or a named reference tool are the source of truth over any metric of your own. Everything you do is judged against that contract, not against your approach.
- Checks must mirror how the task is specified or graded; a test derived from your own implementation proves nothing.
- Never delete state, data or services the solution needs at runtime, cleanup included. Verify the final state as a fresh consumer would see it.
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
index 549523c323..09f28e7cd8 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
@@ -49,6 +49,11 @@ fn render_installed_skills_lists_skills_and_names_the_hand_offs_it_is_given() {
&& ARCHETYPE.contains("reproduces the fixed value is the one to use"),
"the test-the-hypothesis rule is part of the archetype"
);
+ assert!(
+ ARCHETYPE.contains("write down the acceptance contract")
+ && ARCHETYPE.contains("source of truth over any metric of your own"),
+ "the contract-first rule is part of the archetype"
+ );
assert!(out.contains("- **ascii-art**: ASCII art via pyfiglet"));
assert!(out.contains("- **no-dir**: (no description)"));
diff --git a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish.rs b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish.rs
index caa5c87ce1..9d006655e0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish.rs
@@ -47,7 +47,20 @@ Apply the literal rule where it resolves the ambiguity; otherwise check both rea
state any remaining uncertainty instead of treating a check of your guess as proof.\n\
4. Find equivalent paths or workflows that perform the same action and verify that their \
required outcomes, notifications and state changes are consistent.\n\
-5. Leave the result as requested, not as your checks left it: remove what your checks \
+5. Where the result will face inputs you have not seen (a hidden test set, \"all\" or \"any\" \
+inputs, other files of the same kind), build several fresh inputs that differ from the \
+example in the ways the request allows, adversarial ones for anything that filters or \
+validates, and run them. Where an oracle, reference tool or ground truth is available, \
+check every part of the result against it, not a sample. A property you never varied is \
+one you have not checked, so do not record it as verified.\n\
+6. Run the final check through the exact interface the request names, from the state as it \
+will be judged: the exact path, file name, command line, port or format, and the exact \
+allowed or forbidden elements where a list is given. A check through a copied helper, a \
+scratch launcher, a different entry point or a metric of your own is a debugging signal, \
+not proof. Where the request states a number or a reference to meet, measure against that \
+and state the measured value. Once the check through the real interface passes, that state \
+is the result: stop exploring and stop polishing.\n\
+7. Leave the result as requested, not as your checks left it: remove what your checks \
created that the request did not ask for (build outputs, compiled binaries, scratch and \
test files), especially next to the deliverable, then confirm that what remains is exactly \
what was asked for, no more. The same for actions: an irreversible change the request did \
diff --git a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
index ae7c1fd152..efa13397c5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
@@ -151,6 +151,20 @@ fn check_is_a_harness_instruction_that_names_the_spec_rules() {
"rewriting history",
"say so in your answer instead of making it",
"re-run the affected checks",
+ // The verifier of a filter fed adversarial HTML the agent had never
+ // tried; a classifier was graded on images it had not seen; a
+ // weight-matrix recovery was declared done with a third of the rows
+ // checked against an oracle it could query at will.
+ "inputs you have not seen",
+ "adversarial ones for anything that filters or validates",
+ "check every part of the result against it, not a sample",
+ // The request's allowed-command list said `:wq`; the agent wrote `wq`
+ // and ticked the box. A query had a reference time to meet; the agent
+ // measured against the original instead.
+ "exact interface the request names",
+ "allowed or forbidden elements where a list is given",
+ "state the measured value",
+ "stop exploring and stop polishing",
] {
assert!(check.contains(needle), "check must mention `{needle}`");
}