Skip to content

Shell Integration

aisw provides an optional shell hook for manual or advanced shell workflows.

The hook intercepts aisw use <tool> <profile>, runs the real binary with --emit-env, and applies the emitted export KEY=VALUE lines to the shell environment. All other subcommands are passed through unchanged.

Normal aisw use behavior no longer depends on this hook. aisw init and aisw use apply the selected profile directly to the live Claude/Codex/Gemini config locations, so standalone tool invocations pick up the active profile without extra shell steps. The hook is optional.


Add to ~/.bashrc (or ~/.bash_profile):

Terminal window
eval "$(aisw shell-hook bash)"

Add to ~/.zshrc:

Terminal window
eval "$(aisw shell-hook zsh)"

Add to ~/.config/fish/config.fish:

Terminal window
aisw shell-hook fish | source

Fish cannot eval POSIX export KEY=VALUE syntax, so the fish hook parses each line with string replace / string split and applies the values via set -gx.


aisw ships completion files for bash, zsh, and fish.

When installed via install.sh, completions are installed to these locations:

  • Bash: ~/.local/share/bash-completion/completions/aisw
  • Zsh: the first writable directory in fpath when detectable, otherwise ~/.zsh/completions/_aisw
  • Fish: ~/.config/fish/completions/aisw.fish

Manual installation from source:

Terminal window
cargo build --release
# Bash
install -Dm644 completions/aisw.bash ~/.local/share/bash-completion/completions/aisw
# Zsh
install -Dm644 completions/_aisw ~/.zsh/completions/_aisw
# Fish
install -Dm644 completions/aisw.fish ~/.config/fish/completions/aisw.fish

If you use zsh and ~/.zsh/completions is not already in fpath, add this to ~/.zshrc before compinit:

Terminal window
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit

To regenerate completion files from source:

Terminal window
cargo build --release

The build writes fresh completion files to completions/.


After sourcing, run:

Terminal window
echo $AISW_SHELL_HOOK # should print 1

Remove or comment out the eval / source line from your shell config, then start a new shell session.