Give context
Context tells the AI what world the data lives in. It is not a long prompt.
“A person’s name” is not the same on an ID form and on a game nickname. Context gives the AI that frame.
You do not write a huge prompt. You pass short facts: domain, purpose, audience, locale.
How to write it
It can be a string or an object. A string is stored as { notes: [that text] }.
The object can use these keys: domain, purpose, audience, locale, channel (strings), notes (a list of strings), plus any keys your app needs (tenant, plan, …).
Four places to put it
The most specific level wins. notes pile up. Other keys are overwritten: the one closest to the rule stays.
const edcheck = createEDcheck({ provider, context: { domain: "software services", locale: "es-BO" },}); const Project = edcheck.define(schema, { context: { purpose: "create_project", audience: "client" }, nodeContext: { address: { channel: "web" }, }, rules: { fullName: semantic({ intent: "A plausible full name for a real person", context: "As written on the ID", }), },});- Instance (
createEDcheck): applies to everything. - Schema (
define): applies to this object. - Node (
nodeContext): applies to one field and its children. - Rule: applies to that rule only.
locale does not change which rules run
locale is information for the model (“this is Spanish from Bolivia”). It does not turn rules off or change the instructions. It also does not translate by itself.
If two rules end up with the same context, they still ride in one request. If a rule has a different context, EDcheck opens another request just for that group.
Do not name a field context
The context key is reserved on the state sent to the AI. A path or nodeContext that starts with context is rejected.