cn -p "your prompt" to execute a single task without an interactive session. The agent runs to completion and prints its response to stdout.
Piping
Pipe data intocn to include it as context:
Output options
| Flag | Effect |
|---|---|
--silent | Strip <think> tags and excess whitespace from output |
--format json | Output structured JSON |
--silent is useful when piping output into another program. --format json is useful for parsing results programmatically.
Tool permissions
In headless mode, tools that would normally prompt for approval (ask permission) are automatically excluded — there’s no one to approve them. To enable write operations, explicitly allow them:
Authentication in CI
SetCONTINUE_API_KEY instead of running cn login: