
Pattern Abstract Grammar
Structured instructions for LLMs
KeywordsA1
The keywords fall into categories by the job they do in a line, and every keyword is uppercase because that is the form the model has seen most in code. Every keyword outside the prepositions grounds to a record in the ontology's reasoning collection, so the vocabulary is derived rather than invented, and the lists below are read from the grammar's own records.
Semantic operationsA1.1
A document names one of the semantic operations for every external effect. One adapter per harness maps each operation to a tool, and the short tool forms an adapter accepts are its aliases, never the grammar's vocabulary.
DISCOVER_RESOURCESDISCOVER_RESOURCES "<pattern>" INTO <resources>READ_RESOURCEREAD_RESOURCE <resource> INTO <content>SEARCH_CONTENTSEARCH_CONTENT <content> FOR <term> INTO <matches>ANALYZE_CONTENTANALYZE_CONTENT <content> AGAINST <criteria> INTO <findings>EXTRACT_FACTSEXTRACT_FACTS <fields> FROM <content> INTO <facts>CALCULATE_METRICCALCULATE_METRIC <measure> FROM <facts> INTO <value>COMPOSE_ARTIFACTCOMPOSE_ARTIFACT <artifact> FROM <facts> USING <shape>VALIDATE_ARTIFACTVALIDATE_ARTIFACT <artifact> AGAINST <schema>PERSIST_ARTIFACTPERSIST_ARTIFACT <artifact> TO <destination>EXECUTE_TOOLEXECUTE_TOOL <command> WITH timeout: <bound> INTO <result>REQUEST_DECISIONREQUEST_DECISION <party> WITH options: [<a>, <b>] INTO <choice>REPORT_RESULTREPORT_RESULT <artifact> TO <parties>Node keywordsA1.2
These tokens make up the node form, which is the unit of a document. They cover the header with its four-slot tag, the contract, the substrate stage at which the node's artifact comes to be, and the slots and limits a document declares.
NODE# NODE <n> — <NAME> [<layer> · <axis> · <math type> · yields: <shape>]CONTRACTCONTRACT:YIELDSyields: <set | boolean | edge-list | ranking | procedure | artifact>GENESIS@genesis: <existence | difference | relation | structure | transformation | constraint | emergence>PRESERVESpreserves: <distinction>, <distinction>OUTPUT_CONTRACT# OUTPUT CONTRACTLIMITLIMIT <name>: "<what the document cannot do>"SLOTSLOT {<namespace>.<name>}: RESOLVED | ABSENT | DEFERREDValidation keywordsA1.3
These tokens make up the handoff gate. They cover a check with its evidence and the population it was measured over, the refusal before a write, the standing of the read set, and the three verdicts, with unknown routed to blocked.
ASSERTASSERT conditionREQUIREREQUIRE dependencyHANDOFFHANDOFF GATE (evidence-bearing):GATEHANDOFF GATE:CHECK[check] <claim> (evidence: <what settles it>)POPULATIONover: <set> measured: <n> / <N>REFUSErefuse: <condition> before <write>FRESHNESSfreshness: <inputs fingerprint> + <code fingerprint>STANDINGstanding: moved-set <set>UNKNOWNunknown → BLOCKEDBLOCKEDresult: ... | unknown → BLOCKEDPROMOTEpromote: <candidate> ON clean verdictPUBLISHpublish: <artifact> BY <party>RESULTresult: pass → NODE <n+1> | <failure> → REPAIR (owner: <node>) | unknown → BLOCKEDREPAIRREPAIR (owner: NODE <n>)RULE_IDrule_id: "<NODE NAME>"Report keywordsA1.4
A verdict is written as a report so that a later checker can challenge it. The report's fields record what was measured, over what, from which inputs, and whether the three termination conditions coincide.
SUBJECTsubject: <node>VERDICTverdict: pass | fail | unknownDOMAINdomain: declared <N> measured <n>POPULATIONSpopulations: <part> <n>, <part> <n>INPUTSinputs: <identity> <fingerprint>CODEcode: <fingerprint>OUTPUToutput: <identity> <fingerprint>REFUSALSrefusals: <n> [<reason>]OBSERVEDobserved: <n> [<location>]UNRESOLVEDunresolved: <n> [<reason>]COMPLETIONcompletion: saturated <bool> complete <bool> verified <bool>Invariant keywordsA1.5
An invariant record states a property in a form that could be false, the set it quantifies over, the parties it binds, and the objector that would disagree if it stopped holding. A record with no objector declares none, and the missing check stands as declared debt.
INVARIANTINVARIANT <name>: <property> over: <set> binds: <parties> objector: <check | none>PROPERTYINVARIANT one-writer: a record has exactly one writer ...OVERover: every record on the surfaceBINDSbinds: every party writing thereOBJECTORobjector: [check] one open fence per record | noneMeta keywordsA1.6
The meta block and the node tags state what the document is for, which source grounds which, what it trusts, what it may touch and what it declares outside itself, and how far repair may recurse.
META%% META %%:USEUSE TEMPLATE nameCUE@cue: "<reminder>"RECURSION_LIMITrecursion_limit: <bound>PURPOSE@purpose: "<what this node decides>"AXIS_QUESTION@axis_question: "<the question>"TRUSTtrust: tool_output = TRUSTED, prior_knowledge = UNTRUSTEDJURISDICTIONjurisdiction: <in scope> | external: <declared outside>PRIORITYpriority: <governing document> > <ontology> > <template> > <task>TEMPLATEUSE TEMPLATE validationAction keywordsA1.7
A directive inside a node's transform opens with one of these verbs. Each grounds to a reasoning mode or a loop node, and the ones that name an effect lower to a semantic operation.
READREAD file INTO dataWRITEWRITE content TO fileEXECUTEEXECUTE command WITH paramsCREATECREATE artifact FROM templateDELETEDELETE file_pathFINDFIND pattern IN scopeANALYZEANALYZE target FOR conditionVALIDATEVALIDATE state AGAINST schemaVERIFYVERIFY conditionEXTRACTEXTRACT data FROM sourceCOLLECTCOLLECT items INTO containerFILTERFILTER items WHERE conditionCOMPARECOMPARE a AGAINST bCONVERTCONVERT data TO formatMERGEMERGE sources INTO targetSPLITSPLIT data BY delimiterSORTSORT items BY criteriaRANKRANK items BY scoreLINKLINK source TO targetREPORTREPORT findingsADDADD item TO listAPPENDAPPEND value TO arrayINSERTINSERT item AT indexREMOVEREMOVE item FROM listMOVEMOVE file TO destinationCOPYCOPY file TO backupBACKUPBACKUP file TO locationRESTORERESTORE FROM backupLOADLOAD config FROM fileSENDSEND message TO recipientWAITWAIT FOR conditionATTEMPTATTEMPT operationFAILFAIL WITH messageEXITEXIT 1RETURNRETURN resultITERATEITERATE operationINVESTIGATEINVESTIGATE issueDETERMINEDETERMINE outcomeENFORCEENFORCE ruleEVIDENCEEVIDENCE claimPROPAGATEPROPAGATE updatesFINALIZEFINALIZE operationREDUCEREDUCE items TO valueRENAMERENAME file TO newnameORDERORDER items BY keyMARKMARK item AS completePREDICTPREDICT outcome FROM modelCLASSIFYCLASSIFY item BY typeEXPLAINEXPLAIN behaviorREFLECTREFLECT ON outcomeABSTRACTABSTRACT pattern FROM casesGENERALIZEGENERALIZE FROM examplesDESCRIBEDESCRIBE structureFORMALIZEFORMALIZE rule AS predicateControl flow keywordsA1.8
These keywords mirror the flow control constructs of programming languages.
IFIF condition: actionELSEELSE: alternativeFORFOR EACH item IN list:EACHFOR EACH x IN items:WHILEWHILE condition: actionTRYTRY: risky_opCATCHCATCH: handle_errorEXCEPTEXCEPT: recoveryFINALLYFINALLY: cleanupMATCHMATCH value:CASECASE pattern: actionDEFAULTDEFAULT: fallbackWHENWHEN event: actionUNLESSUNLESS condition: actionUNTILUNTIL doneGUARDGUARD cond ELSE: exitBREAKBREAKCONTINUECONTINUEGOTOGOTO labelSTARTSTART processENDENDSTOPSTOPLOOPLOOP BACKTO stepSTEPSTEP 1: actionRULERULE name: bodyINitem IN collectionMATCHESvalue MATCHES patternDeclaration keywordsA1.9
These keywords declare the variables and types that hold a document's state.
SETSET name = valueDECLAREDECLARE x: stringDEFINEDEFINE PI = 3.14LETLET temp = exprCONSTCONST MAX = 100Modifier keywordsA2.1
A modifier qualifies and strengthens a line inside a property. It never heads a block, because a block head states no set, no parties and no objector, and the invariant record carries all three.
MUSTMUST validate firstNEVERNEVER delete without backupALWAYSALWAYS log changesREQUIREDREQUIRED fieldMANDATORYMANDATORY checkCRITICALCRITICAL validationABSOLUTEABSOLUTE ruleFORBIDDENFORBIDDEN: direct DBCoordination keywordsA2.2
A shared surface makes this structure explicit. It consists of the surface, its records, each with exactly one writer, the addressed items inside them, the typed edges between records, the states derived from those edges, the reader classes, and the one operation that posts and waits. The waiting, locking and retry tokens describe the same model from one party's turn.
AWAITAWAIT op INTO resultPARALLELPARALLEL: tasks ENDDELEGATEDELEGATE task TO readerQUEUEQUEUE operationRETRYRETRY operationLOCKLOCK resourceUNLOCKUNLOCK resourceSURFACESURFACE <key>:RECORDRECORD <id> subject: <key>ITEMITEM <id> TO <reader>: <claim>PARENTPARENT <surface>SATISFIED_BYSATISFIED_BY <artifact>BLOCKSBLOCKS <record>ANSWERSANSWERS <record>REFUTESREFUTES <record>SUPERSEDESSUPERSEDES <record>OPENstate: OPENABSORBEDstate: ABSORBEDREADERREADER <party> AS participant | boundedBARRIERBARRIER ON <surface>SWAPSWAP <span> AGAINST <read>WAITWAIT ON <surface> AS <reader> INTO <diff>State machine keywordsA2.3
A state machine makes a lifetime explicit, meaning the states a thing can be in and the transitions that are legal between them. In a coordinated document a state is derived from the graph and never written, so the machine declares what may happen, not what has.
STATE_MACHINESTATE_MACHINE workflow:STATESTATE pending:TRANSITIONTRANSITION FROM a TO bONON approvalFROMFROM pendingTOTO approvedENTRYENTRY: notifyEXITEXIT: cleanupDAG keywordsA2.4
A dependency graph makes explicit what depends on what, as declared by the referent and never inferred from a name. The loop spine of a document is one such graph, and a repair edge is a back-edge on it.
DAGDAG pipeline:DEPENDS_ONDEPENDS_ON [a, b]AFTERAFTER compileBEFOREBEFORE deployPARALLEL_GROUPPARALLEL_GROUP: a, bNODENODE build:Priority queue keywordsA2.5
A priority queue makes a ranking explicit, with the candidates ordered by a declared worth. The branch ranking a worth gate emits is one, and a peek returns the selected branch.
PRIORITY_QUEUEPRIORITY_QUEUE branches:PRIORITYPRIORITY = 10ENQUEUEENQUEUE task TO qDEQUEUEDEQUEUE FROM qPEEKPEEK queueHEAPIFYHEAPIFY queueCOMPARE_BYCOMPARE_BY priorityFlowchart keywordsA2.6
A flowchart is the rendered projection of a declared structure. It shows a graph, a lifetime or a ranking to a reader, and it never carries a structure the document did not declare elsewhere.
FLOWCHARTFLOWCHART process:MERMAIDMERMAID flowchart:LAYOUTLAYOUT verticalSUBGRAPHSUBGRAPH auth:Document type keywordsA2.7
These keywords name the document type in a declaration of the form THIS {TYPE} {VERB} description.
AGENTTHIS AGENT PERFORMS...WORKFLOWTHIS WORKFLOW EXECUTES...PROTOCOLTHIS PROTOCOL DEFINES...POLICYTHIS POLICY ENFORCES...CHECKLISTTHIS CHECKLIST PROVIDES...TEMPLATETHIS TEMPLATE IMPLEMENTS...TASKTHIS TASK EXECUTES...INSTRUCTIONTHIS INSTRUCTION IS...PROMPTTHIS PROMPT IS...COMMANDTHIS COMMAND EXECUTES...TESTTHIS TEST PERFORMS...DEBUGTHIS DEBUG RESOLVES...VERIFICATIONTHIS VERIFICATION PERFORMS...DISTILLATIONTHIS DISTILLATION DISTILLS...AUDITTHIS AUDIT AUDITS...TRANSLATIONTHIS TRANSLATION AUDITS...COMPOSITIONTHIS COMPOSITION RENDERS...Document verbsA2.8
These verbs follow the type in a document declaration.
ISTHIS INSTRUCTION IS...ENFORCESTHIS POLICY ENFORCES...EXECUTESTHIS WORKFLOW EXECUTES...HASTHIS AGENT HAS...PERFORMSTHIS AGENT PERFORMS...PROVIDESTHIS CHECKLIST PROVIDES...IMPLEMENTSTHIS TEMPLATE IMPLEMENTS...DEFINESTHIS PROTOCOL DEFINES...MANAGESTHIS AGENT MANAGES...COORDINATESTHIS WORKFLOW COORDINATES...GENERATESTHIS TEMPLATE GENERATES...RESOLVESTHIS DEBUG RESOLVES...FINDSTHIS DEBUG FINDS...FIXESTHIS DEBUG FIXES...VERIFIESTHIS VERIFICATION VERIFIES...CLASSIFIESTHIS VERIFICATION CLASSIFIES...DISTILLSTHIS DISTILLATION DISTILLS...ABSTRACTSTHIS DISTILLATION ABSTRACTS...ELIMINATESTHIS DISTILLATION ELIMINATES...AUDITSTHIS AUDIT AUDITS...MEASURESTHIS AUDIT MEASURES...SCORESTHIS AUDIT SCORES...CORRECTSTHIS TRANSLATION CORRECTS...RENDERSTHIS COMPOSITION RENDERS...COMPOSESTHIS COMPOSITION COMPOSES...FOLDSTHIS COMPOSITION FOLDS...Contextual keywordsA2.9
These prepositions and connectors state the relation between the operands of a line.
INTOREAD file INTO dataWITHEXECUTE WITH paramsUSINGVALIDATE USING schemaASBIND result AS aliasBETWEENvalue BETWEEN 1 AND 10AGAINSTVALIDATE AGAINST schemaBASED_ONCREATE BASED_ON templateWITHOUTEXECUTE WITHOUT loggingWHEREFIND WHERE x > 0CONTENTWRITE CONTENT dataNOTNOT conditionSTYLESTYLE outputFORSEARCH FOR patternINFIND key IN objectFROMEXTRACT FROM responseTOWRITE TO fileAn adapter's aliasesA3.1
The aliases below belong to one adapter, and they are shown as an instance of a binding rather than as grammar. The grammar carries no tool name, so a document names the operation, and the binding for a harness maps its short forms to the operation and the operation to whichever tool performs it there. Another harness ships another table, and the document does not change.
READREAD "<file>" INTO <content>WRITEWRITE <content> TO <file>EDITEDIT <file> WITH before: "<span>", after: "<span>"GLOBGLOB "<pattern>" INTO <files>GREPGREP "<term>" IN <scope> INTO <matches>BASHBASH "<command>" WITH timeout: <bound>WEB_FETCHWEB_FETCH "<address>" INTO <content>WEB_SEARCHWEB_SEARCH "<query>" INTO <hits>TASKTASK "<objective>" WITH agent: <role> → <result>ASK_USERASK_USER "<question>" WITH options: [<a>, <b>]