Skip to content

Commands

aisw [--no-color] [--non-interactive] [--quiet] <command> ...
FlagEffect
--no-colorDisable ANSI color output
--non-interactiveFail instead of prompting; safe for CI
--quietSuppress human-readable presentation output; does not suppress errors, JSON output, --emit-env, or shell-hook
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 [--yes]

Bootstrap command. Run once after install.

  • Creates ~/.aisw/ with 0700 permissions.
  • 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 aisw profile.
FlagEffect
--yesAccept all prompts without confirmation

Notes:

  • init is safe to re-run. If ~/.aisw/ already exists, it skips creation and proceeds to detection.
  • For Gemini, when both ~/.gemini/.env and OAuth cache files are present, import uses the .env file first.
  • For Claude Code on macOS, init checks the Keychain before checking the credentials file.
  • init will not import a duplicate if the OAuth identity matches an already-stored profile.
Terminal window
aisw init
aisw init --yes

aisw add <tool> <profile> [--api-key KEY] [--from-env] [--from-live] [--label TEXT] [--set-active] [--yes]

Create a named profile.

FlagEffect
--api-key KEYStore the given API key
--from-envRead the key from the tool’s env var (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY)
--from-liveCapture the tool’s current live credentials without launching login
--label TEXTHuman-readable description, shown in list and status
--set-activeActivate the profile immediately after adding
--yesOverwrite an existing profile when used with --from-live

Notes:

  • Without --api-key, --from-env, or --from-live, add runs the interactive OAuth flow for the tool.
  • In --non-interactive mode, interactive OAuth is not available and the command fails.
  • --from-live captures what the tool is currently using; it does not launch a browser or auth flow.
  • --from-live always activates the profile because those credentials are already live.
  • --from-live --yes overwrites an existing profile in place; the existing entry is not removed until capture succeeds.
  • When OAuth identity can be resolved, add blocks creating a duplicate profile for an already-stored account.

Live credential locations by tool:

  • Claude: ~/.claude/.credentials.json or the macOS Keychain
  • Codex: ~/.codex/auth.json or the OS keyring
  • Gemini: ~/.gemini/.env (API key) or OAuth files in ~/.gemini/
Terminal window
aisw add claude work --api-key "$ANTHROPIC_API_KEY"
aisw add codex ci --from-env
aisw add gemini personal --label "Personal account" --set-active
aisw add claude work --from-live
aisw add codex work --from-live --yes

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.

FlagEffect
--state-mode isolatedSet CLAUDE_CONFIG_DIR or CODEX_HOME to the profile directory (default)
--state-mode sharedUnset CLAUDE_CONFIG_DIR or CODEX_HOME; tool reads its standard config dir
--allSwitch every tool that has a matching profile name
--profile NAMEProfile name; required with --all

Notes:

  • --state-mode applies 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 use also emits the environment variable exports into the current shell session.
Terminal window
aisw use claude work
aisw use codex work --state-mode shared
aisw use --all --profile personal

aisw list [tool] [--json]

Show all stored profiles.

Terminal window
aisw list
aisw list claude
aisw list --json

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.
Terminal window
aisw status
aisw status --json

aisw remove <tool> <profile> [--yes] [--force]

Delete a stored profile. A backup is created before deletion.

FlagEffect
--yesSkip confirmation prompt
--forceAllow removing the currently active profile
Terminal window
aisw remove codex old --yes
aisw remove claude work --force --yes

aisw rename <tool> <old> <new>

Rename a profile. The profile directory and all config references are updated atomically.

Terminal window
aisw rename claude default work

aisw backup list [--json]

List available backups with timestamps and associated profile names.

Terminal window
aisw backup list
aisw backup list --json

aisw backup restore <backup_id> [--yes]

Restore profile files from a backup. Does not activate the profile; run aisw use after restore.

FlagEffect
--yesSkip confirmation prompt
Terminal window
aisw backup restore 20260325T114502Z-claude-work --yes
aisw use claude work

aisw uninstall [--dry-run] [--remove-data] [--yes]

Remove aisw-managed shell hook blocks from shell config files.

FlagEffect
--dry-runPreview what would be changed without making any changes
--remove-dataAlso remove ~/.aisw/ after hook cleanup
--yesSkip confirmation prompt

Notes:

  • Does not remove the aisw binary.
  • Does not remove tool config directories (~/.claude/, ~/.codex/, ~/.gemini/).
  • Only removes # aisw hook blocks that aisw init or aisw shell-hook added.
Terminal window
aisw uninstall --dry-run
aisw uninstall --yes
aisw uninstall --remove-data --yes

aisw shell-hook <bash|zsh|fish>

Print the shell hook code for the given shell. Redirect into your shell config file:

Terminal window
aisw shell-hook zsh >> ~/.zshrc
aisw shell-hook bash >> ~/.bashrc
aisw shell-hook fish >> ~/.config/fish/conf.d/aisw.fish

See Shell integration for details and completion setup.


aisw doctor [--json]

Check install and environment health: binary locations, ~/.aisw/ permissions, shell hook status, and keyring availability.

Terminal window
aisw doctor
aisw doctor --json

For CI patterns, JSON output contracts, and non-interactive usage, see Automation and scripting.