/ concept-collection / commonroom-recorder
Sign in
concept-collection / commonroom-recorder
commonroom-recorder / CLAUDE.md
6.8 KBPreviewCodeBlameHistoryRaw

CLAUDE.md#

Tips for future agents working in this repo — a Node CLI that joins a commonroom call as a muted, visible participant and records every other participant's audio (one WAV per participant) plus the room chat. Read commonroom's CLAUDE.md first: this tool speaks its protocol verbatim, and the protocol is documented there.

Architecture#

src/
  identity.ts   ported from commonroom; EPHEMERAL keypair (no localStorage)
  nostr.ts      ported near-verbatim (Node >= 22 global WebSocket); close() added
  peer.ts       ported, adapted to @roamhq/wrtc; receive-only media (see below)
  wav.ts        incremental WAV writer (buffers ~1 s, re-patches header sizes)
  recorder.ts   the heart: presence, mesh, control channel, audio sinks, files
  render.ts     shared transcript timeline: turn merging, md/json rendering
  transcribe.ts `transcribe` subcommand: per-WAV ASR + merged transcript.md
  livetranscribe.ts  record --transcribe: persistent faster-whisper helper,
                silence-cut chunking, live transcript re-rendering
  cli.ts        record/transcribe subcommands, signal handling, log lines
  test/
    speaker.ts         synthetic participant: sine tone + one chat message
    loopback.ts        test: recorder + speaker in a random room -> tone + chat
    transcribe-test.ts test: fabricated 2-speaker recording dir (JFK sample)
                       -> transcript ordering + words; uses --model tiny

Key design decisions#

Testing#

npm run build && npm run test:loopback — full end-to-end over the real public relays (needs network): asserts the recorded WAV contains the 440 Hz tone (RMS + zero-crossing rate) and the chat message landed exactly once. npm run test:transcribe — real-speech transcription test (downloads the whisper.cpp JFK sample + the tiny model on first run). npm run test:live — end-to-end LIVE transcription: a speaker streams the JFK WAV into a room (speaker.js --wav; playback and leave countdown start at first connect) and the test asserts the transcript grew while still recording. Segfault-at-exit in a child process = some path bypassed process.exit(). For manual testing against real browsers, record a room and join it at https://concept-collection.github.io/commonroom/ — let the user do multi-person tests; don't try to automate browser media.

moveopenescclose