Discord ──▶ kimaki bot ──HTTP + one event stream──▶ OpenCode 2 service ◀── your OpenCode TUI │ │ ▼ ▼ ~/.kimaki/kimaki.db sessions, messages, queue, (threads, channels, routines) provider logins
opencode serve --service. It looks for the binary in this order: OPENCODE_PATH, opencode, ~/.opencode/bin/opencode, then opencode2 if present. The minimum version is 2.0.19. Kimaki never pins a version, because that would replace the running server and stop your TUI sessions.curl -fsSL https://opencode.ai/v2/install | bash (in a terminal it asks first). An OpenCode 1 or an older OpenCode 2 is an error with install instructions. Kimaki never replaces it.<data-dir>/kimaki.db (default ~/.kimaki/kimaki.db): bot credentials, the channel to directory mapping, the thread to session mapping, channel preferences, routines, and sleeps. On first start it imports a V1 discord-sessions.db read-only. The V1 file is never changed.Kimaki <machine> (default: the hostname, override with --machine-name). A channel belongs to the machine whose database has it. Other Kimaki bots ignore it.KIMAKI_LOCK_PORT (default 29988). Starting a second bot on the same port stops the running one, then takes over. CLI subcommands like kimaki send and kimaki session archive talk to the bot through this port. To run a second bot, use a free port and a separate data dir:1KIMAKI_LOCK_PORT=31001 kimaki --data-dir ~/.kimaki-test
~/.config/opencode/plugins/kimaki/ and ~/.config/opencode/plugins/kimaki-anthropic/. No opencode.json edit is needed. The kimaki plugin acts only on sessions Kimaki created, never on your own TUI sessions. It puts the kimaki command on the agent's PATH, so agents can call kimaki send, kimaki upload-to-discord, and more. The kimaki-anthropic plugin adds Claude Pro/Max login to OpenCode.<data-dir>/attachments/<messageId>/ and sent to OpenCode as files./transcription-key, kimaki bot keys set, OPENAI_API_KEY, or GEMINI_API_KEY. The transcription also decides the route: interrupt, queue, new session, or agent. Gateway installs without a key use a free transcription endpoint on kimaki.dev.<data-dir>/kimaki.log. The file is reset on every bot start.12kimaki logs # print the log path kimaki logs --follow # print the log and follow new lines
<data-dir>/session-events/<threadId>.jsonl. Print them with kimaki session events <id>. See Debug sessions and report bugs.kimaki process supervises the bot as a child process. kimaki restart starts the bot again with the code on disk. Sessions keep running in OpenCode.kimaki profile cpu records a CPU profile of the running bot (default 20 seconds). kimaki profile heap writes a heap snapshot. Files land in <data-dir>/profiles/. Open .cpuprofile files in Chrome DevTools (Performance tab).