墨kazokuai.dev

Sumi makes games

Sumi (墨, ink) is an app a house runs for itself: one container, its own members, its own data.

A member brings a story, a picture or a sentence, and Sumi walks them through six rooms to a game.

The AI does the typing — a script per level against a small kit; the member does the deciding.

Everything is ink and light: silhouettes, neon outlines, light as the thing you play with.

What comes out is a game package: a zip any host that speaks the contract can play, Sumi's own Play room first.

Sumi stands on its own; with KazokuAI beside it, a pairing links the two, and neither ever needs the other.

Install Sumi

One container, one folder of your choosing, two toml files edited in place, and an address of your own: the guide for any operator.

The package contract

contract 1text v1.1

What a game is to any host: the zip, the manifest, the sandbox, the messages. Read it, download it, and run the harness.

The house link

contract 1text v1.2

How two apps of one house pair, link their members and open each other signed in. With a reference peer and signing vectors.

KIT.md

kit 0.8.0

The one truth about the kit: its budgets, what it draws, every pack, and what does not exist. It is also what the AI reads.

The method

Six rooms from a seed to a package: Pitch, Cast, Levels, Story, Package, Settings — and Play.

Install Sumi

Sumi is one container with one folder of your choosing: build the image from the repo or load a release, run it, edit the two toml files it writes on its first boot, and give it an address of your own. The install guide takes it step by step, for any Docker host.

Once both apps run in the house, an admin of each pairs them once; then each member links their two accounts once, from either app. This is the pairing, from the house-link text (the whole text):

Made once, by one admin of each app. App A shows a code; app B's admin types it in with A's address.

  1. A shows a code. A's admin asks for one. The code is 8 symbols from Crockford's base-32 alphabet 0123456789ABCDEFGHJKMNPQRSTVWXYZ (32 symbols, no I, L, O or U), each drawn from a cryptographic random source, shown in two groups of four (7KQ2 M9XD) with A's origin beside it. It lasts 10 minutes from when it is shown, is good for one pairing, and ends when a new code is shown, when the admin cancels it, or after 5 wrong tries (§2.2). A that already has a peer shows no code.

  2. B's admin enters A's origin and the code. B normalizes the origin (§1) and sends, server to server:

    POST <A origin>/api/house-link/pair · content-type: application/json

    {"contract": 1, "code": "7KQ2M9XD", "origin": "<B origin>", "name": "<B's name>", "capabilities": ["…"]}
    

    B that already has a peer sends nothing.

  3. A checks the code. A reads the code case-insensitively, drops spaces and hyphens, and reads I and L as 1 and O as 0. Then, in this order: a peer already → 409 already_paired; contract not one A speaks → 400 contract; no code showing, or a different code → 403 bad_code (a wrong try, §2.2); the code past its 10 minutes → 403 expired_code. Otherwise the code is used up, A draws a key of 32 random bytes, stores the peer (§2.1) and answers 200:

    {"contract": 1, "key": "<43 characters: the key, base64url, no padding>", "origin": "<A origin>", "name": "<A's name>", "capabilities": ["…"]}
    

    origin is the origin A showed with the code.

  4. B stores the peer. B checks the answer: contract one it speaks, origin the origin its admin typed, key 32 bytes. Then it stores the peer as A did. If B can't keep it after A has answered, B's admin says so plainly and A's admin unpairs (a later pairing gets already_paired from A until then).

The admin of either app sees the peer's name, origin, capabilities and when they were paired, and can unpair.

2.1 What each app keeps

{peer origin, peer name, key, capabilities, paired_at, own origin} — own origin is the origin this app named in the pairing (A: the one shown with the code; B: the one it sent). Every token this app signs names it as iss, and every token it accepts must name it as aud (§3).

The key is a secret. An app keeps it with its other secrets (Sumi: secrets.toml, section [house_link], mode 600, written by the app) — never in its database, a log line, an error, a page or a report — and never sends it anywhere but in the pair answer above. Both apps use the same key for both directions.

2.2 Wrong tries

The pair route is open (B has no session on A). A counts wrong codes against the code showing: the fifth wrong try ends the code, and A's admin shows a new one. With 32^8 codes, 5 tries and 10 minutes, a guess succeeds about once in 2·10^11.

2.3 Unpairing

Either admin may unpair. The app signs an unpair token (§4) and sends, server to server,

DELETE <peer origin>/api/house-link/pair · authorization: HouseLink <token>

waits at most 10 seconds, and then deletes its side whatever the answer: the key, the peer, every link (§5), every nonce (§3.4). A peer that accepts the token (§3.3, with no link check) deletes the same and answers 200 {"ok": true}. An app that receives no notice keeps a pairing whose tokens nobody will sign again; its admin unpairs there too.