@mindifyai/cortex-cli
v0.1.5
Published
Command-line interface for Cortex.
Downloads
593
Readme
Cortex CLI
A complete command-line companion for Mindify Cortex: browser login, hosted model chat, autonomous goal loops, repository-aware agent prompts, a local Pi coding harness, and a polished terminal UI inspired by Claude Code, Codex CLI, and Gemini CLI — with deep links back into the Cortex app.
Install
npm install -g @mindifyai/cortex-cliEquivalent package-manager commands:
pnpm add -g @mindifyai/cortex-cli
yarn global add @mindifyai/cortex-cli
bun add -g @mindifyai/cortex-cliAfter installation, run Cortex directly:
cortex --helpQuick start
cortex login --base-url https://cortex.mindifyai.dev
cortex doctor
cortex models
cortex ask "Summarize this repository"
cortex goal "Add unit tests for the auth module"
cortex chatFor non-interactive environments, pass CORTEX_TOKEN and optionally
CORTEX_BASE_URL instead of using cortex login.
Commands
| Command | Description |
| --- | --- |
| cortex login [--base-url <url>] | Sign in through the browser callback flow. |
| cortex logout | Remove the saved local session. |
| cortex status | Show whether the CLI is signed in. |
| cortex doctor | Check Node, auth, server, profile, and model API reachability. |
| cortex models | Print hosted model IDs returned by Cortex. |
| cortex threads | List your recent Cortex app threads with web links. |
| cortex open [thread-id] | Open the Cortex app (or a specific thread) in the browser. |
| cortex config get [key] | Print the saved CLI configuration. |
| cortex config set <key> <value> | Save a config value, such as defaultModel openai/gpt-4.1. |
| cortex config unset <key> | Remove a saved config value. |
| cortex ask [--model provider/model] <question> | Ask one non-interactive question. |
| cortex chat [--model provider/model] | Open the interactive TUI. |
| cortex goal [options] <goal> | Run an autonomous agent loop until the goal is done. |
| cortex agent | Send a project map and coding-agent prompt to Cortex. |
| cortex explain <file> | Ask Cortex to explain a file. |
| cortex edit <file> <instruction> | Ask Cortex for a safe patch suggestion. |
| cortex pi [options] [prompt] | Run the local Pi coding-agent harness. |
Top-level slash aliases work too, for example cortex /status,
cortex /models, cortex /ask "question", cortex /goal "…", and
cortex /chat.
Goal loops
cortex goal (and /goal inside the TUI) runs an agent loop instead of a
single turn: the model works one step per iteration and reports
GOAL_STATUS: CONTINUE, DONE, or BLOCKED at the end of each reply. The
loop keeps stepping until the goal is done, the model is blocked, or the
iteration budget (goalMaxIterations, default 8) runs out.
cortex goal "Write release notes for the last five commits"
cortex goal --model anthropic/claude-sonnet-5 --max-iterations 12 "Refactor the config module"By default the loop runs against hosted Cortex chat with a compact project map
attached. Pass --pi to run the loop on the local Pi coding harness instead,
where the agent can actually read files — and, with the safety flags, edit
files and run commands between iterations:
CORTEX_ANTHROPIC_API_KEY=sk-ant-... cortex goal --pi --allow-writes "Fix the failing test"The command exits non-zero when the goal did not finish (blocked or
max-iterations), so it can gate scripts and CI steps.
Interactive TUI
cortex chat opens a full terminal experience with a Cortex banner, an
interactive command palette, streaming markdown rendering, a thinking spinner,
tab-completed slash commands, model switching, goal loops, thread handoff to
the Cortex app, elapsed response timing, and a repository-aware agent mode.
Type / and press Enter to open the command palette: type to filter, move
with ↑/↓, select with Enter, cancel with Esc. In non-interactive terminals the
palette falls back to a numbered list.
| Slash command | Description |
| --- | --- |
| / | Open the selectable command palette. |
| /help | Show all TUI commands and shortcuts. |
| /status | Show server, model, thread ID, turn count, and web link. |
| /goal <goal> | Run an agent loop until the model reports DONE. |
| /agent <goal> | Attach a compact git-tracked project map to a coding-agent prompt. |
| /pi <prompt> | Run the local Pi harness from inside chat. |
| /model [provider/name] | Switch models — bare /model opens an interactive picker. |
| /models | List hosted Cortex models. |
| /threads | List your recent Cortex app threads. |
| /resume [thread-id] | Continue a Cortex app thread in the CLI (picker when no ID). |
| /web | Print this thread's link in the Cortex app. |
| /new | Start a fresh chat thread. |
| /clear | Redraw the interface. |
| /exit | Quit. |
Press Tab after typing / to complete commands. End a line with \ to continue
a multiline prompt. Failed requests print an error and keep the session alive,
and piped stdin works for scripted sessions.
Cortex app connection
CLI chat threads live in the same account as the Cortex app, so a conversation can move fluidly between the two:
/threads(orcortex threads) lists your recent app conversations./resumecontinues an app conversation in the terminal./weband/statusprint thehttps://…/chat/<thread>deep link for the current CLI thread so you can pick it up in the app.cortex open [thread-id]opens the app (or a thread) in the browser.
Local Pi Harness
cortex pi runs the local Pi coding-agent harness against the current
workspace. It uses CORTEX_ANTHROPIC_API_KEY or ANTHROPIC_API_KEY.
CORTEX_ANTHROPIC_API_KEY=sk-ant-... cortex pi
cortex pi --model anthropic:claude-sonnet-4-6 "Review this project"
cortex pi --allow-writes "Patch the failing test"
cortex pi --allow-writes --allow-commands "Run tests and fix failures"By default, Pi mode is read-only: it can read, list, find, and grep files. File
edits require --allow-writes; shell commands require --allow-commands.
Configuration
Configuration is stored in ~/.config/mindify-cortex/config.json with private
file permissions. Useful settings include:
cortex config set baseUrl https://cortex.mindifyai.dev
cortex config set defaultModel openai/gpt-4.1
cortex config set maxContextBytes 200000
cortex config set goalMaxIterations 12
cortex config set piAgentModel claude-sonnet-4-6
cortex config getDevelopment
cd cortex-cli
npm install
npm run build
npm test