20 KiB
Implementation Roadmap
Purpose
This document is the handoff-oriented implementation plan for the project. It is intentionally short and execution-focused.
A new agent should be able to read this file, understand the current project state, and immediately know what to build next without re-deriving the whole design.
Current Status
As of now:
- architecture and workflow docs are written
- CLI surfaces for
inbox,orch, worktree execution, andcouncil-revieware defined - embedded SQLite schema and migrations exist in code
- JSON output shapes are defined for the major flows
- Go module and initial command skeletons exist
inboxandorchboth compile- shared SQLite schema initialization exists
inboxis implemented end-to-end, including send/fetch/claim/renew/update/reply/done/fail/cancel/list/show/watch/wait-replyinboxsupports blocking waits, lease renewal, unread fetches backed by per-agent read cursors,--body-file, artifact attachments, and structured JSON errors with stable exit codes- integration tests now cover each implemented inbox command, plus the main inbox workflows, wait/watch flows, artifact persistence, unread behavior, and JSON error contracts
- a human-readable inbox command test-plan set has been authored under
docs/tests/inbox/ - a human-readable
orchtest-plan set has now been authored underdocs/tests/orch/, with aROADMAP.md, shared conventions, workflow scenarios, per-command indexes, and concrete case documents aligned to the current CLI surface, including supplemental coverage for key flag validation, ordering/limit behavior, payload-only answers, cleanup errors, and council report default/error contracts - a reusable Codex skill package for
inboxnow exists underskills/inbox/, with a formalSKILL.md,agents/openai.yaml, and a bundled CLI binary asset - reusable Codex skill packages for
orchandcouncil-reviewnow exist underskills/orch/andskills/council-review/, both using bundled copies of theorchCLI binary asset - an inbox skill forward-test plan directory now exists under
docs/tests/inbox-skill/, with a shared execution template and multiple scenario cases - an orch skill forward-test plan directory now exists under
docs/tests/orch-skill/, with a shared execution contract and initial leader-side workflow scenarios - a council-review skill forward-test plan directory now exists under
docs/tests/council-review-skill/, with a shared execution contract and initial council workflow scenarios - an execution-roadmap workflow now exists under
docs/roadmaps/active/anddocs/roadmaps/archive/for agent-level work traces and completion archives - a repo-local
scripts/package_skill_clis.shpackaging flow now builds bundled skill CLI assets forinbox,orch, andcouncil-review orchnow implementsrun init/show,task add,dep add,ready,dispatch,reconcile,wait,blocked,answer,retry,reassign,cancel,cleanup, andstatusorchcan create runs, gate tasks through dependencies, dispatch work throughinbox, reconcile worker thread state back into task state, answer blocked tasks, retry or reassign work, cancel tasks or runs, clean attempt worktrees, and create per-attempt Git worktrees during strict dispatchorch dispatchnow supports--repo-path,--workspace-root, and--strict-worktree, auto-enables strict worktree mode for code-like tasks inferred from task metadata, resolves committed base revisions, records workspace metadata on attempts, and writes that metadata into inbox task payloadsorch waitnow blocks on run-scoped task events and reconciles inbox state while polling so leader waits can wake on worker progress without manual sleep loopsorch council startnow creates a dedicated council run, persists council target input metadata, and dispatches the three fixed reviewer roles through the existing schedulerorch council waitnow blocks until the three reviewer tasks reach terminal states or a timeout is reachedorch council tallynow parses completed reviewer outputs, persistscouncil_findings, groups recommendations intoconsensus,majority, andminority, and persistscouncil_groupsorch council reportnow reads persistedcouncil_groups, renders human-readable markdown reports, writes markdown artifacts, and persists final report metadata incouncil_reports- automated integration tests now cover the main
orchscheduler slice, including dependency gating, dispatch, blocked-answer flow, retry, reassign, cancel, cleanup, strict worktree creation, automatic code-task worktree enablement, dirty-repo rejection rules, wait wake/timeout behavior, and council start/wait/tally/report behavior - additional
orchcommand and workflow contract tests now cover the full documented Markdown case set underdocs/tests/orch/, includingrun init/show,task addvalidation, ready ordering, dispatch attempt/thread contracts, blocked latest-question output, answer payload-only and empty-input rejection, cleanup selector and no-match errors, status summaries, reconcile failed-state mapping, strict-worktree dispatch-to-cleanup, and council report default/error behavior
This means the project now has a working orch core scheduler with automatic worktree selection for code-like tasks, strict worktree-backed dispatch, the main leader-side control loop, and the full v1 council workflow from start through final report generation.
Source Of Truth
Read these docs first:
Use this roadmap for implementation order, not for protocol design.
Project Goal
Build a Go-based local agent orchestration stack with:
inbox: worker-facing durable coordination busorch: leader-facing scheduler and control plane- strict worktree-backed execution for code-writing task attempts
council-review: a user-facing three-reviewer brainstorm workflow implemented on top oforch
Implementation Principles
- Do not redesign the protocol unless implementation reveals a real contradiction.
- Keep
inboxandorchas separate CLIs or command groups, but share one SQLite file. - Prefer one small working path over broad unfinished scaffolding.
- Make JSON output stable early.
- Implement the happy path first, then add wait/retry/cleanup.
Recommended v1 Order
Progress Snapshot
Current implementation status:
Milestone 1: Go Skeletonis completeMilestone 2: Shared DB Layeris complete enough for both CLIsMilestone 3: Inbox Happy Pathis completeMilestone 4: Orch Core Schedulingis complete for the current non-worktree scheduler scopeMilestone 5: Strict Worktree Supportis completeMilestone 6: Waiting Primitivesis completeMilestone 7: Council Reviewis complete
The council review v1 surface is now complete, including final report rendering and metadata persistence.
Milestone 1: Go Skeleton
Goal:
- initialize the Go module
- choose CLI framework and SQLite driver
- create package layout
- make empty commands compile
Recommended shape:
cmd/inboxcmd/orchinternal/dbinternal/storeinternal/protocolinternal/cli
Definition of done:
go build ./...succeedsinbox --helpworksorch --helpworks
Status:
- completed
Milestone 2: Shared DB Layer
Goal:
- create the SQLite connection layer
- enable required pragmas
- add schema initialization and migration mechanism
Minimum scope:
- communication tables for
inbox - scheduling tables for
orch - shared
eventstable
Definition of done:
inbox initinitializes the databaseorchcan open the same database successfully
Status:
- completed for current inbox needs
Completed so far:
- shared DB open layer exists
- required SQLite pragmas are applied
- embedded schema files exist
inbox initapplies schema successfully
Remaining:
- decide whether
orchshould gain an explicit DB bootstrap check or continue to rely oninbox init
Milestone 3: Inbox Happy Path
Goal:
- implement worker-facing coordination primitives first
First commands:
inbox initinbox sendinbox fetchinbox claiminbox updateinbox replyinbox doneinbox failinbox show
Delay if needed:
watchwait-replycancellist
Definition of done:
- one thread can be created, claimed, updated, replied to, and completed
- all major commands support
--json
Status:
- completed
Completed so far:
inbox initinbox sendinbox fetchinbox claiminbox renewinbox updateinbox replyinbox doneinbox failinbox cancelinbox listinbox showinbox watchinbox wait-reply
Milestone 4: Orch Core Scheduling
Goal:
- implement run/task/dependency/attempt orchestration on top of
inbox
First commands:
orch run initorch task addorch dep addorch readyorch dispatchorch reconcileorch blockedorch answerorch status
Delay if needed:
retryreassigncancelcleanupwait
Definition of done:
- a leader can create a run
- add tasks and dependencies
- dispatch a task through
orch - see worker state reflected back after
reconcile
Status:
- completed for the current non-worktree scheduling scope
Completed so far:
orch run initorch run showorch task addorch dep addorch readyorch dispatchorch reconcileorch waitorch blockedorch answerorch retryorch reassignorch cancelorch cleanuporch status- CLI integration tests cover dispatch/reconcile, dependency gating, blocked-answer flow, wait wake/timeout, retry, reassign, cancel, cleanup, and non-ready dispatch rejection
Remaining:
- none for the current scheduler control surface
Milestone 5: Strict Worktree Support
Goal:
- ensure code-writing tasks execute in isolated worktrees
First scope:
orch dispatchresolvesbase_ref- strict mode fails when the repo is dirty and no explicit base is provided
- worktree path and branch name are stored on the attempt
Definition of done:
- a code task dispatch creates a real worktree
- the assigned worktree path appears in attempt metadata and inbox payload
Status:
- completed
Completed so far:
orch dispatchcan use--repo-pathto target a source Git repository without relying on the caller's current working directoryorch dispatch --strict-worktreeresolvesbase_refto a concrete commit, defaults toHEADon clean repositories, and rejects dirty repositories when--base-refis omittedorch dispatchauto-selects worktree mode for code-like tasks inferred from existing task metadata such as worker role and acceptance markers- dispatch creates a fresh branch and Git worktree per attempt and persists
base_ref,base_commit,branch_name,worktree_path, andworkspace_status - dispatch writes workspace metadata into the inbox task payload for worker runtimes
- reconcile now advances
workspace_statusfromcreatedtoactive,completed, orabandonedbased on thread state orch cleanupremoves completed or abandoned worktrees and marks attempt workspace state ascleaned- CLI integration tests cover strict worktree creation, auto-enabled worktrees for code-like tasks, explicit-base dispatch on dirty repos, strict dirty-repo rejection, and cleanup
Remaining:
- none
Milestone 6: Waiting Primitives
Goal:
- replace blind polling with blocking CLI waits
Commands:
orch waitinbox wait-reply
Definition of done:
- leader can block on new task events
- blocked worker can block on reply events
Status:
- completed
Completed so far:
orch waitinbox wait-replyorch waitreconciles inbox state while polling and wakes on matching run-scopedtask_*events- CLI integration tests cover wait wake and timeout behavior
Milestone 7: Council Review
Goal:
- implement the user-facing three-reviewer brainstorming workflow
First commands:
orch council startorch council waitorch council tallyorch council report
Definition of done:
- one council run can dispatch three reviewers
- tally grouped recommendations into
consensus,majority, andminority - produce stable JSON and a markdown report artifact
Status:
- completed
Completed so far:
- council-specific storage now includes run metadata, reviewer assignment rows, reviewer findings/groups tables, persisted council input references, and final report metadata
orch council startorch council waitorch council tallyorch council report- council start creates a dedicated run, stores council target input metadata, creates reviewer tasks
CR1throughCR3, and dispatches the fixed reviewer rolesarchitecture-reviewer,implementation-reviewer, andrisk-reviewer - council wait blocks until all three reviewer tasks reach terminal states or timeout
- council tally parses structured reviewer outputs from completed reviewer result messages and persists grouped recommendations
- council report reads grouped recommendations from persisted
council_groups, supports--showbucket filtering, renders markdown report artifacts, and persists report metadata plus artifact paths - CLI integration tests cover council start dispatch, metadata persistence, council wait wake/timeout behavior, council tally grouping in
normalandstrictmodes, and council report default/all/JSON rendering behavior
Remaining:
- none for the v1 council workflow
Immediate Next Task
If a new agent is taking over now, the next concrete step should be:
- treat
Milestone 7: Council Reviewas complete unless a new user request introduces a new council capability - keep the authored inbox test-plan set in
docs/tests/inbox/synchronized if futureorchwork changes shared CLI behavior - choose the next milestone explicitly instead of reopening the completed council v1 slice
The inbox implementation and its human-readable test-plan set are already in place, and orch now supports the main scheduler loop plus the complete council start/wait/tally/report workflow, so any next step should be a new milestone rather than unfinished council v1 work.
Recommended Driver Choices
Current recommendation:
- CLI framework:
Cobra - SQLite driver: pure-Go driver
Reason:
- command surfaces are already command-group heavy
- pure-Go SQLite keeps distribution simpler
Suggested Early Tests
Completed so far:
- schema init test
- inbox command-level CLI integration coverage aligned to
docs/tests/inbox/ - inbox workflow lifecycle coverage
- orch scheduler lifecycle coverage for run/task/dependency/dispatch/reconcile
- orch blocked-question and answer coverage
- orch strict worktree creation and dirty-repo policy coverage
- orch wait wake and timeout coverage
- orch retry, reassign, cancel, and cleanup coverage
- orch council start dispatch and persistence coverage
- orch council wait wake and timeout coverage
- orch council tally grouping coverage
- orch council report default markdown,
--show all, and JSON shape coverage
Still recommended before the codebase grows too much:
- worktree path generation test
Inbox Test Documentation Roadmap
Status:
- completed for the current inbox CLI surface
- command-level and workflow Markdown documents exist under
docs/tests/inbox/ - future updates should revise this section only when new inbox commands or materially new CLI-visible behavior are added
Goal:
- make inbox behavior easy for a new agent to understand and convert into automated tests without re-reading all code paths
Directory layout:
docs/tests/inbox/README.mddocs/tests/inbox/_shared/README.mddocs/tests/inbox/workflows/README.mddocs/tests/inbox/<command>/README.mddocs/tests/inbox/<command>/<case-slug>.md
Initial command folders:
initsendfetchclaimrenewupdatereplydonefailcancellistshowwatchwait-reply
Documentation rules:
- organize by folder with a
README.mdentrypoint - command folders use
README.mdas an index only - each command case lives in its own Markdown file named after the case slug
- do not use numeric test case IDs
- identify command cases by concrete file path
- keep one command per directory, plus
workflows/for cross-command behavior - use
_shared/for common fixtures, database conventions, exit-code rules, and shared JSON assertions
Required per-case structure:
用例意义前置条件输入预期输出断言结论
Case file naming pattern:
<stable-slug>.md
Authoring order:
- global conventions in
docs/tests/inbox/README.md - shared fixtures and assertion helpers in
docs/tests/inbox/_shared/README.md - lifecycle flow in
docs/tests/inbox/workflows/README.md - core command docs:
send,fetch,claim,reply,done,show - secondary command docs:
renew,update,fail,cancel,list - waiting and read-state docs:
watch,wait-reply, unread and mark-read workflow cases
Definition of done:
- every implemented inbox command has a dedicated document directory
- every documented case contains concrete input and expected output
- shared assumptions are centralized instead of copied into each command file
- a new agent can pick any case and implement it as an automated test with minimal additional discovery
Orch Test Documentation Roadmap
Status:
- current planned
orchMarkdown test-plan set is authored underdocs/tests/orch/ - global conventions, shared fixtures, workflow scenarios, per-command indexes, and concrete case documents now exist
docs/tests/orch/ROADMAP.mdnow tracks authored counts, document progress, and future additions in the same style used fordocs/tests/inbox/ROADMAP.md- supplemental command-visible cases now cover high-value gaps in
task add,ready,answer,cleanup, andcouncil report
Goal:
- make
orchbehavior easy for a new agent to understand and convert into automated tests or manual validation steps without re-reading all scheduler code paths
Directory layout:
docs/tests/orch/README.mddocs/tests/orch/ROADMAP.mddocs/tests/orch/_shared/README.mddocs/tests/orch/workflows/README.mddocs/tests/orch/<leaf-command>/README.mddocs/tests/orch/<leaf-command>/<case-slug>.md
Current document model:
- one folder per implemented leaf command
- each command folder uses
README.mdas an index only - workflow cases live in
docs/tests/orch/workflows/README.md - detailed case backlog and authored-case register are tracked centrally in
docs/tests/orch/ROADMAP.md
Next documentation step:
- keep
docs/tests/orch/ROADMAP.mdsynchronized when neworchCLI behavior or workflow cases are added, removed, or materially revised
Out Of Scope For First Pass
Do not block v1 on these:
- advanced auth or permissions
- background daemons beyond blocking CLI commands
Handoff Notes For Future Agents
- The design phase is complete enough to start coding.
- Avoid reopening major design questions unless implementation forces it.
- The repository already has compiling binaries and working schema init.
- The inbox test-plan docs are in place; keep them synchronized before and during broad
orchimplementation. - inbox command test-plan folders use
README.mdas an index plus one file per case; keep any further structural changes consistent with the documented rules above. - Preserve the separation:
inboxhandles communicationorchhandles schedulingcouncil-reviewis a workflow on top oforch
- When writing inbox test docs, use the folder-per-command structure described above and keep cross-command cases inside
docs/tests/inbox/workflows/. - Treat this file as the implementation entrypoint for new agents.