Skip to content

CLI Flags

gsd is invoked from the command line with optional flags and subcommands. Flags control how a session starts — which model to use, whether to resume, whether to run in headless or single-shot mode, or whether to start in an isolated worktree. Subcommands like gsd config, gsd worktree, and gsd headless exit immediately after their task without launching the TUI.

Most day-to-day work happens inside the interactive TUI using slash commands. The CLI flags listed here are for the binary entry point only.

gsd [options] [message...]
gsd <subcommand> [subcommand-flags]

Getting help:

Terminal window
gsd --help
gsd <subcommand> --help
FlagShortDescription
--continue-cResume the most recent session for the current directory. Restores conversation history and active auto-mode state.
--worktree [name]-wStart in an isolated git worktree. Auto-names the worktree if no name is given. Creates it if it doesn’t exist; resumes it if it does.
--print-pSingle-shot prompt mode — send a message (positional arg), print the response, exit. No TUI.
--mode <mode>Output mode for non-interactive use: text (plain), json (structured), rpc (child process), mcp (MCP server).
--model <id>Override the default model for this session. Model ID depends on the provider (e.g. claude-opus-4-6, gpt-4o).
--no-sessionDisable session persistence — conversation history is not saved.
--extension <path>Load an additional extension from a file path. Can be repeated for multiple extensions.
--append-system-prompt <path>Append extra text to the system prompt. Accepts a file path (read as UTF-8) or a literal string. Used internally by subagent dispatch.
--tools <a,b,c>Restrict available tools to a comma-separated list.
--list-models [search]List available models and exit. Optionally filter by a search term.
--web [path]Launch browser-only web mode. Optionally specify a project path. Equivalent to gsd web [path].
--debugEnable structured JSONL diagnostic logging for troubleshooting dispatch and state issues.
--version-vPrint the installed GSD version and exit.
--help-hPrint help text and exit.
SubcommandDescription
gsd configRe-run the interactive setup wizard to configure LLM providers, API keys, and tool integrations.
gsd updateUpdate GSD to the latest version via npm (npm install -g gsd-pi@latest).
gsd sessionsInteractive session picker — list up to 20 saved sessions for the current directory and choose one to resume.
gsd worktree <cmd>Manage isolated git worktrees for parallel work streams. Alias: gsd wt.
gsd headlessRun /gsd commands without a TUI — for CI, cron jobs, and scripted automation.
gsd web [start|stop] [path]Start or stop browser-only web mode. Omitting the action defaults to start.

gsd worktree (or gsd wt) manages the lifecycle of isolated git worktrees. The -w flag creates or resumes a worktree for interactive sessions; gsd worktree subcommands handle merging and cleanup.

CommandDescription
listList all worktrees with status (files changed, commits ahead, dirty state)
merge [name]Squash-merge a worktree into main and clean up
cleanRemove all worktrees that have been merged or are empty
remove <name>Remove a worktree. Alias: rm. Use --force to remove with unmerged changes.

Typical lifecycle:

1. gsd -w Create worktree, start session inside it
2. (work normally) All changes happen on the worktree branch
3. Ctrl+C Exit — dirty work is auto-committed
4. gsd -w Resume where you left off
5. gsd worktree merge Squash-merge into main when done

gsd headless accepts its own subcommands and flags. The default command is auto. All subcommands (except query) are translated to /gsd <command> and dispatched via RPC to a child session.

CommandDescription
autoRun all queued units continuously (default)
nextRun one unit then stop
statusShow progress dashboard
new-milestoneCreate a milestone from a specification document
queryInstant JSON snapshot of state, next dispatch, and costs (~50ms, no LLM)

Headless flags:

FlagDescription
--timeout <ms>Overall timeout in milliseconds (default: 300000). For new-milestone, the timeout is automatically extended to 600000ms (10 minutes) if the default is used.
--jsonEmit a JSONL event stream to stdout
--model <id>Override model for this headless session
--max-restarts <n>Number of times to restart on crash before giving up (default: 3). Set to 0 to disable restarts.
--supervisedForward interactive UI requests to an orchestrator via stdout/stdin
--response-timeout <ms>Timeout for orchestrator response in supervised mode (default: 30000)
--answers <path>Pre-supply answers and secrets from a JSON file — useful for unattended CI runs
--events <types>Filter JSONL output to specific event types (comma-separated). Implies --json.

new-milestone flags:

FlagDescription
--context <path>Path to a spec or PRD file. Use - for stdin.
--context-text <text>Inline specification text
--autoStart auto-mode automatically after milestone creation
--verboseShow tool calls in progress output

Exit codes for gsd headless: 0 = complete, 1 = error or timeout, 2 = blocked.

FilePurpose
~/.gsd/agent/auth.jsonAPI keys and provider credentials
~/.gsd/sessions/<project>/Saved session data for the current directory
FilePurpose
~/.gsd/sessions/<project>/New session data created on each interactive launch
~/.gsd/agent/auth.jsonUpdated by gsd config when credentials change
.gsd/runtime/headless-context.mdTemporary context file written by gsd headless new-milestone before spawning the RPC child

Start a new session:

Terminal window
gsd

Resume the last session:

Terminal window
gsd --continue
# or
gsd -c

Pick a past session interactively:

Terminal window
gsd sessions

Use a specific model:

Terminal window
gsd --model claude-opus-4-6

Single-shot prompt (no TUI):

Terminal window
gsd --print "What's the current project status?"
# or
gsd -p "What's the current project status?"

List available models:

Terminal window
gsd --list-models
gsd --list-models sonnet

Run as an MCP server:

Terminal window
gsd --mode mcp

Start in a new auto-named worktree:

Terminal window
gsd -w

Create or resume a named worktree:

Terminal window
gsd -w auth-refactor

Merge a worktree back to main when done:

Terminal window
gsd worktree merge auth-refactor
# or using the alias
gsd wt merge auth-refactor

List all worktrees with status:

Terminal window
gsd worktree list

Remove all merged or empty worktrees:

Terminal window
gsd worktree clean

Remove a specific worktree (using rm alias):

Terminal window
gsd wt rm auth-refactor

Launch web mode:

Terminal window
gsd --web
gsd web start /path/to/project
gsd web stop

Run headless auto-mode (no TUI, exits when done):

Terminal window
gsd headless
gsd headless --json # machine-readable output
gsd headless --timeout 60000 # 1-minute timeout

Create a milestone from a spec file, then auto-execute:

Terminal window
gsd headless new-milestone --context spec.md --auto
cat spec.md | gsd headless new-milestone --context -

Run headless with verbose tool call output:

Terminal window
gsd headless new-milestone --context spec.md --verbose

Run headless with pre-supplied answers (unattended CI):

Terminal window
gsd headless --answers answers.json auto

Disable automatic restarts on crash:

Terminal window
gsd headless --max-restarts 0 auto

Filter JSONL output to specific event types:

Terminal window
gsd headless --events agent_end,extension_ui_request auto

Run headless in supervised orchestrator mode:

Terminal window
gsd headless --supervised auto

Instant state snapshot (no LLM call):

Terminal window
gsd headless query

Re-run setup wizard:

Terminal window
gsd config

Check version:

Terminal window
gsd --version