Skip to content

feat(acp): wire claim_task and list_tasks to the DB indexer #146

@paulbreuler

Description

@paulbreuler

Problem

claim_task and list_tasks in src/acp/tools.ts are stubs that return hardcoded data. They do not query the SQLite/FTS5 index, so the ACP hub cannot actually dispatch real tasks from the workspace.

Current behavior

// claim_task — stub
return {
  taskId: req.planId ? `${req.planId}#000` : 'unknown',
  title: 'Unclaimed task',
  frontmatter: {},
  primerContent: null,
  files: [],
};

// list_tasks — stub
return [];

Expected behavior

  • list_tasks({ planId?, status? }) — queries the agent index (via listAgents or equivalent DB call) and returns real tasks filtered by plan and status
  • claim_task({ planId?, agentId? }) — finds the next GAP agent in the specified plan (or highest-priority across all plans), marks it WIP via updateTaskStatus, resolves its primer via resolvePrimer, and returns the full task payload (frontmatter + primer content + files list)

Acceptance criteria

  • list_tasks returns real agents from the DB, respecting planId and status filters
  • claim_task selects the next GAP agent using the existing scoring/priority logic
  • claim_task calls updateTaskStatus to transition the agent to WIP before returning
  • claim_task resolves and injects the plan primer into the response
  • Both tools handle missing plan gracefully (return empty/error, not throw)
  • Tests cover real DB queries with a temp SQLite fixture

Files to modify

  • src/acp/tools.ts — replace stubs with real DB calls
  • src/acp/types.ts — extend ClaimTaskResponse if needed
  • tests/acp/tools.test.ts — add integration tests with temp DB

Related

  • src/cli/task-resolver.ts — existing plan/agent resolution logic to reuse
  • src/indexer.ts — DB access layer

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions