Operators#
49 built-in operators in 5 families. Write \Name_{\Family}(input; config).
This is the same text the editor shows while you type: the completion popup, the documentation pane beside it and the hover card all render from this registry, so what you read here is what the editor tells you.
| Family | Operators |
|---|---|
\Psi reasoning |
Ask CoT ToT GoT SelfAsk Plan Reflect Critique Summarize OpenCode AxialCode SelectiveCode Codebook |
\Gamma context |
Retrieve Search Fetch Rank Filter Compress MergeContext Ground Cite Tabs Close |
\mathcal{M} memory |
MemRead MemWrite MemAppend MemSearch MemSummarize MemForget |
\Sigma aggregation |
Join Vote Debate Map Shuffle Rotate Reverse Transpose Zip Chunk Pick Cross Flatten Unique Sort |
\Lambda framework / agent |
ReAct Verify Fork Chat |
Operators compose with \circ, apply across a matrix with \times, and run
concurrently with \parallel — see the language guide.
Reasoning — `\Psi`#
\Ask_{\Psi}#
Ask(x; context) — Reasoning
Answer x with the language model, optionally using context.
x— the question, as textcontext— optional list of passages or tabs to answer from
Returns: the answer, as text
local a = $\Ask_{\Psi}("What is Lua?")$
One model call. The cheapest of the Ψ operators — reach for it before CoT.
\AxialCode_{\Psi}#
AxialCode(codes) — Reasoning
Axial coding: group codes into categories and relate them.
codes— the output of OpenCode
Returns: categories, each with the codes it contains and how they relate
local cats = $\AxialCode_{\Psi}(codes)$
\Codebook_{\Psi}#
Codebook(codes) — Reasoning
Render codes as a markdown codebook table.
codes— codes from any coding pass
Returns: a markdown table
fs.write("codebook.md", $\Codebook_{\Psi}(codes)$)
\CoT_{\Psi}#
CoT(x; context) — Reasoning
Chain of thought: reason step by step, return the final answer.
x— the questioncontext— optional supporting passages
Returns: the final answer, with the reasoning discarded
local a = $\CoT_{\Psi}(question; context)$
Better on multi-step problems, and slower. The working is not returned.
\Critique_{\Psi}#
Critique(y; rubric) — Reasoning
Critically evaluate y (returns the critique text).
y— the answer to judgerubric— what to judge it against
Returns: the critique, as text — not a score
print($\Critique_{\Psi}(answer; "factual accuracy")$)
\GoT_{\Psi}#
GoT(x; b=3) — Reasoning
Graph of thoughts: generate b candidates in parallel and merge them.
x— the questionb— how many candidates to generate (default 3)
Returns: one answer merged from all candidates
local a = $\GoT_{\Psi}(question; b=3)$
Like ToT but combines the candidates instead of picking one.
\OpenCode_{\Psi}#
OpenCode(corpus; k=12) — Reasoning
Grounded-theory open coding: codes with definitions and quotes.
corpus— the documents or passages to codek— roughly how many codes to produce (default 12)
Returns: a list of {code, definition, quotes}
local codes = $\OpenCode_{\Psi}(interviews; k=15)$
Grounded theory, first pass. Feed the result to AxialCode.
\Plan_{\Psi}#
Plan(x; context) — Reasoning
Produce a step-by-step plan (returns a list of steps).
x— the goalcontext— optional constraints or background
Returns: a list of steps
local steps = $\Plan_{\Psi}("migrate the database")$
\Reflect_{\Psi}#
Reflect(y; context) — Reasoning
Improve a previous answer y.
y— an answer produced earliercontext— optional evidence to improve it against
Returns: the improved answer
local better = $\Reflect_{\Psi}(draft; sources)$
\SelectiveCode_{\Psi}#
SelectiveCode(categories; question) — Reasoning
Selective coding: the core category and its storyline.
categories— the output of AxialCodequestion— the research question to organise around
Returns: the core category and its storyline
print($\SelectiveCode_{\Psi}(cats; question)$)
\SelfAsk_{\Psi}#
SelfAsk(x; n=3) — Reasoning
Decompose x into n sub-questions (returns a list).
x— the question to break upn— how many sub-questions (default 3)
Returns: a list of sub-questions, as text
for _, q in ipairs($\SelfAsk_{\Psi}(topic; n=5)$) do print(q) end
\Summarize_{\Psi}#
Summarize(x; words=120) — Reasoning
Summarize text, tabs or lists.
x— text, a tab, or a list of eitherwords— target length (default 120)
Returns: the summary, as text
print($\Summarize_{\Psi}(tab; words=80)$)
Accepts a matrix of tabs, so it summarises a whole selection at once.
\ToT_{\Psi}#
ToT(x; b=3) — Reasoning
Tree of thoughts: generate b candidate answers in parallel, keep the best.
x— the questionb— how many candidate answers to explore (default 3)
Returns: the best candidate
local a = $\ToT_{\Psi}(puzzle; b=4)$
Costs roughly b model calls.
Context — `\Gamma`#
\Cite_{\Gamma}#
Cite(y; C) — Context
Add [n] citations to y from the numbered context C.
y— the answerC— the numbered context it came from
Returns: the answer with [n] markers added
print($\Cite_{\Gamma} \circ \Summarize_{\Psi}(pages)$)
\Close_{\Gamma}#
Close(tabs) — Context
Close every tab in a list.
tabs— a tab or a matrix of tabs
Returns: nothing
$\Close_{\Gamma}(T)$
\Compress_{\Gamma}#
Compress(C; chars=2000) — Context
Shrink context to a size budget (summarizes when needed).
C— context: text, passages or tabschars— the size budget (default 2000)
Returns: context that fits the budget
local small = $\Compress_{\Gamma}(pages; chars=4000)$
Drops what it can; summarises only when dropping is not enough.
\Fetch_{\Gamma}#
Fetch(url) — Context
Open url in a hidden tab and return its text.
url— the page to read
Returns: the page text
local text = $\Fetch_{\Gamma}("https://example.com")$
Opens a hidden tab and closes it again.
\Filter_{\Gamma}#
Filter(C; predicate) — Context
Keep the items for which predicate(item) is true.
C— a listpredicate— a Lua function returning true to keep an item
Returns: a shorter list
local long = $\Filter_{\Gamma}(docs; function(d) return #d > 500 end)$
\Ground_{\Gamma}#
Ground(y; C) — Context
Rewrite y so it only states what the context C supports.
y— an answer that may overreachC— the context it must stay inside
Returns: the answer rewritten to claim only what C supports
local safe = $\Ground_{\Gamma}(answer; sources)$
\MergeContext_{\Gamma}#
MergeContext(C1, C2, ...) — Context
Merge several context lists into one.
C1, C2, …— any number of context lists
Returns: one list
local all = $\MergeContext_{\Gamma}(web, notes, memory)$
\Rank_{\Gamma}#
Rank(C; q) — Context
Sort passages by relevance to q.
C— a list of passagesq— what to rank them against
Returns: the same list, reordered
local best = $\Rank_{\Gamma}(passages; question)$
\Retrieve_{\Gamma}#
Retrieve(q; source, k=5) — Context
Top-k passages from tabs/text most relevant to q (list).
q— what you are looking forsource— tabs, text, or a list of passagesk— how many passages to return (default 5)
Returns: a list of passages, most relevant first
local ctx = $\Retrieve_{\Gamma}(question; source=tabs, k=8)$
\Search_{\Gamma}#
Search(q; k=5) — Context
Web search in a hidden tab; returns a list of {title, url}.
q— the search queryk— how many results (default 5)
Returns: a list of {title, url}
local hits = $\Search_{\Gamma}("ohm language"; k=10)$
Runs in a hidden tab. No results is an empty list, not an error.
\Tabs_{\Gamma}#
Tabs(urls; hidden=true) — Context
Open one tab per url, all at once (the same as \Tab \times urls).
urls— a list of addresseshidden— open them out of sight (default true)
Returns: a matrix of tabs
local T = $\Tabs_{\Gamma}(urls; hidden=true)$
The same as \Tab \times urls. Opens them all at once, not one by one.
Memory — `\mathcal{M}`#
\MemAppend_{\mathcal{M}}#
MemAppend(k, v) — Memory
Append v to the list stored at memory key k.
k— the keyv— the item to add
Returns: the list
$\MemAppend_{\mathcal{M}}("seen", url)$
\MemForget_{\mathcal{M}}#
MemForget(k) — Memory
Delete memory key k.
k— the key to delete
Returns: nothing
$\MemForget_{\mathcal{M}}("draft")$
\MemRead_{\mathcal{M}}#
MemRead(k) — Memory
Read memory key k.
k— the key
Returns: the stored value, or nil
local v = $\MemRead_{\mathcal{M}}("topic")$
\MemSearch_{\mathcal{M}}#
MemSearch(q; k=5) — Memory
Memory entries most relevant to q.
q— what to look fork— how many entries (default 5)
Returns: the closest entries
local past = $\MemSearch_{\mathcal{M}}(question)$
\MemSummarize_{\mathcal{M}}#
MemSummarize() — Memory
Summarize everything in memory.
Returns: a summary of everything in memory
print($\MemSummarize_{\mathcal{M}}()$)
\MemWrite_{\mathcal{M}}#
MemWrite(k, v) — Memory
Write v to memory key k.
k— the keyv— any JSON-able value
Returns: the value
$\MemWrite_{\mathcal{M}}("topic", answer)$
Aggregation — `\Sigma`#
\Chunk_{\Sigma}#
Chunk(M; size=2) — Aggregation
Split into rows of n items.
M— a listsize— items per row (default 2)
Returns: a list of rows
local batches = $\Chunk_{\Sigma}(T; size=5)$
\Cross_{\Sigma}#
Cross(A, B) — Aggregation
Every pair from two lists (the same as A imes B).
A— a listB— a list
Returns: a list of {a, b} pairs, A-major
local jobs = $\Cross_{\Sigma}(sites, topics)$
sites \times topics means the same thing.
\Debate_{\Sigma}#
Debate(y1, ..., yn; question) — Aggregation
Judge competing answers and return the best one.
y1 … yn— competing answersquestion— what they were answering
Returns: the winning answer, with reasons
print($\Debate_{\Sigma}(claude, gpt; question)$)
\Flatten_{\Sigma}#
Flatten(M) — Aggregation
Flatten nested lists into one.
M— nested lists
Returns: one flat list
local all = $\Flatten_{\Sigma}(results)$
\Join_{\Sigma}#
Join(y1, ..., yn) — Aggregation
Synthesize several outputs into one answer.
y1 … yn— any number of answers
Returns: one synthesised answer
local one = $\Join_{\Sigma}(a, b, c)$
\Map_{\Sigma}#
Map(M; f) — Aggregation
Apply f to every item, concurrently (the same as M \times f).
M— a list or matrixf— a function to apply to each item
Returns: a list of results, in order
local titles = $\Map_{\Sigma}(T; function(t) return t.title() end)$
Runs concurrently. The same as M \times f.
\Pick_{\Sigma}#
Pick(M; n=1, seed) — Aggregation
Take n random items (one item when n=1).
M— a listn— how many (default 1)seed— optional, to repeat the choice
Returns: n items — the item itself when n is 1
local one = $\Pick_{\Sigma}(candidates)$
\Reverse_{\Sigma}#
Reverse(M) — Aggregation
Reverse the list.
M— a list
Returns: a new list
local back = $\Reverse_{\Sigma}(steps)$
\Rotate_{\Sigma}#
Rotate(M; by=1) — Aggregation
Rotate the list by n places.
M— a listby— places to rotate (default 1)
Returns: a new list
local next = $\Rotate_{\Sigma}(queue)$
\Shuffle_{\Sigma}#
Shuffle(M; seed) — Aggregation
Random permutation; pass a seed to repeat it.
M— a listseed— optional, to repeat the same order
Returns: a new list
local mixed = $\Shuffle_{\Sigma}(T; seed=7)$
\Sort_{\Sigma}#
Sort(M; by, desc=false) — Aggregation
Sort by a key function, or by text.
M— a listby— a key function, or omit for text orderdesc— largest first (default false)
Returns: a new sorted list
local big = $\Sort_{\Sigma}(pages; by=function(p) return p.words end, desc=true)$
\Transpose_{\Sigma}#
Transpose(M) — Aggregation
Swap rows and columns of a 2-D matrix.
M— a 2-D matrix
Returns: rows and columns swapped
local cols = $\Transpose_{\Sigma}(rows)$
\Unique_{\Sigma}#
Unique(M) — Aggregation
Drop duplicates, keeping order.
M— a list
Returns: the list without duplicates, order kept
local once = $\Unique_{\Sigma}(urls)$
\Vote_{\Sigma}#
Vote(y1, ..., yn) — Aggregation
Majority vote over outputs.
y1 … yn— the answers to compare
Returns: the most common answer
local agreed = $\Vote_{\Sigma}(a, b, c)$
\Zip_{\Sigma}#
Zip(A, B, ...) — Aggregation
Interleave lists into rows.
A, B, …— lists of the same length
Returns: a list of rows
local pairs = $\Zip_{\Sigma}(urls, titles)$
Framework / agent — `\Lambda`#
\Chat_{\Lambda}#
Chat(tab; prompt) — Framework / agent
Type a prompt into a page and return its reply (the same as tab <- prompt).
tab— a tab showing a chat siteprompt— what to send
Returns: the reply text
local reply = $\Chat_{\Lambda}(grok; "explain Ohm")$
The same as tab <- prompt. Waits for the page to stop changing.
\Fork_{\Lambda}#
Fork(f; n=3) — Framework / agent
Function that runs f n times in parallel and returns all results.
f— a functionn— how many copies (default 3)
Returns: a function that runs f n times at once and returns every result
local tries = $\Fork_{\Lambda}(answer; n=5)$()
\ReAct_{\Lambda}#
ReAct(x; steps=6) — Framework / agent
Agent loop: reason and act with search/open tools, return the answer.
x— the questionsteps— how many reason/act rounds to allow (default 6)
Returns: the answer once the agent is satisfied
local a = $\ReAct_{\Lambda}("who founded Lua and when"; steps=8)$
Opens tabs and searches on its own. The slowest and most expensive operator here.
\Verify_{\Lambda}#
Verify(y; evidence) — Framework / agent
Check y against evidence (returns true/false).
y— a claimevidence— what to check it against
Returns: true or false
if $\Verify_{\Lambda}(claim; sources)$ then print("holds") end