docs/SETUP.md
For: Setting up beads integration with AI coding tools Version: 0.30.0+
The bd setup command uses a recipe-based architecture to configure beads integration with AI coding tools. Recipes define where workflow instructions are written—built-in recipes handle popular tools, and you can add custom recipes for any tool.
bd prime as SSOTbd prime is the single source of truth for operational workflow commands. The beads section in each tool's instruction file provides a pointer to bd prime for hook-enabled agents (Claude, Gemini) or the full command reference for hookless agents (Factory, Codex, Mux).
Each integration uses one of two profiles that control how much content is written to tool instruction files (AGENTS.md, CLAUDE.md, or GEMINI.md):
| Profile | Used By | Content |
|---|---|---|
full | Factory, Codex, Mux, OpenCode | Complete command reference, issue types, priorities, workflow |
minimal | Claude Code, Gemini CLI | Pointer to bd prime, quick reference only (~60% smaller) |
Hook-enabled agents (Claude, Gemini) use the minimal profile because bd prime injects full context at session start. Hookless agents need the full profile because their instruction file is their only source of instructions.
Profile precedence: If a file already has a full profile section and a minimal profile tool installs to the same file (e.g., via symlinks), the full profile is preserved to avoid information loss.
| Recipe | Path | Integration Type |
|---|---|---|
cursor | .cursor/rules/beads.mdc | Rules file |
windsurf | .windsurf/rules/beads.md | Rules file |
cody | .cody/rules/beads.md | Rules file |
kilocode | .kilocode/rules/beads.md | Rules file |
claude | ~/.claude/settings.json + CLAUDE.md | SessionStart/PreCompact hooks + minimal section |
gemini | ~/.gemini/settings.json + GEMINI.md | SessionStart/PreCompress hooks + minimal section |
factory | AGENTS.md | Marked section |
codex | AGENTS.md | Marked section |
mux | AGENTS.md | Marked section |
aider | .aider.conf.yml + .aider/ | Multi-file config |
# List all available recipes
bd setup --list
# Install integration for your tool
bd setup cursor # Cursor IDE
bd setup windsurf # Windsurf
bd setup kilocode # Kilo Code
bd setup claude # Claude Code
bd setup gemini # Gemini CLI
bd setup factory # Factory.ai Droid
bd setup codex # Codex CLI
bd setup mux # Mux
bd setup aider # Aider
# Verify installation
bd setup cursor --check
bd setup claude --check
# Print template to stdout (for inspection)
bd setup --print
# Write template to custom path
bd setup -o .my-editor/rules.md
# Add a custom recipe
bd setup --add myeditor .myeditor/rules.md
bd setup myeditor # Now you can use it
Factory.ai Droid integration uses the AGENTS.md standard, which is compatible with multiple AI coding assistants.
# Create or update AGENTS.md with beads integration
bd setup factory
Creates or updates AGENTS.md in your project root with:
The beads section is wrapped in HTML comments (<!-- BEGIN/END BEADS INTEGRATION -->) with metadata for safe updates. The begin marker includes profile and hash metadata (e.g., <!-- BEGIN BEADS INTEGRATION profile:full hash:d4f96305 -->) for freshness detection. Legacy markers without metadata are auto-upgraded on the next install or update.
AGENTS.md is an industry-standard format for AI coding agent instructions, supported by:
Using AGENTS.md means one configuration file works across your entire AI tool ecosystem.
| Flag | Description |
|---|---|
--check | Check if beads section exists and is current (reports missing, stale, or current) |
--remove | Remove beads section from AGENTS.md |
# Check if beads section is in AGENTS.md
bd setup factory --check
# Output: ✓ Factory.ai integration installed: AGENTS.md
# Beads section found in AGENTS.md
# Remove beads section
bd setup factory --remove
Factory Droid and other AGENTS.md-compatible tools automatically read AGENTS.md from:
./AGENTS.md)~/.factory/AGENTS.md)The beads section teaches AI agents:
bd ready for finding workbd create for tracking new issuesbd dolt push at session endIf you already have an AGENTS.md file with other project instructions:
bd setup factory will append the beads section<!-- BEGIN/END BEADS INTEGRATION -->) ensure safe updatesUse Factory integration when:
Use other integrations when:
bd setup claude (hooks are more dynamic)You can use multiple integrations simultaneously - they complement each other!
Codex reads AGENTS.md instructions at the start of each run/session. Adding the beads section is enough to get Codex and beads working together.
bd setup codex
Creates or updates AGENTS.md with the beads integration section (same markers as Factory.ai).
BEADS_DIR setups, use bd where to confirm the resolved workspace; the integration does not require a local ./.beads.Mux reads layered instruction files, including workspace AGENTS.md. Adding the beads section is enough to get Mux and beads working together.
bd setup mux # Root AGENTS.md
bd setup mux --project # Root AGENTS.md + .mux/AGENTS.md
bd setup mux --global # Root AGENTS.md + ~/.mux/AGENTS.md
Creates or updates AGENTS.md with the beads integration section (same markers as Factory.ai and Codex).
| Flag | Description |
|---|---|
--check | Check root integration (and with layer flags, also check those layers) |
--remove | Remove root integration (and with layer flags, also remove those layers) |
--project | Install/check/remove workspace-layer instructions in .mux/AGENTS.md |
--global | Install/check/remove global-layer instructions in ~/.mux/AGENTS.md |
Claude Code integration uses hooks to automatically inject beads workflow context at session start and before context compaction.
# Global installation (recommended)
bd setup claude
# Project-only installation
bd setup claude --project
# With stealth mode (flush only, no git operations)
bd setup claude --stealth
Global installation (~/.claude/settings.json):
SessionStart hook: Runs bd prime when a new session startsPreCompact hook: Runs bd prime before context compactionProject installation (.claude/settings.local.json):
Instruction file (CLAUDE.md in project root):
bd prime--check freshness detection| Flag | Description |
|---|---|
--check | Check both hooks and the managed CLAUDE.md beads section |
--remove | Remove beads hooks and managed CLAUDE.md beads section |
--project | Install for this project only (not globally) |
--stealth | Use bd prime --stealth (flush only, no git operations) |
# Check hooks + CLAUDE.md beads section
bd setup claude --check
# Output: ✓ Global hooks installed: /Users/you/.claude/settings.json
# ✓ Claude Code integration installed: /path/to/CLAUDE.md (current)
# Remove hooks
bd setup claude --remove
# Install project-specific hooks with stealth mode
bd setup claude --project --stealth
The hooks call bd prime which:
bd where is the right diagnostic check when local ./.beads is absentThis is more context-efficient than MCP tools (~1-2k tokens vs 10-50k for MCP schemas).
Gemini CLI integration uses hooks to automatically inject beads workflow context at session start and before context compression.
# Global installation (recommended)
bd setup gemini
# Project-only installation
bd setup gemini --project
# With stealth mode (flush only, no git operations)
bd setup gemini --stealth
Global installation (~/.gemini/settings.json):
SessionStart hook: Runs bd prime when a new session startsPreCompress hook: Runs bd prime before context compressionProject installation (.gemini/settings.json):
Instruction file (GEMINI.md in project root):
bd prime--check freshness detection| Flag | Description |
|---|---|
--check | Check both hooks and the managed GEMINI.md beads section |
--remove | Remove beads hooks and managed GEMINI.md beads section |
--project | Install for this project only (not globally) |
--stealth | Use bd prime --stealth (flush only, no git operations) |
# Check hooks + GEMINI.md beads section
bd setup gemini --check
# Output: ✓ Global hooks installed: /Users/you/.gemini/settings.json
# ✓ Gemini CLI integration installed: /path/to/GEMINI.md (current)
# Remove hooks
bd setup gemini --remove
# Install project-specific hooks with stealth mode
bd setup gemini --project --stealth
The hooks call bd prime which:
This works identically to Claude Code integration, using Gemini CLI's hook system (SessionStart and PreCompress events).
Cursor integration creates a rules file that provides beads workflow context to the AI.
bd setup cursor
Creates .cursor/rules/beads.mdc with:
| Flag | Description |
|---|---|
--check | Check if integration is installed |
--remove | Remove beads rules file |
# Check if rules are installed
bd setup cursor --check
# Output: ✓ Cursor integration installed: .cursor/rules/beads.mdc
# Remove rules
bd setup cursor --remove
Cursor reads .cursor/rules/*.mdc files and includes them in the AI's context. The beads rules file teaches the AI:
bd ready for finding workbd create for tracking new issuesbd dolt push at session endAider integration creates configuration files that teach the AI about beads, while respecting Aider's human-in-the-loop design.
bd setup aider
| File | Purpose |
|---|---|
.aider.conf.yml | Points Aider to read the instructions file |
.aider/BEADS.md | Workflow instructions for the AI |
.aider/README.md | Quick reference for humans |
| Flag | Description |
|---|---|
--check | Check if integration is installed |
--remove | Remove beads configuration |
# Check if config is installed
bd setup aider --check
# Output: ✓ Aider integration installed: .aider.conf.yml
# Remove configuration
bd setup aider --remove
Unlike Claude Code, Aider requires explicit command execution. The AI will suggest bd commands, which the user runs via /run:
You: What issues are ready to work on?
Aider: Let me check. Run:
/run bd ready
You: [runs the command]
Aider: Great! To claim bd-42, run:
/run bd update bd-42 --claim
This respects Aider's philosophy of keeping humans in control while still leveraging beads for issue tracking.
| Feature | Factory.ai | Codex | Mux | Claude Code | Gemini CLI | Cursor | Aider |
|---|---|---|---|---|---|---|---|
| Command execution | Automatic | Automatic | Automatic | Automatic | Automatic | Automatic | Manual (/run) |
| Context injection | AGENTS.md | AGENTS.md | AGENTS.md | Hooks + CLAUDE.md | Hooks + GEMINI.md | Rules file | Config file |
| Global install | No (per-project) | No (per-project) | No (per-project) | Yes | Yes | No (per-project) | No (per-project) |
| Stealth mode | N/A | N/A | N/A | Yes | Yes | N/A | N/A |
| Standard format | Yes (AGENTS.md) | Yes (AGENTS.md) | Yes (AGENTS.md) | No (proprietary) | No (proprietary) | No (proprietary) | No (proprietary) |
| Multi-tool compatible | Yes | Yes | Yes | No | No | No | No |
Start with Factory integration - Creates AGENTS.md which works across multiple AI tools:
bd setup factory
Add tool-specific integrations as needed - Claude hooks, Cursor rules, or Aider config for tool-specific features
Install globally for Claude Code or Gemini CLI - You'll get beads context in every project automatically
Use stealth mode in CI/CD - bd setup claude --stealth or bd setup gemini --stealth avoids git operations that might fail in automated environments
Commit instruction files to git - This ensures all team members and AI tools get the same instructions (AGENTS.md, CLAUDE.md, GEMINI.md, as applicable)
Run bd doctor after setup - Verifies the integration is working:
bd doctor | grep -iE "claude|gemini"
# Claude Integration: Hooks installed (CLI mode)
# Gemini CLI Integration: Hooks installed
bd setup <tool> --checkbd doctor output for integration statusFor Claude Code, ensure bd prime works standalone:
bd prime
If this fails, fix the underlying beads issue first.
# Remove global hooks
bd setup claude --remove
# Install project hooks
bd setup claude --project
You can add custom recipes for editors/tools not included in the built-in list.
# Add a recipe that writes to a specific path
bd setup --add myeditor .myeditor/rules.md
# Install it
bd setup myeditor
# Check it
bd setup myeditor --check
# Remove it
bd setup myeditor --remove
Custom recipes are stored in .beads/recipes.toml:
[recipes.myeditor]
name = "myeditor"
path = ".myeditor/rules.md"
type = "file"
For one-off installs without saving a recipe:
# Write template to any path
bd setup -o .my-custom-location/beads.md
# Inspect the template first
bd setup --print
| Type | Description | Example |
|---|---|---|
file | Write template to a single file | cursor, windsurf, cody, kilocode |
hooks | Modify JSON settings to add hooks | claude, gemini |
section | Inject marked section into existing file | factory |
multifile | Write multiple files | aider |
Custom recipes added via --add are always type file.