cc-workspace 4.7.1 → 5.2.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +291 -0
  2. package/README.md +123 -41
  3. package/bin/cli.js +313 -134
  4. package/global-skills/agents/e2e-validator.md +151 -32
  5. package/global-skills/agents/implementer.md +77 -71
  6. package/global-skills/agents/reviewer.md +192 -0
  7. package/global-skills/agents/security-auditor.md +345 -0
  8. package/global-skills/agents/team-lead.md +93 -101
  9. package/global-skills/agents/workspace-init.md +16 -5
  10. package/global-skills/bootstrap-repo/SKILL.md +1 -0
  11. package/global-skills/cleanup/SKILL.md +35 -25
  12. package/global-skills/cross-service-check/SKILL.md +1 -0
  13. package/global-skills/cycle-retrospective/SKILL.md +6 -4
  14. package/global-skills/dispatch-feature/SKILL.md +225 -173
  15. package/global-skills/dispatch-feature/references/anti-patterns.md +52 -35
  16. package/global-skills/dispatch-feature/references/spawn-templates.md +140 -97
  17. package/global-skills/doctor/SKILL.md +124 -25
  18. package/global-skills/e2e-validator/references/container-strategies.md +55 -23
  19. package/global-skills/hooks/orphan-cleanup.sh +60 -0
  20. package/global-skills/hooks/permission-auto-approve.sh +61 -4
  21. package/global-skills/hooks/session-start-context.sh +10 -47
  22. package/global-skills/hooks/test_hooks.sh +242 -0
  23. package/global-skills/hooks/user-prompt-guard.sh +6 -6
  24. package/global-skills/hooks/validate-spawn-prompt.sh +40 -30
  25. package/global-skills/incident-debug/SKILL.md +1 -0
  26. package/global-skills/merge-prep/SKILL.md +1 -0
  27. package/global-skills/metrics/SKILL.md +139 -0
  28. package/global-skills/plan-review/SKILL.md +2 -1
  29. package/global-skills/qa-ruthless/SKILL.md +2 -0
  30. package/global-skills/refresh-profiles/SKILL.md +1 -0
  31. package/global-skills/rules/context-hygiene.md +4 -19
  32. package/global-skills/rules/model-routing.md +31 -18
  33. package/global-skills/session/SKILL.md +41 -20
  34. package/global-skills/templates/workspace.template.md +1 -1
  35. package/package.json +4 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,291 @@
1
+ # Changelog
2
+
3
+ ## [5.2.1] — 2026-03-06
4
+
5
+ ### Prompt quality improvements
6
+
7
+ - **`dispatch-feature` Phase 0** — added concrete few-shot examples for good vs bad
8
+ clarification questions. Models produce significantly better clarifications with
9
+ examples to anchor on.
10
+
11
+ - **`dispatch-feature` modes B/C/D** — expanded from 1-line descriptions to detailed
12
+ step-by-step procedures. Mode B specifies exploration-first flow, Mode C specifies
13
+ retroactive plan creation and scoped post-impl, Mode D defers to its dedicated section.
14
+ Reduces improvisation risk on non-default modes.
15
+
16
+ - **`dispatch-feature` Phase 4 micro-QA** — Haiku diff review prompt is now referenced
17
+ from `@references/spawn-templates.md` instead of being inlined. Prevents prompt
18
+ corruption when Opus reformulates the template. The canonical template in
19
+ spawn-templates.md (section "Haiku micro-QA subagent template") is the single
20
+ source of truth.
21
+
22
+ ### Bug fixes
23
+
24
+ - **`workspace-init` Phase 2** — fixed stale references to global `~/.claude/skills/`
25
+ and `~/.claude/rules/` (removed in v5.2.0). Phase 2 now correctly checks local
26
+ `orchestrator/.claude/skills/` and `.claude/rules/`, and checks global agents
27
+ separately with the full list of 6 agents.
28
+
29
+ - **CLI `doctor`** — skill count check is now dynamic (reads from package's
30
+ `global-skills/` directory) instead of hardcoded `13`. Adding or removing skills
31
+ no longer requires updating the doctor check.
32
+
33
+ - **CLI `session close`** — now checks for `gh` CLI availability before offering PR
34
+ creation. If `gh` is not installed, the PR step is skipped with a helpful message
35
+ instead of failing silently on user confirmation.
36
+
37
+ - **CLI cleanup** — removed obsolete tombstone comment about `generateBlockHook()`
38
+ (removed in v4.1.4).
39
+
40
+ ## [5.2.0] — 2026-03-06
41
+
42
+ ### Breaking changes
43
+
44
+ - **Skills and rules are now LOCAL** — installed in `orchestrator/.claude/skills/` and
45
+ `orchestrator/.claude/rules/` instead of `~/.claude/skills/` and `~/.claude/rules/`.
46
+ Only agents remain global (`~/.claude/agents/`) because `claude --agent` requires it.
47
+ This means Claude sessions outside orchestrator/ no longer inherit cc-workspace rules
48
+ and skills — Claude behaves normally when used outside orchestrator context.
49
+
50
+ - **Automatic legacy cleanup** — `npx cc-workspace update --force` removes old global
51
+ skills and rules from `~/.claude/` (from versions < 5.2). Only cc-workspace-owned
52
+ entries are removed; user-created skills/rules are untouched.
53
+
54
+ ### New agents
55
+
56
+ - **`reviewer`** — Senior code review agent (Opus). Evidence-based: every comment requires
57
+ file:line + code snippet + justification. Anchored on constitution + CLAUDE.md + plan,
58
+ NEVER on existing legacy code (safe for projects in active refactoring). Mandatory scope
59
+ check (plan vs implemented). Standalone via `claude --agent reviewer` or invoked in
60
+ dispatch-feature Phase 5 after qa-ruthless.
61
+
62
+ - **`security-auditor`** — Security audit agent (Opus). 7-phase systematic audit:
63
+ auth flow tracing (endpoint × middleware mapping), tenant isolation (model × scoping check),
64
+ secrets scan (hardcoded values, committed .env, frontend bundle exposure), dependency CVEs
65
+ (npm audit / composer audit with grep fallback), input validation & injection vectors
66
+ (SQL, XSS, command, deserialization), headers & CORS, and session-scoped delta analysis
67
+ (separates NEW findings from PRE-EXISTING). Conditional in Phase 5 — triggered when plan
68
+ involves auth changes, tenant-scoped models, file uploads, payment data, or new public
69
+ endpoints. Standalone via `claude --agent security-auditor`.
70
+
71
+ ### Changes
72
+
73
+ - **`qa-ruthless`** — added explicit `model: opus` in frontmatter. Previously inherited
74
+ from caller context; now fixed to Opus regardless of invocation method.
75
+
76
+ - **`dispatch-feature` Phase 5** — updated order:
77
+ 1. cross-service-check
78
+ 2. qa-ruthless
79
+ 3. reviewer (new — always)
80
+ 4. security-auditor (new — conditional)
81
+ 5. merge-prep
82
+ 6. cycle-retrospective
83
+
84
+ - **`team-lead`** — workflow table updated for new Phase 5 order with reviewer and
85
+ conditional security-auditor.
86
+
87
+ - **`model-routing.md`** — routing table updated: QA orchestration = Opus (explicit),
88
+ code reviewer = Opus, security auditor = Opus, QA investigators = Sonnet (clarified).
89
+
90
+ - **`doctor`** — refactored for new layout:
91
+ - Skills and rules checked locally in `orchestrator/.claude/` (not globally)
92
+ - Legacy detection: warns if old global skills/rules still exist
93
+ - Agent count updated to 6 (added reviewer, security-auditor)
94
+
95
+ - **`bin/cli.js`** — major refactoring:
96
+ - `installGlobals()`: only installs agents globally; calls `cleanLegacyGlobals()`
97
+ - `cleanLegacyGlobals()` (new): removes cc-workspace skills and rules from `~/.claude/`
98
+ - `setupWorkspace()`: copies skills + rules into `orchestrator/.claude/skills/` and
99
+ `orchestrator/.claude/rules/`
100
+ - `updateLocal()`: now updates skills + rules locally (in addition to hooks, settings,
101
+ templates, CLAUDE.md)
102
+ - `doctor()`: checks skills/rules locally, detects legacy globals
103
+ - `uninstall`: updated for new layout, cleans agents + legacy globals
104
+ - CLAUDE.md content: updated config section, skills/agents count, launch commands
105
+ - Help, post-init summary, and all user-facing messages updated
106
+
107
+ - **All frontmatter** — `prompt_version` bumped to `5.2.0` across all 19 agents and skills.
108
+
109
+ ### Migration from v5.1.x
110
+
111
+ 1. Run `npx cc-workspace update --force` from your workspace root.
112
+ 2. This will:
113
+ - Install 6 agents globally (`~/.claude/agents/`)
114
+ - Install skills + rules locally (`orchestrator/.claude/skills/` and `rules/`)
115
+ - Remove legacy global skills and rules from `~/.claude/`
116
+ - Update hooks, settings, templates, CLAUDE.md
117
+ 3. Run `npx cc-workspace doctor` to verify the new layout.
118
+ 4. Claude sessions outside orchestrator/ will no longer see cc-workspace rules/skills.
119
+
120
+ ## [5.1.0] — 2026-03-05
121
+
122
+ ### Fixes from prompt engineering review
123
+
124
+ - **Version alignment** — `package.json` now matches `prompt_version: 5.1.0` across all agents/skills.
125
+
126
+ - **`--dry-run` flag** — `init` and `update` commands now support `--dry-run` to preview
127
+ all file operations without writing anything. All FS helpers (mkdirp, copyFile, copyDir,
128
+ writeFile, writeVersion, chmod) respect the flag.
129
+
130
+ - **Secure `permission-auto-approve.sh`** — compound commands (`&&`, `||`, `;`, `|`,
131
+ backticks, `$()`) are now rejected before any pattern matching. Prevents hypothetical
132
+ `git branch session/x && malicious-command` bypasses. DRY constant for JSON responses.
133
+
134
+ - **Robust `detectProjectType`** — replaced naive `string.includes()` check with
135
+ `JSON.parse` + `dependencies`/`devDependencies` key lookup. Detects `@quasar/app-vite`,
136
+ `@quasar/app-webpack` explicitly. No more false positives from package names containing
137
+ "next" or "react" as substrings.
138
+
139
+ - **Split `session-start-context.sh`** — extracted orphan worktree cleanup into
140
+ `orphan-cleanup.sh` (new hook). `session-start-context.sh` now handles context injection
141
+ only. Both registered as separate `SessionStart` hooks in `settings.json`.
142
+
143
+ - **Stronger `validate-spawn-prompt.sh`** — constitution detection uses 3 heuristics:
144
+ explicit headers, numbered bold rules (3+ = constitution), and keyword+domain term density.
145
+ Expanded domain keywords (error handling, security, test coverage, etc.).
146
+
147
+ - **JSON format for Haiku micro-QA** — micro-QA template now requests structured JSON
148
+ (`{"status":"OK"}` or `{"status":"BLOCKER","file":"...","line":N,"reason":"..."}`)
149
+ instead of free-text. Updated in both `spawn-templates.md` and `dispatch-feature/SKILL.md`.
150
+
151
+ - **Compact Phase 2.5/2.9** — replaced verbose literal bash blocks with concise semantic
152
+ descriptions + table format. Opus has the concepts; token savings without information loss.
153
+
154
+ - **Clarified `/compact` instruction** — Rule #10 in team-lead now explicitly references
155
+ Claude Code's native `/compact` command rather than vague "compact after each cycle".
156
+
157
+ - **Chrome MCP check in doctor** — new Check 4b verifies Chrome DevTools MCP server
158
+ configuration in both global and project-level settings. Warns if `e2e-validator --chrome`
159
+ would fail due to missing MCP.
160
+
161
+ - **CLI unit tests** — added `test_cli.sh` (comprehensive): version, help, unknown command,
162
+ `--dry-run` (no files written), full `init` (structure + globals + permissions),
163
+ idempotency (user files preserved), `update --force`, project type detection,
164
+ session list. ~50 assertions.
165
+
166
+ ## [5.0.0] — 2026-03-05
167
+
168
+ ### Breaking changes
169
+
170
+ - **Orchestrator now has Bash access** — `disallowedTools: Bash` removed from `team-lead`.
171
+ Opus manages git (branch creation, worktrees) and micro-QA directly. No subagent delegation for git.
172
+
173
+ - **One teammate per repo** — the dispatch model shifts from "one subagent per commit unit"
174
+ to "one teammate per repo". The teammate handles all commit units for its repo sequentially,
175
+ signals after each commit, and waits for orchestrator green light.
176
+
177
+ - **Micro-QA between every commit** — mandatory Bash test run + Haiku diff review after each
178
+ commit before greenlighting the next. This replaces the single final QA-only model.
179
+
180
+ - **Worktrees created after plan validation** — branches and worktrees are set up by Opus
181
+ directly via Bash only after the user validates the plan. No more orphan branches on rejected plans.
182
+
183
+ - **Worktrees persist until session close** — worktrees in `/tmp/` are never pruned during
184
+ an active session. Cleanup happens exclusively in `/session close <n>`.
185
+
186
+ - **cycle-retrospective is mandatory** — now a required Phase 5 step in dispatch-feature,
187
+ not an optional post-cycle task.
188
+
189
+ - **plan-review uses Sonnet** — upgraded from Haiku for constitution compliance checking.
190
+
191
+ ### New features
192
+
193
+ - **Source branch override** — specify a different source branch in the initial prompt
194
+ ("fix on hotfix/payment", "refacto from develop"). Stored in session JSON, used as PR target.
195
+
196
+ - **Session JSON commit tracking** — session `.json` files now track per-repo commit status,
197
+ hash, and QA result for resumability after crashes.
198
+
199
+ - **Worktree removal in session close** — `session close` (CLI and skill) now includes
200
+ a step to remove `/tmp/` worktrees before branch deletion.
201
+
202
+ - **Micro-QA Haiku template** — new spawn template in `spawn-templates.md` for the
203
+ structured diff-only review subagent used in Phase 4.
204
+
205
+ ### Changes
206
+
207
+ - `team-lead.md` — removed `disallowedTools: Bash`, added Phase 4 micro-QA flow,
208
+ updated dispatch model to one teammate per repo, added git setup instructions (Phase 2.5).
209
+
210
+ - `implementer.md` — removed all git setup responsibility (worktree creation, branch creation).
211
+ Implementer receives a ready worktree path. Added SendMessage signal + wait protocol.
212
+ `maxTurns` increased from 60 to 120 for multi-commit sessions.
213
+
214
+ - `dispatch-feature/SKILL.md` — Phase 1 uses Opus direct exploration (no upfront Haiku scan).
215
+ Phase 2.5 documents Opus-direct git setup. Phase 3 redesigned for one-teammate-per-repo.
216
+ Phase 4 (micro-QA) is new. Phase 5 adds mandatory cycle-retrospective.
217
+
218
+ - `dispatch-feature/references/spawn-templates.md` — full rewrite for one-teammate-per-repo
219
+ model. New backend, frontend, infra, and Haiku micro-QA templates. Context tiering updated.
220
+
221
+ - `dispatch-feature/references/anti-patterns.md` — updated for v5 model.
222
+ Removed "one subagent per commit" anti-pattern (now correct behavior).
223
+ Added: never two teammates on same repo, never skip micro-QA, never prune active worktrees.
224
+
225
+ - `hooks/permission-auto-approve.sh` — extended to auto-approve safe Bash git operations
226
+ (branch creation, worktree add in /tmp/, log/status/diff) and test/typecheck in worktrees.
227
+
228
+ - `hooks/validate-spawn-prompt.sh` — updated checks for v5 spawn model:
229
+ worktree_path required, signal protocol required, plan (not just tasks) required.
230
+
231
+ - `hooks/session-start-context.sh` — session-aware orphan cleanup: active session worktrees
232
+ are never removed. Only truly orphaned worktrees (no matching active session JSON) are cleaned.
233
+
234
+ - `hooks/user-prompt-guard.sh` — updated reminder: Bash is allowed for git/test operations,
235
+ not for writing application code in repos.
236
+
237
+ - `rules/model-routing.md` — updated routing table (plan-review → Sonnet, micro-QA → Haiku).
238
+ Documents dispatch-feature Phase 1 exception (Opus explores directly).
239
+
240
+ - `skills/session/SKILL.md` — added worktree removal step in `/session close`.
241
+
242
+ - `dispatch-feature/SKILL.md` — added **Phase 2.9: Pre-dispatch check** between
243
+ git setup and teammate dispatch. Verifies branch exists, worktree exists and is on
244
+ the right branch, worktree is clean, repo is reachable. Auto-fixes simple cases
245
+ (missing branch/worktree), escalates to user if unreachable.
246
+
247
+ - `doctor/SKILL.md` — added **v5 compatibility checks** (Check 3):
248
+ detects v4 installations (disallowedTools: Bash in team-lead, missing SendMessage
249
+ in implementer, plan-review on haiku), validates active session worktree_path fields,
250
+ checks session worktrees exist on disk, detects orphan worktrees not linked to any session.
251
+
252
+ - `skills/cleanup/SKILL.md` — session-aware: explicitly skips active session worktrees.
253
+
254
+ - `skills/cycle-retrospective/SKILL.md` — description updated to MANDATORY, references Phase 5.
255
+
256
+ - `skills/plan-review/SKILL.md` — model changed from haiku to sonnet.
257
+
258
+ - `templates/workspace.template.md` — version reference updated to v5.0.
259
+
260
+ - `bin/cli.js` — version bumped to 5.0.0. `session close` command now includes worktree
261
+ removal step before branch deletion. `claudeMdContent()` updated to reflect v5 rules.
262
+
263
+ ### Migration from v4.x
264
+
265
+ 1. Run `npx cc-workspace update --force` to install v5 global components.
266
+ 2. Run `npx cc-workspace update` from your workspace root to update local `orchestrator/`.
267
+ 3. The new `team-lead` agent has Bash access — review your workspace security posture.
268
+ 4. Existing sessions (`session.json` files) are compatible but lack the new `worktree_path`
269
+ and `commits` fields. Add them manually or re-init sessions.
270
+ 5. `cycle-retrospective` will now be called automatically at the end of every dispatch cycle.
271
+
272
+
273
+ ### E2E Validator updates (v5.0.0 continued)
274
+
275
+ - `agents/e2e-validator.md` — model upgraded Sonnet → Opus. maxTurns 100 → 150.
276
+ No worktrees: agent works directly on repos at correct branch (merged or session).
277
+ Added port conflict check (Step 1) before starting containers.
278
+ Added global 10-minute timeout on container health checks.
279
+ Added test data seeding step (Step 2).
280
+ Teardown simplified — no worktree removal, only branch restore + docker down.
281
+ `--fix` mode updated to use Teammate(implementer) instead of Task(implementer).
282
+
283
+ - `e2e-validator/references/container-strategies.md` — build contexts changed from
284
+ `/tmp/e2e-{repo}` to `../{repo}` (direct repo path at checked-out branch).
285
+ Added non-standard port defaults to reduce conflicts with local dev servers.
286
+ Added port assignment table in e2e-config.md guidance.
287
+ Removed all /tmp/ worktree references.
288
+
289
+ ## [4.7.1] — previous
290
+
291
+ See git history for earlier versions.
package/README.md CHANGED
@@ -27,7 +27,7 @@ cd ~/projects/my-workspace
27
27
  npx cc-workspace init . "My Project"
28
28
  ```
29
29
 
30
- This creates an `orchestrator/` directory and installs 13 skills, 4 agents, 9 hooks, and 2 rules into `~/.claude/`.
30
+ This creates an `orchestrator/` directory with 13 skills, 2 rules, and 9 hooks locally in `orchestrator/.claude/`, and installs 6 agents globally in `~/.claude/agents/`.
31
31
 
32
32
  ### Configure (one time)
33
33
 
@@ -48,6 +48,8 @@ The init agent will:
48
48
  ```bash
49
49
  cd orchestrator/
50
50
  claude --agent team-lead # orchestration sessions
51
+ claude --agent reviewer # evidence-based code review
52
+ claude --agent security-auditor # security audit
51
53
  claude --agent e2e-validator # E2E validation (beta)
52
54
  ```
53
55
 
@@ -67,8 +69,8 @@ npx cc-workspace update
67
69
  ```
68
70
 
69
71
  Updates all components if the package version is newer:
70
- - **Global**: skills, rules, agents in `~/.claude/`
71
- - **Local** (if `orchestrator/` found): hooks, settings.json, CLAUDE.md, templates, _TEMPLATE.md
72
+ - **Global**: agents in `~/.claude/agents/` + cleanup of legacy global skills/rules
73
+ - **Local** (if `orchestrator/` found): skills, rules, hooks, settings.json, CLAUDE.md, templates, _TEMPLATE.md
72
74
  - **Never overwritten**: workspace.md, constitution.md, plans/, e2e/
73
75
 
74
76
  ### Diagnostic
@@ -78,7 +80,7 @@ npx cc-workspace doctor # from terminal
78
80
  /doctor # from inside a Claude Code session
79
81
  ```
80
82
 
81
- Checks: installed version, skills, rules, agents, hooks, jq, orchestrator/ structure.
83
+ Checks: installed version, agents (global), skills + rules (local), hooks, jq, orchestrator/ structure, legacy globals detection.
82
84
 
83
85
  ---
84
86
 
@@ -89,10 +91,17 @@ my-workspace/
89
91
  ├── orchestrator/ <- you cd here
90
92
  │ ├── .claude/
91
93
  │ │ ├── settings.json <- env vars + hooks
92
- │ │ └── hooks/
93
- │ │ ├── session-start-context.sh
94
- │ │ ├── validate-spawn-prompt.sh
95
- │ │ └── ... <- 9 scripts (all warning-only)
94
+ │ │ ├── hooks/
95
+ │ │├── session-start-context.sh
96
+ │ │├── validate-spawn-prompt.sh
97
+ │ │└── ... <- 9+ scripts (all warning-only)
98
+ │ │ ├── skills/ <- LOCAL (13 skills — only active in orchestrator/)
99
+ │ │ │ ├── dispatch-feature/
100
+ │ │ │ ├── qa-ruthless/
101
+ │ │ │ └── ...
102
+ │ │ └── rules/ <- LOCAL (2 rules — only active in orchestrator/)
103
+ │ │ ├── context-hygiene.md
104
+ │ │ └── model-routing.md
96
105
  │ ├── CLAUDE.md <- orchestrator profile
97
106
  │ ├── workspace.md <- filled by workspace-init
98
107
  │ ├── constitution.md <- filled by workspace-init
@@ -117,6 +126,15 @@ my-workspace/
117
126
  ├── repo-a/ (.git) <- teammate worktree
118
127
  ├── repo-b/ (.git) <- teammate worktree
119
128
  └── repo-c/ (.git) <- teammate worktree
129
+
130
+ ~/.claude/
131
+ └── agents/ <- GLOBAL (6 agents — needed for claude --agent)
132
+ ├── team-lead.md
133
+ ├── implementer.md
134
+ ├── workspace-init.md
135
+ ├── reviewer.md
136
+ ├── security-auditor.md
137
+ └── e2e-validator.md
120
138
  ```
121
139
 
122
140
  ---
@@ -153,7 +171,7 @@ In `workspace.md`, add the `Source Branch` column to the service map:
153
171
  1. The team-lead identifies impacted repos during planning (Phase 2)
154
172
  2. After plan approval, **Phase 2.5** creates a session:
155
173
  - Writes `.sessions/{name}.json` with impacted repos only
156
- - Spawns a Task subagent to run `git branch session/{name} {source}` in each repo
174
+ - Opus runs `git branch session/{name} {source}` + `git worktree add /tmp/...` directly via Bash
157
175
  - Uses `git branch` (NOT `git checkout -b`) to avoid disrupting other sessions
158
176
  3. Teammates receive the session branch in their spawn prompt — they do NOT create their own branches
159
177
  4. PRs go from `session/{name}` → `source_branch` (never to main directly)
@@ -212,12 +230,14 @@ parallel in each repo via Agent Teams.
212
230
 
213
231
  | Role | Model | What it does |
214
232
  |------|-------|-------------|
215
- | **Orchestrator** | Opus 4.6 | Clarifies, plans, delegates, verifies. Writes in orchestrator/ only. |
233
+ | **Orchestrator** | Opus 4.6 | Clarifies, plans, manages git, delegates, micro-QA between commits. Writes in orchestrator/ only. |
216
234
  | **Init** | Sonnet 4.6 | Diagnostic + interactive workspace configuration. Run once. |
217
- | **Teammates** | Sonnet 4.6 | Implement in an isolated worktree, test, commit. |
235
+ | **Teammates** | Sonnet 4.6 | Implement in an isolated worktree. One per repo, handles all commits sequentially, signals after each. |
218
236
  | **Data extractors** | Haiku | Read-only. Collect raw data (types, configs, logs). Never judge or conclude. |
219
- | **QA** | Sonnet 4.6 | Hostile mode. Min 3 problems found per service. |
220
- | **E2E Validator** | Sonnet 4.6 | Containers + Chrome browser testing (beta). |
237
+ | **QA** | Opus 4.6 | Hostile mode. Spawns Sonnet investigators. Min 3 problems found per service. |
238
+ | **Reviewer** | Opus 4.6 | Evidence-based code review. Scope check + architecture + constitution compliance. |
239
+ | **Security Auditor** | Opus 4.6 | Auth flow tracing, tenant isolation, secrets scan, CVEs, input validation. |
240
+ | **E2E Validator** | Opus 4.6 | Containers + Chrome browser testing (beta). |
221
241
 
222
242
  ### The 4 session modes
223
243
 
@@ -233,13 +253,14 @@ parallel in each repo via Agent Teams.
233
253
  ```
234
254
  CLARIFY -> ask max 5 questions if ambiguity
235
255
  PLAN -> write the plan in ./plans/, wait for approval
236
- SESSION -> create session branches in impacted repos (Phase 2.5)
237
- SPAWN -> Wave 1: API/data in parallel
256
+ SESSION -> create session branches + worktrees in impacted repos (Phase 2.5)
257
+ SPAWN -> Wave 1: API/data (one teammate per repo, sequential commits)
238
258
  Wave 2: frontend with validated API contract
239
259
  Wave 3: infra/config if applicable
240
- COLLECT -> update the plan with results
241
- VERIFY -> cross-service-check + qa-ruthless
242
- REPORT -> final summary
260
+ MICRO-QA -> Bash tests + Haiku diff after EVERY commit before green light
261
+ VERIFY -> cross-service-check + qa-ruthless + reviewer + (security-auditor)
262
+ MERGE -> merge-prep (PRs, conflict detection)
263
+ RETRO -> cycle-retrospective (mandatory)
243
264
  ```
244
265
 
245
266
  ### Security — path-aware writes
@@ -249,9 +270,9 @@ but never in sibling repos. A `PreToolUse` hook in the team-lead agent frontmatt
249
270
  dynamically checks if the target path is inside orchestrator/ before allowing writes.
250
271
 
251
272
  Protection layers:
252
- 1. `disallowedTools: Bash` in agent frontmatter
253
- 2. `tools` whitelist in agent frontmatter (note: `allowed-tools` is the skill equivalent)
254
- 3. `PreToolUse` path-aware hook in agent frontmatter (team-lead only teammates write freely in their worktrees)
273
+ 1. `tools` whitelist in agent frontmatter
274
+ 2. `PreToolUse` path-aware hook in agent frontmatter (team-lead only teammates write freely in their worktrees)
275
+ 3. `PreToolUse` Bash guard in implementer frontmatter (blocks git checkout on main working trees)
255
276
 
256
277
  ---
257
278
 
@@ -259,16 +280,16 @@ Protection layers:
259
280
 
260
281
  | Skill | Role | Trigger |
261
282
  |-------|------|---------|
262
- | **dispatch-feature** | 4 modes: Clarify -> Plan -> Delegate -> Track | "Implement X", "new feature" |
263
- | **qa-ruthless** | Hostile QA + UX audit | "QA", "review", "test" |
283
+ | **dispatch-feature** | 4 modes: Clarify -> Plan -> Git -> Delegate -> Micro-QA -> Track | "Implement X", "new feature" |
284
+ | **qa-ruthless** | Hostile QA + UX audit (Opus) | "QA", "review", "test" |
264
285
  | **cross-service-check** | Inter-repo consistency | "cross-service", "pre-merge" |
265
286
  | **incident-debug** | Multi-layer diagnostic | "Bug", "500", "not working" |
266
- | **plan-review** | Plan sanity check (Haiku) | "Review plan" |
287
+ | **plan-review** | Plan sanity check (Sonnet) | "Review plan" |
267
288
  | **merge-prep** | Conflicts, PRs, merge order | "Merge", "PR" |
268
289
  | **cycle-retrospective** | Post-cycle learning (Opus + Haiku gatherers) | "Retro", "retrospective" |
269
290
  | **refresh-profiles** | Re-scan repo CLAUDE.md files (Haiku) | "Refresh profiles" |
270
291
  | **bootstrap-repo** | Generate a CLAUDE.md (Haiku) | "Bootstrap", "init CLAUDE.md" |
271
- | **e2e-validator** | E2E validation: containers + Chrome (beta) | `claude --agent e2e-validator` |
292
+ | **metrics** | Quantitative KPIs from session data | "/metrics", "/metrics last-5" |
272
293
  | **session** | List, status, close parallel sessions | `/session`, `/session status X` |
273
294
  | **doctor** | Full workspace diagnostic (Haiku) | `/doctor` |
274
295
  | **cleanup** | Remove orphan worktrees + stale sessions | `/cleanup` |
@@ -278,18 +299,23 @@ next one starts. The plan on disk is the source of truth.
278
299
 
279
300
  ---
280
301
 
281
- ## The 4 agents
302
+ ## The 6 agents
282
303
 
283
304
  | Agent | Model | Usage |
284
305
  |-------|-------|-------|
285
306
  | **team-lead** | Opus 4.6 | `claude --agent team-lead` — multi-service orchestration |
286
307
  | **workspace-init** | Sonnet 4.6 | `claude --agent workspace-init` — diagnostic + initial config |
287
- | **implementer** | Sonnet 4.6 | Task subagent with `isolation: worktree` — isolated implementation |
288
- | **e2e-validator** | Sonnet 4.6 | `claude --agent e2e-validator` — E2E validation with containers + Chrome (beta) |
308
+ | **implementer** | Sonnet 4.6 | Teammate spawned by team-lead — isolated implementation in worktrees |
309
+ | **reviewer** | Opus 4.6 | `claude --agent reviewer` — evidence-based code review (scope check, architecture, constitution) |
310
+ | **security-auditor** | Opus 4.6 | `claude --agent security-auditor` — auth flows, tenant isolation, secrets, CVEs, input validation |
311
+ | **e2e-validator** | Opus 4.6 | `claude --agent e2e-validator` — E2E validation with containers + Chrome (beta) |
312
+
313
+ Agents are installed globally in `~/.claude/agents/` (required for `claude --agent`).
314
+ Skills and rules are local to `orchestrator/.claude/` — they don't affect Claude sessions outside orchestrator/.
289
315
 
290
316
  ---
291
317
 
292
- ## The 9 hooks (settings.json) + 1 agent-level hook (team-lead frontmatter)
318
+ ## The 9 hooks (settings.json) + 2 agent-level hooks (frontmatter)
293
319
 
294
320
  All hooks in settings.json are **non-blocking** (exit 0 + warning). No hook blocks the session.
295
321
 
@@ -396,9 +422,10 @@ npx cc-workspace doctor # full diagnostic (or /doctor in-session)
396
422
  ```
397
423
 
398
424
  On each `init` or `update`, the CLI compares versions:
399
- - **Newer version** → overrides skills, rules, agents, hooks
425
+ - **Newer version** → overrides agents (global), skills + rules + hooks (local)
400
426
  - **Same version** → skip (unless `--force`)
401
427
  - **Workspace files** (workspace.md, constitution.md, plans/) → never overwritten
428
+ - **Legacy cleanup** → removes old global skills/rules from `~/.claude/` (versions < 5.2)
402
429
 
403
430
  ---
404
431
 
@@ -411,7 +438,7 @@ cc-workspace/
411
438
  ├── README.md
412
439
  ├── LICENSE
413
440
 
414
- └── global-skills/ <- components installed in ~/.claude/
441
+ └── global-skills/ <- source of truth for all components
415
442
  ├── templates/
416
443
  │ ├── workspace.template.md
417
444
  │ ├── constitution.template.md
@@ -421,7 +448,8 @@ cc-workspace/
421
448
  │ └── references/
422
449
  │ ├── frontend-ux-standards.md
423
450
  │ ├── spawn-templates.md
424
- └── anti-patterns.md
451
+ ├── anti-patterns.md
452
+ │ └── rollback-protocol.md
425
453
  ├── qa-ruthless/SKILL.md
426
454
  ├── cross-service-check/SKILL.md
427
455
  ├── incident-debug/SKILL.md
@@ -430,6 +458,7 @@ cc-workspace/
430
458
  ├── cycle-retrospective/SKILL.md
431
459
  ├── refresh-profiles/SKILL.md
432
460
  ├── bootstrap-repo/SKILL.md
461
+ ├── metrics/SKILL.md
433
462
  ├── e2e-validator/
434
463
  │ └── references/
435
464
  │ ├── container-strategies.md
@@ -438,11 +467,21 @@ cc-workspace/
438
467
  ├── session/SKILL.md <- /session slash command
439
468
  ├── doctor/SKILL.md <- /doctor slash command
440
469
  ├── cleanup/SKILL.md <- /cleanup slash command
441
- ├── hooks/ <- 9 scripts (warning-only)
442
- ├── rules/ <- 2 rules
443
- └── agents/ <- 4 agents (team-lead, implementer, workspace-init, e2e-validator)
470
+ ├── hooks/ <- 9+ scripts (warning-only)
471
+ ├── rules/ <- 2 rules → installed LOCAL in orchestrator/.claude/rules/
472
+ └── agents/ <- 6 agents installed GLOBAL in ~/.claude/agents/
473
+ ├── team-lead.md
474
+ ├── implementer.md
475
+ ├── workspace-init.md
476
+ ├── reviewer.md
477
+ ├── security-auditor.md
478
+ └── e2e-validator.md
444
479
  ```
445
480
 
481
+ **Installation layout:**
482
+ - `agents/` → `~/.claude/agents/` (global — `claude --agent` requires it)
483
+ - Everything else → `orchestrator/.claude/` (local — no side effects outside orchestrator)
484
+
446
485
  ---
447
486
 
448
487
  ## Idempotence
@@ -450,9 +489,10 @@ cc-workspace/
450
489
  Both `init` and `update` are safe to re-run:
451
490
  - **Never overwritten**: `workspace.md`, `constitution.md`, `plans/*.md`, `e2e/` (user content)
452
491
  - **Always regenerated**: `settings.json`, `CLAUDE.md`, `_TEMPLATE.md`
453
- - **Always copied**: hooks, templates
492
+ - **Always copied**: hooks, skills, rules, templates
454
493
  - **Always regenerated on init**: `service-profiles.md` (fresh scan)
455
- - **Global components**: only updated if the version is newer (or `--force`)
494
+ - **Agents** (global): only updated if the version is newer (or `--force`)
495
+ - **Legacy cleanup**: old global skills/rules in `~/.claude/` are removed automatically
456
496
 
457
497
  ---
458
498
 
@@ -489,14 +529,14 @@ Add `--fix` to any mode to dispatch teammates for fixing failures.
489
529
 
490
530
  ### How it works
491
531
 
492
- 1. Creates `/tmp/` worktrees on session branches (from the plan)
493
- 2. Starts services via `docker compose up`
494
- 3. Waits for health checks
532
+ 1. Checks out repos to the correct branch (merged source or session branch)
533
+ 2. Starts services via `docker compose up` with build context pointing to repos
534
+ 3. Waits for health checks (10-minute global timeout)
495
535
  4. Runs existing test suites + generates API scenario tests from the plan
496
536
  5. With `--chrome`: drives Chrome via chrome-devtools MCP (navigate, fill forms,
497
537
  click, take screenshots, record GIFs, check network requests and console)
498
538
  6. Generates report with evidence (screenshots, GIFs, network traces)
499
- 7. Tears down containers and worktrees
539
+ 7. Tears down containers and restores repos to their original branch
500
540
 
501
541
  ### Chrome testing
502
542
 
@@ -518,6 +558,48 @@ With `--chrome`, the agent:
518
558
 
519
559
  ---
520
560
 
561
+ ## Changelog v5.1.0 -> v5.2.0
562
+
563
+ | # | Feature | Detail |
564
+ |---|---------|--------|
565
+ | 1 | **Skills & rules now LOCAL** | Installed in `orchestrator/.claude/skills/` and `rules/` instead of `~/.claude/`. Only agents remain global. Claude behaves normally outside orchestrator/. |
566
+ | 2 | **Automatic legacy cleanup** | `update --force` removes old global skills/rules from `~/.claude/` (from versions < 5.2). |
567
+ | 3 | **Reviewer agent (Opus)** | Evidence-based code review: scope check (plan vs implemented), architecture assessment, constitution compliance. Anchored on constitution + CLAUDE.md + plan, never on legacy code. |
568
+ | 4 | **Security auditor agent (Opus)** | 7-phase audit: auth flow tracing, tenant isolation, secrets scan, dependency CVEs, input validation, headers/CORS, session-scoped delta analysis. Conditional in Phase 5. |
569
+ | 5 | **qa-ruthless explicit Opus** | Added `model: opus` in frontmatter. Previously inherited from caller context. |
570
+ | 6 | **Phase 5 expanded** | Now: cross-service → qa-ruthless → reviewer → (security-auditor) → merge-prep → cycle-retrospective. |
571
+
572
+ ---
573
+
574
+ ## Changelog v5.0.0 -> v5.1.0
575
+
576
+ | # | Feature | Detail |
577
+ |---|---------|--------|
578
+ | 1 | **`--dry-run` flag** | `init` and `update` support preview without writing files. |
579
+ | 2 | **Secure `permission-auto-approve.sh`** | Compound commands rejected before pattern matching. |
580
+ | 3 | **Robust `detectProjectType`** | JSON.parse + dependency lookup instead of string.includes(). |
581
+ | 4 | **Split orphan cleanup** | Extracted into separate `orphan-cleanup.sh` hook. |
582
+ | 5 | **JSON format for micro-QA** | Haiku returns structured `{"status":"OK"}` instead of free text. |
583
+ | 6 | **Chrome MCP check in doctor** | Verifies Chrome DevTools MCP configuration. |
584
+ | 7 | **Hook unit tests** | `test_hooks.sh` with ~30 assertions. CLI unit tests with ~50 assertions. |
585
+
586
+ ---
587
+
588
+ ## Changelog v4.7.0 -> v5.0.0
589
+
590
+ | # | Feature | Detail |
591
+ |---|---------|--------|
592
+ | 1 | **Opus has Bash** | `disallowedTools: Bash` removed from team-lead. Opus manages git (branches, worktrees) and micro-QA directly. |
593
+ | 2 | **One teammate per repo** | Shift from one subagent per commit unit to one teammate per repo. Sequential commits with signal+wait protocol. |
594
+ | 3 | **Micro-QA between every commit** | Bash tests + Haiku diff review after each commit before green light. |
595
+ | 4 | **Worktrees after plan validation** | Branches and worktrees created by Opus only after user approves the plan. |
596
+ | 5 | **Worktrees persist** | `/tmp/` worktrees live until `session close`. No pruning during active sessions. |
597
+ | 6 | **cycle-retrospective mandatory** | Required Phase 5 step, not optional. |
598
+ | 7 | **Source branch override** | Specify source branch in initial prompt. Stored in session JSON. |
599
+ | 8 | **E2E validator upgraded** | Opus model, no worktrees (direct checkout), port conflict check, global timeout, test data seeding. |
600
+
601
+ ---
602
+
521
603
  ## Changelog v4.6.2 -> v4.7.0
522
604
 
523
605
  | # | Feature | Detail |