Get started with the CLI

Install the cruxy coding agent from npm, check the Node.js version it needs, sign in, and run your first task from a terminal.

Cruxy Code is the cruxy command, published on npm as @cruxy/cli. It is a coding agent that works in your repository from the terminal: it reads code, edits files, runs commands, and checks its own work. It asks for your approval before it writes a file or runs a shell command. Every model turn goes to the Cruxy API at https://api.cruxy.ai, and the model is a tier (canto, saga, or epos) or auto.

This section documents @cruxy/cli 1.19.0.

Requirements

  • Node.js 20 or later. The package declares "node": ">=20" in engines.
  • Node.js 22.13 or later for a persistent codebase index. On older Node.js, semantic search keeps its index in memory and rebuilds it each session, and cruxy index refuses to build one.
  • A terminal to sign in. cruxy login and cruxy init are interactive. In CI or a script, set CRUXY_API_KEY instead; see Sign in from the CLI.
  • On Windows, Git Bash or PowerShell. The CLI runs shell commands through one of them, or through the shell you name in shell.executable.

Install

npm install -g @cruxy/cli
cruxy --version

cruxy --version prints the installed version. cruxy --help lists every command; CLI command reference documents each one.

Run it for the first time

  1. Open your project

    Start cruxy in the directory you want it to work in. That directory becomes the project root, and file access stays inside it.

    cd my-project
    cruxy
  2. Sign in

    With no key in the environment and none saved, the first run in a terminal walks you through device login: the CLI prints a link and a short code, you approve in a browser, and the CLI saves the credential to ~/.cruxy. It then names the organization the credential is bound to and your role in it. See Sign in from the CLI.

  3. Carry on into your task

    Once sign-in completes, the CLI carries on with what you asked for: cruxy "<task>" runs the task, and a bare cruxy opens the session. With no task, it first offers a demo run that summarizes the repository from its README and structure; press Enter to run it, or n to skip. If you leave sign-in before it completes, the CLI stops there.

  4. Give it a task

    Type a task into the session. Before any file write or shell command, the CLI shows you what it is about to do and waits for your answer.

Ways to run it

CommandWhat it does
cruxyOpens the full-screen interactive session. Where the full-screen session cannot run, it prints a short usage banner and exits 0.
cruxy "<task>"Opens the interactive session with the task as its first turn. Where the full-screen session cannot run, it runs the task once.
cruxy run "<task>"Runs the task once and exits. A run that stops before it finishes exits 20.
cruxy runOpens a line-based interactive session. It needs a terminal.
cruxy --resume [id]Resumes a saved session for this project. Without an id, it lets you pick from recent sessions.

The full-screen session needs an interactive terminal. It does not run when stdin or stdout is not a terminal (for example, when piped), when TERM=dumb, or in screen-reader mode (CRUXY_SCREEN_READER or ACCESSIBLE); there, use cruxy run for a line-based session.

Inside a session, type /help for the session commands. In the full-screen session, Shift+Tab cycles the mode between manual, auto-approve, plan, and full-auto; see Projects, permissions, and context.

Set up a project

cruxy init prepares the current directory: it gets a key only if none is set, offers to write a CRUXY.md, and offers the demo run.

cruxy init

CRUXY.md holds instructions for your project, such as conventions and how to build and test. The CLI reads it into every turn. If there is no CRUXY.md, it reads AGENTS.md instead.

Run without a terminal

In CI or a script, cruxy run "<task>" reads the key from CRUXY_API_KEY and never stops to ask a question. An action that needs approval cannot be approved there, so the first file write or shell command ends the run with CRUXY_E_APPROVAL_REQUIRED and exit code 10. A task the agent can finish with its read-only tools, such as explaining code, runs to the end.

# CRUXY_API_KEY is set in the CI environment, never in the script.
cruxy run "explain how requests are authenticated in src/"

Next steps

Sign in from the CLI

Device login, the signed-in credential it saves, when it expires, and how to replace it.

CLI command reference

Every command, flag, and default, the session commands, and the exit codes.

CLI configuration

Config files, the order they merge in, environment variables, and the default settings.

Projects, permissions, and context

What asks for approval, what stays on your machine, and what the CLI sends to the API.

Troubleshoot the CLI

Read an error and its code, and fix the failures you are most likely to hit.

Was this page helpful?