System R CLI: Trade From Your Terminal
April 4, 2026 · By Ashim Nandi
System R CLI is a local-first trading agent that runs in your terminal. It connects to the same backend as ATOM, the same 55 MCP tools, the same 187 domain services, the same risk engine. The difference is the interface: text in, text out, no browser required. Built with Bun, TypeScript, and Ink 5, it follows the Claude Code interaction model. Session-first auth, conversational AI, slash commands for fast actions.
What the CLI Is
The CLI is not a simplified version of ATOM. It is the same platform through a different surface.
Every tool call available in ATOM's web chat is available in the terminal. Market data, risk analysis, backtesting, order execution, portfolio monitoring. The backend does not distinguish between a request from the browser and a request from the CLI. Both hit the same API, the same domain layer, the same broker adapters.
The difference is workflow. The web interface uses rich blocks, visual confirmations, mouse interactions. The CLI uses structured text output, keyboard-driven navigation, and composability with other terminal tools.
For traders who already live in the terminal, context switching to a browser is friction. The CLI removes that friction.
Why Terminal
The terminal is the most powerful interface ever built. That is not nostalgia. It is engineering.
Speed. No page loads, no rendering delays, no asset downloads. You type, the system responds. Latency is measured in the round-trip to the API, not the time it takes a browser to paint a DOM.
Composability. Pipe output to other tools. Grep your trade journal. Redirect analysis to a file. Chain commands in a shell script. The terminal plays well with everything else on your machine.
Scriptability. Automate recurring workflows. Run a morning market scan as a cron job. Script a pre-market checklist that queries portfolio heat, checks overnight moves, and flags any positions near stop levels.
Focus. No notifications, no sidebars, no visual clutter. One input, one output. The interface gets out of the way and lets you think.
Reproducibility. Every command is text. Text can be saved, shared, version-controlled, and replayed. A CLI session is inherently documentable.
Developers and power users already know this. The CLI meets them where they work.
How It Works
Authentication
The CLI uses session-first auth, matching the Claude Code flow:
systemr login
This opens a browser for OAuth, then stores the session token locally. Subsequent sessions reuse the token until it expires. For environments where a browser is not available (CI, remote servers), API key fallback is supported:
systemr --api-key sk_your_key_here
Session tokens are the primary auth method. API keys are for automation and headless environments.
Interactive Chat
Once authenticated, systemr drops you into an interactive session. You chat with the same AI models available in ATOM's web interface. Ask questions, request analysis, propose trades.
> What is the current regime for SPY?
SPY is in a trending_bullish regime. 20-day momentum is positive,
volatility is below the 30th percentile, and breadth indicators
confirm broad participation. This regime has historically favored
trend-following strategies over mean-reversion.
> Run a G-Score on my crypto momentum strategy for the last 90 days
G-Score: +4.2% (annualized)
Arithmetic return: 8.1%
Volatility tax: 3.9%
Sample size: 47 trades
Regime coverage: trending (62%), volatile (38%)
The edge is positive but thin. The volatility tax is consuming
nearly half of the arithmetic return. Consider reducing position
sizing or filtering for lower-volatility setups.
The AI has full access to the MCP tools and domain services. It can query live market data, compute risk metrics, run backtests, and propose trades, all within the terminal conversation.
Slash Commands
For actions you run frequently, slash commands skip the conversational overhead:
| Command | Action |
|---|---|
/portfolio |
Current holdings, P&L, allocation |
/risk |
Portfolio heat, drawdown status, VaR |
/trade |
Initiate a trade with confirmation prompt |
/workspace |
Switch or configure workspace |
/killswitch |
Immediately halt all trading activity |
/backtest |
Run a quick backtest on a strategy |
/regime |
Current market regime classification |
/gscore |
G-Score for a strategy or portfolio |
/scan |
Market scanner with custom criteria |
/history |
Recent trade history with P&L |
/balance |
Account balance and credit status |
/help |
Full command reference |
Twenty-four slash commands cover the most common workflows. They are not aliases for chat messages. They are direct tool invocations that skip the LLM reasoning step and return results immediately.
PROFILE.md and RULES.md
This is one of the CLI's most distinctive features. You configure your agent's behavior through markdown files, not settings menus.
PROFILE.md
PROFILE.md defines who you are as a trader. The agent reads it at the start of every session.
# Trader Profile
## Risk Tolerance
Conservative. Maximum 1% risk per trade. 6% portfolio heat cap.
## Time Horizon
Swing trades, 2-10 day holding period. No day trading.
No overnight futures positions.
## Preferred Instruments
US equities (large and mid cap). Crypto majors (BTC, ETH, SOL).
No penny stocks. No meme coins.
## Experience
12 years systematic trading. Former institutional.
Understand Greeks but do not trade options actively.
## Goals
Consistent capital growth. Target 15-20% annual.
Preservation of capital is priority one.
The agent uses this context to calibrate its responses. It will not suggest day trading setups to a swing trader. It will not recommend options strategies to someone who specified "no options." It will size positions according to the stated risk tolerance.
RULES.md
RULES.md defines hard constraints the agent must follow. These are not suggestions. They are boundaries.
# Trading Rules
## Position Rules
- Never risk more than 1% of account on a single trade
- Maximum 6 concurrent positions
- No margin trading
- No short selling (long only)
## Instrument Rules
- US equities: market cap > $2B only
- Crypto: BTC, ETH, SOL only. No altcoins below $1B market cap
- No forex. No futures. No options.
## Timing Rules
- No trades in the first 15 minutes after market open
- No trades in the last 15 minutes before market close
- No new positions on FOMC days before the announcement
## Risk Rules
- Kill switch at 3% daily drawdown
- Reduce position sizing by 50% after two consecutive losses
- No new positions when portfolio heat exceeds 5%
These rules are enforced at the agent level. If you ask the CLI to buy a stock with a $500M market cap and your rules say "$2B minimum," the agent will refuse and explain why. RULES.md is your automated trading discipline.
The combination of PROFILE.md and RULES.md means the agent starts every session with full context about your trading style, risk tolerance, and hard constraints. No re-explaining. No drift.
Architecture
The CLI is built with a clean 8-level architecture:
| Level | Responsibility |
|---|---|
| Commands | 12 top-level CLI commands (login, chat, config, etc.) |
| Screens | 5 full-screen layouts (chat, portfolio, settings, etc.) |
| Components | 13 UI components (message list, composer, status bar, etc.) |
| Hooks | 12 React hooks (useChat, usePortfolio, useEventStream, etc.) |
| Slash Commands | 24 slash command handlers |
| API | 18 API client modules (auth, market, risk, trade, etc.) |
| Lib | Shared utilities, formatters, validators |
| Config | Auth storage, workspace settings, PROFILE.md/RULES.md loading |
92 source files. 305 tests passing. Zero architecture violations.
The CLI connects to ATOM's API over HTTPS. It does not bundle its own domain logic. All computation happens server-side in the same infrastructure that powers the web interface. This means updates to the domain layer, new MCP tools, new broker adapters, and new risk features are available in the CLI immediately. No CLI update required.
Example Session
A typical morning workflow:
$ systemr
System R CLI v3.2.0
Authenticated as ashim@systemr.ai
Workspace: crypto-momentum
> /risk
Portfolio Heat: 3.2% (cap: 6%)
Daily P&L: +$142 (+0.14%)
Open positions: 3
Drawdown from peak: 1.8%
VaR (95%, 1-day): $890
> /regime BTC
BTC regime: volatile_bullish
20d volatility: 58% (72nd percentile)
Momentum: positive, accelerating
Funding rate: +0.012% (neutral)
> Should I add to my BTC position given current conditions?
Given your RULES.md constraints and current portfolio state:
- Current BTC position: 0.15 BTC ($9,420)
- Portfolio heat after add: 4.8% (within 5% cap from RULES.md)
- Regime is volatile_bullish, which your momentum strategy
handles but with higher variance
- G-Score for similar setups in volatile regimes: +2.1%
(positive but below your trending regime average of +6.3%)
Recommendation: A small add is defensible. Size at 0.25x
normal to account for elevated volatility. That keeps
portfolio heat under your 5% RULES.md ceiling.
> /trade BTC-USD buy 0.05
Order preview:
Instrument: BTC-USD
Side: BUY
Quantity: 0.05 BTC (~$3,140)
Risk: 0.31% of account
Portfolio heat after: 4.1%
Confirm? (Y/n): Y
Order submitted. Fill: 0.05 BTC @ $62,803.40
The session flows naturally. Slash commands for quick checks, conversational AI for analysis, structured confirmation for execution.
Getting Started
# Install
bun install -g @systemr/cli
# Authenticate
systemr login
# Start trading
systemr
Requirements: Bun runtime (v1.0+), a System R account (free signup at app.systemr.ai with $5 credit), and a terminal.
The CLI works alongside ATOM's web interface. Use whichever fits your workflow. Both connect to the same backend, the same workspace, the same positions. Start an analysis in the CLI, review it on the web. Place a trade on the web, monitor it from the terminal.
FAQ
Can the CLI do everything the web interface can?
Yes, functionally. Every MCP tool and domain service available in the web interface is available in the CLI. The difference is presentation. The web renders rich visual blocks (charts, stat grids, interactive confirmations). The CLI renders structured text. The underlying data and computation are identical.
Do I need to know how to code to use the CLI?
No. The CLI is conversational. You type natural language and get responses. Slash commands are single words, not programming. PROFILE.md and RULES.md are plain English in markdown format. If you can write a grocery list, you can write trading rules.
Does the CLI work on all operating systems?
The CLI runs on macOS, Linux, and Windows (via WSL or native). It requires the Bun runtime. Installation is one command.
How does PROFILE.md differ from workspace settings?
Workspace settings define broker connections, asset class focus, and technical configuration. PROFILE.md defines your trading identity: risk tolerance, preferred instruments, experience level, goals. RULES.md defines hard constraints the agent must follow. Think of it this way. Workspace is infrastructure. PROFILE.md is personality. RULES.md is discipline.