No description
  • Python 95.4%
  • Shell 4.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Alban Boyé 3af4ca1043 Rename the thinking state to mistral
The cat is the Mistral mascot, so the state that plays it takes the
name: assistant.ANIMATIONS key, the boot hint printed by main.py,
and the README examples.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
2026-11-30 22:35:25 +01:00
.vibe/skills/mpremote Restructure firmware, add deploy/run scripts and README 2026-11-25 20:49:10 +01:00
img Add case photos to the README 2026-11-25 23:10:26 +01:00
tools Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
.gitignore Add case photos to the README 2026-11-25 23:10:26 +01:00
anim_blink.py Restructure firmware, add deploy/run scripts and README 2026-11-25 20:49:10 +01:00
anim_boot.py copilot animation fix 2026-11-25 22:57:47 +01:00
anim_cat.py Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
anim_copilot.py Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
anim_util.py Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
assistant.py Rename the thinking state to mistral 2026-11-30 22:35:25 +01:00
cat_frames.py Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
copilot_frames.py Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
deploy.sh Revert "Ingest frames with a single player function; rename thinking to mistral" 2026-11-30 22:33:57 +01:00
main.py Rename the thinking state to mistral 2026-11-30 22:35:25 +01:00
README.md Rename the thinking state to mistral 2026-11-30 22:35:25 +01:00
run.sh Restructure firmware, add deploy/run scripts and README 2026-11-25 20:49:10 +01:00
ssd1306.py Restructure firmware, add deploy/run scripts and README 2026-11-25 20:49:10 +01:00

Mistrou

A tiny desk assistant: an ESP32-C3 with an OLED screen, embedded in a 3D-printed mini computer case, that shows cute faces and animations reflecting the state of the AI agent running on your computer — idle, thinking, waiting for input, talking, done.

The vibe of the thing: a little pixel-art companion sitting next to your keyboard that comes alive when the agent works.

Photos

The 3D-modeled case — a mini computer shell with the screen on the front:

The Mistrou case in CAD

And the first printed build, alive on the desk:

The Mistrou build on the desk

Hardware

Part Detail
Board ESP32-C3 with 0.42 OLED screen, MicroPython firmware
Display SSD1306 OLED, 72x40 pixels, I2C (SDA=GPIO5, SCL=GPIO6, 400 kHz)
Case 3D-printed mini computer case, screen visible on the front

Project goal

The board is the display head of a desk assistant. A client running on the computer watches the lifecycle of the local AI coding agent and sends the corresponding face/animation to the board:

  • Idle — calm face, slow blinking
  • Thinking — animation plays while the agent generates
  • Waiting — attention-seeking face when the agent needs the user
  • Done — happy animation when a task completes

macOS is the first development platform; Windows is a planned target.

Repository layout

main.py            # entry point: display init, boot animation, starts the assistant thread
assistant.py       # state machine: set_state(name) + animation loop in a background thread
deploy.sh          # copy all firmware files to the ESP32-C3
run.sh             # run main.py from the local files (mounts the repo dir; no copy)
anim_boot.py       # boot animation (fake kernel dmesg)
anim_blink.py      # idle animation: blinking "Mistrou" prompt
anim_cat.py        # cat playback
anim_copilot.py    # Copilot robot head playback
anim_util.py       # shared frame playback + MONO_HLSB scaling
cat_frames.py      # cat animation frames: 27 frames, 22x10 MONO_HLSB
copilot_frames.py  # Copilot robot art: 3 frames, 16x12 MONO_HLSB (bob is code-side)
ssd1306.py         # display driver (copied to the device)
img/               # case photos and renders for this README
.vibe/skills/      # Vibe skill: mpremote usage

How the firmware works

  • main.py runs on the device (MicroPython auto-runs it at power-on): it initializes the display, plays anim_boot once, then starts the assistant state machine in a background thread and returns to the REPL.
  • assistant.py maps state names to animations — idle blinks the "Mistrou" prompt, mistral plays the cat (the Mistral mascot) — and its thread replays the current state's animation unit forever, re-reading the state between units.
  • The 22x10 cat frames live in cat_frames.py as 30-byte MONO_HLSB buffers (3 bytes/row, MSB first), scaled at import time by anim_cat.py.
  • A scale_mono_hlsb() helper upscales the frames (CatScale = 3 draws each sprite pixel as 3x3 — 66x30, the largest that fits a 72x40 screen).

Driving the assistant from the host (mpremote)

The client changes states by shelling out to mpremote:

mpremote resume exec "import assistant; assistant.set_state('mistral')"  # cat
mpremote resume exec "import assistant; assistant.set_state('idle')"       # blink
mpremote resume exec "import assistant; print(assistant.state(), assistant.frames)"

resume is REQUIRED: a plain mpremote exec soft-resets the device on connect, which wipes the heap and kills the animation thread (the connection interrupt itself is harmless — the thread catches it).

States so far: idle (blink), mistral (cat), copilot (bobbing robot head from the GitHub Copilot icon). Add a state by registering an animation unit in assistant.ANIMATIONS; frame-based animations scale and center via anim_util.play.

Development workflow (mpremote)

Install mpremote, connect the board over USB, then use the helper scripts:

pip install --user mpremote

./deploy.sh          # copy main.py, anim_*.py, cat_frames.py, ssd1306.py to the device
./run.sh             # run main.py from the LOCAL files (mounts the repo dir on the device; no copy)

Both accept an optional device path (./deploy.sh /dev/cu.usbmodem21201). Equivalent raw mpremote commands:

mpremote devs                       # list serial devices
mpremote fs cp main.py anim_boot.py anim_blink.py anim_cat.py cat_frames.py ssd1306.py :
mpremote soft-reset exec "import main"   # run the copy already on the device
mpremote repl                       # interactive REPL

The full mpremote reference lives in .vibe/skills/mpremote/SKILL.md.

Animation pipeline

cat_frames.py holds the packed frames. They were produced from an animated GIF with Pillow (uv run --with Pillow works fine); the intermediate lechat-sprite/ PNGs were removed afterwards, regenerate them with this pipeline if ever needed:

  1. Extract GIF frames, compositing the transparency to white (a naive convert('RGB') turns transparent pixels yellow — the transparent index shares a palette slot with yellow).
  2. Threshold to 1-bit black/white.
  3. Crop to the artwork's bounding box and downscale by the pixel-art block size (32:1 here), giving the native 22x10 sprite.
  4. Pack each frame into MONO_HLSB bytes (3 bytes/row, MSB first) and put them in a *_frames.py module.

Editing frames (tools/edit_frames.py)

tools/edit_frames.py is a terminal pixel editor for the *_frames.py modules. It runs on the host (standard library only, via curses) and rewrites the module in the same format, keeping the header comments and config lines (CatW/CatH, CatScale, CatFrameMs, ...) and updating the frame count in the header comment:

python3 tools/edit_frames.py cat_frames.py      # or copilot_frames.py
Key Action
arrows / hjkl move the cursor
space toggle pixel
, / . previous / next frame
n duplicate the current frame
m delete the current frame
r clear the current frame
p preview the animation
s save back to the .py file
q quit (prompts if there are unsaved changes)

After editing, push the changed module to the board with ./deploy.sh. tools/ is host-side only and is not part of the deploy list.

Roadmap

  • Client daemon on macOS watching the agent state (files/hooks) and driving the board over USB serial
  • Animation set per agent state, streamed instead of embedded
  • Windows support
  • Case design files and build photos