Skip to main content
Run 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 into cn to include it as context:
Pipe the output into other tools:

Output options

--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:
See tool permissions for the full policy system.

Resume in headless mode

Resume a previous session without interactive input:
This replays the previous session’s history, which can be useful for inspecting past results in automation.

Examples