CodeWork
CLI

Reference

Every CodeWork CLI command, flag, and environment variable.

Run codework --help or codework <command> --help to see this from your terminal.

Commands

CommandWhat it does
codework run <prompt>Start or continue an agent session
codework modelsList the model catalog
codework models providersList provider IDs
codework models refreshDownload the model catalog if it’s stale
codework auth loginSign in to a subscription provider
codework auth statusShow a stored login without refreshing it
codework auth refreshRefresh a stored login if it has expired
codework auth logoutClear a stored login
codework mcp add <name>Add or replace an MCP server in mcp.json
codework mcp remove <name>Remove an MCP server from mcp.json
codework mcp listConnect to every enabled MCP server and show its state and tools
codework mcp login <name>Sign in to an MCP server with OAuth
codework mcp logout <name>Remove an MCP server’s stored OAuth credentials
codework mcp reconnect <name>Restart a thread’s MCP server in a running server
codework mcp disconnect <name>Close a thread’s MCP server in a running server
codework plugin add <spec>Install a plugin and add it to a settings file
codework plugin remove <spec>Remove a plugin from a settings file
codework plugin installInstall every plugin the settings files name
codework plugin listList configured plugins and what each resolved to
codework plugin check [spec]Report plugins with a newer revision
codework plugin update [spec]Fetch newer revisions
codework plugin reloadRe-import plugins in a running server
codework session link <id>Link a session to a project folder, through a running server
codework session relink <id>Move a session’s work, or one thread’s, to another checkout
codework thread list <id>List a session’s threads, newest first
codework thread fork <id>Start a new thread from an entry of a thread’s history
codework service startStart the background server and print its URL
codework service restartRestart the background server and print its URL
codework service statusPrint the background server’s URL, or stopped
codework service stopStop the background server
codework serveStart the RPC server
codework acpStart the ACP server on stdio

Commands that talk to a running server (mcp reconnect, mcp disconnect, plugin reload, session link, session relink, thread list, thread fork) take --server, which defaults to ws://127.0.0.1:7433/rpc/v1.

codework run

FlagDescription
-s, --session <id>Continue an existing session
--thread <id>Thread of --session to continue: a thread ID, or main (default)
-C, --cwd <path>Working directory for a new session
--provider <id>Provider ID from the model catalog. Use it together with --model
--model <id>Model ID. Use it together with --provider
--thinking <level>off, minimal, low, medium, high, xhigh, or max
--sandbox-driver <driver>Sandbox driver for a new session (default local)
--sandbox-id <id>Reuse an existing sandbox instance
--sandbox-provider-id <id>Attach to an existing remote sandbox by its provider ID
--server <url>Run against an RPC server, e.g. ws://127.0.0.1:7433/rpc/v1

--cwd and the sandbox flags only apply when starting a new session. Ctrl+C stops the run, and codework serve does not resume it later. run exits with 1 when the reply was cut off by the model’s output limit.

codework auth

FlagDescription
--openai-codexUse OpenAI Codex (ChatGPT Plus or Pro)
--github-copilotUse GitHub Copilot
--devicelogin only: use a device code instead of a local browser callback
--browserlogin only: open the sign-in URL in your browser (default on)
--enterprise <host>login only: GitHub Enterprise domain for Copilot
--enable-modelslogin only: enable unconfigured Copilot catalog models
--auth-file <path>Credential file (default <home>/aikit/auth.json)
--server <url>Use the credentials of a running RPC server instead of this machine
--jsonMachine-readable output (not on logout)

codework mcp

add and remove edit the user mcp.json in your CodeWork home, or the project’s .codework/mcp.json with --local.

FlagApplies toDescription
--url <url>addStreamable HTTP server URL, instead of a command after --
--env KEY=VALUEaddEnvironment variable of a stdio server
--cwd <path>addWorking directory of a stdio server
--header KEY=VALUEaddHTTP header
--bearer-token-env-var <var>addSend Authorization: Bearer with this variable’s value
--oauth-client-id <id>addPre-registered OAuth client ID
--oauth-client-secret <s>addOAuth client secret (may be ${NAME} or !command)
--oauth-callback-port <port>addFixed OAuth callback port
--oauth-client-name <name>addClient name sent when registering with the OAuth server
--exposure <mode>adddirect (default), hidden, codemode, or deferred
--description <text>addWhat the server offers
-l, --localadd, removeEdit the project’s .codework/mcp.json
--jsonlistMachine-readable output
--browserloginOpen the sign-in URL in your browser (default on)
--timeout <seconds>loginHow long the whole sign-in may take (default 300)
-s, --session <id>reconnect, disconnectThe session (required)
--thread <id>reconnect, disconnectThread whose server it is: a thread ID, or main (default)
codework mcp add fs -- npx -y @modelcontextprotocol/server-filesystem .
codework mcp add linear --url https://mcp.linear.app/mcp

codework mcp list exits with 1 when an entry is broken or an enabled server does not connect.

codework session

FlagApplies toDescription
--unlinklinkClear the link, leaving the session with no project folder
--thread <id>relinkMove only this thread (a thread ID, or main) instead of the session
-C, --directoryrelinkCheckout to move into
--sandbox-id <id>relinkSandbox instance to move to (default local)
--jsonrelinkMachine-readable output

codework session link <id> [path] links the session to path, or to the current folder when you leave path out.

codework thread

FlagApplies toDescription
--thread <id>forkThread to fork: a thread ID, or main (default)
--at <entry>forkKeep history through this entry
--before <entry>forkKeep history up to this prompt, and print the prompt’s text
--jsonlist, forkMachine-readable output

codework thread fork prints the new thread’s ID. Continue it with codework run --session <id> --thread <thread-id>.

codework plugin

FlagApplies toDescription
-g, --globaladd, removeEdit the user-wide settings file instead of this project’s
--session <id>addWrite to the project a session is linked to
--verboselistShow the message behind a failure
--refreshcheckAsk again instead of reusing a recent answer

codework models

FlagApplies toDescription
--provider <id>modelsList only this provider’s models
--forcerefreshDownload the catalog even if it’s fresh

codework service

codework service start reuses the background server named in <home>/service.json, or starts one. The server keeps running until codework service stop. A server from an older CLI version is replaced. Its log is <home>/log/server.log.

FlagApplies toDescription
--hoststart, restartInterface a new background server binds (default 127.0.0.1)
--portstart, restartPort a new background server listens on (default 7433)

codework serve

On start, the server resumes runs that a crash or shutdown cut off.

FlagDescription
--hostInterface to bind (default 127.0.0.1)
--portPort to listen on, or 0 for any free port (default 7433)
--serviceRun as the background server, logging to <home>/log/server.log

Global flags

These work on every command. With --server, put --home, --database, and --user-config-dir on codework serve instead.

FlagDescription
--homeCodeWork home for settings, credentials, cache and data (default ~/.codework)
--databaseSQLite database path, or :memory: for throwaway sessions
--user-config-dirDirectory whose settings.jsonc replaces the user settings in --home
-h, --helpShow help
-v, --versionShow the version
--log-levelMinimum log level: all, trace, debug, info, warn, error, fatal, or none
--completionsPrint a shell completion script: bash, zsh, fish, sh, powershell, or pwsh
--wizardStart wizard mode for a command

Environment variables

VariableDescription
CODEWORK_HOME_DIRCodeWork home when --home is not given (default ~/.codework)
CODEWORK_MODELS_FILEPin the model catalog to a file you manage
CODEWORK_MODELS_TTLHow old the catalog may get before a refresh (default 15 minutes)
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
OPENROUTER_API_KEYOpenRouter API key
GEMINI_API_KEYGoogle Gemini API key
XAI_API_KEYxAI API key

Settings files are covered in the settings reference.