MARS CLI (mars) is a coding agent that lives in your terminal. It reads, writes, and runs code in your project, plans multi-step work with subagents, and answers quick questions on a free model without touching your session context. One provider, one login: MarsAI.
![]() Startup header |
![]() Free-model ? ask |
- MarsAI-only provider — sign in with OAuth device flow (
/mars) orMARSAI_API_KEY. No provider zoo to configure. - Free-tier delegation — inline
?question,/ghost(replay last prompt),/budget, subagents, and auto-recon all run onmarsai/auto-freeat zero cost, isolated from your main session context. - Subagents — single, parallel, and chained dispatch to isolated child
marsprocesses, each with its own context window. Explore-first auto-recon appends a repo map to the system prompt on the first turn of a fresh session. - Web tools —
web_fetch(manual-redirect fetching with per-hop private-network blocking) andweb_search(DuckDuckGo lite). /handoff- export a session as JSONL with copy-paste import instructions; move work between machines or teammates./init- generate or improveAGENTS.md: collects project stats (manifests, scripts, workspaces, file counts), then the agent investigates the repo and writes the instruction file itself.mars pack- export tracked files as XML context for handoff to another model. Gitignore-aware, skips binaries, redacts secrets, caps output at 200KB./update- self-update from the npm registry, async and non-blocking.- Sessions, themes, MCP, codemode — resumable sessions, themable TUI, MCP server support, and JavaScript code mode.
- Safe by default — trust dialogs for project folders, SSRF-protected redirects, SIGTERM→SIGKILL child process escalation.
npm install -g @mars_ai/marscliRequires Node.js >= 22.19.
cd your-project
marsFirst run: sign in via /mars (OAuth device flow) or export MARSAI_API_KEY. Then just type what you want built.
Handy keys:
| Input | Effect |
|---|---|
?question |
Ask a free model without touching session context |
/ghost |
Replay the last prompt on the free model |
/init [focus] |
Create or improve AGENTS.md (focus text optional) |
!cmd |
Run a shell command inline |
ctrl+o |
Expand the transcript |
/handoff |
Export the session as JSONL |
Non-interactive:
mars -p "refactor server.js to use ES modules" # one-shot prompt
mars --mode json -p "list dead exports" # JSON output
mars pack # repo as XML for another model
mars pack --query "src/**/*.ts" --max-bytes 100000
mars pack --full # no size cap| Env var | Purpose |
|---|---|
MARSAI_API_KEY |
MarsAI API key (alternative to OAuth login) |
MARSAI_SUBAGENT_MODEL |
Pin the model used for free-tier delegation |
MARS_NO_RECON |
Set 1 to disable auto-recon in spawned children |
Settings live in .mars/ (project) and ~/.mars/ (global).
MIT — forked from mars by Mario Zechner. Rebranded and maintained as MARS CLI with the MarsAI provider.




