
Pattern Abstract Grammar
Structured Instructions for AI Systems
Keyword Ontology
PAG keywords are organized into semantic categories that reflect their function in instructions. All keywords are uppercase to leverage token patterns common in code training data. Hover over keywords for details.
Action Keywordsα
Primary verbs that initiate operations. These appear frequently in code, which may influence model completion patterns.
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 completeControl Flow Keywordsβ
Flow control structures that mirror programming constructs.
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 /regex/Declaration Keywordsγ
Variable and type declarations for state management.
SETSET name = valueDECLAREDECLARE x: stringDEFINEDEFINE PI = 3.14LETLET temp = exprCONSTCONST MAX = 100Modifier Keywordsδ
Constraint qualifiers that express behavioral expectations.
MUSTMUST validate firstNEVERNEVER delete without backupALWAYSALWAYS log changesREQUIREDREQUIRED fieldMANDATORYMANDATORY checkCRITICALCRITICAL validationABSOLUTEABSOLUTE ruleFORBIDDENFORBIDDEN: direct DBCoordination Keywordsε
Keywords for concurrent and asynchronous operations.
AWAITAWAIT op INTO resultPARALLELPARALLEL: tasks ENDDELEGATEDELEGATE task TO agentQUEUEQUEUE operationRETRYRETRY operationLOCKLOCK resourceUNLOCKUNLOCK resourceState Machine Keywordsζ
Keywords for declarative state machine definitions.
STATE_MACHINESTATE_MACHINE workflow:STATESTATE pending:TRANSITIONTRANSITION FROM a TO bONON approvalFROMFROM pendingTOTO approvedENTRYENTRY: notifyEXITEXIT: cleanupDAG Keywordsη
Keywords for Directed Acyclic Graph task orchestration.
DAGDAG pipeline:NODENODE build:DEPENDS_ONDEPENDS_ON [a, b]AFTERAFTER compileBEFOREBEFORE deployPARALLEL_GROUPPARALLEL_GROUP: a, bPriority Queue Keywordsθ
Keywords for priority-based task scheduling.
PRIORITY_QUEUEPRIORITY_QUEUE tasks:PRIORITYPRIORITY = 10ENQUEUEENQUEUE task TO qDEQUEUEDEQUEUE FROM qPEEKPEEK queueHEAPIFYHEAPIFY queueCOMPARE_BYCOMPARE_BY priorityFlowchart Keywordsι
Keywords for visual flow definitions.
FLOWCHARTFLOWCHART process:MERMAIDMERMAID flowchart:LAYOUTLAYOUT verticalSUBGRAPHSUBGRAPH auth:Document Type Keywordsκ
Keywords that define the document type in declarations (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...Document Verbsλ
Verbs used in document declarations.
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...Meta Keywordsμ
Keywords for metadata and template operations.
META%% META %%:USEUSE TEMPLATE nameTEMPLATEUSE TEMPLATE validationCUECUE color: "red"MAX_DEPTHMAX_DEPTH = 5Validation Keywordsν
Keywords for validation gates and assertions.
ASSERTASSERT conditionREQUIREREQUIRE dependencyVALIDATIONVALIDATION GATE:GATEVALIDATION GATE:Contextual Keywordsξ
Prepositions and connectors that establish relationships.
INTOREAD file INTO dataFROMEXTRACT FROM responseWITHEXECUTE WITH paramsUSINGVALIDATE USING schemaFORSEARCH FOR patternINFIND key IN objectTOWRITE TO fileASBIND result AS aliasBETWEENvalue BETWEEN 1 AND 10AGAINSTVALIDATE AGAINST schemaBASED_ONCREATE BASED_ON templateWITHOUTEXECUTE WITHOUT loggingWHEREFIND WHERE x > 0CONTENTWRITE CONTENT dataNOTNOT conditionSTYLESTYLE outputAI Tool Keywordsο
Keywords for invoking AI agent tools.
READREAD "config.json"WRITEWRITE content TO fileEDITEDIT file old newGLOBGLOB "**/*.js"GREPGREP "pattern" IN pathBASHBASH "npm test"BASH_OUTPUTBASH_OUTPUT bash_idKILL_SHELLKILL_SHELL shell_idWEB_FETCHWEB_FETCH url promptWEB_SEARCHWEB_SEARCH "query"TASKTASK prompt typeTODO_WRITETODO_WRITE todosASK_USERASK_USER questionsNOTEBOOK_EDITNOTEBOOK_EDIT path cellSKILLSKILL "pdf"SLASH_COMMANDSLASH_COMMAND "/cmd"MCP_EXECUTEMCP_EXECUTE tool paramsAI Tool Parametersπ
Common parameter names for tool invocations.
FILE_PATHfile_path: "src/main.js"PATTERNpattern: "**/*.ts"COMMANDcommand: "npm run build"QUERYquery: "PAG grammar"URLurl: "https://..."PROMPTprompt: "Extract..."TIMEOUTtimeout: 30000DESCRIPTIONdescription: "Build"OLD_STRINGold_string: "foo"NEW_STRINGnew_string: "bar"CONTENTcontent: "data..."CELL_IDcell_id: "abc123"NOTEBOOK_PATHnotebook_path: "nb.ipynb"SUBAGENT_TYPEsubagent_type: "Explore"