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
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: cycle-retrospective
3
+ description: >
4
+ Post-cycle learning and knowledge capture. Analyzes QA findings, teammate
5
+ reports, and implementation patterns to improve repo CLAUDE.md files,
6
+ service profiles, and project constitution. Run after a successful cycle
7
+ (dispatch → QA → merge). Use when user says "retro", "rétrospective",
8
+ "capitalise", "lessons learned", "what did we learn", "améliore les docs".
9
+ argument-hint: "[feature-name]"
10
+ context: fork
11
+ disable-model-invocation: true
12
+ model: haiku
13
+ allowed-tools: Read, Write, Glob, Grep, Task
14
+ ---
15
+
16
+ # Cycle Retrospective — Continuous Learning
17
+
18
+ After a complete cycle (dispatch → QA → merge), capture lessons learned
19
+ and propagate improvements to project documentation.
20
+
21
+ ## Phase 1: Gather data
22
+
23
+ 1. Read `./workspace.md` for the service map
24
+ 2. Find the most recent completed plan in `./plans/` (status ✅ or all tasks ✅)
25
+ 3. Read the plan including:
26
+ - QA report section (findings, patterns)
27
+ - Cross-service check results
28
+ - Session log (blockers, escalations, re-dispatches)
29
+
30
+ ## Phase 2: Analyze patterns
31
+
32
+ Spawn parallel Explore subagents (Task, Haiku) to categorize findings:
33
+
34
+ ### Recurring QA findings
35
+ - Group QA findings by category (🔴 bugs, 🟡 smells, 🟠 dead code, 🔵 missing tests, 🟣 UX violations)
36
+ - Identify patterns: same type of issue across multiple cycles?
37
+ - Flag findings that could have been prevented by a rule or convention
38
+
39
+ ### Teammate friction
40
+ - Parse session log for escalations — what decisions weren't covered by the plan?
41
+ - Parse for re-dispatches — what went wrong on first attempt?
42
+ - Parse for idle time — were tasks too large or poorly scoped?
43
+
44
+ ### Cross-service gaps
45
+ - Were there contract mismatches? Missing env vars? Schema drift?
46
+ - Could these have been caught earlier by a convention?
47
+
48
+ ## Phase 3: Generate improvements
49
+
50
+ For each finding category, generate concrete improvement suggestions:
51
+
52
+ ### CLAUDE.md updates (per repo)
53
+ For each impacted repo, suggest additions to its CLAUDE.md:
54
+ - New conventions discovered during implementation
55
+ - Common pitfalls to document
56
+ - Test patterns that should be standard
57
+ - Architecture decisions made during this cycle
58
+
59
+ Format:
60
+ ```markdown
61
+ ### Suggested additions for [repo]/CLAUDE.md
62
+
63
+ #### Conventions (new)
64
+ - [convention discovered]
65
+
66
+ #### Pitfalls (new)
67
+ - [pitfall encountered]
68
+
69
+ #### Patterns (new)
70
+ - [pattern to follow]
71
+ ```
72
+
73
+ ### Constitution updates
74
+ If a finding reveals a gap in the project constitution:
75
+ ```markdown
76
+ ### Suggested constitution rule
77
+ **[Rule number]. [Rule name].** [Description based on what went wrong]
78
+ Triggered by: [QA finding or escalation that revealed the gap]
79
+ ```
80
+
81
+ ### Service profiles updates
82
+ If repo conventions changed, note what needs updating in service-profiles.md.
83
+
84
+ ## Phase 4: Write retrospective
85
+
86
+ Create `./plans/retro-{date}.md`:
87
+
88
+ ```markdown
89
+ # Retrospective — [Feature name] — [DATE]
90
+
91
+ ## Cycle summary
92
+ - **Feature**: [name]
93
+ - **Services**: [list]
94
+ - **QA findings**: 🔴[n] 🟡[n] 🟠[n] 🔵[n] 🟣[n]
95
+ - **Escalations**: [n]
96
+ - **Re-dispatches**: [n]
97
+
98
+ ## Recurring patterns
99
+ | Pattern | Occurrences | Category | Preventable? |
100
+ |---------|------------|----------|-------------|
101
+ | [pattern] | [n] | [category] | [yes/no + how] |
102
+
103
+ ## Suggested improvements
104
+
105
+ ### CLAUDE.md updates
106
+ [per-repo suggestions]
107
+
108
+ ### Constitution updates
109
+ [if any]
110
+
111
+ ### Process improvements
112
+ [if any — e.g., "add X to plan template", "add Y to QA checklist"]
113
+
114
+ ## Actions
115
+ - [ ] Update [repo]/CLAUDE.md with [changes]
116
+ - [ ] Update constitution with rule [N]
117
+ - [ ] Update service-profiles.md
118
+ - [ ] Update plan template with [addition]
119
+ ```
120
+
121
+ ## Phase 5: Present and confirm
122
+
123
+ Present the retrospective to the user. Ask:
124
+ "Rétrospective terminée. [N] améliorations suggérées. Appliquer les changements aux CLAUDE.md ?"
125
+
126
+ If user confirms, spawn teammates to apply the CLAUDE.md updates to each repo.
127
+ Do NOT auto-apply constitution changes — those require human review.
128
+
129
+ ## Anti-patterns
130
+ - NEVER fabricate findings — only report what's in the actual plan and QA data
131
+ - NEVER modify repo code — only documentation files (CLAUDE.md, service-profiles)
132
+ - NEVER auto-apply constitution changes without user approval
133
+ - Keep suggestions actionable and specific — "improve error handling" is too vague
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: dispatch-feature
3
+ description: >
4
+ Orchestrate multi-service feature implementation. Clarifies ambiguities
5
+ before planning, writes a persistent markdown plan, spawns teammates
6
+ in dependency waves with full context including constitution and UX standards.
7
+ Use whenever the user describes a feature, says "implémente", "nouvelle feature",
8
+ "dispatch", "lance le dev", "lance les teammates", or provides a spec.
9
+ argument-hint: "[feature description]"
10
+ context: fork
11
+ allowed-tools: Read, Write, Glob, Grep, Task, Teammate, SendMessage
12
+ ---
13
+
14
+ # Dispatch Feature — Clarify, Plan, Delegate, Track
15
+
16
+ You produce ZERO code in repos. You clarify, plan, delegate, track.
17
+ You CAN write in orchestrator/ (plans, workspace.md, constitution.md).
18
+
19
+ ## Mode detection
20
+
21
+ Before any phase, check which mode was selected:
22
+
23
+ | Mode | Behavior |
24
+ |------|----------|
25
+ | **A — Complet** | Run all phases 0-5 (default) |
26
+ | **B — Plan rapide** | Skip Phase 0 (Clarify). Start at Phase 2 with specs as-is. |
27
+ | **C — Go direct** | Skip Phases 0-2. Dispatch immediately from user specs. |
28
+ | **D — Single-service** | Phases 0-2, then spawn ONE teammate. No waves. |
29
+
30
+ If no mode specified, use Mode A.
31
+
32
+ ## Phase 0: Clarify
33
+
34
+ Run through this checklist SILENTLY. Only ask for items you cannot deduce:
35
+
36
+ **Must-know** (block if missing):
37
+ - **Who** — which user type uses this feature?
38
+ - **What** — exact expected behavior (input → output)?
39
+ - **Where** — which services are impacted?
40
+ - **Data** — which entities/fields?
41
+
42
+ **Should-know** (ask if ambiguous):
43
+ - Error handling? Permissions? Trigger mechanism? Dependencies?
44
+
45
+ **Rules**: max 5 questions at once, formulated as concrete choices.
46
+ Skip clarify if: bug with log provided, or user says "go"/"autonome".
47
+
48
+ ## Phase 1: Load context
49
+
50
+ 1. Read `./workspace.md`
51
+ 2. Read `./plans/service-profiles.md`
52
+ 3. Read `./constitution.md` (project-specific rules)
53
+ 4. Auto-discover repos: scan `../` for directories with `.git/` not in workspace.md
54
+ → If new repos found: mention them, ask if relevant to this feature
55
+
56
+ > **v4.0 change**: The `constitution-en` rule is now scoped to orchestrator/ only.
57
+ > Teammates do NOT receive it automatically. You MUST include the full 12 universal
58
+ > principles + project-specific rules in every spawn prompt.
59
+
60
+ ## Phase 2: Write the plan
61
+
62
+ Create `./plans/{feature-name}.md` using `./plans/_TEMPLATE.md`.
63
+ Include: context, clarification answers, services impacted, dependency waves,
64
+ detailed tasks per service, API contract (exact shapes), and autonomous choices if applicable.
65
+
66
+ ### Dependency waves
67
+
68
+ - **Wave 1**: Producers — API backend, data/analytics, auth (define contracts)
69
+ - **Wave 2**: Consumers — Frontend, integrations (depend on wave 1 contracts)
70
+ - **Wave 3**: Infra/config — Gateway routes, deployment (after code exists)
71
+
72
+ Independent services go in the same wave. Save. **Present plan, wait for approval.**
73
+
74
+ ## Phase 3: Spawn teammates (Agent Teams)
75
+
76
+ Use the **Teammate** tool to spawn teammates. Each teammate is an independent
77
+ Agent Teams session with its own context window.
78
+
79
+ ### Teammate spawn template
80
+
81
+ For EVERY teammate, include in the spawn prompt:
82
+ 1. Project-specific rules from `workspace constitution.md` (translated to English)
83
+ 2. Their tasks from the plan
84
+ 3. API contract (if applicable)
85
+ 4. Instruction to read repo CLAUDE.md first
86
+ 5. Instruction to escalate architectural decisions not in the plan
87
+
88
+ See @references/spawn-templates.md for the full templates per service type
89
+ (backend, frontend, infra, explore).
90
+
91
+ > **Constitution in spawn prompts**: The 12 universal principles are NO LONGER
92
+ > auto-injected into teammate sessions (v4.0 — rule scoped to orchestrator/).
93
+ > You MUST include ALL 12 principles + project-specific rules in every spawn prompt.
94
+ > See @references/spawn-templates.md for templates with the full constitution.
95
+
96
+ ### Frontend teammates — extra context
97
+
98
+ Before their tasks, inject:
99
+ - The UX standards (content of `references/frontend-ux-standards.md`)
100
+ - The exact API contract shapes for TypeScript interfaces
101
+
102
+ ### API teammates — extra context
103
+
104
+ Inject:
105
+ - The API contract they must implement (exact shapes)
106
+ - Note that frontend will build types from these shapes
107
+
108
+ ### Isolation
109
+
110
+ **Agent Teams teammates** (Teammate tool) get automatic worktree isolation —
111
+ no manual setup needed. Each teammate runs in its own git worktree.
112
+
113
+ **Task subagents** (Task tool, used for lightweight Explore/Haiku scans) do NOT
114
+ get automatic isolation. This is fine because Explore subagents are read-only.
115
+ If a Task subagent needs to write code, add `isolation: worktree` to its config.
116
+
117
+ Never mix: one teammate per repo per wave. No two teammates editing the same repo.
118
+
119
+ ### Wave execution
120
+
121
+ 1. Spawn all wave 1 teammates in parallel
122
+ 2. Wait for ALL wave 1 to report back
123
+ 3. Collect wave 1 results, update the API contract if needed
124
+ 4. Spawn wave 2 teammates with validated contracts from wave 1
125
+ 5. Repeat for wave 3 if applicable
126
+ 6. Use **SendMessage** to clarify or redirect teammates mid-wave if needed
127
+
128
+ ## Phase 4: Collect and update
129
+
130
+ On each teammate report:
131
+ 1. Update `./plans/{feature-name}.md` — statuses ✅ or ❌
132
+ 2. Note dead code found
133
+ 3. If a teammate failed → analyze, correct plan, re-dispatch
134
+ 4. **Session log** entry: `[HH:MM] teammate-[service]: [status], [N] files, tests [pass/fail]`
135
+ 5. If current wave done → launch next wave
136
+
137
+ ## Phase 5: Post-implementation
138
+
139
+ 1. Run `cross-service-check`
140
+ 2. Run `qa-ruthless`
141
+ 3. Update plan with all results
142
+ 4. Present final status to user
143
+
144
+ ## Mode D: Single-service
145
+
146
+ For targeted fixes or single-repo work:
147
+ 1. Identify the ONE service to touch
148
+ 2. Skip waves — spawn a single teammate
149
+ 3. No cross-service-check (unless user requests it)
150
+ 4. QA scoped to that service only
151
+ 5. Merge prep for that service only
152
+
153
+ > **Context note**: This skill runs with `context: fork`. After it completes,
154
+ > its internal context is discarded. The plan file on disk is the source of truth.
155
+ > QA and cross-service-check will reload the plan from disk.
156
+
157
+ ## Session recovery
158
+
159
+ If resuming after crash:
160
+ 1. Read `./workspace.md` for project context
161
+ 2. List `./plans/` for active plans
162
+ 3. Read active plan — statuses and session log tell you where you are
163
+ 4. Resume at last incomplete step
164
+ 5. If no mode was selected before crash, default to Mode A
165
+
166
+ ## Anti-patterns
167
+
168
+ See @references/anti-patterns.md for the full list of anti-patterns and common mistakes.
@@ -0,0 +1,31 @@
1
+ # Dispatch Anti-Patterns
2
+
3
+ Reference file for dispatch-feature. Loaded on-demand when Claude needs reminders.
4
+
5
+ ## NEVER do these
6
+
7
+ 1. **NEVER write code in repos** — not even examples. You CAN write in orchestrator/
8
+ (plans, workspace.md, constitution.md). For repo code: delegate without exception.
9
+ 2. **NEVER skip clarify on ambiguous requests** — if in doubt, ask
10
+ 3. **NEVER spawn one teammate for multiple repos** — one teammate = one repo = one wave
11
+ 4. **NEVER skip the plan file** — everything is tracked on disk
12
+ 5. **NEVER dispatch without approval** unless user explicitly said "autonome" or "go"
13
+ 6. **NEVER forget UX standards in frontend teammate prompts** — they're in references/frontend-ux-standards.md
14
+ 7. **NEVER launch wave 2 before wave 1 reports back** — contracts must be validated first
15
+ 8. **NEVER let a teammate guess on architectural decisions** — they must escalate to you
16
+ 9. **ALWAYS include the full constitution in spawn prompts** — the 12 universal principles
17
+ + project-specific rules. Since v4.0, the constitution rule is scoped to orchestrator/
18
+ only. Teammates do NOT receive it automatically.
19
+ 10. **NEVER keep code details in your context** — summarize to 3 lines in the plan, then compact
20
+ 11. **NEVER assume repos are listed in workspace.md** — scan `../` at feature start for
21
+ any new `.git` repos that may have appeared since last configuration
22
+
23
+ ## Common mistakes to watch for
24
+
25
+ | Mistake | Detection | Correction |
26
+ |---------|-----------|-----------|
27
+ | Teammate implements without reading CLAUDE.md | Report doesn't mention repo conventions | Re-dispatch with explicit instruction |
28
+ | Frontend teammate skips empty/error states | QA UX audit finds 🟣 violations | Re-dispatch with UX standards reminder |
29
+ | Plan has vague tasks like "implement feature" | Each task should have a clear input→output | Rewrite plan with specific tasks |
30
+ | API contract has `{}` placeholder | Frontend can't build types | Complete the contract shapes before wave 2 |
31
+ | Two teammates on same repo in same wave | Git conflicts guaranteed | Split into separate waves |
@@ -0,0 +1,73 @@
1
+ # Frontend UX Standards
2
+
3
+ Ce document est injecté dans le prompt de chaque teammate frontend.
4
+ Il définit le niveau de qualité UX minimum attendu.
5
+
6
+ ## Les 4 états obligatoires
7
+
8
+ Chaque composant qui affiche des données DOIT implémenter :
9
+
10
+ ### Loading state
11
+ - Skeleton loader qui reproduit la forme du contenu attendu
12
+ - Pas de spinner générique plein écran — le skeleton donne un aperçu de la structure
13
+ - Le skeleton est animé (pulse) pour indiquer l'activité
14
+ - Durée max avant timeout : configurable, défaut 10s → bascule sur error state
15
+
16
+ ### Empty state
17
+ - Illustration ou icône contextuelle (pas un message texte seul)
18
+ - Message clair qui explique pourquoi c'est vide
19
+ - Call-to-action pour créer le premier élément ou modifier les filtres
20
+ - Exemple : "Aucun budget défini. Créez votre premier budget pour commencer le suivi."
21
+
22
+ ### Error state
23
+ - Message d'erreur compréhensible par l'utilisateur (pas le message technique)
24
+ - Bouton "Réessayer" qui retente l'action
25
+ - Si l'erreur persiste, afficher un message secondaire avec un lien support
26
+ - Les erreurs réseau et les erreurs serveur ont des messages différents
27
+
28
+ ### Success state
29
+ - Le contenu s'affiche avec une transition fluide depuis le skeleton
30
+ - Si c'est une action (création, modification), feedback toast/notification
31
+ - L'état succès est le seul qui ne nécessite pas d'élément UI supplémentaire
32
+
33
+ ## Responsive
34
+
35
+ - **Mobile first** : construire la version mobile en premier
36
+ - Breakpoints Quasar : `$breakpoint-xs` (0-599), `$breakpoint-sm` (600-1023),
37
+ `$breakpoint-md` (1024-1439), `$breakpoint-lg` (1440+)
38
+ - Les tableaux de données sur mobile : basculer en vue carte/liste, pas de scroll horizontal
39
+ - Les formulaires sur mobile : champs empilés, clavier natif approprié (inputmode)
40
+ - Les actions principales : accessibles avec le pouce (zone basse de l'écran)
41
+
42
+ ## Interactions
43
+
44
+ - **Debounce** sur les inputs de recherche/filtre : 300ms
45
+ - **Optimistic updates** pour les actions rapides (toggle, suppression)
46
+ avec rollback en cas d'erreur API
47
+ - **Confirmation** pour les actions destructives (suppression, reset)
48
+ via dialog Quasar, pas window.confirm()
49
+ - **Transitions** entre les états : fade 150ms par défaut
50
+ - **Disabled state** clair sur les boutons pendant le traitement (pas de double submit)
51
+
52
+ ## Accessibilité (minimum)
53
+
54
+ - Tous les éléments interactifs ont un `aria-label` descriptif
55
+ - Navigation au clavier fonctionnelle (tab order logique, focus visible)
56
+ - Contraste minimum WCAG AA (4.5:1 texte, 3:1 grands textes)
57
+ - Les icônes sans texte ont un `aria-label` ou un tooltip
58
+ - Les formulaires ont des labels associés (pas de placeholder comme seul label)
59
+
60
+ ## Formulaires
61
+
62
+ - Validation inline au blur (pas seulement au submit)
63
+ - Messages d'erreur sous le champ concerné, en rouge, avec icône
64
+ - Bouton submit disabled tant que le formulaire est invalide
65
+ - Auto-focus sur le premier champ à l'ouverture
66
+ - Préserver les données saisies en cas d'erreur serveur
67
+
68
+ ## Design system
69
+
70
+ - Utiliser les composants Quasar natifs en priorité (QTable, QForm, QDialog...)
71
+ - Ne pas réinventer un composant qui existe dans Quasar
72
+ - Les couleurs, spacing, et typographie suivent le thème Quasar du projet
73
+ - Les icônes viennent d'un set unique (Material Icons ou celui configuré)
@@ -0,0 +1,109 @@
1
+ # Teammate Spawn Templates
2
+
3
+ Reference file for dispatch-feature. Loaded on-demand, not at skill activation.
4
+
5
+ > **v4.0**: The constitution rule is scoped to orchestrator/ only. Teammates do NOT
6
+ > receive the 12 universal principles automatically. Every spawn template below includes
7
+ > a "Universal principles" section that you MUST fill with the full 12 principles from
8
+ > `~/.claude/rules/constitution-en.md` (or the FR version from constitution.md).
9
+
10
+ ## Backend/API teammate spawn template
11
+
12
+ ```
13
+ You are teammate-[service]. Read the CLAUDE.md in your repo first.
14
+
15
+ ## Universal principles (non-negotiable)
16
+ [paste all 12 universal principles from the constitution — they are NOT auto-injected
17
+ into teammates since v4.0. Copy them from ~/.claude/rules/constitution-en.md]
18
+
19
+ ## Project rules (non-negotiable)
20
+ [paste project-specific rules from workspace constitution.md, translated to English]
21
+
22
+ ## API contract
23
+ [paste the exact request/response shapes this service must implement]
24
+ [note: frontend will build TypeScript interfaces from these shapes]
25
+
26
+ ## Your tasks
27
+ [paste tasks from plan for this service]
28
+
29
+ ## Instructions
30
+ 1. Read the repo CLAUDE.md first — follow its conventions
31
+ 2. Implement the tasks above following the full constitution (12 principles above + project rules)
32
+ 3. Use the LSP tool for code navigation (go-to-definition, find-references)
33
+ 4. Run the existing test suite — report pass/fail
34
+ 5. List any dead code created or exposed by your changes
35
+ 6. Commit on branch feature/[name] with conventional commits
36
+ 7. If you hit an architectural decision NOT covered by the plan: STOP and
37
+ report the dilemma instead of guessing
38
+ 8. Report back: files created/modified, tests pass/fail, dead code found, blockers
39
+ ```
40
+
41
+ ## Frontend teammate spawn template
42
+
43
+ ```
44
+ You are teammate-[service]. Read the CLAUDE.md in your repo first.
45
+
46
+ ## Universal principles (non-negotiable)
47
+ [paste all 12 universal principles from the constitution — they are NOT auto-injected
48
+ into teammates since v4.0. Copy them from ~/.claude/rules/constitution-en.md]
49
+
50
+ ## Project rules (non-negotiable)
51
+ [paste project-specific rules from workspace constitution.md, translated to English]
52
+
53
+ ## UX Standards (non-negotiable)
54
+ [paste full content of frontend-ux-standards.md]
55
+
56
+ ## API contract (TypeScript interfaces)
57
+ [paste exact response shapes from wave 1 — teammate builds TS interfaces from these]
58
+
59
+ ## Your tasks
60
+ [paste tasks from plan for this service]
61
+
62
+ ## Instructions
63
+ 1. Read the repo CLAUDE.md first — follow its conventions
64
+ 2. Implement the tasks following the full constitution (12 principles + project rules) and UX standards
65
+ 3. Use the LSP tool for code navigation
66
+ 4. Every new component MUST handle 4 states: skeleton loader, empty+CTA, error+retry, success
67
+ 5. Run the existing test suite — report pass/fail
68
+ 6. List any dead code (unused components, composables, store actions, CSS)
69
+ 7. Commit on branch feature/[name] with conventional commits
70
+ 8. If you hit an architectural decision NOT covered by the plan: STOP and escalate
71
+ 9. Report back: files created/modified, tests pass/fail, dead code found, UX compliance, blockers
72
+ ```
73
+
74
+ ## Infra/Config teammate spawn template
75
+
76
+ ```
77
+ You are teammate-[service]. Read the CLAUDE.md in your repo first.
78
+
79
+ ## Universal principles (non-negotiable)
80
+ [paste all 12 universal principles from the constitution — they are NOT auto-injected
81
+ into teammates since v4.0. Copy them from ~/.claude/rules/constitution-en.md]
82
+
83
+ ## Project rules (non-negotiable)
84
+ [paste project-specific rules from workspace constitution.md, translated to English]
85
+
86
+ ## Your tasks
87
+ [paste tasks — typically: gateway routes, deployment configs, env vars]
88
+
89
+ ## Instructions
90
+ 1. Read the repo CLAUDE.md first
91
+ 2. Implement the configuration changes following the full constitution
92
+ 3. Verify consistency with other services (env vars, routes, schemas)
93
+ 4. No code changes — only configuration
94
+ 5. Commit on branch feature/[name]
95
+ 6. If you hit an architectural decision NOT covered by the plan: STOP and escalate
96
+ 7. Report back: files modified, consistency check results, blockers
97
+ ```
98
+
99
+ ## Explore/Haiku subagent template (read-only)
100
+
101
+ ```
102
+ You are an explorer scanning [target]. Read-only — do NOT modify any files.
103
+
104
+ ## Task
105
+ [specific read-only investigation task]
106
+
107
+ ## Report format
108
+ [what to extract and how to format the findings]
109
+ ```
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # notify-user.sh
3
+ # Notification hook: sends desktop notification when Claude needs attention.
4
+ # Works on macOS (osascript), Linux (notify-send), and falls back to terminal bell.
5
+ set -euo pipefail
6
+
7
+ INPUT=$(cat)
8
+
9
+ MESSAGE=$(echo "$INPUT" | jq -r '.message // "Claude Code needs your attention"' 2>/dev/null) || MESSAGE="Claude Code needs your attention"
10
+ TITLE="Claude Code Orchestrator"
11
+
12
+ # Sanitize message for safe shell interpolation (strip quotes, backslashes, special chars)
13
+ SAFE_MESSAGE=$(printf '%s' "$MESSAGE" | tr -d '"\\\n' | head -c 200)
14
+ SAFE_TITLE=$(printf '%s' "$TITLE" | tr -d '"\\\n')
15
+
16
+ # Try macOS notification — use positional args to avoid injection
17
+ if command -v osascript &>/dev/null; then
18
+ osascript -e 'on run argv' \
19
+ -e 'display notification (item 1 of argv) with title (item 2 of argv)' \
20
+ -e 'end run' \
21
+ -- "$SAFE_MESSAGE" "$SAFE_TITLE" 2>/dev/null || true
22
+ # Try Linux notification
23
+ elif command -v notify-send &>/dev/null; then
24
+ notify-send -- "$SAFE_TITLE" "$SAFE_MESSAGE" 2>/dev/null || true
25
+ fi
26
+
27
+ # Always ring terminal bell as fallback
28
+ printf '\a' 2>/dev/null || true
29
+
30
+ exit 0
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # permission-auto-approve.sh
3
+ # PermissionRequest hook: auto-approves Read/Glob/Grep to reduce friction.
4
+ # Uses hookSpecificOutput JSON with decision.behavior: "allow".
5
+ set -euo pipefail
6
+
7
+ INPUT=$(cat)
8
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null) || true
9
+
10
+ if echo "$TOOL_NAME" | grep -qE '^(Read|Glob|Grep)$'; then
11
+ cat << 'EOF'
12
+ {"hookSpecificOutput":{"hookEventName":"PermissionRequest","decision":{"behavior":"allow","toolNames":["Read","Glob","Grep"]}}}
13
+ EOF
14
+ fi
15
+
16
+ exit 0
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env bash
2
+ # session-start-context.sh
3
+ # SessionStart hook: injects active plan context and repo status.
4
+ # Stdout on exit 0 is added as context visible to Claude.
5
+ set -euo pipefail
6
+
7
+ cat > /dev/null
8
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
9
+ OUTPUT=""
10
+
11
+ # Find active plans (plans with pending ⏳ or in-progress 🔄 tasks)
12
+ if [ -d "$PROJECT_DIR/plans" ]; then
13
+ ACTIVE_PLANS=$(find "$PROJECT_DIR/plans" -name '*.md' \
14
+ ! -name '_TEMPLATE.md' \
15
+ ! -name 'service-profiles.md' \
16
+ -exec grep -l '⏳\|🔄' {} \; 2>/dev/null \
17
+ | sort | tail -5)
18
+
19
+ if [ -n "$ACTIVE_PLANS" ]; then
20
+ FIRST_PLAN=""
21
+ OUTPUT+="[Session context] Active plans with pending tasks:\n"
22
+ while IFS= read -r plan; do
23
+ PLAN_NAME=$(basename "$plan")
24
+ [ -z "$FIRST_PLAN" ] && FIRST_PLAN="$PLAN_NAME"
25
+ TODO=$(grep -c '⏳' "$plan" 2>/dev/null || echo "0")
26
+ WIP=$(grep -c '🔄' "$plan" 2>/dev/null || echo "0")
27
+ DONE=$(grep -c '✅' "$plan" 2>/dev/null || echo "0")
28
+ OUTPUT+=" - $PLAN_NAME (⏳ $TODO pending, 🔄 $WIP in progress, ✅ $DONE done)\n"
29
+ done <<< "$ACTIVE_PLANS"
30
+ OUTPUT+="\nRead these plans to resume where you left off.\n"
31
+
32
+ # Export active plan name to Claude's environment if supported
33
+ if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "$FIRST_PLAN" ]; then
34
+ echo "ACTIVE_PLAN=$FIRST_PLAN" >> "$CLAUDE_ENV_FILE"
35
+ fi
36
+ fi
37
+ fi
38
+
39
+ # Check workspace.md exists
40
+ if [ ! -f "$PROJECT_DIR/workspace.md" ]; then
41
+ OUTPUT+="[WARNING] No workspace.md found. Run setup-workspace.sh first.\n"
42
+ fi
43
+
44
+ # First-session detection
45
+ if [ -f "$PROJECT_DIR/workspace.md" ]; then
46
+ if grep -q '\[UNCONFIGURED\]' "$PROJECT_DIR/workspace.md" 2>/dev/null; then
47
+ OUTPUT+="[FIRST SESSION] workspace.md is not yet configured. Run: claude --agent workspace-init\n"
48
+ OUTPUT+="Sibling repos detected:\n"
49
+ PARENT_DIR="$(cd "$PROJECT_DIR/.." 2>/dev/null && pwd)"
50
+ if [ -n "$PARENT_DIR" ] && [ -d "$PARENT_DIR" ]; then
51
+ for dir in "$PARENT_DIR"/*/; do
52
+ [ -d "$dir" ] || continue
53
+ dir_name=$(basename "$dir")
54
+ [ "$dir_name" = "$(basename "$PROJECT_DIR")" ] && continue
55
+ [ -d "$dir/.git" ] && OUTPUT+=" - $dir_name\n"
56
+ done
57
+ fi
58
+ OUTPUT+="\n"
59
+ fi
60
+ fi
61
+
62
+ # Auto-discovery: detect new repos not in workspace.md
63
+ if [ -f "$PROJECT_DIR/workspace.md" ] && ! grep -q '\[UNCONFIGURED\]' "$PROJECT_DIR/workspace.md" 2>/dev/null; then
64
+ PARENT_DIR="$(cd "$PROJECT_DIR/.." 2>/dev/null && pwd)"
65
+ NEW_REPOS=""
66
+ if [ -n "$PARENT_DIR" ] && [ -d "$PARENT_DIR" ]; then
67
+ for dir in "$PARENT_DIR"/*/; do
68
+ [ -d "$dir" ] || continue
69
+ dir_name=$(basename "$dir")
70
+ [ "$dir_name" = "$(basename "$PROJECT_DIR")" ] && continue
71
+ if [ -d "$dir/.git" ] && ! grep -q "$dir_name" "$PROJECT_DIR/workspace.md" 2>/dev/null; then
72
+ NEW_REPOS+=" - $dir_name\n"
73
+ fi
74
+ done
75
+ fi
76
+ if [ -n "$NEW_REPOS" ]; then
77
+ OUTPUT+="[Auto-discovery] New repos detected (not in workspace.md):\n$NEW_REPOS\n"
78
+ fi
79
+ fi
80
+
81
+ if [ -n "$OUTPUT" ]; then
82
+ echo -e "$OUTPUT"
83
+ fi
84
+
85
+ exit 0
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # subagent-start-context.sh
3
+ # SubagentStart hook: injects active plan + constitution reference into each subagent.
4
+ # Stdout is added as additionalContext for the subagent.
5
+ set -euo pipefail
6
+
7
+ cat > /dev/null
8
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
9
+ OUTPUT=""
10
+
11
+ # Inject active plan context
12
+ if [ -d "$PROJECT_DIR/plans" ]; then
13
+ ACTIVE_PLAN=$(find "$PROJECT_DIR/plans" -name '*.md' \
14
+ ! -name '_TEMPLATE.md' \
15
+ ! -name 'service-profiles.md' \
16
+ ! -name 'retro-*.md' \
17
+ -exec grep -l '⏳\|🔄' {} \; 2>/dev/null \
18
+ | sort | head -1)
19
+
20
+ if [ -n "$ACTIVE_PLAN" ]; then
21
+ PLAN_NAME=$(basename "$ACTIVE_PLAN")
22
+ OUTPUT+="[Subagent context] Active plan: $PLAN_NAME\n"
23
+ OUTPUT+="Read $ACTIVE_PLAN for your assigned tasks.\n"
24
+ fi
25
+ fi
26
+
27
+ # Remind about constitution
28
+ if [ -f "$PROJECT_DIR/constitution.md" ]; then
29
+ OUTPUT+="[Project constitution] Non-negotiable rules in $PROJECT_DIR/constitution.md — read and follow.\n"
30
+ fi
31
+
32
+ OUTPUT+="[Reminder] Report back: files changed, tests pass/fail, dead code found, blockers.\n"
33
+
34
+ echo -e "$OUTPUT"
35
+ exit 0