Understanding Reintent
The concepts of Reintent: choices, intents, effects and the loop.
Reintent
The way React has UI = f(state), Reintent has World = f(choices). The line joins two steps:
- Intent : what someone wants, written as a program with questions left open. Pure.
- Choices : the answers to those questions.
- Realization : the computation the host runs. It can be a tree of data (host nodes, React elements) or plain code and function calls.
- World : where the host executes , and where events come from. is how it is at time .
Reintent takes you from probabilistic choices to a deterministic computation. When the choices change, the intent is realized again, and only what they affect is evaluated again (reactive computing). When a set of choices cannot be realized, Reintent treats it as a request to handle: use a default, ask a person, or escalate to reprogram the intent.
Choices
At any moment, the choices are one complete probability distribution over a defined space of possibilities. is a sum type that defines the space. Each possibility is a variant, and it can carry data. is the set of finite-support distributions over :
All the uncertainty lives in the choices, so the intent can stay pure.
A deterministic state is a degenerate distribution. A person's decision makes a choice :
| Level | Notation | TypeScript |
|---|---|---|
| Possible values | type Layout = ... | |
| Distribution type | Choices<Layout> | |
| Current distribution | const layouts = ... |
type Layout =
| { kind: 'grid'; columns: number }
| { kind: 'list' }
| { kind: 'carousel'; snap: boolean };
const layouts = choices<Layout>([
{ value: { kind: 'grid', columns: 3 }, weight: 0.6 },
{ value: { kind: 'list' }, weight: 0.3 },
{ value: { kind: 'carousel', snap: true }, weight: 0.1 },
]);
const grid = state<Layout>({ kind: 'grid', columns: 3 });- An open world with a fixed type. does not list every value the world could hold, but at any moment it is a fixed type. Reintent grows by reprogramming the program, so stays type-safe.
- Dependent. is a monad, and a choice that depends on another's answer is .
- Layered. Each writer has its own say: the code's prior, a System One model's belief, and a person's preferences, constraints and decision. The intent keeps every layer and cascades them into the effective , so forgetting a decision brings the belief back.
Intent
An intent reads the choices and produces a realization . Reintent gives you the primitives to write . JSX composes the computation, and effects come in through hooks.
Pure. The simplest intent has no effects. Each choice gives one value in a computation, and when every choice is a state, the intent is a plain pure function.
Effect
An intent asks for values through algebraic effects. Hooks fire them, and a component around a subtree is their handler. Firing an effect and answering it make the Loop: within one evaluation a handler answers with the distribution a choice has now, and the answers still missing come from Actors over time.
Choose. The intent has one effect: it asks for a value of a choice.
is do in . The program gives a choice's prior and question where it reads it. The effect is a request: in this evaluation, a handler answers it with the distribution the choice has now, and the answers still missing come from Actors outside , in the Loop. They are written into the choice and the intent is realized again, so stays pure. The formula leaves out the choice's identity: reading the same choice twice on one path gives the same value.
Handlers. A handler gets the continuation . There is one kind of handler, with parallel strategies:
- collapse calls with the likeliest value once it is sure enough, and is the default;
- each calls for every possibility, and each path in records the values it took;
- as calls with a given value and writes nothing back (a preview), a counterfactual inside this subtree;
- reprogram does not resume. It hands this part of the intent to the Loop's Reprogram.
Writing one case per variant is pattern matching: it reads the choice once and evaluates the case it got. Inside each, every case is evaluated once.
Unresolved. A collapse gives something like a Result, a value or a reason:
unsure means the leading candidate is not far enough ahead. none means the current candidates have all been excluded; the type may still contain other admissible values. An open string choice can generate another greeting after its current candidates are rejected. unmet means the requested value cannot be represented by . Recovery policy chooses whether to request new candidates, revise constraints where permitted, forward, or propose a reprogram. The formula abbreviates the available-candidate case, leaving constraints, the requested value, and policy implicit.
Evaluation outcome and waiting for Actors are separate: a choice can be unsure while waiting for a Human, or have a usable value while waiting for a new judgment. On the first generation there may be no candidate or fallback value yet. In that case the computation remains incomplete, with its requests recorded; the handler does not call without a value. A boundary or host can show a placeholder or the previous realization. A single request can be described by a Promise; changing inputs can make the choice request answers and evaluate again.
A handler handles an unresolved result by its reason and policy: it calls with an available fallback; forwards the same with and the reason to an outer handler (an escalation); or proposes a reprogram. At the root, absence of a usable value remains an incomplete result for the host. The result of evaluation stays deterministic.
The value a handler picks serves this evaluation alone: a person's decision reaches the choice only through Decide, and the world changes only when the host executes λ.
Loop
Actors change the choices or the intent:
- Code: the program a developer wrote. It gives priors and reduces events into new choices.
- Model: split loosely by strategy. System One weighs the possibilities in quickly. System Two reasons, writes values has not listed, and proposes new programs. One model can work in both ways, and an app can connect a single model. Prior Arts traces the names and the models that fit each.
- Human: makes decisions, says what they want, and confirms a reprogram.
| Changes | Changes | |
|---|---|---|
| Code | priors, Reduce | a developer edits the source, outside the runtime |
| Model | System One weighs (Judge); System Two writes new values | System Two proposes a new program (Reprogram) |
| Human | decisions, written into the choices by the host's code | prompts, and confirming a proposal |
The answers a choice is missing come from Actors, each into one of its layers. Code gives the prior. System One weighs the possibilities lists. System Two writes candidates in a type the program fixes, , and they become the choice's possibilities. A Human decides, . The choice says whom to ask, in order; the layers say who prevails, a Human's decision on top. Every choice has a stable identity: answers are written back by it, and a reprogrammed intent finds its choices by it.
- Reduce. An event changes the choices through the code, and the intent is realized again. This is the symbolic path, a React loop. Judge and Reprogram make up the neural path, a ReAct loop.
- Judge. A System One model quickly weighs the possibilities in the current , or a System Two model writes candidates for an open choice. The program stays as it is.
- Decide. A person's decision goes into the top layer, through the host's code.
- Reprogram. A reasoning model changes the intent, and with it which choices are possible. Judge works inside the space of possibilities, and Reprogram changes the space. Reprogram sits above the intent. A prompt or an escalation starts it, and a person confirms its proposal before it is committed.
Last updated on
Edit on GitHub