CLI
Every cusp command-line flag, slash command, headless output format and exit code.
cusp [options] [prompt]cusp starts an interactive session in the current folder. With a prompt, the session starts with that message. With -p, it runs the prompt without the UI, prints the result and exits.
Examples
cusp # interactive session in this folder
cusp "explain the build pipeline" # start with a prompt
cusp -c # continue the most recent session here
cusp -r # pick a session to resume
cusp -m openai:gpt-6.1-sol --effort high # choose model and effort
cusp -p "list TODO comments in src/" # headless: print the answer and exit
cat error.log | cusp -p "what failed?" # headless with piped inputOptions
Session
| Flag | Meaning |
|---|---|
-c, --continue | Continue the most recent session in this folder |
-r, --resume [ses_…] | Resume a session by id, or pick one interactively when no id is given |
--fork-session | With --continue or --resume: continue in a copy, leaving the original untouched |
-n, --name <title> | Name the session |
--cwd <dir> | Workspace folder. Default: the current directory |
--continue and --resume can't be combined. --fork-session requires one of them.
Model and permissions
| Flag | Meaning |
|---|---|
-m, --model <provider:model> | Model for this session, or a bare model id on the current provider |
--effort <level> | none, minimal, low, medium, high, xhigh or max |
--permission-mode <mode> | default, acceptEdits, plan, auto, bypassPermissions or dontAsk |
--dangerously-skip-permissions | Same as --permission-mode bypassPermissions |
--allowedTools <rules…> | Pre-approve tools for this session, such as "Bash(git log *)" Edit |
--disallowedTools <rules…> | Always deny these tools for this session |
--append-system-prompt <text> | Extra instructions appended to the system prompt |
--system-prompt <text> | Replace the system prompt. Accepted but not supported yet in 0.1: Cusp ignores it with a warning. Use --append-system-prompt |
--allowedTools and --disallowedTools also accept the kebab-case spellings --allowed-tools and --disallowed-tools. Lists can be comma- or space-separated; Cusp never splits inside parentheses, so "Bash(git log *),Edit" is two rules. The manual mode name is accepted as an alias for default.
Headless
| Flag | Meaning |
|---|---|
-p, --print | Run the prompt (or stdin) non-interactively, print the result, exit |
--output-format <f> | text (default), json or stream-json |
--input-format <f> | text (default) or stream-json |
--include-partial-messages | With stream-json output: also emit streaming deltas |
--max-turns <n> | Stop after n model turns |
--output-format and --input-format require -p. -p can't open the session picker, so --resume needs an explicit id in headless mode.
Daemon
| Flag | Environment variable | Meaning |
|---|---|---|
--daemon <mode> | — | How to reach a daemon: auto (default), connect, spawn or embedded |
--daemon-url <url> | CUSP_DAEMON_URL | Connect to this daemon |
--daemon-token <token> | CUSP_DAEMON_TOKEN | Its bearer token |
--data-dir <dir> | CUSP_DATA_DIR | Daemon data directory. Default ~/.cusp |
| Mode | Behavior |
|---|---|
auto | Use --daemon-url if given, else find a running daemon for the data directory, else start one |
connect | Only connect to --daemon-url. Fail if it isn't reachable |
spawn | Always start a new daemon process for this run |
embedded | Run the daemon inside the CLI process. Useful in containers and CI |
Other
| Flag | Meaning |
|---|---|
--verbose | Diagnostics on stderr, including permission denials in headless mode |
-v, --version | Print the version |
-h, --help | Show help |
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | The run failed |
2 | Invalid command line |
130 | Interrupted |
Headless mode
cusp -p runs one prompt and exits. The prompt comes from the arguments, from stdin, or both: piped input is read when stdin isn't a terminal.
Nobody can answer prompts in headless mode, so:
- Permission requests are decided by
--allowedToolsand--disallowedTools. Anything not pre-approved is denied, and the agent is told how to proceed. Every denial is listed inpermission_denialsin the JSON result. - Questions from the agent (
AskUserQuestion) are answered with "No answer: running non-interactively. Use your best judgment and state the assumption." - Workspace trust prompts don't appear.
# Allow tests and edits, nothing else
cusp -p "make the failing test in auth.test.ts pass" \
--allowedTools "Bash(bun test *)" Edit Write \
--max-turns 25 \
--output-format jsontext output
The final assistant message, as plain text. Errors go to stderr.
json output
A single JSON object when the run ends. Field names follow the widely used headless result format (type, subtype, result, session_id, total_cost_usd, …), so existing scripts that parse it keep working.
{
"type": "result",
"subtype": "success",
"is_error": false,
"result": "Fixed the token expiry check in src/auth/session.ts. All 48 tests pass.",
"session_id": "ses_01JCQ8Z4X9T5V2M3N7K1P6R0WA",
"num_turns": 7,
"duration_ms": 41873,
"total_cost_usd": 0.0871,
"usage": {
"input_tokens": 182340,
"output_tokens": 2911,
"reasoning_tokens": 1404,
"cache_read_input_tokens": 151200,
"cache_creation_input_tokens": 18420
},
"permission_denials": []
}| Field | Meaning |
|---|---|
subtype | success, error_max_turns, error_during_execution or error_interrupted |
is_error | true for any subtype other than success |
result | The final assistant text |
session_id | Pass to --resume to continue the session |
num_turns | Model turns in this run |
duration_ms | Wall-clock time |
total_cost_usd | Cost of this run, or null when pricing is unknown |
usage | Token counts for this run. input_tokens includes cache reads and writes |
permission_denials | Each denied call: tool, title and call_id |
error | A description, when the run failed |
stream-json output
One JSON object per line while the run is in progress, then the same result object as json on the last line.
The first line describes the run:
{"type":"system","subtype":"init","session_id":"ses_01JC…","cwd":"/Users/me/code/app","model":{"providerId":"anthropic","modelId":"claude-opus-5-5"},"permission_mode":"default","cusp_version":"0.1.0","daemon":"spawned"}Each following line wraps one session event:
{"type":"event","session_id":"ses_01JC…","event":{"seq":12,"body":{"type":"tool.start", …}}}Streaming deltas (assistant.delta, tool.progress) are included only with --include-partial-messages.
stream-json input
With --input-format stream-json, each line on stdin is a user message:
{"type":"user","message":{"role":"user","content":"Now add tests for it."}}content can be a string or an array of content blocks ({"type":"text","text":"…"}, images and so on). This lets another program hold a multi-turn conversation with Cusp over a pipe.
Interactive mode
Slash commands
| Command | Meaning |
|---|---|
/help, /? | Commands and keyboard shortcuts |
/clear (/new, /reset) | Start a new session. The current one stays resumable |
/resume [session] | Resume a previous session in this folder |
/rename <title> | Rename this session |
/rewind | Rewind the conversation and files to an earlier prompt |
/fork | Continue in a copy of this session |
/model [provider:model] | Switch the model |
/effort [low|medium|high|xhigh|max] | Set reasoning effort |
/mode [default|acceptEdits|plan|auto] | Set the permission mode |
/plan | Switch to plan mode |
/todos | Show or hide the task list |
/cost (/usage) | Tokens and cost for this session |
/status | Daemon, session, model and workspace details |
/diff | Summarize uncommitted changes in the workspace |
/export [file] | Write the conversation to a text file |
/init | Ask Cusp to write a CUSP.md guide for this project |
/review | Ask Cusp to review the uncommitted changes. It reports bugs first, with file and line, and doesn't modify files |
/compact [instructions] | Summarize the conversation to free context |
/exit (/quit) | Exit |
Skills you can invoke appear in the same / menu.
Prompt prefixes
| Prefix | Meaning |
|---|---|
/ | A slash command or skill |
@path | Mention a file. Completion suggests paths as you type |
!command | Run a shell command yourself and share its output with the agent |
Keyboard shortcuts are listed in Keyboard shortcuts.
Environment variables
| Variable | Meaning |
|---|---|
CUSP_DAEMON_URL | Daemon to connect to |
CUSP_DAEMON_TOKEN | Bearer token for that daemon |
CUSP_DATA_DIR | Data directory. Default ~/.cusp |
CUSP_THEME | dark (default) or light, for the terminal UI colors |
NO_COLOR | Disable color. The UI keeps lightness contrast but drops hues |
| Provider keys | See Providers and gateways |