title: Task as runnable unit — workflow prompts and a runs table
plan_slug: agent-coordination
status: ready
priority: P2
tenant_id: global
cursor_epic_id: null
updated_at: "2026-06-01"
---
# Epic objective
Every backlog item can carry a workflow prompt; every agent session against a task gets recorded in a `runs` table. These two changes are the foundation that `claim_task` / `complete_task` build on.
## In scope / out of scope
**In scope**
- Schema additions for workflow prompts.
- New `runs` table + tRPC router.
- Minimal UI for editing the prompt and viewing recent runs.
**Out of scope**
- The actual MCP tools (next epic).
- Orchestrator process (deferred epic).
## Related tasks
| Task | Link |
|------|------|
| Add workflow prompt to backlog items | `./Task-add-workflow-prompt-to-backlog-items.md` |
| Runs table and tRPC router | `./Task-runs-table-and-trpc-router.md` |
## Dependencies
- Depends on: `Plan-daily-driver-finish` (don't extend stubs).
- [x] A task row can store an optional workflow prompt that overrides the epic/plan default. (Schema column `workflow_prompt`, parser plumbing, slug-based inheritance walk all shipped.)
- [x] An `agent_runs` row captures `started_at`, `finished_at`, `actor_user_id`, `outcome`, `tokens_input`, `tokens_output`, `tokens_total`, `notes`, `error`, and `metadata`. (One column more than the spec — added `tokens_total` because Symphony's "absolute totals win" rule needs explicit storage.)
- [x] Minimal UI lets an operator read recent runs at `/[workspaceSlug]/settings/runs`. Prompt-editing UI is deferred to `Task-workflow-prompt-task-detail-ui.md` because `apps/web` doesn't yet have a backlog-item detail panel.