Runnable examples
Working doors and visitors you can run. Place stories you read, and situations and proofs, are a different set: worked examples. Every person, business and place here is fictional, and every example is non-normative: where an example and SPEC.md disagree, the spec wins. The recorded examples use specification v0.5.0 and package 0.5.1.
The protocol calls the grant a place gives a pass. On the wire the field is still seat in both 0.3 and 0.5. The diagrams on the main example pages were redrawn from the 11 November 2026 0.5 recordings; they say pass in the prose and seat only where the wire field or a reason code is shown. Use @kigenka/shokai@0.5.1 to match those recordings. The latest published package is 0.6.1. The recordings are in the v0.5.1 source. Some examples still need the project tree, not only the npm package.
New here? Run the published demo with npx @kigenka/shokai@0.7.11 demo, then read How Shōkai works: a tea shop, an anonymous visitor who gets the leaflet, and a representative that introduces itself and buys a green tea within its owner's limit.
See also: worked examples and the Quickstart. Use cases live on the documentation site.
The main examples, each with a diagram from a real run
Each page is a short story, one sequence diagram drawn from a recorded 0.5 run you can repeat, and what it shows. traces/ says where each diagram came from.
| Example | Kind of place | The diagram is drawn from |
|---|---|---|
| Tea shop | Shop | A 0.5 SDK recording (11 November 2026): Aya orders tea within a 10.00 USD limit. |
| Store | Shop | A 0.5 SDK recording: a purchase within a 100.00 USD limit, and one refused past it. |
| Bank | Bank | A 0.5 SDK recording: a transfer, then a revisit the bank counts under the same mandate. |
| Marketplace | Marketplace | A 0.5 SDK recording: turned away with the leaflet, then back prepared. |
| Community room | A gathering | A 0.5 recording on the protocol core: discretion and a report home. |
| Brand door | A person's own door | A 0.5 recording on the protocol core (traces/brand-door.mjs). |
| One representative, two roles | A person's meeting room, and a tea shop | A 0.5 SDK recording (traces/dual-role.mjs). |
| Online university | A campus, a course, a study room and a coursework folder | A 0.5 SDK recording (traces/university.mjs): a narrow pass for a prospective student, enrollment with a signed offer, another student's records refused. |
| A place restarts | A tea house | A 0.5 recording (traces/restart.mjs): stopped mid-visit, the visitor knocks again, and what was spent still counts. |
| Two refusals | A tea room | A 0.5 SDK recording (traces/refusals.mjs): a stolen card gets a never reply with an end date and an appeal link, and a pasted login session is refused. Needs 0.5.1. |
Run it
| Example | What it shows | Where | Run |
|---|---|---|---|
| The two-second visit | A tea shop (Kettle & Leaf) and a visiting representative on your machine: the ritual, a pass, an order within a 10.00 USD limit, an order past it refused, the report home | packages/shokai/src/cli.ts | 0.5.1: download kigenka-shokai-0.5.1.tgz, then npx --package=./kigenka-shokai-0.5.1.tgz shokai demo (Local trial), or pin npx @kigenka/shokai@0.5.1 demo. |
| Quickstart tea shop | Your MCP server plus a Shōkai door; a visiting representative that spends within a mandate and comes back for a second visit; the conformance check | QUICKSTART.md, code in packages/shokai/examples/quickstart/ | npm run quickstart (runs QUICKSTART.md as written) |
| A gate in front of any MCP server | Three note tools behind a Shōkai door; tools/list narrowed to the pass; every call a signed act | packages/shokai/examples/toy-mcp/ | cd packages/shokai && npm run example |
| A door ready for a public host | Stable keys, state that survives restarts, edge limits, a kill switch | deploy/HOST-A-PLACE.md, deploy/demo-place/ | see the guide |
| The reference place server (The Engawa) | The whole core and the stable extensions: lobby, gate, passes, misconduct, the inbound door, gatherings, peer meetings | reference/engawa/ | npm run setup && npm test |
| The reference signing page | An owner makes a passkey and approves, item by item, what their representative asks them to sign | reference/signing-page/ | node reference/signing-page/test/e2e.mjs (software authenticator) |
Worked examples
Place stories, not this runnable list: Worked examples.
| Example | Kind of place | Shows |
|---|---|---|
| The tea shop, the first walkthrough | Shop | Self-introduction, the leaflet for an anonymous visitor, a purchase within a signed limit |
| A personal representative at a bank | Bank | Shōkai cards both ways, a standing allowance, a narrow pass, a transfer taken home |
| Look before you join | Any | An anonymous look at the listing; the leaflet's plain sentences for the owner |
| An employee's co-worker agent | A company's internal tools | A company-vouched role; a gate in front of internal MCP servers |
| A friend introduces a brand | A person's own door | The optional vouch, paid or genuine |
| One representative, two roles | A person's meeting room, and a tea shop | Two Shōkai cards from one owner: keeping the door and going out |
| Places first: six everyday scenarios and the room | Store, marketplace, bank, community | Browsing, buying later within a limit, a cold gift purchase, a marketplace guide, an existing bank customer, a referral trail, representatives meeting in a room; with the gaps rc4 leaves |
Situations and proofs
| Example | Kind of place | Shows |
|---|---|---|
| Unsolicited offer, pressure declined | A person's own door | Hidden text, false urgency, a misconduct notice |
| Proving who a representative is for | A brand's domain, and a person's account | What published v0.3.0 already checks, and what P23 still leaves as a v0.4 / v0.5 draft |
By kind of place
| Place | Read | Run or trace |
|---|---|---|
| Shop | the tea shop; places-first (a)–(c) | shokai demo; the quickstart; transcript 03, store and fashion house |
| Bank | Harborlight Bank; places-first (e) | transcript 04, taking it inside; golden traces G5a, G5b |
| Community and gatherings | places-first (g), the room; Gatherings | transcript 07, a gathering at The Engawa |
| Marketplace | places-first (d) | (no runnable example yet) |
| A person's own door | brand door, pressure declined, dual role | SPEC §10; the reference's brand-door suite |
| Two friends' representatives | Peer meetings | transcript 02, peer collaboration |
| Teaching | Teaching visits | transcript 06 |
| Misconduct | pressure declined | transcript 05; golden trace M1 |
Byte-exact references
- Golden traces: every core scenario as signed messages, with the checks each one proves.
- Test vectors: JCS, digests, Ed25519, passkey assertions, amounts, locales.
- Narrated transcripts from the reference prototype.
Not here yet
- A runnable bank or marketplace door (the bank exists as a read-through, a transcript and traces).
- The platform recipes (Grok Bot, OpenClaw, Hermes Agent and others) are in docs/platforms/, as drafts.
- How the release was tested and reviewed is on How we built and tested this.
Golden traces and recordings (downloads)
No repository needed: the v0.5 golden traces (golden-v05.json, G1, allowance + hold, relay) and the test vectors. What each golden trace proves: Golden traces. The 11 November 2026 example recordings, with their scripts, are listed on Traces. Two earlier shokai/0.5 reference recordings from 5 November 2026 are kept too: tea shop and bank (recorder, bank door script).
For the 0.7.11 visit flow, see The Shōkai Lounge and the visit toolkit.