Files
Codewalkers/.planning/phases/05-task-dispatch/05-05-PLAN.md
Lukas May 7b155ecc28 docs(05): create phase 5 plan - task dispatch
Phase 05: Task Dispatch
- 5 plans in 3 waves
- 3 parallel (Wave 1), 1 sequential (Wave 2), 1 sequential (Wave 3)
- Ready for execution

Requirements covered:
- AGENT-06: Message queue for agent questions
- TASK-01: Task status visibility
- TASK-04: Dependency-ordered dispatch
- TASK-05: Work queue for agents
2026-01-30 20:22:17 +01:00

5.0 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous
phase plan type wave depends_on files_modified autonomous
05-task-dispatch 05 execute 3
05-02
05-04
src/trpc/router.ts
src/trpc/context.ts
src/cli/index.ts
true
Add message and dispatch tRPC procedures and CLI commands.

Purpose: Complete AGENT-06 (message visibility) and TASK-04/TASK-05 (dispatch control) with user-facing interfaces. Users can view pending agent questions and control task dispatch. Output: tRPC message and dispatch procedures, CLI commands for messages and dispatch.

<execution_context> @/.claude/get-shit-done/workflows/execute-plan.md @/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md

@.planning/phases/05-task-dispatch/05-01-SUMMARY.md @.planning/phases/05-task-dispatch/05-02-SUMMARY.md @.planning/phases/05-task-dispatch/05-04-SUMMARY.md

@src/trpc/router.ts @src/trpc/context.ts @src/cli/index.ts @src/db/repositories/message-repository.ts @src/dispatch/types.ts

Task 1: Add message and dispatch tRPC procedures src/trpc/router.ts, src/trpc/context.ts 1. Add to TRPCContext: - messageRepository?: MessageRepository - dispatchManager?: DispatchManager - Add requireMessageRepository and requireDispatchManager helpers
  1. Add message procedures to appRouter:

    listMessages: publicProcedure .input(z.object({ agentId: z.string().optional(), status: z.enum(['pending', 'read', 'responded']).optional() })) .query(...)

    • If agentId, filter by agent
    • If status, filter by status
    • Return array of Message objects

    getMessage: publicProcedure .input(z.object({ id: z.string() })) .query(...)

    • Return single message or throw NOT_FOUND

    respondToMessage: publicProcedure .input(z.object({ id: z.string(), response: z.string() })) .mutation(...)

    • Update message with response and status='responded'
    • Return updated message
  2. Add dispatch procedures:

    queueTask: publicProcedure .input(z.object({ taskId: z.string() })) .mutation(...)

    • Call dispatchManager.queue(taskId)
    • Return { success: true }

    dispatchNext: publicProcedure .mutation(...)

    • Call dispatchManager.dispatchNext()
    • Return DispatchResult

    getQueueState: publicProcedure .query(...)

    • Call dispatchManager.getQueueState()
    • Return queue state object

    completeTask: publicProcedure .input(z.object({ taskId: z.string() })) .mutation(...)

    • Call dispatchManager.completeTask(taskId)
    • Return { success: true } npm run build passes Message and dispatch tRPC procedures added
Task 2: Add message and dispatch CLI commands src/cli/index.ts 1. Add message command group:

const messageCommand = program .command('message') .description('View agent messages and questions');

cw message list [--agent ] [--status ]

  • Call listMessages tRPC
  • Display as table: id (short), agent, type, content (truncated), status, createdAt
  • Show "(pending)" count prominently

cw message read

  • Call getMessage tRPC
  • Display full message content
  • If pending, show prompt to respond

cw message respond

  • Call respondToMessage tRPC
  • Confirm response recorded
  • Suggest resuming agent if appropriate
  1. Add dispatch command group:

    const dispatchCommand = program .command('dispatch') .description('Control task dispatch queue');

    cw dispatch queue

    • Call queueTask tRPC
    • Confirm task queued

    cw dispatch next

    • Call dispatchNext tRPC
    • Show result: which task dispatched to which agent, or why it failed

    cw dispatch status

    • Call getQueueState tRPC
    • Show: queued count, ready count, blocked count
    • List ready tasks with their priority

    cw dispatch complete

    • Call completeTask tRPC
    • Confirm task completed

Follow existing CLI patterns for error handling and output formatting. cw message --help and cw dispatch --help show commands Message and dispatch CLI commands functional

Before declaring plan complete: - [ ] npm run build succeeds - [ ] npm test passes - [ ] cw message --help shows list, read, respond - [ ] cw dispatch --help shows queue, next, status, complete - [ ] All tRPC procedures added

<success_criteria>

  • Message tRPC procedures: listMessages, getMessage, respondToMessage
  • Dispatch tRPC procedures: queueTask, dispatchNext, getQueueState, completeTask
  • CLI message commands: list, read, respond
  • CLI dispatch commands: queue, next, status, complete
  • All requirements (AGENT-06, TASK-01, TASK-04, TASK-05) have user-facing interfaces </success_criteria>
After completion, create `.planning/phases/05-task-dispatch/05-05-SUMMARY.md`