
Pattern Abstract Grammar
Structured Instructions for AI Systems
Instruction Patterns
PAG instructions follow consistent patterns that define how keywords relate to their operands.
Keyword Semanticsα
Each keyword carries specific semantic meaning:
| Category | Keyword | Semantic | Preposition |
|---|---|---|---|
Input | READ | Non-destructive source read | FROM |
Input | EXTRACT | Preserves source integrity | INTO |
Pattern | FIND | Boolean existence check | IN |
Pattern | ANALYZE | Deep examination against reference | AGAINST |
Output | CREATE | Artifact generation | FROM/USING |
Output | WRITE | Idempotent entry creation | TO |
Narrowing | FILTER | Removes non-matching items | TO |
Control | SET | State assignment | = |
Control | EXECUTE | Action invocation | ON/WITH |
Preposition Slotsβ
Prepositions establish relationships between keywords and operands:
| Preposition | Relationship | Example |
|---|---|---|
FROM | Input origin | READ data FROM source |
IN | Location/container | FIND pattern IN scope |
INTO | Destination container | EXTRACT fields INTO struct |
TO | Intended destination | WRITE output TO file |
USING | Process mechanism | CREATE doc USING template |
AGAINST | Evaluation reference | VALIDATE data AGAINST schema |
FOR | Objective/purpose | SEARCH FOR pattern |
ON | Target system | EXECUTE command ON server |
WITH | Parameter specification | EXECUTE task WITH config |
Input Patternsγ
Patterns for acquiring data from sources:
Input PatternsREAD file FROM path INTO variable LOAD config FROM "settings.json" EXTRACT fields FROM response INTO data WEB_FETCH resource FROM url INTO response
READ— non-destructive read, source unchangedLOAD— resource acquisition with parsingEXTRACT— selective field isolationWEB_FETCH— remote resource retrieval
Output Patternsδ
Patterns for producing results:
Output PatternsWRITE content TO file CREATE report FROM data USING template APPEND item TO collection REPORT status_message
WRITE— idempotent file creation/updateCREATE— artifact generation from templateAPPEND— add to existing collectionREPORT— output status or findings
Transform Patternsε
Patterns for data transformation:
Transform PatternsCONVERT data TO format FILTER items TO filtered_items WHERE condition MERGE sources INTO target SPLIT data BY delimiter INTO segments
CONVERT— format changeFILTER— selective retention with WHERE clauseMERGE— combine multiple sourcesSPLIT— divide into parts
Validation Patternsζ
Patterns for verification and validation:
Validation PatternsVALIDATE data AGAINST schema VERIFY condition VALIDATION GATE: ✅ condition_1 met ✅ condition_2 met ANALYZE state FOR errors INTO error_list COMPARE actual AGAINST expected INTO diff_result
VALIDATE— schema conformance checkVERIFY— boolean condition checkVALIDATION GATE— checkpoint verification blockANALYZE— inspection for specific conditionCOMPARE— difference detection
Search Patternsη
Patterns for finding and discovering:
Search PatternsFIND pattern IN scope INTO found_items GLOB "**/*.js" INTO file_list GREP "pattern" IN path INTO matches WEB_SEARCH query INTO search_results
FIND— boolean existence checkGLOB— file pattern matchingGREP— content pattern searchWEB_SEARCH— external search query
Control Patternsθ
Patterns for execution control:
Control PatternsEXECUTE command WITH params EXECUTE Task(subagent_type = agent_name, prompt = task_description) DELEGATE task TO agent SEND message TO recipient AWAIT response INTO result
EXECUTE— run with parametersEXECUTE Task— invoke subagent with parametersDELEGATE— hand off to another agentSEND— communication to recipientAWAIT— wait for async result
Intent Patterns
PAG uses algorithmic patterns to map natural language intent to structured phases. Understanding these patterns helps you write more effective documents.
Pattern Typesι
Each pattern type maps trigger phrases to VERB chain templates:
| Pattern | Triggers | VERB Chain | Use Case |
|---|---|---|---|
Cognitive | learn, understand, analyze | FILTER→READ→FIND→LINK→CREATE→ANALYZE→WRITE | Pattern detection |
Decision | choose, select, pick | CREATE→FILTER→FIND→FILTER→EXECUTE | Option selection |
Construction | build, create, generate | EXTRACT→READ→CREATE→FIND→WRITE→ANALYZE | Artifact creation |
Hypothesis | debug, investigate, find cause | CREATE→RANK→ATTEMPT→ANALYZE→EXECUTE | Debugging |
Perceptual | monitor, observe, detect | FIND→ANALYZE→EXECUTE→FIND | State observation |
Adaptive | adjust, tune, optimize | READ→ANALYZE→EXECUTE→WRITE | Behavior modification |
Cognitive Pattern Exampleκ
For analyzing codebase patterns:
Cognitive Pattern ExampleIntent: "Analyze codebase for duplicated logic and create report" Pattern matched: Cognitive (trigger: "analyze") # PHASE 1: Filter Scope FILTER codebase TO target_files # PHASE 2: Read Content FOR EACH file IN target_files: READ content FROM file # PHASE 3: Find Patterns FIND duplicated_logic IN content # PHASE 4: Link Context LINK patterns TO source_locations # PHASE 5: Create Report CREATE report FROM linked_patterns # PHASE 6: Analyze Quality ANALYZE report AGAINST quality_threshold # PHASE 7: Write Output WRITE report TO output
- Trigger word "analyze" suggests the Cognitive pattern
FILTERnarrows scope before reading — avoids processing irrelevant filesLINKconnects findings to source locations for traceabilityANALYZEphase validates output quality before writing- Seven phases follow the VERB chain: FILTER→READ→FIND→LINK→CREATE→ANALYZE→WRITE
Decision Pattern Exampleλ
For selecting between options:
Decision Pattern ExampleIntent: "Choose the best database for our requirements" Pattern matched: Decision (trigger: "choose") # PHASE 1: Create Options CREATE candidate_list FROM available_databases # PHASE 2: Filter Requirements FILTER candidate_list BY must_have_requirements # PHASE 3: Find Matches FIND matching_databases IN filtered_candidates # PHASE 4: Filter Ranking FILTER matches BY performance_criteria INTO ranked_options # PHASE 5: Execute Selection EXECUTE selection_decision WITH ranked_options
- Trigger word "choose" suggests the Decision pattern
CREATEgenerates initial candidate list from available options- Two
FILTERpasses — first by requirements, then by ranking criteria FINDidentifies which candidates survive filteringEXECUTEmakes the final selection from ranked options
Hypothesis Pattern Exampleμ
For debugging and investigation:
Hypothesis Pattern ExampleIntent: "Debug the authentication failure" Pattern matched: Hypothesis (trigger: "debug") # PHASE 1: Create Hypotheses CREATE hypothesis_list FROM error_symptoms SET hypothesis_list[0] = "Token expired" SET hypothesis_list[1] = "Invalid credentials" SET hypothesis_list[2] = "Network timeout" # PHASE 2: Rank Likelihood RANK hypothesis_list BY evidence_strength # PHASE 3: Attempt Verification FOR EACH hypothesis IN ranked_hypotheses: ATTEMPT verify_hypothesis WITH test_case # PHASE 4: Analyze Results ANALYZE verification_results AGAINST expected_outcomes # PHASE 5: Execute Fix EXECUTE remediation FOR confirmed_hypothesis
- Trigger word "debug" suggests the Hypothesis pattern
CREATEgenerates multiple hypotheses from observed symptomsRANKorders hypotheses by likelihood based on evidenceATTEMPTtests each hypothesis — fails fast, moves to nextEXECUTEapplies fix only after hypothesis is confirmed
Construction Pattern Exampleν
For building artifacts:
Construction Pattern ExampleIntent: "Generate API documentation from source code" Pattern matched: Construction (trigger: "generate") # PHASE 1: Extract Sources EXTRACT source_files FROM codebase WHERE api_endpoints # PHASE 2: Read Definitions FOR EACH file IN source_files: READ endpoint_definitions FROM file # PHASE 3: Create Structure CREATE documentation_structure FROM endpoint_definitions # PHASE 4: Find Examples FIND usage_examples IN test_files # PHASE 5: Write Documentation WRITE documentation TO output_path # PHASE 6: Analyze Completeness ANALYZE documentation AGAINST coverage_threshold
- Trigger word "generate" suggests the Construction pattern
EXTRACTpulls relevant sources from broader codebaseCREATEbuilds output structure from extracted definitionsFINDlocates supplementary content (examples) to enrich outputANALYZEvalidates completeness before finalizing
Choosing the Right Patternξ
Algorithm Loop Classes
PAG algorithms follow seven fundamental loop patterns. Each loop class defines a characteristic verb chain that maps to specific problem domains.
Loop Classification & Analysis Loopsο
Algorithm loops are classified by their primary operational category. Analysis loops (Perceptual, Cognitive) focus on understanding and pattern detection:
Loop Classification & Analysis Loops# PERCEPTUAL LOOPS - React to signals in input streams [Signal-Analysis-Loop] FIND<Signal> → ANALYZE<Signal> → EXTRACT<Analysis> → WRITE<Response> → SET<State> → ITERATE<Cycle> [Reactive-Execution-Loop] FIND<Trigger> → EXTRACT<Context> → CREATE<Response> → EXECUTE<Tools> → ANALYZE<Results> → ITERATE<Cycle> [Deep-Focus-Loop] FIND<Target> → FILTER<Distractions> → ANALYZE<Target> → CREATE<Insights> → ITERATE<Cycle> # COGNITIVE LOOPS - Process information to build understanding [Knowledge-Construction-Loop] FILTER<Domain> → READ<Information> → FIND<Patterns> → LINK<Elements> → CREATE<Representations> → WRITE<Structures> [Domain-Investigation-Loop] READ<Domain> → FIND<Patterns> → ANALYZE<Patterns> → CREATE<Hypotheses> → ANALYZE<Hypotheses> → WRITE<Findings> [Source-To-Sink-Tracing-Loop] READ<Source> → FIND<Data-Flow> → INVESTIGATE<Path> → ANALYZE<Transformations> → WRITE<Trace>
- Perceptual — use when monitoring, observing, or detecting state changes
- Cognitive — use when analyzing patterns, discovering relationships, or constructing knowledge
- Signal-Analysis — continuous monitoring with state updates
- Knowledge-Construction — builds structured representations from raw data
| Class | Characteristics | Verb Chain Pattern |
|---|---|---|
Perceptual | Signal detection, analysis, response | FIND → ANALYZE → WRITE/CREATE |
Cognitive | Information processing, understanding, integration | READ → FIND → LINK → CREATE |
Decision | Option generation, evaluation, selection, execution | CREATE → FIND → FILTER → EXECUTE |
Construction | Component assembly, validation, storage | EXTRACT → CREATE → ANALYZE → WRITE |
Adaptive | Environment sensing, strategy adjustment, iteration | READ → ANALYZE → EXECUTE → ITERATE |
Meta | Self-monitoring, strategy refinement, optimization | FIND → ANALYZE → EXECUTE → ITERATE |
Hypothesis | Hypothesis generation, constraint testing, refinement | CREATE → ANALYZE → ANALYZE → EXECUTE |
Decision & Construction Loopsπ
Decision loops evaluate options and select actions. Construction loops build artifacts from specifications:
Decision & Construction Loops# DECISION LOOPS - Evaluate options and select actions [Option-Selection-Loop] CREATE<Options> → FILTER<Options> → FIND<Criteria> → FILTER<By-Criteria> → EXECUTE<Selection> [Problem-Solving-Chain] READ<Problem> → ANALYZE<Requirements> → CREATE<Solutions> → ANALYZE<Solutions> → FILTER<Feasible> → EXECUTE<Best-Solution> [Severity-Hierarchical-Prioritization-Loop] MARK<Severity> → COLLECT<By-Severity> → SET<Priority> → CREATE<Dependency-Graph> → DETERMINE<Execution-Order> # CONSTRUCTION LOOPS - Build artifacts from specifications [Artifact-Generation-Loop] READ<Specifications> → EXTRACT<Requirements> → CREATE<Artifact> → ANALYZE<Artifact> → WRITE<Artifact> [Multi-Artifact-Generation-Loop] READ<Meta-Specification> → EXTRACT<Artifact-Types> → CREATE<Artifacts> → FIND<Dependencies> → CREATE<Dependency-Graph> → WRITE<Artifacts> [Template-Instantiation-With-Calculated-Metrics-Loop] READ<Template> → READ<Data> → DETERMINE<Metrics> → CREATE<Template-Parameters> → EXECUTE<Template-Instantiation> → WRITE<Instantiated-Artifact>
- Decision — use when choosing between alternatives, prioritizing work, or routing execution
- Construction — use when generating documents, creating structures, or assembling components
- Option-Selection — constraint-based filtering to single choice
- Artifact-Generation — specification-driven single artifact creation
- Multi-Artifact — batch creation with dependency tracking
Meta, Adaptive & Hypothesis Loopsρ
Meta loops monitor and refine execution strategy. Adaptive and Hypothesis loops handle uncertainty and environmental change:
Meta, Adaptive & Hypothesis Loops# META LOOPS - Monitor and refine execution strategy [Strategy-Refinement-Loop] FIND<Failure> → ANALYZE<Root-Cause> → CREATE<Alternatives> → ANALYZE<Alternatives> → SET<Strategy> → EXECUTE<Strategy> [Multi-Agent-Orchestration-Loop] READ<Task> → EXTRACT<Subtasks> → CREATE<Agent-Assignments> → EXECUTE<Agents> → ANALYZE<Outputs> → COLLECT<Results> [Two-Phase-Detection-Correction-Loop] EXECUTE<Detection-Phase> → ANALYZE<Detection-Results> → CREATE<Correction-Plan> → EXECUTE<Correction-Phase> → ANALYZE<Corrections> # ADAPTIVE & HYPOTHESIS LOOPS - Handle uncertainty [Investigate-Action-Loop] FIND<Uncertainty> → ANALYZE<Context> → CREATE<Investigation-Plan> → EXECUTE<Investigation> → ANALYZE<Findings> → WRITE<Knowledge> [Parallel-Hypothesis-Tracking-With-Conditional-Pivot-Loop] CREATE<Multiple-Hypotheses> → RANK<By-Confidence> → ATTEMPT<Top-Hypothesis> → ANALYZE<Failure> → EXECUTE<Pivot-Or-Return> [Self-Calibration-Testing-Loop] CREATE<Test-Cases> → EXECUTE<Tests-On-Self> → ANALYZE<Test-Results> → FIND<Calibration-Drift> → SET<Self-Parameters>
- Meta — use for self-correction, orchestrating agents, or enforcing constraints
- Adaptive — use when tuning behavior based on environment feedback
- Hypothesis — use when debugging, investigating, or testing theories
- Strategy-Refinement — failure-driven strategy adaptation
- Parallel-Hypothesis — ranked hypothesis testing with pivot on failure
Algorithm Examples
Concrete algorithm implementations showing how loop classes translate to executable PAG phases. Each example includes the full verb chain with preposition slots.
Analysis Examples: Cognitive & Decisionσ
Cognitive loops process information to build understanding. Decision loops evaluate and select from options:
Analysis Examples: Cognitive & Decision# COGNITIVE: Code-AST-Analysis-Data-Extraction-Loop # Extracts structural information from source code using AST parsing GLOB<Code-Files> → READ<Code-Content> → ANALYZE<AST> → EXTRACT<Symbols> → SET<Analysis-Entry> → WRITE<Analysis> # PHASE 1: Locate Sources GLOB file_pattern IN workspace_root COLLECT code_files # PHASE 2: Read & Parse FOR EACH code_file IN code_files: READ code_file INTO code_content ANALYZE code_content INTO ast USING parser # PHASE 3: Extract & Build EXTRACT exported_symbols FROM ast EXTRACT imported_symbols FROM ast SET analysis_entry.file = code_file SET analysis_entry.exports = exported_symbols # PHASE 4: Write Output APPEND analysis_entry TO ast_analysis WRITE ast_analysis TO analysis_output_path AS json VALIDATION GATE: ✅ All files processed ✅ AST parse successful ✅ Output written --- # DECISION: Pattern-Based-Risk-Classification-Loop # Classifies patterns by risk level and generates recommendations FIND<Patterns> → ANALYZE<Risk-Indicators> → DETERMINE<Risk-Score> → MARK<Risk-Level> → CREATE<Recommendations> # PHASE 1: Detect & Analyze FIND patterns IN target_source USING pattern_detection FOR EACH pattern IN patterns: ANALYZE pattern FOR risk_indicators EXTRACT severity, likelihood, impact FROM risk_indicators # PHASE 2: Score & Classify DETERMINE risk_score FROM indicators BASED_ON risk_formula MARK risk_level BASED_ON risk_score: IF risk_score >= 0.8: SET risk_level = "critical" IF risk_score >= 0.5: SET risk_level = "high" ELSE: SET risk_level = "medium/low" # PHASE 3: Generate Output CREATE recommendations FROM risk_classification WRITE risk_report TO output_path VALIDATION GATE: ✅ All patterns classified ✅ Risk scores in valid range [0, 1] ✅ Recommendations generated
- Cognitive characteristic: input → understand → structure → output
- Decision characteristic: input → score → classify → act
GLOB/FINDestablishes input setANALYZEdecomposes or examinesDETERMINE/MARKapplies scoring and classification
Build Examples: Construction & Metaτ
Construction loops generate artifacts from specifications. Meta loops monitor and refine execution strategy:
Build Examples: Construction & Meta# CONSTRUCTION: Multi-Artifact-Generation-Loop # Generates multiple artifacts with dependency tracking READ<Meta-Specification> → EXTRACT<Artifact-Types> → CREATE<Artifacts> → FIND<Dependencies> → WRITE<Artifacts> # PHASE 1: Load & Extract READ meta_specification FROM input_path EXTRACT artifact_type_list FROM meta_specification SET artifact_types = ["schema", "validator", "documentation", "tests"] # PHASE 2: Generate with Validation FOR EACH artifact_type IN artifact_types: CREATE artifact FROM meta_specification USING generation_rules[artifact_type] ANALYZE artifact AGAINST type_specification VALIDATION GATE: ✅ Artifact conforms to type schema # PHASE 3: Dependency Analysis FIND dependencies BETWEEN artifacts FOR EACH artifact_a, artifact_b IN artifacts: IF artifact_a.outputs INTERSECTS artifact_b.inputs: APPEND (artifact_a, artifact_b) TO dependency_edges CREATE dependency_graph FROM dependency_edges ANALYZE dependency_graph FOR cycles # PHASE 4: Write Output WRITE artifacts TO artifact_repository WRITE dependency_graph TO graph_output_path VALIDATION GATE: ✅ All artifact types generated ✅ No circular dependencies --- # META: Strategy-Refinement-Loop # Self-corrects strategy when failures are detected FIND<Failure> → ANALYZE<Root-Cause> → CREATE<Alternatives> → SET<Strategy> → EXECUTE<Strategy> # PHASE 1: Detect Failure FIND failure_pattern IN execution_results IF NOT failure_detected: STOP # PHASE 2: Root Cause Analysis ANALYZE failure_context FOR causal_factors EXTRACT primary_cause FROM causal_factors SET root_cause_report = { primary: primary_cause, severity: failure_severity } # PHASE 3: Generate & Evaluate Alternatives CREATE alternative_strategies FROM root_cause_report FOR EACH alternative IN alternatives: ANALYZE alternative AGAINST constraints DETERMINE feasibility_score FROM constraint_satisfaction RANK alternatives BY feasibility_score DESC # PHASE 4: Update & Execute SET current_strategy = alternatives[0] WRITE strategy_change_log TO audit_trail EXECUTE current_strategy ON target IF NOT success: ITERATE Strategy-Refinement-Loop VALIDATION GATE: ✅ Root cause identified ✅ Viable alternative generated ✅ Strategy update logged
- Construction characteristic: spec → components → assemble → validate → write
- Meta characteristic: observe → diagnose → adapt → re-execute
CREATE USINGapplies generation rulesFIND BETWEENdetects relationshipsSET/EXECUTEupdates and applies strategy
Uncertainty Examples: Hypothesis & Perceptualυ
Hypothesis loops test multiple theories with confidence-based pivoting. Perceptual loops react to signals with state-based response:
Uncertainty Examples: Hypothesis & Perceptual# HYPOTHESIS: Parallel-Hypothesis-Tracking-With-Conditional-Pivot-Loop # Tests multiple hypotheses with confidence-based pivot CREATE<Multiple-Hypotheses> → RANK<By-Confidence> → ATTEMPT<Top-Hypothesis> → ANALYZE<Failure> → EXECUTE<Pivot-Or-Return> # PHASE 1: Generate & Rank CREATE n_hypotheses FROM evidence FOR EACH symptom IN observed_symptoms: CREATE hypothesis THAT EXPLAINS symptom DETERMINE confidence_score FROM evidence_strength SET hypothesis.confidence = confidence_score RANK hypotheses BY confidence DESC SET H1 = hypotheses[0], H2 = hypotheses[1] SET secondary_threshold = 0.6 # PHASE 2: Test Top Hypothesis ATTEMPT fix_for_H1 EXECUTE minimal_change FOR H1.remediation ANALYZE outcome AGAINST expected_resolution IF H1_fix_succeeded: REPORT "H1 confirmed" AND STOP # PHASE 3: Pivot or Return IF H1_fix_failed: ANALYZE failure_mode FOR new_evidence COMPARE H2.confidence AGAINST secondary_threshold IF H2.confidence >= threshold: ATTEMPT fix_for_H2 ELSE: RETURN TO investigation_phase WITH updated_evidence VALIDATION GATE: ✅ At least 2 hypotheses generated ✅ Confidence scores assigned ✅ Resolution achieved OR investigation restarted --- # PERCEPTUAL: Signal-Analysis-Loop # Continuous monitoring with state-based response FIND<Signal> → ANALYZE<Signal> → EXTRACT<Analysis> → WRITE<Response> → SET<State> → ITERATE<Cycle> # PHASE 1: Detect Signal FIND signal_pattern IN input_stream IF NOT signal_detected: ITERATE ON next_input # PHASE 2: Analyze & Extract ANALYZE detected_signal USING processing_operations DETERMINE signal_type FROM signal BASED_ON signal_taxonomy DETERMINE signal_strength FROM signal.amplitude EXTRACT signal_content INTO analysis_output SET analysis = { type: signal_type, strength: signal_strength, timestamp: current_time } # PHASE 3: Respond & Update State CREATE system_response FROM analysis USING response_rules WRITE system_response INTO context SET state USING transformation_mechanism IF signal_strength > alert_threshold: SET state.alert_level = "elevated" # PHASE 4: Iterate ITERATE Signal-Analysis-Loop ON next_signal VALIDATION GATE: ✅ Signal processed within latency threshold ✅ State updated consistently ✅ Response generated for significant signals
- Hypothesis characteristic: generate → rank → test → pivot/confirm
- Perceptual characteristic: detect → process → respond → update → repeat
RANK BYorders by confidenceATTEMPTtests hypothesis experimentallyFIND INdetects patterns in streamSET USINGupdates state machine
Algorithm Integration
Protocols for integrating existing algorithms into PAG documents and creating new algorithms from cross-domain patterns.
Integration Protocol & Exampleφ
Four-step process for instantiating algorithms in PAG documents, with a concrete example:
Integration Protocol & Example[Algorithm-Integration-Protocol] FIND<Loop-Pattern> → EXTRACT<Type-Parameters> → SET<Preposition-Slots> → CREATE<Directive-Block> # STEP 1: Find Loop Pattern FIND algorithm_class IN task_requirements BASED_ON classification_table Example: Task "analyze codebase for patterns" → Cognitive Loop # STEP 2: Extract Type Parameters EXTRACT domain_objects FROM task_specification INTO type_placeholders Example: <Source> = codebase, <Patterns> = code_patterns, <Output> = analysis_report # STEP 3: Set Preposition Slots SET concrete_values TO preposition_operators USING context_mapping Example: FROM = "src/**/*.js", IN = parsed_ast, TO = "reports/analysis.json" # STEP 4: Create Directive Block CREATE executable_directive FROM instantiated_algorithm INTO prompt_structure --- # INTEGRATION EXAMPLE Task: "Process user requests and route to appropriate handlers" STEP 1: Task contains "process", "route" → Decision Loop (Option-Selection-Loop) STEP 2: <Options> = handler_candidates, <Criteria> = request_type_matching STEP 3: FROM = user_request, BASED_ON = request.type, ON = matched_handler STEP 4: Final PAG: AGENT request-router EXECUTES Option-Selection-Loop: # PHASE 1: Create Options READ user_request FROM input_queue CREATE handler_candidates FROM handler_registry # PHASE 2: Filter by Type FILTER handler_candidates BASED_ON request.type # PHASE 3: Find & Execute FIND matching_handler IN filtered_candidates EXECUTE matched_handler ON user_request WRITE response TO output_queue VALIDATION GATE: ✅ Handler found for request type ✅ Response generated
- FIND matches task to loop class using trigger words
- EXTRACT identifies domain-specific type parameters
- SET binds concrete values to preposition slots
- CREATE produces executable PAG directive block
- Final directive includes validation gates for quality assurance
Algorithm Creation Protocolχ
Five-phase process for discovering and creating new algorithms from cross-domain patterns:
Algorithm Creation Protocol[Algorithm-Creation-Protocol] READ<Domains> → LINK<Patterns> → FIND<Isomorphisms> → EXTRACT<Template> → ANALYZE<Uniqueness> # PHASE 1: Domain Pattern Inspection READ cross_domain_sources FOR overlapping_patterns IN domain_literature Sources: - Natural Language Processing (semantic parsing, discourse analysis) - Theory of Mind research (belief modeling, intention recognition) - Psychology (cognitive processes, behavioral patterns) - Compiler Theory (parsing, optimization passes) # PHASE 2: Capability Mapping LINK identified_patterns TO implementation_capabilities USING feasibility_analysis Capabilities: - ML/NN architectures (attention mechanisms, recurrent structures) - Compiler constructs (AST traversal, code generation) - LLM+CLI (tool execution, context management) # PHASE 3: Common Ground Detection FIND structural_equivalences BETWEEN domain_patterns USING pattern_matching FIND verb_sequences IN cross_domain_operations LINK preposition_relationships TO data_flow_patterns EXTRACT control_flow INTO pag_lang_constructs # PHASE 4: Template Abstraction CREATE verb_chain FROM common_operations SET type_parameters FOR domain_objects WRITE semantic_guarantees FOR each_step MARK algorithm INTO algorithm_class # PHASE 5: Uniqueness Validation ANALYZE candidate_algorithm AGAINST existing_algorithms USING redundancy_checks ANALYZE verb_chain FOR redundancy IN algorithm_repository ANALYZE keywords AGAINST pag_lang_specification --- # ALGORITHM TEMPLATE FORMAT [Named-Algorithm] Class: <Loop-Class> VERB<Type> → VERB<Type> → VERB<Type> → ... 1. **VERB<Type>** – VERB <object> [preposition slots...] 2. **VERB<Type>** – VERB <object> [preposition slots...] ...
- Phase 1 surveys multiple domains for recurring patterns
- Phase 2 maps patterns to implementable capabilities
- Phase 3 finds structural isomorphisms across domains
- Phase 4 abstracts common structure into reusable template
- Phase 5 validates uniqueness against existing algorithms
Preposition Slotsψ
Semantic meaning of each preposition slot in algorithm definitions:
| Slot | Meaning | When Used |
|---|---|---|
FROM | Input origin | READ data, EXTRACT structure, COLLECT from source |
IN | Location container | FIND patterns, GREP within structure |
INTO | Destination container | WRITE outputs, EXTRACT components |
ON | Direct target | EXECUTE tools, ITERATE on input |
TO | Intended destination | FILTER subset, SET value, WRITE destination |
USING | Process mechanism | Any action requiring method specification |
BASED_ON | Selection criteria | FILTER, RANK, SET strategy |
AGAINST | Evaluation reference | ANALYZE correctness, COMPARE criteria |
FOR | Objective/purpose | ANALYZE purpose, INVESTIGATE reason |
BETWEEN | Relational mapping | LINK elements, COMPARE differences |
WITHOUT | Explicit exclusion | FILTER constraints, SET without condition |
Verb Semantic Guaranteesω
Each verb carries specific semantic guarantees intended to constrain implementation:
| Category | Verb | Semantic Guarantee |
|---|---|---|
Input | READ | Non-destructive read; source unmodified |
Input | EXTRACT | Preserves source meaning; extracts structure |
Pattern | FIND | Boolean existence check; non-invasive |
Pattern | ANALYZE | Deep examination; may delegate to tools |
Output | CREATE | Produces candidate set or structured artifact |
Narrowing | FILTER | Removes elements; preserves order |
Execution | EXECUTE | Side effects possible; modifies environment |
Transfer | WRITE | Creates new entry; idempotent if overwrite |
Relation | LINK | Creates bidirectional associations |
Control | ITERATE | Maintains session context; sequential |
Sequence | RANK | Priority-based ordering; score-driven |
State | SET | Assigns state; idempotent |
Mapping | MATCH | Pattern matching; deterministic |
Validation | VERIFY | Boolean validation; non-modifying |