Commands
Global flags
Section titled “Global flags”aisw [--no-color] [--non-interactive] [--quiet] <command> ...| Flag | Effect |
|---|---|
--no-color | Disable ANSI color output |
--non-interactive | Fail instead of prompting; safe for CI |
--quiet | Suppress human-readable presentation output; does not suppress errors, JSON output, --emit-env, or shell-hook |
At a glance
Section titled “At a glance”aisw init [--yes]aisw add <tool> <profile> [--api-key KEY] [--from-env] [--from-live] [--label TEXT] [--set-active] [--yes]aisw use <tool> <profile> [--state-mode isolated|shared]aisw use --all --profile <profile> [--state-mode isolated|shared]aisw list [tool] [--json]aisw status [--json]aisw remove <tool> <profile> [--yes] [--force]aisw rename <tool> <old> <new>aisw backup list [--json]aisw backup restore <backup_id> [--yes]aisw uninstall [--dry-run] [--remove-data] [--yes]aisw shell-hook <bash|zsh|fish>aisw doctor [--json]<tool> is one of: claude, codex, gemini.
aisw init
Section titled “aisw init”aisw init [--yes]Bootstrap command. Run once after install.
- Creates
~/.aisw/with0700permissions. - Offers shell hook installation for bash, zsh, or fish.
- Detects currently logged-in accounts for each tool and offers to import them as named profiles.
- Reports current live state per tool, including whether it matches any existing
aiswprofile.
| Flag | Effect |
|---|---|
--yes | Accept all prompts without confirmation |
Notes:
initis safe to re-run. If~/.aisw/already exists, it skips creation and proceeds to detection.- For Gemini, when both
~/.gemini/.envand OAuth cache files are present, import uses the.envfile first. - For Claude Code on macOS,
initchecks the Keychain before checking the credentials file. initwill not import a duplicate if the OAuth identity matches an already-stored profile.
aisw initaisw init --yesaisw add
Section titled “aisw add”aisw add <tool> <profile> [--api-key KEY] [--from-env] [--from-live] [--label TEXT] [--set-active] [--yes]Create a named profile.
| Flag | Effect |
|---|---|
--api-key KEY | Store the given API key |
--from-env | Read the key from the tool’s env var (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY) |
--from-live | Capture the tool’s current live credentials without launching login |
--label TEXT | Human-readable description, shown in list and status |
--set-active | Activate the profile immediately after adding |
--yes | Overwrite an existing profile when used with --from-live |
Notes:
- Without
--api-key,--from-env, or--from-live,addruns the interactive OAuth flow for the tool. - In
--non-interactivemode, interactive OAuth is not available and the command fails. --from-livecaptures what the tool is currently using; it does not launch a browser or auth flow.--from-livealways activates the profile because those credentials are already live.--from-live --yesoverwrites an existing profile in place; the existing entry is not removed until capture succeeds.- When OAuth identity can be resolved,
addblocks creating a duplicate profile for an already-stored account.
Live credential locations by tool:
- Claude:
~/.claude/.credentials.jsonor the macOS Keychain - Codex:
~/.codex/auth.jsonor the OS keyring - Gemini:
~/.gemini/.env(API key) or OAuth files in~/.gemini/
aisw add claude work --api-key "$ANTHROPIC_API_KEY"aisw add codex ci --from-envaisw add gemini personal --label "Personal account" --set-activeaisw add claude work --from-liveaisw add codex work --from-live --yesaisw use
Section titled “aisw use”aisw use <tool> <profile> [--state-mode isolated|shared]aisw use --all --profile <profile> [--state-mode isolated|shared]Activate a stored profile as the live account.
| Flag | Effect |
|---|---|
--state-mode isolated | Set CLAUDE_CONFIG_DIR or CODEX_HOME to the profile directory (default) |
--state-mode shared | Unset CLAUDE_CONFIG_DIR or CODEX_HOME; tool reads its standard config dir |
--all | Switch every tool that has a matching profile name |
--profile NAME | Profile name; required with --all |
Notes:
--state-modeapplies to Claude Code and Codex CLI only. Gemini does not support it.- Switching is atomic: the previous live state is snapshotted before any write. A failed write triggers a full rollback.
- With shell hook active,
aisw usealso emits the environment variable exports into the current shell session.
aisw use claude workaisw use codex work --state-mode sharedaisw use --all --profile personalaisw list
Section titled “aisw list”aisw list [tool] [--json]Show all stored profiles.
aisw listaisw list claudeaisw list --jsonaisw status
Section titled “aisw status”aisw status [--json]Show per-tool state: installed binary, active profile, credential backend, live-match status, and token expiry warnings.
Notes:
- “Live match” indicates whether the tool’s current live credentials match the
aisw-recorded active profile. - Token expiry warnings appear when an OAuth token is expired or expires within 24 hours.
aisw statusaisw status --jsonaisw remove
Section titled “aisw remove”aisw remove <tool> <profile> [--yes] [--force]Delete a stored profile. A backup is created before deletion.
| Flag | Effect |
|---|---|
--yes | Skip confirmation prompt |
--force | Allow removing the currently active profile |
aisw remove codex old --yesaisw remove claude work --force --yesaisw rename
Section titled “aisw rename”aisw rename <tool> <old> <new>Rename a profile. The profile directory and all config references are updated atomically.
aisw rename claude default workaisw backup list
Section titled “aisw backup list”aisw backup list [--json]List available backups with timestamps and associated profile names.
aisw backup listaisw backup list --jsonaisw backup restore
Section titled “aisw backup restore”aisw backup restore <backup_id> [--yes]Restore profile files from a backup. Does not activate the profile; run aisw use after restore.
| Flag | Effect |
|---|---|
--yes | Skip confirmation prompt |
aisw backup restore 20260325T114502Z-claude-work --yesaisw use claude workaisw uninstall
Section titled “aisw uninstall”aisw uninstall [--dry-run] [--remove-data] [--yes]Remove aisw-managed shell hook blocks from shell config files.
| Flag | Effect |
|---|---|
--dry-run | Preview what would be changed without making any changes |
--remove-data | Also remove ~/.aisw/ after hook cleanup |
--yes | Skip confirmation prompt |
Notes:
- Does not remove the
aiswbinary. - Does not remove tool config directories (
~/.claude/,~/.codex/,~/.gemini/). - Only removes
# aiswhook blocks thataisw initoraisw shell-hookadded.
aisw uninstall --dry-runaisw uninstall --yesaisw uninstall --remove-data --yesaisw shell-hook
Section titled “aisw shell-hook”aisw shell-hook <bash|zsh|fish>Print the shell hook code for the given shell. Redirect into your shell config file:
aisw shell-hook zsh >> ~/.zshrcaisw shell-hook bash >> ~/.bashrcaisw shell-hook fish >> ~/.config/fish/conf.d/aisw.fishSee Shell integration for details and completion setup.
aisw doctor
Section titled “aisw doctor”aisw doctor [--json]Check install and environment health: binary locations, ~/.aisw/ permissions, shell hook status, and keyring availability.
aisw doctoraisw doctor --jsonAutomation reference
Section titled “Automation reference”For CI patterns, JSON output contracts, and non-interactive usage, see Automation and scripting.