Skip to main content
Context GrammarDesign for context-aware AI

Context Grammar · Stage 4

The Rule Engine: Turning Context into Action

Practical help must fit the whole situation and keep the promises people made. The Rule Engine is where those agreements, and the lines never to be crossed, live—out of the model’s reach.

Rule Engine

English audio

Read transcript

The quick-meal judgment

"I need to leave in twenty minutes. Something quick, please." A great server doesn't just look for a dish that cooks fast. They choose something that won't burn your mouth when you're in a rush. A meal that is fast to cook is useless if it's too hot to eat quickly. The kitchen needs a truly practical solution: a meal that is quick to serve and easy to finish. The Rule Engine does that exact same thinking for AI.

01 · Read

Now picture a school morning: fifteen minutes to pack a lunchbox and get out the door. The assistant checks ingredients, dietary restrictions, and preparation time. It knows you bought eggs yesterday, but it doesn't know if there is cooked rice left in the pot. So, it simply asks. That first step is Read: gathering what you said, checking existing records, and recognizing what is still unknown.

02 · Match

There is rice, about eight minutes left to cook, and a child’s dietary needs to respect. The assistant suggests rice balls and a rolled omelet. When time is short, you need one solid option, not a long comparison of recipes. This is Match: applying clear rules like "when time is short, choose a meal that can be ready on time." It makes the server's instinctive judgment explicit and dependable.

When rules meet

Spoken instructions are wonderful when your hands are busy cooking. But if the family is still asleep and you asked for quiet, speaking aloud is the last thing you want. A silent prompt on a nearby screen is much better. When rules pull in different directions, the engine resolves the tension: honoring boundaries, respecting house rules, and choosing the quietest, most sensible path forward.

03 · Emit

The plan is set: suggest rice balls and an omelet, keep the steps brief, and let the parent choose. Emit passes that decision to the interface. On a smartphone, it shows a clean checklist and an action button. On a distant kitchen screen, it renders large text you can easily read from across the room. The core instruction stays rock-solid, while its presentation adapts to the device in front of you.

Requirements before preferences

"Can we try a different flavor today?" The assistant can easily swap seasonings or side dishes. But it will never compromise on food allergies. Hard requirements come first, every single time. Personal preferences, taste, and variety come right after. Like a careful host, it stays completely flexible about your wishes while remaining unflinching about your safety.

The same rules, a new place

The lunchbox is packed, and you head out to the car. The detailed kitchen steps vanish. Shopping lists can wait until you arrive, rather than demanding your attention behind the wheel. Only urgent, time-sensitive alerts should gently interrupt. You don't have to rebuild your settings every time you move; the engine applies the exact same values to your new surroundings.

A guess is not an agreement

"You seem busy" is just an AI hunch—and hunches can be wrong. "Ask before buying" is a clear agreement you established. A floating guess about your mood must never rewrite a firm boundary. Given the same inputs and the same version of the rules, the rule decision arrives at the same conclusion. That deterministic consistency is what earns lasting trust.

Propose · Check · Present

When the assistant prepares tonight's grocery order, three systems work as one: the Rule Engine shapes the proposed action, the Negotiation Gate verifies permissions, and AX Patterns shape an editable review. To you, it feels like a single, seamless flow: review the proposed order, make a quick edit, and decide whether to place it.

One source, different views

At work, your immediate team might need granular research figures. Another stakeholder only needs the clear summary they are cleared to see. From a single source of truth, the system assembles the right view for the right audience. The rhythm is universal: gather the facts, apply the rules, and tell the interface what to present.

Read · Match · Emit

"Why this lunchbox today?" The answer is right there in plain sight: fifteen minutes until departure, and ingredients already at home. If the choice missed the mark, you can easily inspect the logic and adjust the rule. Read, Match, and Emit: understand the situation, apply the agreements, and deliver the right response. That is how intelligent assistance stays clear, accountable, and entirely yours.

A parent packs rice balls and an omelet into a lunchbox while a child waits at the door.
Fifteen minutes, one lunchbox: read what is known, ask what is missing, choose what fits.

01 / The quick-meal judgment

A fast dish can still be the wrong dish

You tell a server, “I need to leave in 20 minutes.” Soup can be cooked in three, but if it arrives too hot to eat, the quick preparation has solved the wrong problem. A good server thinks through both clocks: when the food is ready and how long you need to enjoy it.

AI needs the same kind of judgment. A response may be generated instantly yet take too long to read, check, or act on. The Rule Engine turns what the system knows about your goal, situation, and boundaries into a practical next step. It is the decision layer between understanding you and showing you something useful, and it is where your agreements and firm lines are kept, outside the model, so the model cannot rewrite them.

A diner in a hurry speaks with an attentive restaurant server

02 / Read

Start with what is known—and mark what is not

Now it is a school morning. You have 15 minutes before leaving and need a lunchbox. The family Brain remembers an allergy and that eggs were bought yesterday. But a purchase record does not prove the eggs are still there. Nor does it tell the assistant whether any rice is left in the pot.

Read brings together the current Intent, the Situation Signals, the Relationship Dials, and relevant Brain facts. It keeps their sources and freshness visible. If one missing fact changes the answer, the assistant asks only for that fact: “Is there rice left?” It should not make you repeat everything it already knows—or pretend that an old clue is a live inventory check.

A family planning a school lunchbox before departure
01 / Known

15 minutes until departure; the child’s allergy is on record.

02 / Uncertain

Eggs were purchased yesterday; that does not confirm they remain.

03 / Ask once

Is there rice left in the pot?

03 / Match

Choose a response that fits the whole morning

Suppose you confirm the rice and eggs. After packing and getting shoes on, only eight minutes remain to cook. A list of twelve recipes is not helpful now. Match checks what is possible, removes anything that breaks a firm requirement, and selects one useful option: rice balls and a quick omelet.

The choice is not based on speed alone. It also respects the child’s allergy, what is on hand, the time to prepare and pack, and how much attention you can spare. These priorities become explicit rules, so a comparable situation does not depend on the assistant improvising a new standard each time.

Rice balls and a quick omelet proposed for the lunchbox

04 / Resolve a conflict

The whole room matters, not just one signal

Your hands are covered in cooking oil, so speaking might seem convenient. But the family is still asleep. A “hands busy → speak aloud” rule and a “keep the room quiet” rule pull in different directions.

The Rule Engine resolves that conflict before anything is shown. It can put one short, silent instruction on a nearby display and wait for a glance, instead of announcing it. A device’s capability never overrules a privacy or safety boundary; if no safe channel is available, the assistant waits or asks later.

A quiet kitchen display while the family sleeps

05 / Emit

One decision, shaped for each screen

Emit packages the decision as a structured instruction called a ui.command. It might say: suggest one lunchbox, show only essential steps, do not speak aloud, and leave the final choice to the parent. This is a description of the response, not a finished picture of a screen.

On a phone, the same command can become a short touch checklist. On a kitchen display, it can become two large, glanceable steps. The useful meaning stays consistent while the layout and input method fit the surface in front of you.

Shared decision

Rice balls + omelet · 8 minutes · silent · parent decides

Phone · touch checklist

1. Shape rice balls 2. Cook omelet

Kitchen display · glanceable

RICE BALLS → OMELET

06 / What the Engine holds

Agreements, the ask, leeway, and lines

The Rule Engine holds four things. Agreements: what the person said, in their words, with a date and a reason. The ask: what was requested, and where it ends. Leeway: room to adjust within the ask. Anything at the ask’s edge or beyond it is offered to the person, never done unasked. Lines: what is never crossed.

A food allergy is a line. So are a privacy boundary and a budget ceiling you explicitly set. The Engine excludes options that cross them, even if those options look convenient or popular.

Flavor, a side dish, or how a suggestion is presented can be flexible. The assistant may offer a different seasoning when an ingredient is missing. It may not trade away an allergy rule to save two minutes. When facts are missing, it asks or falls back to a safe option rather than quietly treating a requirement as a preference.

The same four apply when building with AI. The 19 tasks that were asked for are done. The 3 issues noticed along the way lie beyond the ask, so they are offered as a list, not fixed. Fixing them would be a new decision for the person.

Agreements

“Ask me before buying” · words, date, reason

The ask

One lunchbox this morning · done when it is packed

Leeway

Flavor · side dish · presentation · anything more is offered

Lines never crossed

Allergy · privacy · budget cap

07 / From kitchen to commute

The same person enters a different moment

A few minutes later, you are driving. The lunchbox decision remains in memory, but the kitchen checklist no longer belongs on screen. Hands and eyes are needed for the road. The assistant suppresses non-urgent details; if a time-critical route change is needed, it uses the car’s safe, brief channel—or waits when even that would distract.

You did not edit a profile between rooms. Updated physical, attention, priority, and device signals changed the allowed response. The rules stayed in place; the current context changed what they produced.

A driver concentrating on the road while the interface adapts

08 / Guesses and agreements

A hunch cannot grant permission

“You seem rushed” is an inference. “Ask me before buying” is an agreement. The assistant may use the first to shorten a suggestion, but it cannot use it to skip the confirmation you asked for. Missing or stale signals lower certainty; they do not raise the Autonomy Dial.

Given the same state—the same inputs, agreements, and rules—the Engine reaches the same permission result: proceed, ask, or stop. How that result is expressed may vary, because a model writes the wording, and live facts may change. The permission result itself can be tested and traced: which facts were read, which rule won, and why the action stopped or proceeded.

The architecture, after the story

Read → Match → Emit → the next stages

The narrative above has a precise counterpart. This diagram is a reference for what each part owns; it is not a demand that every interface show these terms to the person using it.

01 / 04

Read

Intent + Signals + Dials + Brain facts; preserve source, freshness, and unknowns.

02 / 04

Match

Apply lines, agreements, the ask and its leeway, and priorities; resolve conflicts. Anything beyond the ask becomes an offer.

03 / 04

Emit

Produce a device-neutral ui.command describing content, density, channel, and decision authority.

04 / 04

Next

Negotiation Gate checks whether to proceed, ask, or stop. AX Patterns render the behavior.

For builders: inspect the rule, not just the result

A context schema defines valid signal and dial values; rules define conditions, effects, and precedence; a shared command vocabulary keeps surfaces aligned. The Engine should record the input facts and rule identifiers behind each decision. High-priority safety and trust guards cannot be bypassed by a lower-priority convenience rule. Rule numbers, rule counts, and priority values in the specs are the current version: reference, not definition.

intent + signals + dials + brain
  → read(source, freshness, unknowns)
  → match(requirements, preferences, authority)
  → ui.command(content, density, channel, decision_by)
  → negotiation_gate → AX patterns

Try the same rules in two moments

Switch between kitchen and car. The rule set stays the same; only the current signals and the resulting command change.

Signals in

Hands busy · family asleep · 8 minutes

ui.command out

Show one silent lunchbox suggestion on the kitchen display. Parent chooses.

09 / One source, many windows

The right detail for each audience

The same decision can also have different authorized views at work. An engineering teammate may need raw telemetry and unresolved risks. An executive may need a concise outcome and a confidence note. An external client should see only the agreed proposal and timeline.

The Rule Engine can request a suitable view, but the Disclosure Dial and access permissions decide what each recipient may actually see. It does not make sensitive data safe by merely placing it in a prettier layout. If a required permission or fact is missing, the system withholds that detail and asks for review.

Work information presented differently to team and external audiences

10 / Transparent and adjustable

Make the reason visible—and the mistake repairable

A helpful answer should be able to explain itself in ordinary language: “I suggested rice balls and an omelet because you had eight minutes, confirmed rice and eggs, and asked me to avoid this allergen.” That lets you notice a wrong assumption immediately.

If the calendar was wrong or the rice is gone, you can correct the fact and see the suggestion change. The system records which rule was used, so designers can improve a recurring mistake without making you start from scratch. After the Engine proposes a response, the Negotiation Gate decides whether it can go ahead, needs your confirmation, or must stop.

Next chapter

Next: when should the assistant ask?

The Rule Engine proposes a response. The Negotiation Gate checks the risk, confidence, and your boundaries before an action crosses into the world.