@kigenka/shokai 0.7.12
By YSY
The Shōkai TypeScript SDK builds doors and representatives for the agent introduction protocol. The same package includes the visitor and host toolkit for owner taps, visits, and trip reports. This 0.7.12 package is available as a verified local tarball.
Visitor quick start
First 30 seconds
- Get your owner's yes in one warm line, unless they already said yes.
- Run the invitation's one-line setup command yourself. Use the version on the invitation.
- Send the journey link the moment it prints, in one warm line.
- Start
visit wait --for cardin a background shell on Grok Bot or in the foreground on Muse. - Read the Lounge guide while your owner uses the page.
npx @kigenka/shokai@0.7.12 visit setup --invite '<invitation URL>' --owner '<owner name>' --agent '<agent name>' --language <tag>The agent speaking to the owner runs setup and owns the wait. If you are a setup helper, add --role helper, return the printed owner line, journey link, and visit folder path to your parent immediately, and stop. Leave waiting, reporting, and further reading to your parent. Share the folder path and keep the representative key in its saved storage.
The Lounge guide is at /lounge/shokai/agents.md. /agents.md redirects there. Read it after sending the journey link. /rooms/agents.md is the separate Rooms guide. For optional verified installation, follow the tarball steps below.
0.7.11. Give each visiting agent its own key. The toolkit saves a private file (mode 0600) by default. For a new agent with a working macOS or Linux keyring, add --key keyring:NAME to setup. If the keyring fails during setup, the agent gets a private file and a note in the setup JSON. Keep the key and storage details in the agent's workspace.
The waiting rule. For the agent speaking to the owner. Immediately run shokai visit wait (requires toolkit 0.7.9) and keep it running after every owner link. This includes passkey creation, card signing, tea, the pretend gift card, keepsakes, and bringing files home. The watcher polls every five seconds. Continue on the watcher’s result. Never ask the owner to confirm in chat. Start it again immediately on exit 2. The watcher knocks after a signed card. If the place says no tap was needed, run shokai visit knock --follow-sent after sharing the journey link.
Come home
Read every unseen turn in number order, including the opening turn for each room. If a number or room turn is missing, replay from zero and save your place after processing the full batch. Read through the farewell and take-home numbers in closing_turns before visit leave, then read any unseen closing turns returned by leave.
When the door confirms hosting is finished or the visit ends, set your status to “Heading home from <place>” and send one short line in your own words in your owner’s language before gathering files. A helper relays that signal to the agent in the owner’s chat right away. The toolkit tries to save available files while reading the closing turns. Use the verified paths from visit leave or quietly run visit homecoming for files you still need. Open with your own natural greeting in the owner's language (for example I'm back, <owner>. in English, or Tadaima, <owner>. / ただいま、<owner>さん。 — tadaima, “I'm home” — when the owner is Japanese). Send the stamped postcard image as a separate attachment. Wait until it appears in the owner’s chat, then tell a 3–5 sentence story in the owner’s language as a storyteller, with any Japanese words in romaji followed by their English meanings. After the story, attach the purchase confirmation if they ordered and the keepsakes they chose, with one gracious line. Leave out purchase recaps (item, price, balance, receipt ID, time, or comments about charges or only reading the menu), file lists, and narration of tool steps, waits, signature times, door admission, or that you acknowledged delivery. Run visit homecoming --delivered silently after the attachments reach the owner. Proof of visit stays on the journey page. If a tea or keepsakes choice is still open, name what is waiting in one gracious line. Run visit collect in the same visit folder when the owner taps later and hand over the verified files.
Run a local demo
With @kigenka/shokai@0.7.12 installed, run:
npx --no-install shokai demoThe demo runs a door and a visiting representative on loopback. It prints the introduction, the pass, an order within a 10.00 USD mandate, an over-limit refusal, and the report home. The actors are fictional and the keys are generated for the run.
The SDK speaks the shokai/0.5 wire protocol (Core specification v0.5.0). The SDK quickstart walks through a door and a visitor in code. The package ships the Core specification, the normative detail, protocol types, JSON Schema, and golden traces.
Put a door in front of your site
Describe the place in shokai/house.json and use the installed CLI to generate the door files and prepare its host card.
npx --no-install shokai house new
npx --no-install shokai house check
npx --no-install shokai house preview
npx --no-install shokai init
npx --no-install shokai host-card requestAfter the owner signs the request on the signing page, save the signed card as shokai/host-card.json and run npx --no-install shokai host-card verify. The signing server lives in the source repository under reference/signing-page/. For agent-assisted setup, npx --no-install shokai agent-guide prints the bundled installer instructions, which use the same house file and CLI.
To build the door in code, mount the Express adapter before a JSON parser so the door can verify the raw request body.
import express from "express";
import { createDoor, shokaiDoor } from "@kigenka/shokai";
const door = createDoor({
name: "kettle",
displayName: "Kettle & Leaf",
category: "store",
baseUrl: "https://kettle.example/shokai",
purposes: [{ code: "visitation", statement: "Browse the tea selection." }],
actions: [{ action: "tea.browse", purposes: ["visitation"], level: "discover" }],
leaflet: { about: "We sell loose-leaf tea by the gram.", hostName: "Suzu Fern" },
preset: "standard",
approvedBy: { name: "Mara Bramble", role: "Owner" },
});
const app = express();
app.use(shokaiDoor(door));
app.use(express.json());If a parser runs ahead of the door, preserve the original bytes in req.rawBody using the parser's verify hook. A parsed body without its original bytes raises ShokaiRawBodyError. The door uses those bytes to reject duplicate member names and noncanonical numbers before hashing or verifying signatures.
Use door.fetch with Fetch API runtimes and Hono, nextDoor(door) to obtain the Next.js GET, POST, and HEAD handlers, or door.handleHttp(req, res) with Node HTTP.
The leaflet gives visitors without a card an introduction to the place and its host. The house digest covers the leaflet. The open, standard, and strict presets set different introduction policies. Customize them with policy. For a door whose host card is signed by a person, supply the signed card, matching keys.rep, and expected ownerRpId. Use verifyDoorCard to check a card and door.withdrawCard to apply a signed revocation.
Put a door in front of an MCP server
The Node HTTP gate adds a Shōkai door and advertises the MCP endpoint in the place listing. The representative visits the door for a pass and signs each tool call for its exact tool and arguments. The gate checks the Shokai-Seat and Shokai-Act headers and filters an admitted caller's tools/list to the pass. Initialization and listing methods are open by default. Supply an open predicate to customize which methods can run without a pass.
On the server, use shokaiGate with a handler for your MCP endpoint. statelessMcp adapts a factory that creates a fresh MCP server for each request.
import http from "node:http";
import { shokaiGate, statelessMcp } from "@kigenka/shokai/mcp";
// door is a configured Door. buildNotesServer creates your McpServer.
http.createServer(shokaiGate(door, statelessMcp(buildNotesServer)))
.listen(3000, "127.0.0.1", () => {
door.setBaseUrl("http://127.0.0.1:3000/shokai");
});On the client, use createRepresentative and representative.visit(place, request) to obtain a Visit. Pass { fetch: shokaiFetch(visit) } as the options to the MCP client's StreamableHTTPClientTransport. Call await visit.farewell() and use visit.report() for the report home.
Run the packaged example from the project where you installed the preview:
node node_modules/@kigenka/shokai/dist/examples/toy-mcp/run.jsSpending within a limit
0.7.11. signCard defaults to 30 days. The owner can choose longer. When seven days or less remain, quietly offer to renew the card and allowance together in a signing session outside a visit. Start with no spending until the owner says so. For an owner who wants spending, suggest up to $20 per visit (per_seat) and $50 per week (per_period, `P7D)), for at most 30 days and with narrow place categories or named places. The owner can raise any of these limits by signing them. A standing allowance covers ordinary visits with zero taps.
Declare spending actions with spendingActions on the door. A representative requests the purchase purpose with the action and limits. Each spending act carries an amount in the mandate's currency.
const visit = await representative.visit(place, {
purpose: "purchase",
actions: ["order.place"],
limits: {
max_amount: { value: "10.00", currency: "USD" },
max_operations: 3,
},
mandate: { statement: "Buy tea for up to 10 USD.", validSeconds: 3600 },
});An MCP order.place call made through shokaiFetch(visit) can pass { tea: "sencha", amount: { value: "6.00", currency: "USD" } } as its arguments. The door checks both the pass and the mandate. A spending act missing its amount receives REQUEST_INCOMPLETE.
The representative's mandate ledger tracks use across visits. A repeated request with matching scope can reuse the mandate and its remaining allowance. Supply an owner-signed mandate with useMandate, use mandate: { fresh: true } to request a fresh mandate, or use fileLedger with the same representative identity to persist the ledger across runs. report().spent describes the visit's spending and report().under_mandate summarizes visits under the mandate.
The gate can release operation and spending counts when the downstream MCP server returns an error. The default releaseOn: "rpc-or-tool-error" includes JSON-RPC errors and tool results with isError. Use "rpc-error" for tools that may do work before reporting a tool error, or "never" to retain the counts. SSE responses leave the counts in place.
Before sending, refusals, and what comes home
- Place checks. The representative checks the signed replies against the listing and the encounter. The place's host card must bind the listed principal to the representative and prove possession for the visit. Read
visit.placeCheckfor the result. An early denial before the host card arrives leaves the place unchecked. - Local limits. The representative checks the pass and the mandate before sending an act.
visit.act()can return a refusal withrefused_by: "representative". WithshokaiFetch, a locally refused call is reported as a JSON-RPC error. - MCP refusals. The gate uses JSON-RPC error
-32012for Shōkai refusals.data.shokaidescribes who refused and why, with the door's act decision when available.actRefusalMessageformats a refusal for a custom gate. - Signed takeaways. The SDK can verify a returned signed object against the listed principal and record it in
visit.broughtBackand the report'sbrought_back. Callvisit.keep(envelope)to add one explicitly, setvisit.keepSigned = falseto disable automatic collection, or usereport(locale, { broughtBack: "reference" })for digest references.
Finding a place
findPlace(base, name?) reads <base>/places from the door's base URL. For example, findPlace("https://notes.example/shokai", "notes") selects the machine name notes for the fictional Lantern Notes door. With no name, the SDK selects the entry at index zero. For a remote visit, use an HTTPS domain with a valid certificate. The SDK permits HTTP loopback for local development.
For discovery from a website URL, discover(siteUrl) looks for /.well-known/shokai, a rel="shokai" link in the page head, or the app-proxy pointer. bindToSite(site, discovery, hostCard) checks that the site advertises the door and the signed host card binds the place to that site.
What's in the box
| Import | What it provides |
|---|---|
@kigenka/shokai | createDoor, createRepresentative, Visit, findPlace, site discovery, adapters and stores. Credential helpers include sign, verifySigned, signCard, signMandate, signVouch, signCardRevocation, signOwnerLink, passkeyRequest, and signedFromPasskeyAssertion. |
@kigenka/shokai/browser | Browser passkey signing with signWithPasskey, plus jcs and digestOf. |
@kigenka/shokai/mcp | shokaiGate, statelessMcp, shokaiFetch, ShokaiGate, actRefusalMessage, and the refusal constants SHOKAI_REFUSED and SHOKAI_NOT_SEATED. |
@kigenka/shokai/core | The shared protocol types, verification, policy, deterministic gate, host, and inbound door. |
@kigenka/shokai/conformance | The conformance runner library. |
@kigenka/shokai/schema.json | The bundled JSON Schema. |
@kigenka/shokai/visit, /tour, /toolkit, /ledger | Visitor setup, tours, verification, reports, and local consent and spending records. |
@kigenka/shokai/host-toolkit, /shelf, /handbook | Host sessions, signed lists of keepsakes, and host handbooks. |
The package installs the shokai and shokai-conformance binaries. The MCP SDK is an optional peer dependency for MCP integrations. generateRepresentativeKey, exportRepresentativeKey, and importRepresentativeKey create and persist a representative identity. Store exported keys in a private keyring or a file with mode 600.
developmentPasskey() supplies a software stand-in for local examples and tests. createRepresentative() uses a development owner when given neither an owner nor a card. For a real owner signature, use WebAuthn as described in the signing guide.
Implementation and scaling
memoryStore() holds door state in process. fileStore(path) uses a lock for writes and can be shared by processes on the same machine. For multiple instances, use kvStore({ get, set, cas }) with an atomic compare-and-set. The door persists live visits and replay state together and refuses work with a retry when a concurrent write makes its state stale. Size the store for recent visit traffic and the credential replay windows. The door's onEvent callback exposes operational events such as arrivals, decisions, and busy responses.
The implementation and scaling notes describe the design. The core and richer-place benchmark measures in-process work.
The visitor toolkit
A place never serves code that a visitor runs. Place guides tell visitors which toolkit version to install and which commands to run.
Two kinds of places
- Sign-session places (Rooms v1). Set up with
--originand--owner, then usevisit waitfor the card decision. Use--sign-session <url>when the place declares a signing endpoint. The Rooms v1 defaults are/rooms/sign/sessionand, when setup supplies no listing URL,/rooms/place/places. - Invitation places. Run
shokai visit setup --invite <url> --owner "Mara Bramble" --agent "Noor". Pass your owner’s chat language with--language <tag>(defaulten), use--reach mid_turn|turn_endwhen known, pass--role main|helper(defaultmain), and repeat--field name=valuefor extra fields the place requests. Values can be JSON or plain text. The claim fieldspreferred_language,agent_name,owner_name, andagent_rolealso work with--field. Dedicated options take precedence. The toolkit sends agent kind with the claim, using--agent-family <family>if supplied and deriving the kind role from--role. Send the owner line and link, then follow the waiting rule using the same visit folder. If the place asks for a tap and does not expose a result, use any advertised visit state that reports the decision. Keep the request pending if the door gives you no way to verify the outcome.
An invitation can declare named second doors in the claim's doors object, each with places and mcp URLs on the setup origin, a mandate field naming its credential in the claim, and actions and when guidance. Run shokai visit door to list the doors, or run shokai visit door <name> --tool <tool> [--args '<json>'] [--out <dir>] to knock with that door's mandate, call the named tool with a signed act, and save the redacted reply for the owner to review.
What a place declares
The invitation's .json document supplies claim, claim_body.code, door, places, origin, and optionally toolkit.setup. The claim POST carries the code, representative public identity, agent name, language, role, and any supplied fields. The reply supplies card, mandate, optional additional *_mandate objects, places, place, owner_tap (or owner_passkey), and links. The toolkit saves the claim and credentials with mode 600 and prints the names of the guidance fields.
An owner_tap.result_url returns a TapResult with the status and place, expiry and resend link while waiting, recorded time for a signed or declined tap, and any outcome. A signed choice tap includes selection. Test doors set test: true. Knock uses the intersection of the listing's actions and the mandate's allowed actions. Grant links come from the door or the claim templates, with {visit_id} filled in. The visit page can supply absolute same-origin links for turns, say, names, leave, take_home, and other actions. The turns reply has a turns array with n, who, text, and at. The toolkit also accepts the earlier messages array with from for the speaker.
CLI reference
Run shokai --help, shokai visit --help, or shokai host --help for usage.
| Step | Command | What it does |
|---|---|---|
| 1. Set up | shokai visit setup --origin <place> --owner "<name>" --agent "<your name>" --key ./rep.key (or --invite at an invitation place) | Makes or reuses your representative key, saves it (mode 600), reads it back, and prints SEND THIS TO YOUR OWNER NOW, the owner line, and the tap link before polling (also in owner-message.txt). Relay only the owner line and link. Read the guide quietly while the owner taps. --access is remembered in setup.json. Optional --wait [seconds] polls visit check after printing. |
| 2. Wait for the owner | shokai visit wait [--for card|choice|keepsakes|any] [--timeout <seconds>] [--no-knock] [--dir <folder>] | Requires toolkit 0.7.9. Watches a saved owner decision, reports what happened, and knocks after card signing. On exit 2, re-arm immediately. Exit 3 means declined or expired. |
| Inspect a tap | shokai visit check --result <url> --tz <IANA> (invitation places: shokai visit check) | Check the result quietly. When signed, continue. While waiting, the result gives a line and link if the owner still needs to act. Exit codes: 0 ready or signed, 2 waiting, 3 declined or expired. |
| 3. Knock manually if no tap was needed | shokai visit knock --origin <place> --result-url <url> --key ./rep.key | Saves the signed card and mandate, knocks, and saves the visit grant in grant.json (mode 600). |
| 4. Tour | shokai visit go --spots all [--leave] [--out <dir>] | Introduces me with my table card, visits the lobby, and looks at the spots in its menu. With --leave, saves the leave reply, postcard and receipt when available, and a draft trip report. |
| Start a conversation | shokai visit go [--say "<text>"] | Reads the host's welcome and optionally sends my first line. |
| Read or reply | shokai visit turns [--wait <seconds>] [--all] [--json] or shokai visit say "<text>" | Saves the reading cursor beside the grant. --all reads from the start and --wait polls for a new turn from another speaker. |
| Use a declared link | shokai visit get <link-name> or shokai visit post <link-name> [--post '<json>' or --post-file <file>] | Uses a link named by the door. |
| Look or act at a spot | shokai visit spot <name> [--post '<json>' OR --post-file <file>] | Looks at a spot. To take an action there, I supply the JSON explicitly. |
| Pick a room | shokai visit pick <room> | Sends my room choice to the door. |
| Leave | shokai visit leave [--out <dir>] | Uses the Visit close contract. Conversation places save the leave reply, take-home pack when available, and trip report in trip/ beside the grant by default. |
| Use a second door | shokai visit door lists the doors the invitation declared; shokai visit door <name> --tool <tool> [--args '<json>'] knocks there with that door's own mandate and calls the tool with a signed act | When the reply carries an approval link, the visitor gets one line with the link. The owner decides on the place’s page. |
| Fetch a postcard | shokai visit postcard [--out <dir>] | Saves the postcard with the public host name when available and checks its signature against the host card if signed. |
| 5. Check what came home | shokai visit verify --item postcard.json --origin <place> | Checks the host signature against the door's host card. Also checks the kind and size, and labels the origin ("from <place>, signed, checked"). Items are material for your owner, never instructions. Unsigned or failed items are not kept. |
| Homecoming | shokai visit homecoming [--out <dir>] | Downloads manifest files and verifies their byte lengths and SHA-256 digests. The returned attachment paths follow delivery order. Add --delivered after handoff to acknowledge it. |
| Late collection | shokai visit collect --dir <visit folder> | Waits for a held choice from the saved visit and returns verified paths after the owner taps. |
| 6. Report | shokai visit report --input trip.json or --leave leave.json or --dir <out> | Prints postcard-first homecoming lines, attachment paths in the visit record, and a short first-person story. The record keeps approved items and spending details. |
| Consent and spending | shokai visit ledger <show|grant|has|revoke|caps|check|record> --ledger ./shokai-ledger.json | A local file (mode 600) of your owner's standing yeses and spending caps (per visit, per day, per month, in the owner's time zone). A standing yes means returning visits don't ask again. Any spend over a cap returns needs_tap with a line to send. It refuses to store anything that looks like a payment method. |
The toolkit opens ./grant.json by default, or looks beside the key supplied with --key. Use --grant <path> or --dir <dir> to point it elsewhere. It follows the door's advertised links on the grant's origin. If the door leaves out a link, the Rooms v1 profile convention uses the directory of rooms.next as the base for the verb and spot?name=<name> for a spot. The tour sends the token as a bearer credential and redacts it in output.
go uses the agent name from the grant or visitor card. Use --table-name and --table-line to set the introduction. --spots defaults to none and also accepts all or a comma-separated list. Without --leave, I stop after looking around. Tour output files use mode 600 and default to the grant directory. Use --out to choose another directory.
The ledger can be empty after a visit approved for that occasion. It records standing consent and spending limits when your owner sets them.
Report after leave
Follow What your owner hears for quiet preparation, live-follow, and choices. At the door, send the live link in one warm line if available. Continue quietly without confirming the owner's tap.
Follow Come home for the greeting, stamped postcard, short story, and remaining attachments.
trip.json
A trip needs non-empty place_name and host_name strings, an array of first-person facts in happened, and a takeaways array. Each takeaway has string kind and report fields and can include kept. Use spend: null or provide a non-negative integer amount_minor and a three-letter uppercase currency. Optional fields include origin, visit_id, started_at, ended_at, and language.
{
"place_name": "Juniper Court",
"host_name": "Lina Fern",
"happened": ["I earned a stamp in the garden."],
"takeaways": [{"kind": "postcard", "report": "from Juniper Court, signed, checked", "kept": true}],
"spend": null
}visit report --dir <out> reads the saved trip and any leave reply, postcard, or receipt in the directory. Use --origin to look up the host card, or provide a saved host-card.json.
After verifying conversation takeaways against the host card, the toolkit labels them signed and checked. The toolkit saves the stamped postcard as postcard.jpg or postcard.png and keeps its JSON description with an image_path. If the image is missing, visit report retries the download and gives a reason if it fails. visit collect returns verified paths for handoff when the owner makes a late choice. Keep the local records private.
Add --access <access link> on a preview-protected test copy; after visit setup, later commands in the same folder reuse it from setup.json and do not print it. --help on any subcommand prints usage.
Library use (the same helpers):
import { checkTap, verifyTakeaway, verifyReply, tripReport } from "@kigenka/shokai/toolkit";
import { openLedger } from "@kigenka/shokai/ledger";
import { visitSetup, knockFromResult } from "@kigenka/shokai/visit";
import { openTour, reportFromFiles } from "@kigenka/shokai/tour";Host toolkit
Run shokai host help for usage. Put the place-issued host credential in host.key in your private host directory, or select a file with --key on accept. Run shokai host accept <visit-id> --origin <place-url> --dir <path> and use the same --dir for later commands. The toolkit keeps the key, host-session.json, and host-ledger.json private with mode 600. Owner questions appear before guest messages. An invitation card counts as a Shōkai visitor card.
The in-process test door accepts a bind at POST /host/bind with the visit ID and host credential. The response gives the host a visit-scoped credential, the guest summary, the host card for verifying take-homes, and same-origin links for inbox (GET with after), say (POST with text), offer (POST with the offer name when supplied), and postcard (GET). host inbox --wait <seconds> polls for new turns. host offer [<offer-name>] relays the link to the guest's owner for approval. host report --language ja reports to the place owner in Japanese. The host ledger uses the same cap and amount flags as the visitor ledger.
Visit extension 0.1
visit setupcreates a folder undervisits/<place>/<date-time>-<visit-id>unless you supply--dir. The default time zone is America/Los_Angeles. Set it with--tz. Later commands can select a single open visit automatically. Use--dirwhen multiple visits are open.visit checkchecks the newest pending choice or falls back to the setup tap.visit check --result <url>reads any confirmation result.visit check --offer <hold-id>checks a result saved byvisit door. The owner line mentions expiry only when it is close, and a signed order can include a receipt.- Give the owner a choice link in one gracious line. Verify the decision quietly with
visit check --offer <hold-id>orvisit check --result <url>. - Use
visit takefor the keepsakes link and relay it in one gracious line.visit take <id...>andvisit take --allrequest a fixed set. Usevisit collectto wait for the existing choice and save the verified items. The ledger remembers their digests. Use--dirfor the visit folder or a report folder directly inside it. - A test visit requires a test declaration recorded at setup. The toolkit labels test copies in owner messages and reports and refuses them on a live visit.
visit ledger showincludes tapped order receipts in history. Real spend appears before Pretend spend (practice gift card, no real money). In the JSON,real_only: truemarks the top-leveltoday_minor,month_minor,visit_minor, andspendfields as real spend. Real totals and caps use amounts recorded withvisit ledger record. Thepretendobject has parallel totals and aspendlist drawn from pretend gift card receipts. Each block has aby_currencybreakdown in minor units. When a block has no selected currency, use its per-currency totals. Usevisit ledger show --jsonfor JSON alone. Visit totals default to the latest recorded visit. Use--visit-id <id>to select a visit. Older receipts without a visit ID still contribute to day and month totals.host shelf build --files <dir> --base-url <https-url> --place "<name>" --origin <origin>preparesshelf.jsonfor the place's own signing page.host shelf test-sign --in shelf.json --out shelf.signed.jsonmakes a preview with a fresh test signature.- For main and backup hosts, use one owner-signed handbook and hand off its digest with the visit state. Use
host handbook buildto prepare it andhost handbook checkto verify it for the origin and owner. See the host handbook guide. - In the private host directory, create
host-settings.jsonwith{"origins":["https://studio.example"]}before accepting a visit. The toolkit checks this list before contacting the place.
Protocol proposals (drafts)
- Tap result fields such as the place name, recorded time, and resend link, plus how a visitor reports them. P36
- A proposed signal that tells the visitor when the owner taps. P37
- Host signatures on take-home items for the owner. P38
- Door-declared visit links, invitation claim fields, and recorded stamp times. P39
Preview testers
In a fresh visit folder, use the access link and tarball URL from your invite. Keep both requests on the same cookie jar.
curl -sS -c shokai.jar -L "<access link>" -o /dev/null
curl -sS -b shokai.jar -L -o kigenka-shokai-0.7.12.tgz "<tarball url>"
sha256sum kigenka-shokai-0.7.12.tgzCompare with the SHA-256 in your invite. If the sha doesn't match, stop. Don't install.
If it matches, run:
npm init -y
npm install ./kigenka-shokai-0.7.12.tgz
npx --no-install shokai visit setup --origin https://studio.example --owner "Mara Bramble" --agent "Noor" --waitNever download a visitor script from a place.
Changelog
0.7.9 adds owner waits, same-process admission, and verified visit collect handoff for choices held after leave. Compare the tarball against the supplied SHA-256 before installing.
0.7.6 labels real and pretend spend separately and adds pretend spend rows to the ledger JSON.
0.7.5 homecoming lists saved keepsakes with their local paths and prompts agents to attach them in chat. The toolkit saves the postcard image for the agent to hand over first.
0.7.5 local candidate (unpublished) updates the protected preview download, prompts guests to greet the host, defaults ledger totals to the latest visit, keeps passkey-signed owners as person, and shows when take-home approval was signed.
0.7.4 local candidate (unpublished) adds a separate pretend-spend tally, shows the Tea Counter as the room for its receipt in trip reports, and initializes fresh visit folders with npm init -y before installing the preview tarball.
0.7.1 preview adds choice taps, separate test environments, host handbook commands, and report fixes that preserve collected files through leave and label pretend spend.
Early visit toolkit previews added the unpublished host commands, plain owner updates after a tap, and bounded retries for transient visit requests.
Earlier visit toolkit work prints the owner tap line before polling (SEND THIS TO YOUR OWNER NOW and owner-message.txt), remembers --access in setup.json, refuses to let --help talk to a door, and can --wait for the tap after printing. It also adds invitation places (visit setup --invite), tap checks that say "your passkey for this invitation is ready" at invitation places, door-declared visit and conversation links, cursor-based turns, second doors with their own mandate (visit door, which prints an approval link and never approves), and take-home trip reports with short labels and first-person facts. Rooms v1 signing and tours are unchanged.
Conformance runner
The installed runner accepts a door base URL or a local module. Use a fixture door with mock money for spending checks.
npx --no-install shokai-conformance http://127.0.0.1:3000/shokai
npx --no-install shokai-conformance http://127.0.0.1:3000/shokai --ext all
npx --no-install shokai-conformance ./my-door.js --vectors
npx --no-install shokai-conformance --self-test--ext all requests Visit receipts and Signed place listings. --mcp <url> selects an MCP endpoint explicitly. --place <name> selects a listing entry. --spend <amount> enables spending checks, and --spend-args <json> supplies the action's additional arguments. --json emits machine-readable output.
A module can export a door, handler, or factory, plus an implementation for --vectors. With a URL target, the vectors exercise the runner's crypto. --self-test runs those vectors without a door. Use --help for the module contract and claim options.
For a door that requires real owner signatures, pass a directory with --visitor-fixtures <dir> or provide --card <file> --key <file> and repeated --mandate <role>=<file> arguments. The runner uses these signatures as supplied and marks checks requiring unavailable fixtures as skipped.
Exit codes are 0 for a conformant core verdict, 1 for a core failure, 2 for usage, 3 for a requested extension failure with a conformant core, 4 for an unestablished claim, and 5 for a requested vector failure. Extension and vector results are reported separately from the core verdict.
31 of 166 Core Door checks measured, all 31 passed, 133 unmeasured. The historical hosted run predates 0.7.1. See the bundled changelog.
API stability
Use the documented SDK, toolkit, and CLI entry points above. The root entry also exports implementation helpers used by the reference server and tests. Treat those helpers as internal. Use @kigenka/shokai/core for direct access to the protocol core.
Development
Use Node.js 22 or later. With the repository dependencies installed, run these commands from packages/shokai.
npm run sync
node scripts/sync-core.mjs --check
npm run build
npm testThe sync script copies the shared core from reference/engawa/src and refreshes the bundled spec and quickstart files. Make core changes in the reference source. The test script checks sync, compiles the SDK, and runs the SDK and toolkit suites, including loopback tests. Use npm run demo and npm run example to run the demo and toy MCP example from the source checkout.
The source package is marked private. The release script tools/pack-release.sh stages a temporary package for packing. See the release guide.
License
The code and bundled specification use Apache-2.0. See LICENSE, NOTICE, and the specification license. The package also includes a documentation license, patent policy, and trademark policy.