CLI
Automation and CI
Run Cortex non-interactively with stable output and fail-closed approvals.
cortex exec "Fix the failing unit test" --output jsonprintf '%s' "Review this pull request" | cortex review - --output jsonlcortex validate test "Run the repository test suite" --final-message-file result.txtStable inputs and outputs
Section titled “Stable inputs and outputs”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.
CI guidance
Section titled “CI guidance”- 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.

