Skip to content

AQL

AQL, the Agent Query Language, is how memory is read and written in ADB, A3T’s agent database. Agents use it on every turn; flows use it with call: adb; you can read with it on an agent’s Memory › AQL tab. A statement is a verb, a memory type and clauses: reads say FROM, writes say INTO. This page follows AQL 0.13: 13 verbs, each working on every memory type, with RECALL as the only read. For a guided tour, read AQL, explained, and for what changed in 0.13, AQL 0.13: One Read, Thirteen Verbs; every verb is at the end of this page. The full grammar is in the AQL repository, with a playground.

TypeWhat it holdsTypical use
WORKINGWhat an agent holds for the task at handThe current conversation’s state
EPISODICWhat happened, one record per eventEach turn of a conversation
SEMANTICWhat is known: records with a key and fields, and the links between themWhat it knows; knowledge graphs are built from these
PROCEDURALHow to do things, with a confidenceSteps it has learned
TOOLSThe tools it knows aboutThe tool catalogue

ALL reads every type at once; it works with RECALL and FORGET only.

PartOptions
ReadRECALL: every read, by key, by condition, by meaning, the latest items or the tools for a task; ADB picks the access path
WriteSTORE INTO, UPDATE INTO … WHERE … (…), FORGET FROM
LinksLINK FROM … INTO … TYPE "…" connects records, or sets an existing link’s weight; UNLINK removes links; WITH LINKS and FOLLOW LINKS read them
NamespacesBRANCH, FORK and MERGE work on whole namespaces
FlowPIPELINE (several reads in one request), SUBSCRIBE, UNSUBSCRIBE, PUBLISH
SessionUSE "…" names the namespace for the statements after it
ClausesWHERE, LIKE (by meaning) with CONFIDENCE, WINDOW LAST n, ORDER BY, LIMIT, RETURN, AGGREGATE, GROUP BY, HAVING
ModifiersNAMESPACE "…" (an agent’s space; a read may list several), IN SCOPE "…", TTL 90d, AS OF "<time>", WITH HISTORY
Variables$name in WHERE and LIKE, bound from the caller’s variables
-- The help-desk agent's last turns (no WHERE reads everything, up to the LIMIT)
RECALL FROM EPISODIC NAMESPACE "agt-87c819a3" ORDER BY created_at DESC LIMIT 50
-- One conversation's turns
RECALL FROM EPISODIC WHERE session_id = "agt-87c819a3:order-A-1042" NAMESPACE "agt-87c819a3" LIMIT 10
-- Knowledge about refunds, by meaning rather than exact words
RECALL FROM SEMANTIC LIKE "late refund" NAMESPACE "a3t-usage" LIMIT 5
-- One record by its key: a key is an ordinary field
RECALL FROM SEMANTIC WHERE key = "refund-window" NAMESPACE "a3t-usage"

A read answers with its records and a memory point: the place in ADB’s log it reflects, usable with AS OF to read the same state again.

STORE INTO SEMANTIC (key = "refund-window", content = "Refunds arrive within 7 days of approval")
STORE INTO PROCEDURAL (pattern = "late-refund", steps = "Ask for the order number, check the status, escalate after 7 days", confidence = 0.9)
UPDATE INTO SEMANTIC WHERE key = "refund-window" (content = "Refunds arrive within 5 working days of approval")
FORGET FROM SEMANTIC WHERE key = "refund-window"

FORGET removes a record from every read at once; its history is kept. UPDATE keeps the old version too, so AS OF and WITH HISTORY can read it.

When two keys turn out to name one thing, give the survivor the other key as an alias, then forget the duplicate. Reads and links by the alias reach the survivor:

UPDATE INTO SEMANTIC WHERE key = "refund-window" (aliases = ["refund-time"])
FORGET FROM SEMANTIC WHERE key = "refund-time"
LINK FROM SEMANTIC WHERE key = "refund-window"
INTO PROCEDURAL WHERE pattern = "late-refund"
TYPE "handled_by"
RECALL FROM SEMANTIC WHERE key = "refund-window"
FOLLOW LINKS TYPE "handled_by"
RETURN pattern, confidence

A relationship is a link, and a value is a field: there are no separate facts. Links are read in both directions.

Every statement works in one namespace: its own NAMESPACE, or the one named by a USE earlier in the same request.

USE "agt-87c819a3";
RECALL FROM EPISODIC WHERE session_id = "agt-87c819a3:order-A-1042" LIMIT 10;
RECALL FROM SEMANTIC LIKE "late refund" NAMESPACE "a3t-usage" LIMIT 5

A branch is a namespace too. BRANCH makes one that reads through its base and keeps its own writes; MERGE brings its changes back, failing on conflicts unless PREFER SOURCE or PREFER TARGET says which side wins; FORGET FROM ALL drops it:

BRANCH FROM "agt-87c819a3" INTO "agt-87c819a3-try"
MERGE FROM "agt-87c819a3-try" INTO "agt-87c819a3"
FORGET FROM ALL NAMESPACE "agt-87c819a3-try"

FORK makes a full, independent copy instead.

- recall_history:
call: adb
with:
query: RECALL FROM EPISODIC WHERE host = $host LIMIT 5 RETURN alert, outcome
variables:
host: ${ $context.alert.host }
_resource: a3t/adb
export:
as: '${ $context + {history: .} }'

variables bind $names in WHERE and LIKE. In STORE and UPDATE values, build the statement with an expression and quote values with @json:

query: '${ "STORE INTO EPISODIC (host = " + ($context.alert.host | @json) + ", outcome = \"open\") TTL 90d" }'

On every turn, an agent built on tmpl_a3t_agent:

  1. recalls from its own space: the conversation’s earlier turns, and facts and procedures that match the message; and from the semantic spaces attached to it;
  2. if procedure answers are turned on in its memory settings (they are off by default), answers from a matching procedure without calling the model;
  3. stores the turn in its episodic memory afterwards.

Its space is a NAMESPACE of its own in its organisation’s ADB, shown on its Memory tab, e.g. agt-87c819a3. On a memory branch, every statement it runs reads and writes that branch.

Each AQL verb and its clauses, as a tree. Open one with + for what it does and an example; search finds a keyword anywhere.

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"