Skip to content

CLI

Automation and CI

Run Cortex non-interactively with stable output and fail-closed approvals.

Terminal window
cortex exec "Fix the failing unit test" --output json
printf '%s' "Review this pull request" | cortex review - --output jsonl
cortex validate test "Run the repository test suite" --final-message-file result.txt

Use --output json for one final document or jsonl for ordered events. Set --output-schema FILE when the result must match a JSON schema and --final-message-file FILE when downstream work needs only the final message. Bound work with --timeout, --max-turns and --retries.

Headless execution never prompts or reads an approval from standard input. A required approval fails closed unless --approval-provider names an approved external provider. Read-only review and security presets do not become writable because an approval provider exists.

  • Use short-lived workload authentication where your organization enables it.
  • Pin the Cortex CLI release and verify the signed installer or update manifest.
  • Preserve JSONL ordering and exit codes.
  • Do not place tokens in command arguments, repository variables printed by the job, or generated artifacts.