Skip to main content

CLI Commands

When run without arguments, the CoStrict CLI launches the TUI interface by default.

cs

You can also pass a prompt directly to run non-interactively:

cs run "Explain how closures work in JavaScript"

tui

Launch the CoStrict terminal user interface.

cs [project]

Flags

FlagShortDescription
--continue-cResume the last session
--session-sSession ID to resume
--forkFork the session when resuming (use with --continue or --session)
--promptPrompt to use
--model-mModel to use, in provider/model format
--agentAgent to use
--portPort to listen on
--hostnameHostname to listen on

Commands

agent

Manage CoStrict agents.

cs agent [command]

create

Create a new agent with a custom configuration.

cs agent create

This command guides you through creating an agent with a custom system prompt and tool configuration.

list

List all available agents.

cs agent list

attach

Attach a terminal to a CoStrict backend started via serve or web.

cs attach [url]

Example:

# Start the backend server
cs web --port 4096 --hostname 0.0.0.0

# In another terminal, attach the TUI to the running backend
cs attach http://10.20.30.40:4096

Flags

FlagShortDescription
--dirWorking directory to launch the TUI in
--session-sSession ID to resume

auth

Manage provider credentials and login state.

cs auth [command]

login

Configure API keys for providers. Keys are stored in ~/.local/share/costrict/auth.json.

cs auth login

CoStrict loads provider information from the credentials file on startup, as well as from environment variables or a .env file in the project.

list

List all authenticated providers.

cs auth list
# or
cs auth ls

logout

Remove a provider's login credentials.

cs auth logout

mcp

Manage Model Context Protocol servers.

cs mcp [command]

add

Add an MCP server to your configuration.

cs mcp add

list

List all configured MCP servers and their connection status.

cs mcp list
# or
cs mcp ls

auth

Authenticate against an OAuth-enabled MCP server.

cs mcp auth [name]

List OAuth-enabled servers and their auth status:

cs mcp auth list
# or
cs mcp auth ls

logout

Remove OAuth credentials for an MCP server.

cs mcp logout [name]

debug

Debug OAuth connection issues for an MCP server.

cs mcp debug <name>

models

List all available models across configured providers.

cs models [provider]

Models are displayed in provider/model format — useful for finding the exact model name to use in config files.

Filter by provider:

cs models anthropic

Flags

FlagDescription
--refreshRefresh the model cache from models.dev
--verboseVerbose output including pricing metadata

run

Run CoStrict non-interactively with a direct prompt.

cs run [message..]

Useful for scripting, automation, or quick answers:

cs run Explain how context works in Go

Connect to a running cs serve instance to avoid MCP server cold-start time:

# Start a headless server in one terminal
cs serve

# Run commands in another terminal
cs run --attach http://localhost:4096 "Explain async/await"

Flags

FlagShortDescription
--commandCommand to run, using the message as arguments
--continue-cResume the last session
--session-sSession ID to resume
--forkFork the session when resuming
--shareShare the session
--model-mModel to use, in provider/model format
--agentAgent to use
--file-fFile to attach to the message
--formatOutput format: default or json (raw JSON events)
--titleSession title
--attachAttach to a running CoStrict server (e.g. http://localhost:4096)
--portLocal server port (default: random)

serve

Start a headless CoStrict server for API access.

cs serve

Set COSTRICT_SERVER_PASSWORD to enable HTTP basic auth (username defaults to costrict).

Flags

FlagDescription
--portPort to listen on
--hostnameHostname to listen on
--mdnsEnable mDNS discovery
--corsAdditional browser origins to allow for CORS

session

Manage CoStrict sessions.

cs session [command]

list

List all sessions.

cs session list
FlagShortDescription
--max-count-nLimit to the most recent N sessions
--formatOutput format: table or json (default: table)

stats

Show token usage and cost statistics for sessions.

cs stats

Flags

FlagDescription
--daysShow stats for the last N days (default: all time)
--toolsNumber of tools to show (default: all)
--modelsShow per-model usage breakdown
--projectFilter by project

export

Export session data as JSON.

cs export [sessionID]

If no session ID is provided, you will be prompted to choose from available sessions.


import

Import session data from a JSON file.

cs import <file>

web

Start a headless CoStrict server with a web interface.

cs web

Opens a browser at http://127.0.0.1:4096/ by default.

Flags

FlagDescription
--portPort to listen on
--hostnameHostname to listen on
--mdnsEnable mDNS discovery
--corsAdditional browser origins to allow for CORS

acp

Start an ACP (Agent Client Protocol) server.

cs acp

Communicates via nd-JSON over stdin/stdout.

Flags

FlagDescription
--cwdWorking directory
--portPort to listen on
--hostnameHostname to listen on

uninstall

Uninstall CoStrict and remove all related files.

cs uninstall

Flags

FlagShortDescription
--keep-config-cKeep configuration files
--keep-data-dKeep session data and snapshots
--dry-runShow what would be deleted without deleting
--force-fSkip confirmation prompts

upgrade

Update CoStrict to the latest or a specific version.

cs upgrade [target]

Upgrade to a specific version:

cs upgrade v0.1.48

Flags

FlagShortDescription
--method-mInstallation method: curl, npm, pnpm, bun, brew

Global Flags

FlagShortDescription
--help-hShow help
--version-vPrint version number
--print-logsPrint logs to stderr
--log-levelLog level: DEBUG, INFO, WARN, ERROR

Environment Variables

VariableTypeDescription
COSTRICT_BASE_URLstringCoStrict server URL (for self-hosted deployments)
COSTRICT_SERVER_PASSWORDstringEnable basic auth for serve/web
COSTRICT_SERVER_USERNAMEstringOverride basic auth username (default: costrict)
COSTRICT_CONFIGstringPath to configuration file
COSTRICT_CONFIG_DIRstringPath to configuration directory
COSTRICT_CONFIG_CONTENTstringInline JSON configuration
COSTRICT_AUTO_SHAREbooleanAutomatically share sessions
COSTRICT_DISABLE_AUTOUPDATEbooleanDisable automatic update checks
COSTRICT_DISABLE_TERMINAL_TITLEbooleanDisable automatic terminal title updates
COSTRICT_PERMISSIONstringInline JSON permission configuration
COSTRICT_DISABLE_LSP_DOWNLOADbooleanDisable automatic LSP server downloads
COSTRICT_DISABLE_AUTOCOMPACTbooleanDisable automatic context compaction
COSTRICT_GIT_BASH_PATHstringPath to Git Bash executable on Windows

Experimental Features

VariableTypeDescription
COSTRICT_EXPERIMENTALbooleanEnable all experimental features
COSTRICT_EXPERIMENTAL_LSP_TOOLbooleanEnable the experimental LSP tool
COSTRICT_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MSnumberDefault timeout for bash commands (ms)
COSTRICT_EXPERIMENTAL_OUTPUT_TOKEN_MAXnumberMaximum output tokens for LLM responses
COSTRICT_EXPERIMENTAL_FILEWATCHERbooleanEnable directory-wide file watcher
COSTRICT_EXPERIMENTAL_PLAN_MODEbooleanEnable plan mode