Sulat.com / Writing on AIFriday, December 4, 2026
Enter →
Agent Engineering/4 December 2026

TanStack Oracles tried in Codex on bytes, ms and slugify

TanStack Oracles has a coding agent check software against written rules. I ran its prompt in Codex on three popular npm packages, and each oracle failed on unchanged code.

Glass crystal ball with green checks and one red cross beside two parcels, for TanStack Oracles
Illustration: Sulat

At a glance

  • TanStack Oracles is an early preview framework from Kyle Mathews, announced on 3 December, in which a coding agent writes rules and a simple model for your code and checks the real code against them over generated inputs.
  • I ran the announcement's prompt in Codex on bytes, ms and slugify, and each session produced an oracle that failed on the unchanged package in about five minutes.
  • ms returns "-1 seconds" for -1500 ms, slugify drops a "$&" separator, and bytes.parse returns 1 for "1K" and for a string with a leading space.
  • The oracles are first drafts on three small packages, so this shows the workflow rather than how Oracles copes with a stateful system like TanStack DB.

TanStack Oracles is an early preview framework, announced on 3 December, that has a coding agent write down rules for a piece of software and then check the real code against them. Its announcement post ends with a prompt you paste into an agent. I ran it in Codex three times, once each in the npm packages bytes, ms and slugify. Every session ended with an oracle that failed on the unchanged package.

What Oracles is

Kyle Mathews, who maintains TanStack DB, wrote Oracles while getting that library to 1.0. His 1.0 RC1 post describes months of bugs found by agents working against independent models of the database. In the new post he says he has run Oracles on more than 100 repositories, including many of the most-downloaded packages on npm, and that it found bugs in every one. Those figures are his. I ran three.

You write a rule about behaviour, which Oracles calls a law, and the framework generates long sequences of actions, which it calls histories. A deliberately simple model works out the expected answer for each history, a driver runs the real code, and a check compares the two. When they disagree, Oracles shrinks the history to a short reproduction. It combines property-based testing, model-based testing, fuzzing and mutation testing, and it leans on fast-check and Vitest.

A history feeds a simple model and the real code, then both answers are compared after every step
The model and the real code answer the same history, and a mismatch is the clue.

Two parts go beyond a property test. Calibrations feed the checker a deliberately wrong answer to prove it would notice. And the oracle-gaps command makes small changes to copies of your production code, runs the oracle against each copy, and reports any change that no law rejects. Mathews writes that these gaps can’t be waived, because agents are good at finding reasons to excuse a failing check.

The package is @tanstack/oracles, MIT licensed, first published on 3 December and now at version 0.0.1. It lists Vitest and fast-check as peer dependencies. The README says JavaScript and TypeScript have the strongest integration and that porting the toolkit to other languages is a top priority. Mathews says Databricks sponsors his time and a research group, and says he will work with the Protocol Institute on a Future of Programming research effort in 2027. He describes a longer goal of agents implementing against oracles the way a compiler works from a specification.

How I ran it

Everything ran on one 4 vCPU Intel Xeon 2.10 GHz virtual machine with 15 GB of memory and a 252 GB disk, under Ubuntu 24.04 with Linux 6.18, Node 22 and npm 10.9. I used Codex CLI 0.174.0 on a ChatGPT sign-in with its default model, gpt-6.2-sol, in the workspace-write sandbox with network access on. The three packages came from npm: bytes 3.1.2, ms 2.1.3 and slugify 1.6.9. Each went into its own fresh git repository, so the repositories are the published tarballs, not the projects’ GitHub checkouts.

The prompt is the one from the announcement, word for word:

Code
Show me what oracle testing with @tanstack/oracles can find in this repository.
Download https://raw.githubusercontent.com/TanStack/oracles/main/packages/oracles/skills/oracles-explore/SKILL.md
Read it in full and follow it to explore this repository with Oracles.

I started the three sessions in parallel from each package directory:

Code
codex exec -s workspace-write \
  -c sandbox_workspace_write.network_access=true \
  --skip-git-repo-check "$(cat prompt.txt)"
Five steps: read the skill, probe the real API, pick one behaviour, write the oracle, run it and it fails
The agent’s path from prompt to a failing oracle.

What Codex found first

Codex downloaded the skill, installed @tanstack/oracles 0.0.1 as a dev dependency and probed each package’s public API before proposing anything. In about two minutes per package it came back with three candidate spots, a recommendation and two questions: which behaviour to dig into, and whether it could keep an oracles-feedback.md log of rough spots for the Oracles maintainers. The probes already showed something in all three.

PackageRecommended spotWhat the probe showed
bytesParsing byte stringsbytes.parse('1KB') returns 1024, but with a leading space it returns 1
msSigned rounding and pluralisationms(1500, { long: true }) returns “2 seconds”, and ms(-1500, { long: true }) returns “-1 seconds”
slugifyCustom separatorsslugify('a b', '$&') returns “a b” instead of a literal “a$&b”
Codex’s first reply for each package. I reran each probe afterwards and got the same results.

I answered all three sessions with the same message:

Code
Go with your recommendation. Yes to the feedback log. I approve the laws you propose. Build the oracle, run it, report what it finds, and leave the production fix for after you've shown me the failing run.

Each session then wrote an oracle file of 100 to 180 lines, ran it, ran oracle-gaps and stopped with a failing run. About five minutes passed from the first prompt to the last failure. The production code was untouched in all three.

Cards for bytes, ms and slugify showing the input, the wrong result and what the rule expected
Each oracle failed on unchanged code.

bytes

Codex wrote three laws for bytes.parse: documented units scale by their binary multiplier whatever the case, valid strings never throw, and a number followed by an unsupported suffix returns null. The first two passed. The third failed.

bytes.parse('1K') returns 1. The README says parse returns null upon error and lists b, kb, mb, gb, tb and pb as the supported units. The code tests the string against a regular expression for those units and, when it doesn’t match, falls back to parseInt and treats the result as bytes. So 1K, 1kbx and ' 1KB' all come back as 1. The README doesn’t say whether an unlisted suffix is an error. The law I approved treats it as one, and the maintainers haven’t ruled on it. The leading-space case matters most: a config value of ' 1KB' parses as 1 byte instead of 1024.

Code
const bytes = require('./index')
console.log(bytes.parse('1KB'))
console.log(bytes.parse(' 1KB'))
console.log(bytes.parse('1K'))
Terminal: bytes.parse returns 1024, 1, 1 and the Oracles vitest run reports 4 failed, 62 passed
The bytes oracle on unchanged bytes 3.1.2.

Four of 66 tests failed, in the fixed-seed run and the random-seed run. The gap check made 93 changes to copies of index.js. The laws caught 26 and 6 survived as gaps, marked provisional because the baseline run already fails.

ms

For ms Codex wrote one law about the long format: the unit word is singular exactly when the displayed count has magnitude one. It generated durations across the safe integer range and added hand-built histories on both sides of each unit’s first pluralisation boundary.

It failed at exactly negative one and a half units. The README’s own examples include “1 minute” and “-3 minutes”, so the convention is clear, and the boundary is where the code disagrees with itself. The plural check compares the magnitude against 1.5 times the unit, while the count comes from Math.round, which rounds -1.5 up to -1. Positive 1500 gives “2 seconds”; negative 1500 gives “-1 seconds”.

InputResultSingular form
-1500 ms-1 seconds-1 second
-90000 ms-1 minutes-1 minute
-5400000 ms-1 hours-1 hour
-129600000 ms-1 days-1 day
The four failing boundaries, each reproduced with ms(value, { long: true }).
Code
const ms = require('./index')
console.log(ms(1500, { long: true }))
console.log(ms(-1500, { long: true }))
console.log(ms(-90000, { long: true }))
Terminal: ms prints 2 seconds, -1 seconds, -1 minutes and the Oracles vitest run reports 8 failed, 72 passed
The ms oracle on unchanged ms 2.1.3.

Eight of 80 tests failed, four in each campaign. The law checks agreement with the displayed count and leaves the rounding tie rule open, so it doesn’t say whether -1.5 should round to -1 or -2. The gap check made 82 changes to copies of index.js. The law caught 17 and 8 survived as provisional gaps.

slugify

Codex’s law for slugify was that for ASCII words and whitespace, the result is the words joined by the literal separator you pass. It failed whenever the separator contained a JavaScript replacement token. The README describes replacement as the character used in place of spaces, and the implementation passes it straight to String.replace, where $& means “the matched text”.

Code
const slugify = require('./slugify')
console.log(slugify('a a', { replacement: '-' }))
console.log(slugify('a a', { replacement: '$&' }))
Terminal: slugify returns a-a then a a for a $& separator and the Oracles vitest run reports 10 failed, 22 passed
The slugify oracle on unchanged slugify 1.6.9.

Ten of 32 tests failed. Codex’s probe, which varied the separator, whitespace, word count and trim setting found that 208 of its 864 calls differed from a literal-separator model. The gap check made 50 changes to copies of slugify.js. The law caught 19 and 15 survived, all marked provisional because the baseline run already fails.

Things to know

  • Oracles 0.0.1 installs Vitest 5 as a peer. The skill recommends Vitest 4.1, and npm 10.9 failed to resolve that next to Oracles in all three packages. Codex declared Vitest 5.1.2 in ms and slugify, and installed Vitest 4.1 with --legacy-peer-deps in bytes.
  • The workspace-write sandbox needs a writable npm cache, so Codex pointed npm’s --cache at a temporary directory.
  • The skill asks the agent to keep an oracles-feedback.md log. All three logs recorded the Vitest resolution and cache points above.
  • The session stops and asks before building anything. Approving the laws is one reply, and the skill treats a law as yours only once you approve it.

What this doesn’t show

Three small, stateless packages is the easy end of what Oracles is for. Mathews built it around TanStack DB, where the interesting rules are about sequences of optimistic edits and syncs, and I haven’t run it on anything like that. I didn’t fix any of the three packages or send the findings upstream. I didn’t run the gap-closing rounds the skill describes after the first failure, so the oracles here are first drafts. And the bytes result rests on a reading of the README that I approved, not on a documented contract.

The runs show the workflow. A prompt, one approving reply and a few minutes gave a short, readable oracle file for each package, with the law and where it comes from written at the top, and a failing run anyone can repeat with npx vitest run.


Sources

Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador. Codex ran on an OpenAI model.