Complete reference for openclaw completion, generating, installing, and writing shell tab-completion scripts for zsh, bash, fish, and PowerShell.

What does Openclaw Completion do?
It generates tab-completion scripts that teach your shell how to autocomplete openclaw commands, subcommands, and flags. Without this, you’re typing blind.
The generator eagerly loads the full command tree at generation time, meaning nested subcommands like openclaw agents bind or openclaw browser tab close are baked into the script, not lazily resolved at runtime. This means the script stays accurate as long as you regenerate it after CLI updates.
Two Ways to Get Completions Working
The quick path is openclaw completion –install, it handles everything automatically by writing the script to the state directory and adding a source line to your shell profile. The manual path is openclaw completion –shell <shell> piped wherever you need it, useful if you manage your dotfiles with a tool like Chezmoi or Nix. If you’re unsure which shell you’re running, check the Supported Shells table. PowerShell users have a slightly different sourcing mechanism.
Basic Commands
Generate and inspect the completion script without modifying any files. Useful for dotfile managers or reviewing the output before committing to an install.
| openclaw completion Generates and prints the completion script to standard output. Defaults to zsh when no shell is specified. Pipe this wherever you need it, into a file, your dotfile manager, or directly sourced in the terminal. |
| openclaw completion –shell <shell> Generates the completion script for a specific shell target. Accepted values: zsh bash powershell fish. |
print to stdout — manual dotfile control
# Default output (zsh) openclaw completion # Specific shell targets openclaw completion --shell bash openclaw completion --shell fish openclaw completion --shell powershell # Redirect into a file manually openclaw completion --shell bash > ~/.local/share/bash-completion/completions/openclaw
Supported Shells
The –shell flag accepts exactly four values. The shell grid below maps them to their platforms and default status.
| zsh macOS · Linux default | bash macOS · Linux · CI | fish macOS · Linux | powershell Windows · cross-platform |
Not sure which shell you’re on? Run echo $SHELL on Unix-like systems, or $PSVersionTable in PowerShell to confirm. The –install flag auto-detects your active shell and targets the correct profile file.
Installation Commands
Two install modes, automated profile injection or writing directly to the state directory. Both are idempotent and safe to run more than once.
| openclaw completion –install Recommended for most setups. Installs the completion script by adding a small “OpenClaw Completion” source line block into your shell profile, pointing it at the cached script. The profile file is auto-detected based on your active shell. Prompts for confirmation before writing, pass -y to skip. |
| openclaw completion –write-state Writes the completion script(s) to $OPENCLAW_STATE_DIR/completions directly, without printing the script to your terminal and without modifying your shell profile. Use this when you manage the source line yourself, or when your shell profile already sources everything from the state directory. |
install variants
# Auto-detect shell + inject source line into profile (with prompt) openclaw completion --install # Same, skip confirmation openclaw completion --install -y # Install for a specific shell non-interactively openclaw completion --shell bash --install -y # Write to state dir only, no profile modification openclaw completion --write-state
After running –install, you need to restart your shell or source your profile for completions to activate. The install command writes the files and adds the source line, but it doesn’t reload your current session.
Per-Shell Install Guide
The one-liner for each supported shell. The –install flag handles this automatically, but if you need manual control over where the source line goes, these are the equivalent commands.
# Generate and install (auto-injects into ~/.zshrc)
openclaw completion --shell zsh --install -y
# Or manually redirect into a completions directory
openclaw completion --shell zsh > ${fpath[1]}/_openclaw
# Then reload
source ~/.zshrc
All four shells are supported by –install, just pass the corresponding –shell value alongside it. The auto-detect path (no –shell flag) reads your $SHELL environment variable and targets the right profile file automatically.

Options Reference
Full flag reference for openclaw completion. Short and long forms are interchangeable where both exist.
| Short | Long | Description |
|---|---|---|
| -s | --shell <shell> | Specifies the shell target. Accepts zsh, bash, powershell, fish. Default is zsh. |
| -i | –install | Installs the completion by adding a source line to your shell profile. Auto-detects the active shell when –shell is omitted. |
| — | –write-state | Writes the completion script(s) to $OPENCLAW_STATE_DIR/completions without printing to stdout and without touching your shell profile. |
| -y | –yes | Skips the install confirmation prompts. Use in CI or unattended dotfile setup scripts. |
The completion generator eagerly loads the full command tree so that all nested subcommands are included in the generated script. After upgrading the Openclaw CLI, re-run openclaw completion –install -y to refresh the cached script with any new commands or flags.
