Skip to content

renjie-liu/magic_coding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Wand for Vibe Coding

A Bluetooth magic wand that lets you code by voice, confirmed with a flick — like casting a spell to write code. Hold the push-to-talk button, speak your intent, release, then flick the wand to authorize Claude Code to apply the change.

Status: hobby project / early prototype. Bring-up is in progress; nothing here is production-ready. Hardware involves a Li-ion cell — read the assembly guide before powering anything on.

How it works

 [Wand]  ──BLE──▶  [Host daemon]  ──▶  [STT]  ──▶  [Claude Code CLI]
  PTT held: stream PCM audio          Gemini 2.0 Flash      runs in a
  Released: emit transcript           or OpenAI Whisper     sandboxed cwd
  Flick gesture: authorize execution

The wand is a Seeed XIAO ESP32-S3 with an INMP441 MEMS mic, an LSM6DSO 6-axis IMU, a WS2812B LED ring, a PTT button, and a Li-ion cell. Firmware runs in PlatformIO/Arduino. The host is a small Python daemon that owns the BLE link, runs speech-to-text, and shells out to the Claude Code CLI with a restricted tool set (Edit,Write,Read) inside a sandbox directory.

Repo layout

magic_coding/
├── docs/        Architecture, BOM, assembly, wiring, design decisions
├── cad/         OpenSCAD source for the wand shell (v0.1 demo + v0.2 draft)
├── hardware/    Component bounding envelopes for collision check
├── firmware/    ESP32-S3 firmware (PlatformIO, two envs: wand_prod / wand_devboard)
├── host/        Python daemon — BLE, STT, Claude Code integration
└── tools/       One-off utilities (e.g. wiring-diagram generator)

Start with docs/architecture.md for the system view. For a build, see docs/bill-of-materials.md, docs/wiring_v0.1.md (authoritative pinout), and docs/v0.2_assembly_checklist.md for the v0.2 shell assembly.

Quickstart

Host daemon

cd host
pip install -e .

# Pick one STT backend:
export GEMINI_API_KEY=...   # preferred — Gemini 2.0 Flash
# or
export OPENAI_API_KEY=...   # Whisper fallback

# Optional:
export MAGIC_WAND_WORK_DIR=~/wand-test          # Claude Code sandbox cwd
export MAGIC_WAND_GEMINI_MODEL=gemini-2.0-flash # override Gemini model

magic-wand

The daemon scans for MagicWand over BLE, then waits for PTT/audio/gesture events. The claude CLI must be on PATH for execution to do anything real; without it, the daemon logs a mock response.

Firmware

cd firmware
pio run -e wand_prod -t upload          # the assembled wand
pio run -e wand_devboard -t upload      # bench breadboard rig (different IMU mount)
pio device monitor

wand_prod is the default. The wand_devboard env adds -DIMU_MOUNT_BREADBOARD, which selects a different axis-remap matrix because the breadboard fixture mounts the IMU at 90° relative to the production wand.

Shell (CAD)

Install OpenSCAD, open cad/magic_wand.scad (v0.1 three-segment demo shell) or cad/wand_v0.2/wand_full.scad (v0.2 draft). F5 to preview, F6 to render. STLs ready for JLC3DP / Bambu live in cad/stl/ and cad/wand_v0.2/. See cad/README.md for export and print settings.

Hardware

Part Role
Seeed XIAO ESP32-S3 (non-Sense) MCU + BLE radio
LSM6DSO 6-axis IMU (gestures)
INMP441 I²S MEMS microphone
WS2812B mini ring (8 LED) Visual feedback
6×6 mm tactile button Push-to-talk
Alps EG1218 SPDT slide switch Power
Protected 18650 Li-ion cell Battery

Total parts cost is around $55–60. Wiring is solder-free female-female DuPont jumpers. See docs/bill-of-materials.md for sources and docs/wiring_v0.1.md for the authoritative pinout.

Contributing

This is a hobby project — pace is "as time permits", and direction can shift. Bug reports, build photos, and PRs welcome via GitHub Issues. See CONTRIBUTING.md for the short version.

License

MIT — code, CAD, and docs.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors