Oracles Docs
Concepts
AI/LLM: This documentation page is available in plain markdown format at/oracles/latest/docs/guides/adopt-oracles.md
Adopt Oracles in your codebase
Start with one important behavior and keep what you learn. An oracle can sit alongside your existing tests, help the next agent understand the design and check a refactor or optimization against the rules you agreed on.
The decisions you capture become executable memory. When a change violates one, the oracle brings the relevant rule and a failing case back into view.
Note
Outline draft for review. The concrete package, runner and lint integration currently targets JavaScript/TypeScript; identify adaptations for other languages explicitly.
Choose what to keep#
- Begin with Try Oracles. Oracles is especially useful for thoroughly testing a specific area of your codebase.
- You can ask the agent to port the tests into your existing unit-test suite afterward. Check that each regression fails before the fix and passes afterward.
- To continue using Oracles, keep the oracle and follow the setup below. Preserve the rules it checks, its test cases and the evidence that it catches bugs.
Finish repository setup#
- Pin compatible toolkit packages; configure the test runner and the gap check.
- Add lint presets and agent instructions that point to the installed skills.
- Fit oracle files around the existing suite and workspace structure.
- Connect the validated workflow to CI, with replayable failures and clear ownership.
Expand by behavior#
- Choose another function, feature or interaction that matters to the people using your software.
- Reuse the test machinery while keeping each model independent of the production implementation.
- Track which code each oracle owns, the promises it checks and the remaining limits.
Make the next change easier#
- Use the oracle when asking an agent to refactor, optimize or replace the implementation.
- Keep the design decisions beside the checks, so a later agent can understand why a result matters.
- When review finds a missed bug, investigate why the oracle missed it: the generated cases, simulation, observations or comparison may need to improve.
- If the investigation exposes an undecided behavior, settle that design question before making it a new rule.
Evolve the design for a new feature#
- Use a request for pinned tasks as an example of a new design decision: do pinned tasks count toward the ten-task limit, and where should they appear?
- Let the agent explore the consequences of different choices. Decide which behavior you want before changing the rules.
- Update the law, model and checks together so later implementations preserve the new decision.
Migrate existing tests#
- Identify the obligation behind an existing example or group of tests.
- Express that obligation in an approved law with suitable histories and observations.
- Demonstrate that the oracle detects the original defect or another meaningful violation.
- Remove redundant tests only after their obligations remain covered.
- Keep a concrete before/after conversion example here.
Add a ratchet#
- The shipped preset enforces discipline inside oracle files, including how tests register.
- A broader policy against new ordinary unit tests is a separate repository decision and enforcement setup.
- Describe the chosen scope, treatment of existing tests and gradual conversion process.
- Add a verified configuration/CI recipe before claiming repository-wide enforcement is available.
Keep improving the checks#
- Diagnose disagreements before changing expected behavior.
- Keep fixes, refactors and law changes tied to the evidence appropriate to them.
- Link Writing an oracle and Gap check and replay.