From RawTrail's demo data · Claude Code 2.1.302 on macOS · recorded 17 November 2026

What Claude Code runs before its first tool call

We launched Claude Code five times with claude -p and recorded each launch from macOS Endpoint Security. In the first half second, before it ran anything it was asked to, Claude Code started 15 to 21 processes of its own: it read its login from the Keychain, asked git about the project, and probed for toolchains. Most of it is housekeeping. None of it is in the session transcript, because none of it is a tool call.

The five launches

launch  permission mode     processes  security  git calls  first tool call
1       acceptEdits         15         4         3          2.71 s
2       acceptEdits         15         4         3          2.92 s
3       acceptEdits         15         4         3          2.02 s
4       bypassPermissions   18         4         6          5.34 s
5       bypassPermissions   21         4         9          10.27 s

Processes are distinct process IDs descended from the claude process between its exec and the first tool call in the transcript. A re-exec keeps its process ID, so git's hop through the Command Line Tools shim is not counted twice. Launches 1 to 3 are the three prompts of one session, 4 and 5 the two prompts of another. In every launch the last of these processes started 0.26 to 0.79 seconds after claude, and no other process started before the first tool call.

What it ran, in order

  • Its own login, from the Keychain. Four runs of security find-generic-password -a <user> -w: three for the service "Claude Code-credentials" (one of them through /bin/sh -c) and one for "Claude Code". The -w flag prints the stored secret to the child's output, which Claude Code reads. This is how it gets its login on a Mac.
  • Whether a local settings file is in git. git ls-files --error-unmatch -- ':(icase).claude/settings.local.json'. That file is where "Yes, and don't ask again" saves the permission rule, which can hold the full command, and it is meant to stay out of the repo.
  • Git state, with every hook switched off. git remote get-url origin and git remote in all five launches; in launches 4 and 5 also git status --short, git log --oneline -n 5 and git config user.name. The ls-files check sets core.hooksPath=/dev/null and core.fsmonitor=. Every other call carries 37 -c settings, among them core.hooksPath=/dev/null, core.fsmonitor=, core.askPass=, protocol.ext.allow=never and hook.<name>.enabled=false for 28 hook names. Hooks or an fsmonitor command configured in the repository can't run through Claude Code's own git calls. The git commands the agent ran later as tool calls (git init, git commit) carried none of these settings, so the repo's hooks applied to them as usual.
  • The files in the project and the plugin cache. rg --no-config --files --hidden /path/to/project, and rg --files --hidden --no-ignore --max-depth 4 --glob .orphaned_at ~/.claude/plugins/cache.
  • The machine and its toolchains. One sh -c script: uname -s, -r, -m, then command -v for npm, yarn, pnpm, bun, deno and node. Plus ps -o lstart= -p <pid>.
  • Its own files and the network. A session file in ~/.claude/sessions/, a lock in ~/.local/state/claude/locks/, a rewrite of ~/.claude.json with a backup in ~/.claude/backups/, a file-watch probe in /tmp/claude-501/, and connections to Anthropic (DNS lookups for api.anthropic.com and mcp-proxy.anthropic.com show in launches 4 and 5; in 1 to 3 the address was probably cached).

Most of this is housekeeping, and the hook settings are a defense. The point is where you can see it: the transcript, and any hook that fires on tool calls, start at the first tool call. These processes run before it, as children of claude itself.

Check your own clones for settings.local.json

Claude Code checks the repository root only. To search the whole history of a clone, nested folders and any case included (fetch first):

git log --all --oneline -- ':(glob,icase)**/.claude/settings.local.json'

If it prints anything that was ever pushed, rotate the credentials in it. Deleting the file doesn't undo the push. In files people committed to public GitHub, GitGuardian counted 31,088 secrets, 5,343 of them still valid when found (InfoWorld, 11 November 2026).

Replay it yourself

The five launches, across two sessions, are in RawTrail's demo data, captured on a real Mac. The demo runs in Docker on any machine and shows recorded activity, not live capture.

git clone https://github.com/rawtrail/rawtrail.git
cd rawtrail
docker compose -f docker-compose.demo.yml up

Open https://localhost:8088/ui/, accept the self-signed certificate warning, and sign in with demo@rawtrail.local / demo. Open the ordinary coding session or the bypassPermissions one under Agent sessions: the process tree lists these children of claude next to the processes the tool calls started. The raw events are in corpus/sessions/alex-mbp.jsonl; filter exec events whose parent is a claude process and compare their timestamps with the first agent_tool_call.

To record your own launches on an Apple Silicon Mac with macOS 26 or later: scripts/laptop/rawtrail-laptop install from the same clone. Everything stays on your laptop, and rawtrail-laptop uninstall removes it. What it records: watch-your-agent.md.

What this does not show

  • One Mac, one Claude Code version (2.1.302), claude -p launches in one project. An interactive launch, another version, or a repo with a different layout may run a different set.
  • What these processes are for is our reading of the commands, not Anthropic's documentation.
  • RawTrail records Claude Code sessions today; other agents are not covered yet.

Using agents at work?

hello@rawtrail.io Star it on GitHub

RawTrail also deploys to a team's Macs through any MDM, reporting to a server you host (how it deploys). Victor is looking for up to three design partner teams to run it at work and tell him what is missing: the evaluation guide has what to install, where the data goes, and the terms. Write to him, or post what your agent did in the GitHub discussion.

Open source under MIT. Pre-1.0.