# Claude Code Headless Runs with Reviewable Evidence

> Collect reviewable artefacts from Claude Code headless runs by saving the candidate diff, test process exit code and verifier output in a focused CI job.

URL: https://www.matthewswong.com/en/blog/claude-code-headless-evidence-artifacts/

- Author: Matthews Wong (https://www.matthewswong.com/en/about/)
- Published: 2026-12-03
- Updated: 2026-12-03
- Category: AI

> **Key takeaway:** A Claude Code headless run can produce a review note and a candidate diff, while the CI script owns the final pass or fail decision. Choose a deterministic command for verification and retain its exit code separately from conversational output. Use a bilingual key check as a concrete first fixture.

What should the headless job do?

Give it one clear requirement such as identifying a missing counterpart in a translation file. Ask for paths and a described change. Limit the task to a checkout with fixture files and treat any proposed patch as a candidate for review.

Which result should control CI?

Run the key check as an independent process in the workflow. Save its exit code and attach relevant output to the job. A summary that says success can appear even when a validation step never ran.

How should artefacts be arranged?

Keep a short run summary, a compact diff and the verifier output. Record the commit under test alongside them. This lets a reviewer distinguish a patch produced in the run from a checkout that already contained the fix.

What should a failure fixture do?

Introduce a missing translation in a test checkout and confirm that the verifier fails with a path or key. Restore the pair and check that the same workflow succeeds. Exercise both cases before trusting the gate for real content.

How should the CLI output be interpreted?

Select an output format documented for the CLI version you run if downstream tooling parses the response. Keep its parse failures distinct from repository check failures. Label both in the job log so the maintainer knows which process to retry.

Which data should the job retain?

Retain the commit, file paths, and verification results needed for review. Use synthetic inputs for examples and avoid dumping environment values into logs. A focused artefact is easier to inspect than a long session transcript.

## Sources and further reading

- Claude Code CLI reference
- Claude Code workflows
- Claude Code permissions
- Claude Code settings and precedence

## Source links

- https://code.claude.com/docs/en/cli-reference
- https://code.claude.com/docs/en/common-workflows
- https://code.claude.com/docs/en/permissions
- https://code.claude.com/docs/en/settings

## FAQ

### What should the headless job do?

Give it one clear requirement such as identifying a missing counterpart in a translation file. Ask for paths and a described change. Limit the task to a checkout with fixture files and treat any proposed patch as a candidate for review.

### Which result should control CI?

Run the key check as an independent process in the workflow. Save its exit code and attach relevant output to the job. A summary that says success can appear even when a validation step never ran.

### How should artefacts be arranged?

Keep a short run summary, a compact diff and the verifier output. Record the commit under test alongside them. This lets a reviewer distinguish a patch produced in the run from a checkout that already contained the fix.

### What should a failure fixture do?

Introduce a missing translation in a test checkout and confirm that the verifier fails with a path or key. Restore the pair and check that the same workflow succeeds. Exercise both cases before trusting the gate for real content.

### How should the CLI output be interpreted?

Select an output format documented for the CLI version you run if downstream tooling parses the response. Keep its parse failures distinct from repository check failures. Label both in the job log so the maintainer knows which process to retry.

---

- HTML version: https://www.matthewswong.com/en/blog/claude-code-headless-evidence-artifacts/
- Bahasa Indonesia: https://www.matthewswong.com/id/blog/claude-code-headless-evidence-artifacts/
- Site index for agents: https://www.matthewswong.com/llms.txt
- Sitemap: https://www.matthewswong.com/sitemap.xml
- API description (OpenAPI): https://www.matthewswong.com/openapi.json
