AI discovers the law from observation, and that law itself becomes the running system — the deepest mechanism of ai-desk
ai-desk methodology — Hiroyuki OKINOI · 2026-05
At first glance, Constraint Folding looks like just a technique for replacing if/else with a table.
This is only the entrance. The real power lies beyond.
The core of Constraint Folding is that AI infers the world (the table) from observed data, and that table runs as-is.
The phase called "writing code" disappears. In its place comes a new phase: "extracting the law from observation."
This behavior emerges when Bible §6 "Mine and Verify" combines with Constraint Folding.
Collect (input, output) samples from existing systems or business rules
LLM + Monte Carlo enumerate many candidate laws
Run each candidate against every observation, discard whatever doesn't fit
The surviving laws = the constraint table = a state machine that already runs
Humans only touch 1 (provide observations) and 4 (confirm behavior). 2 and 3 are entirely AI.
From a state where the source of a legacy shipping rule was lost, full reconstruction from 50 observations.
Concretely: PoC code lives in examples/.
From 50 (weight, distance, zone, fee) pairs, AI infers a table of "thresholds, base values, additive rules."
Feeding the reconstructed table into the reducer reproduces every observation. The system was rebuilt without ever reading the source code.
Because it's a pure reducer, AI can mechanically try and prune candidates.
A branch tree makes all of these structurally impossible (control flow can't run backward, combinations explode, verification has side effects).
Folding is what lets AI run inference.
The inference result is directly executable. No "code generation" phase needed.
The moment AI infers it, the system already runs. "Human transcribes inference into code" disappears.
Humans declare the axes → cartesian product expands the table
Total coverage of a known domain
Observations → AI back-infers constraints → table generated automatically
Law discovery in unknown domains
Both produce the same output: "table + reducer". The same execution substrate is usable through two paths — humans writing it, or AI inferring it.
"Writing code" is replaced by "extracting the law from observation."
Humans stop doing translation work. They keep observation and confirmation.
Rebuild business logic with lost source from observation. Shipping fees, tax computation, discount logic.
From "I want behavior like this" samples, AI infers the rule → an immediately running implementation.
From observations of a running system, reverse-verify "is the implementation what was intended?" Detect spec/impl drift.
Operator decision history → rule inference → automation. Turn "tacit know-how" into data.
From play logs, extract "fun state combinations" → adjust the rules.
Any finite discrete domain. Scheduling, placement, combinatorial optimization.
Ultimately, the step called "writing code" disappears.
"Codebase" becomes "a set of constraint tables".
"Refactoring" becomes "add samples and re-infer".
"Bug fix" becomes "add the failing observation and reconstruct".
This is the final resolution of Bible §0.0 "complexity is the human's problem; concealment is the AI's problem."
Humans hold intent and observation, AI holds inference and construction, the machine holds pure execution. The roles separate completely.
Constraint Folding is not a "data-ification trick" —
it is the substrate where AI discovers the law and the law itself runs.
Enumeration is the entrance, inference is the heart.
On this substrate, development is no longer "writing" but "extracting".
github.com/AoyamaRito/ai-desk
Hiroyuki OKINOI · Aoyama Rito