Skip to main content
Mythos

Headless Mode in 📝Claude Code is the non-interactive invocation pattern triggered by claude -p "<prompt>", designed for scripting, CI pipelines, and automated agent workflows that run without a human terminal session.

In headless mode, the harness skips the interactive UI entirely: no prompt approvals, no streaming TUI, no keyboard chord bindings. The agent receives the prompt, runs to completion, and emits a single structured response to stdout (markdown by default, JSON via --output-format json). The exit code reflects success or failure of the agent run, making it natural to chain into shell pipelines, GitHub Actions, or other automation surfaces.

Headless invocations typically pair with --dangerously-skip-permissions to pre-approve every tool call, since there's no human to answer prompts. Production patterns add tight allowlists in 📝settings.json (Claude Code) instead, granting only the specific commands the workflow needs. Session memory still loads from ~/.claude/projects/, so context persists across runs if the project is consistent — useful for repeat automations like nightly maintenance or scheduled triage.

Use cases include CI-driven code review (Claude evaluates a diff), batch refactoring across files, automated changelog generation from commit history, and the foundation underlying 📝Claude Code Routines (Anthropic-hosted scheduled headless runs). The companion --print flag in non-interactive mode disables fork mode for 📝Claude Code Forked Sub-Agents.

Contexts

Created with 💜 by One Inc | Copyright 2026