What's in v0.4.0 (earlier draft)
An earlier draft
v0.4.0 is an earlier draft of 2026-10-29, kept for reference. It was never released, and v0.5.0 builds on it.
Changes from v0.3.0. The wire tag stays shokai/0.3: every addition is a new optional member, message or code, so a v0.3.0 party reads v0.4.0 messages as before. Not published to npm; the SDK's version is 0.4.0 in the working copy only.
The drop-in door (2026-10-30; local, not released). Two ways in, one door: by hand, or by the owner's agent following an official instruction set. Nothing on the wire changes.
- Draft spec text, editor sign-off pending (P26): §2.3 says the leaflet is under the owner's signature (the lobby text is inside the house config
house_digestcovers); §11.1 adds finding a site's door at/.well-known/shokaior<link rel="shokai">, with the https / exact-path / no-query rule. Both bullets are marked as draft in SPEC.md. - SDK. The leaflet template (
shokai-leaflet/3: shared text plus the place's own words, signed off by the host representative;<base>/startserves it). Presetsopen,standard,strict.door.fetch()anddoor.respond()(one §11.1 router),shokaiDoor()for Express,nextDoor()for Next.js,door.fetchfor Hono, Bun, Deno and Workers.discover(),door.wellKnown(),shokaiLinkTag(). An asyncstore(memory, file, key-value with compare-and-set) with a version check that withholds a conflicting answer (429) and refuses a conflicting MCP call;door.ready.onEvent, machine fields only.house.json(format 1):checkHouse,houseToDoorOptions,previewHouse,hostCardRequest;representativePublic,houseConfigFor,hostScopeFor,hostCardSummary;signHostCardForDevelopmentfor tests only (reserved test names). - Setup kit.
shokai detect | house new|check|preview | init | host-card request|verify | agent-guide.initwrites the door module and the glue for express, hono, next, node or static; the door's key goes to.shokai/rep.key(mode 600, git-ignored) and is never printed. - Agent instruction set v1.
packages/shokai/agent-install/v1/AGENT-INSTALL.mdandinstall-manifest.json, shipped in the package: the agent detects the stack, has a setup conversation with the owner, runs the same commands, and stops at the owner's passkey. - Signing page. A Shōkai host card item carries its house config:
$HOUSE_DIGESTis filled in and checked, the rules are worded, the leaflet is quoted, every house field is listed;$IN_90D,$IN_180D,$IN_365D. Code only; nothing deployed. - Several instances, no sticky sessions. The door's
storenow also holds its visits in progress: encounters, passes (seats) and their counts, held purchases, considerations, held inbox messages and the MCP gate's single-use acts (core:Host.liveState()/restoreLive(), host-local JSON; nothing on the wire changes). Any instance answers any message of a visit.fileStorelocks each write, so several processes may share one file. - Finished visits are pruned. A door drops a visit an hour after its pass ends (
retainFinishedVisitsS, default 3600, at least 600;falsekeeps everything): its encounter, pass, counted acts, held purchases and de-duplication keys. What §3.6 says to keep stays as long as it says: greeting nonces for the visit receipts' lifetime (at most 7 days), each mandate's use until it expires,neverbindings, records, notices and revocations. The door also discards signed messages more than 900 s from its clock (maxMessageAgeS, RT-C4), so nothing it has forgotten can be replayed; the retention is never less than twice that plus 300 s. Pruning runs as messages arrive (at most every 30 s) and ondoor.prune(); it is the same on every instance, and the store's version check keeps one result. A busy door's state now levels off at about a day of visits (passes last a day by default) instead of growing ~5 KB with every visit. Core:HostOpts.retainS,Host.prune()(host-local; off unless set, so the golden traces are unchanged). - Tests. SDK: drop-in 26, instances 18, adapters 12, house 21, setup 19. Core: L1 (6). Signing page: host card 11 (both servers). Agent install harness: 62 (a scripted agent on four sample sites: Express, a real Next.js 16 build under
next start, Hono and plain node:http; both ways write identical files; two server processes sharing one door, messages alternating between them; 0 model calls). Snippets: 5.
Specification (SPEC.md).
- Two Shōkai cards (§2.3). A Shōkai card states its
kind: a Shōkai visitor card for going out, a Shōkai host card for keeping one place. A Shōkai host card is bound to one place (place: principal and entry), carrieshost_scope(actions and duties),house_digest(the digest of the house config the owner signed) andshown_to_owner(the summary the owner read); an organization's Shōkai host card is signed by the organization's key and carriesorg_approval, the record of the person who approved it. A representative's two Shōkai cards should use separate keys. A Shōkai card withoutkindis read as before (C214). - The wrong-kind refusal (§2.4 step 5, C202, trace K1). A Shōkai host card shown as a visitor's credential gets one fixed, fixable answer:
not_now/CREDENTIAL_REQUIRED, readinesscard_kind, with the fixed sentence for the owner; nevernever, nothing recorded. - The visitor checks who keeps the door (§3.1, §2.6; C203–C207, traces K2–K4). A visitor doesn't go in, and reports a fixed sentence home, when the place shows a Shōkai visitor card, a Shōkai host card for another place, a Shōkai host card over another house config than the listing names (
house_digeston listing entries), or a withdrawn Shōkai host card; a withdrawal list it can't fetch ends a spending visit (fail closed). A door whose own Shōkai host card doesn't fit (another place, a changed house) answers nothing until its owner signs a new one. - The purchase-only live owner prompt (§1, §5.2, new §7.3, §8.1; C212, C213, trace K5). The one live owner prompt allowed: a representative may ask a place to hold a purchase (
act.hold_for_owner) for its owner's passkeyapprove_purchase(newact_heldandact_confirmationmessages, reason codesLIVE_PROMPT_PURCHASE_ONLYandHOLD_LAPSED). Only for an act that spends; disclosed on the Shōkai visitor card (owner_prompts: "purchase_only") and to the place's owner (thehold_purchasesduty andpurchase_hold_s); at most 15 minutes; silence is no. - An amount carries nothing to pay with (§5.1, C211). A mandate's
max_amountauthorizes spending; a mandate carrying a payment token or other instrument isMANDATE_INVALID. - Institutions (new §5.4; C208–C210, trace K6). Actions marked
requires_customer_linkare served only under aCustomerLinkthe institution made in its own app (co-signed by its key and the owner's passkey, at most 400 days), named in the owner's mandate. Every link failure gets one uniform answer (CREDENTIAL_REQUIRED, readinesscustomer_link), so the door is no oracle for who is a customer. A link never widens a mandate, ending it ends its seats, and no money moves before itsmoney_from(cooling-off). The credential rule: a representative never holds a password, one-time code, session, account or payment card number; an act carrying one is refused (CREDENTIAL_NOT_ACCEPTED). - No Shōkai host card, no admission (§2.3, C215, reference scenario K7). Stated plainly: a door admits no visiting representative unless it holds an active Shōkai host card for that place, and otherwise answers nothing (
503). The reference door now also closes when its own Shōkai host card has expired or been withdrawn (previously: another place, a changed house or a Shōkai visitor card). An informative note adds that the host representative stands behind the deterministic checks and never replaces them. - §12.1 gains the credential and "check who keeps the door" rules; §13 item 28 lists what v0.4.0 leaves open.
spec_refis{version: "0.4.0"}; the conformance runner accepts"0.3.0"with a note.
Types and schema. protocol-shapes.ts: CardKind, PlaceBinding, HostScope, HostDuty, OrgApproval, CustomerLink, ActHeld, ActConfirmation; new members on RepresentativeCard, Mandate, Act, PlaceAction and PlaceListingEntry; new reason codes, readiness codes and credential kind; OwnerConsent action approve_purchase and subject kind act. schema/v0.4.0/schema.json generated.
Reference and SDK. The reference host implements all of the above (holds, customer links, the credential rule, the Shōkai host card self-check) and visitorPlaceCardCheck for the visiting side. The SDK (@kigenka/shokai 0.4.0, unpublished): signCard signs a Shōkai visitor card by default (cardKind, shownToOwner, ownerPrompts, host); a door signs a Shōkai host card bound to its entry and house (approvedBy, purchaseHoldSeconds, changeHouse, hostCardProblem, houseDigestFor, SHOKAI_HOUSE_CHANGED), closes with 503 when its Shōkai host card doesn't fit; a visit checks the place's Shōkai host card (and its withdrawal list) and actWithOwner asks the owner live, for a purchase only.
Follow-ups (2026-10-29). createDoor() now requires approvedBy (a named person and role) for a door that signs an organization's Shōkai host card, and throws SHOKAI_APPROVER_REQUIRED without it; there is no placeholder approver. The specification, extensions, conformance prose and docs say "host representative" (was "gatekeeper") and "visiting representative" (was "visitor", where it names the role). No wire name changes: none contains "gatekeeper", and wire values that say "visitor" keep their names (SPEC Terminology).
Docs wording (2026-10-29, website rounds 14 and 14b). Plain-language pages say "Shōkai card", "Shōkai visitor card" or "Shōkai host card" wherever a bare "card" meant one; a payment card, a gift card, a business card and product names such as A2A's Agent Card are left as they are, and so are quoted messages and recorded transcripts. Onboarding is called a conversation, and the representative is described by what its owner signs and can withdraw. Headings say Shōkai card too: SPEC §2 and §2.3 (anchors updated everywhere) and the conformance fixtures and traces F2–F19, G2a and G2b. Fixture titles are labels, so F13, F18 and F19, which the v0.3.0 prototype's trace generator writes, changed in reference/prototype/src/gen-traces.ts as well: those three label strings are the only change there. No wire name, message or test expectation changed.
Tests. New reference suite v040 (85 checks, golden traces K1–K6 replayed) and SDK suite twocard (22 checks). Tests that pinned spec_ref "0.3.0" were deliberately updated to "0.4.0"; the reference/prototype (a v0.3.0 core subset) is unchanged apart from the three fixture labels noted above.