I've read the plan carefully. Here's the core workflow summary, followed by contradictions and open questions I found.
Core Workflow Summary
5 phases, 3 runtime contexts:
-
Spec Agent (local Claude via ClaudeSpawner) — Quality gate. Takes a vague user request, evaluates it against 5 criteria, runs a stateless clarification loop with the human until the spec is solid, then writes structured tickets to request_queue/ as MD files. Can detect variant requests ("give me 2 versions") and duplicate the full dependency chain with independent IDs and group names. Each ticket gets a start_status judgment that allows stage-skipping (e.g., a well-specified ticket starts at Needs Plan, not Needs Research).
-
Orchestrator (TypeScript, continuous loop in SandboxQueueProcessor) — Polls request_queue/, topological-sorts on depends_on, dispatches one stage per worker invocation to eligible tickets (up to N parallel). After each stage completes, parses WORK_RESULT for next_status and re-dispatches. Dependencies block on Done only. Terminal tickets (nothing non-Done depends on them) get a PR + merge; non-terminal grouped tickets just push to their shared feat/{group} branch.
-
Workers (Claude in Daytona sandbox, stateless) — Each invocation handles exactly one stage using a prompt from stagePromptMap. The full pipeline is: Research → (Specification →) Plan → Implement → Validate → Done, with an Oneshot fast-track for simple tasks. Research/Spec/Plan can run locally; Implement/Validate/Oneshot require a sandbox.
-
Test-Writer (same sandbox as worker, after Implement/Validate/Oneshot) — Deterministic post-implementation step. Unit tests for all tickets; integration tests only for terminal tickets.
-
Entry point — Two modes: npx tsx src/index.ts spec "..." for Spec Agent, npx tsx src/index.ts for Orchestrator loop.
Contradictions & Open Questions
1. filterEligible signature is inconsistent
Phase 3 first defines it with 3 parameters (actionableTasks, allTasks, active) at line ~411, with detailed commentary about why both task sets are needed. But the "filterEligible Update" section at line ~738 shows a 2-parameter version (tasks, active) that only takes one task list. The 2-param version can't distinguish actionable from all tasks, defeating the point of the earlier design.
Which is intended? The 3-param version is the correct one based on the surrounding rationale.
2. Oneshot dispatch has no entry status
The stagePromptMap maps Needs * statuses to prompts. The TaskStatus enum has OneshotInProgress but no NeedsOneshot. The stage transition diagram shows Research routing directly to Oneshot In Progress. But the orchestrator pattern is: find Needs X → set X In Progress → dispatch worker.
Who dispatches the oneshot worker? Either:
- Research itself runs the oneshot inline (contradicts the "one stage per invocation" pattern), or
- There should be a
NeedsOneshot status + entry in stagePromptMap that's missing from the plan
3. executeWorker vs dispatchStage naming conflict
Phase 3 (line ~474) explicitly renames executeWorker to dispatchStage. But Phase 5 (line ~971) uses executeWorker() throughout. These describe different things — dispatchStage handles one stage; Phase 5's executeWorker creates a sandbox and runs impl + tests. But the naming overlap is confusing.
Suggest: Keep dispatchStage for Phase 3's one-stage dispatcher. Phase 5's sandbox-level function could be runSandboxedStage or similar.
4. Agent 1 (Reader) and Agent 3 (Writer) — still Claude agents or absorbed into TypeScript?
The prompt mapping table lists agent1-linear-reader.md and agent3-linear-writer.md as needing HIGH adaptation. The pipeline diagram (line ~69) shows them as distinct Claude-powered steps. But the Orchestrator design in Phase 3 handles all their responsibilities in TypeScript: loadActionableTasks() replaces agent1, writeResults() + updateTaskStatus() replaces agent3.
Are the agent1/agent3 prompts still invoked as Claude calls, or is their logic now pure TypeScript? The plan seems to have evolved toward TypeScript-native reader/writer but never explicitly deprecated the prompts.
5. Unresolved TODO comment (line ~257)
There's a raw HTML comment:
<!-- I need 2 IDs here, one to track the feature requests from the user, the other to track the tickets for the implementation; for ease of implementation, also create a dir "feature_requests_id" to store the feature request... -->
This suggests a dual-ID scheme (feature request ID vs ticket ID) and a directory-per-feature-request structure that was never resolved in the plan body. The current plan only has AGI-{n} ticket IDs in a flat request_queue/.
6. Test-Writer scope is ambiguous
Phase 5 says "Every worker execution is followed by a test-writer step." But in the stage-aware model, Research/Spec/Plan stages don't produce code changes worth testing, and they may run locally without a sandbox. The test-writer only makes sense after Implement, Validate, or Oneshot stages.
The plan probably means: test-writer runs only after stages that produce code (Implement/Oneshot), not after every stage. But this isn't stated explicitly.
Want me to dig into any of these, or should we resolve them one at a time?