SAVANT//GATEWAY
Back to Signal
RepositoryTrendshiftNov 5, 2026leamariek

leamariek/house-rules

★ 0⑂ 0

Learns a board game's rules by watching people play it on video, using Meta's SAM 3.1, Voice Transcribe, Muse Wonder and Muse Spark.

TypeScriptMIT
View on GitHub ↗Last push Nov 4, 2026

House Rules

Film your family playing. Get the game. Every family plays its board games a little differently, and nobody ever writes those rules down. House Rules watches a phone video of a real game, tracks every piece with SAM 3.1, listens to what the players say with Muse Voice Transcribe, and has Muse Wonder write the rules as an executable program. A checker replays every observed move against that program and sends each contradiction back to Wonder until the rules explain the game. Then House Rules names the closest known game, states exactly how your family deviates from it, and hands you a playable browser version with an AI opponent and a printable rulebook.

Built by Lea Marie Korsawe for the Meta AI developer hackathon (October 26 to November 4, 2026).

How it works, per Meta model

All AI calls go to the Meta Model API (https://api.meta.ai/v1). Every raw response is recorded next to the run, so any live run can be replayed offline.

Model What House Rules uses it for Code
sam-3.1 (video and image) Tracks the board, every piece color and the players' hands through the whole video. Image probes on still frames pick the phrase SAM segments best for each piece color. On long games, one image segmentation per hand-free interval reads each settled position directly. perception/hr_perception/sam.py, pipeline.py, stills.py
muse-spark-1.3 (vision and text) Reads the board from three frames: game family, corners, piece colors and the SAM concepts to track. Formalizes what the players said into checkable claims, turns the deviation list into one plain sentence, writes the rulebook, and translates every quoted span of speech into English once, so the app shows English while the original words stay in the run as evidence. perception/hr_perception/board.py, rules/scripts/claims.ts, identify.ts, rulebook.ts, web/scripts/translate-quotes.ts
muse-voice-transcribe-1.0 (diarization) Separates the players' voices into speech turns and attaches them to moves, so a spoken rule ("no going back anywhere on the board") counts as evidence just like a move. perception/hr_perception/speech.py
muse-wonder-1.0 Writes the rule program (rules.ts, a declarative DSL that is parsed, never evaluated) from the observed log and speech. The checker replays every move; each contradiction goes back with the board state, the rule blamed, nearby speech and checker-verified candidate edits, round after round. rules/src/induce.ts, rules/src/wonder.ts

Everything that is not a model call is ordinary, testable code: board registration and occupancy (OpenCV), the rule DSL and engine, the consistency checker, game identification against a catalog of known games, Italian draughts with its capture priorities, and an MCTS opponent that plays whatever rules were induced.

Results

Numbers below are copied from the run files in this repository.

Çin daması (Turkish corner checkers), public/runs/cin-damasi

Two people play on an 8x8 board while the host explains the rules in Turkish.

  • Perception: 81 moves and 16 diarized speech turns from 299.5 s of video (log.json).
  • Induction (induction.json): Wonder's first program explains 71 of 81 moves and contradicts one spoken claim. After revision, version 2 explains 80 of 81; version 3 keeps 80 of 81 and attaches the players' own words to the backward-step rule. The one move left over is played after the game was already won.
  • Identity (identity.json): closest known game Ugolki, with the family's house rule stated as "Ugolki, but your family never jumps a piece backward and never steps a piece backward except inside the opponent's home." The deviation is traced to the spoken sentence "Geri gitme kesinlikle bu komple alanda yok." ("There is no going back anywhere on the whole board.").
  • Out: rules.ts, rules.json, rulebook.md (written by Muse Spark), and a playable version in the web app.
  • Perception cost: USD 3.75 estimated (18,596 SAM video frames, 6 SAM images).

Dama italiana played wrong on purpose, public/runs/dama-sbagliata-1

The author of this video played Italian draughts with deliberate mistakes; the comments name 3 of them. House Rules replays the perceived game against canonical Italian draughts (Federazione Italiana Dama rules) and refuses every move the book does not allow.

  • Perception: 135 moves read from 127 settled board states, covering 0 to 668 s of 870.6 s; after that the room light drops and SAM 3.1 stops finding black discs on black squares (violations.json).
  • Accuracy, checked frame by frame against the video (review.json): 133 of 135 moves correct; the other two are a pair of White moves logged in swapped order inside one hand-covered stretch, both orders legal.
  • Rules: 129 of 135 moves are legal. House Rules finds 7 errors: the board set the chess way (light corner on the right), Black moving first, and five skipped or unfinished compulsory captures (moves 22, 28, 37, 39, 52). That covers all 3 the commenters named (board, first move, the missed capture at 1:26) plus 4 nobody named (moves 28, 37, 39, 52), each confirmed on the video frames (review.json).
  • Perception cost: USD 3.83 estimated (13,059 SAM video frames, 468 SAM images).

Connect Four benchmark, eval/

A blind test on footage House Rules was never built for: hand-held phone videos of upright Connect Four boards from a public CC BY 4.0 dataset, scored against the dataset's own annotated board states. Full write-up with per-game results and failure analysis: eval/connect4.md.

27 held-out games, 470 ground-truth moves v1 frozen pipeline, run once live v2 after failure analysis (replayed, tuned on the same games)
Moves recovered in order (recall) 413 / 470 = 87.9% 438 / 470 = 93.2%
Extracted moves that are real (precision) 413 / 1,218 = 33.9% 438 / 471 = 93.0%
Move F1 0.49 0.93
Final board exactly right 16 / 27 19 / 27
Final board cells right 90.0% 98.6%
  • Muse Wonder named Connect Four in 9 of 9 valid programs; 7 of 9 behave exactly like standard Connect Four.
  • Local-search induction on the v2 logs names Connect Four in 29 of 29 games, also with the board withheld.
  • API spend for the whole benchmark: USD 9.78 (eval/connect4/scores/costs.json).

Quickstart

Requirements: Node 22.18 or newer, Python 3.12 with uv, ffmpeg.

git clone <this repo> house-rules && cd house-rules

# web app with the two real runs (no API key needed)
cd web && npm ci && npm run dev          # http://127.0.0.1:1212  (switch runs in the header, or ?run=dama-sbagliata-1)

# tests
cd ../rules && npm ci && npm test        # rule DSL, engine, checker, induction, identification, MCTS
cd ../perception && uv sync && uv run pytest
cd ../web && npm run build               # type check and production build

Live runs need your own Meta Model API key: create one at https://dev.meta.ai (API keys page). Put it in .env at the repo root; it is loaded at runtime, never printed, and .env is git-ignored. No key ships with this repo.

cp .env.example .env                      # then set MODEL_API_KEY=...
scripts/fetch-footage.sh cin-damasi       # original CC BY source video into footage/
uv run perception/run.py --video footage/cin-damasi.mp4 --out public/runs/my-run --play-end 299.467
cd rules
npm run induce -- ../public/runs/my-run   # Muse Wonder writes and revises rules.ts
node scripts/claims.ts ../public/runs/my-run     # spoken rules as checkable claims (Spark)
node scripts/identify.ts ../public/runs/my-run --phrase
node scripts/rulebook.ts ../public/runs/my-run

uv run perception/run.py --help lists the options for harder footage (stills mode, chunked piece streams, fixed SAM concepts). perception/hr_perception/stabilize.py registers and crops a drifting top-down video first, and rules/scripts/dama.ts replays a draughts game against canonical Italian rules.

Architecture

perception/   Python 3.12 (uv). Video + audio in, board.json and log.json out.
              SAM 3.1 streams, Spark board reading, diarized speech, registration, occupancy, stable states.
rules/        TypeScript (Node, no build step). Rule DSL and engine for graph boards, consistency checker,
              Muse Wonder induction loop, spoken-claim checker, game identification, Italian draughts, MCTS.
web/          Vite + TypeScript. Watch view, induction view (explains counter, rule diffs), identity,
              refusal view for games checked against the book, play view against the MCTS opponent
              (with draughts move hints), printable rulebook. The build ships only runs with credited footage.
eval/         Connect Four benchmark: ground truth, scoring, replay, per-game results and spend.
public/runs/  The contract between the three parts, one directory per run.
scripts/      fetch-footage.sh for the CC BY source videos.

A run directory holds:

File Written by Content
video.mp4 perception the prepared video the overlays are drawn on
board.json perception board as a graph: nodes, edges, lines, image registration
log.json perception observed game: states, moves with frame evidence, diarized speech turns
claims.json rules (Spark) spoken rules as checkable allowed or forbidden moves
rules.ts, rules.json rules (Wonder) induced rule program and its readable rule list
induction.json rules every version: moves explained, contradictions, rule diff
identity.json rules closest known game and the deviations in plain words
rulebook.md rules (Spark) printable rulebook
quotes_en.json web script (Spark) English translation of every quoted span of speech
violations.json, review.json rules, operator draughts refusals per move, and the frame-by-frame review of them
footage.json operator on-screen footage credit

Source audio and raw API recordings stay out of the repository (.gitignore); replay mode reads them when present.

Built during the hackathon

Everything in this repository was built by Lea Marie Korsawe during the hackathon, October 26 to November 4, 2026: the perception pipeline, the rule DSL, engine, checker and induction loop, game identification, the Italian draughts checker, the MCTS opponent, the web app, the Connect Four benchmark, and all run results. Third-party material is limited to the CC BY footage, the CC BY 4.0 Connect Four dataset, the fonts and the open-source dependencies listed in CREDITS.md.

License

MIT, see LICENSE. Footage, dataset and fonts keep their own licenses, see CREDITS.md.

Reactions
Sign in to react

Discussion

0 comments on Savant Gateway

This discussion is ours, not the publisher's. The thread is public. Sign in to post; the source's own comment count, when reported, appears in the details panel. One level of replies is supported.

Sign in to join the discussion.

No comments yet. Start the conversation.