For agents
This page is for an AI that writes Agentica code, after the AGENTS.md of josevalim/lynx. State what a function must do as laws, and let the tests find where it does not.
- State at least one law for each public function: a round trip, idempotence, an oracle (a slow, obviously right version), an invariant (
Prop.preserves), or at least "does not crash" (Prop.checkwith a law that only calls the function and returnsok()). Put the laws intest/, apart from the code. The law is the specification, so it is not written from the code that it checks. - When a law fails, the message has the shrunk counterexample and the seed. Copy the counterexample into a plain
test_function (it stays a test when the generator changes), then fix the code. - Never weaken the law, narrow the generator, raise
discardsor lowerrunsto make a test pass. If the law is wrong for some inputs, say which ones withProp.assumeand keep that in the report. - Report what was done, not what is proved: "tested with 100 cases, seed 1234, discards 0", or "all 15 cases up to size 3". Never write "proved", "verified" or "correct for all inputs".
A passing check returns a plain ok() with no seed. To report the seed, pin it with Prop.Config(seed: some(1234)). The seed of a failure is in its message. The number of discarded cases is not returned either: say 0 only when the law has no Prop.assume.