Skip to content

CLI Reference

Commands and flags for running and configuring Polytoken from a shell.

The legacy top-level print commands remain available for compatibility. Use the polytoken print command group for new scripts and workflows.

Polytoken CLI.

ArgumentTypeDescription
--config-dirCONFIGConfig directory for this invocation.
--working-dirWORKING_DIRWorking directory for this invocation.

Validate and manage Polytoken configuration.

Open the interactive configuration shell.

Edit a Polytoken configuration file, then validate it.

ArgumentTypeDescription
--userflagEdit the user/global config layer instead of the current project layer.
--formatyaml, toml, json5Format to use when creating a missing config file. Default: yaml.

Validate Polytoken configuration files.

ArgumentTypeDescription
--userflagValidate only the user/global config layer.
--projectflagValidate only the current project’s config layer.

Manage provider authentication state.

Manage authentication for a configured MCP server.

Log in to a configured MCP server with OAuth.

ArgumentTypeDescription
--serverSERVERConfigured MCP server name. Required.
--forceflagOverwrite existing OAuth state without prompting.
--no-openflagPrint the authorization URL without trying to open it in a browser.

Show whether a configured MCP server has stored OAuth state.

ArgumentTypeDescription
--serverSERVERConfigured MCP server name. Required.

Remove stored OAuth state for a configured MCP server.

ArgumentTypeDescription
--serverSERVERConfigured MCP server name. Required.
--yesflagConfirm logout without prompting.

Manage authentication for a configured provider. A provider with providers.<name>.enabled: false is not visible to these commands; re-enable the provider first.

Log in to a configured provider with its interactive auth flow.

ArgumentTypeDescription
--providerPROVIDERConfigured provider name. Required.
--forceflagOverwrite existing valid auth state without prompting.
--authorization-codeflagUse the browser OAuth authorization-code flow instead of the device flow (Codex providers only).

Show stored auth state for a configured provider, or for every configured provider that uses managed auth when —provider is omitted.

ArgumentTypeDescription
--providerPROVIDERConfigured provider name. Omit to show every configured provider that uses managed auth.

Refresh stored auth state for a configured provider.

ArgumentTypeDescription
--providerPROVIDERConfigured provider name. Required.

Remove stored auth state for a configured provider.

ArgumentTypeDescription
--providerPROVIDERConfigured provider name. Required.
--yesflagConfirm logout without prompting.

Print machine-readable Polytoken metadata.

Print structured CLI command metadata to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print structured tool documentation metadata to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the built-in language-server catalog to stdout, in catalog (precedence) order. Pure catalog data: no config loading, no PATH probing.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print structured slash-command documentation metadata to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print structured TUI keyboard command-action metadata to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the daemon’s OpenAPI specification to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the JSON Schema for the DaemonEvent wire envelope to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the JSON Schema for the daemon sync-event wire envelope to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the JSON Schema for the Outpost fleet-event wire union to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print the Outpost OpenAPI specification to stdout.

ArgumentTypeDescription
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Print an authored JSON Schema to stdout.

ArgumentTypeDescription
<SCHEMA>app-config, agents-frontmatter, facet-frontmatter, subagent-frontmatter, skill-frontmatter, permissions-configRequired.
--formatjson, json-pretty, yamlOutput format. Default: json-pretty. Alias: --formats.

Run the daemon in the foreground (not forked).

ArgumentTypeDescription
--listenLISTENDefault: 127.0.0.1:0.
--sessions-dirSESSIONS_DIR
--log-dirLOG_DIR
--project-dirPROJECT_PATHRequired.
--session-idSESSION_ID
--parent-session-idPARENT_SESSION_ID
--listener-fdLISTENER_FD
--global-config-dirGLOBAL_CONFIGGlobal config directory.
--project-config-dirPROJECT_CONFIGProject-level config directory.
--todo-dirTODO_DIROverride where todo records are read from and written to.
--resumeflagResume an existing session from saved history. Requires --session-id.
--credential-fileCREDENTIAL_FILEPath to the daemon credential file. The CLI generates a credential file at startup and passes this path to the daemon. Required.
--auth-dirAUTH_DIROverride the auth directory. When set, the daemon resolves Codex device auth and MCP OAuth credentials from this directory instead of the default data_root()/auth/.

Run a single non-interactive prompt, print the final result, and write stable exec: ... progress lines to stderr during provider retry waits.

ArgumentTypeDescription
<PROMPT>PROMPTPrompt text. If stdin is piped, stdin content is appended.
--modelMODELOverride the configured default model for this invocation.
--facetFACETOverride the exec facet for this invocation.
--max-tool-turnsMAX_TOOL_TURNSOverride the maximum number of tool turns for this invocation.
--output-schemaOUTPUT_SCHEMAJSON Schema file the exec completion tool must capture before the run finishes. Without it, every exec run still ends by calling the exec_structured_output tool, which captures a default {“output”: string} payload; the captured string is printed raw as the run’s stdout.
--todo-dirTODO_DIROverride where todo records are read from and written to.
--print-session-logsflagMirror session id, JSONL session events, and exec trace logs to stderr.

List configured models and selectable reasoning variants.

ArgumentTypeDescription
--formathuman, json, json-pretty, yamlOutput format. Default: human.

Spawn a new daemon session and attach the TUI.

ArgumentTypeDescription
--sessions-dirSESSIONS_DIROverride the sessions registry directory. Useful for tests and for supervisors that want a non-XDG location.
--log-dirLOG_DIROverride the log directory.
--no-attachflagSpawn the daemon and print its session id and port without attaching.
--promptPROMPTImmediately submit this text as the session’s first prompt. With the TUI (default), the prompt is submitted after the TUI attaches. With —no-attach, the prompt is submitted via HTTP after the daemon is healthy so the agent starts working in the background.
--modelMODELOverride the configured default model for this session. Accepts a model name exactly as exec --model does: short names and fully qualified strings like model(reasoning). An unknown model fails the command. A facet that pins a model takes precedence over this value.
--facetFACETOverride the session’s startup facet. An unknown facet fails the command. A facet that pins a model takes precedence over --model.
--adventurously-auto-approve-planflagStart the session with adventurous auto-handoff enabled, as if /adventurously-auto-approve-plan had been run. Takes effect while the session is in the plan facet.

Attach the TUI to a live session.

ArgumentTypeDescription
<SESSION_ID>SESSION_IDRequired.
--sessions-dirSESSIONS_DIROverride the sessions registry directory. Useful for tests and for supervisors that want a non-XDG location.

List live sessions (stale-cleans any dead entries as a side effect). Pass —all to list every session stored on disk, including historical and legacy sessions.

ArgumentTypeDescription
--sessions-dirSESSIONS_DIROverride the sessions registry directory.
--allflagList all sessions from disk (live, historical, and legacy) instead of only live ones. Read-only: skips stale registry cleanup.
--formathuman, json, json-pretty, yamlOutput format. Default: human.

Kill unattached local session daemons.

ArgumentTypeDescription
<SESSION_ID>SESSION_IDReap exactly this session without checking TUI attachment.
--forceflagSkip confirmation.
--sessions-dirSESSIONS_DIROverride the sessions registry directory.

Resume a previous session from history.

ArgumentTypeDescription
<SESSION_ID>SESSION_IDSession ID to resume directly, skipping the picker.
--sessions-dirSESSIONS_DIR
--log-dirLOG_DIR

Export a retained local session as standalone HTML without loading configuration or contacting a daemon.

ArgumentTypeDescription
<SESSION_ID>SESSION_IDRetained session identifier to export. Required.
--output-fileOUTPUT_FILEOutput HTML file. Relative paths resolve from the invocation cwd. Required.
--sessions-dirSESSIONS_DIROverride the retained sessions directory.
--forceflagReplace an existing output file atomically.

Run startup-readiness checks and report a checklist.

ArgumentTypeDescription
--formathuman, json, json-pretty, yamlOutput format. Default: human.

Inspect shipped polytoken:// resources (ls and cat).

List VFS schemes or entries in a polytoken:// directory.

ArgumentTypeDescription
<URI>URIOptional polytoken:// URI to list. Omit to list available VFS schemes.

Print the exact contents of a polytoken:// file to stdout.

ArgumentTypeDescription
<URI>URIThe polytoken:// URI to read. Required.

Validate a skill, facet, or subagent definition file.

Validate a skill definition file by name or path.

ArgumentTypeDescription
<TARGET>TARGETSkill/subagent/facet name (resolved via standard discovery) or path to a markdown file. Required.

Validate a subagent definition file by name or path.

ArgumentTypeDescription
<TARGET>TARGETSkill/subagent/facet name (resolved via standard discovery) or path to a markdown file. Required.

Validate a facet definition file by name or path.

ArgumentTypeDescription
<TARGET>TARGETSkill/subagent/facet name (resolved via standard discovery) or path to a markdown file. Required.

Inspect discovered themes and the design token catalog.

List discovered theme files (built-in and user).

ArgumentTypeDescription
--formathuman, jsonOutput format. Default: human.

List the design token catalog with metadata and default resolved styles.

ArgumentTypeDescription
--formathuman, jsonOutput format. Default: human.

Validate theme files, reporting errors and warnings.

ArgumentTypeDescription
--allflagValidate all discovered themes instead of one file.
<PATH>PATHTheme file path or polytoken:// URI to validate. When omitted (and --all is not set), validates the built-in default.

Inspect language-server support.

Check which language servers are installed.

ArgumentTypeDescription
<NAME>NAMEServer id to check (e.g. gopls). Omit to list every server.
--formathuman, json, json-prettyOutput format. JSON renders the full listing as one array and a named check as a single object. Default: human.

Generate shell completion scripts for bash, zsh, fish, powershell, or elvish.

ArgumentTypeDescription
<SHELL>bash, elvish, fish, powershell, zshShell to generate completions for. Required.

Check for and apply Polytoken self-updates.

ArgumentTypeDescription
--channellatest, stableRelease channel to track. Defaults to the updates.channel config value, or latest if unset. If Polytoken cannot load the config, Polytoken warns on stderr and uses latest.
--target-versionTARGET_VERSIONInstall a specific version instead of the channel latest. Bypasses the newer-than check (allows downgrades).
--checkflagCheck for available updates without applying them.
--formathuman, jsonOutput format. human (default) prints progress messages; json emits structured JSON to stdout. Default: human.