Skip to content

Commit 67b2129

Browse files
author
catlog22
committed
Refactor code structure for improved readability and maintainability
1 parent 19fb4d8 commit 67b2129

60 files changed

Lines changed: 3018 additions & 659 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/agents/team-worker.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,15 @@ After Phase 4 completes, determine Phase 5 variant:
237237
### Phase 5-L: Loop Completion (when inner_loop=true AND more same-prefix tasks pending)
238238

239239
1. **TaskUpdate**: Mark current task `completed`
240-
2. **Message Bus**: Log completion
240+
2. **Message Bus**: Log completion with verification evidence
241241
```
242242
mcp__ccw-tools__team_msg(
243243
operation="log",
244244
team=<session_id>,
245245
from=<role>,
246246
to="coordinator",
247247
type=<message_types.success>,
248-
summary="[<role>] <task-id> complete. <brief-summary>",
248+
summary="[<role>] <task-id> complete. <brief-summary>. Verified: <verification_method>",
249249
ref=<artifact-path>
250250
)
251251
```
@@ -283,7 +283,7 @@ After Phase 4 completes, determine Phase 5 variant:
283283
| Condition | Action |
284284
|-----------|--------|
285285
| Same-prefix successor (inner loop role) | Do NOT spawn — main agent handles via inner loop |
286-
| 1 ready task, simple linear successor, different prefix | Spawn directly via `Task(run_in_background: true)` |
286+
| 1 ready task, simple linear successor, different prefix | Spawn directly via `Task(run_in_background: true)` + log `fast_advance` to message bus |
287287
| Multiple ready tasks (parallel window) | SendMessage to coordinator (needs orchestration) |
288288
| No ready tasks + others running | SendMessage to coordinator (status update) |
289289
| No ready tasks + nothing running | SendMessage to coordinator (pipeline may be complete) |
@@ -311,6 +311,23 @@ inner_loop: <true|false based on successor role>`
311311
})
312312
```
313313

314+
### Fast-Advance Notification
315+
316+
After spawning a successor via fast-advance, MUST log to message bus:
317+
318+
```
319+
mcp__ccw-tools__team_msg(
320+
operation="log",
321+
team=<session_id>,
322+
from=<role>,
323+
to="coordinator",
324+
type="fast_advance",
325+
summary="[<role>] fast-advanced <completed-task-id> → spawned <successor-role> for <successor-task-id>"
326+
)
327+
```
328+
329+
This is a passive log entry (NOT a SendMessage). Coordinator reads it on next callback to reconcile `active_workers`.
330+
314331
### SendMessage Format
315332

316333
```
@@ -320,8 +337,10 @@ SendMessage(team_name=<team_name>, recipient="coordinator", message="[<role>] <f
320337
**Final report contents**:
321338
- Tasks completed (count + list)
322339
- Artifacts produced (paths)
340+
- Files modified (paths + before/after evidence from Phase 4 verification)
323341
- Discuss results (verdicts + ratings)
324342
- Key decisions (from context_accumulator)
343+
- Verification summary (methods used, pass/fail status)
325344
- Any warnings or issues
326345

327346
---

.claude/skills/team-coordinate-v2/roles/coordinator/commands/analyze-task.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,26 @@ Apply merging rules to reduce role count (cap at 5).
9090

9191
### Step 6: Role-Spec Metadata Assignment
9292

93-
For each role, determine frontmatter fields:
93+
For each role, determine frontmatter and generation hints:
9494

9595
| Field | Derivation |
9696
|-------|------------|
9797
| `prefix` | From capability prefix (e.g., RESEARCH, DRAFT, IMPL) |
9898
| `inner_loop` | `true` if role has 2+ serial same-prefix tasks |
99-
| `subagents` | Inferred from responsibility type: orchestration -> [explore], code-gen (docs) -> [explore], validation -> [] |
99+
| `subagents` | Suggested, not mandatory — coordinator may adjust based on task needs |
100+
| `pattern_hint` | Reference pattern name from role-spec-template (research/document/code/analysis/validation) — guides coordinator's Phase 2-4 composition, NOT a rigid template selector |
101+
| `output_type` | `artifact` (new files in session/artifacts/) / `codebase` (modify existing project files) / `mixed` (both) — determines verification strategy in Behavioral Traits |
100102
| `message_types.success` | `<prefix>_complete` |
101103
| `message_types.error` | `error` |
102104

105+
**output_type derivation**:
106+
107+
| Task Signal | output_type | Example |
108+
|-------------|-------------|---------|
109+
| "write report", "analyze", "research" | `artifact` | New analysis-report.md in session |
110+
| "update docs", "modify code", "fix bug" | `codebase` | Modify existing project files |
111+
| "implement feature + write summary" | `mixed` | Code changes + implementation summary |
112+
103113
## Phase 4: Output
104114

105115
Write `<session-folder>/task-analysis.json`:
@@ -132,6 +142,8 @@ Write `<session-folder>/task-analysis.json`:
132142
"inner_loop": false,
133143
"role_spec_metadata": {
134144
"subagents": ["explore"],
145+
"pattern_hint": "research",
146+
"output_type": "artifact",
135147
"message_types": {
136148
"success": "research_complete",
137149
"error": "error"

.claude/skills/team-coordinate-v2/roles/coordinator/commands/monitor.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ Receive callback from [<role>]
6060
+- None completed -> STOP
6161
```
6262

63-
**Fast-advance note**: A worker may have already spawned its successor via fast-advance. When processing a callback:
64-
1. Check if the expected next task is already `in_progress` (fast-advanced)
65-
2. If yes -> skip spawning that task, update active_workers to include the fast-advanced worker
66-
3. If no -> normal handleSpawnNext
63+
**Fast-advance reconciliation**: A worker may have already spawned its successor via fast-advance. When processing any callback or resume:
64+
1. Read recent `fast_advance` messages from team_msg (type="fast_advance")
65+
2. For each fast_advance message: add the spawned successor to `active_workers` if not already present
66+
3. Check if the expected next task is already `in_progress` (fast-advanced)
67+
4. If yes -> skip spawning that task (already running)
68+
5. If no -> normal handleSpawnNext
6769

6870
---
6971

@@ -262,6 +264,13 @@ handleCallback / handleResume detects:
262264
4. -> handleSpawnNext (will re-spawn the task normally)
263265
```
264266

267+
### Fast-Advance State Sync
268+
269+
On every coordinator wake (handleCallback, handleResume, handleCheck):
270+
1. Read team_msg entries with `type="fast_advance"` since last coordinator wake
271+
2. For each entry: sync `active_workers` with the spawned successor
272+
3. This ensures coordinator's state reflects fast-advance decisions even before the successor's callback arrives
273+
265274
### Consensus-Blocked Handling
266275

267276
```

.claude/skills/team-coordinate-v2/roles/coordinator/role.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,15 @@ Regardless of complexity score or role count, coordinator MUST:
182182

183183
4. **Call TeamCreate** with team name derived from session ID
184184

185-
5. **Read `specs/role-spec-template.md`** + task-analysis.json
185+
5. **Read `specs/role-spec-template.md`** for Behavioral Traits + Reference Patterns
186186

187187
6. **For each role in task-analysis.json#roles**:
188-
- Fill role-spec template with:
189-
- YAML frontmatter: role, prefix, inner_loop, subagents, message_types
190-
- Phase 2-4 content from responsibility type reference sections in template
191-
- Task-specific instructions from task description
188+
- Fill YAML frontmatter: role, prefix, inner_loop, subagents, message_types
189+
- **Compose Phase 2-4 content** (NOT copy from template):
190+
- Phase 2: Derive input sources and context loading steps from **task description + upstream dependencies**
191+
- Phase 3: Describe **execution goal** (WHAT to achieve) from task description — do NOT prescribe specific subagent or tool
192+
- Phase 4: Combine **Behavioral Traits** (from template) + **output_type** (from task analysis) to compose verification steps
193+
- Reference Patterns may guide phase structure, but task description determines specific content
192194
- Write generated role-spec to `<session>/role-specs/<role-name>.md`
193195

194196
7. **Register roles** in team-session.json#roles (with `role_spec` path instead of `role_file`)

0 commit comments

Comments
 (0)