CLI
The bub CLI is part of the app layer and requires installing bub[app]. This page lists all built-in subcommands; plugins can register additional subcommands via register_cli_commands (check bub --help for the active list).
Global options
Section titled “Global options”bub [OPTIONS] COMMAND [ARGS]...| Option | Type | Default | Description |
|---|---|---|---|
--workspace, -w |
path | current working directory | Sets BubFramework.workspace (affects default tool working directory, skill discovery, and relative paths) |
--version, -V |
flag | — | Print the installed Bub version and exit |
--help |
flag | — | Show help and exit |
--workspacedoes not changeBUB_HOMEor the location of~/.bub/config.yml.- Running
bub(orbub -w PATH) without a subcommand executesBubFramework.default_command(chatby default, launching the interactive terminal REPL). - If
bub[app]is not installed, runningbubprints the missing dependency and installation command and exits with code1.
bub run
Section titled “bub run”Runs a complete Turn for one message (resolves session, builds prompt, runs model and tools, saves state, and renders replies), prints TurnResult.outbounds to stdout, and exits. Does not start ChannelManager.
bub run [OPTIONS] MESSAGE| Parameter / Option | Type | Default | Description |
|---|---|---|---|
MESSAGE |
text | required | Message body; runs an internal command directly when starting with the command prefix (, by default) |
--channel |
text | cli |
Inbound channel identifier |
--chat-id |
text | local |
Inbound chat ID |
--sender-id |
text | human |
Written to context.sender_id |
--session-id |
text | <channel>:<chat-id> |
Explicit session ID override (used to share history across entry points) |
Output format:
[channel:chat_id]<reply content>Examples:
bub run "Summarize this repository."bub run --channel web --chat-id demo "Continue the previous topic."bub run --session-id shared:demo ",tape.info"Because bub run does not start ChannelManager:
- Does not start background services:
mcp.lifecycle,acp-server, and external chat channel listeners do not start; - Does not deliver to external platforms: output is printed only to stdout;
- Still enters core resource scopes:
provide_tape_store,provide_lifespan, andprovide_steering_inboxare initialized and cleaned up on exit; - Uses the non-streaming model stage: calls
HookRuntime.run_model.
Note: if the model stage errors or returns empty text, bub run logs a run_model error and prints fallback text, and the process may still exit with code 0. In automation scripts, inspect stderr and output content rather than relying solely on the exit code.
bub chat
Section titled “bub chat”Starts an interactive terminal session (REPL), enables the cli channel, and starts all enabled Lifecycle background services (such as MCP connections).
bub chat [OPTIONS] [INITIAL_PROMPT]| Parameter / Option | Type | Default | Description |
|---|---|---|---|
INITIAL_PROMPT |
text | — | Optional; sent automatically right after the REPL starts |
--chat-id |
text | local |
CLI chat ID |
--session-id |
text | cli_session |
Session ID |
bub chatalways streams output (ignoringBUB_STREAM_OUTPUT).- Exits with code
1if a plugin removes theclichannel. - Direct commands inside the REPL use
BUB_COMMAND_PREFIX(,by default); enter,helpto list available commands.
bub chatbub chat "What changed in this repository?"bub chat --session-id shared:demobub gateway
Section titled “bub gateway”Starts ChannelManager and keeps all enabled external message channels (such as Telegram, Feishu, and Discord) running.
bub gateway [OPTIONS]| Option | Type | Default | Description |
|---|---|---|---|
--enable-channel |
text (repeatable) | reads BUB_ENABLED_CHANNELS |
Enable specific channels, or exclude a channel with !name |
--install |
flag | off | Register and start the gateway as a background user service |
--uninstall |
flag | off | Stop and remove the installed background gateway service |
--install and --uninstall are mutually exclusive; --enable-channel overrides BUB_ENABLED_CHANNELS.
Channel selection rules
Section titled “Channel selection rules”BUB_ENABLED_CHANNELS accepts comma-separated names; --enable-channel can be passed multiple times:
| Value | Channels started |
|---|---|
all (default) |
Every channel and Lifecycle service with enabled=True that is not an Interface, minus !name exclusions |
| Explicit ordinary channel names | Listed ordinary channels with enabled=True (minus exclusions), plus all enabled Lifecycle services |
Only Lifecycle names |
Only the specified Lifecycle background services |
Only !name exclusions |
Fails to start (exit code 1) because no channels are included |
Interfacechannels are interactive UIs (such ascli) that must be selected explicitly and are excluded fromall.Lifecyclechannels are background services (such asmcp.lifecycleandagent-plugins.mcp).- If no channels are enabled, the process prints
No channels are enabled...and exits with code1.
bub gatewaybub gateway --enable-channel telegrambub gateway --enable-channel telegram --enable-channel discordbub gateway --enable-channel telegram --enable-channel '!mcp.lifecycle'Single-quote !name exclusions in your shell (e.g., '!mcp.lifecycle') to prevent shell history expansion.
Background service installation
Section titled “Background service installation”| OS | Installation method | Location / behavior |
|---|---|---|
| Linux | systemd user unit | ${XDG_CONFIG_HOME:-~/.config}/systemd/user/bub-gateway.service (restarts on failure) |
| Windows | Windows Scheduled Task | Task named Bub Gateway, starts at user login and restarts on failure |
| macOS | --install unsupported |
Use launchd, tmux, or Docker deployment |
- Installation records the current Python interpreter, workspace directory, and
--enable-channelflags; re-runbub gateway --installafter changing environments or moving the workspace. - On Linux, run
loginctl enable-linger "$USER"so the service stays running after SSH logout.
bub onboard
Section titled “bub onboard”Runs the interactive configuration wizard and writes settings to ~/.bub/config.yml.
bub onboard [OPTIONS] [PLUGIN_NAME]| Parameter | Type | Default | Description |
|---|---|---|---|
PLUGIN_NAME |
text | none | Optional; run only the specified plugin’s onboard_config wizard |
Without PLUGIN_NAME, runs the built-in model wizard followed by every registered plugin’s wizard; with PLUGIN_NAME, runs only that plugin’s wizard and skips the gateway service prompt.
Model wizard write rules:
| Wizard action | Config result |
|---|---|
| Select OpenAI-compatible or local endpoint | Writes openai:<model>, api_base, and client_args.api_format: chat |
| Select official OpenAI API after a custom URL was set | Resets api_base to https://api.openai.com/v1 |
| Leave Base URL blank | Keeps the provider default without writing an empty value to YAML |
| Enter Base URL explicitly | Writes api_base to YAML (changing Base URL clears any previously saved API key) |
| Leave API key blank | Keeps the existing key for that URL or relies on environment variables |
| Select Codex | Skips fetching the online model list and prompts for a model ID directly |
The connectivity check queries only the provider’s model-list endpoint (10-second timeout). Settings are validated via configure.validate before saving. Exits with 0 on success or 1 on failure.
bub install
Section titled “bub install”Installs plugin packages into Bub’s managed uv project directory; with no arguments, syncs existing dependencies in that project.
bub install [OPTIONS] [SPECS]...| Parameter / Option | Type | Default | Description |
|---|---|---|---|
SPECS |
positional | empty | PyPI package names, bub-contrib plugin names, or Git URLs |
--project |
path | $BUB_HOME/bub-project (default ~/.bub/bub-project) |
Managed plugin project directory (also configurable via BUB_PROJECT) |
Supported package spec formats:
| Format | Resolves to |
|---|---|
package |
PyPI package name |
package@ref |
The packages/package subdirectory of bub-contrib, pinned to branch or tag ref |
owner/repo |
https://github.com/owner/repo.git |
https://github.com/owner/repo.git@ref |
Git repository URL pinned to ref |
git@... or https://... |
Prefixed with git+ and passed to uv |
package@ref uses the official bub-contrib repository by default. To use a fork or mirror, set the top-level contrib_repo in config.yml or override it with BUB_CONTRIB_REPO. Use a Git URL accepted by uv, such as ssh://git@example.com/org/repo.git#subdirectory=plugins/mcp. package@ref supplies the ref and defaults to packages/package unless the URL sets #subdirectory= (use . for the repository root). For private repositories, use an SSH key or Git credential helper rather than putting credentials in the URL.
Do not write owner/repo@v1.2.0: the current parser accepts only the owner/repo shorthand without a ref. To pin any GitHub repository, use the full URL. Bub’s own repository name is also not the same as its package name; when installing a plugin, use the spec given in the plugin’s README.
Examples:
bub install bub-mcp@mainbub install bub-discordbub install https://github.com/owner/repo.git@v1.2.0bub installUnderlying uv commands:
| Bub command | uv invocation |
|---|---|
bub install (no arguments) |
uv sync --active --inexact |
bub install <specs> |
uv add --active <requirements> |
bub uninstall <packages> |
uv remove --active <packages> |
bub update (no arguments) |
uv sync --active --upgrade --inexact |
bub update <packages> |
uv sync --active --inexact --upgrade-package ... |
Prerequisites: uv is installed, bub is running inside a virtual environment (sys.prefix != sys.base_prefix), and any explicit --project directory already exists.
bub uninstall
Section titled “bub uninstall”Uninstalls plugins from the managed plugin project:
bub uninstall [OPTIONS] PACKAGES...bub uninstall bub-discordbub update
Section titled “bub update”Upgrades plugins in the managed plugin project (upgrades all installed plugins when no package names are given):
bub update [OPTIONS] [PACKAGES]...bub updatebub update bub-mcpRestart any running bub chat or bub gateway process after upgrading.
bub login codex
Section titled “bub login codex”Signs in via the OpenAI Codex CLI to configure ChatGPT plan credentials:
bub login codex [OPTIONS]| Option | Type | Default | Description |
|---|---|---|---|
--executable |
text | codex |
Codex CLI executable name or path |
--device-auth |
flag | off | Use device-code authorization |
--codex-home |
path | $CODEX_HOME or ~/.codex |
Directory storing auth.json |
After logging in, set BUB_MODEL=codex:<model> and do not set BUB_API_KEY.
Other account logins
Section titled “Other account logins”Reuse credentials from the official Grok CLI or GitHub CLI (gh):
bub login grok [--executable grok] [--device-auth]bub login github-copilotAfter logging in, set BUB_MODEL=grok:<model> or BUB_MODEL=github-copilot:<model> (no API key required).
bub plugins
Section titled “bub plugins”Lists discovered plugins along with their Python distribution name and version:
bub plugins [OPTIONS] [NAMES]...| Parameter / Option | Type | Default | Description |
|---|---|---|---|
NAMES |
text | all plugins | Query specific plugin entry-point names |
--version-only |
flag | off | Print only the version string per line (- when no package metadata exists) |
Prints name distribution version per line (appending (failed: <error>) if loading failed). Exits with code 1 if a requested name does not exist.
bub hooks
Section titled “bub hooks”Prints all hooks and their bound plugin implementations (hidden diagnostic command not shown in bub --help):
bub hooksFormat: <hook_name>: <implementation>, ..., listed in pluggy registration order. Note that runtime execution order reverses this list; see Hooks reference: Execution priority.
Exit codes
Section titled “Exit codes”| Scenario | Exit code |
|---|---|
| Command succeeded | 0 |
| CLI argument parsing error (Typer) | 2 |
Missing bub[app] extra, no enabled channels, or config/login/plugin lookup failure |
1 |
uv failure in bub install / uninstall / update |
Passes through uv’s exit code |