# configuration/grammar/data/template.composition.data.json

> 56 lines of code and 0 definitions.

Tree: GovLab Context
Language: json
Layer: domain
Canonical: https://banes-lab.com/anatomy/context#file-context-configuration-grammar-data-template-composition-data-json
Source text: https://banes-lab.com/source/context/configuration/grammar/data/template.composition.data.json.txt

Listed in [configuration/grammar/data](https://banes-lab.com/api/source/context/configuration/grammar/data.md), after [configuration/grammar/data/template.checklist.data.json](https://banes-lab.com/source/context/configuration/grammar/data/template.checklist.data.json.md) and before [configuration/grammar/data/template.debug.data.json](https://banes-lab.com/source/context/configuration/grammar/data/template.debug.data.json.md).

## Contained in

- [configuration/grammar/data](https://banes-lab.com/anatomy/context/folder-context-configuration-grammar-data.md)

## Source

```json
{
    "copyright": "PAG (Pattern Abstract Grammar) © Bane's Lab, CC BY-SA 4.0. Used with the author's explicit permission; attribution must be preserved. See ../../../LICENSE.",
    "check": {
        "by": [
            "the template round-trip check, which fills the template and validates the result against the grammar",
            "the slot check, which requires every declared slot to appear in the body and every slot in the body to be declared"
        ],
        "population": "this template's body and slots, and every document created from it",
        "freshness": "a verdict stands until the template, its document type or the grammar changes",
        "refusal": "the gate fails on a dangling slot, an unregistered type, or a filled template that does not validate",
        "observation": "none: a template is static text, and nothing observes it while a run executes",
        "evidence": "fires-and-accepts: one suite plants a slot the body never carries and a template of an unregistered type, another plants a retired head in a real template, and every filled template validates clean",
        "authority": "the template's document type and the grammar, which every document created from the template conforms to"
    },
    "type": "COMPOSITION",
    "title": "Writing Composition Meta-Template (anchor-modifier transform-algebra structure generator)",
    "slots": [
        {
            "name": "convention.space_schema",
            "description": "the injected SPACE: the facets, their values, each anchor value's skeleton, and each modifier value's op-list and signature",
            "required": true,
            "kind": "string"
        },
        {
            "name": "style_request",
            "description": "the raw style request (a bundle-label, a partial coordinate, or a free description)",
            "required": true,
            "kind": "string"
        },
        {
            "name": "task_name",
            "description": "kebab-case name for the output file",
            "required": true,
            "kind": "string"
        }
    ],
    "constraints": [
        "declaration_required",
        "gate_per_node",
        "contract_reads_prior_output",
        "population_declared",
        "refusal_before_write",
        "invariant_has_objector",
        "evidence_grounded",
        "space_injected_never_hardcoded",
        "coordinate_resolves_in_space_one_anchor",
        "coordinate_realizable_no_axis_conflict",
        "ops_apply_in_precedence_order_do_not_commute",
        "anchor_alone_owns_clause_order",
        "closure_over_primitive_alphabet",
        "every_facet_leaves_a_named_signature",
        "at_most_one_repair_then_reject",
        "unknown_is_not_pass"
    ],
    "body": "---\nname: {task_name}\ntype: COMPOSITION\nversion: 1.0.0\n---\n\nTHIS COMPOSITION RENDERS a writing style's token-sequence structure from a faceted coordinate, folding one anchor skeleton with ordered modifier transforms over a primitive grammatical alphabet.\n\n%% META %%:\n    priority: the requested coordinate for intent, the SPACE for legal values, nothing else\n    trust: the_coordinate = SOLE_AUTHORITY_FOR_INTENT, the_space = SOLE_AUTHORITY_FOR_VALUES, prior_knowledge = UNTRUSTED\n    objective: {style_request}\n    jurisdiction: {style_request} against the SPACE in {convention.space_schema} | external: every style the SPACE does not name\n    recursion_limit: 1\n\n# NODE 1 — RESOLVE   [epistemic · ontology · set-theory · yields: set]\n@purpose: \"parse the style request into a validated coordinate and fix what is authoritative\"\n@genesis: existence\nCONTRACT:\n  input:     {style_request}\n  transform: READ_RESOURCE {convention.space_schema} INTO space; EXTRACT_FACTS <one value per facet, a bundle-label expanded through the SPACE label map> FROM {style_request} INTO coordinate; FOR EACH facet IN <unstated modifier facets>: SET facet = identity\n  constraints: every named value resolves in the SPACE; exactly one anchor facet is assigned; an unstated modifier is identity, never guessed\n  output:    coordinate\nDECLARE coordinate: object\nSET coordinate = {anchor: <the one anchor value>, modifiers: <one value per modifier facet>, space: space}\nHANDOFF GATE (evidence-bearing):\n  rule_id: \"RESOLVE\"   yields: boolean\n  [check] every assigned value is a member of its facet's values (evidence: the SPACE lookup) over: facets measured: <resolved> / <facets>\n  [check] exactly one facet carries the anchor role (evidence: coordinate.anchor)\n  [check] unstated modifiers are identity, not guessed (evidence: coordinate.modifiers)\n  result: pass → NODE 2 | value outside the SPACE → REPAIR (owner: NODE 1) | unknown → BLOCKED\n\n# NODE 2 — REALIZABILITY   [conative · teleology · optimization · yields: boolean]\n@purpose: \"judge the coordinate realizable, with no conflicting facet values, before sequencing\"\n@genesis: difference\n@mandatory\nCONTRACT:\n  input:     coordinate from NODE 1\n  transform: FOR EACH axis IN <the facet axes>: COMPARE coordinate.modifiers AGAINST <the axis's incompatible pairs> INTO conflicts; DETERMINE <composition correctness over coverage> INTO objective\n  constraints: two conflicting values on one axis make the coordinate unrealizable and it is rejected, never merged; a faithful partial render beats a conflicted full one\n  output:    teleology\nDECLARE teleology: object\nSET teleology = {realizable: <conflicts empty>, conflicts: conflicts, objective: objective}\nHANDOFF GATE (tel-priority injection-gate):\n  rule_id: \"REALIZABILITY\"   yields: boolean\n  [check] no axis carries two conflicting values (evidence: teleology.conflicts) over: axes measured: <conflict-free> / <axes>\n  [check] composition correctness is the objective over coverage (evidence: teleology.objective)\n  [check] an unrealizable coordinate is routed to rejection, never merged (evidence: the result arm taken)\n  result: pass → NODE 3 | unrealizable → BLOCKED | unknown → BLOCKED\n\n# NODE 3 — PLAN   [epistemic · reasoning · algebra · yields: ordered-structure]\n@purpose: \"order the modifier transforms by the non-commuting precedence, seed the skeleton from the anchor, and assemble the render plan\"\n@genesis: structure\nCONTRACT:\n  input:     teleology from NODE 2\n  transform: SORT <the modifier op-lists> BY <lexicon, world, valence, density, register, wrap>; EXTRACT_FACTS <the anchor skeleton over the primitive alphabet> FROM coordinate.space INTO seed; COMPOSE_ARTIFACT plan FROM {seed, <the ordered steps>} USING <seed before steps>\n  constraints: request order is irrelevant because ops do not commute; an identity facet contributes nothing; the anchor alone owns clause order\n  preserves: the anchor's clause order\n  output:    plan\nDECLARE plan: object\nSET plan = {seed: seed, steps: <the totally ordered ops>}\nHANDOFF GATE (evidence-bearing):\n  rule_id: \"PLAN\"   yields: boolean\n  [check] the steps are totally ordered by precedence with no cross-facet tie (evidence: plan.steps) over: modifier facets measured: <ordered> / <modifiers>\n  [check] the seed skeleton is non-empty (evidence: plan.seed)\n  [check] the plan orders the seed before the steps (evidence: plan)\n  result: pass → NODE 4 | tie → REPAIR (owner: NODE 3) | unknown → BLOCKED\n\n# NODE 4 — RENDER   [epistemic · formalization · computation · yields: procedure]\n@purpose: \"instantiate the skeleton, fold each op in order, and gate the folded structure on admissibility before the signature check\"\n@genesis: transformation\nCONTRACT:\n  input:     plan from NODE 3\n  transform: FOR EACH step IN plan.steps: CONVERT structure TO <the op applied> INTO structure; VALIDATE_ARTIFACT structure AGAINST <closure over the primitive alphabet, non-emptiness, the anchor predicate> INTO admissibility\n  constraints: substitute-lexicon changes fillers only, never primitive tags; a primitive escaping the alphabet, an emptied sequence or a voided anchor predicate without an explicit reorder is refused at the step\n  preserves: every primitive tag\n  output:    structure\nDECLARE structure: object\nSET structure = {tokens: <a sequence over the alphabet>, applied: <every applied op>, admissible: admissibility}\nHANDOFF GATE (evidence-bearing):\n  rule_id: \"RENDER\"   yields: boolean\n  [check] the applied ops equal the planned steps (evidence: structure.applied against plan.steps) over: plan.steps measured: <applied> / <steps>\n  [check] every token's primitive is in the alphabet (evidence: the closure check)\n  [check] the sequence is non-empty and the anchor predicate is not voided (evidence: structure.admissible)\n  result: pass → NODE 5 | escape or void → REPAIR (owner: NODE 3) | unknown → BLOCKED\n\n# NODE 5 — VERIFY   [evaluative · verification · logic + probability · yields: number]\n@purpose: \"prove the rendered structure realizes the coordinate by checking that each facet left its named signature, repairing at most once\"\n@genesis: constraint\n@mandatory\nCONTRACT:\n  input:     structure from NODE 4\n  transform: FOR EACH modifier IN coordinate.modifiers: SEARCH_CONTENT structure.tokens FOR modifier.signature INTO evidence; VALIDATE_ARTIFACT structure AGAINST <the anchor's clause order, unless an explicit reorder was applied> INTO order; ANALYZE_CONTENT evidence FOR <the missing signature that would refute conformance> INTO refuter\n  constraints: a checkmark with no named token is void; a single bad op is reverted or reordered and re-rendered once; a repair that fails escalates to rejection, never a loop\n  output:    verdict\nDECLARE verdict: object\nSET verdict = {conforms: <every signature present and order intact>, evidence: evidence, refuter: refuter, repairs: <zero or one>}\nHANDOFF GATE (ver-stop gate):\n  rule_id: \"VERIFY\"   yields: boolean\n  [check] every modifier's signature is present with its token or position named (evidence: verdict.evidence) over: coordinate.modifiers measured: <signed> / <modifiers>\n  [check] the anchor order is intact or an explicit reorder is in the applied ops, and a refuter is named (evidence: order and verdict.refuter)\n  [check] at most one repair re-render occurred (evidence: verdict.repairs)\n  standing: moved-set none\n  result: pass → NODE 6 | missing signature → REPAIR (owner: NODE 4) | unknown → BLOCKED\n\n# NODE 6 — EMIT   [evaluative · termination · set-theory · yields: artifact]\n@purpose: \"emit the validated structure with its facet evidence, and declare the render complete or the coordinate unrealizable\"\n@genesis: emergence\n@mandatory\nCONTRACT:\n  input:     verdict from NODE 5\n  transform: COMPOSE_ARTIFACT emission FROM {structure, verdict} USING <every facet's evidence token named>; REDUCE emission.tokens TO <collapsed only where an op declared collapse>; PERSIST_ARTIFACT emission TO <{task_name} emission>; REPORT_RESULT emission TO <the parties whose next work it creates>\n  constraints: render adds no new transform; a rejection is a valid terminal, never a retry; a self-assessed done is not ter-stop\n  output:    emission\n  freshness: fingerprint(verdict) + fingerprint(this document)\nHANDOFF GATE (ter-stop gate):\n  rule_id: \"TERMINATE\"   yields: boolean\n  [check] the structure is emitted with per-facet evidence tokens (evidence: emission) over: facets measured: <evidenced> / <facets>\n  [check] the verdict conforms for a stop, or the coordinate was rejected as unrealizable (evidence: the termination set)\n  [check] exactly one validated render per coordinate (evidence: verdict.repairs and the emission count)\n  refuse: an emission destination that changed since it was read before PERSIST_ARTIFACT\n  result: pass → TERMINATE | integrity defect → REPAIR (owner: NODE 6) | unknown → BLOCKED\n\n# CROSS-NODE INVARIANTS\nINVARIANT space-is-data: the SPACE is injected data and the core knows no style by name over: every render binds: the composer objector: [check] every assigned value is a member of its facet's values at NODE 1\nINVARIANT realizable-first: no conflicted coordinate is rendered over: every coordinate binds: the composer objector: [check] no axis carries two conflicting values at NODE 2\nINVARIANT anchor-owns-order: the anchor alone owns clause order and a modifier is a transform on its output over: every render binds: the composer objector: [check] the anchor order is intact at NODE 5\nINVARIANT precedence-not-request: ops apply in precedence order because they do not commute over: plan.steps binds: the composer objector: [check] the steps are totally ordered by precedence at NODE 3\nINVARIANT closure: every rendered token stays within the primitive alphabet over: structure.tokens binds: the composer objector: [check] every token's primitive is in the alphabet at NODE 4\nINVARIANT signature-not-checkmark: a gate names the token that is its evidence, because a bare checkmark is void over: every facet binds: the composer objector: [check] every modifier's signature is present with its token named at NODE 5\nINVARIANT one-repair: at most one repair re-render precedes rejection over: every coordinate binds: the composer objector: [check] at most one repair re-render occurred at NODE 5\n\nREPORT:\n  subject: NODE 6\n  verdict: pass | fail | unknown\n  domain: declared <facets> measured <evidenced>\n  populations: modifiers signed <n>, ops applied <n>, repairs <n>\n  refusals: <n> [<reason>]\n  unresolved: <n> [<reason>]\n  completion: saturated <bool> complete <bool> verified <bool>\n"
}
```
