Pattern Abstract Grammar

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.

READ
Input acquisitionREAD file INTO data
WRITE
Output generationWRITE content TO file
EXECUTE
Action invocationEXECUTE command WITH params
CREATE
ConstructionCREATE artifact FROM template
DELETE
RemovalDELETE file_path
FIND
DiscoveryFIND pattern IN scope
ANALYZE
InspectionANALYZE target FOR condition
VALIDATE
VerificationVALIDATE state AGAINST schema
VERIFY
ConfirmationVERIFY condition
EXTRACT
IsolationEXTRACT data FROM source
COLLECT
AggregationCOLLECT items INTO container
FILTER
SelectionFILTER items WHERE condition
COMPARE
ComparisonCOMPARE a AGAINST b
CONVERT
TransformationCONVERT data TO format
MERGE
CombinationMERGE sources INTO target
SPLIT
DivisionSPLIT data BY delimiter
SORT
OrderingSORT items BY criteria
RANK
PrioritizationRANK items BY score
LINK
AssociationLINK source TO target
REPORT
OutputREPORT findings
ADD
Add to collectionADD item TO list
APPEND
Append to endAPPEND value TO array
INSERT
Insert at positionINSERT item AT index
REMOVE
Remove from collectionREMOVE item FROM list
MOVE
RelocationMOVE file TO destination
COPY
DuplicationCOPY file TO backup
BACKUP
PreservationBACKUP file TO location
RESTORE
RecoveryRESTORE FROM backup
LOAD
Resource acquisitionLOAD config FROM file
SEND
CommunicationSEND message TO recipient
WAIT
Timing controlWAIT FOR condition
ATTEMPT
Trial operationATTEMPT operation
FAIL
Error terminationFAIL WITH message
EXIT
Exit executionEXIT 1
RETURN
Return valueRETURN result
ITERATE
RepetitionITERATE operation
INVESTIGATE
Deep analysisINVESTIGATE issue
DETERMINE
Decision makingDETERMINE outcome
ENFORCE
Constraint applicationENFORCE rule
EVIDENCE
Proof provisionEVIDENCE claim
PROPAGATE
Change distributionPROPAGATE updates
FINALIZE
CompletionFINALIZE operation
REDUCE
AggregationREDUCE items TO value
RENAME
Name modificationRENAME file TO newname
ORDER
ArrangementORDER items BY key
MARK
AnnotationMARK item AS complete

Control Flow Keywordsβ

Flow control structures that mirror programming constructs.

IF
Conditional executionIF condition: action
ELSE
Alternative branchELSE: alternative
FOR
Iteration startFOR EACH item IN list:
EACH
Iterator markerFOR EACH x IN items:
WHILE
Conditional loopWHILE condition: action
TRY
Exception handling startTRY: risky_op
CATCH
Exception handlerCATCH: handle_error
EXCEPT
Exception alternativeEXCEPT: recovery
FINALLY
Cleanup blockFINALLY: cleanup
MATCH
Pattern matchingMATCH value:
CASE
Match branchCASE pattern: action
DEFAULT
Fallback caseDEFAULT: fallback
WHEN
Event triggerWHEN event: action
UNLESS
Negated conditionalUNLESS condition: action
UNTIL
Loop terminatorUNTIL done
GUARD
Early exit checkGUARD cond ELSE: exit
BREAK
Exit loopBREAK
CONTINUE
Skip iterationCONTINUE
GOTO
Jump to labelGOTO label
START
Flow start markerSTART process
END
Flow end markerEND
STOP
TerminationSTOP
LOOP
Loop markerLOOP BACKTO step
STEP
Step markerSTEP 1: action
RULE
Rule definitionRULE name: body
IN
Containment testitem IN collection
MATCHES
Pattern testvalue MATCHES /regex/

Declaration Keywordsγ

Variable and type declarations for state management.

SET
Variable assignmentSET name = value
DECLARE
Typed declarationDECLARE x: string
DEFINE
Constant definitionDEFINE PI = 3.14
LET
Local bindingLET temp = expr
CONST
Immutable valueCONST MAX = 100

Modifier Keywordsδ

Constraint qualifiers that express behavioral expectations.

MUST
Mandatory requirementMUST validate first
NEVER
ProhibitionNEVER delete without backup
ALWAYS
Invariant ruleALWAYS log changes
REQUIRED
Necessity markerREQUIRED field
MANDATORY
Obligation markerMANDATORY check
CRITICAL
High priorityCRITICAL validation
ABSOLUTE
No exceptionsABSOLUTE rule
FORBIDDEN
Absolute prohibitionFORBIDDEN: direct DB

Coordination Keywordsε

Keywords for concurrent and asynchronous operations.

AWAIT
Async waitAWAIT op INTO result
PARALLEL
Concurrent executionPARALLEL: tasks END
DELEGATE
Task handoffDELEGATE task TO agent
QUEUE
Task queuingQUEUE operation
RETRY
Retry on failureRETRY operation
LOCK
Resource lockLOCK resource
UNLOCK
Release lockUNLOCK resource

State Machine Keywordsζ

Keywords for declarative state machine definitions.

STATE_MACHINE
Machine declarationSTATE_MACHINE workflow:
STATE
State definitionSTATE pending:
TRANSITION
State change ruleTRANSITION FROM a TO b
ON
Event triggerON approval
FROM
Source stateFROM pending
TO
Target stateTO approved
ENTRY
Entry actionENTRY: notify
EXIT
Exit actionEXIT: cleanup

DAG Keywordsη

Keywords for Directed Acyclic Graph task orchestration.

DAG
Graph declarationDAG pipeline:
NODE
Node definitionNODE build:
DEPENDS_ON
DependenciesDEPENDS_ON [a, b]
AFTER
SequencingAFTER compile
BEFORE
Reverse sequencingBEFORE deploy
PARALLEL_GROUP
Parallel nodesPARALLEL_GROUP: a, b

Priority Queue Keywordsθ

Keywords for priority-based task scheduling.

PRIORITY_QUEUE
Queue declarationPRIORITY_QUEUE tasks:
PRIORITY
Priority valuePRIORITY = 10
ENQUEUE
Add to queueENQUEUE task TO q
DEQUEUE
Remove from queueDEQUEUE FROM q
PEEK
View top itemPEEK queue
HEAPIFY
Reorder queueHEAPIFY queue
COMPARE_BY
Comparison functionCOMPARE_BY priority

Flowchart Keywordsι

Keywords for visual flow definitions.

FLOWCHART
Flow declarationFLOWCHART process:
MERMAID
Mermaid syntaxMERMAID flowchart:
LAYOUT
Flow directionLAYOUT vertical
SUBGRAPH
Nested groupSUBGRAPH auth:

Document Type Keywordsκ

Keywords that define the document type in declarations (THIS {TYPE} {VERB} description).

AGENT
AI agent definitionTHIS AGENT PERFORMS...
WORKFLOW
Multi-phase processTHIS WORKFLOW EXECUTES...
PROTOCOL
Standard proceduresTHIS PROTOCOL DEFINES...
POLICY
Constraint systemTHIS POLICY ENFORCES...
CHECKLIST
Task trackingTHIS CHECKLIST PROVIDES...
TEMPLATE
Reusable patternTHIS TEMPLATE IMPLEMENTS...
TASK
Single objectiveTHIS TASK EXECUTES...
INSTRUCTION
General guidanceTHIS INSTRUCTION IS...
PROMPT
LLM interactionTHIS PROMPT IS...
COMMAND
Executable commandTHIS COMMAND EXECUTES...
TEST
Test specificationTHIS TEST PERFORMS...

Document Verbsλ

Verbs used in document declarations.

IS
IdentityTHIS INSTRUCTION IS...
ENFORCES
ConstraintTHIS POLICY ENFORCES...
EXECUTES
ActionTHIS WORKFLOW EXECUTES...
HAS
PossessionTHIS AGENT HAS...
PERFORMS
BehaviorTHIS AGENT PERFORMS...
PROVIDES
OfferingTHIS CHECKLIST PROVIDES...
IMPLEMENTS
RealizationTHIS TEMPLATE IMPLEMENTS...
DEFINES
SpecificationTHIS PROTOCOL DEFINES...
MANAGES
ControlTHIS AGENT MANAGES...
COORDINATES
OrchestrationTHIS WORKFLOW COORDINATES...
GENERATES
CreationTHIS TEMPLATE GENERATES...

Meta Keywordsμ

Keywords for metadata and template operations.

META
Metadata block%% META %%:
USE
Template usageUSE TEMPLATE name
TEMPLATE
Template referenceUSE TEMPLATE validation
CUE
Context cueCUE color: "red"
MAX_DEPTH
Recursion limitMAX_DEPTH = 5

Validation Keywordsν

Keywords for validation gates and assertions.

ASSERT
Hard assertionASSERT condition
REQUIRE
Prerequisite checkREQUIRE dependency
VALIDATION
Gate markerVALIDATION GATE:
GATE
Checkpoint markerVALIDATION GATE:

Contextual Keywordsξ

Prepositions and connectors that establish relationships.

INTO
DestinationREAD file INTO data
FROM
SourceEXTRACT FROM response
WITH
AssociationEXECUTE WITH params
USING
InstrumentVALIDATE USING schema
FOR
Purpose/IterationSEARCH FOR pattern
IN
ContainmentFIND key IN object
TO
TargetWRITE TO file
AS
Alias/RoleBIND result AS alias
BETWEEN
Rangevalue BETWEEN 1 AND 10
AGAINST
Comparison targetVALIDATE AGAINST schema
BASED_ON
FoundationCREATE BASED_ON template
WITHOUT
ExclusionEXECUTE WITHOUT logging
WHERE
Filter conditionFIND WHERE x > 0
CONTENT
Data markerWRITE CONTENT data
NOT
NegationNOT condition
STYLE
FormattingSTYLE output

AI Tool Keywordsο

Keywords for invoking AI agent tools.

READ
File readingREAD "config.json"
WRITE
File writingWRITE content TO file
EDIT
File modificationEDIT file old new
GLOB
Pattern matchingGLOB "**/*.js"
GREP
Content searchGREP "pattern" IN path
BASH
Shell executionBASH "npm test"
BASH_OUTPUT
Shell outputBASH_OUTPUT bash_id
KILL_SHELL
Shell terminationKILL_SHELL shell_id
WEB_FETCH
URL retrievalWEB_FETCH url prompt
WEB_SEARCH
Web searchWEB_SEARCH "query"
TASK
Agent spawningTASK prompt type
TODO_WRITE
Task managementTODO_WRITE todos
ASK_USER
User interactionASK_USER questions
NOTEBOOK_EDIT
Jupyter editingNOTEBOOK_EDIT path cell
SKILL
Skill invocationSKILL "pdf"
SLASH_COMMAND
Command executionSLASH_COMMAND "/cmd"
MCP_EXECUTE
MCP tool executionMCP_EXECUTE tool params

AI Tool Parametersπ

Common parameter names for tool invocations.

FILE_PATH
Path to filefile_path: "src/main.js"
PATTERN
Search patternpattern: "**/*.ts"
COMMAND
Shell commandcommand: "npm run build"
QUERY
Search queryquery: "PAG grammar"
URL
Target URLurl: "https://..."
PROMPT
Processing promptprompt: "Extract..."
TIMEOUT
Max execution timetimeout: 30000
DESCRIPTION
Command descriptiondescription: "Build"
OLD_STRING
Text to replaceold_string: "foo"
NEW_STRING
Replacement textnew_string: "bar"
CONTENT
File contentcontent: "data..."
CELL_ID
Jupyter cell IDcell_id: "abc123"
NOTEBOOK_PATH
Notebook file pathnotebook_path: "nb.ipynb"
SUBAGENT_TYPE
Agent type to spawnsubagent_type: "Explore"