Claude Code¶
Run Claude Code inside an isolated Git worktree, with every session captured as a reviewable attempt.
Why wrap Claude Code with ait¶
Claude Code is fast and capable, but a single prompt can edit many files
across your repository. ait keeps that work contained:
- The agent edits an isolated worktree instead of your root checkout.
- Every Claude Code run becomes one attempt — prompt, files, status, output, and commits stay linked.
- You can inspect, recover, rebase, or apply an attempt with normal Git concepts.
- A repo-local memory layer surfaces what previous Claude runs already tried.
Setup¶
ait init # detects `claude` on PATH, auto-installs the wrapper + hook
ait adapter doctor claude-code # optional sanity check
ait init detects every supported agent CLI on $PATH and wires it up
in one shot — for Claude Code that means installing a repo-local
claude wrapper plus merging the Claude Code hook config into
.claude/settings.json. To re-run setup explicitly (e.g. after
upgrading Claude Code), use ait adapter setup claude-code.
Run Claude Code under ait¶
Use Claude Code exactly as you normally would:
Or wrap the call explicitly:
Set explicit intent and commit text via environment variables:
AIT_INTENT="Update README" \
AIT_COMMIT_MESSAGE="update README with Claude" \
claude -p --permission-mode bypassPermissions \
"Shorten the README and improve the quickstart"
Review and apply¶
Apply when the diff is good:
Discard when it is not:
Use Claude Code as an adversarial reviewer¶
light review mode is a local deterministic risk scan. It does not call
Claude Code. Use adversarial mode when you want Claude Code to review a
finished attempt:
The built-in claude-code review adapter resolves to the local claude -p
CLI. AIT sends the structured reviewer brief on stdin, runs the reviewer
outside the target attempt worktree, captures stdout/stderr, and expects a
structured JSON findings object.
AIT removes ANTHROPIC_API_KEY from this child process environment. This keeps
the reviewer path aligned with local Claude Code authentication and prevents a
silent fallback to provider API credits. If the local claude binary is not
available or not logged in, the review fails closed instead of switching to an
API-key path.
Check local auth status:
Expected local CLI mode reports will_use_api_key: false and
will_fallback_to_credits: false.