toolcall() ← all concepts

// concept · agentic

In CI, claude -p runs the repo's own hooks

On your laptop, opening Claude Code in a folder you haven't trusted stops at a dialog first. In a headless run there is no dialog. So if a CI step runs claude -p on a pull request's checkout, the settings file in that pull request decides what commands run on your runner.

// the docs

Claude Code's headless docs, under Start faster with bare mode:

Without --bare, a -p session runs the hooks in a project's .claude/settings.json and connects the servers in its .mcp.json, even in a folder you've never trusted. A -p session shows no workspace trust dialog and no per-server approval prompt.

The security page says the same in one line: in an interactive session Claude Code shows the workspace trust dialog, and servers in .mcp.json get their own approval prompt, but "A -p session shows neither prompt." The permissions page's table What runs before you trust a folder lists each kind of repository content. In the claude -p column, hooks in settings files: "Used". Servers in .mcp.json: "Connected without asking, approved or not." (A repository's permissions.allow rules, by contrast, are not used.)

A hook is a command in a settings file, and the harness runs it on its event. The model doesn't choose to.

The fix: --bare for untrusted checkouts

# skips the repo's hooks, skills, commands, subagents, plugins and .mcp.json servers claude --bare -p "Review this diff" --allowedTools "Read"

The docs: "Bare mode is useful for CI and scripts … A hook in a teammate's ~/.claude or an MCP server in the project's .mcp.json won't run, because bare mode never reads them." Bare mode reads no OAuth login, so set ANTHROPIC_API_KEY. They also say --bare "will become the default for -p in a future release".

Two limits from the permissions page. Under --bare the project's env block and helpers such as awsAuthRefresh in its settings files still apply. Other per-run switches: --setting-sources user (read neither the project's settings nor its .mcp.json), --settings '{"disableAllHooks": true}' (putting it in your user settings alone isn't enough, because project settings take precedence), and disabledMcpjsonServers to reject a server by name.

What the official GitHub Action does

anthropics/claude-code-action's own security doc:

When the action runs against a pull request, it restores a fixed list of Claude configuration paths from the PR base branch before starting Claude: .claude/, .mcp.json, .claude.json, .gitmodules, .ripgreprc, CLAUDE.md, CLAUDE.local.md, and .husky/.

Related: what an agent's tools can reach on your machine.

Sources: Claude Code docs (headless, security, permissions; changelog through 2.1.310) and anthropics/claude-code-action (docs/security.md, base-action/README.md). Verified 2026-10-25.

One concept a week. Free.

The deeper, copy-paste version of each ToolCall short — in your inbox.

// total: 0.00 · spam: void · unsubscribe: one click