Skip to content

[Feature]: Integrate Beads for dependency-aware task execution (v3.0)Β #47

@pedroalmeida415

Description

@pedroalmeida415

🎯 Summary

Integrate Beads - a lightweight git-based issue tracker designed for AI agents - to replace Smart Ralph's linear task execution with dependency-aware parallel execution.

⚠️ Breaking Change: This would be a major architectural change targeting v3.0


πŸš€ Why Beads?

Current Smart Ralph With Beads
Linear task list with [P] markers True dependency DAG with blocks relationships
Custom .ralph-state.json management Git-native state via JSONL (auto-sync)
Manual parallel task detection bd list --ready finds all unblocked tasks in ~10ms
Large .progress.md context loading bd prime provides compact 1-2k token context
Custom completion verification bd doctor detects orphaned work automatically
Race conditions with parallel temp files Hash-based IDs prevent collisions

πŸ“Š Key Benefits

1. Smarter Parallel Execution

Current: Linear scan for [P] markers
         1.1 β†’ 1.2 β†’ [P]1.3 β†’ [P]1.4 β†’ 1.5

With Beads: True dependency resolution
         1.1 ──blocks──► 1.2 ──blocks──┬──► 1.3 ──┐
                                       β”‚          β”œβ”€β”€blocks──► 1.5
                                       └──► 1.4 β”€β”€β”˜

bd list --ready automatically returns [1.3, 1.4] when 1.2 completes

2. Simplified State Management

# No more custom state file parsing
bd list --ready --json    # What can run now?
bd show $ID --json        # Task details
bd close $ID              # Mark complete
bd sync                   # Push state to git

3. Better Context Efficiency

  • bd prime: ~1-2k tokens of structured workflow context
  • vs. reading entire .progress.md which can grow unbounded

4. Built-in Audit Trail

git commit -m "feat(auth): implement OAuth2 (bd-a3f8e9)"
#                                            ↑ issue ID in commit

5. Cross-Spec Tracking

bd create --title "user-auth" --related bd-xyz789
# Native relationship tracking replaces relatedSpecs array

πŸ”§ Proposed Changes

Phase 1: Non-Breaking Additions

  • Add bd sync to ALL_TASKS_COMPLETE protocol
  • Include Beads issue IDs in commit messages
  • Use bd doctor for completion verification

Phase 2: Task Management (Breaking)

  • task-planner creates Beads issues with --blocks relationships
  • Coordinator uses bd list --ready instead of taskIndex
  • Replace .ralph-state.json with Beads as source of truth

Phase 3: Context Optimization

  • Inject bd prime output into spec-executor context
  • Store learnings in Beads issue notes vs .progress.md

πŸ“‹ Migration Path

  1. v2.x: Add optional Beads support (feature flag)
  2. v3.0: Beads becomes default, legacy mode deprecated
  3. v3.1+: Remove legacy .ralph-state.json support

πŸ”— References


πŸ’¬ Discussion

Looking for feedback on:

  1. Is the migration path reasonable?
  2. Should we support both modes long-term or fully migrate?
  3. Any concerns about adding Beads as a dependency?

cc @tzachbon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions