Internal circular · Not for citizens · Citizens may read it anyway
How the Ministry works
The process is not code. It is a workflow definition stored in Sanity, next to the submissions it acts on. Every run is a document too: which stage it is in, what the clerks said, who pressed what, and when. The public site only reads the workflow back.
- Front DeskTake a number. The number is also a form.
- Department of PedantrySomething is always missing.
- Department of Rubber StampsWe have never said no.
- The ArchiveEverything is somewhere.
- The Minister's DeskA human. Allegedly.
- Office of CertificatesSuitable for framing.
- On the WallSuitable for framing.
The corridor
- Front Desk. Your form is stamped in automatically. If a department sends it back, this is where you answer.
- Department of Pedantry. An AI clerk reads your form and finds the one thing missing. It cites a regulation it made up. Answer it and it accepts, grudgingly.
- Department of Rubber Stamps. An AI clerk approves everything and says something that proves it did not read the form.
- The Archive. An AI archivist files your form. Every third serial is lost, once. You get a receipt and go back to the Front Desk.
- The Minister's Desk. A human. Approves with a note, rejects with a reason, or refers the file back to a department. One hour to rule, or the Department of Delays sends the file back to the Archive, which loses it.
- Office of Certificates. A certificate document is written with the clerks' remarks as stamps, rendered to an image, and a Discord webhook announces it.
What is Sanity here
- Submissions, departments, clerks, certificates and receipts are documents in dataset
ministryof projectv6745vem. - The clerks' personalities are content: a clerk document holds the system prompt. Slide the temperament in Studio and the prompt rewrites itself. Their portraits are generated by Agent Actions from that prompt.
- The corridor is a Sanity Workflows definition. Each department is a stage; each AI clerk is an effect; each human decision is an action. Both move the run through the same transitions. Guards freeze the form while a department holds it.
- Effects run in a Sanity Function that wakes when a run gains unclaimed work. The clerks call Agent Actions (Prompt) with the form as a GROQ parameter. A second Function ticks the clock once an hour for the Department of Delays.
- The Minister's back office is an App SDK app in the Sanity Dashboard: the corridor as a live board, one file open at a time, a workflow diagram, and the same actions the CLI can fire.
- The definition has a test suite that runs the real engine in memory: the lost loop, the delays, the guards, all without a network.
Built for the Sanity Challenge on DEV. The code is public; the link is in the post.