Form 0-1 · Standing orders
How a file moves
Every permit type in Sanity names an approval chain. Each chain is a Sanity Workflows definition, deployed into the workflows dataset as a document. Filing an application starts an instance of that definition. The instance is the file's single source of truth.
AI agents run as effects: the engine queues them, this site's server runs them, and their ruling goes back on the instance. Every move between stages is a GROQ condition over that state. Humans fire actions: citizens resubmit, officials stamp, and at the inspection window, you stamp. The engine refuses any action the current stage doesn't offer.
Below are the four definitions as deployed, read back from the dataset just now.
Booth inspection
A scripted applicant at the inspection window. The AI clerk passed the paperwork; the inspector stamps it.
Inspection window
window
Human · Stamp APPROVEDHuman · Stamp DENIED
- → Permit issued · Approved
when $allActivitiesDone && $fields.windowDecision == 'approve' - → Denied · Denied
when $allActivitiesDone && $fields.windowDecision == 'deny'
- → Permit issued · Approved
Permit issued
issued
Terminal stage.
Denied
denied
Terminal stage.
Express permit
Minor whimsy. The AI clerk issues it if the paperwork is in order. No human stamp.
Clerk intake
intake
AI · Clerk Third Class (AI)
- → Referred elsewhere · Refer elsewhere (this thing exists)
when $allActivitiesDone && $effects['clerk-review'].verdict == 'too-real' - → Awaiting the citizen · Request more paperwork
when $allActivitiesDone && $effects['clerk-review'].verdict == 'incomplete' - → Permit issued · Paperwork in order
when $allActivitiesDone && $effects['clerk-review'].verdict == 'complete'
- → Referred elsewhere · Refer elsewhere (this thing exists)
Awaiting the citizen
awaiting-citizen
Human · Resubmit
- → Clerk intake · Back to the clerk
when $allActivitiesDone
- → Clerk intake · Back to the clerk
Permit issued
issued
Terminal stage.
Referred elsewhere
referred
Terminal stage.
Sky permit
Clouds, rainbows, moons. Two agents, then two human signatures.
Clerk intake
intake
AI · Clerk Third Class (AI)
- → Referred elsewhere · Refer elsewhere (this thing exists)
when $allActivitiesDone && $effects['clerk-review'].verdict == 'too-real' - → Awaiting the citizen · Request more paperwork
when $allActivitiesDone && $effects['clerk-review'].verdict == 'incomplete' - → Ministry of Weather review · Paperwork in order
when $allActivitiesDone && $effects['clerk-review'].verdict == 'complete'
- → Referred elsewhere · Refer elsewhere (this thing exists)
Awaiting the citizen
awaiting-citizen
Human · Resubmit
- → Clerk intake · Back to the clerk
when $allActivitiesDone
- → Clerk intake · Back to the clerk
Ministry of Weather review
meteorology
AI · Ministry of Weather (AI)
- → Under-Secretary's desk · Sky clear
when $allActivitiesDone && $effects['weather-review'].verdict == 'favourable' - → Denied · Sky already allocated
when $allActivitiesDone && $effects['weather-review'].verdict == 'unfavourable'
- → Under-Secretary's desk · Sky clear
Under-Secretary's desk
stamping
Human · Stamp APPROVEDHuman · Stamp DENIED
- → Minister's countersignature · Approved
when $allActivitiesDone && $fields.stampingDecision == 'approve' - → Denied · Denied
when $allActivitiesDone && $fields.stampingDecision == 'deny'
- → Minister's countersignature · Approved
Minister's countersignature
countersign
Human · Stamp APPROVEDHuman · Stamp DENIED
- → Permit issued · Approved
when $allActivitiesDone && $fields.countersignDecision == 'approve' - → Denied · Denied
when $allActivitiesDone && $fields.countersignDecision == 'deny'
- → Permit issued · Approved
Permit issued
issued
Terminal stage.
Denied
denied
Terminal stage.
Referred elsewhere
referred
Terminal stage.
Standard permit
AI clerk intake, then a human Under-Secretary stamps it.
Clerk intake
intake
AI · Clerk Third Class (AI)
- → Referred elsewhere · Refer elsewhere (this thing exists)
when $allActivitiesDone && $effects['clerk-review'].verdict == 'too-real' - → Awaiting the citizen · Request more paperwork
when $allActivitiesDone && $effects['clerk-review'].verdict == 'incomplete' - → Under-Secretary's desk · Paperwork in order
when $allActivitiesDone && $effects['clerk-review'].verdict == 'complete'
- → Referred elsewhere · Refer elsewhere (this thing exists)
Awaiting the citizen
awaiting-citizen
Human · Resubmit
- → Clerk intake · Back to the clerk
when $allActivitiesDone
- → Clerk intake · Back to the clerk
Under-Secretary's desk
stamping
Human · Stamp APPROVEDHuman · Stamp DENIED
- → Permit issued · Approved
when $allActivitiesDone && $fields.stampingDecision == 'approve' - → Denied · Denied
when $allActivitiesDone && $fields.stampingDecision == 'deny'
- → Permit issued · Approved
Permit issued
issued
Terminal stage.
Denied
denied
Terminal stage.
Referred elsewhere
referred
Terminal stage.