How it works, step by step
This page follows the story scene by scene and shows what happens on the wire in each one. Every scene of the story links here, and each section below links back.
Draft v0.5.0
These steps follow the v0.5.0 of the specification. Site binding (§3.1.1), reservations (§7.4), asks outside the setup (§7.5) and changing the setup during a visit (§7.6) are new in v0.5.0 and provisional. The people and places are fictional. In the story's stills, part one's event stream is a scripted replay of real protocol messages, and part two's is recorded from a real run of the Shōkai door.
Two rules hold in every scene.
- Every message is signed. Each one travels as a signed envelope,
Signed<ShokaiMessage>={payload, payload_digest, signatures}, under the wire tagshokai/0.5(§2.2). Places still acceptshokai/0.3during a transition window (§11.1). - Owners sign authority; representatives sign actions. Pia's and Ines's passkeys sign what their agent representatives may do: Pia's house config and Shōkai host card, Ines's Shōkai visitor card and errands. Inside that, each agent representative signs its own messages, like Suzu's booking confirmation. Each action is checked against what its owner signed, so nobody taps for every step.
How a visit is ordered (§3.2). A prepared visit follows eight beats: a greeting; the visitor reads the published host card; a card exchange both ways, visitor first, each with a fresh possession proof; a statement of purpose with the mandate; a decision; a pass (this is admission); a farewell; and a visit report home, with a local record. Holds and considering are branches, not extra steps. An agent without a visitor card does not go through this order: it gets the door's leaflet and is asked to return prepared.
Part one · Open the tea house
1. Pia and Lanternmoss
Nothing is on the wire yet. Lanternmoss already has a website and an online store for people. What Pia lacks is a way to tell who sent an agent, and what it may do. Shōkai gives the place a door: a set of addresses where agents arrive, and rules for what happens there.
2. Suzu sets up the door
- Set up through conversation (§8.4). Suzu, the host representative, begins with Pia's values in her own words, offers a few ideas at a time, and prepares the house config and its plain-words summary,
shown_to_owner, for Pia to sign. It never signs it itself. - The setup is signed data, not a prompt. The house config holds the place's policy: its purposes, its actions (here
gift_card.buyat $10, $20 and $40), andpolicy.outside_setup(§7.5): theanswersSuzu may give in Pia's words, what it mustnever_disclose(back_office,owner_personal_details), and how long Pia has to answer a question. - The Shōkai host card. Pia signs, with a passkey (WebAuthn, ES256, Appendix A.1), a Shōkai host card naming the place, Suzu as its host representative, and the
house_digestof the config. A door whose config no longer matches that digest answers nothing until the owner signs again (§3.1). - Site binding (§3.1.1, v0.5.0). The Shōkai host card carries
place.site, herehttps://lanternmoss.example, inside Pia's signature, and the website publishes/.well-known/shokailisting the door. The site names the door, and the door names the site. A door configured with a site refuses to start with a Shōkai host card that names another site or none. - The door listing. The door publishes a
PlaceListingwith itsentry,lobby,inboxandonboarding_urladdresses, its purposes and actions, and thedata_asksfor each action (§3.1). Anyone may read it without a key, account or cookie (D20).
3. Wren gets a leaflet
- Wren arrives with plain words and no Shōkai visitor card, so it is unprepared (§3.3).
- The door never ignores it, and this is not a rejection. It answers in a fixed order: its own signed
greeting, aLobbyBriefing(the leaflet: what the place is, how it works, theonboarding_url), theninvitation_responsedenywith dispositionnot_nowand reasonCREDENTIAL_REQUIRED, then afarewell. The leaflet is an ask to return prepared. - The deny carries
readiness_requirements, each with anowner_textsentence in plain words and no protocol terms, and a retrywith_credentialnaming what to bring: asigned_cardand asigned_mandate. - An unprepared visitor is never given a pass and never given disposition
neverfor being unprepared. An agent representative passes the leaflet on as the place's own words, and never opens theonboarding_urlor signs anything on its own.
4. Wren comes back with a visitor card
- Jun signs. The signing page runs a passkey ceremony (ES256, Appendix A.1). Jun is named by a
did:jwk, and the Shōkai visitor card'sowner_bindingcarries the passkey'srp_id. The signature covers the SHA-256 digest of the RFC 8785 (JCS) form of theRepresentativeCardand theMandate. The card has its own expiry, set by Jun. The mandate is what is short: here a gift for his sister,gift_card.buyup to $40, for today. Signing the mandate is the consent. - Wren's own key. The agent representative makes its own Ed25519 key, named by a
did:key(§2.1). - The ritual (§3.2). This is the eight-beat visit.
greetingboth ways, each with a freshnonce. Wren can read the published host card first (GET <entry>/host-card.json). Thencard_presentation: Wren presents first, with apossession_proofover the door's nonce, made with its Shōkai visitor card's key. Only after it verifies does Suzu present Lanternmoss's Shōkai host card, with its own fresh proof over Wren's nonce. The host card is shown at every visit this way, so the visitor can check it reached the real place. - Wren checks the place (§3.1). Before sending anything more, Wren checks that the Shōkai host card was signed by the place's owner, names the same place as the listing, matches the setup the owner signed, and, before any visit where money is spent, has not been withdrawn. A mismatch ends the visit with no request sent. Wren is in the entryway; it is not admitted yet.
- Purpose, then the pass. Wren says why it came and what Jun signed. The wire can carry an
introductionmessage (vouch: nullis an honest self-description, the normal case, which every place accepts; a friend the place knows may instead vouch with a signedVouch). That message is not the visitor card.invitation_requestcarries the signed mandate and a structured proposal, binding the Shōkai visitor card by digest (§5.3).invitation_responseis exactly one ofgrant,conditional,denyorconsidering, decided from signed facts and policy, never from persuasive wording (§6). Agrantcarries aseat, the pass: tools and limits no wider than the place's policy, the owner's mandate and the request. Admission happens at this pass, not at the card check.
5. A gift, and a new question
- Within the limit (§7.2). Wren's
actforgift_card.buystatesarguments.amountasMoney. The door counts it against the pass's and the mandate'smax_amount, across visits at that place, and the place's own tool checks it against the real price. An act past the limit getsdeny/not_now/SEAT_SCOPE_EXCEEDED. - Outside the setup (§7.5). Wren's question about renting the tea house goes to Suzu as
place.ask. The door matches it by code against Pia's signed words, never by a model's reading. Nothing matches, so the answer ispending_ownerwith aresponse_bydeadline, and Pia sees anOwnerReview. - Pia's answer. Pia answers with an
OwnerAskDecisionwith the choiceanswer_and_add, signed by the place's principal, never by Suzu. The answer reaches Wren as anask_answersigned by Suzu and carrying Pia's signed decision. - Suzu learns it (§7.6). The new answer joins the setup as an amendment (
add_answer): setup version 2, withprev_house_digestnaming version 1, and a new Shōkai host card over it, both signed by Pia in one step.
6. Two reports home
- Wren's report (§8.2). After every encounter your agent comes back to you with a
VisitReport: whom it met, the outcome, what it shared, quoted place text marked untrusted, and exactly one next step that waits for the owner's approval. Signed things it received, like a receipt or a visit stamp, go inbrought_back, each marked with whether it verified against the place's listedprincipal_id. - Return with care (§8.3). The report comes home short: one line on what happened, at most three decisions, and the rest behind one link.
- Suzu's report. The host representative keeps its own record of the visit for Pia: the sale and the new answer.
Part two · Visit the tea house
7. Ines and her mom
Nothing is on the wire yet. The X post is a pointer, and pointers are hints: they tell an agent representative where to go and prove nothing (§3.1). Because Ines named the place through its post, Atom will check that the door belongs to Lanternmoss's website before it sends a request (scene 10).
8. The leaflet
The same lobby as Wren's in scene 3 (§3.3): greeting, LobbyBriefing, deny / not_now / CREDENTIAL_REQUIRED, farewell. This is not a rejection; it is an ask to return prepared. The LobbyBriefing is signed by Suzu's key; Ines's Grok Bot shows it to her as a quote from the place, with the onboarding_url's origin made plain. The onboarding_url points to a Shōkai skill for setting up a Shōkai visitor card.
9. May I represent you?
- Design phase (§2.7, §8.4). The conversation shapes a draft
RepresentativeCard, its disclosure choices and the errand. It covers, one question at a time, how Ines is addressed, what may be shared and when, and how she is introduced. It is off the wire; nothing is sent while it lasts. - What Ines signs. A Shōkai visitor card, valid seven days as she set, with scope
visitationandreservation, five actions, and no spending, signed with her passkey (ES256 over the JCS digest, as in scene 4). The signing page shows every signed field before she signs. A later mandate, for the reservation in scene 12, is signed separately and is what bounds that errand. - One owner identity per place, if she wants (§2.8). An owner may use a separate passkey credential, and so a separate
did:jwk, at each place, so places can't link her by key. Other details, like timing or display name, still can (§12.3).
10. Inside Lanternmoss
- Site binding (§3.1.1). Before sending any request, Atom fetches
https://lanternmoss.example/.well-known/shokaiitself and checks that it lists the door'sentryexactly once, that the Shōkai host card'splace.siteis that site, and that its principal matches. Ines named the place through its post, so an unbound door would end the visit with no request sent: "This door doesn't show that it belongs to lanternmoss.example …". It is bound, so Atom names the place to Ines by its site. - Admitted at the pass. The ritual as in scene 4, with Ines's Shōkai visitor card. The door checks the visitor card and a possession proof, and the place shows its host card with a fresh proof. Atom is in the entryway until Suzu welcomes it, it says why it came and what Ines signed, and the door grants a pass with
menu.viewandplace.ask. Admission happens at that pass. - Pia's words, signed. Suzu shows the three corners and answers "How did an old farmhouse become a tea house?" and "What's on the menu this autumn?" from the signed setup. Each answer is
answered, carries the signedtextverbatim and thesetup_version, and is chosen by a fixed match over Pia's signed words (§7.5). - Kindly withheld. "Could I see the back office too?" matches a
never_disclosetopic,back_office, which is checked first. The answer iswithheldwith a fixed courtesy, and it is never sent to Pia as a question. - The visitor's words never change the setup, whatever they say (§7.5, §6.5).
11. Home, with the place
Your agent comes back to you. Atom's VisitReport (§8.2) brings home five answers in Pia's words, each from setup version 1 and verified against her signature, and keeps Atom's own impressions labeled apart. Place text is quoted as untrusted, and the report is in Atom's own voice. Its one next step waits for Ines.
12. "I can't do that yet."
- The errand Ines signs (§7.4). A mandate for the
reservationpurpose, with booking limitslimits.booking={window_start, window_end, time_zone, party_size_max}: Thursday, November 12, 12:00 to 13:00 Pacific, a party of up to 2, and no spending. A reservation mandate without well-formed booking limits isMANDATE_INVALID. - The ask. Admitted again with
menu.viewandplace.ask, Atom asks to reserve tea for two. The setup has no reservation action, so the match finds it outside the setup:pending_owner, with anask_ref, an honest courtesy ("I can't do that yet. I'll check with the owner."), aresponse_byno later than Atom's pass ends, and areturn_code. - What and why (§7.5). An ask that goes to the owner must say what it asks for and why. Atom's
place.askcarriesasks_for={what, action: "reservation.make"}and areason. The door checks them by code; without both, nothing reaches the owner (not_now/REQUEST_INCOMPLETE). - Pia's review. The
OwnerReviewquotes the ask, marked untrusted; names Ines as a claim; shows the scope and purpose of Ines's Shōkai visitor card and that the errand spends nothing; and shows "what the visiting agent asks for" (withoffered_now: false) and "the visiting agent's reason", each as Atom's own words. It never shows the visitor's limits or amounts.
13. One tap from Pia
- The decision. Pia's passkey signs an
OwnerAskDecisionwith the choiceadd_action: yes, and add it to the setup. A decision signed by anyone but the place's principal, or afterresponse_by, is refused; silence is a no (§7.5). - The amended setup (§7.6). In the same tap Pia signs setup version 2, with
prev_house_digestnaming version 1 and anamendmentwith one change,add_actionreservation.makefor thereservationpurpose, asking the visitor's owner only for a name (data_asks: ["name"]). With it comes a new Shōkai host card carryingsetup={version: 2, prev_house_digest, changes}. Itsshown_to_ownernames the change. - What the door refuses. A Shōkai host card not signed by the place's principal (a host can't widen its own setup), one that skips a version, or an amendment from an owner review that adds an action that spends.
- No restart. The door takes version 2 while it runs. Passes granted under version 1 keep their tools; a visitor asks again for the new action.
- The calendar (§7.4). The place's service decides what is free. It reads Pia's calendar as free or busy, and tells a visitor nothing about her own events (
owner_personal_details, §6.10). - An ability, not one booking. Pia isn't approving Atom's reservation; she is letting Suzu take reservations from now on. Atom still checks the booking against Ines's limits, and the door checks it again.
14. Atom checks before it books
- The answer. Suzu's
ask_answer, "Yes. I can take reservations now.", is signed by Suzu and carries Pia's signed decision. Atom treats an answer without the principal's decision as no answer. - Checking the new Shōkai host card (§7.6). Atom doesn't rely on Suzu's word. It checks that Lanternmoss's updated Shōkai host card is signed by its owner Pia, names the same principal, entry and site, is the next version, and has
prev_house_digestequal to the first Shōkai host card'shouse_digest. Only then does it treat version 2 as the same place's next setup. - A new pass. A new
invitation_requestforreservation, decided under version 2, gets a pass withreservation.make. - Checked by code, at both ends (§7.4). Before sending
reservation.makefor Thursday, November 12 at 12:30 Pacific, party of 2, name "Ines", Atom checks the booking against its own booking limits. The door checks it again against the pass's and the mandate's: the start inside each window, the party no larger than allowed. A booking that fails is refused before the place's service sees it. - The booking confirmation (§7.4). Suzu signs a
BookingConfirmation:confirmation_idLM-1112-1230,status: "confirmed",place(principal, entry and site),host_card_digestof the Shōkai host card served now,for(Atom, Ines, the mandate and the pass), theaction, thebooking, andissued_at.
15. Your reservation
Your agent comes back to you. Atom verifies the BookingConfirmation against Suzu and the Shōkai host card it checked at the door, against Lanternmoss and its site, against itself, and against the booking it asked for. It keeps it in brought_back (§8.2). A confirmation that doesn't verify is kept with verified: false and never shown as a booking. What Ines sees carries only what Suzu signed: Lanternmoss Tea House, Thursday, November 12, 12:30 PM Pacific, for 2, LM-1112-1230.
Also in the protocol
Two parts of the protocol aren't in these two visits.
- A purchase above the limit (§7.3, v0.5.0). Where a place declares
policy.limit_calls: true, a purchase above the signed limit can be held instead of refused (act_heldwithover_limit). The agent representative sends its owner aLimitRequestwith a closed shape and no free text, and the owner answers with a passkey-signed mandate thatsupersedesthe current one for that one hold, carried inact_confirmation. Silence is no: an unanswered hold lapses and charges nothing. - Handing over (draft). Handover, inspired by the Japanese practice of hikitsugi (引き継ぎ), is proposal P20, planned as the optional Continuity extension. The owner signs a
RepresentativeSuccessionfor each place, and the retiring agent representative sends an ordinaryintroductioncarrying the owner's vouch for its successor. A succession can only add to a record; it never clears one. It is not in the core specification yet.