tamagotchi

CLI reference

Every gochi command, what it does, and when to reach for it.

The gochi CLI is the friendly front-end to the pet. It talks to a background daemon that owns the USB serial port, so multiple terminals, scripts, and AI skills can drive the device without fighting each other.

Install it from the Wiring page if you haven't yet, then:

gochi --help        # top-level command list
gochi <cmd> --help  # detail for a single command
gochi --version

Daemon lifecycle

CommandWhat it does
gochi setupOne-time install — registers the daemon (and HTTP server) so it auto-starts at login.
gochi stopRelease the serial port (run this before make flash).
gochi startReacquire the serial port after a stop.
gochi killTerminate the daemon. launchd/systemd/Task Scheduler auto-respawns it with the current code.

kill is the easiest way to pick up local changes to the CLI/daemon source — the service manager respawns the process and the new code is loaded next time you run a command.

Port busy? Something else is holding the serial port. Run gochi stop to release it, or gochi kill to terminate the daemon completely. If it's still busy, unplug and replug the board, or try a different USB port.

Drive the pet

CommandArgsWhat it does
gochi face [name]face name, e.g. happyShow an expression. Omit name for an interactive menu.
gochi mood [name]mood name, e.g. playfulSet the pet's mood. Omit name for a menu.
gochi text <text...>a string (quote if it has spaces)Show text on the OLED. Long lines scroll.
gochi image <path>path to a PNG or JPGRender an image (auto-resized to 128×64, 1-bit).

Faces: neutral, happy, sad, sleepy, excited, surprised, angry, blink, love, sexy, shy, dead.

Moods: content, playful, grumpy, sleepy, affectionate.

gochi image options

FlagDefaultWhat it does
--no-ditheroffUse a plain brightness threshold instead of Floyd–Steinberg.
-t, --threshold <n>128Threshold cutoff 0..255. Only meaningful with --no-dither.
--invertoffSwap on/off pixels.
--bg <color>blackLetterbox fill — black or white.
gochi image ~/Pictures/skull.png
gochi image logo.png --no-dither -t 90 --bg white

Queries

CommandWhat you get
gochi pingPONG if the daemon is reachable.
gochi healthDaemon + device status as JSON.
gochi get stateCurrent view and active expression.
gochi get fpsDisplay frame rate the firmware is achieving.
gochi list facesEvery face name the firmware knows about.
gochi i2cScan both I²C buses and label every device that ACKs.

gochi i2c is the fastest tool for wiring problems — it tells you whether a device is alive on the bus, separating hardware issues from code issues.

Self-test

gochi test                # menu — pick a component
gochi test serial         # USB serial round-trip
gochi test oled           # write "Hello" and ask you if it shows
gochi test buzzer         # play a tone, ask if you heard it
gochi test imu            # lift and shake, watch the face react
gochi test all            # walks through every component in order

Each step asks a y/n question, so you always know exactly which part of the stack passed.

Daemon

CommandWhat it does
gochi daemon statusPrint the launchd/systemd unit + UDS socket state.
gochi daemon runRun the daemon in the foreground. Used by service managers — you usually don't run this yourself.

HTTP server

The HTTP frontend is what AI skills and external scripts talk to (default http://localhost:7474). It's enabled by default after gochi setup.

CommandWhat it does
gochi server enableTurn the TCP HTTP listener on.
gochi server disableTurn it off (the UDS socket keeps working for local CLI use).
gochi server statusShow the listener state.
gochi server runForeground process used by launchd — not for interactive use.

Common recipes

Before flashing firmware:

gochi stop
make flash
gochi start

Show a build result:

gochi face happy
gochi text "build passed"

Reset to a neutral state:

gochi face neutral
gochi mood content