Pattern Overview

The Intent Extraction Loop is the fundamental pattern for agentic workflows. It describes how intent flows from specification to execution.

The Loop

1. Specification (Gherkin + Figma)

2. Semantic Extraction (LLM as parser)

3. Canonical Form (DAG of operations)

4. Execution (Deterministic runtime)

5. Verification (Prove fidelity)

6. Audit Trail (Prove execution)

Stage 1: Specification

Input: Gherkin scenario + Figma design

Scenario: Process refund
  Given a completed transaction
  When the customer requests a refund
  Then deduct from merchant account
  And credit customer payment method
  And send confirmation email

Stage 2: Semantic Extraction

The LLM is used only for understanding, not execution.

Task: Extract entities, relationships, and constraints.

Output:

{
  "entities": {
    "transaction": "completed",
    "customer": "identified",
    "merchant": "identified"
  },
  "operations": [
    "deduct_from_merchant",
    "credit_customer",
    "send_email"
  ],
  "constraints": [
    "transaction must be completed",
    "customer must be verified"
  ]
}

Stage 3: Canonical Form

Convert to a DAG (Directed Acyclic Graph):

verify_transaction

deduct_from_merchant ← verify_merchant

credit_customer ← verify_payment_method

send_email

log_audit_trail

This is deterministic. No ambiguity.

Stage 4: Execution

The runtime executes the DAG:

Stage 5: Verification

Prove that execution matches specification:

Stage 6: Audit Trail

Generate a proof that execution was faithful:

{
  "specification": "Process refund",
  "execution_trace": [
    {"step": 1, "operation": "verify_transaction", "result": "success"},
    {"step": 2, "operation": "deduct_from_merchant", "result": "success"},
    {"step": 3, "operation": "credit_customer", "result": "success"},
    {"step": 4, "operation": "send_email", "result": "success"}
  ],
  "fidelity": "100%"
}

Why This Pattern Works

  1. Separates concerns: Specification, extraction, execution, verification
  2. Enables composition: Each stage can be improved independently
  3. Provides auditability: Every step is logged and verifiable
  4. Guarantees fidelity: Specification and execution are mathematically equivalent