Browse documentation

Headless mode

Run Mind CLI non-interactively in CI/CD pipelines, automation scripts, and environments without a browser

Headless mode lets you run Mind CLI as part of your CI/CD pipeline to automate code reviews, generate tests, or troubleshoot build failures — no interactive terminal required. Authenticate with an API key, pass a prompt, and Mind executes it end-to-end.

Authentication

Headless mode requires an API key set as the MIND_API_KEY environment variable. If you haven't created one yet, follow the steps in Authentication.

Running headless commands

Pass --no-interactive along with your prompt:

mind chat --no-interactive "your prompt here"

Since there's no user to approve tool calls, use --trust-all-tools or --trust-tools to grant permissions upfront:

# Trust all tools:
mind chat --no-interactive --trust-all-tools "Write tests for auth"
# Trust specific tools:
mind chat --no-interactive --trust-tools=read,grep "Find all TODOs"

CI/CD examples

GitHub Actions

name: Mind Code Review
on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Mind CLI
        run: curl -fsSL https://app.mindcode.sh/install.sh | bash
      - name: Review PR changes
        env:
          MIND_API_KEY: ${{ secrets.MIND_API_KEY }}
        run: mind chat --no-interactive --trust-tools=read,grep "Review PR for security issues"

Structured output

Pass --output-format stream-json to receive run events as JSON Lines on stdout. Each line is a self-contained JSON object, making the output easier to process in scripts, logging pipelines, and CI jobs than formatted text.

mind chat --no-interactive --trust-all-tools --output-format stream-json "Summarize open TODOs"

Flags reference

FlagDescription
--no-interactiveRun without an interactive session. Requires a prompt as an argument
--output-format stream-jsonEmit run events as JSON Lines on stdout for programmatic use
--trust-all-toolsAuto-approve all tool calls without prompting
--trust-tools=<categories>Auto-approve specific tool categories (e.g., read, grep, write)
--require-mcp-startupFail immediately if any MCP server fails to connect

Best practices

  • Store MIND_API_KEY as a secret in your CI/CD platform — never commit it to source control.
  • Use --trust-tools with specific categories instead of --trust-all-tools to follow least privilege.
  • Add --require-mcp-startup when your pipeline depends on MCP servers to fail fast instead of hanging.