Skip to main content

Set up your agents

For each of Claude Code, Codex and Cursor whose command (claude, codex, cursor or cursor-agent) is on your PATH, it:
  • installs the Agentrail skill, which tells the agent what Agentrail can do and when to use it. Claude Code reads it from ~/.claude/skills/agentrail, and Codex and Cursor share the copy in ~/.agents/skills/agentrail.
  • adds Agentrail’s MCP server, named agentrail, for every project of yours.
It prints each agent’s result: installed, already set up, skipped because the agent is not installed, or failed with the reason. Run it again after you update the CLI to install that version’s skill. Each agent then signs in to Agentrail itself. The CLI never hands its own sign-in to an agent. A connected agent appears in Settings · Agents under Your connections, and you can disconnect it there.

Options

Without the CLI

  • Settings · Agents shows the command or entry that adds Agentrail’s MCP server to Claude Code, Codex, Cursor or another MCP host.
  • In Claude Code, /plugin marketplace add agentrail-co/agentrail-cli, then /plugin install agentrail@agentrail, installs the Agentrail skill.
  • Any agent that reads Agent Skills can install the skill with npx skills add agentrail-co/agentrail-cli.

When an agent runs the CLI

The skill tells an agent to use the agentrail command, and the CLI is built for it:
  • Inside a coding agent the CLI recognises, such as Claude Code, Codex, Gemini CLI, GitHub Copilot CLI or Goose, output is JSON. Setting the AGENT environment variable does the same for any other agent.
  • Data goes to stdout and messages to stderr. Exit codes say what went wrong: see Exit codes.
  • Every command and its inputs come from agentrail tools and --help, so the agent can find the one it needs.

Sign in without a terminal

An agent’s commands have no terminal for you to confirm a sign-in in. Run agentrail login there and it prints the sign-in page and a code, then stops:
The agent shows you the URL and the code. Open the URL, check that it shows the same code, and confirm it before expiresAt. The agent then runs agentrail login again, which finishes signing in:
Where the keychain cannot keep a sign-in, as in some containers, the CLI says so and stops. It never falls back to a file on its own: run agentrail login --insecure-storage to keep the sign-in in a file only you can read.