claude-git-workflow (CGW) provides drop-in integrations for two major AI agent environments: Claude Code and Google Antigravity Agents.
These integrations provide two defensive layers:
- Skills & Slash Command: Teaches the agent to use
scripts/git/*.shwrapper scripts instead of rawgitcommands, ensuring lint checks, local-file protection, backup tags, and CI verification are never bypassed. Includes the interactive/auto-git-workflow-cmdmenu. - PreToolUse Guardrails: Hard enforcement at the harness layer. Intercepts tool calls before execution and blocks dangerous raw git commands (e.g., bare
git commit,--no-verify, force-push,git reset --hard,git branch -D,git checkout ., rawgit worktree remove), printing an explanatory message that directs the agent to the corresponding CGW wrapper script.
| Feature | Claude Code | Google Antigravity Agents |
|---|---|---|
| Skill Location (Local) | .claude/skills/auto-git-workflow/ |
.agents/skills/auto-git-workflow/ |
| Skill Location (Global) | ~/.claude/skills/auto-git-workflow/ |
~/.gemini/config/skills/auto-git-workflow/ |
| Command Location (Local) | .claude/commands/auto-git-workflow-cmd.md |
.agents/skills/auto-git-workflow-cmd/SKILL.md |
| Command Location (Global) | ~/.claude/commands/auto-git-workflow-cmd.md |
~/.gemini/config/skills/auto-git-workflow-cmd/SKILL.md |
| Guardrail Script | .claude/hooks/cc-block-dangerous-git.sh (+ _guardrail_core.sh) |
.agents/hooks/agy-block-dangerous-git.cmd (Win) / .sh (Unix) (+ _guardrail_core.sh) |
| Guardrail Config | .claude/settings.json |
.agents/hooks.json (or ~/.gemini/config/hooks.json) |
| Target Tool Intercepted | Bash tool invocations | run_command tool calls |
The interactive Windows installer prompts you to configure Claude Code, Antigravity Agents, or both:
claude-git-workflow\cgw-install.cmdIt validates prerequisites, copies scripts and staging files, installs hooks, registers skills, and configures the guardrails in .claude/settings.json and .agents/hooks.json.
configure.sh automatically detects present directories (.claude/ or .agents/) and offers to install the corresponding harness files:
# Interactive setup (prompts for each harness)
./scripts/git/configure.sh
# Or install with explicit flags:
./scripts/git/configure.sh --claude --antigravity| Flag | Purpose |
|---|---|
--claude |
Explicitly enable Claude Code integration |
--antigravity |
Explicitly enable Antigravity Agents integration |
--skip-claude |
Skip Claude Code skill, slash command, and guardrail |
--skip-antigravity |
Skip Antigravity skill, command, and guardrail |
--skip-cc-guardrail |
Install Claude Code skill/command but skip its PreToolUse guardrail |
--skip-agy-skill |
Skip Antigravity skill/command installation |
--skip-agy-guardrail |
Skip Antigravity PreToolUse guardrail |
--global |
Install skills and guardrails globally (~/.claude/ and ~/.gemini/config/) |
- Local (default): Installed directly into the project's
.claude/and.agents/directories. Active only within that repository. Neither directory is added to.gitignoreautomatically (onlylogs/,.cgw.confand.cgw.conf.bakare), so add them yourself if you don't want to commit them. - Global (
--global): Installed into~/.claude/and~/.gemini/config/. Makes CGW skills and guardrails available across every project on your machine:
# Global install
./scripts/git/configure.sh --globalBoth harnesses support the /auto-git-workflow-cmd slash command. It opens a state-aware interactive menu:
- ⭐ Full promotion: commit → push → merge/PR → push, the full pipeline in one run.
- Commit & Stash: commit, amend the message, stash and restore work in progress.
- Push, Pull & Sync: push, publish a branch, sync branches with the remote.
- Branch, Merge & PR: merge, rebase, create or check out a PR, cherry-pick.
- Undo & Recover: undo a commit, unstage/discard, roll back a merge, rescue commits from the reflog.
- Release & Maintain: tag a release, generate a changelog, check repo health, clean artifacts.
Before displaying the menu, /auto-git-workflow-cmd inspects repository status (uncommitted work, ahead/behind counts, in-progress rebase/merge, stash stack) and pre-selects the likely next action.
Every push performed through /auto-git-workflow-cmd (or via push_validated.sh in agent workflows) is followed by the CI Verification Gate:
- The agent runs
./scripts/git/verify_ci.sh --branch <pushed branch>(or--pr <N> --sha <head>aftercreate_pr.sh), which waits for the GitHub Actions runs the push triggered to reach a terminal state. - Exit
0(CI: green) or3(not applicable) completes the step. - Exit
1(CI: red <workflow> <url>): the agent inspects the failure logs, attempts a fix, re-commits, re-pushes, and re-runs the gate (up toCGW_CI_MAX_FIX_ROUNDS=3). - Exit
2(CI: unverified) is reported as unverified, never as green. - See CI Setup for details.
Guardrails run before the agent executes a shell command:
- Claude Code: Registered as a
PreToolUsehook in.claude/settings.json. Intercepts Bash tool calls matching patterns likegit commit,--no-verify,git push --force(--force-with-leaseis allowed),git reset --hard,git branch -D, andgit checkout .. Other raw commands such as plaingit pushorgit mergeare not intercepted; the skill rules direct the agent to the wrapper scripts, and the git hooks remain the enforcement layer. - Antigravity Agents: Registered in
.agents/hooks.json(or~/.gemini/config/hooks.json) under thecgw-git-guardrail→PreToolUsekey, matching therun_commandtool. Usesagy-block-dangerous-git.cmdon Windows andagy-block-dangerous-git.shon Unix.
git-guardrail mod supersedes the Claude Code shell hook. On a machine where the in-process git-guardrail mod is deployed (~/.claude/mods/git-guardrail) and wired up (CLAUDE_CODE_PLUGIN_DIRS in the environment or in ~/.claude/settings.json names it), configure.sh — and therefore cgw-install.cmd and cgw-batch-install.cmd — no longer installs cc-block-dangerous-git.sh. It also retires an existing install: the PreToolUse entry is removed (other hooks such as ExitPlanMode are kept), and .claude/hooks/cc-block-dangerous-git.sh and _guardrail_core.sh are deleted when they match the stock copies; customised copies are kept with a warning. Machines without the mod keep the shell hook, so re-running the batch updater on another machine needs no extra steps. The Antigravity guardrail is separate (own adapter and core copy under .agents/hooks/) and is never touched.
When an agent attempts a blocked command, the guardrail rejects it and surfaces guidance. The Claude Code hook exits with code 2 and prints the message to stderr; the Antigravity hook returns {"decision": "deny", "reason": ...} and exits 0:
BLOCKED: Command matched dangerous pattern "git commit".
Use ./scripts/git/commit_enhanced.sh "<type>: <msg>" instead — it runs lint, protects local-only files, and enforces conventional commit format.
The user has prevented you from doing this.
- Type
/skillsand confirmauto-git-workflowappears in the list. - If missing, verify
.claude/skills/auto-git-workflow/SKILL.mdexists and restart Claude Code.
- In the agent CLI, check
.agents/skills/to confirmauto-git-workflowandauto-git-workflow-cmdare present. - Check
.agents/hooks.jsonto verify theagy-block-dangerous-githook entry exists.