# From intent to structure

> This section covers how a request is turned into structure: by walking the loop rather than by matching a word, as shown in [fit, not word] and written in…

Page: PAG · Patterns
Canonical: https://banes-lab.com/pag/patterns#intent-to-structure

This section is stop 27 of 102 in the learning route. Previous: [01 - Instruction patterns](https://banes-lab.com/pag/patterns/instruction-patterns.md). Next: [03 - Genesis stages](https://banes-lab.com/pag/patterns/genesis-stages.md). It builds on [01 - Instruction patterns](https://banes-lab.com/pag/patterns/instruction-patterns.md), [12 - Worth before work](https://banes-lab.com/disciplined-methodology/plan/worth-before-work.md).

This section covers how a request is turned into structure: by walking [the loop](https://banes-lab.com/disciplined-methodology/start/the-loop.md) rather than by matching a word, as shown in [B1·e fit, not word](https://banes-lab.com/pag/patterns#intent-to-structure-panel-e) and written in [B1·b selection by fit](https://banes-lab.com/pag/patterns#intent-to-structure-panel-b). Each of the loop's nodes yields a decision of a declared shape. Intent yields a ranking, never a yes; verify yields a boolean over evidence; and terminate yields a stop only when the work is saturated, complete and verified, which are the three gates written in [B1·c typed gates](https://banes-lab.com/pag/patterns#intent-to-structure-panel-c). A document that walks the loop writes each node with its contract, and with a gate wherever the node owes one, as shown in full in [B1·a ten nodes](https://banes-lab.com/pag/patterns#intent-to-structure-panel-a), and [B1·d the loop](https://banes-lab.com/pag/patterns#intent-to-structure-panel-d) shows the edge a refutation takes back.

### Walk the loop, select by fit

A structure chosen from a trigger word answers the word rather than the request. A request to analyze a plan is routed to the analysis protocol because it said analyze, but the plan needed a decision between two designs, and the output is a thorough analysis of the wrong question. A trigger word is the cheapest possible match and the least reliable one, because the same word appears in requests that have nothing else in common.

For this reason I treat the words of a request as evidence about it, never as its subject. The structure is derived from the transition the request asks for, rather than from the words it uses. In practice, a request is turned into nodes by walking the loop in order and closing each node on the gate it owes. The objective is stated before anything is examined, and the admissible ways of reaching it are ranked, so intent yields a ranking with more than one entry. A protocol is selected by comparing the transition the request asks for with what each protocol is for, and the reason is recorded. Every gate is typed to the shape its decision yields, and a refuted claim goes back to derive with its evidence, rather than forward with a caveat.

To check this, name for each node the stage it realises and the shape its gate yields. A gate that owes a ranking and returns a yes has folded, and a protocol whose selection cites a word rather than a reason was matched, not chosen. A descriptive artifact, such as a reference, a note or a contract, is read rather than walked, and forcing the full loop onto it fits it to a shape it does not have. Only an artifact that will be walked takes every node.

The four gates the loop names never fold, whatever the size of the task, and a document writes each as a typed gate. Worth is a ranking with more than one entry, as described in [worth before work](https://banes-lab.com/disciplined-methodology/plan/worth-before-work.md). Admissibility is asked after the operations exist. Evidence is a non-empty set, and finding no contradiction is not evidence. Termination requires saturation, completion and [verification](https://banes-lab.com/records/arch/verification.md) together. Every other node runs when the subject calls for it.

The reason for a selection travels with it, so a reader can contest it.

B1·a ten nodes

```pag
# the ten nodes · each closes on the gate it owes, and each reads only the prior node's output
# NODE 1 — ORIENT      [epistemic · ontology · set-theory · yields: set]
@purpose: "name what exists before anything is done with it"
CONTRACT:
input:     <the declaration's objective>
transform: READ_RESOURCE <the governing documents> INTO <authority>; DISCOVER_RESOURCES "<pattern>" INTO <what exists>
output:    <what exists>, under <authority>
HANDOFF GATE:
[check] <authority> read before any claim (evidence: the read precedes the first claim)
[check] every claim about the tree has a location (evidence: no claim without a path)
[check] <what exists> is non-empty, or the empty set is reported (evidence: a count, or the report)
result: pass → NODE 2 | unlocated claim → REPAIR (owner: NODE 1) | unknown → BLOCKED

# NODE 2 — INTENT      [conative · teleology · optimisation · yields: ranking]
@purpose: "decide what is worth doing before any effort is spent"
CONTRACT:
input:     <what exists> from NODE 1
transform: SET <objective> = "<one sentence the result is checked against>"; COMPOSE_ARTIFACT <branches> FROM <objective>; RANK <branches> BY <utility minus cost> INTO <ranked>
output:    <ranked>, and the chosen branch
HANDOFF GATE:
[check] <objective> is one sentence a result can be checked against (evidence: the sentence)
[check] <ranked> holds more than one admissible branch (evidence: a count above one) over: <branches> measured: <admissible> / <branches>
[check] the chosen branch is the first of <ranked> (evidence: the ranking)
result: pass → NODE 3 | one branch → REPAIR (owner: NODE 2) | unknown → BLOCKED

# NODE 3 — SEE         [epistemic · analysis · graph · yields: edge-list]
CONTRACT:
input:     <what exists> from NODE 1, under the chosen branch
transform: ANALYZE_CONTENT <what exists> AGAINST <the lenses the subject warrants> INTO <observations>
output:    <observations>
HANDOFF GATE:
[check] every observation names its lens (evidence: one lens per entry) over: <observations> measured: <lensed> / <observations>
[check] every observation has a location (evidence: no entry without a path)
result: pass → NODE 4 | unlensed observation → REPAIR (owner: NODE 3) | unknown → BLOCKED

# NODE 4 — DERIVE      [epistemic · reasoning · logic · yields: boolean]
CONTRACT:
input:     <observations> from NODE 3
transform: EXTRACT_FACTS <claims> FROM <observations> INTO <claims>
output:    <claims>
HANDOFF GATE:
[check] every claim names the observation it rests on (evidence: a source per claim) over: <claims> measured: <sourced> / <claims>
[check] no claim rests on prior knowledge (evidence: every source is in <observations>)
result: pass → NODE 5 | unsourced claim → REPAIR (owner: NODE 3) | unknown → BLOCKED

# NODE 5 — PROJECT     [epistemic · reasoning · graph · yields: edge-list]
CONTRACT:
input:     <claims> from NODE 4
transform: COMPOSE_ARTIFACT <plan> FROM <claims> USING <dependency order>
output:    <plan>
HANDOFF GATE:
[check] <plan> is acyclic (evidence: a topological order exists)
[check] every step of <plan> names its inputs and outputs (evidence: no empty contract) over: <plan> steps measured: <contracted> / <steps>
result: pass → NODE 6 | a cycle → REPAIR (owner: NODE 5) | unknown → BLOCKED

# NODE 6 — ACT         [epistemic · formalisation · computation · yields: procedure]
CONTRACT:
input:     <plan> from NODE 5
transform: EXECUTE_TOOL <plan> INTO <realised>
output:    <realised>
HANDOFF GATE:
[check] every step ran or is reported as blocked (evidence: one status per step) over: <plan> steps measured: <ran or blocked> / <steps>
[check] every step traces to the chosen branch (evidence: the trace)
[check] <realised> names every artifact a step produced (evidence: one entry per step)
refuse: a step that would write outside the chosen branch before EXECUTE_TOOL
result: pass → NODE 7 | untraced step → REPAIR (owner: NODE 6) | unknown → BLOCKED

# NODE 7 — CONSTRAIN   [conative · teleology · optimisation · yields: boolean]
CONTRACT:
input:     <realised> from NODE 6
transform: VALIDATE_ARTIFACT <realised> AGAINST <the chosen branch's cost and the hard limits>
output:    the admissibility verdict
HANDOFF GATE:
[check] nothing ran outside the chosen branch (evidence: every step traces to it) over: <realised> measured: <inside> / <steps>
[check] the realised cost is within the branch's cost (evidence: the two numbers)
[check] no step crossed a hard limit (evidence: the limits, each checked)
result: pass → NODE 8 | a limit crossed → REPAIR (owner: NODE 5) | unknown → BLOCKED

# NODE 8 — VERIFY      [evaluative · verification · logic · yields: boolean]
CONTRACT:
input:     <claims> from NODE 4, and <realised> from NODE 6
transform: VALIDATE_ARTIFACT every <claim> AGAINST <evidence>
output:    the verdicts
HANDOFF GATE:
[check] evidence non-empty for every claim (evidence: the evidence set) over: <claims> measured: <evidenced> / <claims>
[check] every claim names its refuter (evidence: one refuter per claim)
[check] no claim rests on the absence of a contradiction (evidence: each claim's evidence is an observation)
standing: moved-set <the surfaces that changed since NODE 3>
result: pass → NODE 9 | refuted → REPAIR (owner: NODE 4) | unknown → BLOCKED

# NODE 9 — COMMIT      [evaluative · representation · information-theory · yields: artifact]
CONTRACT:
input:     the verdicts from NODE 8
transform: PERSIST_ARTIFACT <result> TO <the surface the next cycle reads>
output:    <result>
freshness: fingerprint(<claims>) + fingerprint(<realised>)
HANDOFF GATE:
[check] <result> persisted where the next cycle reads (evidence: a read returns it)
[check] <result> carries its derivations (evidence: the evidence set travels with it) over: <claims> measured: <carried> / <claims>
[check] nothing earlier was rewritten by the commit (evidence: a witness read)
refuse: <the surface the next cycle reads> changed since it was read before PERSIST_ARTIFACT
result: pass → NODE 10 | a rewrite → REPAIR (owner: NODE 9) | unknown → BLOCKED

# NODE 10 — TERMINATE  [evaluative · termination · set-theory · yields: boolean]
CONTRACT:
input:     <result> from NODE 9
transform: VALIDATE_ARTIFACT <result> AGAINST <saturated, complete, verified>
output:    the stop
HANDOFF GATE:
[check] saturated · nothing remains to examine (evidence: the open set is empty) over: the open set measured: <examined> / <open>
[check] complete · the objective sentence reads true against the tree (evidence: the sentence, checked)
[check] verified · every claim passed NODE 8 (evidence: the verdicts)
result: pass → TERMINATE | not saturated → REPAIR (owner: NODE 1) | unknown → BLOCKED
```

B1·b selection by fit

```pag
# selection by semantic fit · never by a word in the request
ANALYZE <request> AGAINST <each protocol's use-when> INTO <fit>
FOR EACH <protocol> IN <protocols>:
IF <fit>[<protocol>].<semantic-match>:
APPEND <protocol> TO <selected> WITH reason: <fit>[<protocol>].<reason>

# what a trigger word would have done
# "analyze" in the request → the analysis protocol, whatever the request was for
```

B1·c typed gates

```pag
# a decision typed to its shape · a gate owing a ranking is not satisfied by a yes
HANDOFF GATE (evidence-bearing):
rule_id: "INTENT"      yields: ranking
[check] the chosen branch is the argmax over admissible branches (evidence: the ranking)
[check] more than one branch was admissible (evidence: a count above one)
[check] every branch carries what it advances and what it costs (evidence: no branch with an empty field)
result: pass → NODE 3 | one branch → REPAIR (owner: NODE 2) | unknown → BLOCKED

HANDOFF GATE (evidence-bearing):
rule_id: "VERIFY"      yields: boolean
[check] the evidence set is non-empty for every claim (evidence: the set) over: <claims> measured: <evidenced> / <claims>
[check] every claim names what would refute it (evidence: one refuter per claim)
[check] every claim's evidence is an observation, never an absence (evidence: each entry's source)
result: pass → NODE 9 | refuted → REPAIR (owner: NODE 4) | unknown → BLOCKED

HANDOFF GATE (evidence-bearing):
rule_id: "TERMINATE"   yields: boolean
[check] saturation (evidence: the open set is empty) over: the open set measured: <examined> / <open>
[check] completion (evidence: the objective sentence, checked against the tree)
[check] verification (evidence: every claim's verdict)
result: pass → TERMINATE | not saturated → REPAIR (owner: NODE 1) | unknown → BLOCKED
```

B1·d the loop

```mermaid
flowchart TB
orient["Orient · what exists"]
intent["Intent · worth, a ranking"]
see["See · lenses"]
derive["Derive · claims"]
project["Project · an ordered plan"]
act["Act · procedures"]
constrain["Constrain · admissible?"]
verify["Verify · evidence"]
commit["Commit · an artifact"]
terminate["Terminate · stop?"]
orient --> intent -- gate --> see --> derive --> project --> act --> constrain -- gate --> verify -- gate --> commit --> terminate
verify -. refuted, with the evidence .-> derive
terminate -- gate --> orient
```

B1·e fit, not word

```mermaid
flowchart LR
request["A request"]
word["A trigger word · analyze, choose, debug"]
fit["Semantic fit · the transition requested against each protocol's use-when"]
wrong["The protocol the word names"]
right["The protocol the transition needs, with its reason"]
request -. the cheap path .-> word --> wrong
request --> fit --> right
```

## Links to

- [The loop](https://banes-lab.com/disciplined-methodology/start/the-loop.md)
- [Worth before work](https://banes-lab.com/disciplined-methodology/plan/worth-before-work.md)
- [Verification](https://banes-lab.com/records/arch/verification.md)

## Linked from

- [Genesis stages](https://banes-lab.com/pag/patterns/genesis-stages.md)
- [Algorithm examples](https://banes-lab.com/pag/patterns/algorithm-examples.md)
- [Integrating algorithms](https://banes-lab.com/pag/patterns/algorithm-integration.md)
- [Template families](https://banes-lab.com/pag/templates/templates-families.md)
