Reference

Auth and CLI Config

Sign in with agentclash auth, manage CLI tokens, and understand where the CLI stores config and how it resolves the API URL, workspace, and token.

This page covers the agentclash auth and agentclash config commands, the files they write, and the environment variables that override them in CI. For worker and API server settings see the Config Reference.

Sign in

bash
1agentclash auth login            # opens a browser to approve the login
2agentclash auth login --device   # print the verification URL instead of opening a browser
3agentclash auth login --force    # start a new browser login even if credentials are valid
4agentclash auth status           # show who the CLI is authenticated as
5agentclash auth logout           # delete stored credentials

auth login prints a verification link, opens it in your default browser when possible, and waits for you to approve the login. Use --device in headless or remote shells. Browser login needs an interactive terminal; in CI set AGENTCLASH_TOKEN instead.

auth status calls the API and prints your user ID, email, display name, and the number of organization and workspace memberships. If you are not logged in it prints a message and exits with code 1. With --json it returns the raw session object.

auth logout only deletes the stored credentials file. It does not unset AGENTCLASH_TOKEN, and it does not revoke the token on the server (use auth tokens revoke for that).

CLI tokens

bash
1agentclash auth tokens list              # ID, name, last used, created
2agentclash auth tokens revoke <token-id>

tokens list shows your CLI tokens (a token that has never been used shows never under Last Used). tokens revoke revokes one by ID.

Where things are stored

ItemLocationNotes
User config~/.config/agentclash/config.yamlWritten by config set, workspace use, and link; mode 0600
Credentials~/.config/agentclash/credentials.jsonWritten by auth login; JSON with the token and optional expiry, user ID, and email; mode 0600
Project config.agentclash.yamlOptional; found by searching from the current directory upward. Keys: workspace_id, org_id

If XDG_CONFIG_HOME is set, the directory is $XDG_CONFIG_HOME/agentclash instead. The config directory is created with mode 0700. The saved baseline bookmark (agentclash baseline set) is also kept in the user config file, per workspace.

Read and write config

bash
1agentclash config list
2agentclash config get api_url
3agentclash config set output json

Valid keys are default_workspace, default_org, api_url, and output. config set rejects unknown keys, and output must be one of table, json, or yaml. config get on an unset key exits with an error in table mode; with --json it returns {"key": "...", "value": null} and exits 0. config list prints (not set) for empty values.

How values are resolved

API URL, highest priority first:

  1. --api-url flag
  2. AGENTCLASH_API_URL environment variable
  3. api_url in the saved user config
  4. Built-in default: https://api.agentclash.dev for released binaries, http://localhost:8080 for source builds

Workspace, highest priority first:

  1. --workspace / -w flag
  2. AGENTCLASH_WORKSPACE environment variable
  3. workspace_id in the nearest .agentclash.yaml
  4. default_workspace in the saved user config

Organization uses AGENTCLASH_ORG, then org_id in .agentclash.yaml, then default_org in the user config.

Token: when AGENTCLASH_TOKEN is set it always takes precedence over the stored credentials file. If you run auth login while it is set, the CLI saves the new credentials but warns that the environment variable still wins.

CI usage

bash
1export AGENTCLASH_API_URL="https://api.agentclash.dev"
2export AGENTCLASH_TOKEN="<cli-token>"
3export AGENTCLASH_WORKSPACE="<workspace-id>"
4
5agentclash run list

No auth login is needed when AGENTCLASH_TOKEN is set. Pair this with --non-interactive (also implied by CI and AGENTCLASH_NONINTERACTIVE) so the CLI fails fast instead of prompting.

See also