Adds the data layer for per-item agent prompts. Markdown frontmatter gets an `agent_prompt:` block scalar that survives the importer round-trip (newlines preserved), and `resolveWorkflowPrompt()` walks task → epic → plan → built-in default returning both the resolved string and the source level. Walk is slug-based, not parent_id-based, because the importer leaves parent_id briefly null mid-transaction. tRPC `backlog.getWorkflowPrompt` returns ownOverride + effectivePrompt so future UI can render the override box + preview without two queries. `backlog.updateWorkflowPrompt` is owner/admin-gated (prompts change downstream Cursor/Claude behavior) and audit-logged on every write. UI deferred — apps/web doesn't have a backlog-item detail panel yet; the existing object-detail panel is for the objects table. Follow-up filed at Task-workflow-prompt-task-detail-ui.md. Co-authored-by: Cursor <cursoragent@cursor.com>
2.3 KiB
2.3 KiB
| kind | slug | title | plan_slug | epic_slug | status | priority | tenant_id | owner | cursor_todo_id | updated_at |
|---|---|---|---|---|---|---|---|---|---|---|
| task | workflow-prompt-task-detail-ui | Backlog-item detail panel — render and edit workflow_prompt | agent-coordination | task-as-runnable-unit | draft | P2 | global | unassigned | null | 2026-06-02 |
Task summary
The data layer for per-item workflow prompts shipped in Task-add-workflow-prompt-to-backlog-items. This task adds the UI surface that uses it.
Deferred from the parent task because apps/web does not yet have a backlog-item detail panel — apps/web/components/panels/object-detail.tsx is for the objects table, not markdown_backlog_items. Adding a new panel surface (state, edit affordance, draft handling) is a substantive UI task on its own.
Description
Add a "Workflow prompt" section to wherever a single backlog item is rendered for read/edit. Likely surfaces:
- A dedicated route like
/[workspaceSlug]/plans/[planSlug]/[epicSlug]/[taskSlug]if a Plans browser ever exists. - A drawer or sheet opened from the Plans tree (if/when that ships).
- The agent runs view (
/settings/runs) — click a run to expand task context including the effective prompt.
For v1 of THIS task, pick the smallest surface that lets an operator actually use the data:
- Effective prompt — read-only display from
api.backlog.getWorkflowPrompt({ backlogItemId }). Show the source level as a small badge ("From this task" / "Inherited from epic: X" / "Inherited from plan: Y" / "Built-in default"). - Override — a textarea bound to
ownOverride. Empty = inherit. Save callsapi.backlog.updateWorkflowPrompt.
Subtasks
- Decide on the rendering surface (see options above).
- Build the section component with effective-prompt preview + override textarea.
- Owner/admin gate matches the procedure (the procedure refuses non-managers, but the UI should hide the save button rather than let the click fail).
- Show "clear override" affordance when an override is set.
Acceptance criteria
- Saving an override flips the source badge to "From this task."
- Clearing an override re-shows the inherited source.
- Non-managers see the prompt but cannot edit it.
Links
- Parent:
./Task-add-workflow-prompt-to-backlog-items.md - Epic:
./Epic-task-as-runnable-unit.md