import { INTENT_SECTION_ICON } from "#configuration/icons/grammar.icons"; import { INTENT_SECTION_ID } from "#core/ids/grammar.ids"; import { PAG_LANGUAGE } from "#configuration/constants/code.constants"; import type { Section } from "#types/document.types"; const LOOP_SAMPLE = '# the ten nodes · each closes on the gate it owes, and each reads only the prior node\'s output\n# NODE 1 — ORIENT [epistemic · ontology · set-theory · yields: set]\n@purpose: "name what exists before anything is done with it"\nCONTRACT:\n input: \n transform: READ_RESOURCE INTO ; DISCOVER_RESOURCES "" INTO \n output: , under \nHANDOFF GATE:\n [check] read before any claim (evidence: the read precedes the first claim)\n [check] every claim about the tree has a location (evidence: no claim without a path)\n [check] is non-empty, or the empty set is reported (evidence: a count, or the report)\n result: pass -> NODE 2 | unlocated claim -> REPAIR (owner: NODE 1) | unknown -> BLOCKED\n\n# NODE 2 — INTENT [conative · teleology · optimisation · yields: ranking]\n@purpose: "decide what is worth doing before any effort is spent"\nCONTRACT:\n input: from NODE 1\n transform: SET = ""; COMPOSE_ARTIFACT FROM ; RANK BY INTO \n output: , and the chosen branch\nHANDOFF GATE:\n [check] is one sentence a result can be checked against (evidence: the sentence)\n [check] holds more than one admissible branch (evidence: a count above one) over: measured: / \n [check] the chosen branch is the first of (evidence: the ranking)\n result: pass -> NODE 3 | one branch -> REPAIR (owner: NODE 2) | unknown -> BLOCKED\n\n# NODE 3 — SEE [epistemic · analysis · graph · yields: edge-list]\nCONTRACT:\n input: from NODE 1, under the chosen branch\n transform: ANALYZE_CONTENT AGAINST INTO \n output: \nHANDOFF GATE:\n [check] every observation names its lens (evidence: one lens per entry) over: measured: / \n [check] every observation has a location (evidence: no entry without a path)\n result: pass -> NODE 4 | unlensed observation -> REPAIR (owner: NODE 3) | unknown -> BLOCKED\n\n# NODE 4 — DERIVE [epistemic · reasoning · logic · yields: boolean]\nCONTRACT:\n input: from NODE 3\n transform: EXTRACT_FACTS FROM INTO \n output: \nHANDOFF GATE:\n [check] every claim names the observation it rests on (evidence: a source per claim) over: measured: / \n [check] no claim rests on prior knowledge (evidence: every source is in )\n result: pass -> NODE 5 | unsourced claim -> REPAIR (owner: NODE 3) | unknown -> BLOCKED\n\n# NODE 5 — PROJECT [epistemic · reasoning · graph · yields: edge-list]\nCONTRACT:\n input: from NODE 4\n transform: COMPOSE_ARTIFACT FROM USING \n output: \nHANDOFF GATE:\n [check] is acyclic (evidence: a topological order exists)\n [check] every step of names its inputs and outputs (evidence: no empty contract) over: steps measured: / \n result: pass -> NODE 6 | a cycle -> REPAIR (owner: NODE 5) | unknown -> BLOCKED\n\n# NODE 6 — ACT [epistemic · formalisation · computation · yields: procedure]\nCONTRACT:\n input: from NODE 5\n transform: EXECUTE_TOOL INTO \n output: \nHANDOFF GATE:\n [check] every step ran or is reported as blocked (evidence: one status per step) over: steps measured: / \n [check] every step traces to the chosen branch (evidence: the trace)\n [check] names every artifact a step produced (evidence: one entry per step)\n refuse: a step that would write outside the chosen branch before EXECUTE_TOOL\n result: pass -> NODE 7 | untraced step -> REPAIR (owner: NODE 6) | unknown -> BLOCKED\n\n# NODE 7 — CONSTRAIN [conative · teleology · optimisation · yields: boolean]\nCONTRACT:\n input: from NODE 6\n transform: VALIDATE_ARTIFACT AGAINST \n output: the admissibility verdict\nHANDOFF GATE:\n [check] nothing ran outside the chosen branch (evidence: every step traces to it) over: measured: / \n [check] the realised cost is within the branch\'s cost (evidence: the two numbers)\n [check] no step crossed a hard limit (evidence: the limits, each checked)\n result: pass -> NODE 8 | a limit crossed -> REPAIR (owner: NODE 5) | unknown -> BLOCKED\n\n# NODE 8 — VERIFY [evaluative · verification · logic · yields: boolean]\nCONTRACT:\n input: from NODE 4, and from NODE 6\n transform: VALIDATE_ARTIFACT every AGAINST \n output: the verdicts\nHANDOFF GATE:\n [check] evidence non-empty for every claim (evidence: the evidence set) over: measured: / \n [check] every claim names its refuter (evidence: one refuter per claim)\n [check] no claim rests on the absence of a contradiction (evidence: each claim\'s evidence is an observation)\n standing: moved-set \n result: pass -> NODE 9 | refuted -> REPAIR (owner: NODE 4) | unknown -> BLOCKED\n\n# NODE 9 — COMMIT [evaluative · representation · information-theory · yields: artifact]\nCONTRACT:\n input: the verdicts from NODE 8\n transform: PERSIST_ARTIFACT TO \n output: \n freshness: fingerprint() + fingerprint()\nHANDOFF GATE:\n [check] persisted where the next cycle reads (evidence: a read returns it)\n [check] carries its derivations (evidence: the evidence set travels with it) over: measured: / \n [check] nothing earlier was rewritten by the commit (evidence: a witness read)\n refuse: changed since it was read before PERSIST_ARTIFACT\n result: pass -> NODE 10 | a rewrite -> REPAIR (owner: NODE 9) | unknown -> BLOCKED\n\n# NODE 10 — TERMINATE [evaluative · termination · set-theory · yields: boolean]\nCONTRACT:\n input: from NODE 9\n transform: VALIDATE_ARTIFACT AGAINST \n output: the stop\nHANDOFF GATE:\n [check] saturated · nothing remains to examine (evidence: the open set is empty) over: the open set measured: / \n [check] complete · the objective sentence reads true against the tree (evidence: the sentence, checked)\n [check] verified · every claim passed NODE 8 (evidence: the verdicts)\n result: pass -> TERMINATE | not saturated -> REPAIR (owner: NODE 1) | unknown -> BLOCKED'; const FIT_SAMPLE = '# selection by semantic fit · never by a word in the request\nANALYZE AGAINST INTO \nFOR EACH IN :\n IF [].:\n APPEND TO WITH reason: [].\n\n# what a trigger word would have done\n# "analyze" in the request -> the analysis protocol, whatever the request was for'; const TYPED_SAMPLE = '# a decision typed to its shape · a gate owing a ranking is not satisfied by a yes\nHANDOFF GATE (evidence-bearing):\n rule_id: "INTENT" yields: ranking\n [check] the chosen branch is the argmax over admissible branches (evidence: the ranking)\n [check] more than one branch was admissible (evidence: a count above one)\n [check] every branch carries what it advances and what it costs (evidence: no branch with an empty field)\n result: pass -> NODE 3 | one branch -> REPAIR (owner: NODE 2) | unknown -> BLOCKED\n\nHANDOFF GATE (evidence-bearing):\n rule_id: "VERIFY" yields: boolean\n [check] the evidence set is non-empty for every claim (evidence: the set) over: measured: / \n [check] every claim names what would refute it (evidence: one refuter per claim)\n [check] every claim\'s evidence is an observation, never an absence (evidence: each entry\'s source)\n result: pass -> NODE 9 | refuted -> REPAIR (owner: NODE 4) | unknown -> BLOCKED\n\nHANDOFF GATE (evidence-bearing):\n rule_id: "TERMINATE" yields: boolean\n [check] saturation (evidence: the open set is empty) over: the open set measured: / \n [check] completion (evidence: the objective sentence, checked against the tree)\n [check] verification (evidence: every claim\'s verdict)\n result: pass -> TERMINATE | not saturated -> REPAIR (owner: NODE 1) | unknown -> BLOCKED'; const LOOP_DIAGRAM = 'flowchart TB\n orient["Orient · what exists"]\n intent["Intent · worth, a ranking"]\n see["See · lenses"]\n derive["Derive · claims"]\n project["Project · an ordered plan"]\n act["Act · procedures"]\n constrain["Constrain · admissible?"]\n verify["Verify · evidence"]\n commit["Commit · an artifact"]\n terminate["Terminate · stop?"]\n orient --> intent -- gate --> see --> derive --> project --> act --> constrain -- gate --> verify -- gate --> commit --> terminate\n verify -. refuted, with the evidence .-> derive\n terminate -- gate --> orient'; const FIT_DIAGRAM = 'flowchart LR\n request["A request"]\n word["A trigger word · analyze, choose, debug"]\n fit["Semantic fit · the transition requested against each protocol\'s use-when"]\n wrong["The protocol the word names"]\n right["The protocol the transition needs, with its reason"]\n request -. the cheap path .-> word --> wrong\n request --> fit --> right'; export const INTENT_SECTION: Section = { icon: INTENT_SECTION_ICON, id: INTENT_SECTION_ID, intro: "A request is turned into structure by walking the loop, not by matching a word, the two routes fit, not word draws and selection by fit writes. Each of the loop's nodes yields a decision of a declared shape: intent a ranking, never a yes; verify a boolean over evidence; terminate a stop only when the work is saturated, complete and verified, the three gates typed gates writes. A document that walks the loop writes each node with its contract and a gate wherever the node owes one, which is the whole of ten nodes, and the loop draws the edge a refutation takes back.", subsections: [ { blocks: [ { application: "Turn a request into nodes by walking the loop in order and closing each node on the gate it owes. State the objective before any seeing and rank the admissible ways of reaching it, so intent yields a ranking with more than one entry. Select a protocol by comparing the transition the request asks for against what each protocol is for, and record the reason. Type every gate to the shape its decision yields, and let a refuted claim go back to derive with the evidence rather than forward with a caveat.", boundary: "A descriptive artifact, a reference, a note, a contract, is read rather than walked, and forcing the full loop onto it is fitting a thing to a shape it does not have. Only an artifact that will be walked takes every node.", cause: "A word in a request is evidence about the request and never its subject, and a protocol chosen from the word answers the word.", decision: "Derive the structure from the transition the request asks for rather than from the words it uses.", failureMode: "A request to analyze a plan is routed to the analysis protocol because it said analyze, the plan needed a decision between two designs, and the output is a thorough analysis of the wrong question.", kind: "lesson", principle: "Intent yields a ranking, protocols are selected by fit, and every decision is typed to its shape.", problem: "A structure chosen from a trigger word answers the word rather than the request.", validation: "For each node, name 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.", }, { kind: "text", text: "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 worth before work states. Admissibility is asked after the operations exist. Evidence is a non-empty set, where no contradiction found is not evidence. Termination is saturation and completion and verification together. Every other node runs when the subject warrants it.", }, { kind: "text", text: "Protocol selection is by fit because a trigger word is the cheapest possible match and the least reliable: the same word appears in requests with nothing in common but the word. The reason travels with the selection so a reader can contest it.", }, { code: LOOP_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "ten nodes" }, { code: FIT_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "selection by fit" }, { code: TYPED_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "typed gates" }, { caption: "the loop", kind: "mermaid", text: LOOP_DIAGRAM }, { caption: "fit, not word", kind: "mermaid", text: FIT_DIAGRAM }, ], title: "Walk the loop, select by fit", }, ], title: "From intent to structure", };