Skip to main content
This guide explains how AI coding agents use Beads to manage tasks, track dependencies, and handle long-horizon work without losing context.

Why agents need Beads

AI coding agents face unique challenges:
  • Context loss: Session boundaries and token limits cause agents to forget previous work
  • No structured planning: Markdown TODO lists are unstructured and hard to query
  • No dependency tracking: Can’t determine what’s ready to work on
  • Merge conflicts: Multiple agents or sessions create conflicting task lists
Beads solves these problems with:
  • Persistent memory: Dolt-backed database survives sessions and account rotations
  • Dependency tracking: Automatically detects ready work with bd ready
  • Zero conflicts: Hash-based IDs prevent merge collisions
  • Structured queries: JSON output for programmatic use

Basic agent workflow

A typical agent session follows this pattern:
1

Check for ready work

Start by finding unblocked tasks:
This returns issues with no open blockers, sorted by priority.
2

Claim the task atomically

Use --claim to atomically set assignee and status:
This prevents multiple agents from working on the same task.
The --claim flag sets assignee=<your-username> and status=in_progress in a single atomic operation.
3

Work on the task

Implement, test, and document the feature. As you discover new work, create linked issues:
The discovered-from dependency links the new issue to the parent task.
4

Complete the task

When finished, close the issue:
Any dependencies on this task are now unblocked.

Discovered work pattern

When agents discover new work during implementation, they should link it to the parent:
This creates a discoverable audit trail showing what work was found during which task.

Session completion protocol

When ending a work session, agents should:
1

File remaining work

Create issues for anything that needs follow-up:
2

Update issue status

Close finished work, update in-progress items:
3

Push to remote

Ensure all changes are pushed:
Never end a session without pushing. Unpushed work causes conflicts for other agents.
4

Provide handoff context

Choose next work and provide context:
Return a summary and prompt for the next session:
“Continue work on bd-d4f9: Add rate limiting. Authentication is complete (bd-a3f8), need to implement rate limiting middleware and tests.”

Using bd prime for context

The bd prime command generates a context dump for agents:
This outputs:
  • Ready work (unblocked tasks)
  • Current work (in-progress issues)
  • Recent activity
  • Project statistics
  • Stored memories (from bd remember)
Agents can use this at session start to understand project state.

Non-interactive commands only

Never use bd edit - it opens an interactive editor that agents cannot use.
Always use bd update with flags:

Agent-specific flags

Always use these flags for programmatic use:
  • --json: Machine-readable output
  • --quiet: Suppress progress messages
  • --no-color: Disable color codes
  • --claim: Atomically claim tasks

Multi-agent coordination

When multiple agents work on the same project:

Use atomic claim

Always claim with --claim to prevent conflicts:

Sync frequently

Pull before checking ready work:
Push after completing work:

Use dependencies to coordinate

Block dependent work:

Error handling

Agents should handle common errors:

Issue already claimed

Merge conflicts

Database locked

Integration with Claude, Copilot, Aider

See the Integrations section for tool-specific setup:

Claude

CLI + hooks approach with automatic context injection

Copilot

MCP server for GitHub Copilot and VS Code

Aider

Human-in-the-loop workflow with /run commands

Best practices

Do

  • ✅ Always use --json for programmatic output
  • ✅ Use --claim for atomic task assignment
  • ✅ Link discovered work with discovered-from
  • ✅ Check bd ready before asking for work
  • ✅ Push frequently to avoid conflicts
  • ✅ Use bd prime for session context

Don’t

  • ❌ Don’t use bd edit (interactive)
  • ❌ Don’t parse human-readable output
  • ❌ Don’t forget to push at session end
  • ❌ Don’t create duplicate tracking (markdown TODOs)
  • ❌ Don’t skip --claim when starting work

See also