See your agents built, governed and running in a 30-minute walkthrough. Book a demo →
← All posts

AQL, Explained

Every verb of AQL 0.13, the Agent Query Language, as one expanding tree. Open RECALL, STORE, LINK, BRANCH, MERGE, PIPELINE and the rest, clause by clause, each with an explanation and an example.

Sriram 1 min read
AQL 0.13's verbs drawn as a tree on a floor, from AQL at the front to the read, write, graph, namespace and flow families and their verbs, under the title AQL, explained.

AQL is the query language agents use for their own memory: five memory types (working, episodic, semantic, procedural and tools) and a small set of verbs to store, recall, link and learn. Agent Memory Needs a Query Language explains why. This post is the reference.

Updated 18 Nov 2026 for AQL 0.13, which replaced the earlier versions with one smaller language. AQL 0.13: One Read, Thirteen Verbs explains what changed and why.

AQL is not YAML, so instead of keys the tree is built from verbs: 13 of them, plus USE. Every statement has the same shape:

VERB  FROM|INTO  MEMORY_TYPE  predicate  [modifiers...]

Each verb below opens into those parts in order: the memory it reads or writes, the predicate that picks records, then the modifiers that shape the result. Click + on any part to see what it does and an example.

readreads memorywritechanges memorygraphlinks recordsnamespacebranchesflowpipelines, topics, USE
AQL verbs
  • RECALL read verb

    AQL › RECALL

    Every read. Exact lookups, filters, similarity, the tools for a task, the session's latest state: one verb, and the engine picks the access path from what you ask.

    RECALL FROM EPISODIC WHERE outcome = "success"
      ORDER BY confidence DESC LIMIT 5
    • FROM memory clause required

      AQL › RECALL › FROM memory

      Which memory to read. ALL reads every type at once: "tell me everything about this URL".

      RECALL FROM ALL WHERE url = "example.com/news"
      • EPISODIC memory

        AQL › RECALL › FROM memory › EPISODIC

        What happened: events, incidents, decisions and their outcomes.

      • SEMANTIC memory

        AQL › RECALL › FROM memory › SEMANTIC

        What is known: records about things, and the links between them.

      • PROCEDURAL memory

        AQL › RECALL › FROM memory › PROCEDURAL

        How to do things: runbooks and strategies the agent runs.

      • TOOLS memory

        AQL › RECALL › FROM memory › TOOLS

        What can be used: the tools the agent may call, with their rankings.

      • WORKING memory

        AQL › RECALL › FROM memory › WORKING

        The current session: what the agent is holding right now.

      • ALL memory

        AQL › RECALL › FROM memory › ALL

        Every memory type at once. For RECALL and FORGET only.

    • WHERE predicate

      AQL › RECALL › WHERE

      Conditions on fields. A key is just a field: WHERE key = "person:ada" is an exact lookup. No WHERE reads everything, within LIMIT.

      RECALL FROM EPISODIC WHERE pod = "payments-api" AND resolved = true
      • = != < <= > >= operator

        AQL › RECALL › WHERE › = != < <= > >=

        Compare a field with a value. Strings in double quotes; numbers, true, false and null as they are.

        RECALL FROM EPISODIC WHERE resolution_time > 300
      • BETWEEN a AND b operator

        AQL › RECALL › WHERE › BETWEEN a AND b

        A value in a range, both ends included. Also how to read a span of time.

        RECALL FROM EPISODIC WHERE created_at BETWEEN "2026-11-01T00:00:00Z" AND "2026-11-08T00:00:00Z"
      • IN ( … ) operator

        AQL › RECALL › WHERE › IN ( … )

        The field equals any value in the list.

        RECALL FROM EPISODIC WHERE pod IN ("payments-api", "checkout")
      • CONTAINS STARTS_WITH ENDS_WITH operator

        AQL › RECALL › WHERE › CONTAINS STARTS_WITH ENDS_WITH

        Match part of a text field.

        RECALL FROM SEMANTIC WHERE key STARTS_WITH "person:"
      • AND OR ( ) logic

        AQL › RECALL › WHERE › AND OR ( )

        Combine conditions. Brackets make the grouping explicit.

        RECALL FROM EPISODIC WHERE (pod = "a" OR pod = "b") AND resolved = true
      • {name} $name value

        AQL › RECALL › WHERE › {name} $name

        A variable instead of a literal: bound by the request, or by an earlier stage of a PIPELINE.

        RECALL FROM EPISODIC WHERE url = {url} LIMIT 10
    • LIKE "text" | $var predicate

      AQL › RECALL › LIKE "text" | $var

      Similarity: the records closest in meaning to some text or a vector, found by vector and word search together. Use it instead of WHERE.

      RECALL FROM SEMANTIC LIKE $question CONFIDENCE 0.7 LIMIT 5
      • CONFIDENCE c modifier

        AQL › RECALL › LIKE "text" | $var › CONFIDENCE c

        At least this similar, from 0 to 1. Without it you get the best matches, however weak.

        RECALL FROM PROCEDURAL LIKE "pod OOMKilled restart" CONFIDENCE 0.6
    • WINDOW LAST n | duration modifier

      AQL › RECALL › WINDOW LAST n | duration

      The newest items: the last n, or everything from the last 30s, 5m, 1h… Works on anything that has a time.

      RECALL FROM WORKING WINDOW LAST 30s
      • LAST n option

        AQL › RECALL › WINDOW LAST n | duration › LAST n

        The n most recent items.

        RECALL FROM WORKING WINDOW LAST 10
      • LAST duration option

        AQL › RECALL › WINDOW LAST n | duration › LAST duration

        Everything from the last span of time: a number and ms, s, m, h or d.

        RECALL FROM EPISODIC WHERE pod = "payments-api" WINDOW LAST 1h
    • shape the result modifiers

      AQL › RECALL › shape the result

      Order, cut and trim what comes back, so the LLM gets a few useful rows instead of everything.

      RECALL FROM EPISODIC WHERE outcome = "success"
        ORDER BY confidence DESC LIMIT 5
        RETURN incident_id, action, confidence
      • ORDER BY field [ASC | DESC] modifier

        AQL › RECALL › shape the result › ORDER BY field [ASC | DESC]

        Sort by one field. Ascending unless you say DESC. With LIMIT, also how to take the top n by a field.

        RECALL FROM WORKING ORDER BY attention_weight DESC LIMIT 3
      • LIMIT n modifier

        AQL › RECALL › shape the result › LIMIT n

        Return at most n records.

        RECALL FROM EPISODIC WHERE pod = "payments-api" LIMIT 10
      • RETURN fields modifier

        AQL › RECALL › shape the result › RETURN fields

        Return only these fields, or * for all of them. Keeps the context small.

        RECALL FROM SEMANTIC WHERE key = "service:payments-api" RETURN owner, memory_limit
    • summarise modifiers

      AQL › RECALL › summarise

      Turn many records into a few numbers. Often the LLM needs a signal, not fifty rows.

      RECALL FROM EPISODIC WHERE strategy = "tech_news_premium"
        AGGREGATE COUNT(*) AS uses, AVG(ctr) AS avg_ctr
        HAVING uses > 10 AND avg_ctr < 0.01
      • AGGREGATE f(field) AS name modifier

        AQL › RECALL › summarise › AGGREGATE f(field) AS name

        Compute COUNT, AVG, SUM, MIN or MAX over the matched records. COUNT(*) counts them. AS names the result.

        RECALL FROM EPISODIC WHERE root_cause = "OOMKilled"
          AGGREGATE COUNT(*) AS incidents, AVG(resolution_time) AS avg_minutes
      • GROUP BY fields modifier

        AQL › RECALL › summarise › GROUP BY fields

        With AGGREGATE: one result row per group instead of one overall.

        RECALL FROM EPISODIC WHERE outcome = "won"
          AGGREGATE COUNT(*) AS wins GROUP BY url
      • HAVING condition modifier

        AQL › RECALL › summarise › HAVING condition

        Filter on the aggregated values. Needs AGGREGATE.

        RECALL FROM EPISODIC WHERE outcome = "won"
          AGGREGATE COUNT(*) AS wins GROUP BY url
          HAVING wins > 5
    • read the graph modifiers

      AQL › RECALL › read the graph

      Records are connected by LINKs. These modifiers show the links behind a record, or walk along them to other records, even in another memory type. Links are read in both directions.

      RECALL FROM SEMANTIC WHERE key = "concept:k8s-oom"
        FOLLOW LINKS TYPE "triggers"
        RETURN pattern_id, steps, confidence
    • read the past modifiers

      AQL › RECALL › read the past

      UPDATE keeps the old version of a record. These modifiers read memory as it was, not just as it is. A time is a timestamp or a variable.

      RECALL FROM SEMANTIC WHERE key = "person:ada" AS OF "2026-10-01T00:00:00Z"
      • AS OF time modifier

        AQL › RECALL › read the past › AS OF time

        What memory held at that moment.

        RECALL FROM SEMANTIC WHERE key = "product:x1" AS OF $quarter_end RETURN price
      • WITH HISTORY modifier

        AQL › RECALL › read the past › WITH HISTORY

        Every version, current and replaced, oldest first.

        RECALL FROM PROCEDURAL WHERE pattern_id = "deploy" WITH HISTORY
      • WITH HISTORY BETWEEN a AND b modifier

        AQL › RECALL › read the past › WITH HISTORY BETWEEN a AND b

        Only the versions written in that span.

        RECALL FROM SEMANTIC WHERE key = "person:ada" WITH HISTORY BETWEEN "2026-01-01T00:00:00Z" AND "2026-06-30T00:00:00Z"
    • whose memory modifiers

      AQL › RECALL › whose memory

      Every statement works in a namespace: its own NAMESPACE, else the USE in force. A read may list several namespaces.

      RECALL FROM SEMANTIC LIKE $q NAMESPACE ("crm", "kb") LIMIT 5
      • NAMESPACE "ns" modifier

        AQL › RECALL › whose memory › NAMESPACE "ns"

        Whose memory: an agent, a project, a branch. A server may require it on every statement.

        RECALL FROM EPISODIC WHERE pod = "payments-api" NAMESPACE "ops"
      • NAMESPACE ("a", "b") modifier

        AQL › RECALL › whose memory › NAMESPACE ("a", "b")

        One read across several namespaces, ranked together. Reads only: writes, links and topics are in one namespace.

        RECALL FROM SEMANTIC LIKE "refund policy" NAMESPACE ("crm", "kb") LIMIT 5
      • IN SCOPE "s" modifier

        AQL › RECALL › whose memory › IN SCOPE "s"

        A shared group inside the namespace, such as one team.

        RECALL FROM SEMANTIC IN SCOPE "team:billing" WHERE kind = "customer"
  • STORE write verb

    AQL › STORE

    Write a new memory. A write names one memory type: the agent decides whether this is an event, knowledge or a procedure.

    STORE INTO EPISODIC (event = "login", user_id = "u123") TTL 7d
    • INTO memory clause required

      AQL › STORE › INTO memory

      Exactly one memory type. STORE INTO ALL is an error.

      STORE INTO PROCEDURAL (pattern_id = "oom-fix", steps = "raise limit, restart", confidence = 0.6)
      • EPISODIC memory

        AQL › STORE › INTO memory › EPISODIC

        What happened: events, incidents, decisions and their outcomes.

      • SEMANTIC memory

        AQL › STORE › INTO memory › SEMANTIC

        What is known: records about things, and the links between them.

      • PROCEDURAL memory

        AQL › STORE › INTO memory › PROCEDURAL

        How to do things: runbooks and strategies the agent runs.

      • TOOLS memory

        AQL › STORE › INTO memory › TOOLS

        What can be used: the tools the agent may call, with their rankings.

      • WORKING memory

        AQL › STORE › INTO memory › WORKING

        The current session: what the agent is holding right now.

    • ( field = value, … ) payload required

      AQL › STORE › ( field = value, … )

      The record, as field = value pairs in brackets. Fields are free: the agent decides what to keep. Values can be strings, numbers, true, false, null, lists or variables.

      STORE INTO EPISODIC (incident_id = "inc-001", pod = "payments-api", resolved = true, resolution_time = 420)
    • TTL d modifier

      AQL › STORE › TTL d

      Forget this memory automatically after a duration: 30s, 15m, 12h, 7d.

      STORE INTO EPISODIC (event = "login", user_id = "u123") TTL 7d
    • whose memory modifiers

      AQL › STORE › whose memory

      A write works in exactly one namespace: its own NAMESPACE, else the USE in force.

      STORE INTO EPISODIC (event = "called", customer = "person:ada") NAMESPACE "crm"
      • NAMESPACE "ns" modifier

        AQL › STORE › whose memory › NAMESPACE "ns"

        Whose memory: an agent, a project, a branch. A server may require it on every statement.

        RECALL FROM EPISODIC WHERE pod = "payments-api" NAMESPACE "ops"
      • IN SCOPE "s" modifier

        AQL › STORE › whose memory › IN SCOPE "s"

        A shared group inside the namespace, such as one team.

        STORE INTO SEMANTIC (key = "note:renewal", text = "renewal due") IN SCOPE "team:billing"
  • UPDATE write verb

    AQL › UPDATE

    Change fields of records that exist. The old version is kept as history, so AS OF and WITH HISTORY can still read it. A value is a field: there are no separate facts.

    UPDATE INTO SEMANTIC WHERE key = "person:ada" (age = 36)
    • INTO memory clause required

      AQL › UPDATE › INTO memory

      One memory type, not ALL.

      UPDATE INTO PROCEDURAL WHERE pattern_id = "oom-fix" (confidence = 0.94, success_count = 8)
    • WHERE predicate required

      AQL › UPDATE › WHERE

      Which records to change. Required: an UPDATE never touches everything.

      UPDATE INTO EPISODIC WHERE incident_id = "inc-001" (resolved = true)
    • ( field = value, … ) payload required

      AQL › UPDATE › ( field = value, … )

      The fields to set. Fields you leave out keep their values; set one to null to clear it.

      UPDATE INTO SEMANTIC WHERE key = "person:ada" (title = null, team = "research")
    • (aliases = [ … ]) field

      AQL › UPDATE › (aliases = [ … ])

      Two keys turn out to name one thing. Give the survivor the other key as an alias, then FORGET the duplicate: reads, links and stored links by the alias all reach the survivor. Nothing is rewritten. (This replaces MERGE ENTITY.)

      UPDATE INTO SEMANTIC WHERE key = "person:ada" (aliases = ["person:ada-lovelace"]) NAMESPACE "crm";
      FORGET FROM SEMANTIC WHERE key = "person:ada-lovelace" NAMESPACE "crm"
    • TTL d modifier

      AQL › UPDATE › TTL d

      Forget this memory automatically after a duration: 30s, 15m, 12h, 7d.

      STORE INTO EPISODIC (event = "login", user_id = "u123") TTL 7d
    • whose memory modifiers

      AQL › UPDATE › whose memory

      A write works in exactly one namespace: its own NAMESPACE, else the USE in force.

      STORE INTO EPISODIC (event = "called", customer = "person:ada") NAMESPACE "crm"
      • NAMESPACE "ns" modifier

        AQL › UPDATE › whose memory › NAMESPACE "ns"

        Whose memory: an agent, a project, a branch. A server may require it on every statement.

        RECALL FROM EPISODIC WHERE pod = "payments-api" NAMESPACE "ops"
      • IN SCOPE "s" modifier

        AQL › UPDATE › whose memory › IN SCOPE "s"

        A shared group inside the namespace, such as one team.

        STORE INTO SEMANTIC (key = "note:renewal", text = "renewal due") IN SCOPE "team:billing"
  • FORGET write verb

    AQL › FORGET

    Erase memories. A forgotten record leaves a tombstone, so no read can still see it.

    FORGET FROM WORKING WHERE stale = true
    • FROM memory clause required

      AQL › FORGET › FROM memory

      One memory type, or ALL to forget a record wherever it is.

      FORGET FROM ALL WHERE user_id = "u123" NAMESPACE "crm"
      • EPISODIC memory

        AQL › FORGET › FROM memory › EPISODIC

        What happened: events, incidents, decisions and their outcomes.

      • SEMANTIC memory

        AQL › FORGET › FROM memory › SEMANTIC

        What is known: records about things, and the links between them.

      • PROCEDURAL memory

        AQL › FORGET › FROM memory › PROCEDURAL

        How to do things: runbooks and strategies the agent runs.

      • TOOLS memory

        AQL › FORGET › FROM memory › TOOLS

        What can be used: the tools the agent may call, with their rankings.

      • WORKING memory

        AQL › FORGET › FROM memory › WORKING

        The current session: what the agent is holding right now.

      • ALL memory

        AQL › FORGET › FROM memory › ALL

        Every memory type at once. For RECALL and FORGET only.

    • WHERE predicate

      AQL › FORGET › WHERE

      Which records to forget.

      FORGET FROM EPISODIC WHERE pod = "payments-api" AND resolved = true
    • no WHERE option

      AQL › FORGET › no WHERE

      Forgets everything in the memory named. It must name its NAMESPACE, so it can never happen by accident. FORGET FROM ALL with a NAMESPACE drops the whole namespace, which is also how a branch is dropped.

      FORGET FROM ALL NAMESPACE "crm-try"
    • whose memory modifiers

      AQL › FORGET › whose memory

      A write works in exactly one namespace: its own NAMESPACE, else the USE in force.

      STORE INTO EPISODIC (event = "called", customer = "person:ada") NAMESPACE "crm"
      • NAMESPACE "ns" modifier

        AQL › FORGET › whose memory › NAMESPACE "ns"

        Whose memory: an agent, a project, a branch. A server may require it on every statement.

        RECALL FROM EPISODIC WHERE pod = "payments-api" NAMESPACE "ops"
      • IN SCOPE "s" modifier

        AQL › FORGET › whose memory › IN SCOPE "s"

        A shared group inside the namespace, such as one team.

        STORE INTO SEMANTIC (key = "note:renewal", text = "renewal due") IN SCOPE "team:billing"
  • BRANCH namespace verb

    AQL › BRANCH

    A new namespace that reads through its base at a point in time, plus its own writes. Nothing is copied, and writes stay in the branch. Use it to try something against real memory.

    BRANCH FROM "crm" INTO "crm-try"
    • FROM "ns" INTO "ns" clause required

      AQL › BRANCH › FROM "ns" INTO "ns"

      FROM is the base; INTO is the new branch. A branch can be branched again. The two names must differ. USE doesn't apply: these verbs always name their namespaces.

      BRANCH FROM "crm" INTO "crm-try"
    • AS OF time option

      AQL › BRANCH › AS OF time

      Branch from the base as it was at that moment, not as it is now.

      BRANCH FROM "crm" INTO "crm-before-import" AS OF "2026-11-01T09:00:00Z"
    • drop a branch note

      AQL › BRANCH › drop a branch

      A branch is a namespace, so FORGET drops it. Dropping a namespace that still has branches is refused, naming them.

      FORGET FROM ALL NAMESPACE "crm-try"
  • FORK namespace verb

    AQL › FORK

    BRANCH with a full copy. The fork no longer reads through its base, so later changes to the base, or dropping it, don't reach it. It remembers where it came from, so it can still be merged either way.

    FORK FROM "crm" INTO "crm-copy"
    • FROM "ns" INTO "ns" clause required

      AQL › FORK › FROM "ns" INTO "ns"

      FROM is copied into the new namespace INTO. The two names must differ. USE doesn't apply: these verbs always name their namespaces.

      FORK FROM "crm" INTO "crm-try"
    • AS OF time option

      AQL › FORK › AS OF time

      Copy the records as they were at that moment.

      FORK FROM "crm" INTO "crm-nov-1" AS OF "2026-11-01T00:00:00Z"
  • MERGE namespace verb

    AQL › MERGE

    Apply the changes FROM made since the two parted to INTO, in one write. Merging a base into its branch moves the branch forward (what rebase did). Two namespaces with no common base can't be merged.

    MERGE FROM "crm-try" INTO "crm"
    • FROM "ns" INTO "ns" clause required

      AQL › MERGE › FROM "ns" INTO "ns"

      FROM is the side whose changes are applied; INTO receives them. The two names must differ. USE doesn't apply: these verbs always name their namespaces.

      MERGE FROM "crm" INTO "crm-try"
    • PREFER SOURCE | TARGET option

      AQL › MERGE › PREFER SOURCE | TARGET

      When both sides changed the same record, MERGE fails and lists the conflicts. PREFER says which side wins instead: SOURCE is FROM, TARGET is INTO.

      MERGE FROM "crm-try" INTO "crm" PREFER SOURCE
    • rebase note

      AQL › MERGE › rebase

      Merge the base into the branch to bring in its newer changes before you test again.

      MERGE FROM "crm" INTO "crm-try"
  • PIPELINE flow verb

    AQL › PIPELINE

    Several reads in one request, in order, within a time budget, ending in one context for the LLM. The last stage may write, to keep what was learned.

    PIPELINE bid TIMEOUT 80ms
      RECALL FROM TOOLS WHERE task = "bidding" LIMIT 3
      | RECALL FROM SEMANTIC WHERE key = {url}
      | RECALL FROM EPISODIC WHERE url = {url} LIMIT 10
    • name option

      AQL › PIPELINE › name

      An optional name, for logs and traces.

      PIPELINE triage RECALL FROM WORKING WINDOW LAST 60s | RECALL FROM EPISODIC WHERE pod = {pod} LIMIT 5
    • TIMEOUT d option

      AQL › PIPELINE › TIMEOUT d

      The time budget for the whole pipeline. TIMEOUT exists only here.

      PIPELINE TIMEOUT 200ms RECALL FROM WORKING WINDOW LAST 60s | RECALL FROM EPISODIC WHERE pod = {pod} LIMIT 5
    • stage | stage clause required

      AQL › PIPELINE › stage | stage

      RECALLs separated by |. {name} uses a value from an earlier stage. Each stage may name its own NAMESPACE.

      PIPELINE enrich
        RECALL FROM SEMANTIC WHERE key = {customer} NAMESPACE "crm"
        | STORE INTO EPISODIC (customer = {customer}, seen = true) NAMESPACE "ops"
    • write last option

      AQL › PIPELINE › write last

      The last stage may be a STORE or UPDATE: read the experience, then write back what was learned (what REFLECT … THEN did).

      PIPELINE learn
        RECALL FROM EPISODIC WHERE incident_id = {current}
        | RECALL FROM PROCEDURAL WHERE pattern_id = {matched}
        | STORE INTO PROCEDURAL (pattern_id = "learned", steps = "step1, step2", confidence = 0.6)
  • SUBSCRIBE flow verb

    AQL › SUBSCRIBE

    Follow changes as they happen: messages on a topic, or a live query whose result updates as memory changes. A subscription starts now.

    SUBSCRIBE TOPIC "orders" WHERE status = "paid" NAMESPACE "shop"
    • TOPIC "name" clause

      AQL › SUBSCRIBE › TOPIC "name"

      Messages PUBLISHed to this topic. WHERE filters them.

      SUBSCRIBE TOPIC "orders" WHERE status = "paid" NAMESPACE "shop"
    • RECALL … clause

      AQL › SUBSCRIBE › RECALL …

      A live query (what WATCH was): any RECALL, delivered again whenever its result changes.

      SUBSCRIBE RECALL FROM SEMANTIC WHERE kind = "customer" LIMIT 20 NAMESPACE "crm"
    • delivery note

      AQL › SUBSCRIBE › delivery

      Acknowledgements, resuming from a position and how often a live query re-runs are the server's API and settings, not AQL.

  • UNSUBSCRIBE flow verb

    AQL › UNSUBSCRIBE

    Stop a subscription or a live query.

    UNSUBSCRIBE "sub-7f3a"
    • handle clause required

      AQL › UNSUBSCRIBE › handle

      The id returned when the subscription was created: a string, a variable or a name.

      UNSUBSCRIBE $sub
  • PUBLISH flow verb

    AQL › PUBLISH

    Send a message to a topic, for every subscriber.

    PUBLISH TOPIC "orders" (order_id = "o-1", status = "paid") TTL 7d NAMESPACE "shop"
    • TOPIC "name" clause required

      AQL › PUBLISH › TOPIC "name"

      Where to publish. Topics are in one namespace.

      PUBLISH TOPIC "alerts" (pod = "payments-api", level = "high")
    • ( field = value, … ) payload required

      AQL › PUBLISH › ( field = value, … )

      The record, as field = value pairs in brackets. Fields are free: the agent decides what to keep. Values can be strings, numbers, true, false, null, lists or variables.

      PUBLISH TOPIC "orders" (order_id = "o-1", status = "paid")
    • TTL d modifier

      AQL › PUBLISH › TTL d

      How long the message is kept for subscribers.

      PUBLISH TOPIC "orders" (order_id = "o-1", status = "paid") TTL 7d
  • USE session

    AQL › USE

    Name the namespace once. Statements after it that name no namespace work there; a statement's own NAMESPACE still wins.

    USE "crm";
    RECALL FROM SEMANTIC WHERE key = "person:ada";
    STORE INTO EPISODIC (event = "called", customer = "person:ada")
    • script clause

      AQL › USE › script

      Statements separated by ; are one request. Its answer is the last statement's. A failing statement stops the script and is named by position; the ones before it stay done.

      USE "ops";
      STORE INTO EPISODIC (event = "deploy", service = "payments-api");
      RECALL FROM EPISODIC WHERE service = "payments-api" ORDER BY created_at DESC LIMIT 3
    • session note

      AQL › USE › session

      A connection that keeps state (MCP, Flight) keeps its USE between requests. A plain HTTP request uses a script.

    • own NAMESPACE wins note

      AQL › USE › own NAMESPACE wins

      USE only fills in a missing namespace. BRANCH, FORK and MERGE always name theirs.

      USE "crm";
      RECALL FROM EPISODIC WHERE pod = "x" NAMESPACE "ops"

Three rules that hold everywhere

  1. One pair of direction words. Reads and FORGET take FROM memory; STORE and UPDATE write INTO it. LINK, BRANCH, FORK and MERGE say both ends: FROM one INTO the other.
  2. One read, any memory. RECALL is the only read verb and works on every memory type. ALL works with RECALL and FORGET only; writes name one memory type and one namespace.
  3. Modifiers come after the predicate, in any order. LIMIT 5 ORDER BY created_at DESC and ORDER BY created_at DESC LIMIT 5 mean the same.

Every example in the tree parses with the AQL 0.13 reference parser.

Try it in the docsRun AQL in your browser: the parser and engine in WASM

Sources