Skip to main content

CLI Flag Reference

This page is the exhaustive flag and subcommand reference for every binary in the go-code suite: harnessd, harnesscli, go-code, cronctl, cronsd, symphd, trainerd, forensics, and install.sh.

Use it to look up the exact flag name, its type, its default, and what it controls. When you need the "why" behind a flag or a worked example, the linked concept pages go deeper.

Go's flag package accepts both single-dash and double-dash forms for every flag — -flag value and --flag value are equivalent. The fact sheets and source code use a single dash in most examples; both forms work at runtime.


harnessd — the HTTP daemon

harnessd (cmd/harnessd) is the long-running HTTP daemon that boots the full agent runtime (LLM provider, tools, cron, MCP, workflows) and exposes it over a REST + SSE API. It has only three CLI flags; everything else is controlled by environment variables or TOML config files.

Flags

FlagTypeDefaultDescription
--profilestring""Named profile to load from ~/.harness/profiles/<name>.toml (or .harness/profiles/<name>.toml in the project dir). Applies on top of the user and project TOML layers, before env vars.
--mcpboolfalseStart as an MCP stdio server instead of an HTTP server. Reads stdin and writes stdout; does not bind a TCP port.
--mcp-workspacestring"" (resolves to $PWD)Workspace root used when --mcp is active. Falls back to HARNESS_WORKSPACE, then ..

Source: cmd/harnessd/main.go:170-178

Key environment variables

harnessd is primarily configured through environment variables and TOML files. The most commonly needed env vars are listed here; for the full cascade see the Configuration reference.

VariableDefaultDescription
HARNESS_ADDR:8080HTTP listen address (e.g. :9000 or 127.0.0.1:8080).
HARNESS_MODEL"gpt-4.1-mini"Default LLM model identifier.
HARNESS_MAX_STEPS8Maximum tool-call steps per run. Set to 0 in config for unlimited; the daemon resets a 0 config default back to 8 for backward compatibility.
HARNESS_WORKSPACE.Workspace root path.
HARNESS_PROVIDER(catalog)Set to "fake" for key-free deterministic smoke testing.
HARNESS_FAKE_TURNS""Path to the JSON turns file when HARNESS_PROVIDER=fake. Required when the fake provider is active.
HARNESS_AUTH_DISABLED""Set to "true" to disable Bearer token auth. Auth is also implicitly off when HARNESS_RUN_DB is not set (no key store to validate against).
OPENAI_API_KEY""OpenAI API key. The primary provider path; required unless a catalog provider or HARNESS_PROVIDER=fake is configured.

Source: cmd/harnessd/main.go:319-432, internal/server/auth.go:228-230, internal/server/auth.go:77-81, cmd/harnessd/bootstrap_helpers.go:259-273

MCP stdio mode

./harnessd --mcp --mcp-workspace /path/to/project

When --mcp is set, harnessd communicates over stdin/stdout using the MCP protocol instead of binding a port. The REST API and the /mcp HTTP endpoint are both unavailable in this mode.


harnesscli — the CLI client

harnesscli (cmd/harnesscli) is the terminal client for harnessd. It dispatches to one of several subcommands based on the first argument. When no recognized subcommand is given it falls through to default run mode.

Default / bare-run mode

When no subcommand is present, harnesscli creates a run via POST /v1/runs and streams SSE events until a terminal event (run.completed, run.failed, or run.cancelled) arrives.

Source: cmd/harnesscli/main.go:123

FlagTypeDefaultDescription
-base-urlstringhttp://localhost:8080Harness API base URL.
-promptstring""Prompt text to send. Required unless -tui or -list-profiles is set.
-modelstring""Model override for this run.
-system-promptstring""System prompt override for this run.
-agent-intentstring""Startup intent for prompt routing (e.g. code_review, general).
-task-contextstring""Task context injected into the startup prompt.
-prompt-profilestring""Prompt profile override for model routing.
-prompt-customstring""Custom prompt extension text appended to the prompt.
-workspacestring"" (resolves to cwd)Workspace directory for this run. Resolved via os.Getwd() when empty.
-tuiboolfalseLaunch the interactive BubbleTea TUI. Requires a real terminal — fails with an error if stdout is a pipe.
-list-profilesboolfalseFetch and print available profiles, then exit.
-prompt-behaviorcsvListFlag(empty)Behavior extension IDs. Accepts comma-separated values or repeated flags.
-prompt-talentcsvListFlag(empty)Talent extension IDs. Accepts comma-separated values or repeated flags.

Source: cmd/harnesscli/main.go:127-141

In TUI mode, /feedback [--local] [request] captures the current request, run/session/transcript context, bounded redacted rollouts and service logs, and pending image chips into a local evidence bundle. By default it uploads the bundle and images through the authenticated gh CLI and creates a dennisonbertram/go-code issue directly; --local disables publication. The older --issue and --screenshot <png-or-jpeg> arguments remain accepted for compatibility. See Feedback bundles.

Streaming output format (non-TUI):

run_id=<uuid>
<event_type> <json_payload>
...
terminal_event=<run.completed|run.failed|run.cancelled>

Exit codes (non-TUI streaming): 0 on run.completed, 2 on run.failed, 6 on run.cancelled, 3 when the run blocks on input while stdin is non-interactive, 1 on client/transport errors, 130 on SIGINT/SIGTERM. Full contract: Exit Codes.

list / runs subcommand

Both list and runs tokens route to runList. Calls GET /v1/runs.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.
-status""Filter by status: queued, running, completed, or failed.
-conversation-id""Filter by conversation ID.

Output: a 4-column table (ID, STATUS, MODEL, PROMPT). Prompt is truncated at 40 characters.

Source: cmd/harnesscli/runctl.go:53-58

cancel subcommand

Takes one positional argument: the run ID. Calls POST /v1/runs/{id}/cancel.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.

Source: cmd/harnesscli/runctl.go:118-121

status / show subcommand

Both status and show tokens route to runStatus. Takes one positional argument: the run ID. Calls GET /v1/runs/{id}.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.

Source: cmd/harnesscli/runctl.go:174-177

continue subcommand

Takes a run ID as the first positional argument and the continuation prompt as the remaining arguments (joined with spaces). Calls POST /v1/runs/{id}/continue.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.
-no-streamfalseCreate the continuation run without streaming events. Prints only run_id=<id> and exits 0 (1 on error); no terminal event is observed, so the exit-code mapping does not apply.

Source: cmd/harnesscli/runctl.go:260-264

replay subcommand

Takes one positional argument: a run ID or a path to a rollout JSONL file. Calls POST /v1/runs/replay.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.
-modesimulateReplay mode: simulate (offline integrity check) or fork (reconstruct up to a step and resume live).
-fork-step0Step to fork from when -mode=fork. Only included in the request payload when mode is fork.
-detect-driftfalseRun drift detection during a simulate replay.

Output is pretty-printed JSON to stdout.

Source: cmd/harnesscli/runctl.go:334-340

search subcommand

Takes one or more positional arguments as the query (joined with spaces). Fetches all runs from GET /v1/runs and filters client-side — there is no dedicated server search endpoint.

FlagDefaultDescription
-base-urlhttp://localhost:8080Harness API base URL.
-status""Filter by status before searching.

Search is a case-insensitive substring match over: ID, conversation ID, tenant ID, model, prompt, output, status, error, and workflow recap fields.

Source: cmd/harnesscli/runctl.go:403-407

improve subcommand

Delegates to scripts/autoresearch-loop.sh. Must be run from the repo root.

FlagDefaultDescription
-target(empty, repeatable)Target seam to inspect. May be repeated.
-dry-runfalsePrint the planned autoresearch command without running it.
-score-onlyfalseRun go test ./..., go test ./... -race, and ./scripts/test-regression.sh, then exit.
-iterations"1"Autoresearch loop iteration count.
-pause"0"Seconds to pause between autoresearch runs.
-report-dir.tmp/autoresearchDirectory for autoresearch report output.
-base-urlhttp://localhost:8080Harness API base URL.
-profile"full"Run profile sent to harnessd.
-prompt-profile"autoresearch"Prompt routing profile.
-model""Optional model override.
-max-steps"50"Step budget passed to autoresearch runs.
-test-cmd./scripts/test-regression.shDefault validation command for unknown targets.

The -test-cmd value is also exported as HARNESS_AUTORESEARCH_DEFAULT_TEST_CMD when launching the loop script.

Source: cmd/harnesscli/improve.go:31-43

auth login subcommand

Generates an API key locally (no server call) and saves it to ~/.harness/config.json.

FlagDefaultDescription
-serverhttp://localhost:8080Harness server URL stored in the config file.
-tenant"default"Tenant ID for the new key.
-name"cli"Human-readable name for this key.

On success, prints the config path, the raw API key, and an Authorization: Bearer <key> example.

Source: cmd/harnesscli/auth.go:32-37

auth login does not contact the server. The key is generated locally and stored at ~/.harness/config.json (permissions: directory 0700, file 0600). The server URL you pass is stored as metadata only — no validation occurs.


go-code — the user-facing wrapper

go-code (scripts/go-code.sh) is the single user-facing command. It auto-starts harnessd when no server is healthy at the configured port, delegates to harnesscli for all subcommands, and shuts the server down on exit only if it started it.

Invocation modes

InvocationModeWhat it does
go-codetuiLaunches the BubbleTea TUI.
go-code "prompt text"promptRuns a single prompt and streams events.
go-code --serverserverStarts harnessd in background, prints the URL, and exits.
go-code runslistLists known runs (alias: go-code list).
go-code show <run-id>statusShows one run (alias: go-code status <run-id>).
go-code cancel <run-id>cancelCancels a run.
go-code continue <run-id> "prompt"continueContinues a completed run and streams events.
go-code replay <run-id-or-path>replayReplays a recorded run.
go-code search <query>searchSearches run metadata.
go-code improve [--target seam]improveRuns or plans the self-improvement test loop.

Source: scripts/go-code.sh:31-56, scripts/go-code.sh:210-282

Relevant environment variables

VariableDefaultDescription
HARNESS_ADDR:8080Server listen address. The port is extracted and used to construct the base URL passed to harnesscli.
GO_CODE_DATA_DIR(auto-detected)Override the runtime asset root (prompts, catalog).
HARNESS_MODEL_CATALOG_PATH(auto-detected)Path to catalog/models.json.

Source: scripts/go-code.sh:23-24, scripts/go-code.sh:76-79, scripts/go-code.sh:99


cronctl — cron job management CLI

cronctl (cmd/cronctl) is the CLI client for cronsd. It communicates over HTTP.

Environment variable

VariableDefaultDescription
CRONSD_URLhttp://localhost:9090Base URL of the cronsd service.

Source: cmd/cronctl/main.go:34-36

Subcommands and flags

SubcommandRequired flagsOptional flagsDescription
create--name, --schedule, --command--type (default shell), --timeout (default 30)Create a recurring job. --schedule accepts a standard 5-field UTC cron expression (no seconds field).
listList all jobs in tabular format.
get <id-or-name>Get a single job by ID or name.
delete <id-or-name>Soft-delete a job.
history <id-or-name>--limit (default 20)List execution history for a job.
pause <id-or-name>Pause a job (sets status to "paused").
resume <id-or-name>Resume a paused job (sets status to "active").
healthCheck cronsd health.

Source: cmd/cronctl/main.go:41-96

Example:

cronctl create \
--name daily-report \
--schedule "0 9 * * 1-5" \
--command "curl -s http://localhost:8080/v1/runs -d '{}' -H 'Content-Type: application/json'" \
--timeout 60

Cron expressions are 5-field UTC only (Minute Hour DOM Month DOW). The robfig/cron/v3 parser does not accept a seconds prefix — 6-field expressions will fail validation.


cronsd — cron scheduling daemon

cronsd (cmd/cronsd) is the standalone cron daemon. It owns a SQLite database and exposes a REST API. harnessd embeds an equivalent scheduler by default (when HARNESS_CRON_URL is empty) so you only need cronsd when running a dedicated external cron service.

Environment variables

VariableDefaultDescription
CRONSD_ADDR:9090Listen address.
CRONSD_DB_PATH~/.go-harness/cronsd.dbSQLite database file path.
CRONSD_MAX_CONCURRENT5Maximum simultaneous job executions.

Source: cmd/cronsd/main.go:65-69

cronsd has no CLI flags beyond the implicit help output. All configuration is via environment variables.


symphd — issue-driven orchestration daemon

symphd (cmd/symphd) is an orchestration daemon that polls GitHub Issues, provisions workspaces, dispatches agent runs, and applies retry-with-backoff. It is configured primarily through a YAML file.

CLI flags

FlagDescription
-config <path>Path to the YAML config file.
-addr <addr>Override the listen address (e.g. :8888).

Source: cmd/symphd/main.go:32-33

YAML config keys (with defaults)

The YAML config file controls all orchestration behavior. Below are the keys and their built-in defaults.

KeyDefaultDescription
addr":8888"HTTP listen address for the symphd API.
workspace_type"local"Workspace type: local, worktree, container, vm, or pool.
max_concurrent_agents10Maximum simultaneously running agent dispatches.
poll_interval_ms5000GitHub Issue poll interval in milliseconds.
harness_url"http://localhost:8080"URL of the harnessd instance inside each workspace.
base_dir"$TMPDIR/symphd"Base directory for workspace provisioning.
track_label"symphd"GitHub Issue label that marks issues for dispatch.
retry_max_attempts5Maximum dispatch attempts per issue before dead-lettering.
retry_base_delay_ms10000Base backoff delay in milliseconds (10 seconds).
retry_max_delay_ms300000Maximum backoff delay in milliseconds (5 minutes).
pool_size3Number of pre-provisioned workspaces when workspace_type: pool.
pool_workspace_type"container"Type of workspace each pool slot uses.

Source: internal/symphd/config.go:69-108

Environment variables

VariableDescription
GITHUB_TOKENGitHub API token. Used when github_token is not set in the config file.
HETZNER_API_KEYRequired when workspace_type: vm.
OPENAI_API_KEYForwarded to each provisioned workspace's environment.
ANTHROPIC_API_KEYForwarded to each provisioned workspace's environment.
HARNESS_MODELForwarded to each provisioned workspace's environment.

API keys are never written to disk or to TOML — they are captured from the parent process at startup and forwarded via workspace.Options.Env.

Source: internal/symphd/config.go:91-93, internal/symphd/orchestrator.go:267-284


trainerd — training and scoring CLI

trainerd (cmd/trainerd) reads JSONL rollout files produced by the harness, computes structural metrics, optionally sends batches to Claude for analysis, and can auto-apply high-confidence findings to system prompts or tool descriptions on a git branch.

Persistent flags (all subcommands)

FlagDefaultDescription
--db-path~/.trainerd/training.dbSQLite database path for traces, findings, and applied changes.
--log-levelinfoLog level.

Source: cmd/trainerd/main.go:38-39

Subcommands

trainerd score — load a JSONL rollout file and compute structural scores.

FlagRequiredDefaultDescription
--run-id <id>yesRun ID to score. Reads the rollout from HARNESS_ROLLOUT_DIR/<date>/<run_id>.jsonl.
--rollout-dirno~/.trainerd/rolloutsDirectory containing rollout JSONL files. Overridden by HARNESS_ROLLOUT_DIR.

Source: cmd/trainerd/commands.go:16-35

The --trainer flag on trainerd loop is accepted but has no effect on which model is used. The model is fixed to the package default claude-opus-4-6 (const defaultModel at internal/training/claude_trainer.go:15, applied by NewClaudeTrainer); the --trainer flag value is never passed to WithModel(). Source: internal/training/claude_trainer.go:13-18, cmd/trainerd/commands.go:103,249.


forensics — rollout diffing CLI

forensics (cmd/forensics) has one subcommand: diff. It compares two JSONL rollout files and scores which run performed better.

forensics diff

forensics diff <rollout_a.jsonl> <rollout_b.jsonl>

Takes two positional arguments: paths to JSONL rollout files. No flags.

Output format:

Run A: <N> steps, $<cost>
Run B: <N> steps, $<cost>
Steps: <N> identical, <N> diverged, <N> only in A, <N> only in B
Winner: A|B|Tie (<reasons>)

The winner is determined by a regression scorer that awards points for: outcome (3 pts), error count (1 pt), cost (1 pt), and step count (1 pt).

Source: cmd/forensics/main.go:5-6, cmd/forensics/main.go:36-138


install.sh — source installer

scripts/install.sh installs harnessd, harnesscli, and the go-code wrapper into a user-accessible location. The default target is ~/.local/bin (no sudo required).

Flags

FlagDescription
--prefix DIRInstall under DIR/bin. Default: ~/.local.
--bin-dir DIRDirect binary destination (overrides the bin/ subdirectory of --prefix).
--data-dir DIROverride the runtime assets destination (prompts, catalog).
--systemInstall to /usr/local/bin. May require sudo.
--add-to-pathAppend the install directory to your shell profile.
--no-buildReuse pre-built ./harnesscli and ./harnessd binaries in the repo root instead of running go build.
--uninstallRemove go-code, harnesscli, harnessd, and the data directory.
--dry-runPrint what would happen; write nothing to disk.

Source: scripts/install.sh:23-48

Environment variable overrides (checked before flag parsing)

VariableOverrides
GO_CODE_PREFIX--prefix default
GO_CODE_BINDIR--bin-dir
GO_CODE_DATA_DIR--data-dir

Source: scripts/install.sh:15-17


scripts/init.sh — worktree bootstrap

scripts/init.sh is the canonical way to create a new isolated development worktree. It creates the worktree, downloads dependencies, builds local binaries, and writes a sourceable env file.

scripts/init.sh [options] <task-slug>

Flags

FlagDefaultDescription
--base-ref <ref>mainBase git ref for the new worktree.
--branch <name>codex/<task-slug>Branch name. The codex prefix can be overridden with INIT_BRANCH_PREFIX.
--worktree-root <dir>.codex-worktreesDirectory where worktrees are stored.
--session <name>Start harnessd in a tmux session with this name.
--start-serverStart harnessd in tmux after bootstrapping.
--skip-buildSkip the go build step.
--skip-downloadSkip go mod download.
--checkVerify prerequisites and exit.

Source: scripts/init.sh:11-32


Next steps