Skip to main content
GridOS has its own formula engine built into the kernel. Formulas let cells compute values dynamically from other cells, update automatically when dependencies change, and serve as the building blocks for agent-generated financial models. This page covers everything you need to write, read, and debug GridOS formulas.

Formula syntax basics

A cell becomes a formula cell when its value starts with =. Everything after the = is evaluated by the GridOS expression parser.
GridOS formulas are typically written as named function calls with comma-separated arguments in parentheses.

Infix arithmetic

The engine parser does accept the four basic infix operators (+, -, *, /) plus exponentiation (^ or **), so a hand-typed formula like:
works when you type it into a cell directly.
But agents never emit infix. The built-in finance and general agents are instructed to use named primitives (MULTIPLY, MINUS, etc.) for three reasons: auditability (every computation is a named registry call), macro composability (primitives can be wrapped into user macros easily), and cross-provider determinism (LLMs disagree about operator precedence but agree about function names).So you’ll see =MULTIPLY(C3, 0.4) in agent output, not =C3*0.4 — even though both work. Stick with named primitives in anything the agent will read or modify.

Cell references

Reference another cell by its A1 address inside any function argument:
When the referenced cell changes value, every formula that depends on it recalculates automatically.

Excel-ism tolerance

LLMs trained on Excel examples sometimes emit formulas with Excel-specific syntax. The parser normalizes three of the most common patterns before tokenizing, so these work transparently: GridOS has no fill-down semantics, so the $ in absolute refs is semantically meaningless here — it’s just noise the parser strips. Similarly, the percent normalization means =MULTIPLY(C5, 15%) and =MULTIPLY(C5, 0.15) compute identically.

Range syntax

Pass a rectangular block of cells to a function using start:end notation:
A range expands to every cell in the bounding rectangle, row by row, left to right. Empty cells in a range contribute 0 to numeric functions.
Range arguments (A1:B6) are only valid as direct function arguments, not as sub-expressions. =SUM(AVERAGE(A1:A5), B1) is forbidden in cells for the same reason nested calls are — use a macro if you need that composition.

Cross-sheet references

Formulas can reach cells on other sheets in the same workbook with SheetName!A1 syntax. Sheet names containing spaces or special characters must be single-quoted:
Sheet-name matching is case-insensitive. A reference to a sheet that doesn’t exist resolves to #REF! at evaluation time. The agent knows the cross-sheet grammar — ask it “pull A1 from Sheet 2 into B2” or “sum the Data sheet’s A1:A10 into the summary sheet” and it emits the correct qualified reference. The ACTIVE SHEET context in its system prompt tells it where writes land; cross-sheet refs only appear when the user actually asks to read from another sheet.
v1 caveat: the initial read is correct, but upstream changes on the source sheet don’t auto-propagate to the dependent cell. Re-evaluate by touching the formula (enter the cell, press Enter) or by re-running the formula through /grid/cell. Full cross-sheet dirty-tracking is on the roadmap.

Nested calls

No nested function calls in cells. =SUM(MAX(A1, B1), C1) is not valid in a grid cell. To compose functions, create a user macro — macro bodies are the one place where nesting is allowed.
The reason: the preview/apply flow inspects each cell’s top-level formula to compute dependencies and run the pre-apply safety guard. Nesting would make that analysis recursive and much harder to audit. Macros opt in to that complexity explicitly.

Built-in primitives

These 21 functions are always available. Agents receive the authoritative list at runtime, so they will never invent names outside this table. Plugins can add more.

Math functions

Comparison functions

All comparisons return true or false and are most useful as the first argument to IF.

Logical functions

Empty strings and null are treated as falsy by IF, AND, OR, and NOT. Every other value — including 0 and false — follows standard Python truthiness rules.

Formula examples by category

Error codes