Glossary
The concepts behind Reintent and their names in the current API.
React sums up its model as UI = f(state). Reintent says World = f(choices). Here f is an intent, a function you write, as a React component is. Choices are its input, each open question's current distribution. The intent returns a realization λ, and the host executes λ in its world.
The context and handling policies are part of this realization. This glossary connects the concepts to the current API. Understanding Reintent develops the model; Prior Arts introduces its intellectual background.
From intent to world
Three of these words name something that keeps its identity while what it holds changes. A subscript marks what it holds at one moment.
| Keeps its identity | At a moment | Changed by |
|---|---|---|
| An intent | its program, | reprogramming |
A choice, { of, name } | its distribution, , over the possibilities its program allows | code, models, and people |
| The world | how it is, | the host executing λ, and people and time, whose changes come back as events |
A realization is worked out again each time, from the program and the choices of that moment.
The formulas of Understanding Reintent read as sentences:
| Formula | In words |
|---|---|
| The realization now is the intent's program now, run on the choices now. | |
| The host executes the realization in the world as it is, and the world changes. | |
| An event changes the choices through the code. | |
| System One weighs the current candidates, including candidates supplied by generation. | |
| A person's decision goes into the top layer of a choice. | |
| System Two writes the intent's next program, and each choice carries over by its identity. | |
World = f(choices) | All of it in one line: the choices decide what the world becomes. |
Sam writes an intent for a card. At any moment the intent has one program. The card's tone is a choice, and its distribution moves as System One judges and Sam decides. intent.realize() runs the program on the choices as they are now and returns a realization, λ. Sam's app is the host. It executes λ in its world, and the card appears on the screen. When a choice changes, the intent is realized again. When Sam asks for a card the whole family signs, System Two reprograms the intent, and its next program is realized.
intent.preview(at) realizes the intent under choices nobody has made. Its realization describes a possible world, how the world would be if the host executed it. intent.explore() lists the likeliest possible worlds with their probabilities. The world changes when the host executes a realization.
Words that sit close together
- Intent and program. The intent is the one that lasts. A program is one version of it. You hold the intent (
createIntent), read its program (intent.program), and reprogram it to move it to the next version. - Choice and distribution. A choice is a question with an identity,
{ of, name }, which outlives programs. Its distribution is how the question stands now: weights over its possibilities. - Realize, evaluate, and execute. To realize is what the intent does: run its program on its choices, send the requests that asks for, and run again as answers arrive. To evaluate is one run of a program, which the realizer performs, so one realization can take several evaluations. To execute is the host's part: it carries out λ in the world.
- Realization and world. A realization describes; the world is where it happens. A page, a native app, and a test can each execute the same realization in a world of their own.
- World and possible world. The world is the one the host acts in, and its events come back to the loop. A possible world is how it would be under other choices. Previewing and exploring give realizations of possible worlds, and the world stays as it is.
Intent
An intent is what you want, written as a program that leaves some questions open. Its components compose structure and computation, read choices, and describe requests. A natural-language goal can guide its creation and later reprogramming.
createIntent({ program }) gives you the intent, living: its program now, the versions before it, and the choices it reads. Each version is a program. intent.program is the current one, and intent.version names it. A program is pure; what is uncertain stays in the choices. decide, constrain, prefer, and tell change the choices, and only reprogramming changes the program. We write programs in .intent.tsx files. Given the same program, choices, context, and policies, realizing produces the same realization.
Choice, possibility, and distribution
A choice is a question in the intent, such as which tone a card should use. Its stable identity connects the program's reads, model judgments, and human decisions. The mathematical state of that question is a distribution over its possibilities.
| Term | Meaning | Example |
|---|---|---|
| Possibility | A value the program can use for a choice | 'warm', or { kind: 'grid', columns: 3 } |
| Possibility space, | The values permitted by the program's current definition | The Tone type or an entity field's kinds |
| Tag | The identifier used to match a possibility across reads and versions | 'grid' in { kind: 'grid', columns: 3 } |
Distribution, Choices<T> | Possibilities paired with nonnegative weights summing to one | choices([{ value: 'warm', weight: 0.7 }, { value: 'formal', weight: 0.3 }]) |
| Determined state | A distribution concentrated on one value, also called a point mass | state('warm') |
choices('warm', 'formal') supplies equally weighted candidates and leaves the question open for a judgment, decision, or fallback. Explicit weights express the code's prior. The declared type defines the possible values; a particular distribution represents a finite set of current candidates within that type. Generation can supply further values of an open type such as string. A possibility's tag identifies it; its attached data gives the host the current program version's value.
Realization, host, and world
To realize an intent is to evaluate it under the current choices, context, and policies. The result is a realization, λ, the concrete computation or structure the host executes. λ is a term the host interprets. Today it is a tree of host nodes. Such a tree can describe an interface, and host nodes can also form a small language for code or function calls. The host executes λ in its world, the place events come from, and the world changes. A browser can display a card, a scene renderer can construct a world, and another host can run the described computation.
A choice that stays open under fork leaves a branch point in λ, so λ stays deterministic. <Branch> matches a choice's value and evaluates that case; its branch host node records the chosen tag, the kinds there are and the subtree. Realizing and executing are two stages; Prior Arts reads them through multi-stage programming and partial evaluation.
The API's Realization object holds λ in tree, along with reads, requests, unresolved, and the evaluation trace. intent.realize().tree is the realization used in the tutorials. A host node, created with host(kind, props, ...children), describes a host-understood element through its kind, properties, and children.
Prior, belief, decision, and resolution
Several contributors can speak about the same choice. We preserve their contributions in layers and derive the value for an evaluation from those layers.
| Term | Contribution | API |
|---|---|---|
| Prior | The code's initial weighting of possibilities | Weighted choices(...), or a declaration's prior |
| Belief | A model's judgment about the candidates for particular inputs | An answer to a question with ask: ['model'] |
| Generated | System Two's candidates for an open choice | An answer to generate(...) |
| Decision | A person's explicit selection | intent.decide(id, value) |
| Constraint | A restriction on the permitted candidates | intent.constrain(target, constraint) |
| Preference | A relative weighting toward a candidate | intent.prefer(target, tag, factor) |
| Default | A fallback value used while the choice remains unresolved | defaultValue, or a declaration's default |
| Resolution | The value supplied to this particular computation | useChoose(...) |
The cascade derives that value by priority. A preview hypothesis or applicable human decision supplies a value directly. Constraints narrow the candidates; preferences reweight the distribution supplied by a belief or prior. The resolution policy then selects a value or applies its fallback.
A decision is an intervention. The choices it depends on keep their values, and the choices that depend on it are read again with the decided value.
intent.forget(id) withdraws the stored decision. Beliefs, constraints, and preferences remain available to the cascade. intent.history.undo() moves to the previous committed state. The guide Who answers a choice follows these layers through an example.
Policy, source, and status
A resolution policy specifies how to obtain a value from the effective distribution. <World minMargin={0.2}> accepts a leading candidate when its weight exceeds the runner-up by at least 0.2. Short of it, the choice is unresolved, with a reason, and onUnresolved says what follows: a fallback, steps, or forwarding. A choice's own ask says whether a person is asked.
useChoiceStatus(...) exposes the value with its source, the contribution it came from, and its status, how the choice stands in this evaluation.
| Status | Meaning |
|---|---|
decided | A preview, human decision, or constraint fixing one candidate supplies the value |
resolved | The policy or a determined state supplies the value |
unresolved | The choice remains open and uses the fallback path |
unknown | The entity is marked as unloaded, and its read uses the fallback value |
A read can also carry stale, meaning its model judgment came from an earlier input stamp, or waiting, containing stored values awaiting a matching possibility in the current space. These fields help a host explain the result. intent.explain(id) also exposes the effective distribution.
The value and source describe this evaluation; request progress describes work being done to obtain further answers. intent.pending() exposes running and failed model requests. A read can therefore use a fallback or cached belief while another request is running. For a first generation, useGenerate exposes status: 'pending' with value: undefined until an accepted value is available.
Identity, declaration, family, and reference
A choice's identity is { of, name }: the entity instance and the question about it. keyOf(id) encodes this as a key such as card#tone. Stable identities let decisions follow a question through repeated evaluations and program versions.
An entity declaration, created with entity(name, fields), describes choice fields and fixed data. A choice field can declare its kinds, prior, default, model question, dependencies, and conditions. The declaration belongs to the program version.
A family is a declared field across entity instances, such as card.tone. A reference, card.tone('birthday'), identifies that field on a particular instance. useChoose(card.tone) binds the family to the nearest matching entity scope, using the entity's singleton identity as its fallback. Nested entity scopes compose instance paths.
useChoose reads a choice where the program needs its value. useEntity reads an entity's applicable choices in dependency order. Identity determines which question is read, so these reads can follow ordinary conditional control flow.
Actor: Code, Model, and Human
An Actor changes the choices or the intent. There are three.
- Code is the program a developer wrote. It gives priors and reduces events into new choices.
- Model answers with a model, split loosely by strategy. System One weighs the possibilities the program lists, quickly. System Two reasons, writes values the program has not listed, and proposes new programs. One model can work in both ways.
- Human is a person. They decide, say what they want, and confirm a reprogram.
| Changes the choices | Changes the intent | |
|---|---|---|
| Code | priors, and 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 Loop connects four operations: Reduce applies code to events, Judge supplies model weights, Decide records a human answer, and Reprogram evolves the program through a proposal a person can review. Across the site, each Actor has its own colour: Code blue, System One pink, Human yellow-orange, and System Two violet.
Effects, handlers, and model roles
An effect is an operation requested during intent evaluation. Choosing asks for a value so computation can continue. A handler supplies the interpretation or policy for that operation; Actors give the candidates, weights, and decisions it uses. One JSX handler establishes the scope: <World> controls resolution (minMargin), supplies hypotheses (as), enumerates possibilities (each), and handles what cannot settle (onUnresolved).
The intent's model option connects external implementations of three operations:
| Operation | Role | Result |
|---|---|---|
| Judge | System One assesses the listed possibilities | Weights stored as a belief |
| Generate | System Two supplies content described by an instruction | Candidates read through useChoose(generate(...)); useGenerate reads a single generated value |
| Reprogram | System Two proposes an evolved intent program | A proposal for human review |
System One and System Two name these roles. The application supplies the model implementations. Ask requests a person's decision; intent.questions() exposes questions relevant to the current realizations. Escalation brings a choice that cannot settle to a surrounding <World> for further handling, or to the host when nothing around it handles it.
Evaluation, trace, and store
An evaluation is one run of a program in a context, and realizing the intent uses one. Its trace records choice reads, model requests, and escalations. A ChoiceRead captures one choice as it was read, including its value, source, status, and identity.
The intent, created with createIntent, owns its program, layers of choice state and history, and manages requests. A person's actions are its methods (decide, tell, reprogram, …). realize() evaluates and validates the data tree without sending requests; connect(host) keeps committing trees and sends requests only after the host accepts them. Connections share the instance's choices, history and program.
In React, reintentView(Card) makes a root a component: its props are the input, and each mount owns an Intent. <ReintentView> draws it with the host's components, checked against the catalog. useReintent() gives a root's operations, and useReintent(select) subscribes to a selection of its state, such as the history, or of what the evaluation it draws found.
An input stamp identifies the inputs of a model request so that its answer can be reused for the corresponding case. A program version identifies a program in the intent; a revision identifies a position in its commit history.
Preview, possible world, and reprogram proposal
A preview realizes the intent under hypothetical choices while preserving stored decisions. <World as> establishes hypotheses for a subtree; intent.preview(...) evaluates a hypothetical realization.
A possible world is how the world would be under other choice values. The world the host acts in is the actual one. intent.explore(...) returns possible worlds as PossibleWorld values. Each records the choices and their joint probability; preview() realizes the intent under those choices. A world's partial flag indicates that some judgments are still pending.
A reprogram proposal contains a replacement program, a summary, and its base program version. intent.reprogram(...) creates a proposal; intent.review(proposal).accept() commits the accepted program and any accompanying migration together. People can inspect the proposal before acceptance and revisit the resulting commit through history.
Older names
<World> (design note 0046) replaced several handlers and options. The older names still work, and TypeScript marks them deprecated:
| Older | Now |
|---|---|
<Resolve minMargin otherwise> | <World minMargin onUnresolved>; asking a person is the choice's ask |
<Preview at> | <World as> |
<Switch>, SwitchProps | <Branch>, BranchProps |
<Reconsider goal allow id> | <World id onUnresolved={[rejudge({ goal }), reprogram({ goal })]}> |
judge(question, choices, { uses }) | question, ask: ['model'] and uses on the choice |
otherwise (Otherwise) | onUnresolved on a <World>, or ask on the choice |
Escalated, Realization.escalations, intent.onEscalate | Unresolved, Realization.unresolved, intent.onUnresolved |
the World type of intent.explore | PossibleWorld |
Last updated on
Edit on GitHub