Extractors
Each schema field lists extractors in order; the first that yields a non-empty value wins.
| Kind | Options | Yields |
|---|---|---|
header | name | The first value of that header. |
mailbox | source: from, to, reply_to; part: address, name, domain | That part of the mailbox. |
regex | pattern (use a named group (?<value>…), else the first group, else the whole match), flags (default i), source (default body) | The captured text, with offsets. |
labeled_value | labels (tried longest first), value (regex for the value, default rest of line), source | The text after Label:, Label #, or Label - at the start of a line. |
constant | value | The value. Useful as a last-resort default. |
source is one of subject, body, from, from_name, to, reply_to, attachments, all_text.
Confidence
Each value's confidence says how much its match is worth, by extractor kind: a labelled value 1, a regex 0.8, a mailbox or header 0.5, a constant 0.3. It is halved when a transform or type coercion fails, and a mailbox name beside no address scores 0. Policy's auto_accept.min_confidence compares against it, constants excepted (they are configured defaults, not evidence): 1 admits only labelled matches, 0.8 admits regexes too, 0.5 admits structural fallbacks.
Lists
A string[] field is split on newlines by default, because product names carry commas. Set split on the extractor to commas, semicolons, lines_or_commas, or none.
Tables and repeating groups
An HTML body's tables arrive as rows of visible cell texts (layout tables with one cell a row are not tables; hidden cells are not cells), and tabular text (a PDF's text layer, a plain-text invoice) is read as a table when two or more lines split into the same number of cells on tabs or runs of two spaces. get_message shows them as tables. Three extractors read them:
{kind: "table_cell", row: {header: "Grand Total"}, column: {index: 1}}— one cell: the row named by a text in any of its cells (orindex), the column named by its header in the first row (orindex).sourceas for regex (body,attachments,all_text);tablepicks one when several have the headers.{kind: "table_rows", columns: {item: "Item", qty: "Qty", price: "Price"}}— every row of the first table whose header row has all the named columns, as objects; for anobject[]field. Rows with an empty first named column (totals, spacers) are skipped.{kind: "regex_rows", pattern: "^(?<sku>[A-Z]{2}-\\d+)\\s+x(?<qty>\\d+)$"}— every match of a pattern with named groups as an object; flags default togim; for anobject[]field.
An object[] field declares its columns with fields: {item: {type: "string", required: true}, qty: {type: "integer"}}; each column is coerced and checked like a field of its own, and a row that fails makes the field fail validation.
Transforms
A regex with g among its flags gathers every match into a list, one per match, for a string[] field: headlines in a newsletter, line items, links. {"kind": "regex", "pattern": "\\n\\n\\s*(?<value>[^\\n(]+(?:\\n[^\\n(]+)*)\\s*\\(\\d+ MINUTE READ\\)", "flags": "gi"} reads a TLDR issue's headlines whole, wrapped lines and all. The field's position is the first match's.
transforms is an ordered list applied to the extracted text. If one fails, the raw text is kept with confidence 0.5. Besides the named transforms, {"expr": "…"} is a CEL expression over value (the text so far; see expr on the predicates page) whose result becomes the value: {"expr": "replace(value.trim(), \"BL-\", \"\")"}, {"expr": "double(value) * 100.0"}, {"expr": "value.split(\"-\")[1].upperAscii()"}. CEL's own string methods (trim, split, substring, upperAscii, lowerAscii, matches, size, indexOf) plus one function of ours, replace(text, from, to). Refused at save time when it does not parse.
| Transform | Effect |
|---|---|
"trim", "upper", "lower", "collapse_whitespace", "first_line" | As named. |
"number", "integer" | Parses $1,234.50, (12), 1 234. |
"date" | Parses 2026-09-19, 9/19/2026, September 19, 2026, 19 Sep 2026 to YYYY-MM-DD. Numeric dates are read month first; use a regex extractor to reorder day-first sources. |
{"replace": {"pattern": "regex", "with": "text"}} | Global, case-insensitive, multiline replace. |
{"default": value} | Substitutes when the value is empty. |
Type coercion runs after transforms based on the field's type, so a date field needs no explicit "date" transform.
Coordinates
Each value's source records source, documentId (for attachments), start and end offsets into that text, and extractorIndex (which extractor in the list produced it).
This page as Markdown.