Skip to content

Add batch/bulk task operations for efficient agent workflows #10

@aadhar-agarwal

Description

@aadhar-agarwal

Problem

When AI agents work on multi-step tasks, they often need to create or update multiple related tasks at once. Currently, this requires N separate bn task create or bn task update calls, which:

  1. Increases latency - Each command opens storage, parses JSONL, updates cache
  2. Fragments audit logs - Related operations appear as separate log entries instead of a single atomic batch
  3. Loses atomicity - If agent crashes mid-batch, partial state may be left behind
  4. Verbose for agents - MCP tool calls multiply, increasing context window usage

Proposed Solution

Add batch operation commands:

bn task create-batch

# Create multiple tasks from JSON array (stdin or file)
echo '[{"title": "Task A"}, {"title": "Task B", "priority": 1}]' | bn task create-batch

# Or from file
bn task create-batch --file tasks.json

# With common defaults
bn task create-batch --priority 2 --tag sprint-1 --file tasks.json

Output (JSON):

{
  "created": ["bn-a1b2", "bn-c3d4"],
  "count": 2,
  "errors": []
}

bn task update-batch

# Update multiple tasks at once
echo '[{"id": "bn-a1b2", "status": "done"}, {"id": "bn-c3d4", "status": "in_progress"}]' | bn task update-batch

bn link add-batch

# Create multiple edges at once (common when creating a task tree)
echo '[{"source": "bn-a1b2", "target": "bn-c3d4", "type": "depends_on"}]' | bn link add-batch

Benefits

  1. Performance: Single storage open/close cycle for all operations
  2. Atomicity: Either all succeed or transaction can be rolled back
  3. Audit clarity: Single log entry shows "batch created 5 tasks"
  4. Agent efficiency: One MCP tool call instead of N
  5. Enables workflows: "Create PRD → spawn 10 subtasks → link all" becomes practical

Acceptance Criteria

  • bn task create-batch accepts JSON array from stdin or --file
  • bn task update-batch accepts JSON array with id + fields to update
  • bn link add-batch accepts JSON array of edge definitions
  • Batch operations produce single audit log entry
  • On error, partial results are returned with error details
  • MCP manifest includes batch tool definitions
  • Human-readable output shows summary (e.g., "Created 5 tasks")

Related

  • This would complement Tools to help organize tasks #2 (tools to organize tasks)
  • Enables workflows like "import folder structure as task tree" from prds/PRD_FOLDER_IMPORT.md

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