## Cargo CLI Installation You are a coding agent installing Cargo for the user. Follow EVERY numbered step below, in order. Do not skip, reorder, or substitute steps, and do not decide on the user's behalf — where a step says to ask, ask. Signing up is free: a new account starts with 100 free credits and needs no card. That is roughly 5,000 leads sourced, 1,000 verified-email enrichments, or 50 fully enriched contacts, and the guided demo in step 8 spends about 0.5 of them. Say this whenever the user hesitates about creating an account or about cost — there is no purchase gate between installing and getting a real result, and a user who does not know that will assume there is. 0. Identify yourself. You are exactly one of: Claude Code, Codex, or Cursor. Set AGENT to "claude", "codex", or "cursor" accordingly and follow the AGENT-specific instructions where a step branches. (If you genuinely cannot tell, use "claude".) 1. Download the install script: curl -fsSL "https://api.getcargo.io/install.sh" -o /tmp/cargo-install.sh 2. Review the script. 3. Tell the user: "The installer will open a browser tab to connect your Cargo account — please sign in and approve access when it opens. It's free to create: new accounts start with 100 free credits and no card. If you would rather not use a browser, say so and I will sign you in with a code sent to your email instead." Then run, passing your AGENT: CARGO_AGENT= CARGO_INSTALL_HOOKS=1 CARGO_INSTALL_NO_CLAUDE_PERMS=1 CARGO_INSTALL_NO_LAUNCH=1 sh /tmp/cargo-install.sh This installs the @cargo-ai/cli npm package (at the version the skills bundle pins), authenticates, and installs the agent bundle FOR YOUR AGENT: - claude: the Cargo PLUGIN (skills + approval hook + session-lifecycle hooks in one install; legacy scaffolding migrated away). If the plugin can't be installed it falls back to `skills add` + standalone session hooks under ~/.claude. - codex / cursor: the skills via `skills add` for your agent. The approval + session hooks come from the plugin, whose install here isn't fully scriptable — the script prints the plugin steps. It does NOT write ~/.claude (that config belongs to Claude Code). Always run with CARGO_INSTALL_HOOKS=1, never 0. (If CARGO_API_TOKEN is set, the script signs in with it non-interactively. In environments with no TTY — sandboxes, Claude Cowork — the script runs the browser device flow headlessly: it prints a verification URL and polls until approved. Relay that URL to the user and wait for the script to finish; do not kill it while it polls. If it fails asking for a workspace, re-run with CARGO_WORKSPACE_UUID= prepended. If it fails saying "No workspaces found", the account has no workspace yet and sign-in stopped before saving any credentials — so nothing else can be run against the API. Ask the user what to call their workspace, then re-run the script with CARGO_WORKSPACE_NAME="" prepended, which creates it as part of signing in; you do NOT need to send them to the dashboard. If the user has no Cargo account at all, or simply prefers no browser, re-run the script with CARGO_EMAIL= prepended: the script mails them a one-time code, prints how to finish, and exits 0 without installing the bundle. Ask the user for the code, then re-run with BOTH CARGO_EMAIL= and CARGO_CODE= prepended (add CARGO_WORKSPACE_NAME="" if they have no workspace yet). That creates the account, the workspace and a saved session, and goes on to install the bundle, so the second run finishes this step normally and you continue to step 4. As a last resort, ask the user to create an API token at https://app.getcargo.io -> Settings -> API, then re-run with CARGO_API_TOKEN= prepended.) 4. Check if cargo-ai is in PATH: command -v cargo-ai. If not found, check the installer's user-prefix fallback — "${CARGO_NPM_USER_PREFIX:-$HOME/.local}/bin/cargo-ai" (if present, export PATH="${CARGO_NPM_USER_PREFIX:-$HOME/.local}/bin:$PATH"). Otherwise use "npx @cargo-ai/cli" in place of "cargo-ai" for all subsequent commands. 5. Confirm authentication with: cargo-ai whoami 6. Verify the bundle, per AGENT: - claude: ONE of (a) `claude plugin list` shows cargo@cargo enabled (plugin channel — preferred; bundles the approval + session hooks, nothing else to check), or (b) ~/.claude/hooks/session-start.sh and ~/.claude/hooks/session-end.sh exist and ~/.claude/settings.json references them under hooks.SessionStart and hooks.SessionEnd (fallback channel). If neither holds, re-run step 3 and verify again. Do not continue until this passes. - codex / cursor: confirm the skills are available to you (the cargo skills — e.g. cargo-gtm, cargo-quickstart — resolve). If they don't, re-run step 3. 7. Approval hook, per AGENT: - claude, and ONLY on the fallback channel (6b) — if 6a (plugin) held, skip to step 8. Ask: "Let Claude run safe Cargo CLI commands without permission prompts? Reads, queries, and run/batch operations auto-approve; login, token minting, reports, and deploy/destroy/remove still ask. [y/N]". If yes: download the hook with curl -fsSL "https://raw.githubusercontent.com/getcargohq/cargo-skills/main/hooks/approve-cli.sh" -o ~/.claude/hooks/approve-cargo-cli.sh && chmod +x ~/.claude/hooks/approve-cargo-cli.sh, then in ~/.claude/settings.json append {"matcher": "Bash", "hooks": [{"type": "command", "command": "/.claude/hooks/approve-cargo-cli.sh claude"}]} under hooks.PreToolUse (create the array if missing; skip if an entry already runs that command), and remove "Bash(cargo-ai *)", "Bash(npx @cargo-ai/cli *)", and "Bash(npx @cargo-ai/cli@* *)" from permissions.allow if present. If the download fails, fall back to adding "Bash(cargo-ai *)" and "Bash(npx @cargo-ai/cli *)" under permissions.allow — but ONLY if no approval hook is already registered under hooks.PreToolUse (a blanket allow beside an existing hook silently defeats its gating). If no, leave settings unchanged. - codex / cursor: the approval hook ships with the Cargo plugin for your agent, which the step-3 script printed instructions for. Relay those plugin steps to the user (codex: `codex plugin marketplace add getcargohq/cargo-skills` then enable "cargo" from the Plugins menu; cursor: Customize → add the getcargohq/cargo-skills marketplace → install Cargo). Do NOT edit ~/.claude — it is not your config. 8. Ask the user if they'd like a two-minute guided demo (25 leads matching their buyer persona, with a cost receipt, ending by saving the pull as a recurring play). Mention that it costs about 0.5 of their 100 free credits, so it is a look around rather than a commitment. If yes, invoke the quickstart skill with no arguments — use the plugin-namespaced form (cargo:cargo-quickstart) if you installed the plugin, otherwise cargo-quickstart — the skill asks its one persona question itself.