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] [--json --no-shell-hook [--detect-live]]
aisw add <tool> <profile> [--api-key KEY|--api-key-stdin] [--from-env] [--from-live] [--label TEXT] [--credential-backend file|system-keyring] [--set-active] [--yes] [--json|--progress-json]
aisw context create <name> [--claude <profile>] [--codex <profile>] [--gemini <profile>] [--antigravity <profile>] [--json]
aisw context list [--search TEXT] [--json]
aisw context use <name> [--state-mode isolated|shared] [--emit-env] [--json]
aisw context set <name> [--claude <profile>] [--codex <profile>] [--gemini <profile>] [--antigravity <profile>] [--json]
aisw context unset <name> [--claude] [--codex] [--gemini] [--antigravity] [--json]
aisw context remove <name> [--yes] [--json]
aisw context rename <old> <new> [--json]
aisw use <tool> <profile> [--state-mode isolated|shared] [--emit-env] [--json]
aisw use --all --profile <profile> [--state-mode isolated|shared] [--emit-env] [--json]
aisw workspace bind [PATH] --context <name> [--json]
aisw workspace bind --git-remote <PATTERN> --context <name> [--json]
aisw workspace bind --default --context <name> [--json]
aisw workspace unbind [PATH] [--json]
aisw workspace unbind --git-remote <PATTERN> [--json]
aisw workspace unbind --default [--json]
aisw workspace status [--json]
aisw workspace doctor [--json]
aisw workspace guard --mode warn|strict [--json]
aisw list [tool] [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--json]
aisw status [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--context] [--json]
aisw remove <tool> <profile> [--yes] [--force] [--json]
aisw rename <tool> <old> <new> [--json]
aisw backup list [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--json]
aisw backup restore <backup_id> [--yes] [--json]
aisw uninstall [--dry-run] [--remove-data] [--yes]
aisw shell-hook <bash|zsh|fish|pwsh>
aisw doctor [--json]
aisw verify [--json]
aisw repair [--json] [--dry-run|--apply] [--fix home,permissions]
aisw project-bindings list [--json]

<tool> is one of: claude, codex, gemini, antigravity.


aisw init [--yes]
aisw init --json --no-shell-hook [--detect-live]

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
--jsonReturn a machine-readable bootstrap payload instead of interactive output
--no-shell-hookSkip shell hook installation or modification; required with --json
--detect-liveInclude live credential detection results in the machine payload

Notes:

  • init is safe to re-run. If ~/.aisw/ already exists, it skips creation and proceeds to detection.
  • init --json is non-prompting by design. It creates ~/.aisw/config.json, never edits shell rc files, and can report live credentials without importing them.
  • 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 init --json --no-shell-hook --detect-live

aisw add <tool> <profile> [--api-key KEY|--api-key-stdin] [--from-env] [--from-live] [--label TEXT] [--credential-backend file|system-keyring] [--set-active] [--yes] [--json|--progress-json]

Create a named profile.

FlagEffect
--api-key KEYStore the given API key
--api-key-stdinRead the API key from stdin until EOF
--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
`—credential-backend filesystem-keyring`
--set-activeActivate the profile immediately after adding
--yesOverwrite an existing profile when used with --from-live
--jsonReturn a single machine-readable result envelope
--progress-jsonStream newline-delimited JSON progress events, then a final result event

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.
  • --api-key-stdin is intended for GUI and automation integrations that should not expose secrets in process arguments.
  • --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.
  • For Codex ChatGPT-managed auth, --from-live is a bootstrap import, not a durable interchangeable account bundle.
  • For Antigravity, --from-live captures the current shared live keyring-backed session plus the documented Antigravity config roots.
  • add refuses to store the same account twice. For OAuth it compares the resolved account identity; for API keys it compares the key itself. The error names the existing profile, so re-running add with a key you already stored fails rather than creating a second name for it.
  • --credential-backend affects the managed aisw profile only. It does not force the upstream CLI’s live auth backend.
  • Gemini supports only file. Claude, Codex, and Antigravity support file and system-keyring. Stored config and status output use system_keyring.
  • Antigravity is OAuth-only: --api-key, --api-key-stdin, and --from-env are rejected for it, because upstream documents keyring-backed sign-in rather than API-key profile auth. Use aisw add antigravity <name> or --from-live.
  • API keys must be a single line. A key containing a newline or other control character is rejected - usually a stray newline from copy/paste or from piping a file into --api-key.

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/
  • Antigravity: live OS keyring auth plus config/state under ~/.gemini/antigravity-cli/ and ~/.gemini/config/
Terminal window
aisw add claude work --api-key "$ANTHROPIC_API_KEY"
printf '%s' "$ANTHROPIC_API_KEY" | aisw add claude work --api-key-stdin --json
aisw add codex ci --from-env
aisw add claude personal --progress-json
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] [--emit-env] [--json]
aisw use --all --profile <profile> [--state-mode isolated|shared] [--emit-env] [--json]

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
--emit-envPrint shell export/unset lines to stdout instead of writing them to the session
--jsonReturn a single machine-readable result envelope

Notes:

  • --state-mode applies to Claude Code and Codex CLI only. Gemini and Antigravity do not support it. With --all, it is applied only to the tools that support it rather than failing the whole switch.
  • Switching is atomic: the previous live state is snapshotted before any write. A failed write triggers a full rollback.
  • With --all, a tool that has no profile of that name is skipped and the command still succeeds. A tool that has the profile but fails to switch is reported and the command exits non-zero.
  • With shell hook active, aisw use also emits the environment variable exports into the current shell session.
  • --emit-env is used internally by the shell hook. You can use it directly to apply exports in a subshell: eval "$(aisw use claude work --emit-env)".
  • Codex shared mode remains supported for API-key profiles.
  • Codex shared mode is blocked for ChatGPT-managed auth. Use --state-mode isolated instead; this is an expected upstream limitation, not aisw corruption.
Terminal window
aisw use claude work
aisw use codex work --state-mode shared
aisw use --all --profile personal
eval "$(aisw use claude work --emit-env)"

Contexts are saved cross-tool mappings. They let you bind different per-tool profile names under one higher-level name such as work, personal, client-acme, or oss.

Practical framing:

  • Use a profile when you want to switch one tool’s account.
  • Use a context when you want to switch one whole multi-tool work mode.
aisw context create <name> [--claude <profile>] [--codex <profile>] [--gemini <profile>] [--antigravity <profile>] [--json]

Create a saved context. At least one tool mapping is required.

Terminal window
aisw context create acme --claude acme-claude --codex acme-codex
aisw context create acme --claude acme-claude --json
aisw context list [--search TEXT] [--json]

List saved contexts.

FlagEffect
--search TEXTFilter by context name or mapped profile name
--jsonOutput as JSON
Terminal window
aisw context list
aisw context list --search acme
aisw context list --json
aisw context use <name> [--state-mode isolated|shared] [--emit-env] [--json]

Activate every mapped tool in a saved context as one transaction.

FlagEffect
--state-mode isolatedSet CLAUDE_CONFIG_DIR and CODEX_HOME to profile directories (default)
--state-mode sharedUnset CLAUDE_CONFIG_DIR and CODEX_HOME for Claude and Codex
--emit-envPrint shell export/unset lines to stdout instead of writing them to the session
--jsonOutput a machine-readable activation result envelope

Notes:

  • Default state mode is isolated.
  • --state-mode shared applies only to Claude Code and Codex CLI.
  • For Codex, --state-mode shared is blocked when the mapped profile uses ChatGPT-managed auth.
  • Activation is transactional across mapped tools. If one tool write fails, prior live state is restored.
  • With the shell hook active, aisw context use applies emitted env vars to the current shell the same way aisw use does.
Terminal window
aisw context use acme
aisw context use acme --state-mode shared
aisw context use acme --json
eval "$(aisw context use acme --emit-env)"
aisw context set <name> [--claude <profile>] [--codex <profile>] [--gemini <profile>] [--antigravity <profile>] [--json]

Update one or more mappings without disturbing the others.

Terminal window
aisw context set acme --gemini acme-gemini
aisw context set acme --gemini acme-gemini --json
aisw context unset <name> [--claude] [--codex] [--gemini] [--antigravity] [--json]

Remove one or more mappings from a context. The command fails if it would leave the context empty.

Terminal window
aisw context unset acme --codex
aisw context unset acme --codex --json
aisw context remove <name> [--yes] [--json]

Delete a saved context. This does not change live credentials or active per-tool profiles.

Terminal window
aisw context remove acme --yes
aisw context remove acme --yes --json
aisw context rename <old> <new> [--json]

Rename a saved context. This does not change live credentials or active per-tool profiles.

Terminal window
aisw context rename acme client-acme
aisw context rename acme client-acme --json

Bind repos, directories, and git remotes to expected aisw contexts. The shell hook checks these bindings before launching claude, codex, gemini, or agy, warning or blocking when the active context does not match.

See Workspace guardrails for a full explanation of the feature, setup steps, and common patterns.

aisw workspace bind [PATH] --context <name> [--json]
aisw workspace bind --git-remote <PATTERN> --context <name> [--json]
aisw workspace bind --default --context <name> [--json]

Create or update a workspace binding. The context must already exist.

FlagEffect
PATHPath to bind. Defaults to .. Inside a git repo, writes .git/info/aisw.json. Outside a repo, writes a path rule to ~/.aisw/workspaces.json.
--context NAMEExpected context name for this location
--git-remote PATTERNBind by git remote URL pattern. Supports * wildcards.
--defaultSet the fallback context for locations with no more specific rule.
--jsonOutput a machine-readable mutation envelope with the refreshed bindings snapshot
Terminal window
aisw workspace bind . --context client-acme
aisw workspace bind --git-remote "github.com/acme/*" --context client-acme
aisw workspace bind ~/clients --context client-acme
aisw workspace bind --default --context personal
aisw workspace bind --default --context personal --json
aisw workspace unbind [PATH] [--json]
aisw workspace unbind --git-remote <PATTERN> [--json]
aisw workspace unbind --default [--json]

Remove an existing workspace binding.

FlagEffect
PATHPath to unbind. Defaults to .. Inside a git repo, removes .git/info/aisw.json. Outside a repo, removes the matching path rule from ~/.aisw/workspaces.json.
--git-remote PATTERNRemove a git remote rule. Supports the same normalization as bind, so git@github.com:acme/* and github.com/acme/* target the same rule.
--defaultClear the fallback context for locations with no more specific rule.
--jsonOutput a machine-readable mutation envelope with the refreshed bindings snapshot

Notes:

  • unbind errors if the targeted binding does not exist.
  • When invoked in a git repo without PATH, repo-local unbind removes .git/info/aisw.json.
Terminal window
aisw workspace unbind .
aisw workspace unbind ~/clients/acme-api
aisw workspace unbind --git-remote "github.com/acme/*"
aisw workspace unbind --default --json
aisw workspace status [--json]

Show the resolved binding for the current directory: matched rule, expected context, active context/profiles, status, and recommended action.

Terminal window
aisw workspace status
aisw workspace status --json
aisw workspace doctor [--json]

Validate all workspace rules. Checks that referenced context names still exist and reports the resolved state for the current directory.

Terminal window
aisw workspace doctor
aisw workspace doctor --json
aisw workspace guard --mode warn|strict [--json]

Set the default guard mode, saved to ~/.aisw/workspaces.json.

With --json, the success envelope includes the updated guard_mode and the same bindings snapshot returned by aisw project-bindings list --json.

ModeEffect
warnPrint a warning before launching an agent. The launch proceeds. (Default)
strictBlock the agent launch entirely and print a remediation command.
Terminal window
aisw workspace guard --mode warn
aisw workspace guard --mode strict
aisw workspace guard --mode strict --json

aisw list [tool] [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--json]

Show all stored profiles. Pass a tool name as a positional argument or use --tool to filter to one tool.

FlagEffect
[tool] or --toolFilter to one tool: claude, codex, gemini, or antigravity
--search TEXTFilter by profile name or label (substring match)
--sort name|recentSort by profile name or by most recently used
--active-onlyShow only tools that have an active profile
--jsonOutput as JSON
Terminal window
aisw list
aisw list claude
aisw list --tool codex --search work
aisw list --sort recent
aisw list --active-only --json

aisw status [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--context] [--json]

Show per-tool state: installed binary, active profile, credential backend, live-match status, and token expiry warnings.

FlagEffect
--toolFilter to one tool: claude, codex, gemini, or antigravity
--search TEXTFilter by tool, profile, auth type, or backend text
--sort name|recentSort rows by name or most recently used
--active-onlyShow only tools that have an active profile
--contextAdd derived context matching information
--jsonOutput as JSON

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.
  • --context does not change the shape of plain status --json output.
  • status --context --json wraps the tool array in a { "tools": [...], "context": ... } object.
Terminal window
aisw status
aisw status --context
aisw status --tool claude
aisw status --active-only
aisw status --search work --json
aisw status --context --json

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

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

FlagEffect
--yesSkip confirmation prompt
--forceAllow removing the currently active profile
--jsonReturn a single machine-readable result envelope

Notes:

  • A profile that is still mapped by a saved context cannot be removed. The command names the blocking contexts and leaves the profile untouched; update or remove those contexts first with aisw context unset or aisw context remove.
  • Removing the currently active profile with --force also clears the active selection for that tool.
Terminal window
aisw remove codex old --yes
aisw remove claude work --force --yes

aisw rename <tool> <old> <new> [--json]

Rename a profile. The profile directory, the managed credential secret, and all config references (including any context that maps the profile) are updated atomically. If any step fails, the earlier steps are rolled back.

Terminal window
aisw rename claude default work
aisw rename claude default work --json

aisw backup list [--tool <tool>] [--search TEXT] [--sort name|recent] [--active-only] [--json]

List available backups with timestamps and associated profile names.

FlagEffect
--toolFilter to one tool: claude, codex, gemini, or antigravity
--search TEXTFilter by backup id, tool, or profile name
--sort name|recentSort by name or by most recently created
--active-onlyShow only backups for currently active profiles
--jsonOutput as JSON
Terminal window
aisw backup list
aisw backup list --tool claude
aisw backup list --search work --json
aisw backup list --sort recent

aisw backup restore <backup_id> [--yes] [--json]

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 2026-03-25T11-45-02.123Z-0000 --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|pwsh>

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
aisw shell-hook pwsh >> $PROFILE

The hook does two things:

  1. Wraps aisw use and aisw context use so environment variable exports are applied into the current shell session automatically.
  2. Wraps claude, codex, gemini, and agy to run aisw workspace check before each launch, enforcing any configured workspace guardrails.

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

aisw verify [--json]

Read-only confidence check that combines installation health with live profile coherence.

  • Reuses doctor checks for binaries, config, shell hook, keyring, and permissions.
  • Verifies whether each active tool’s live credentials still match the profile aisw records as active.
  • Returns non-zero when concrete failures are found, such as live mismatch, missing managed credentials, or missing binaries.
FlagEffect
--jsonOutput a machine-readable verification report

Notes:

  • verify is stricter than status --json: it adds an overall pass/warn/fail verdict and remediation hints.
  • verify is read-only. It never reapplies credentials or modifies shell files.
  • On macOS, Claude file-backed live verification can remain observational because the live Keychain state is not always inspectable.
Terminal window
aisw verify
aisw verify --json

aisw repair [--json] [--dry-run|--apply] [--fix home,permissions]

Preview or apply safe local repairs for aisw-managed state.

  • home: create AISW_HOME and a default config.json when missing
  • permissions: normalize aisw-managed directories to 0700 and files to 0600 on Unix
FlagEffect
--jsonOutput a machine-readable repair result envelope
--dry-runPreview repair actions without mutating files
--applyApply the selected safe fixes
--fixLimit repairs to one or more fix categories; accepts comma-separated values

Notes:

  • If neither --dry-run nor --apply is provided, repair defaults to dry-run mode.
  • repair is explicit and cautious. It does not reapply live credentials, restore backups, or modify shell rc files.
  • --fix defaults to all currently safe repair categories.
Terminal window
aisw repair
aisw repair --json --dry-run
aisw repair --apply --fix home
aisw repair --json --apply --fix home,permissions

aisw project-bindings list [--json]

List workspace binding rules that matter to GUI/project-aware flows.

  • Includes saved guard_mode
  • Includes user-level workspace rules from ~/.aisw/workspaces.json
  • Includes the current repo-local binding from .git/info/aisw.json when the current directory is inside a repo
  • Does not scan the filesystem for arbitrary repo-local binding files outside the current repo
Terminal window
aisw project-bindings list
aisw project-bindings list --json

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