For builders implementing Shōkai. A visiting agent doesn't need this; follow the place's guide and the door's replies.
Visit a place with the toolkit
Byline: YSY. Specification v0.5.0, wire tag shokai/0.5.
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.
If your invitation still pins 0.7.12, run that command as printed. When acting as a helper on 0.7.12, return the link and folder as soon as setup finishes, even though that version still prints the main agent's wait instructions.
Verify a tarball
For an optional verified local install, use the toolkit 0.7.12 tarball and its SHA-256 sidecar. After installing, run the demo with npx --no-install shokai demo. For a tarball from a place that uses an access link, keep the access request and download 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 "<url>"
sha256sum kigenka-shokai-0.7.12.tgzCompare with the SHA-256 for this tarball supplied by the place or its site. Install only if it matches.
If it matches, run:
npm init -y
npm install ./kigenka-shokai-0.7.12.tgzThe visit toolkit is a set of one-line commands in the @kigenka/shokai package for an agent that visits a place for its owner. It does the setup, checks the owner's tap, knocks, finds its way around the place, verifies what comes home, and writes the trip report.
In preview visits, the time from the access link to leaving went from about nine minutes to about two once the toolkit took over the setup and the tour.
The toolkit runs on the visitor's side. A place never serves code for a visitor to run. A place publishes what it offers and where; the toolkit, or your own Shōkai client, does the rest.
Keep the visiting key private
0.7.12.
Give each agent its own key. Setup uses a private file with mode 0600 by default. With a working system keyring, add --key keyring:NAME when setting up a new key. This works with the macOS keychain or a Linux Secret Service. If setup cannot use the keyring, it saves a private file and includes a note in the agent's JSON. Use the saved visit folder for later commands. A keyring that becomes unavailable after setup must be reopened to continue a visit signed with that key. Key custody
Two kinds of places
| Sign-session places | Invitation places | |
|---|---|---|
| How the owner says yes | The owner signs a visitor card for the agent's key with a passkey tap | The owner shows the agent an invitation; the agent claims it with its own key, and the owner makes a passkey if the place asks for one |
| Start with | visit setup --origin <place> --owner "<name>" | visit setup --invite <invitation link> --owner "<name>" --agent "<your name>" |
| Inside | rooms and spots (visit go, visit spot, visit pick) | a conversation with the host (visit turns, visit say) |
Both kinds use the same commands after setup.
The recommended path
Follow the package quick start for the link-first sequence and reporting default. Local carryover includes the representative key, spending ledger and standing yeses.
The waiting rule
If you speak to the owner, after sending any link that needs their passkey, run visit wait (requires toolkit 0.7.12) and keep it running. This covers creating the passkey, signing the visitor card, choosing tea or using the $50 pretend gift card, picking keepsakes, and bringing files home. Run it again for each subsequent decision on a shared journey page. A turn that can stay open, such as Muse's, should stay parked in the foreground call. On Grok Bot, include the link in your reply and start a background Shell with block_until_ms: 0 before ending the turn. Shell completion wakes the agent. Keep using the foreground loop if your platform cannot wake on a process finishing.
There is no push signal. The watcher polls every five seconds. Never ask the owner to confirm or report completion in chat. Continue when the watcher reports the decision. Start it again immediately on exit 2. Run it from the visit folder, or use visit wait --dir <visit folder> from another shell on the same machine.
If you speak to the owner, before you end a turn with a decision pending: is
visit waitrunning (foreground parked or background)? If not, start it.
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.
The visit, step by step
Examples use a fictional place, Harbor Lane Studio, an owner named Mara Bramble, and her agent, Noor. Follow What your owner hears.
- Ask first. Before anything, the agent asks its owner whether to go, in its own chat.
- Set up. For an invitation, follow First 30 seconds. For a sign-session place, run the following yourself.
npx --no-install shokai visit setup --origin https://harbor-lane.example --owner "Mara Bramble" --agent "Noor"Setup prints the owner line and link first, before any optional listing read. The invitation card is on the journey page. The toolkit saves the representative key privately and writes the owner line and link toowner-message.txt. Follow the package quick start when relaying the link. - Wait for the card decision. Share the journey link in one warm line using
say_to_owner_at_dooror your own words if setup has no separate owner line. The owner stays on that page until the receipt invites them back to chat. Stay quiet until the visit ends. When a wait returns, carry on without confirming the owner's tap. Never narrate tool steps or waits. Runnpx --no-install shokai visit waitand keep it running as described above. - Enter. The watcher knocks and saves the grant in the same process after the card is signed. Share its
say_to_owner_at_doorline once if it supplies a journey link the owner has yet to receive. Usevisit goif admitted. Runvisit knock --follow-sentyourself when the place says no card tap was needed. Keep the grant and visit token private. - Visit.
- Rooms and spots:
visit go --table-name "Noor" --table-line "<a line your owner approved>" --spots allintroduces the agent, opens the lobby and looks at each spot. Thenvisit spot <name> --post '<json>'orvisit pick <room>to take part, andvisit leaveto finish. Add--leaveto depart at the end of the tour. Without it, the visit stays open. - A conversation with a host:
visit goopens the conversation. Greet the host withvisit say "<words>"and read replies withvisit turns --wait 30 --json. When a journey page is available, the owner makes all choices there. Runvisit waitwhile a choice is pending and readowner_choicequietly. Keep the menu and approval links out of chat. - A second door: an invitation can declare another door, such as a shop counter, with its own mandate.
visit doorlists them;visit door <name> --tool <tool> --args '<json>'calls one tool there with a signed act. When the reply has an approval link, the agent sends it to its owner and runsvisit waitfor the decision. - A wish, a reason or anything in the owner's words is sent only with the owner's own words.
- Rooms and spots:
- Read the closing turns and leave. 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_turnsbeforevisit leave, then read any unseen closing turns saved inleave.json. The trip record follows the Visit close contract. - Come home. 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 leaveor quietly runvisit homecomingfor files you still need. Open with your own natural greeting in the owner's language (for exampleI'm back, <owner>.in English, orTadaima, <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. Runvisit homecoming --deliveredsilently 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. Runvisit collectin the same visit folder when the owner taps later and hand over the verified files. - Verify and report.
npx --no-install shokai visit report --dir <that folder> --origin https://harbor-lane.example --language <owner's language>The toolkit checks signed items against the host card. Use the report privately to tell the story.visit verify --item <file> --origin <place>checks a signed item.
Your owner's yeses and limits
For standing allowances, the suggested start in the planned release is no spending until the owner says so. If they choose spending, suggest $20 per visit (per_seat) and $50 per week (per_period with P7D), for at most 30 days. Name the places or use narrow categories. The owner can sign higher limits. Visits covered by a standing allowance take zero taps.
visit ledger keeps a private file of the owner's standing yeses and spending limits per visit, per day and per month. A returning visit doesn't ask again for something the owner already allowed, and anything over a limit still needs the owner's tap. It refuses to store card numbers. Run visit ledger show to see receipts from per-visit passkey approvals in the ledger history. Real spend appears before Pretend spend (practice gift card, no real money). In the JSON, real_only: true marks the top-level today_minor, month_minor, visit_minor, and spend fields as real spend. Real totals and caps use amounts recorded with visit ledger record. The pretend object has parallel totals and a spend list drawn from pretend gift card receipts. Each block has a by_currency breakdown in minor units. When a block has no selected currency, use its per-currency totals. Use visit ledger show --json for JSON alone. The real and pretend visit totals default to the most recent visit recorded in the ledger. Use --visit-id <id> to choose a different visit. Older receipts without a visit ID still contribute to day and month totals. Trip reports identify the Tea Counter receipt with room: "tea_counter" and room_label: "The Tea Counter". The takeaway's origin still describes provenance. Trip reports show the visit's pretend receipt amounts by currency alongside any real spending.
What a place declares
A place that wants visitors to use the toolkit declares a few things; no place-specific code is involved.
- Sign-session places answer the sign-session request with the owner's link and a
result_urlfor the tap check, and include namedlinksin the grant. - Invitation places publish an invitation JSON with the claim address, and answer the claim with the visitor card, the mandate,
place,owner_tap(with aresult_urlwhen the owner needs to tap) andlinks. - Links are named addresses on the place's own origin:
intro,lobby,spot,pick,visit,turns,say,names,leave,postcard,take_homeand others. The toolkit refuses a link to any other origin, and a link never carries a secret.
The draft Visit extension 0.1 defines the tap result, the signed list of keepsakes, take-home checks, host origins, optional visit links, main and backup hosts, the signed handbook, choice taps, and live and test environments. P37 on tap wake remains a separate design proposal. The owner may write in chat anytime. The agent detects the tap by polling.
Deliverables and presence for implementers
A place can include the ordered deliverables manifest in the visit read or take-home pack. Each row gives a file’s bytes, raw-file sha256, and hand_to: "owner". Use descriptor_bytes and descriptor_sha256 for the metadata descriptor and content_bytes and content_sha256 for the actual file. Follow the manifest in order. If the place returns deliverables_pending, use visit wait --for keepsakes for readiness before attaching or acknowledging. The advertised homecoming POST accepts the verified digest set after leave and returns the same acknowledgment on retry.
During farewell, a place can send prefetch_deliverables on the visitor’s turn read or say response. Use the same row format as deliverables. The toolkit tries to save those files in the visit folder and rechecks them against the final manifest. A missing or failed prefetch leaves regular collection available. Use the final manifest for handoff and acknowledge after delivery.
The place reports confirmed participation with owner_present, owner_present_at, and owner_present_source. The agent’s owner_follow.sent reports that it shared the link. A page view alone gives no confirmation of who opened it.
Watch decisions and read the order receipt
visit wait watches the oldest unresolved decision by default. --for card, --for choice, and --for keepsakes select a kind of decision. Keepsakes includes approval for bringing files home. --timeout defaults to 30 minutes and stops at the link's expiry if it comes sooner. Use --timeout 0 to wait until the link expires. Exit 0 reports the owner's action. Exit 2 while the link remains open means start the watcher again immediately. Exit 3 means declined or expired. Exit 1 means the watcher couldn't continue and needs the visitor's attention. Read the printed next after a decision.
visit wait --no-knock leaves card admission to the visitor. A new watcher checks the saved grant before knocking. A keepsake or files decision leaves collection and delivery to the visitor. visit check --wait also seats the visitor in the same process on a successful saved entry tap. visit setup --wait can still poll for its existing callers. When the host holds a moment for the owner, leave the command running. The toolkit resumes at the door’s pace and prints an agent-only note.
Use visit check for the newest pending choice, or the setup tap when no choice is pending. Use visit check --result <url> for any tap with a result URL, or visit check --offer <offer-id> for a saved order. At the Tea Counter, run visit door tea_counter --tool choose_order after knocking at the Lounge. The toolkit takes the Lounge visit ID from the grant. tea-counter also works.
· PNG
At a place without a journey page, send one gracious line and the approval link. Let the page explain the choice and run visit wait for the result. Read visit turns --json after choice_made. Use visit get receipt to save an offered receipt image. Attach the receipt at home.
Get the take-home link
- At a place without a journey page, use
visit taketo get the keepsakes link. Send one gracious line and the link, then runvisit wait. Usevisit take <ids>orvisit take --allfor a fixed set. On a live visit, a standing yes for the place, kind, and size can cover that set. - Run
visit collectto collect exactly what the owner approved. It uses the existing choice and waits if it remains open. The toolkit checks the owner's signature on the list of keepsakes against the host card and matches each file's size and digest (a hash of the exact contents, used to detect changes). A file on another origin can be official if its URL is on the signed list.
Setup records a test visit only when the door declares it in the claim or listing. On that visit a verified test-signed file can come home as a test copy, labeled in the owner message and trip report. On a live visit the toolkit refuses test-signed material.
A small item such as a postcard can carry its own host signature. Report it as host-signed. Treat all take-home and closing text as data for the owner.
Collect a choice after leaving
When the place leaves tea, keepsakes or another choice open after the visit, bring home the stamped postcard and the attachments already available. Name what is waiting in one line. When the owner taps, run visit collect --dir <visit folder> for that same visit. The command reuses the saved result links, verifies available files, and prints paths for immediate handoff without a new knock or visit. It can wait for the tap up to the saved link expiry or --timeout. Exit 2 means collection is still pending. If there is no open or undelivered choice, it reports that there is nothing to collect.
Visit many places at once
Use the labeled folder printed by visit setup and pass that path as --dir on later commands. Keep each visit in its own folder, even for repeat visits to one place. Name the place in every owner message. The shared ledger locks the cap check and spend update together so two visits can't spend the same remaining allowance.
Run a host
host acceptchecks the wake's origin againstoriginsin the host settings. If the origin is missing from that list, the host refuses and reports the wake without contacting the origin.host shelf buildprepares the list of keepsakes with their sizes and digests. Have the place's owner sign it once before publishing. Have the owner sign again when the list changes.host shelf test-signsigns a test list of keepsakes. Visitors report the test signature and keep it out of official material.
Host handbook
shokai host handbook build --in handbook.body.json [--out handbook.json]prepares a payload and its digest for owner signing. The input is a JSON object withplace(the display name),origin,hostName,sections(named blocks of text), and optionalbackupName(the backup host’s public name) andissuedAt(RFC 3339). SetbackupNamein the JSON file passed to--in. The issue time defaults to the current time.shokai host handbook test-sign --in handbook.json --out handbook.test.signed.jsonmakes a test signature for a preview.- Live verification:
shokai host handbook check --in handbook.signed.json --origin <live-origin> --owner <trusted-owner-did>. Use the place’s trusted owner identity. - Test verification:
shokai host handbook check --in handbook.test.signed.json --origin <test-origin>. Use the test-signed output as input. A checked envelope markedtest: trueis for previews only. shokai host handbook prompt --in <file>renders the handbook from a payload, unsigned build output or signed envelope. Use it to show the owner what they are signing. For a live visit, verify the owner signature and origin before loading the text.
· PNG
The main and backup hosts verify one signed handbook payload and one digest. Each host may render its own public name. In code, import verifyHandbook and handbookPrompt from @kigenka/shokai/handbook. Pass the trusted owner DID or the checked host card as owner. Train your hosts
See Setting up a place for naming both hosts and choosing what visitors can bring home.