Using bay
Agents and hooks
How a coding agent learns bay, and what the hooks of each agent product add.
bay is in development. These pages describe bay as it will ship.
The bay skill
bay install copies the bay skill to ~/.claude/skills/bay/. Claude Code loads that skill while the agent works in your repository. The skill tells the agent which command to run. It also tells the agent to read the JSON result on stdout. The skill grants no key and cannot move trunk.
Claude Code first
Claude Code is the first agent product that bay supports in full. Set product = "claude" in the [agent] table of .bay/config.toml. Then bay install adds hook entries that call bay hook <event>. bay doctor then needs Claude Code 2.1.302 or newer on that machine.
[agent]
product = "claude"What the hooks do
- At session start, the hook prints the state of the active change.
- Before a write, the hook refuses a write that bay already knows is stale.
- Before a shell command, the hook blocks a fixed list of dangerous Git commands.
- After each step, the hook records the files that the step read and wrote.
- When an input of your change moves, the hook gives a one-line notice.
- When a change needs repair, the hook can wake an idle agent.
Blocked shell commands
The hook blocks these commands before the shell runs them. A normal push of a refs/bay/* ref stays allowed.
git reset --hard
git clean -f
git clean -fd
git branch -D
git checkout .
git restore .
git push --force, git push --force-with-lease
git push of refs/heads/<trunk>Hooks are an extra entry point
bay's promises do not depend on hooks. bay's own commands run every check that an operation needs. With hooks off, a stale write still cannot land. A session with hooks off shows as untracked in bay status --fleet.
Tiers
Each agent product gets one adapter behind bay hook <event>. The tier says how much hook support that product can give. In every tier, a stale write cannot land. bay doctor names the product, its tier, and the interfaces it lacks.
| Tier | What bay has there | Products |
|---|---|---|
| A. Full | An early refusal that fails closed, a step record, worktree ownership, and wake | Claude Code (2.1.302 or newer) |
| B. Refusal that fails closed | An early refusal that cannot fail open; no step record, worktree ownership or wake | Cursor (failClosed) |
| C. Refusal that fails open | An early refusal while the hook runs; a crashed or hung hook lets the write through; no wake | Codex, Grok Build, Antigravity, Gemini CLI |