Everything is open source under Apache 2.0, so you can try it in a minute or read the full theory at your own pace.
npm i -g reharness
github.com/bes-dev/reharness
Deep dive - where Agentic AI meets classic compiler theory: bes-dev.com/posts/reasoning-…
2
66
In return you get a kind of reliability you can really rely on. The pipeline is stable by its construction, without huge prompts for perfect accuracy, without hidden drift between runs, with static checks confirmed before every run.
1
1
65
An ahead-of-time compiler doesn't see how its output behaves, but a JIT compiler does — and here every run leaves its verdict. When a run fails, the system reads the trace, finds the root cause, and fixes the problem element without touching its contract. When a run succeeds, the deterministic sub-routines that keep repeating are frozen into callable tools, each governed by acquisition and retention mechanisms, so that indiscriminate caching never quietly slows the system down. The same artifact constantly comes in and goes out, and so the optimization loop closes on itself.
1
1
37
And on top of all this I built a compiler that can take a user request, an agent trace, or a ready-made harness as its inputs, and returns a compiled, ready-to-run FSM as its output.
1
1
36
Before the pipeline is run, it is checked by seventy-eight lines of code based on two classical mechanisms: breadth-first reachability and the Kam–Ullman monotone dataflow framework. Together they check that every state is reachable, that every state can reach an end, that a scalar is not read before it is written, and that data visibility is absolutely correct. The quiet elegance is that deriving the connections and checking the connections are one and the same analysis, so the generator and the validator can never disagree.
1
2
37
In my first attempt the model itself annotated the data flow, and that annotation deviated from the real graph almost every time. The solution was to notice that a graph edge is already a contract in itself: a node reads exactly what its ancestors produced, no more and no less. From inside a branch you read one directory, from outside — a list, and loops unroll by the very same rule. Because no one writes a path by hand anymore, the producer and the consumer can no longer disagree.
1
1
47
To create programs able to run in this runtime, I built an Intermediate Representation in the form of an XML skeleton consisting of 12 state types: agent, code, switch, parallel, loop, check, wait, call and a few more. Its guard language is deliberately not Turing-complete — comparisons, boolean operations and arithmetic are allowed, but functions and assignment are not. This single restriction forces every routing decision to be a pure function of small scalar values. As I wrote in the description, the poverty of the target is not a bug, it is the whole point.
1
1
49
For this I built an FSM-based runtime, which formally carries an intimidating name — a deterministic, hierarchical Moore-action transducer with run-to-completion semantics. But every word here explains how it works. As actions are tied to states, not transitions, the question "who did this and why?" always has a precise answer. Because the steps run to completion and routing is deterministic, the machine never hangs silently, and an interrupted run can simply be resumed. The hierarchy provides parallel branches, bounded loops and sub-calls, while all the genuine stochasticity stays within the agent's output.
1
1
199
By compiling reasoning I mean a process where, from the history of solving a task successfully through reasoning, we build a system in which the order of solving the task no longer depends on the model's reasoning. All mechanical actions are translated into program code where possible, and the model's judgments remain only where they can't be avoided.
1
1
37
To solve this problem, I turned to an old theory that has been polished for half a century in another field — building compilers. In 1971 Yoshihiko Futamura showed that specializing an interpreter to one fixed program turns slow interpretation into cheap, compiled execution. And if you look at the agentic loop — think, call tools, analyze, repeat — it is exactly such a stochastic interpreter, while a recorded task trace is exactly such a program. Specializing one with respect to the other is, in the literal sense, compiling the reasoning!
1
1
47
This stopped being a special case once assistants like OpenClaw, Hermes and others became part of daily life. Every day such an assistant performs the same routine task over and over again. With every new run we hope the model will follow the instructions and nothing will break. And to raise the chances of success, we take the most expensive models, the ones that surely shouldn't let us down. But even frontier models give no guarantees when the instruction arrives as recommendations. At this stage of AI's development, a guarantee can't be obtained through better wording; it can only come from a structure the model is forced to follow and cannot break.
1
1
65
In my own practice I've often run into harness failures like these:
— When we fill the harness with too many instructions, they start competing for the model's attention. The model follows some of the instructions and quietly ignores others. Something like: "I can only do 2 of your 3 requirements."
— The more complex the system we build, the more complex and bulky the instructions become. And when you try to move a heavy harness onto local models, they simply don't have enough compute to process it all. The model doesn't work badly — it just it just dies while processing the harness, before it ever reaches the actual problem.
— A pipeline run twice with the same wiring can behave differently, because the model invents the solution from scratch each time and it can differ between passes. We can't be sure the task will be solved exactly the way we described it.
1
1
75
Harness engineering is essentially prompt engineering in a new form. The skills and instructions we write raise the chances of success, but they give no guarantees. Every written line stays a recommendation for the AI, and the model can always ignore it at its own discretion.
Working on RS-25 test software at MSFC — legend status! To be honest, building a 5-year-old React project today is harder than compiling this 56-year-old FORTRAN IV 😄 My favorite find: when altitude goes negative, SSSP prints VEHICLE ATTEMPTED SUBTERRANEAN FLIGHT. Honored!
1
45
Replying to @planetdeimos
That is incredibly cool. It’s a huge privilege to know that the engineers working on SLS might find this weekend project interesting. This code was decades ahead of its time, and I’m just glad to help keep that history alive. Thanks for sharing it, Sean!
2
206
Replying to @reach_espartan @NASA
More detailed information and documentation can be found in the GitHub repository: github.com/bes-dev/sssp. I also provided a general description of the math behind the simulator, based on my analysis of the code.
2
56
Of course, we're not talking about Fortran programs in general, but about a specific pre-project Shuttle simulator.
9
646
Replying to @reach_espartan @NASA
They used the fifth-order Runge-Kutta-Butcher method with adaptive stepping.
1
4
83
Replying to @MKortvely
Wow, thanks for sharing this story! Running a simulation and knowing a shuttle is flying above you along that exact calculated trajectory is practically magic. Especially when you consider the era and the limitations engineers faced building this software.
15
2,163
Replying to @samuel_hayden_ @macjshiggins
To clarify: the "test data" is actual STS-1 telemetry from 1981 vs a theoretical 1970 model. Getting only a 5-15% delta between 1970 math and a physical flight 11 years later just proves the absolute brilliance of the engineers of that era given their limited resources.
1
1
50
