# configuration/strings/structure.strings.ts

> 55 lines of code and 5 definitions.

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

## Definitions

- `SKELETON` (lexical_declaration, line 6)
- `TYPE_SHAPE` (lexical_declaration, line 9)
- `ORDER_DIAGRAM` (lexical_declaration, line 12)
- `TYPE_DIAGRAM` (lexical_declaration, line 15)
- `STRUCTURE_SECTION` (lexical_declaration, line 18, exported)

## Source

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

const SKELETON =
    '---\nname: <document-name>\ntype: WORKFLOW\nversion: 1.0.0\n---\n\nTHIS WORKFLOW EXECUTES <what it is for>\n\n%% META %%:\n    priority: <what outranks what when two sources disagree>\n    trust: <what is trusted> = TRUSTED, <what is not> = UNTRUSTED\n    objective: "<what finished looks like, checkable>"\n    jurisdiction: <what the document may touch> | external: <what it declares outside itself>\n    recursion_limit: <a bound on repair>\n\n# THE FOUR LAYERS · each answers one question about this document\n#   substrate  — how does the artifact come to be        grounds the order of the nodes, named on each by @genesis\n#   epistemic  — how is it known                          orient · see · derive · project · act\n#   conative   — what is worth doing                      intent · constrain            mandatory, always\n#   evaluative — is it right, and are we done             verify · commit · terminate   mandatory, always\n\n# YIELDS-SHAPE LEGEND · every decision resolves to a typed shape\n#   set-theory → set|boolean · logic → boolean · graph → edge-list · optimisation → boolean|ranking · computation → procedure\n\n# SEMANTIC OPERATION BOUNDARY · nodes say WHAT as operations; an adapter decides HOW, and the core names no tool or path\n\n# THE LOOP SPINE · transitions declared once, every node cites it\n# node · layer · axis · yields · transition out\n\n# NODE 1 — ORIENT … NODE 10 — TERMINATE · each with its four-slot tag, its genesis stage, its contract and one evidence-bearing gate\n\n# REPAIR EDGE · verify refutes back to the earliest invalid node, bounded by recursion_limit\n\n# CROSS-NODE INVARIANTS\nINVARIANT <name>: <a property that could be false> over: <the set it ranges over> binds: <the parties it constrains> objector: <the check that would disagree | none>\n\nREPORT:\n  subject: <the terminal node>\n  verdict: pass | fail | unknown\n  domain: declared <N> measured <n>\n  completion: saturated <bool> complete <bool> verified <bool>';

const TYPE_SHAPE =
    "# a type binds a document to a reasoning model and to the axis of the loop it sits on\n\n# cognition · how a system perceives, acts and adapts\nTHIS AGENT PERFORMS <a behaviour, walked as nodes>                axis: reasoning\nTHIS WORKFLOW EXECUTES <a multi-node process>                    axis: formalisation\nTHIS PROMPT IS <one interaction>                                 axis: formalisation\nTHIS COMMAND EXECUTES <one invocable operation>                  axis: formalisation\n\n# pattern-cycle · how pattern-work proceeds\nTHIS PROTOCOL DEFINES <a standing procedure, as rules>           axis: formalisation\nTHIS CHECKLIST PROVIDES <tasks with their contracts>             axis: formalisation\nTHIS TASK EXECUTES <one objective>                               axis: formalisation\nTHIS INSTRUCTION IS <general guidance>                           axis: formalisation\nTHIS COMPOSITION RENDERS <a structure from anchors and modifiers> axis: formalisation\nTHIS POLICY ENFORCES <a constraint set>                          axis: teleology\nTHIS TEMPLATE IMPLEMENTS <a reusable shape, slots open>          axis: representation\n\n# epistemology · how a pattern is known\nTHIS TEST PERFORMS <a specification checked by running it>       axis: verification\nTHIS VERIFICATION PERFORMS <claims adjudicated against evidence> axis: verification\nTHIS AUDIT AUDITS <an artifact against a contract, then corrects> axis: verification\nTHIS DEBUG RESOLVES <a symptom to an evidence-scored cause>      axis: analysis\nTHIS DISTILLATION DISTILLS <repeated behaviour into one base>    axis: reasoning\nTHIS TRANSLATION AUDITS <a rendering against its source>         axis: representation";

const ORDER_DIAGRAM =
    'flowchart TB\n    front["Header block · name, type, version"]\n    decl["Declaration · THIS TYPE VERB description"]\n    meta["META · priority, trust, objective, bounds"]\n    frame["The four layers, the shape legend, the operation boundary"]\n    substrate["The substrate · how the artifact comes to be"]\n    spine["The spine · transitions declared once"]\n    nodes["Nodes · each with a contract and one gate"]\n    repair["The repair edge · bounded"]\n    rules["Cross-node invariants · one record each"]\n    report["The report · what was measured, over what, and whether the three conditions coincide"]\n    front --> decl --> meta --> frame --> substrate --> spine --> nodes --> repair --> rules --> report';

const TYPE_DIAGRAM =
    'flowchart LR\n    type["The declared type"]\n    verb["Its default verb"]\n    model["The reasoning model that walks it"]\n    axis["The axis of the loop it sits on"]\n    reader["A reader knows what kind of instruction this is, and what will walk it"]\n    type --> verb --> reader\n    type --> model --> reader\n    type --> axis --> reader';

export const STRUCTURE_SECTION: Section = {
    icon: STRUCTURE_SECTION_ICON,
    id: STRUCTURE_SECTION_ID,
    intro: "A document says what kind of instruction it is before it gives any instruction, which is the orient stage of the loop written down: what exists is declared before anything is done with it. That makes a document a self-describing structure, laid out as shown in <cite>skeleton</cite> and ordered as shown in <cite>parts in order</cite>. A document that opens with a directive has left its own contract unstated. The type it declares is one of those listed in <cite>the types</cite>, and <cite>what a type fixes</cite> shows what that one line settles before any node is walked.",
    subsections: [
        {
            blocks: [
                {
                    application:
                        "In practice, a document runs in this order: the header, the declaration, the meta block and the frame the nodes cite, and it closes with the repair edge and the invariants.",
                    boundary:
                        "A fragment reused inside other documents carries no header of its own, because the enclosing document already declared the contract. A fragment that declares a second type is two documents.",
                    cause: "A reader classifies a document from its first lines and reads everything after against that guess.",
                    decision:
                        "The contract is fixed on the first line with a type, rather than left for the reader to infer from the directives below.",
                    failureMode:
                        "A reader cannot tell whether a document is a standing policy or a one-time task, walks a policy once and then drops it, and the rules it carried end up applying to nothing.",
                    kind: "lesson",
                    principle:
                        "For this reason the type comes first, and everything after it is read against that type.",
                    problem:
                        "A document with no declared type has an unstated contract, so each reader, the developer or the model, supplies its own.",
                    validation:
                        "To check this, cover everything below the declaration and ask what the document is for, what will walk it and how it will be used. A declaration that cannot answer all three is missing a type or an intent.",
                },
                {
                    kind: "text",
                    text: "The meta block settles four things before any node runs. The priority between sources decides a disagreement before it arises. The trust anchor ensures that a claim from an untrusted source is never promoted to evidence just by being read. The jurisdiction states what the document may touch and what it declares outside itself, rather than leaving that assumed; it is the same boundary the honest gaps draws for a system. The recursion limit makes a repair loop terminate. Choosing the type chooses the contract, the reasoning model and the axis at once, and the verb makes that choice legible on the first line.",
                },
                {
                    kind: "text",
                    text: "The substrate and the spine are declared once and cited by every node. The substrate orders the nodes, as described in node design, and each node names its stage on it. The spine declares every transition: which node leads to which, where a failed verification sends the work back, and where the loop terminates. A node names its place on both and inherits the rest, which is why a document reads as one structure rather than ten separate documents. The document closes with its invariant records and a report, which states the verdict in a form a later checker can challenge, as described in a report, not a checkbox.",
                },
                { code: SKELETON, kind: "code", language: PAG_LANGUAGE, title: "skeleton" },
                { code: TYPE_SHAPE, kind: "code", language: PAG_LANGUAGE, title: "the types" },
                { caption: "parts in order", kind: "mermaid", text: ORDER_DIAGRAM },
                { caption: "what a type fixes", kind: "mermaid", text: TYPE_DIAGRAM },
            ],
            title: "Declare, then instruct",
        },
    ],
    title: "Document structure",
};
```
