cc-workspace 4.0.0

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 (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +382 -0
  3. package/bin/cli.js +735 -0
  4. package/global-skills/agents/implementer.md +39 -0
  5. package/global-skills/agents/team-lead.md +143 -0
  6. package/global-skills/agents/workspace-init.md +207 -0
  7. package/global-skills/bootstrap-repo/SKILL.md +70 -0
  8. package/global-skills/constitution.md +58 -0
  9. package/global-skills/cross-service-check/SKILL.md +67 -0
  10. package/global-skills/cycle-retrospective/SKILL.md +133 -0
  11. package/global-skills/dispatch-feature/SKILL.md +168 -0
  12. package/global-skills/dispatch-feature/references/anti-patterns.md +31 -0
  13. package/global-skills/dispatch-feature/references/frontend-ux-standards.md +73 -0
  14. package/global-skills/dispatch-feature/references/spawn-templates.md +109 -0
  15. package/global-skills/hooks/notify-user.sh +30 -0
  16. package/global-skills/hooks/permission-auto-approve.sh +16 -0
  17. package/global-skills/hooks/session-start-context.sh +85 -0
  18. package/global-skills/hooks/subagent-start-context.sh +35 -0
  19. package/global-skills/hooks/task-completed-check.sh +21 -0
  20. package/global-skills/hooks/teammate-idle-check.sh +29 -0
  21. package/global-skills/hooks/track-file-modifications.sh +20 -0
  22. package/global-skills/hooks/user-prompt-guard.sh +19 -0
  23. package/global-skills/hooks/validate-spawn-prompt.sh +79 -0
  24. package/global-skills/hooks/worktree-create-context.sh +22 -0
  25. package/global-skills/incident-debug/SKILL.md +86 -0
  26. package/global-skills/merge-prep/SKILL.md +87 -0
  27. package/global-skills/plan-review/SKILL.md +70 -0
  28. package/global-skills/qa-ruthless/SKILL.md +102 -0
  29. package/global-skills/refresh-profiles/SKILL.md +22 -0
  30. package/global-skills/rules/constitution-en.md +67 -0
  31. package/global-skills/rules/context-hygiene.md +43 -0
  32. package/global-skills/rules/model-routing.md +42 -0
  33. package/global-skills/templates/claude-md.template.md +124 -0
  34. package/global-skills/templates/constitution.template.md +18 -0
  35. package/global-skills/templates/workspace.template.md +33 -0
  36. package/package.json +28 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vincent / Lota Cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,382 @@
1
+ # Claude Code Multi-Workspace Orchestrator v4.0
2
+
3
+ Un systeme pour piloter des projets multi-services depuis Claude Code.
4
+ L'orchestrateur (Opus) ne code jamais dans les repos. Il clarifie, planifie,
5
+ delegue a des teammates qui travaillent en parallele dans chaque repo.
6
+
7
+ > Claude Code v2.1.47+ / Opus 4.6 / Sonnet 4.6 (fevrier 2026).
8
+ > 9 skills, 11 hooks, 3 agents, 3 rules.
9
+
10
+ ---
11
+
12
+ ## Installation
13
+
14
+ ### Prerequis
15
+
16
+ - **Claude Code** v2.1.47+
17
+ - **Node.js** 18+
18
+ - **jq** (`brew install jq` sur macOS, `apt install jq` sur Linux)
19
+
20
+ ### 1. Setup du workspace
21
+
22
+ ```bash
23
+ cd ~/projets/mon-workspace
24
+ npx claude-orchestrator init . "Mon Projet"
25
+ ```
26
+
27
+ Le CLI :
28
+ - Installe skills/rules/agents dans `~/.claude/` (si version plus recente)
29
+ - Cree `orchestrator/` avec plans/, templates/, hooks
30
+ - Scanne les repos freres (dossiers avec `.git/`)
31
+ - Genere `service-profiles.md`
32
+ - workspace.md et constitution.md en mode `[UNCONFIGURED]`
33
+
34
+ ### 2. Initialisation (une seule fois)
35
+
36
+ ```bash
37
+ cd orchestrator/
38
+ claude --agent workspace-init
39
+ ```
40
+
41
+ L'agent `workspace-init` :
42
+ 1. Diagnostique la structure (hooks, settings, templates)
43
+ 2. Scanne les repos freres, detecte les types de projet, verifie Claude Code readiness
44
+ 3. Propose de generer les CLAUDE.md manquants (optionnel)
45
+ 4. Configuration interactive de workspace.md (section par section)
46
+ 5. Configuration interactive de constitution.md (regles projet)
47
+ 6. Rapport final avec le statut de chaque check
48
+
49
+ ### 3. Sessions de travail
50
+
51
+ ```bash
52
+ cd orchestrator/
53
+ claude --agent team-lead
54
+
55
+ # Le team-lead propose 4 modes :
56
+ # A -- Complet (clarify -> plan -> validate -> dispatch -> QA)
57
+ # B -- Plan rapide (specs -> plan -> dispatch)
58
+ # C -- Go direct (dispatch immediat)
59
+ # D -- Single-service (1 repo, pas de waves)
60
+ ```
61
+
62
+ ### Mise a jour
63
+
64
+ ```bash
65
+ npx claude-orchestrator update
66
+ ```
67
+
68
+ Met a jour les composants globaux (~/.claude/) si la version du package est superieure.
69
+ Les fichiers du workspace (workspace.md, constitution.md, plans/) ne sont jamais ecrases.
70
+
71
+ ### Diagnostic
72
+
73
+ ```bash
74
+ npx claude-orchestrator doctor
75
+ ```
76
+
77
+ Verifie : version installee, skills, rules, agents, hooks, jq, structure orchestrator/.
78
+
79
+ ---
80
+
81
+ ## Structure resultante
82
+
83
+ ```
84
+ mon-workspace/
85
+ ├── orchestrator/ <- tu cd ici
86
+ │ ├── .claude/
87
+ │ │ ├── settings.json <- env vars uniquement
88
+ │ │ └── hooks/
89
+ │ │ ├── block-orchestrator-writes.sh
90
+ │ │ ├── session-start-context.sh
91
+ │ │ ├── validate-spawn-prompt.sh
92
+ │ │ └── ... <- 11 scripts
93
+ │ ├── CLAUDE.md <- profil orchestrateur
94
+ │ ├── workspace.md <- rempli par workspace-init
95
+ │ ├── constitution.md <- rempli par workspace-init
96
+ │ ├── templates/
97
+ │ │ ├── workspace.template.md
98
+ │ │ ├── constitution.template.md
99
+ │ │ └── claude-md.template.md <- template pour les CLAUDE.md des repos
100
+ │ └── plans/
101
+ │ ├── _TEMPLATE.md
102
+ │ └── service-profiles.md
103
+
104
+ ├── repo-a/ (.git) <- teammate worktree
105
+ ├── repo-b/ (.git) <- teammate worktree
106
+ └── repo-c/ (.git) <- teammate worktree
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Comment ca marche
112
+
113
+ ### Le probleme
114
+
115
+ Tu as un projet avec 3-5 repos (API, frontend, infra, etc.). Quand tu
116
+ demandes une feature a Claude Code, il essaie de tout faire lui-meme :
117
+ il perd le contexte, il ne peut pas travailler dans plusieurs repos a la
118
+ fois, et il devine au lieu de demander.
119
+
120
+ ### La solution
121
+
122
+ L'orchestrateur (Opus) ne touche jamais au code des repos. Il clarifie le besoin,
123
+ ecrit un plan en markdown, puis envoie des teammates (Sonnet) bosser en
124
+ parallele dans chaque repo via Agent Teams.
125
+
126
+ ### Qui fait quoi
127
+
128
+ | Role | Modele | Ce qu'il fait |
129
+ |------|--------|---------------|
130
+ | **Orchestrateur** | Opus 4.6 | Clarifie, planifie, delegue, verifie. Ecrit dans orchestrator/ uniquement. |
131
+ | **Init** | Sonnet 4.6 | Diagnostic + configuration interactive du workspace. Se lance une fois. |
132
+ | **Teammates** | Sonnet 4.6 | Implementent dans un worktree isole, testent, commitent. |
133
+ | **Explorateurs** | Haiku | Read-only. Scannent, verifient la coherence. |
134
+ | **QA** | Sonnet 4.6 | Mode hostile. Min 3 problemes trouves par service. |
135
+
136
+ ### Les 4 modes de session
137
+
138
+ | Mode | Quand l'utiliser |
139
+ |------|--------------------|
140
+ | **A -- Complet** | Feature complexe, multi-service, besoin de clarification |
141
+ | **B -- Plan rapide** | Specs claires, pas de questions |
142
+ | **C -- Go direct** | Hotfix, correction rapide, specs evidentes |
143
+ | **D -- Single-service** | Bug ou feature isolee dans un seul repo |
144
+
145
+ ### Le workflow dispatch-feature (Mode A)
146
+
147
+ ```
148
+ CLARIFY -> pose max 5 questions si ambiguite
149
+ PLAN -> ecrit le plan dans ./plans/, attend validation
150
+ SPAWN -> Wave 1 : API/data en parallele
151
+ Wave 2 : frontend avec le contrat API valide
152
+ Wave 3 : infra/config si applicable
153
+ COLLECT -> met a jour le plan avec les resultats
154
+ VERIFY -> cross-service-check + qa-ruthless
155
+ REPORT -> bilan final
156
+ ```
157
+
158
+ ### Securite -- ecriture path-aware
159
+
160
+ L'orchestrateur peut ecrire dans `orchestrator/` (plans, workspace.md, constitution.md)
161
+ mais jamais dans les repos freres. Le hook `block-orchestrator-writes.sh` detecte
162
+ dynamiquement si le chemin cible est dans un repo (presence de `.git/`).
163
+
164
+ Couches de protection :
165
+ 1. `disallowedTools: Bash` dans le frontmatter agent
166
+ 2. `allowed-tools` whitelist dans le frontmatter agent
167
+ 3. Hook `PreToolUse` path-aware dans le frontmatter agent
168
+ 4. Hook `block-orchestrator-writes.sh` dans .claude/hooks/
169
+
170
+ ---
171
+
172
+ ## Les 9 skills
173
+
174
+ | Skill | Role | Declencheur |
175
+ |-------|------|-------------|
176
+ | **dispatch-feature** | 4 modes : Clarifier -> Planifier -> Deleguer -> Suivre | "Implemente X", "nouvelle feature" |
177
+ | **qa-ruthless** | QA hostile + audit UX | "QA", "review", "teste" |
178
+ | **cross-service-check** | Coherence inter-repos | "cross-service", "pre-merge" |
179
+ | **incident-debug** | Diagnostic multi-couche | "Bug", "500", "ca marche pas" |
180
+ | **plan-review** | Sanity check du plan (Haiku) | "Review plan" |
181
+ | **merge-prep** | Conflits, PRs, ordre de merge | "Merge", "PR" |
182
+ | **cycle-retrospective** | Capitalisation post-cycle (Haiku) | "Retro", "retrospective" |
183
+ | **refresh-profiles** | Re-scanner les CLAUDE.md (Haiku) | "Refresh profiles" |
184
+ | **bootstrap-repo** | Generer un CLAUDE.md (Haiku) | "Bootstrap", "init CLAUDE.md" |
185
+
186
+ Tous utilisent `context: fork` -- le resultat d'un skill n'est pas dans le
187
+ contexte quand le suivant demarre. Le plan sur disque est la source de verite.
188
+
189
+ ---
190
+
191
+ ## Les 3 agents
192
+
193
+ | Agent | Modele | Usage |
194
+ |-------|--------|-------|
195
+ | **team-lead** | Opus 4.6 | `claude --agent team-lead` — orchestration multi-service |
196
+ | **workspace-init** | Sonnet 4.6 | `claude --agent workspace-init` — diagnostic + config initiale |
197
+ | **implementer** | Sonnet 4.6 | Subagent Task avec `isolation: worktree` — implementation isolee |
198
+
199
+ ---
200
+
201
+ ## Les 11 hooks
202
+
203
+ Tous les hooks sont **non-bloquants** (exit 0 + warning). Aucun hook ne bloque la session.
204
+
205
+ | Hook | Event | Effet |
206
+ |------|-------|-------|
207
+ | **block-orchestrator-writes** | `PreToolUse` Write\|Edit\|MultiEdit | Bloque ecriture dans les repos, autorise orchestrator/ |
208
+ | **validate-spawn-prompt** | `PreToolUse` Teammate | Warning si contexte manquant (rules, UX, tasks) |
209
+ | **session-start-context** | `SessionStart` | Injecte plans actifs + detection premiere session |
210
+ | **user-prompt-guard** | `UserPromptSubmit` | Warning si demande de code dans un repo |
211
+ | **subagent-start-context** | `SubagentStart` | Injecte plan actif + constitution |
212
+ | **permission-auto-approve** | `PermissionRequest` | Auto-approve Read/Glob/Grep |
213
+ | **track-file-modifications** | `PostToolUse` (async) | Log des fichiers modifies |
214
+ | **teammate-idle-check** | `TeammateIdle` | Warning si taches restantes |
215
+ | **task-completed-check** | `TaskCompleted` | Warning si tests echoues |
216
+ | **worktree-create-context** | `WorktreeCreate` | Rappelle de lire CLAUDE.md du repo |
217
+ | **notify-user** | `Notification` | Notification desktop |
218
+
219
+ ---
220
+
221
+ ## Les 3 templates
222
+
223
+ | Template | Usage |
224
+ |----------|-------|
225
+ | `workspace.template.md` | Structure du fichier workspace.md (projet, service map, relations, rules, onboarding) |
226
+ | `constitution.template.md` | Structure du fichier constitution.md (regles projet 13+) |
227
+ | `claude-md.template.md` | Structure standardisee pour les CLAUDE.md des repos (stack, archi, regles, tests, anti-patterns) |
228
+
229
+ ---
230
+
231
+ ## Auto-decouverte des repos
232
+
233
+ L'orchestrateur scanne automatiquement `../` pour trouver les repos freres :
234
+ - Tout dossier avec `.git/` est un repo disponible
235
+ - L'orchestrateur s'exclut lui-meme
236
+ - Les nouveaux repos sont signales au demarrage
237
+ - `/refresh-profiles` relit les CLAUDE.md de tous les repos
238
+
239
+ ---
240
+
241
+ ## Portabilite
242
+
243
+ Le dossier `orchestrator/` est portable :
244
+ 1. Copie-le dans n'importe quel workspace
245
+ 2. `cd orchestrator && claude --agent workspace-init`
246
+ 3. Si `workspace.md` contient `[UNCONFIGURED]`, le flow de config se relance
247
+ 4. Les repos freres sont re-decouverts automatiquement
248
+
249
+ ---
250
+
251
+ ## La constitution
252
+
253
+ ### Globale (scopee au workspace)
254
+
255
+ 12 principes universels dans `~/.claude/rules/constitution-en.md`.
256
+ Scopee aux fichiers orchestrateur (`workspace.md`, `plans/**`, etc.).
257
+ **v4.0** : les teammates ne la recoivent plus automatiquement.
258
+ L'orchestrateur l'inclut dans chaque spawn prompt.
259
+
260
+ ### Projet (a personnaliser)
261
+
262
+ `constitution.md` dans orchestrator/. Contient **uniquement** les regles
263
+ specifiques au projet (numerotees 13+).
264
+
265
+ ---
266
+
267
+ ## Recovery apres crash
268
+
269
+ - `claude --resume` reprend la session avec l'agent team-lead
270
+ - Le hook SessionStart injecte automatiquement les plans actifs
271
+ - Le plan markdown sur disque est la source de verite
272
+
273
+ | Emoji | Statut |
274
+ |-------|--------|
275
+ | ⏳ | TODO |
276
+ | 🔄 | IN PROGRESS |
277
+ | ✅ | DONE |
278
+ | ❌ | BLOCKED/FAILED |
279
+
280
+ ---
281
+
282
+ ## Versioning et mise a jour
283
+
284
+ Le package utilise le semver. La version installee est trackee dans `~/.claude/.orchestrator-version`.
285
+
286
+ ```bash
287
+ npx claude-orchestrator version # affiche la version du package et celle installee
288
+ npx claude-orchestrator update # met a jour si version superieure
289
+ npx claude-orchestrator doctor # diagnostic complet
290
+ ```
291
+
292
+ A chaque `init` ou `update`, le CLI compare les versions :
293
+ - **Version superieure** → override skills, rules, agents, hooks
294
+ - **Meme version** → skip (sauf `--force`)
295
+ - **Fichiers workspace** (workspace.md, constitution.md, plans/) → jamais ecrases
296
+
297
+ ---
298
+
299
+ ## Contenu du package
300
+
301
+ ```
302
+ claude-orchestrator/
303
+ ├── package.json <- npm package, version semver
304
+ ├── bin/cli.js <- CLI (npx claude-orchestrator)
305
+ ├── README.md
306
+ ├── LICENSE
307
+
308
+ └── global-skills/ <- composants installes dans ~/.claude/
309
+ ├── constitution.md <- 12 principes (FR)
310
+ ├── templates/
311
+ │ ├── workspace.template.md
312
+ │ ├── constitution.template.md
313
+ │ └── claude-md.template.md
314
+ ├── dispatch-feature/
315
+ │ ├── SKILL.md
316
+ │ └── references/
317
+ │ ├── frontend-ux-standards.md
318
+ │ ├── spawn-templates.md
319
+ │ └── anti-patterns.md
320
+ ├── qa-ruthless/SKILL.md
321
+ ├── cross-service-check/SKILL.md
322
+ ├── incident-debug/SKILL.md
323
+ ├── plan-review/SKILL.md
324
+ ├── merge-prep/SKILL.md
325
+ ├── cycle-retrospective/SKILL.md
326
+ ├── refresh-profiles/SKILL.md
327
+ ├── bootstrap-repo/SKILL.md
328
+ ├── hooks/ <- 11 scripts (warning-only)
329
+ ├── rules/ <- 3 rules
330
+ └── agents/ <- 3 agents (team-lead, implementer, workspace-init)
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Idempotence
336
+
337
+ Le setup est safe a relancer :
338
+ - Ne reecrit pas `workspace.md` ni `constitution.md` si deja presents
339
+ - Regenere toujours `service-profiles.md` (scan frais)
340
+ - Regenere toujours `settings.json` et `block-orchestrator-writes.sh` (securite)
341
+ - Les templates sont toujours copies
342
+ - Les composants globaux ne sont mis a jour que si la version est superieure
343
+
344
+ ---
345
+
346
+ ## Changelog v3.5.0 -> v4.0
347
+
348
+ | # | Feature | Detail |
349
+ |---|---------|--------|
350
+ | 1 | **Package NPX** | `npx claude-orchestrator init/update/doctor`. Versioning semver. |
351
+ | 2 | **Orchestrator portable** | Toujours dans un sous-dossier `orchestrator/`. Plus de mode child/sibling. |
352
+ | 3 | **Agent workspace-init** | Diagnostic + config interactive. Remplace la detection [UNCONFIGURED] du team-lead. |
353
+ | 4 | **Template CLAUDE.md** | `claude-md.template.md` — structure standardisee pour les repos. |
354
+ | 5 | **Auto-decouverte repos** | Scanne `../` pour les `.git/`. Pas de liste hardcodee. |
355
+ | 6 | **4 modes de session** | Complet, Plan rapide, Go direct, Single-service. |
356
+ | 7 | **Hooks warning-only** | Plus aucun hook bloquant (exit 2 -> exit 0). |
357
+ | 8 | **verify-cycle-complete supprime** | Plus de blocage a la sortie. |
358
+ | 9 | **Orchestrateur peut ecrire** | Dans orchestrator/ uniquement. Hook path-aware dynamique. |
359
+ | 10 | **Constitution scopee** | `globs: ["*"]` -> fichiers orchestrateur seulement. |
360
+ | 11 | **Limite 30 lignes supprimee** | L'orchestrateur adapte sa verbosite au contexte. |
361
+ | 12 | **Templates structures** | workspace.template.md + constitution.template.md + claude-md.template.md. |
362
+
363
+ ---
364
+
365
+ <details>
366
+ <summary>Changelog v3.4.2 -> v3.5.0</summary>
367
+
368
+ | # | Fix/Feature | Detail |
369
+ |---|-------------|--------|
370
+ | 1 | Dual-mode setup | `--mode child\|sibling`. Auto-detection. |
371
+ | 2 | Fix frontmatter `invocation:` | Remplace par `disable-model-invocation`. |
372
+ | 3 | `argument-hint` sur tous les skills | Autocompletion amelioree. |
373
+ | 4 | Hook `SubagentStart` | Injecte plan actif + constitution. |
374
+ | 5 | Hook `SubagentStop` (prompt Haiku) | Evalue completude. |
375
+ | 6 | Hook `PermissionRequest` | Auto-approve Read/Glob/Grep. |
376
+ | 7 | Hook `PostToolUse` async | Tracking fichiers modifies. |
377
+ | 8 | `hookSpecificOutput` JSON | Migration du pattern. |
378
+ | 9 | `$CLAUDE_PROJECT_DIR` | Remplace `jq .cwd`. |
379
+ | 10 | `CLAUDE_ENV_FILE` dans SessionStart | Export plan actif. |
380
+ | 11 | 14 hooks / 12 events | +4 hooks vs v3.4.2. |
381
+
382
+ </details>