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 input

Options

Session

FlagMeaning
-c, --continueContinue 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-sessionWith --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

FlagMeaning
-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-permissionsSame 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

FlagMeaning
-p, --printRun 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-messagesWith 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

FlagEnvironment variableMeaning
--daemon <mode>—How to reach a daemon: auto (default), connect, spawn or embedded
--daemon-url <url>CUSP_DAEMON_URLConnect to this daemon
--daemon-token <token>CUSP_DAEMON_TOKENIts bearer token
--data-dir <dir>CUSP_DATA_DIRDaemon data directory. Default ~/.cusp
ModeBehavior
autoUse --daemon-url if given, else find a running daemon for the data directory, else start one
connectOnly connect to --daemon-url. Fail if it isn't reachable
spawnAlways start a new daemon process for this run
embeddedRun the daemon inside the CLI process. Useful in containers and CI

Other

FlagMeaning
--verboseDiagnostics on stderr, including permission denials in headless mode
-v, --versionPrint the version
-h, --helpShow help

Exit codes

CodeMeaning
0Success
1The run failed
2Invalid command line
130Interrupted

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 --allowedTools and --disallowedTools. Anything not pre-approved is denied, and the agent is told how to proceed. Every denial is listed in permission_denials in 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 json

text 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": []
}
FieldMeaning
subtypesuccess, error_max_turns, error_during_execution or error_interrupted
is_errortrue for any subtype other than success
resultThe final assistant text
session_idPass to --resume to continue the session
num_turnsModel turns in this run
duration_msWall-clock time
total_cost_usdCost of this run, or null when pricing is unknown
usageToken counts for this run. input_tokens includes cache reads and writes
permission_denialsEach denied call: tool, title and call_id
errorA 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

CommandMeaning
/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
/rewindRewind the conversation and files to an earlier prompt
/forkContinue 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
/planSwitch to plan mode
/todosShow or hide the task list
/cost (/usage)Tokens and cost for this session
/statusDaemon, session, model and workspace details
/diffSummarize uncommitted changes in the workspace
/export [file]Write the conversation to a text file
/initAsk Cusp to write a CUSP.md guide for this project
/reviewAsk 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

PrefixMeaning
/A slash command or skill
@pathMention a file. Completion suggests paths as you type
!commandRun a shell command yourself and share its output with the agent

Keyboard shortcuts are listed in Keyboard shortcuts.

Environment variables

VariableMeaning
CUSP_DAEMON_URLDaemon to connect to
CUSP_DAEMON_TOKENBearer token for that daemon
CUSP_DATA_DIRData directory. Default ~/.cusp
CUSP_THEMEdark (default) or light, for the terminal UI colors
NO_COLORDisable color. The UI keeps lightness contrast but drops hues
Provider keysSee Providers and gateways

On this page