Skip to content

tutorial

Chapter 4 of 5

Chapter 4 — Spend what you loaded

by Rod Rivera Published

Scoped instructions let one skill offer a returning customer their usual account and still handle everyone else.

A personalized greeting is the visible half. The useful half is spending that knowledge later, where it saves the customer a step.

The bundled view_transactions skill asks which account, every time. We know Jordan’s usual account. Asking anyway is the same anonymity, one turn later.

Scoped instructions

A scoped instruction is a top-level if: branch in the skill body. The model is shown only the branch that currently applies:

if: not session.view_transactions.selected_account_id and session.project.default_account_id
The customer has a usual account on file: @memory.project.default_account_label.
Offer that one first by name — for example, "Want your usual
@memory.project.default_account_label, @memory.project.customer_name?" If they
say yes, set `selected_account_id` via `set_fields` to
@memory.project.default_account_id. If they'd rather use a different account, or
they already named one clearly, instead call `fetch_accounts`, present the
accounts, ask which one they want, and set `selected_account_id` to the matching
account id.

if: not session.view_transactions.selected_account_id and not session.project.default_account_id
Call `fetch_accounts` to load the customer's accounts. Present them and ask which
one they want.

if: session.view_transactions.selected_account_id
Call `get_recent_transactions` for the selected account and present the returned
rows briefly (date, merchant, amount).

Three states, three sets of instructions, one skill. A customer with a default account is offered it; a customer without one gets the list; once an account is chosen, both converge on the same final branch.

The model never sees the branches that do not apply, which is why this scales better than one long instruction full of caveats.

Two details that are easy to get wrong

The if: must be at the top level of the skill body. Indented inside an instructions: block it is not parsed as a condition at all — it stays prose, and the model is asked to evaluate something it cannot. This fails silently: nothing errors, the branch just never works.

Reference memory as @memory.… in prose. The session.… form is correct in conditions and structured fields like requires:, but inside instruction text it is passed to the model as literal characters. Two spellings, two places:

Where Form
if: conditions, requires:, complete_when: session.project.default_account_id
instruction prose @memory.project.default_account_id

The result

you  show my transactions
bot  Here are your most recent transactions for Everyday Checking:
     2026-07-28  Blue Harbor Market   -$42.18
     2026-07-26  Northline Transit     -$3.50
     2026-07-24  Cedar & Co.          -$68.00
     2026-07-22  Payroll Deposit   +$2,150.00

No account question. The agent already knew.