Repository navigation
PRD: Manager Console orchestration for delegated Project Threads #15
Description
Problem Statement
The current h-code workflow still depends too heavily on the human to coordinate delegable work. A human can identify work in an epic, Jira set, or todo list that should be parallelised across coding agents, but today they still need to manually shape prompts, choose the right Project, create Threads, check progress across Threads, answer follow-up questions, and push status back to systems of record.
This creates three problems:
- Work that could be delegated stays idle when the human is preoccupied with other work.
- Worker Threads receive uneven prompt quality because the human acts as the prompt shaper under time pressure.
- Ongoing supervision still requires too much manual polling, context switching, and bookkeeping.
The product opportunity is to add a manager-style coordination layer that can accept seeded work, classify it, refine it when needed, spawn Worker Threads in the correct Projects, consume worker blockers/questions, respond when possible, escalate to the human when necessary, and write progress back to Jira or todo systems without hiding the underlying Threads.
Solution
Introduce a single Manager Console in a dedicated Manager Workspace that acts as the control plane for delegated work. The human seeds the manager with an epic, Jira set, or todo list. The manager performs Delegation Intake on each work item, classifies its Work Readiness, and then routes the item through one of three paths:
ready-for-worker: create a project-boundWorker Threadneeds-refinement: create a project-boundRefiner Threadthat runs a human-in-the-loop refinement workflow, typically viagrill-with-docshuman-ownedorblocked-on-context: keep the item in theManager Consolefor the human
A Refiner Thread produces a Refinement Handoff containing the refined problem statement, behavioral or functional acceptance criteria, and target Project. The manager appends that refined context back to the originating Jira/todo item, re-evaluates readiness, and automatically spawns a Worker Thread when the item is clearly ready.
A Worker Thread is a normal first-class Thread inside its owning Project, typically using a worktree. It is visibly marked with a Delegation Badge and can emit structured Worker Escalations such as questions, blockers, review requests, or completion notices. Each Worker Escalation creates a linked Manager Queue Item in the Manager Console. The Manager Queue Discipline for v1 is FIFO, while queue items still retain categories for handling semantics.
Manager-to-worker communication is visible. When the manager responds to a worker, the Worker Thread shows a distinct visible manager-instruction row styled similarly to a human message but visually differentiated. Worker questions and blockers remain visible in the Worker Thread and also surface into the Manager Console as linked queue items.
The v1 manager runtime should favor token efficiency and reliability over a continuously running hidden session. The Manager Console remains a single logical conversation for the user, but underlying manager executions should be short-lived and resume on demand using durable files in the Manager Workspace plus the current queue state. Worker runtime continuity can remain thread-local and provider-native.
User Stories
- As a human operator, I want to seed the
Manager Consolewith an epic and its underlying Jira issues, so that delegable work can begin without me manually creating every Thread. - As a human operator, I want to seed the
Manager Consolewith a todo list, so that informal work can be managed with the same delegation flow as tracked work. - As a human operator, I want the manager to perform
Delegation Intakebefore spawning workers, so that vague work is not blindly delegated. - As a human operator, I want each seeded work item to receive a
Work Readinessclassification, so that I can see what is ready, what needs refinement, and what still belongs with me. - As a human operator, I want the manager to classify items as
ready-for-worker, so that work with sufficient clarity can begin immediately. - As a human operator, I want the manager to classify items as
needs-refinement, so that incomplete work is sharpened before delegation. - As a human operator, I want the manager to classify items as human-owned or blocked on missing context, so that unsuitable work is not delegated prematurely.
- As a human operator, I want
needs-refinementitems to spawn aRefiner Thread, so that I can refine the task in a dedicated conversation instead of overloading the manager transcript. - As a human operator, I want each
Refiner Threadto be tied to a specificProject, so thatgrill-with-docscan use the correctCONTEXT.mdand ADRs. - As a human operator, I want the
Refiner Threadto focus on the problem statement and acceptance criteria rather than implementation file paths, so that delegated work stays grounded without steering workers into the wrong directory. - As a human operator, I want at most one active
Refiner Threadper work item, so that refinement does not fork into conflicting conversations. - As a human operator, I want a completed
Refiner Threadto produce aRefinement Handoff, so that the manager can act on structured output instead of rereading the whole transcript. - As a human operator, I want the
Refinement Handoffto include the refined problem statement, so that the downstream worker receives a legible task definition. - As a human operator, I want the
Refinement Handoffto include behavioral or functional acceptance criteria, so that worker success is testable. - As a human operator, I want the
Refinement Handoffto include the targetProject, so that the manager can delegate into the correct repo. - As a human operator, I want the manager to append refined notes back to Jira or todo systems, so that systems of record reflect the clarified work without overwriting the original description.
- As a human operator, I want Jira updates to be append-only comments or notes in v1, so that the original issue body remains intact.
- As a human operator, I want the manager to automatically spawn a
Worker Threadafter successful refinement when readiness is clear, so that I do not need to manually re-trigger delegation. - As a human operator, I want each
Worker Threadto live inside its owningProject, so that branch, worktree, and repo-local context remain coherent. - As a human operator, I want a
Worker Threadto be visibly distinguished from ad hoc Threads, so that I can quickly tell which work is manager-delegated. - As a human operator, I want delegated worker Threads to retain the original Jira/todo text as provenance, so that source context is never lost.
- As a human operator, I want delegated worker Threads to receive the
Refinement Handoffas the primary brief, so that prompt quality is improved before implementation starts. - As a human operator, I want the manager to transform rough human prompts into stronger worker prompts, so that agent execution quality is less dependent on my phrasing.
- As a human operator, I want the manager to choose the right
Projectfor a worker, so that repo routing becomes part of delegation instead of a manual step. - As a human operator, I want the manager to favor worktrees for delegated execution when appropriate, so that worker activity stays isolated from other active work.
- As a human operator, I want workers to surface blockers and questions back to the manager automatically, so that I do not have to poll every worker transcript.
- As a human operator, I want worker blockers to create linked
Manager Queue Items, so that unresolved work returns to the manager control plane. - As a human operator, I want worker questions to create linked
Manager Queue Items, so that the manager can answer or escalate them. - As a human operator, I want worker completion notices to create linked
Manager Queue Items, so that the manager can update Jira and decide what happens next. - As a human operator, I want each worker escalation to remain visible in the
Worker Thread, so that execution history stays auditable in place. - As a human operator, I want the manager queue to use FIFO in v1, so that coordination stays simple while the product proves the model.
- As a human operator, I want queue items to still carry categories, so that the manager can apply different handling semantics without adding scheduling complexity.
- As a human operator, I want the manager to always write back to the
Worker Threadwhen resolving a worker-facing queue item, so that there is no hidden split between manager state and worker instructions. - As a human operator, I want manager instructions to appear in the
Worker Threadas distinct visible rows, so that I can see what the manager told the worker. - As a human operator, I want the manager-instruction row to look close to a human message but with distinct styling, so that authorship is legible without inventing a totally separate visual language.
- As a human operator, I want worker replies to continue looking like ordinary agent replies, so that only the manager-specific affordances need new UI.
- As a human operator, I want the
Manager Consoleto live in a dedicatedManager Workspace, so that it can persist context in files outside any specificProjectcheckout. - As a human operator, I want the
Manager Consoleto remain a single unified visible conversation, so that coordination work does not fragment into many manager-facing chats. - As a human operator, I want the manager runtime to be token-efficient, so that coordination overhead does not dominate the usefulness of the system.
- As a human operator, I want the manager runtime to be reliable under interruptions and restarts, so that the control plane is not flaky.
- As a human operator, I want the manager to reconstruct its working context from durable manager files and queue state, so that it does not rely entirely on ever-growing conversational history.
- As a human operator, I want worker continuity to stay thread-local and provider-native, so that implementation work can keep benefiting from project-specific session history.
- As a human operator, I want the manager to answer worker questions when it has sufficient context, so that I am only interrupted when truly necessary.
- As a human operator, I want unresolved manager questions to surface clearly to me, so that I can provide input only where it adds value.
- As a human operator, I want the manager to learn my preferences over time through durable workspace context, so that fewer future escalations need my direct involvement.
- As a human operator, I want the manager to supervise multiple
Projectsfrom one place, so that cross-repo work can still be delegated coherently. - As a human operator, I want to inspect worker conversations the manager created, so that delegated work remains transparent.
- As a human operator, I want the manager to update Jira as worker progress changes, so that external systems stay in sync without manual copying.
- As a human operator, I want the manager to leave comments instead of silently mutating tickets, so that stakeholders can see what happened.
- As a human operator, I want this flow to preserve h-code’s existing
Threadsemantics wherever possible, so that the new capability does not create a second hidden conversation model.
Implementation Decisions
- Introduce one
Manager Consoleas a first-class control-plane conversation in a dedicatedManager Workspace. The manager is a single persistent user-facing coordination surface, even if its runtime executes in short-lived bursts. - Add a
Manager Inboxsection to the sidebar that presents theManager Consoleseparately from project-owned Threads. - Treat
Worker ThreadandRefiner Threadas first-class Thread variants rather than inventing hidden internal sessions. This preserves inspectability, reuse of existing Thread infrastructure, and the current product mental model. - Keep
Worker Threadsproject-bound. AWorker Threadbelongs to exactly oneProjectand can belong to at most oneManager Console. - Keep
Refiner Threadsproject-bound.Refiner Threadsexist because refinement uses repo-local context such asCONTEXT.mdand ADRs viagrill-with-docs. - Restrict v1 to one active
Refiner Threadper seeded work item. - Add a
Delegation Intakestage to the manager flow before any worker creation. This stage classifies each seeded work item byWork Readiness. - Support at least these v1 readiness outcomes:
ready-for-worker,needs-refinement,human-owned, andblocked-on-context. - When readiness is
needs-refinement, the manager creates a project-boundRefiner Threadinstead of trying to refine the task inline in theManager Console. - A completed
Refiner Threadmust produce aRefinement Handoffwith the minimum structured fields needed for downstream delegation: refined problem statement, behavioral or functional acceptance criteria, and targetProject. - The manager should append the
Refinement Handoffback to the originating Jira/todo record as notes or comments, rather than overwriting the original description. - When readiness becomes clearly
ready-for-workerafter refinement, the manager should automatically create theWorker Threadand surface that action in theManager Console. - Worker delegation input should include both the original Jira/todo text and the
Refinement Handoff, with the handoff treated as the primary brief and the original text preserved as provenance. - Add explicit
Worker Escalationsupport inside the h-code orchestration runtime rather than heuristic transcript scanning. Escalations should be structured runtime events that the system can route reliably. - Each
Worker Escalationshould create exactly one linkedManager Queue Itemin theManager Console. - The
Manager Queue Disciplinein v1 is FIFO. Queue item category affects handling semantics and presentation, but not scheduling order. - Support v1 queue categories that cover at least questions, blockers, review requests, and work completion.
- Require manager responses to worker-facing queue items to always write back into the
Worker Thread. Manager-only resolution should be reserved for pure internal bookkeeping. - Render manager-to-worker communication as a distinct visible manager-instruction row in the
Worker Thread, styled similarly to a human message but visually differentiated. - Preserve the existing assistant rendering model for worker agent responses rather than redesigning all thread history around fully general multi-party chat authorship.
- Extend the orchestration/event model to represent manager-specific visible rows and worker-specific escalations as first-class events or activities emitted from the h-code runtime.
- Prefer a deep module for manager orchestration state and routing logic instead of scattering manager behavior across sidebar, transport, and provider glue code.
- Introduce a deep module for queue state and queue-item lifecycle so FIFO selection, linkage to worker/refiner Threads, and Jira write-back can be tested independently of the UI.
- Introduce a deep module for seeded work-item classification and readiness transitions so
Delegation Intake,Refinement Handoff, and automatic worker creation remain deterministic. - Introduce a deep module for manager workspace persistence so the manager can store durable files such as notes, preference summaries, active work-item snapshots, and queue state without tying behavior to conversational history alone.
- Favor short-lived manager executions that reconstruct context from
Manager Workspacefiles plus current queue state, rather than relying on a forever-resumed hidden CLI session. This is a deliberate token-efficiency and reliability tradeoff. - Keep worker execution continuity aligned with existing thread-local provider sessions so project implementation work can still use provider-native resume behavior.
- Defer autonomous Jira intake. In v1, the human explicitly seeds the manager with the relevant epic, Jira set, or todo list, while manager-side Jira interactions are limited to append-only write-back.
- This work likely warrants an ADR because it establishes hard-to-reverse architecture around conversation types, queue semantics, manager runtime strategy, and cross-thread supervision.
Testing Decisions
- Good tests should assert external behavior and state transitions, not internal implementation details. The tests should validate what queue items are created, which Threads are spawned, what gets written back to worker Threads or Jira-facing adapters, and how readiness changes over time.
- Test the manager orchestration module with scenario-driven state tests: seeded intake, readiness classification, refiner creation, handoff completion, worker auto-spawn, escalation handling, and write-back behavior.
- Test the queue module independently for FIFO behavior, category preservation, linkage between
Manager Queue Itemsand sourceWorker Escalations, and idempotent handling of duplicate events. - Test the refinement lifecycle independently: one active
Refiner Threadper work item, correctRefinement Handoffcapture, and correct manager transition fromneeds-refinementtoready-for-worker. - Test the worker escalation path at the orchestration boundary: a structured worker escalation should create both a visible worker-side row and a manager-side queue item.
- Test sidebar projection and UI rendering for the
Manager Inbox,Delegation Badge, manager-instruction rows, and linked navigation between manager items and project-bound Threads. - Test Jira/todo write-back through adapter-level contract tests that verify append-only comments/notes rather than destructive mutation.
- Reuse prior art from the existing orchestration decider, projector, and WebSocket stream tests already present in the codebase. Similar event-driven tests exist around thread turn start, plan capture, activity projection, and runtime ingestion.
Out of Scope
- Autonomous Jira discovery or polling without explicit human seeding.
- Priority-based queue scheduling beyond FIFO.
- Multiple
Manager Consoleinstances. - Multiple simultaneous active
Refiner Threadsfor one work item. - Overwriting Jira issue descriptions in place.
- File-path-level implementation plans in the
Refinement Handoff. - A fully general multi-party message model for all thread history.
- Hidden background transcript scanners that infer blockers from punctuation or free text.
- A full long-lived daemon-style always-on manager runtime.
- Rich optimization of manager memory or custom provider compaction strategies beyond the initial manager-workspace persistence model.
- Advanced human-routing toggles such as choosing whether a message in a worker thread goes to the human or the manager on the fly.
Further Notes
- This PRD intentionally preserves h-code’s existing
Threadmental model. The new capability comes from adding control-plane relationships and new Thread variants rather than replacing the core object model. - The design assumes that visibility is a product requirement, not just a debugging convenience. The human should be able to inspect the manager-created
Worker ThreadsandRefiner Threadsdirectly. - The design is intentionally token-conscious. The manager should act as a prompt shaper and coordinator, but its runtime should remain lean by depending on durable manager workspace state instead of ever-growing conversational baggage.
- The manager’s value is not only automatic spawning. It is also prompt shaping, supervision, escalation handling, and write-back coordination.
- An ADR should capture the reasoning behind the single
Manager Console, project-boundRefiner Threads, explicitWorker Escalations, append-only Jira write-back, and hybrid manager runtime strategy.
Activity
fix: address logic gaps, silent failures, and bugs from issue #15 review