# configuration/strings/loop.strings.ts

> 57 lines of code and 6 definitions.

Tree: Site tree
Language: typescript
Layer: product
Canonical: https://banes-lab.com/anatomy/tree#file-configuration-strings-loop-strings-ts
Source text: https://banes-lab.com/assets/sources/source.98d061e5d1dcb01293ad723086985b38d7851fe2667758542c16a618f4d8db8d.generated.txt

## Definitions

- `STAGE_SAMPLE` (lexical_declaration, line 6)
- `PROTOCOL_SAMPLE` (lexical_declaration, line 9)
- `LABELED_SAMPLE` (lexical_declaration, line 12)
- `STAGE_DIAGRAM` (lexical_declaration, line 15)
- `PROTOCOL_DIAGRAM` (lexical_declaration, line 18)
- `LOOP_SECTION` (lexical_declaration, line 21, exported)

## Source

```typescript
import { LOOP_SECTION_ICON } from "#configuration/icons/grammar.icons";
import { LOOP_SECTION_ID } from "#core/ids/grammar.ids";
import { PAG_LANGUAGE } from "#configuration/constants/code.constants";
import type { Section } from "#types/document.types";

const STAGE_SAMPLE =
    "# a genesis stage · where in the substrate cycle a node's artifact comes to be, derived from its verb\nexistence       FIND, READ, DISCOVER_RESOURCES, READ_RESOURCE     does the thing exist, is it scaffolded\ndifference      ANALYZE, FILTER, SPLIT, REMOVE                    what boundary makes it distinct\nrelation        EXTRACT, LINK, SEARCH_CONTENT, EXTRACT_FACTS      what it depends on and connects to\nstructure       CREATE, INSERT, COMPOSE_ARTIFACT                  how its parts are arranged under its laws\ntransformation  EXECUTE, CONVERT, ITERATE, EXECUTE_TOOL           what operation it performs\nconstraint      VERIFY, VALIDATE, ENFORCE, VALIDATE_ARTIFACT      what invariants and gates bound it\nemergence       FINALIZE, REPORT, PERSIST_ARTIFACT, REPORT_RESULT does it integrate and stabilise\n\n# the stage is a tag on the node, beneath the header's four slots · one dialect, one header shape\n# NODE <n> — <NAME>   [<layer> · <axis> · <math type> · yields: <shape>]\n@genesis: <existence | difference | relation | structure | transformation | constraint | emergence>";

const PROTOCOL_SAMPLE =
    '# a protocol · a verb chain with the transition it is for and the principles it serves\n<separate-a-unit>:\n    use_when:   "a unit mixes concerns or exceeds a bounded complexity"\n    chain:      ANALYZE → FIND → EXTRACT → CREATE → VERIFY\n    principles: [<the principles it serves>]\n\n<extend-without-modifying>:\n    use_when:   "a new variant extends a stable system"\n    chain:      ANALYZE → FIND → CREATE → LINK → VERIFY\n    principles: [<the principles it serves>]\n\n<replace-a-path>:\n    use_when:   "an existing production path is replaced"\n    chain:      FIND → ANALYZE → CREATE → EXECUTE → VERIFY\n    principles: [<the principles it serves>]\n\n<author-an-enforcement>:\n    use_when:   "a new invariant needs automated protection"\n    chain:      ANALYZE → CREATE → LINK → EXECUTE → VERIFY\n    principles: [<the principles it serves>]\n\n<verification-gate>:                     # always appended · every plan ends in it\n    use_when:   "every plan requires a final reasoning and checklist validation"\n    chain:      ANALYZE → VERIFY → REPORT\n    principles: [<every active principle>]';

const LABELED_SAMPLE =
    "# a chain expanded into nodes · each header carries its layer, axis, math type and yields, and each node its genesis stage\n# NODE 1 — ANALYZE THE UNIT       [epistemic · analysis · logic · yields: set]\n@genesis: difference\n# NODE 2 — FIND THE SEAMS         [epistemic · ontology · set-theory · yields: set]\n@genesis: existence\n# NODE 3 — EXTRACT THE CONCERN    [epistemic · reasoning · graph · yields: edge-list]\n@genesis: relation\n# NODE 4 — CREATE THE NEW UNIT    [epistemic · formalisation · computation · yields: procedure]\n@genesis: structure\n# NODE 5 — VERIFY THE SPLIT       [evaluative · verification · logic · yields: boolean]\n@genesis: constraint\n\n# the stage is derived from the verb · a node whose stage disagrees with its verb is mislabelled\n# a node that depends on a later genesis than it produces is a genesis inversion";

const STAGE_DIAGRAM =
    'flowchart TB\n    verb["A node\'s verb"]\n    ground["The reasoning record the verb grounds to"]\n    genesis["Its genesis stage · the position in how the artifact comes to be"]\n    order["The order of the nodes · no node depends on a later stage than it produces"]\n    verb --> ground\n    verb --> genesis --> order';

const PROTOCOL_DIAGRAM =
    'flowchart LR\n    request["A request"]\n    transition["The transition it asks for · from one state of the tree to another"]\n    fit["Semantic fit against each protocol\'s use-when"]\n    chain["The chosen chain, with its reason"]\n    nodes["Nodes · each with its stage, each closed by a gate"]\n    gate["The verification gate protocol · always last"]\n    request --> transition --> fit --> chain --> nodes --> gate';

export const LOOP_SECTION: Section = {
    icon: LOOP_SECTION_ICON,
    id: LOOP_SECTION_ID,
    intro: "This section covers the genesis stage every node carries. The stage is derived from the node's verb rather than chosen, as shown in <cite>verb to stage</cite>, because the verb names where in the substrate cycle the node's artifact comes to be; <cite>genesis stages</cite> lists the stages, so one word decides the node's legal position. A protocol is a chain of such verbs, and <cite>protocols</cite> shows four. A protocol is selected as described in from intent to structure and shown in <cite>request to nodes</cite>, and a document instantiates its chain as tagged, gated nodes in genesis order, as shown in <cite>chain expanded</cite>.",
    subsections: [
        {
            blocks: [
                {
                    application:
                        "In practice, every node is tagged with the stage its verb derives, and a chosen chain is expanded into nodes in genesis order, each with a contract that reads the previous output and a gate of its own, and the verification gate protocol closes the chain. Where a node's stage disagrees with its verb, the node is mislabelled, and where a node depends on a later genesis than it produces, the order is wrong.",
                    boundary:
                        "A one-step task has no chain to instantiate. A single read with a single gate is a directive, and tagging it adds a name to nothing.",
                    cause: "A verb is a contract about what a node does, so a stage written beside it is a second declaration of the same fact, and a catalogue of roles beside the verbs is a second vocabulary that the ontology does not carry.",
                    decision:
                        "The stage is derived from the verb's grounding in the substrate cycle, rather than written as a role label beside the verb.",
                    failureMode:
                        "A node's tag says structure while its only directive reads a file, and the reviewer approves a build step that builds nothing.",
                    kind: "lesson",
                    principle:
                        "For this reason the header carries one dialect, and nothing is written beside the verb that the verb already says.",
                    problem: "A node labelled by hand carries a role its verb does not derive.",
                    validation:
                        "To check this, read each node's verb and state the stage it implies. A stage that does not follow from the verb was written by hand, and a header whose bracket carries anything other than the layer, the axis, the math type and the yields is a second dialect.",
                },
                {
                    kind: "text",
                    text: "The stage is a tag beneath the header, so a reader can see a document's construction order from its tags alone while the header keeps one shape. The header's four slots, the layer, the axis, the math type and the yields, come from the loop, and the same verb names the genesis stage used to order the nodes, as described in node design. Every action verb grounds to a reasoning record and the stage follows from that record, so a verb grounded in observation realises existence, one grounded in construction realises structure, and one grounded in a verification node realises constraint, which makes the derivation a lookup rather than a judgement.",
                },
                {
                    kind: "text",
                    text: "A protocol is a chain with a use-when and the principles it serves. The use-when names the transition the chain is for, from one state of the tree to another, and the principles name what the chain must leave true, so a selected protocol carries its own acceptance criteria into the nodes it expands to. The verification gate protocol is appended to every plan, because every plan ends by checking its own reasoning against the tree.",
                },
                { code: STAGE_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "genesis stages" },
                { code: PROTOCOL_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "protocols" },
                { code: LABELED_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "chain expanded" },
                { caption: "verb to stage", kind: "mermaid", text: STAGE_DIAGRAM },
                { caption: "request to nodes", kind: "mermaid", text: PROTOCOL_DIAGRAM },
            ],
            title: "Derived from the verb",
        },
    ],
    title: "Genesis stages",
};
```
