# How can I run Claude Code in CI with narrow permissions and verifiable output?

Exam: CCAR-F — Claude Certified Architect - Foundations (CCAR-F)
Knowledge domain: Claude Code Configuration & Workflows
Updated: 2026-11-25T09:22:56.8307+00:00
HTML: https://learningpathx.com/faq/CCAR-F/ccarf-claude-code-headless-ci-controls.html

## Also asked as

- What should I configure before running claude -p in an unattended CI job?
- How do I keep a non-interactive Claude Code workflow from waiting for approval or releasing unvalidated output?

Use `claude -p` for a non-interactive CI step and configure the permission mode and permitted actions before it runs. Use a dedicated CI identity, a minimal checkout and narrowly scoped credentials. A Manual-mode run denies a call that needs approval unless an authorized approval mechanism handles it. If you configure a permission host, set `--permission-prompts none` with Claude Code v2.1.259 or later to decline instead of waiting.

Use `--allowedTools` for narrowly scoped pre-approval. To restrict available built-in tools, use `--tools` and review other sources of tools, including MCP servers and plugins, as well as deny policy and the shell sandbox. Bound wall-clock time and cost. If you use `--output-format json` with `--json-schema`, check that `structured_output` exists, validate it before consumption, and treat both generated content and tool output as untrusted input. Run required checks separately. A run can end without structured output.

Store the revision, effective configuration, workflow identifier, elapsed time, sanitized output and check results as artifacts. Fail the CI job explicitly if a required check or artifact is missing. Give merge or release privileges to an independently validated stage with its own identity. This keeps a generated recommendation from granting permission to deploy.

[Claude Code non-interactive runs](https://code.claude.com/docs/en/headless) · [Claude Code CLI flags](https://code.claude.com/docs/en/cli-reference) · [Claude Code permission rules](https://code.claude.com/docs/en/permissions)

Source: [Claude Code Hooks, Plan Mode, Automation, and CI Workflows](https://learningpathx.com/news/claude-code-hooks-plan-mode-automation-and-ci-workflows.html)
