XibeCode

Xibe Daemon (24/7)

Xibe Daemon — long-lived coding agent for Telegram, Discord, Slack, cron, /cmd shell, media delivery, and systemd.

Xibe Daemon (24/7)

Xibe Daemon is the always-on coding agent: Telegram / Discord / Slack, cron, pairing, delivery ledger, screenshots/files in chat, and operator shell via /cmd.

CLINotes
xibecode daemonPrimary command
xibecode gatewayFull alias (same process)

This is separate from the E2B cloud gateway (sandbox HTTP proxy). See Cloud / E2B.

Home layout (~/.xibecode or $XIBECODE_HOME)

PathPurpose
profile-*.jsonInteractive CLI profiles
.env / daemon.env / gateway.envSecrets (API keys, bot tokens)
daemon-<profile>.envPer-profile secrets (overrides global when --profile is set)
daemon/Daemon runtime (migrates from legacy gateway/)
daemon/sessions/Messaging chat sessions (kept across E2B /update restart)
daemon/logs/daemon.logDaemon log (daemon-<profile>.log for non-default profiles)
daemon/pairing.jsonDM pairing state
daemon/delivery-ledger.jsonAt-least-once outbound delivery
cron/Scheduled jobs
memories/Curated MEMORY.md / USER.md
skills/Learned / user skills
projects/JSONL transcripts per project cwd
logs/Shared logs

Override root with XIBECODE_HOME.

Quick start

# Configure tokens (wizard)
xibecode setup gateway

# Or edit secrets manually:
# ~/.xibecode/daemon.env  (or gateway.env / .env)
# TELEGRAM_BOT_TOKEN=...
# TELEGRAM_ALLOWED_USERS=123456789
# ANTHROPIC_API_KEY=...   # or your provider key

# Foreground
xibecode daemon --workdir /path/to/repo

# Always-on (systemd user service)
xibecode daemon --install --workdir /path/to/repo
xibecode daemon --start
xibecode daemon --status

Multi-profile bots

xibecode daemon --profile test --workdir /path/to/repo
# Loads ~/.xibecode/daemon-test.env over global secrets
# Logs: ~/.xibecode/daemon/logs/daemon-test.log

Start / stop / status

CommandEffect
xibecode daemonRun in foreground (Ctrl+C stops)
xibecode daemon --installInstall systemd unit xibecode-daemon.service
xibecode daemon --startStart the service
xibecode daemon --stopStop the service
xibecode daemon --statusService status
xibecode daemon --cron-onlyCron only (no messaging)
xibecode daemon --workdir <path>Default project directory
xibecode daemon --profile <name>Use named profile + daemon-<name>.env

xibecode gateway … accepts the same flags.

Systemd helpers after install:

systemctl --user daemon-reload
systemctl --user enable --now xibecode-daemon
# Optional: keep running after logout
sudo loginctl enable-linger $USER

Telegram 409 Conflict

Do not run two processes polling the same bot token. Legacy xibecode-gateway.service is a oneshot alias of the daemon — enable only one unit.

Environment (~/.xibecode/daemon.env or gateway.env)

VariablePurpose
TELEGRAM_BOT_TOKENBotFather token
TELEGRAM_ALLOWED_USERSComma-separated Telegram user ids
TELEGRAM_HOME_CHANNELDefault channel for cron delivery
DISCORD_* / SLACK_*Optional adapters
Provider API keysANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, …
XIBECODE_FALLBACK_PROVIDERSFailover pool string
XIBECODE_GATEWAY_WORKDIRDefault workdir
GATEWAY_ALLOW_ALL_USERSDev-only; do not enable on public bots
XIBECODE_BUSY_INPUT_MODEsteer (default) | queue | interrupt
XIBECODE_RUNTIME_MODEdefault | e2b (auto-detected on hosted sandboxes)
XIBECODE_CMD_TIMEOUT_MS/cmd shell timeout (default 60000)
XIBECODE_DAEMON_VERBOSE / XIBECODE_VERBOSEHeadless tool tracing in daemon logs
XIBECODE_PROGRESS_GROUPINGaccumulate to edit one progress bubble (default: new message per tool line)
XIBECODE_STREAM_EDIT1 to restore mid-turn draft edits (off by default)
XIBECODE_DISABLE_UPDATE_CHECKSkip npm update offers
XIBECODE_DISABLE_AUTO_UPDATESkip auto-update behavior

Messaging slash commands

Registered on Telegram’s / menu and answered in all adapters:

SlashMeaning
/startWelcome + list commands
/helpFull help text
/new /reset /clearClear conversation (keep workdir)
/stopInterrupt run + free the chat immediately (next message is not stuck)
/statusWorkdir, busy state, progress, sandbox id when in e2b mode
/queueList queue · /queue <prompt> force FIFO · /queue clear
/workdir [path]Show or set project directory for this chat
/progress on|offTool progress updates
/levelRigor: yolo | default | strict
/model /modelsShow/list/set model (--global to save profile default)
/skills /skillList / search / view skills
/cmd <command>Shell in chat workdir — no agent loop (aliases: /sh, /shell)
/updateCheck CLI update · /update yes install (e2b: + daemon restart) · /update no
/modeShow runtime mode (default | e2b)
/sethomeSet this chat as cron delivery home
/once /session /always /denyResolve pending dangerous-command approval

Process lifecycle = daemon --start / --stop.
Run lifecycle = /stop or natural completion.

/cmd — operator shell (no agent)

/cmd ls -la
/cmd pwd
/cmd tail -n 40 ~/.xibecode/daemon/logs/daemon.log
  • Runs in the chat workdir via spawn + shell.
  • Default timeout 60s (XIBECODE_CMD_TIMEOUT_MS).
  • Large stdout/stderr is truncated (tail kept).
  • Empty /cmd prints usage.

While the agent is busy

ModeBehavior
steer (default)Plain text injects into the same run after tools / before the next model step
queueFollow-ups wait until the current run finishes
interruptNext plain message aborts and starts a new run
# In daemon.env
XIBECODE_BUSY_INPUT_MODE=steer   # default
  • /queue <prompt> always forces FIFO without interrupt.
  • /stop hard-interrupts and frees the chat so the next message is not blocked.
  • ? can request a quick status without queueing.

Approvals and questions

  • Dangerous commands pause for Once / Session / Always / Deny (inline buttons or slash commands). After resolve, the prompt message is edited and the keyboard is removed.
  • Mid-run agent questions use numbered options; reply with a number or free text (not /status).

Media & screenshots (Telegram)

Agent replies can deliver files with:

MEDIA:screenshots/home.png
MEDIA:dist/report.pdf
MEDIA:relative/path/from/workdir.zip
TypeTelegram API
ImagessendPhoto
VideosendVideo
AudiosendAudio / sendVoice
Other (PDF, zip, code, …)sendDocument (≤50MB)
  • Relative paths resolve against the session workdir.
  • Successful take_screenshot is auto-queued if the model omits MEDIA:.
  • Optional directives: [[as_document]], [[audio_as_voice]].
  • Text file attachments you send (.txt, .md, code, … up to 512KB) are downloaded and inlined into the prompt.

Progress UX

  • Tool progress is sent as new messages by default (not one long edited bubble).
  • Heartbeats about every 30s while busy.
  • Final answer is a new message (mid-turn draft edits off unless XIBECODE_STREAM_EDIT=1).
  • Curated memory progress: saving… then Saved · MEMORY/USER · usage%.
  • Auto-compact progress: compacting… then Context compacted.
  • [[TASK_COMPLETE | summary=…]] is stripped and shown as a plain Done footer.

Runtime modes (default vs e2b)

ModeWhenBehavior
defaultLocal host daemonNo auto self-update restart
e2bHosted sandbox (auto-detect or XIBECODE_RUNTIME_MODE=e2b)/update yes → install latest CLI (sudo when needed) → restart daemon; chat sessions under daemon/sessions/ kept; agent knows sandbox id; preview https://{port}-{sandboxId}.e2b.dev
# Force mode (then restart daemon)
XIBECODE_RUNTIME_MODE=e2b

/mode shows the current runtime mode and sandbox id when applicable.

/update flow (E2B)

  1. Daemon or /update reports a newer npm version.
  2. Reply /update yes (or use the dashboard Update button).
  3. Install tries sudo -n npm i -g xibecode@… first when the global prefix is root-owned, then plain npm, then user-local prefix fallback.
  4. Daemon restarts; messaging chat history is preserved.

CLI equivalent (any machine):

xibecode update --check
xibecode update --apply --yes
# Pin: xibecode update --apply --yes --to 1.17.0

Never silent — always requires explicit apply / /update yes.

Security

  • Prefer allowlists (TELEGRAM_ALLOWED_USERS) or pairing (xibecode pair).
  • Never commit daemon.env / gateway.env.
  • Treat bot tokens like production secrets.
  • /cmd runs as the daemon user in the chat workdir — lock down who can talk to the bot.

Pairing

xibecode pair list
xibecode pair approve telegram <code>
xibecode pair revoke telegram <userId>

Logs & sessions

  • Logs: ~/.xibecode/daemon/logs/daemon.log (and daemon-<profile>.log)
  • Sessions: ~/.xibecode/daemon/sessions/
  • Verbose agent tools: XIBECODE_DAEMON_VERBOSE=1

Iterations

Daemon agent runs default to unlimited iterations (0). Abort with /stop if needed. See Agent engine.

Ctrl+I
Assistant

How can I help?

Ask me about configuration, installation, or specific features.