Attach from Discord
Inside a thread, run/attach to get the exact command for that thread’s
session (the reply is ephemeral, so only you see it):
/session-id returns just the session id plus the same command behind a
spoiler, which is handy when you want to type the -s <id> yourself.
Attach from a terminal
Open a shell in the project’s sandbox, load the generated server environment, then attach to the running server:Replace
<sandbox> with the project’s sandbox name (celly-<slug>). You can
find it with /project status <name>, which reports the host port, or from
sbx ls.opencode attach accepts -c/--continue, -s/--session <id>, and
-p/--password (defaults to OPENCODE_SERVER_PASSWORD), plus --dir. Run
opencode attach --help in the sandbox for the exact semantics of your
installed OpenCode version.
What is shared
- The
opencode serveprocess is the same one Celly supervises, so sessions created in Discord appear in the terminal and vice versa. - The server password lives in
~/.config/celly/opencode.envinside the sandbox (mode0600) and in the bot database. Sourcing it is what letsopencode attachauthenticate to the loopback server. /project statusshows the sandbox state, host port, and session count. Any reply that would contain the server password is ephemeral and masked.
Caveat: terminal-started sessions
By default, a session you start only from the terminal, with no Discord thread behind it, is not routed to Discord. The event router only renders turns into a thread that owns the session; terminal-originated turns are rendered into the owning session’s most recent thread if one exists, otherwise they are ignored. SetATTACH_AUTO_THREAD=true to change that: the first event for an unknown
session creates a Discord thread titled after the session’s title (fetched from
the server) and then routes events normally. Sessions with no project channel
are still dropped.
To keep a conversation on both surfaces, either enable ATTACH_AUTO_THREAD or
start it from Discord (or /resume it into a thread) and then attach from the
terminal.
Web UI
The OpenCode web UI is intentionally not published.sbx maps one loopback
host port per sandbox port, and exposing 4096 to the host network would break
the loopback-only invariant that protects the server password and session data.
Terminal attach is the supported out-of-Discord path.
Related
- Commands —
/attach,/session-id,/project status,/resume, and the rest. - Deployment — running Celly as a service.