fleet-commander-ai 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +159 -0
- package/bin/fleet-commander-mcp.js +27 -0
- package/bin/fleet-commander.js +22 -0
- package/dist/client/assets/index-CHukC8Hq.js +188 -0
- package/dist/client/assets/index-CHukC8Hq.js.map +1 -0
- package/dist/client/assets/index-DvMjcYbg.css +1 -0
- package/dist/client/index.html +13 -0
- package/dist/server/config.d.ts +51 -0
- package/dist/server/config.d.ts.map +1 -0
- package/dist/server/config.js +104 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/db.d.ts +388 -0
- package/dist/server/db.d.ts.map +1 -0
- package/dist/server/db.js +1524 -0
- package/dist/server/db.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +162 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/mcp/index.d.ts +2 -0
- package/dist/server/mcp/index.d.ts.map +1 -0
- package/dist/server/mcp/index.js +112 -0
- package/dist/server/mcp/index.js.map +1 -0
- package/dist/server/mcp/tools/add-project.d.ts +9 -0
- package/dist/server/mcp/tools/add-project.d.ts.map +1 -0
- package/dist/server/mcp/tools/add-project.js +58 -0
- package/dist/server/mcp/tools/add-project.js.map +1 -0
- package/dist/server/mcp/tools/get-team-timeline.d.ts +9 -0
- package/dist/server/mcp/tools/get-team-timeline.d.ts.map +1 -0
- package/dist/server/mcp/tools/get-team-timeline.js +48 -0
- package/dist/server/mcp/tools/get-team-timeline.js.map +1 -0
- package/dist/server/mcp/tools/get-team.d.ts +9 -0
- package/dist/server/mcp/tools/get-team.d.ts.map +1 -0
- package/dist/server/mcp/tools/get-team.js +48 -0
- package/dist/server/mcp/tools/get-team.js.map +1 -0
- package/dist/server/mcp/tools/get-usage.d.ts +9 -0
- package/dist/server/mcp/tools/get-usage.d.ts.map +1 -0
- package/dist/server/mcp/tools/get-usage.js +33 -0
- package/dist/server/mcp/tools/get-usage.js.map +1 -0
- package/dist/server/mcp/tools/launch-team.d.ts +8 -0
- package/dist/server/mcp/tools/launch-team.d.ts.map +1 -0
- package/dist/server/mcp/tools/launch-team.js +49 -0
- package/dist/server/mcp/tools/launch-team.js.map +1 -0
- package/dist/server/mcp/tools/list-issues.d.ts +9 -0
- package/dist/server/mcp/tools/list-issues.d.ts.map +1 -0
- package/dist/server/mcp/tools/list-issues.js +47 -0
- package/dist/server/mcp/tools/list-issues.js.map +1 -0
- package/dist/server/mcp/tools/list-projects.d.ts +9 -0
- package/dist/server/mcp/tools/list-projects.d.ts.map +1 -0
- package/dist/server/mcp/tools/list-projects.js +32 -0
- package/dist/server/mcp/tools/list-projects.js.map +1 -0
- package/dist/server/mcp/tools/list-teams.d.ts +9 -0
- package/dist/server/mcp/tools/list-teams.d.ts.map +1 -0
- package/dist/server/mcp/tools/list-teams.js +43 -0
- package/dist/server/mcp/tools/list-teams.js.map +1 -0
- package/dist/server/mcp/tools/restart-team.d.ts +8 -0
- package/dist/server/mcp/tools/restart-team.d.ts.map +1 -0
- package/dist/server/mcp/tools/restart-team.js +46 -0
- package/dist/server/mcp/tools/restart-team.js.map +1 -0
- package/dist/server/mcp/tools/send-message.d.ts +9 -0
- package/dist/server/mcp/tools/send-message.d.ts.map +1 -0
- package/dist/server/mcp/tools/send-message.js +48 -0
- package/dist/server/mcp/tools/send-message.js.map +1 -0
- package/dist/server/mcp/tools/stop-team.d.ts +8 -0
- package/dist/server/mcp/tools/stop-team.d.ts.map +1 -0
- package/dist/server/mcp/tools/stop-team.js +46 -0
- package/dist/server/mcp/tools/stop-team.js.map +1 -0
- package/dist/server/mcp/tools/system-health.d.ts +9 -0
- package/dist/server/mcp/tools/system-health.d.ts.map +1 -0
- package/dist/server/mcp/tools/system-health.js +32 -0
- package/dist/server/mcp/tools/system-health.js.map +1 -0
- package/dist/server/middleware/error-handler.d.ts +32 -0
- package/dist/server/middleware/error-handler.d.ts.map +1 -0
- package/dist/server/middleware/error-handler.js +65 -0
- package/dist/server/middleware/error-handler.js.map +1 -0
- package/dist/server/routes/events.d.ts +16 -0
- package/dist/server/routes/events.d.ts.map +1 -0
- package/dist/server/routes/events.js +164 -0
- package/dist/server/routes/events.js.map +1 -0
- package/dist/server/routes/issues.d.ts +4 -0
- package/dist/server/routes/issues.d.ts.map +1 -0
- package/dist/server/routes/issues.js +198 -0
- package/dist/server/routes/issues.js.map +1 -0
- package/dist/server/routes/project-groups.d.ts +4 -0
- package/dist/server/routes/project-groups.d.ts.map +1 -0
- package/dist/server/routes/project-groups.js +124 -0
- package/dist/server/routes/project-groups.js.map +1 -0
- package/dist/server/routes/projects.d.ts +4 -0
- package/dist/server/routes/projects.d.ts.map +1 -0
- package/dist/server/routes/projects.js +319 -0
- package/dist/server/routes/projects.js.map +1 -0
- package/dist/server/routes/prs.d.ts +4 -0
- package/dist/server/routes/prs.d.ts.map +1 -0
- package/dist/server/routes/prs.js +186 -0
- package/dist/server/routes/prs.js.map +1 -0
- package/dist/server/routes/query.d.ts +4 -0
- package/dist/server/routes/query.d.ts.map +1 -0
- package/dist/server/routes/query.js +82 -0
- package/dist/server/routes/query.js.map +1 -0
- package/dist/server/routes/state-machine.d.ts +4 -0
- package/dist/server/routes/state-machine.d.ts.map +1 -0
- package/dist/server/routes/state-machine.js +86 -0
- package/dist/server/routes/state-machine.js.map +1 -0
- package/dist/server/routes/stream.d.ts +18 -0
- package/dist/server/routes/stream.d.ts.map +1 -0
- package/dist/server/routes/stream.js +62 -0
- package/dist/server/routes/stream.js.map +1 -0
- package/dist/server/routes/system.d.ts +4 -0
- package/dist/server/routes/system.d.ts.map +1 -0
- package/dist/server/routes/system.js +225 -0
- package/dist/server/routes/system.js.map +1 -0
- package/dist/server/routes/teams.d.ts +4 -0
- package/dist/server/routes/teams.d.ts.map +1 -0
- package/dist/server/routes/teams.js +570 -0
- package/dist/server/routes/teams.js.map +1 -0
- package/dist/server/routes/usage.d.ts +4 -0
- package/dist/server/routes/usage.d.ts.map +1 -0
- package/dist/server/routes/usage.js +80 -0
- package/dist/server/routes/usage.js.map +1 -0
- package/dist/server/schema.sql +267 -0
- package/dist/server/services/cc-query.d.ts +20 -0
- package/dist/server/services/cc-query.d.ts.map +1 -0
- package/dist/server/services/cc-query.js +352 -0
- package/dist/server/services/cc-query.js.map +1 -0
- package/dist/server/services/cleanup.d.ts +15 -0
- package/dist/server/services/cleanup.d.ts.map +1 -0
- package/dist/server/services/cleanup.js +232 -0
- package/dist/server/services/cleanup.js.map +1 -0
- package/dist/server/services/diagnostics-service.d.ts +85 -0
- package/dist/server/services/diagnostics-service.d.ts.map +1 -0
- package/dist/server/services/diagnostics-service.js +242 -0
- package/dist/server/services/diagnostics-service.js.map +1 -0
- package/dist/server/services/event-collector.d.ts +125 -0
- package/dist/server/services/event-collector.d.ts.map +1 -0
- package/dist/server/services/event-collector.js +299 -0
- package/dist/server/services/event-collector.js.map +1 -0
- package/dist/server/services/event-service.d.ts +22 -0
- package/dist/server/services/event-service.d.ts.map +1 -0
- package/dist/server/services/event-service.js +53 -0
- package/dist/server/services/event-service.js.map +1 -0
- package/dist/server/services/github-poller.d.ts +68 -0
- package/dist/server/services/github-poller.d.ts.map +1 -0
- package/dist/server/services/github-poller.js +563 -0
- package/dist/server/services/github-poller.js.map +1 -0
- package/dist/server/services/issue-fetcher.d.ts +231 -0
- package/dist/server/services/issue-fetcher.d.ts.map +1 -0
- package/dist/server/services/issue-fetcher.js +1053 -0
- package/dist/server/services/issue-fetcher.js.map +1 -0
- package/dist/server/services/issue-service.d.ts +102 -0
- package/dist/server/services/issue-service.d.ts.map +1 -0
- package/dist/server/services/issue-service.js +279 -0
- package/dist/server/services/issue-service.js.map +1 -0
- package/dist/server/services/message-template-service.d.ts +39 -0
- package/dist/server/services/message-template-service.d.ts.map +1 -0
- package/dist/server/services/message-template-service.js +87 -0
- package/dist/server/services/message-template-service.js.map +1 -0
- package/dist/server/services/pr-service.d.ts +73 -0
- package/dist/server/services/pr-service.d.ts.map +1 -0
- package/dist/server/services/pr-service.js +231 -0
- package/dist/server/services/pr-service.js.map +1 -0
- package/dist/server/services/project-group-service.d.ts +64 -0
- package/dist/server/services/project-group-service.d.ts.map +1 -0
- package/dist/server/services/project-group-service.js +149 -0
- package/dist/server/services/project-group-service.js.map +1 -0
- package/dist/server/services/project-service.d.ts +161 -0
- package/dist/server/services/project-service.d.ts.map +1 -0
- package/dist/server/services/project-service.js +623 -0
- package/dist/server/services/project-service.js.map +1 -0
- package/dist/server/services/service-error.d.ts +25 -0
- package/dist/server/services/service-error.d.ts.map +1 -0
- package/dist/server/services/service-error.js +49 -0
- package/dist/server/services/service-error.js.map +1 -0
- package/dist/server/services/sse-broker.d.ts +144 -0
- package/dist/server/services/sse-broker.d.ts.map +1 -0
- package/dist/server/services/sse-broker.js +111 -0
- package/dist/server/services/sse-broker.js.map +1 -0
- package/dist/server/services/startup-recovery.d.ts +10 -0
- package/dist/server/services/startup-recovery.d.ts.map +1 -0
- package/dist/server/services/startup-recovery.js +122 -0
- package/dist/server/services/startup-recovery.js.map +1 -0
- package/dist/server/services/stuck-detector.d.ts +20 -0
- package/dist/server/services/stuck-detector.d.ts.map +1 -0
- package/dist/server/services/stuck-detector.js +167 -0
- package/dist/server/services/stuck-detector.js.map +1 -0
- package/dist/server/services/stuck-detector.test.d.ts +2 -0
- package/dist/server/services/stuck-detector.test.d.ts.map +1 -0
- package/dist/server/services/stuck-detector.test.js +363 -0
- package/dist/server/services/stuck-detector.test.js.map +1 -0
- package/dist/server/services/team-manager.d.ts +188 -0
- package/dist/server/services/team-manager.d.ts.map +1 -0
- package/dist/server/services/team-manager.js +1869 -0
- package/dist/server/services/team-manager.js.map +1 -0
- package/dist/server/services/team-service.d.ts +251 -0
- package/dist/server/services/team-service.d.ts.map +1 -0
- package/dist/server/services/team-service.js +707 -0
- package/dist/server/services/team-service.js.map +1 -0
- package/dist/server/services/usage-service.d.ts +42 -0
- package/dist/server/services/usage-service.d.ts.map +1 -0
- package/dist/server/services/usage-service.js +101 -0
- package/dist/server/services/usage-service.js.map +1 -0
- package/dist/server/services/usage-tracker.d.ts +68 -0
- package/dist/server/services/usage-tracker.d.ts.map +1 -0
- package/dist/server/services/usage-tracker.js +220 -0
- package/dist/server/services/usage-tracker.js.map +1 -0
- package/dist/server/utils/build-timeline.d.ts +32 -0
- package/dist/server/utils/build-timeline.d.ts.map +1 -0
- package/dist/server/utils/build-timeline.js +142 -0
- package/dist/server/utils/build-timeline.js.map +1 -0
- package/dist/server/utils/find-git-bash.d.ts +10 -0
- package/dist/server/utils/find-git-bash.d.ts.map +1 -0
- package/dist/server/utils/find-git-bash.js +46 -0
- package/dist/server/utils/find-git-bash.js.map +1 -0
- package/dist/server/utils/hook-installer.d.ts +20 -0
- package/dist/server/utils/hook-installer.d.ts.map +1 -0
- package/dist/server/utils/hook-installer.js +90 -0
- package/dist/server/utils/hook-installer.js.map +1 -0
- package/dist/server/utils/process-utils.d.ts +10 -0
- package/dist/server/utils/process-utils.d.ts.map +1 -0
- package/dist/server/utils/process-utils.js +33 -0
- package/dist/server/utils/process-utils.js.map +1 -0
- package/dist/server/utils/resolve-claude-path.d.ts +4 -0
- package/dist/server/utils/resolve-claude-path.d.ts.map +1 -0
- package/dist/server/utils/resolve-claude-path.js +66 -0
- package/dist/server/utils/resolve-claude-path.js.map +1 -0
- package/dist/server/utils/resolve-message.d.ts +10 -0
- package/dist/server/utils/resolve-message.d.ts.map +1 -0
- package/dist/server/utils/resolve-message.js +27 -0
- package/dist/server/utils/resolve-message.js.map +1 -0
- package/dist/shared/message-templates.d.ts +9 -0
- package/dist/shared/message-templates.d.ts.map +1 -0
- package/dist/shared/message-templates.js +88 -0
- package/dist/shared/message-templates.js.map +1 -0
- package/dist/shared/state-machine.d.ts +28 -0
- package/dist/shared/state-machine.d.ts.map +1 -0
- package/dist/shared/state-machine.js +282 -0
- package/dist/shared/state-machine.js.map +1 -0
- package/dist/shared/types.d.ts +404 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/shared/types.js.map +1 -0
- package/hooks/DESIGN.md +562 -0
- package/hooks/on_notification.sh +9 -0
- package/hooks/on_post_tool_use.sh +9 -0
- package/hooks/on_pre_compact.sh +10 -0
- package/hooks/on_session_end.sh +8 -0
- package/hooks/on_session_start.sh +8 -0
- package/hooks/on_stop.sh +8 -0
- package/hooks/on_stop_failure.sh +8 -0
- package/hooks/on_subagent_start.sh +8 -0
- package/hooks/on_subagent_stop.sh +8 -0
- package/hooks/on_teammate_idle.sh +8 -0
- package/hooks/on_tool_error.sh +8 -0
- package/hooks/send_event.sh +101 -0
- package/hooks/settings.json.example +120 -0
- package/package.json +93 -0
- package/prompts/default-prompt.md +16 -0
- package/scripts/install.ps1 +22 -0
- package/scripts/install.sh +229 -0
- package/scripts/launch.js +64 -0
- package/scripts/uninstall.ps1 +22 -0
- package/scripts/uninstall.sh +123 -0
- package/templates/agents/fleet-dev.md +162 -0
- package/templates/agents/fleet-planner.md +263 -0
- package/templates/agents/fleet-reviewer.md +309 -0
- package/templates/archive/fleet-coordinator.md +128 -0
- package/templates/archive/fleet-dev-csharp.md +74 -0
- package/templates/archive/fleet-dev-devops.md +76 -0
- package/templates/archive/fleet-dev-fsharp.md +83 -0
- package/templates/archive/fleet-dev-generic.md +64 -0
- package/templates/archive/fleet-dev-python.md +75 -0
- package/templates/archive/fleet-dev-typescript.md +76 -0
- package/templates/guides/api-design.md +159 -0
- package/templates/guides/csharp-conventions.md +182 -0
- package/templates/guides/devops-conventions.md +192 -0
- package/templates/guides/fsharp-conventions.md +201 -0
- package/templates/guides/python-conventions.md +146 -0
- package/templates/guides/sql-database.md +125 -0
- package/templates/guides/testing-strategies.md +123 -0
- package/templates/guides/typescript-conventions.md +130 -0
- package/templates/workflow.md +513 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
<!-- Fleet Commander workflow template. Installed by Fleet Commander into your project. -->
|
|
2
|
+
<!-- Placeholders {{PROJECT_NAME}}, {{project_slug}}, {{BASE_BRANCH}}, {{ISSUE_NUMBER}} are replaced during installation. -->
|
|
3
|
+
|
|
4
|
+
# Diamond Workflow — {{PROJECT_NAME}}
|
|
5
|
+
|
|
6
|
+
## About Fleet Commander
|
|
7
|
+
|
|
8
|
+
Fleet Commander (FC) is the orchestration layer that manages your team. Key facts:
|
|
9
|
+
|
|
10
|
+
- **Hooks** — FC monitors agent activity via hooks installed in the repo. Every tool use, session start/end, notification, and error is reported automatically. You do not need to report progress manually.
|
|
11
|
+
- **CI/PR updates via stdin** — FC watches GitHub for CI results and PR status. When something changes, FC sends a message directly to the Team Lead (TL) via stdin. No PR Watcher agent is needed.
|
|
12
|
+
- **Dashboard** — The PM watches all teams from the FC dashboard. They can see your state (Analyzing, Implementing, Reviewing, PR, Done, Blocked), recent events, and output in real time.
|
|
13
|
+
- **Messages from FC** — FC may send structured messages to the TL (see "FC Messages" section below). These arrive as stdin messages and should be acted on promptly.
|
|
14
|
+
- **Idle/Stuck thresholds** — FC marks agents idle after 3 minutes of inactivity and stuck after 5 minutes. Agents waiting for peer messages are expected to be idle — this is normal. TL should only intervene when stuck.
|
|
15
|
+
|
|
16
|
+
## Worktree Awareness
|
|
17
|
+
|
|
18
|
+
You are running inside a **git worktree**, not the main repository checkout. This has critical implications:
|
|
19
|
+
|
|
20
|
+
- **NEVER run `git checkout {{BASE_BRANCH}}`** — the base branch is already checked out in the main worktree. Attempting to check it out here will fail with "already used by worktree."
|
|
21
|
+
- **Use `git fetch origin {{BASE_BRANCH}}` and reference `origin/{{BASE_BRANCH}}`** whenever you need the latest base branch state. Do not try to switch to it.
|
|
22
|
+
- **Your branch is your branch.** Create it, work on it, push it. Never switch away from it to {{BASE_BRANCH}}.
|
|
23
|
+
- This applies to ALL agents (planner, dev, reviewer) — none of them should ever attempt to checkout {{BASE_BRANCH}}.
|
|
24
|
+
|
|
25
|
+
## Entry Point
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
User: claude --worktree {{project_slug}}-{N}
|
|
29
|
+
(prompt is sent via stdin from Fleet Commander's prompt file)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Role of TL (main agent = You):**
|
|
33
|
+
1. Read this workflow and understand the team structure
|
|
34
|
+
2. **Phase 0: Spawn `fleet-planner` only** — planner analyzes the issue and produces a plan
|
|
35
|
+
3. **Wait for planner's plan** — it arrives via `SendMessage` from the planner
|
|
36
|
+
4. **Phase 1: Spawn `fleet-dev` with the plan context** — dev starts implementing immediately
|
|
37
|
+
5. **Wait for dev to report "ready for review"** — dev sends a message when implementation is complete
|
|
38
|
+
6. **Phase 2: Spawn `fleet-reviewer`** — reviewer starts reviewing immediately
|
|
39
|
+
7. Let dev and reviewer communicate peer-to-peer — DO NOT relay messages between them
|
|
40
|
+
8. Only intervene if: escalation after 3 review rounds, agent stuck (5min idle), or final PR creation
|
|
41
|
+
9. When review passes: rebase, create PR, set auto-merge
|
|
42
|
+
10. Respond to FC messages (ci_green, ci_red, pr_merged, nudge_idle, nudge_stuck)
|
|
43
|
+
11. On pr_merged: close issue, shut down agents, finish
|
|
44
|
+
|
|
45
|
+
## Team Composition — Diamond (3 Agents)
|
|
46
|
+
|
|
47
|
+
| Agent | subagent_type | name | Role | Spawn |
|
|
48
|
+
|-------|---------------|------|------|-------|
|
|
49
|
+
| **Planner** | `fleet-planner` | `planner` | Analyzes issue + codebase, produces structured plan with guidebook paths. Sends plan to TL. Stays alive for p2p questions from dev and reviewer. | Phase 0 (immediate) |
|
|
50
|
+
| **Dev** | `fleet-dev` | `dev` | Receives planner's plan at spawn, implements code, writes tests, pushes commits. Communicates with reviewer directly during review. Can ask planner questions via p2p. | Phase 1 (after plan) |
|
|
51
|
+
| **Reviewer** | `fleet-reviewer` | `reviewer` | Spawned after dev reports ready. Two-pass code review. Sends feedback directly to dev. Reports final verdict to TL. Can ask planner questions via p2p. | Phase 2 (after dev ready) |
|
|
52
|
+
|
|
53
|
+
There is NO coordinator agent. The TL orchestrates all three agents directly.
|
|
54
|
+
|
|
55
|
+
All agents use `model: inherit` — they run on the same model as the TL.
|
|
56
|
+
|
|
57
|
+
### Agent Lifecycle
|
|
58
|
+
|
|
59
|
+
- **Agents are spawned sequentially** as each phase completes. This gives each agent the context it needs to start working immediately.
|
|
60
|
+
- **Planner** is spawned first (Phase 0). It analyzes the issue, produces the plan, sends it to TL, and **stays alive** — available for p2p questions from dev and reviewer throughout the workflow.
|
|
61
|
+
- **Dev** is spawned after the plan arrives (Phase 1). The TL includes the planner's plan in the dev's task prompt, so dev can start implementing immediately — no waiting.
|
|
62
|
+
- **Reviewer** is spawned after dev reports ready (Phase 2). The TL includes the branch name and context in the reviewer's task prompt, so reviewer can start reviewing immediately — no waiting.
|
|
63
|
+
- Once spawned, **agents stay alive** until the team is done. Planner persists as a knowledge resource. Dev persists through review rounds and CI fixes. Reviewer persists through all review rounds.
|
|
64
|
+
- Dev and Reviewer communicate **peer-to-peer** — TL does not relay messages between them.
|
|
65
|
+
|
|
66
|
+
### TYPE to Guidebook Mapping
|
|
67
|
+
|
|
68
|
+
All implementation work is assigned to the single `fleet-dev` agent. The Planner's TYPE and Guidebooks fields tell the dev which guidebooks to read for domain-specific conventions.
|
|
69
|
+
|
|
70
|
+
| TYPE in plan | Guidebooks to read |
|
|
71
|
+
|---------------|-------------------|
|
|
72
|
+
| C# / .NET | `csharp-conventions.md` |
|
|
73
|
+
| F# | `fsharp-conventions.md` |
|
|
74
|
+
| TypeScript / JS | `typescript-conventions.md` |
|
|
75
|
+
| Python | `python-conventions.md` |
|
|
76
|
+
| Infrastructure / CI | `devops-conventions.md` |
|
|
77
|
+
| Generic / unknown | CLAUDE.md only (no language-specific guidebook) |
|
|
78
|
+
| Mixed (A + B) | Multiple guidebooks — dev reads all relevant ones |
|
|
79
|
+
|
|
80
|
+
## Workflow State Machine
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
stateDiagram-v2
|
|
84
|
+
[*] --> Setup : start (spawn planner)
|
|
85
|
+
Setup --> Analyzing : planner spawned
|
|
86
|
+
Analyzing --> Implementing : plan OK (TL spawns dev with plan)
|
|
87
|
+
Analyzing --> Blocked : BLOCKED in plan
|
|
88
|
+
Implementing --> Reviewing : dev reports ready (TL spawns reviewer)
|
|
89
|
+
Reviewing --> Implementing : REJECT (dev fixes, max 3 rounds)
|
|
90
|
+
Reviewing --> PR : APPROVE (TL creates PR)
|
|
91
|
+
PR --> Done : CI GREEN + merge
|
|
92
|
+
PR --> Implementing : CI RED (dev fixes, pushes)
|
|
93
|
+
Implementing --> Blocked : escalation
|
|
94
|
+
Reviewing --> Blocked : 3x REJECT
|
|
95
|
+
PR --> Blocked : 3 unique CI failure types
|
|
96
|
+
Done --> [*]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Agents are spawned sequentially as phases complete.** Phase transitions represent when agents are spawned and which agent is actively doing primary work.
|
|
100
|
+
|
|
101
|
+
**Blocked can be entered from any active state** when the team cannot proceed (missing info, unresolvable conflicts, repeated failures).
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Phase 0 — Setup (Spawn Planner)
|
|
106
|
+
|
|
107
|
+
1. **TL spawns `fleet-planner`** with the issue number and project context.
|
|
108
|
+
2. TL enters the Active Monitoring Loop (see below) while waiting for the plan.
|
|
109
|
+
3. Planner analyzes the issue, explores the codebase, discovers guidebooks, and produces a structured plan.
|
|
110
|
+
4. Planner sends the plan to TL via `SendMessage`. Planner stays alive for p2p questions from dev and reviewer.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Active Monitoring Loop
|
|
115
|
+
|
|
116
|
+
After spawning the first agent, the TL enters a continuous monitoring loop that runs throughout the entire workflow. This prevents the TL from going silent between phases.
|
|
117
|
+
|
|
118
|
+
### Monitoring Rules
|
|
119
|
+
|
|
120
|
+
1. **Run `TaskList` every 30-60 seconds** to check the status of all spawned agents. This is your heartbeat — never go more than 60 seconds without checking.
|
|
121
|
+
2. **If any agent exits unexpectedly** (SubagentStop without sending expected output), **respawn immediately** — do not wait for the stuck detector's 5-minute threshold. However, observe the **respawn budget** (see below).
|
|
122
|
+
3. **Between phases** (e.g., planner done, waiting for dev), actively verify the next agent is alive via `TaskList`. If the agent is gone, respawn it (within the respawn budget).
|
|
123
|
+
4. **After each subagent phase completes, immediately proceed** to the next action:
|
|
124
|
+
- **Planner done** — validate the plan — spawn dev with the plan context
|
|
125
|
+
- **Dev done** — check dev output for completeness — spawn reviewer with branch context
|
|
126
|
+
- **Reviewer done** — immediately proceed to PR creation (rebase, `gh pr create`, auto-merge)
|
|
127
|
+
5. **Never passively wait** — if you have nothing to do, run `TaskList` to confirm all agents are healthy.
|
|
128
|
+
|
|
129
|
+
### What To Do When An Agent Is Missing
|
|
130
|
+
|
|
131
|
+
If `TaskList` shows an agent is no longer running:
|
|
132
|
+
1. Check the last output/events from that agent
|
|
133
|
+
2. If the agent completed its work (sent its deliverable), proceed to the next phase
|
|
134
|
+
3. If the agent exited without delivering, respawn it with the same task plus any additional context from the failed attempt
|
|
135
|
+
|
|
136
|
+
### Respawn Budget
|
|
137
|
+
|
|
138
|
+
**Maximum 5 total subagent spawns per team run.** This includes all initial spawns and all respawns across all agent types (planner, dev, reviewer).
|
|
139
|
+
|
|
140
|
+
- Track your spawn count. Each `TaskCreate` call increments the count.
|
|
141
|
+
- If you reach 5 spawns and an agent exits without delivering, **do NOT respawn**. Instead:
|
|
142
|
+
1. Take over the agent's role yourself (TL fallback).
|
|
143
|
+
2. If the role is too complex to take over (e.g., full implementation), report BLOCKED to FC.
|
|
144
|
+
- This budget prevents respawn storms that waste time and resources without making progress.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Phase 1 — Analysis
|
|
149
|
+
|
|
150
|
+
1. Planner (spawned in Phase 0) reads the issue, explores the codebase, discovers guidebooks, and produces a structured plan
|
|
151
|
+
2. **Planner sends the plan to TL via `SendMessage`**
|
|
152
|
+
3. TL validates the plan has all required fields (see format below)
|
|
153
|
+
4. TL evaluates the plan:
|
|
154
|
+
- `BLOCKED=yes` → state Blocked, comment on issue, STOP
|
|
155
|
+
- `BLOCKED=no` → proceed to Phase 2 (spawn dev with the plan)
|
|
156
|
+
- Missing required fields → ask Planner to redo with specific gaps identified
|
|
157
|
+
|
|
158
|
+
### Plan Format
|
|
159
|
+
|
|
160
|
+
The Planner produces a plan in this format:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
## Plan for Issue #{N}
|
|
164
|
+
|
|
165
|
+
### Language/Framework
|
|
166
|
+
{primary language} / {framework(s)}
|
|
167
|
+
|
|
168
|
+
### Guidebooks
|
|
169
|
+
- {path/to/guidebook1.md}
|
|
170
|
+
- {path/to/guidebook2.md}
|
|
171
|
+
- (none found)
|
|
172
|
+
|
|
173
|
+
### Type
|
|
174
|
+
{single | mixed} — {developer mapping}
|
|
175
|
+
|
|
176
|
+
### Key Files
|
|
177
|
+
- {path} — {what changes and why}
|
|
178
|
+
|
|
179
|
+
### What Needs to Change
|
|
180
|
+
{Detailed analysis with implementation approach}
|
|
181
|
+
|
|
182
|
+
### Risks
|
|
183
|
+
- {specific risk or edge case}
|
|
184
|
+
|
|
185
|
+
### Blocked
|
|
186
|
+
no | yes — {reason}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Edge Case: Planner Fails
|
|
190
|
+
|
|
191
|
+
If the Planner is unresponsive for >5 minutes or produces an unusable plan:
|
|
192
|
+
1. TL performs a quick analysis directly: read `CLAUDE.md`, scan the issue, identify key files
|
|
193
|
+
2. Produce a minimal plan (Key Files + What Needs to Change + Type is enough)
|
|
194
|
+
3. Proceed to Phase 2 — spawn dev with the TL-produced plan
|
|
195
|
+
4. Do NOT spend more than a few minutes on this — a good-enough plan is better than a perfect one
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Phase 2 — Implementation
|
|
200
|
+
|
|
201
|
+
1. **TL spawns `fleet-dev`** with the planner's plan included in the task prompt (see Dev Task Format below)
|
|
202
|
+
2. Dev starts implementing immediately — it has the plan, guidebook paths, and all context it needs
|
|
203
|
+
3. Dev implements, tests locally, commits atomically
|
|
204
|
+
4. **Dev sends review request directly to TL** via `SendMessage`: "Ready for review. Branch: `{branch}`"
|
|
205
|
+
5. TL transitions to Phase 3 — spawns reviewer
|
|
206
|
+
|
|
207
|
+
### Dev Task Format (sent via TaskCreate at spawn)
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
ISSUE: #{N} {title}
|
|
211
|
+
BRANCH: {feat|fix|test}/{N}-{short-desc}
|
|
212
|
+
BASE: {{BASE_BRANCH}}
|
|
213
|
+
|
|
214
|
+
PLAN:
|
|
215
|
+
{paste the full planner's plan here}
|
|
216
|
+
|
|
217
|
+
GUIDEBOOKS (read these before implementing):
|
|
218
|
+
{list of guidebook paths extracted from the plan}
|
|
219
|
+
|
|
220
|
+
INSTRUCTIONS:
|
|
221
|
+
1. Read CLAUDE.md in the project root
|
|
222
|
+
2. Read each guidebook file listed above
|
|
223
|
+
3. Parse the planner's plan for implementation details
|
|
224
|
+
4. Implement the changes described in the plan
|
|
225
|
+
5. Follow conventions from CLAUDE.md and guidebooks
|
|
226
|
+
6. Run build + tests locally before reporting ready
|
|
227
|
+
7. Commit atomically: "Issue #{N}: {description}"
|
|
228
|
+
8. Push the branch and report "Ready for review. Branch: {branch}" to TL
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Mixed-Language Work
|
|
232
|
+
|
|
233
|
+
For mixed-type issues (e.g., C# backend + TypeScript frontend):
|
|
234
|
+
1. Spawn the primary dev first (larger scope)
|
|
235
|
+
2. When primary dev completes, spawn secondary dev with `blockedBy` dependency
|
|
236
|
+
3. Wait for both to complete before review
|
|
237
|
+
|
|
238
|
+
### Edge Case: Dev Gets Stuck
|
|
239
|
+
|
|
240
|
+
- FC's stuck detector will nudge TL if the team is idle too long
|
|
241
|
+
- TL checks if the dev agent is still active (TaskList)
|
|
242
|
+
- If dev is stuck: send a message with more context, hints, or simplified scope
|
|
243
|
+
- If dev is unresponsive after nudge: stop the dev agent, spawn a fresh one with additional context from the failed attempt
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Phase 3 — Review (Peer-to-Peer)
|
|
248
|
+
|
|
249
|
+
1. **TL spawns `fleet-reviewer`** with the branch name, issue context, and guidebook paths (see Reviewer Task Format below)
|
|
250
|
+
2. Reviewer starts reviewing immediately — it has all the context it needs
|
|
251
|
+
3. **Dev and reviewer already know each other's names** (set at spawn time). No TL introduction needed.
|
|
252
|
+
4. **TL steps back.** The dev-reviewer loop runs peer-to-peer:
|
|
253
|
+
- Reviewer performs two-pass review (code quality + acceptance)
|
|
254
|
+
- **REJECT** → reviewer sends actionable feedback directly to dev → dev fixes and re-requests review from reviewer directly
|
|
255
|
+
- **APPROVE** → reviewer notifies TL with the final verdict
|
|
256
|
+
5. TL monitors but does NOT intervene unless:
|
|
257
|
+
- **3 review rounds exhausted** → TL arbitrates (see Error Handling)
|
|
258
|
+
- **Agent stuck** (5min idle) → TL sends a nudge
|
|
259
|
+
- **Escalation request** from either agent → TL steps in
|
|
260
|
+
|
|
261
|
+
### Reviewer Task Format (sent via TaskCreate at spawn)
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
ISSUE: #{N} {title}
|
|
265
|
+
BRANCH: {branch_name}
|
|
266
|
+
BASE: {{BASE_BRANCH}}
|
|
267
|
+
|
|
268
|
+
GUIDEBOOKS (read these to verify compliance):
|
|
269
|
+
{list of guidebook paths from the plan}
|
|
270
|
+
|
|
271
|
+
INSTRUCTIONS:
|
|
272
|
+
1. Read CLAUDE.md in the project root
|
|
273
|
+
2. Read each guidebook file listed above
|
|
274
|
+
3. Review the changes on the branch against the base branch
|
|
275
|
+
4. Two-pass review: code quality + acceptance criteria from the issue
|
|
276
|
+
5. Send rejection feedback DIRECTLY to dev via SendMessage
|
|
277
|
+
6. Send final APPROVE or REJECT verdict to TL (me)
|
|
278
|
+
|
|
279
|
+
PEERS:
|
|
280
|
+
- Dev agent name: dev
|
|
281
|
+
- Send rejection feedback DIRECTLY to dev via SendMessage
|
|
282
|
+
- Send final APPROVE or REJECT verdict to TL (me)
|
|
283
|
+
|
|
284
|
+
If you reject, include a numbered list of specific, actionable fixes with file:line references.
|
|
285
|
+
Dev will fix and message you directly when ready for re-review.
|
|
286
|
+
Max 3 review rounds total (initial + 2 re-reviews).
|
|
287
|
+
After 3rd rejection, report BLOCKED to TL.
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### TL Non-Intervention Rules
|
|
291
|
+
|
|
292
|
+
During the dev↔reviewer loop, TL MUST NOT:
|
|
293
|
+
- Relay messages between dev and reviewer (they talk directly)
|
|
294
|
+
- Ask "how's it going?" before an agent is stuck (5min)
|
|
295
|
+
- Override reviewer's verdict (until round 3 escalation)
|
|
296
|
+
- Tell dev to skip fixing a review comment
|
|
297
|
+
- Inject new requirements not in the original issue
|
|
298
|
+
|
|
299
|
+
TL MAY:
|
|
300
|
+
- Respond to FC messages (ci_red, nudge_stuck, etc.)
|
|
301
|
+
- Intervene on escalation from either agent
|
|
302
|
+
- Arbitrate after 3 failed review rounds
|
|
303
|
+
- Nudge an agent that has been idle for 5+ minutes
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Phase 4 — PR
|
|
308
|
+
|
|
309
|
+
After reviewer sends APPROVE to TL:
|
|
310
|
+
|
|
311
|
+
1. **Branch freshness check** (MANDATORY):
|
|
312
|
+
```bash
|
|
313
|
+
git stash --include-untracked && git fetch origin {{BASE_BRANCH}} && git rebase origin/{{BASE_BRANCH}} && git stash pop && git push --force-with-lease
|
|
314
|
+
```
|
|
315
|
+
The `git stash --include-untracked` is required because the CC runtime may leave unstaged changes (e.g., `.claude/settings.json`) that block rebase.
|
|
316
|
+
If rebase fails (conflicts) → state Blocked.
|
|
317
|
+
|
|
318
|
+
2. **TL creates PR**:
|
|
319
|
+
```bash
|
|
320
|
+
gh pr create --base {{BASE_BRANCH}} --title "Issue #{N}: {description}" --body "Closes #{N}"
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
3. **Set auto-merge immediately** (mandatory, no exceptions):
|
|
324
|
+
```bash
|
|
325
|
+
gh pr merge {PR} --auto --squash --delete-branch
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
4. Wait for FC to send CI status via stdin:
|
|
329
|
+
- `ci_green` → auto-merge handles merge → wait for `pr_merged`
|
|
330
|
+
- `ci_red` → TL forwards failure details to dev → dev fixes and pushes
|
|
331
|
+
- After 3 unique CI failure types → state Blocked (FC sends `ci_blocked`)
|
|
332
|
+
- `pr_merged` → state Done
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Phase 5 — Done
|
|
337
|
+
|
|
338
|
+
1. Close issue: `gh issue close {N} --comment "Closed. PR #{PR} merged."`
|
|
339
|
+
2. **Explicit shutdown sequence** (MANDATORY):
|
|
340
|
+
a. Run `TaskList` to identify all active subagents.
|
|
341
|
+
b. For each active subagent, send `shutdown_request` via `TaskUpdate`.
|
|
342
|
+
c. Run `TaskList` again to verify all subagents have exited.
|
|
343
|
+
d. If any subagent is still running after shutdown_request, send a second shutdown_request, then proceed regardless.
|
|
344
|
+
3. TL finishes
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## BLOCKED State
|
|
349
|
+
|
|
350
|
+
Entered from any phase when the team cannot proceed:
|
|
351
|
+
1. Comment on the issue explaining what blocks progress
|
|
352
|
+
2. Report blocker details to FC (visible in dashboard)
|
|
353
|
+
3. STOP all work — wait for PM instructions from FC dashboard
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## FC Messages
|
|
358
|
+
|
|
359
|
+
Fleet Commander sends these messages directly to the TL via stdin. They arrive automatically — no polling needed.
|
|
360
|
+
|
|
361
|
+
| Message ID | When | Content |
|
|
362
|
+
|------------|------|---------|
|
|
363
|
+
| `ci_green` | CI passes on PR | "CI passed on PR #{PR}. All checks green. Auto-merge is {status}." |
|
|
364
|
+
| `ci_red` | CI fails on PR | "CI failed on PR #{PR}. Failing checks: {details}. Fix count: {N}/{max}." |
|
|
365
|
+
| `ci_blocked` | Too many CI failures | "STOP. {N} unique CI failure types on PR #{PR}. Wait for instructions." |
|
|
366
|
+
| `pr_merged` | PR is merged | "PR #{PR} merged. Close the issue, clean up, and finish." |
|
|
367
|
+
| `nudge_idle` | Team idle 3+ min | "FC status check: You've been idle for {N} minutes. If waiting for subagents, run TaskList to verify they are still active. If a phase just completed, proceed to the next step." |
|
|
368
|
+
| `nudge_stuck` | Team stuck 5+ min | "You appear stuck. Report status or ask for help." |
|
|
369
|
+
|
|
370
|
+
### TL Response to FC Messages
|
|
371
|
+
|
|
372
|
+
**On `ci_green`**: Auto-merge will handle the merge. Acknowledge and wait for `pr_merged`.
|
|
373
|
+
|
|
374
|
+
**On `ci_red`**: Forward failure details to dev. Dev fixes and pushes. This counts toward the failure limit.
|
|
375
|
+
|
|
376
|
+
**On `ci_blocked`**: STOP all work. Wait for PM instructions from the dashboard.
|
|
377
|
+
|
|
378
|
+
**On `pr_merged`**: Close the issue, shut down agents (`shutdown_request` to all), finish.
|
|
379
|
+
|
|
380
|
+
**On `nudge_idle`**: Run `TaskList` to verify all subagents are alive. If any agent is missing or crashed, respawn it. Report current status to FC.
|
|
381
|
+
|
|
382
|
+
**On `nudge_stuck`**: Check which agent is stuck. Send a targeted nudge. If no progress after nudge, escalate to FC by reporting status.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Error Handling
|
|
387
|
+
|
|
388
|
+
### Agent Spawn Failure
|
|
389
|
+
|
|
390
|
+
If spawning any agent fails:
|
|
391
|
+
1. **Retry once** — wait 5 seconds, attempt spawn again
|
|
392
|
+
2. **If retry fails** — TL takes over that agent's role:
|
|
393
|
+
- Planner fails → TL does the analysis themselves
|
|
394
|
+
- Dev fails → TL implements the code themselves
|
|
395
|
+
- Reviewer fails → TL reviews the code themselves (still two-pass)
|
|
396
|
+
3. Log the failure for FC visibility (FC sees it via hooks)
|
|
397
|
+
|
|
398
|
+
### Test Failure During Implementation
|
|
399
|
+
|
|
400
|
+
1. Dev runs tests locally before reporting "ready for review"
|
|
401
|
+
2. If tests fail → dev fixes and re-runs until green
|
|
402
|
+
3. Dev does NOT report "ready for review" with failing tests
|
|
403
|
+
4. If dev cannot fix tests after reasonable effort → dev reports blocker to TL → TL may assist or escalate
|
|
404
|
+
|
|
405
|
+
### Review Loop Stuck (3 Rounds Exhausted)
|
|
406
|
+
|
|
407
|
+
After 3 review rounds (initial + 2 fix rounds) with REJECT:
|
|
408
|
+
1. Reviewer sends `BLOCKED — 3 review rounds exhausted` to TL
|
|
409
|
+
2. TL reads the latest rejection feedback and the current code
|
|
410
|
+
3. TL arbitrates:
|
|
411
|
+
- If remaining issues are minor nits → TL overrides and proceeds to PR
|
|
412
|
+
- If remaining issues are substantive → TL sends specific guidance to dev for one final attempt
|
|
413
|
+
- If fundamentally broken → state Blocked, comment on issue
|
|
414
|
+
|
|
415
|
+
### Dev and Reviewer Disagree
|
|
416
|
+
|
|
417
|
+
If the same issue bounces back and forth between dev and reviewer:
|
|
418
|
+
- After round 2, if the same point is still contested, reviewer escalates to TL
|
|
419
|
+
- TL reads the diff and the reviewer's feedback
|
|
420
|
+
- TL arbitrates: either side with the reviewer (dev must fix) or override the reviewer (approve with noted exception)
|
|
421
|
+
|
|
422
|
+
### CI Failure Handling
|
|
423
|
+
|
|
424
|
+
1. `ci_red` received → TL forwards failure details to dev
|
|
425
|
+
2. Dev fixes the failing tests/checks and pushes
|
|
426
|
+
3. Progress on the same failure type does NOT count as a new unique failure
|
|
427
|
+
4. After 3 unique failure types → state Blocked (FC sends `ci_blocked`)
|
|
428
|
+
|
|
429
|
+
### Rebase Conflict
|
|
430
|
+
|
|
431
|
+
1. If `git stash --include-untracked && git rebase origin/{{BASE_BRANCH}}` fails with conflicts → state Blocked
|
|
432
|
+
2. Comment on issue explaining the conflict
|
|
433
|
+
3. STOP — do not attempt manual conflict resolution across worktrees
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Branch Naming
|
|
438
|
+
|
|
439
|
+
The TL determines the branch name based on the issue type and provides it to the dev in the task prompt:
|
|
440
|
+
|
|
441
|
+
| Prefix | Use |
|
|
442
|
+
|--------|-----|
|
|
443
|
+
| `feat/{N}-{desc}` | New feature |
|
|
444
|
+
| `fix/{N}-{desc}` | Bug fix |
|
|
445
|
+
| `test/{N}-{desc}` | Test-only changes |
|
|
446
|
+
|
|
447
|
+
### Commit Format
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
Issue #{N}: {description}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Atomic commits — each commit should be a logical unit.
|
|
454
|
+
|
|
455
|
+
### Build Before Review
|
|
456
|
+
|
|
457
|
+
**MANDATORY before reporting "ready for review"**: dev must run the project build and any new tests locally. This prevents unnecessary review iteration.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Rules
|
|
462
|
+
|
|
463
|
+
- **One issue at a time** — atomic changes only
|
|
464
|
+
- **CI must be green** — PR CANNOT be merged with red CI
|
|
465
|
+
- **Branch from {{BASE_BRANCH}}** — NEVER commit directly to {{BASE_BRANCH}}
|
|
466
|
+
- **TL creates the PR** — dev pushes code, TL creates the PR and sets auto-merge
|
|
467
|
+
- **P2P for review** — dev and reviewer talk directly, TL does not relay
|
|
468
|
+
- **Idle = normal** — agents waiting for messages are expected to be idle
|
|
469
|
+
- **TL intervenes only on escalation, stuck, or PR** — do not micromanage the dev↔reviewer loop
|
|
470
|
+
- **Respond to FC messages promptly** — FC messages arrive via stdin and require action
|
|
471
|
+
- **TL does not implement** — spawn subagents for all work (except planner fallback)
|
|
472
|
+
- **Planner failure is not fatal** — TL can produce a minimal plan if planner fails
|
|
473
|
+
|
|
474
|
+
## Anti-Patterns
|
|
475
|
+
|
|
476
|
+
| Wrong | Right |
|
|
477
|
+
|-------|-------|
|
|
478
|
+
| TL relays messages between dev and reviewer | Dev and reviewer talk directly (p2p) |
|
|
479
|
+
| TL asks "how's it going?" every minute | Wait for report or 5min stuck threshold |
|
|
480
|
+
| TL implements code while dev is active | Let dev do the implementation |
|
|
481
|
+
| TL overrides reviewer without reading feedback | Read feedback, arbitrate only after 3 rounds |
|
|
482
|
+
| Dev pushes without local tests | Build + tests locally BEFORE reporting ready |
|
|
483
|
+
| Dev pushes without rebase | ALWAYS stash + rebase on {{BASE_BRANCH}} before push |
|
|
484
|
+
| Respawning agents endlessly | Max 5 total spawns — then TL takes over or reports BLOCKED |
|
|
485
|
+
| Checking out {{BASE_BRANCH}} in a worktree | NEVER checkout {{BASE_BRANCH}} — use `origin/{{BASE_BRANCH}}` as reference |
|
|
486
|
+
| Dev creates the PR | TL creates the PR after APPROVE |
|
|
487
|
+
| Spawning a coordinator / 4th agent | Diamond team is exactly 3 agents: planner, dev, reviewer |
|
|
488
|
+
| Spawning all 3 agents at once before analysis is done | Spawn sequentially: planner first, then dev with plan, then reviewer after dev ready |
|
|
489
|
+
| Ignoring FC messages | Always respond to ci_green, ci_red, pr_merged, nudges |
|
|
490
|
+
| Respawning agent after 2 min idle | Idle is normal — only act at 5min stuck threshold |
|
|
491
|
+
| TL monitors CI manually | FC handles CI monitoring and sends updates via stdin |
|
|
492
|
+
| TL goes idle after spawning agents without monitoring | TL runs active monitoring loop between phases |
|
|
493
|
+
|
|
494
|
+
## Decision Summary
|
|
495
|
+
|
|
496
|
+
```
|
|
497
|
+
Phase 0: TL → spawn planner only
|
|
498
|
+
Phase 1: Planner analyzes → sends plan to TL → planner stays alive for p2p questions
|
|
499
|
+
TL validates plan → spawns dev WITH the plan context
|
|
500
|
+
Phase 2: Dev implements immediately (has plan) → reports "ready for review" to TL
|
|
501
|
+
TL spawns reviewer WITH branch context
|
|
502
|
+
Phase 3: Reviewer reviews immediately (has branch) → dev + reviewer iterate p2p → reviewer reports verdict to TL
|
|
503
|
+
Phase 4: TL → rebase → create PR → set auto-merge → FC monitors CI
|
|
504
|
+
Phase 5: TL → close issue → shutdown agents → finish
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Edge cases:
|
|
508
|
+
- Planner fails → TL does quick analysis, produces plan, spawns dev with it
|
|
509
|
+
- Planner declares BLOCKED → TL reports blocked, STOP
|
|
510
|
+
- Dev stuck → TL nudges, then restarts with more context
|
|
511
|
+
- 3 rejections → TL arbitrates: simplify, override nits, restart dev, or abort
|
|
512
|
+
- Dev/Reviewer disagree → TL arbitrates after round 2
|
|
513
|
+
- CI blocked → STOP, wait for PM
|