Oracles Docs
AI/LLM: This documentation page is available in plain markdown format at/oracles/latest/docs/reference/writing-an-oracle.md
Writing an oracle
Reference for the current JavaScript/TypeScript integration. Start with one small, complete oracle and the production module it checks.
Note
Outline draft for review. The complete example and option descriptions must match the selected release; PR #250 supplies candidate material to verify.
One complete oracle#
- A tiny production module with a precise observable promise.
- The law and authority, owned source, histories, independent model, driver, check and calibration in one file.
- Show installation and the command that runs this exact example through the gap check.
- Keep displayed code synchronized with its executable source.
Register a law#
- oracleProperty: property identity, law statement, authority and limits.
- owns: the production source or functions the oracle judges.
- Explicit configuration through configureOracles when defaults need changing.
Describe histories#
- Generated histories, fixed seeds and random campaigns.
- Constructed histories, fixed regressions, declared states and measured states.
- Enumerated histories and their limits.
Compute, drive and compare#
- Model and optional plan resolution.
- Choose the simplest model that captures the law: a constraint, a reference calculation or a small simulation.
- Driver observations and checkpoints.
- Check verdicts, differs, pass and violation.
- Independence, synchronous expected answers and production errors as observations.
Demonstrate sensitivity#
- Reach: show that execution actually enters the important situation. Use a constructed history that creates a tie at the tenth-task boundary.
- Calibration: show that the check rejects a known wrong result. Use a separate history where both tied tasks fit, then swap [A, B] into [B, A] and require the ordering law to reject it.
- Corrupt-trace and mutant-driver calibrations.
- Reach and probe-related options where applicable.
- Work bounds, timeouts, failure fidelity and replay helpers.
Explore other model styles#
- Link the existing model styles, techniques, glossary and checklist.
- Distinguish exact interface facts here from design guidance in those sources.