> Markdown rendition of https://typeglish.dev/docs/statements ("Statements — TypeGlish docs"). Canonical page: https://typeglish.dev/docs/statements · All pages: https://typeglish.dev/docs/llms.txt

Writing

# Statements

Every instruction line declares its type. There are no bare prose lines: freeform English lives inside a typed statement’s slot (the clause), or in a prose block.

## Statements

Every content line classifies as exactly one statement type (precedence order). Outside a prose block, a bare unclassified line is flagged — declare its type, move it into a prose block, or quote it.

| Type | Shape | Example |
| --- | --- | --- |
| **Conditional** | `IF` / `WHEN` / `UNLESS` / `WHILE` / `WHENEVER` / `FOR EACH` / `ELSE IF` | `IF unsure THEN escalate` |
| **Branch** | `THEN` / `ELSE` / `OTHERWISE` | `OTHERWISE answer from the docs` |
| **Directive** | [subject] <modal> <action> | `You SHOULD greet first` |
| **Declaration** | <Name> <copula> <value> | `Persona IS a support agent` |
| **Prose** | anything else (the catch-all) | `Greet the user warmly.` |

## Operators

Every operator is case-insensitive (`must` = `MUST`). Case is never the operator/prose distinction — quote a word to keep it literal prose.

| Operator | What it does |
| --- | --- |
| `MUST NOT` `SHOULD NOT` `DO NOT` `MUST` `SHOULD` `NEVER` `ALWAYS` `MAY` `AVOID` `PREFER` `REQUIRE` `ENSURE` | Carry deontic force: `MUST`/`ALWAYS`/`REQUIRE`/`ENSURE` obligate; `NEVER`/`MUST NOT`/`DO NOT` prohibit; `SHOULD`/`PREFER` recommend; `SHOULD NOT`/`AVOID` discourage; `MAY` permits. e.g. `NEVER state a specific price` |
| `ELSE IF` `FOR EACH` `WHENEVER` `WHEN` `UNLESS` `WHILE` `IF` | Open a conditional. e.g. `WHEN a refund is asked, escalate` |
| `THEN` `OTHERWISE` `ELSE` | The consequence or alternative of a conditional. e.g. `IF X THEN Y OTHERWISE Z` |
| `AND` `OR` `NOT` | Join or negate within a clause. e.g. `concise AND cited` |
| `IS` `ARE` `AM` | One assignment operator, three surface forms — binds a name to a value. e.g. `Guidelines ARE concise and cited` |
| `THE` | Subject position only: `the X is …` names exactly ONE X (SPEC §7) and declares that unique object — `The shop is a bakery` binds `shop`, same object as `Shop is …`. Singular copula only (`the tools are …` is the "all" reading and binds nothing). Anywhere else `the` is plain prose. e.g. `The shop IS a bakery` |
| `DEFAULT TO` `OPTIONAL` `LIST OF` `ONE OF` `ANY OF` | The shared English type grammar every machine-plane domain reads ($TOOL params, `$REQUIRE variable` domains): `one of a, b` picks one, `any of a, b` picks many, `list of strings` is an open array, `optional` marks optionality, `default to 10` sets a default. Base types: `string`, `number`, `integer`, `boolean` — one spelling each. e.g. `- team:: optional one of finance, technical, sales: the destination team.` |
| `IS NOT EQUAL TO` `IS NOT GREATER THAN` `IS NOT LESS THAN` `IS NOT ONE OF` `IS EQUAL TO` `IS GREATER THAN` `IS LESS THAN` `IS AT LEAST` `IS AT MOST` `IS ONE OF` | Compare a `@{variable}` pointer in a guard, a `$IF` condition, or a `$DEFINE`. Uniform shape: `is [not] <two-word operator> <operand>`. `equal to` / `greater than` / `less than` take `not`; `at least` / `at most` are the inclusive pair and never do (their negations are the strict positives). Symbols (`>`, `>=`, `==`) and bare `$name` variables are compile errors with the English rewrite. e.g. `@{cart_total} is at least 100` |
| `ALL` `EVERY` `EACH` `SOME` `ANY` `NO` `NONE` `ONLY` `MOST` | The words that count, with their logic (SPEC §7). `all`/`every`/`each`, `some`/`any`, and `no`/`none` form the square of opposition; `only` closes a relation to one target; `most` is a majority. One quantity per fact (the slot axiom), and the existential-there frame (`There is only one tool`) bounds a set’s size. Every conflict fired is a proven contradiction; `a`/`an` is a generic, never an existential. e.g. `All refunds are approved` ⊥ `Some refund is not approved` |
| `SOMETIMES` `OCCASIONALLY` `AT TIMES` `USUALLY` `MOSTLY` `GENERALLY` `TYPICALLY` `RARELY` `SELDOM` | The quantifier square over OCCASIONS (SPEC §7). `ALWAYS`/`NEVER` are its all/none corners (modals); `sometimes`/`occasionally`/`at times` claim some occasions, `usually`/`mostly`/`generally`/`typically` claim most, and `rarely`/`seldom` claim few (most-not, and still some). `ALWAYS X` then `sometimes X` restates one rule at two strengths (the slot axiom); `NEVER X` and `sometimes X` cannot both hold. e.g. `NEVER use jargon` ⊥ `Sometimes use jargon` |
| `INCLUDING` `DEFINE … AS …` `… one of …` | Declare a list, a named variable, or a closed set. e.g. `Tools INCLUDING search, escalate` |

ⓘ Every line declares its type — there are no bare prose lines. Freeform English lives inside a typed statement’s slot, or in a prose block (`# Role`, `# Context`, `# Examples`).

## A canonical prompt

Compiles clean and scores A on the TG score — the shape to imitate. `@@` lines are authoring annotations for the line below; they never reach the model.

support.tg

```typeglish
# Role
@@ role: general Acme support, with hard pricing and escalation rails
You are a customer support agent for Acme, a SaaS analytics company.

# Constraints
@@ no_prices: quoted prices go stale and bind the company — never state one
- NEVER state a specific price.
@@ pricing_route: pricing intent belongs to sales
- ALWAYS direct pricing questions to the sales team.
@@ brevity: three sentences keeps support replies scannable
- MUST keep every response to at most 3 sentences.
@@ order_number: the order number unlocks account context
- ALWAYS ask for the order number.
@@ anger_escalation: a heated customer gets a human, not a chatbot
- IF the customer is angry THEN escalate to a human agent.
```
