tribunal-kit 2.4.6 → 3.1.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 (250) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +139 -86
  4. package/.agent/agents/ai-code-reviewer.md +160 -90
  5. package/.agent/agents/backend-specialist.md +164 -127
  6. package/.agent/agents/code-archaeologist.md +115 -73
  7. package/.agent/agents/database-architect.md +130 -110
  8. package/.agent/agents/debugger.md +137 -97
  9. package/.agent/agents/dependency-reviewer.md +78 -30
  10. package/.agent/agents/devops-engineer.md +161 -118
  11. package/.agent/agents/documentation-writer.md +151 -87
  12. package/.agent/agents/explorer-agent.md +117 -99
  13. package/.agent/agents/frontend-reviewer.md +127 -47
  14. package/.agent/agents/frontend-specialist.md +169 -109
  15. package/.agent/agents/game-developer.md +28 -164
  16. package/.agent/agents/logic-reviewer.md +87 -49
  17. package/.agent/agents/mobile-developer.md +151 -103
  18. package/.agent/agents/mobile-reviewer.md +133 -50
  19. package/.agent/agents/orchestrator.md +121 -110
  20. package/.agent/agents/penetration-tester.md +103 -77
  21. package/.agent/agents/performance-optimizer.md +136 -92
  22. package/.agent/agents/performance-reviewer.md +139 -69
  23. package/.agent/agents/product-manager.md +104 -70
  24. package/.agent/agents/product-owner.md +6 -25
  25. package/.agent/agents/project-planner.md +95 -95
  26. package/.agent/agents/qa-automation-engineer.md +174 -87
  27. package/.agent/agents/security-auditor.md +133 -129
  28. package/.agent/agents/seo-specialist.md +160 -99
  29. package/.agent/agents/sql-reviewer.md +132 -44
  30. package/.agent/agents/supervisor-agent.md +137 -109
  31. package/.agent/agents/swarm-worker-contracts.md +17 -17
  32. package/.agent/agents/swarm-worker-registry.md +46 -46
  33. package/.agent/agents/test-coverage-reviewer.md +132 -53
  34. package/.agent/agents/test-engineer.md +0 -21
  35. package/.agent/agents/type-safety-reviewer.md +143 -33
  36. package/.agent/patterns/generator.md +9 -9
  37. package/.agent/patterns/inversion.md +12 -12
  38. package/.agent/patterns/pipeline.md +9 -9
  39. package/.agent/patterns/reviewer.md +13 -13
  40. package/.agent/patterns/tool-wrapper.md +9 -9
  41. package/.agent/rules/GEMINI.md +63 -63
  42. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  43. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  44. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  45. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  46. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  47. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  48. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  49. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  50. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  51. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  52. package/.agent/scripts/compress_skills.py +167 -0
  53. package/.agent/scripts/consolidate_skills.py +173 -0
  54. package/.agent/scripts/deep_compress.py +202 -0
  55. package/.agent/scripts/minify_context.py +80 -0
  56. package/.agent/scripts/security_scan.py +1 -1
  57. package/.agent/scripts/strip_tribunal.py +41 -0
  58. package/.agent/skills/agent-organizer/SKILL.md +60 -100
  59. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  60. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
  61. package/.agent/skills/api-patterns/SKILL.md +197 -257
  62. package/.agent/skills/api-security-auditor/SKILL.md +125 -57
  63. package/.agent/skills/app-builder/SKILL.md +326 -50
  64. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  65. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  66. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  67. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  68. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  69. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  70. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  71. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  72. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  73. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  74. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  75. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  76. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  77. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  78. package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
  79. package/.agent/skills/architecture/SKILL.md +161 -200
  80. package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
  81. package/.agent/skills/bash-linux/SKILL.md +71 -166
  82. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  83. package/.agent/skills/brainstorming/SKILL.md +345 -127
  84. package/.agent/skills/building-native-ui/SKILL.md +125 -57
  85. package/.agent/skills/clean-code/SKILL.md +266 -149
  86. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  87. package/.agent/skills/config-validator/SKILL.md +73 -131
  88. package/.agent/skills/csharp-developer/SKILL.md +434 -73
  89. package/.agent/skills/database-design/SKILL.md +190 -275
  90. package/.agent/skills/deployment-procedures/SKILL.md +81 -158
  91. package/.agent/skills/devops-engineer/SKILL.md +255 -94
  92. package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
  93. package/.agent/skills/doc.md +5 -5
  94. package/.agent/skills/documentation-templates/SKILL.md +19 -63
  95. package/.agent/skills/edge-computing/SKILL.md +75 -165
  96. package/.agent/skills/extract-design-system/SKILL.md +84 -58
  97. package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
  98. package/.agent/skills/frontend-design/SKILL.md +151 -499
  99. package/.agent/skills/game-design-expert/SKILL.md +71 -0
  100. package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
  101. package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
  102. package/.agent/skills/github-operations/SKILL.md +197 -272
  103. package/.agent/skills/gsap-expert/SKILL.md +194 -0
  104. package/.agent/skills/i18n-localization/SKILL.md +60 -172
  105. package/.agent/skills/intelligent-routing/SKILL.md +123 -103
  106. package/.agent/skills/lint-and-validate/SKILL.md +8 -52
  107. package/.agent/skills/llm-engineering/SKILL.md +281 -195
  108. package/.agent/skills/local-first/SKILL.md +76 -159
  109. package/.agent/skills/mcp-builder/SKILL.md +48 -188
  110. package/.agent/skills/mobile-design/SKILL.md +213 -219
  111. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  112. package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
  113. package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
  114. package/.agent/skills/observability/SKILL.md +211 -203
  115. package/.agent/skills/parallel-agents/SKILL.md +53 -146
  116. package/.agent/skills/performance-profiling/SKILL.md +171 -151
  117. package/.agent/skills/plan-writing/SKILL.md +49 -153
  118. package/.agent/skills/platform-engineer/SKILL.md +57 -103
  119. package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
  120. package/.agent/skills/powershell-windows/SKILL.md +61 -179
  121. package/.agent/skills/python-patterns/SKILL.md +7 -35
  122. package/.agent/skills/python-pro/SKILL.md +273 -114
  123. package/.agent/skills/react-specialist/SKILL.md +227 -108
  124. package/.agent/skills/readme-builder/SKILL.md +15 -85
  125. package/.agent/skills/realtime-patterns/SKILL.md +216 -243
  126. package/.agent/skills/red-team-tactics/SKILL.md +10 -51
  127. package/.agent/skills/rust-pro/SKILL.md +525 -142
  128. package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
  129. package/.agent/skills/server-management/SKILL.md +110 -166
  130. package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
  131. package/.agent/skills/skill-creator/SKILL.md +18 -58
  132. package/.agent/skills/sql-pro/SKILL.md +543 -68
  133. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
  134. package/.agent/skills/swiftui-expert/SKILL.md +124 -57
  135. package/.agent/skills/systematic-debugging/SKILL.md +49 -151
  136. package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
  137. package/.agent/skills/tdd-workflow/SKILL.md +63 -169
  138. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  139. package/.agent/skills/testing-patterns/SKILL.md +437 -130
  140. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  141. package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
  142. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  143. package/.agent/skills/vue-expert/SKILL.md +225 -119
  144. package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
  145. package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
  146. package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
  147. package/.agent/skills/webapp-testing/SKILL.md +71 -196
  148. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  149. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  150. package/.agent/workflows/api-tester.md +96 -224
  151. package/.agent/workflows/audit.md +81 -122
  152. package/.agent/workflows/brainstorm.md +69 -105
  153. package/.agent/workflows/changelog.md +65 -97
  154. package/.agent/workflows/create.md +73 -88
  155. package/.agent/workflows/debug.md +80 -111
  156. package/.agent/workflows/deploy.md +119 -92
  157. package/.agent/workflows/enhance.md +80 -91
  158. package/.agent/workflows/fix.md +68 -97
  159. package/.agent/workflows/generate.md +165 -164
  160. package/.agent/workflows/migrate.md +106 -109
  161. package/.agent/workflows/orchestrate.md +103 -86
  162. package/.agent/workflows/performance-benchmarker.md +77 -268
  163. package/.agent/workflows/plan.md +120 -98
  164. package/.agent/workflows/preview.md +39 -96
  165. package/.agent/workflows/refactor.md +105 -97
  166. package/.agent/workflows/review-ai.md +63 -102
  167. package/.agent/workflows/review.md +71 -110
  168. package/.agent/workflows/session.md +53 -113
  169. package/.agent/workflows/status.md +42 -88
  170. package/.agent/workflows/strengthen-skills.md +90 -51
  171. package/.agent/workflows/swarm.md +114 -129
  172. package/.agent/workflows/test.md +125 -102
  173. package/.agent/workflows/tribunal-backend.md +60 -78
  174. package/.agent/workflows/tribunal-database.md +62 -100
  175. package/.agent/workflows/tribunal-frontend.md +62 -82
  176. package/.agent/workflows/tribunal-full.md +56 -100
  177. package/.agent/workflows/tribunal-mobile.md +65 -94
  178. package/.agent/workflows/tribunal-performance.md +62 -105
  179. package/.agent/workflows/ui-ux-pro-max.md +72 -121
  180. package/README.md +11 -15
  181. package/package.json +1 -1
  182. package/.agent/skills/api-patterns/api-style.md +0 -42
  183. package/.agent/skills/api-patterns/auth.md +0 -24
  184. package/.agent/skills/api-patterns/documentation.md +0 -26
  185. package/.agent/skills/api-patterns/graphql.md +0 -41
  186. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  187. package/.agent/skills/api-patterns/response.md +0 -37
  188. package/.agent/skills/api-patterns/rest.md +0 -40
  189. package/.agent/skills/api-patterns/security-testing.md +0 -122
  190. package/.agent/skills/api-patterns/trpc.md +0 -41
  191. package/.agent/skills/api-patterns/versioning.md +0 -22
  192. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  193. package/.agent/skills/app-builder/feature-building.md +0 -53
  194. package/.agent/skills/app-builder/project-detection.md +0 -34
  195. package/.agent/skills/app-builder/scaffolding.md +0 -118
  196. package/.agent/skills/app-builder/tech-stack.md +0 -40
  197. package/.agent/skills/architecture/context-discovery.md +0 -43
  198. package/.agent/skills/architecture/examples.md +0 -94
  199. package/.agent/skills/architecture/pattern-selection.md +0 -68
  200. package/.agent/skills/architecture/patterns-reference.md +0 -50
  201. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  202. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  203. package/.agent/skills/database-design/database-selection.md +0 -43
  204. package/.agent/skills/database-design/indexing.md +0 -39
  205. package/.agent/skills/database-design/migrations.md +0 -48
  206. package/.agent/skills/database-design/optimization.md +0 -36
  207. package/.agent/skills/database-design/orm-selection.md +0 -30
  208. package/.agent/skills/database-design/schema-design.md +0 -56
  209. package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
  210. package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
  211. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  212. package/.agent/skills/frontend-design/color-system.md +0 -329
  213. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  214. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  215. package/.agent/skills/frontend-design/typography-system.md +0 -363
  216. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  217. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  218. package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
  219. package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
  220. package/.agent/skills/game-development/SKILL.md +0 -236
  221. package/.agent/skills/game-development/game-art/SKILL.md +0 -185
  222. package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
  223. package/.agent/skills/game-development/game-design/SKILL.md +0 -129
  224. package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
  225. package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
  226. package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
  227. package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
  228. package/.agent/skills/game-development/web-games/SKILL.md +0 -150
  229. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  230. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  231. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  232. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  233. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  234. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  235. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  236. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  237. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  238. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  239. package/.agent/skills/mobile-design/platform-android.md +0 -666
  240. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  241. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  242. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  243. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  244. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  245. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  246. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  247. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  248. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  249. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  250. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Coordinate multiple agents for complex tasks. Use for multi-perspective analysis, comprehensive reviews, or tasks requiring different domain expertise.
2
+ description: Coordinate multiple agents for complex tasks. Use for multi-perspective analysis, comprehensive reviews requiring different domain expertise, or tasks where a single agent would miss domain-specific failures. Fan-Out dispatch → parallel execution → Fan-In synthesis → Human Gate.
3
3
  ---
4
4
 
5
5
  # /orchestrate — Multi-Agent Coordination
@@ -8,144 +8,161 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command coordinates multiple specialists to solve a problem that requires more than one domain. **One agent is not orchestration.**
11
+ ## When to Use /orchestrate
12
+
13
+ |Use `/orchestrate` when...|Use something else when...|
14
+ |:---|:---|
15
+ |Task spans 2+ technical domains|Single domain → use specialist directly|
16
+ |Multi-perspective review is needed|Simple code generation → `/generate`|
17
+ |Fan-out parallelism would save time|Debugging → `/debug` (sequential by nature)|
18
+ |One agent would miss domain failures|Planning only → `/plan`|
12
19
 
13
20
  ---
14
21
 
15
- ## When to Use /orchestrate vs Other Commands
22
+ ## Phase 1 Scope Classification
16
23
 
17
- | Use `/orchestrate` when... | Use something else when... |
18
- |---|---|
19
- | Task requires 3+ domain specialists | Single domain → use the right `/tribunal-*` |
20
- | Sequential work with review gates between waves | Parallel, independent tasks → `/swarm` |
21
- | Existing codebase with complex dependencies | Greenfield project → `/create` |
22
- | Human gates required between every wave | Maximum parallel output → `/swarm` |
24
+ Before dispatching workers:
25
+
26
+ ```
27
+ 1. Is this actually multi-domain? (2+ distinct technical areas)
28
+ YES proceed to Phase 2
29
+ NO → route to the single correct specialist agent
30
+
31
+ 2. Can tasks be parallelized (no dependencies between them)?
32
+ → YES → Fan-Out dispatch (all workers simultaneous)
33
+ → NO → Sequential wave dispatch
34
+
35
+ 3. Context budget check:
36
+ □ How many files does each worker need?
37
+ □ Total context across all workers manageable?
38
+ □ Can I pass context_summary instead of full file dumps?
39
+ ```
23
40
 
24
41
  ---
25
42
 
26
- ## The Minimum Rule
43
+ ## Phase 2 — Worker Decomposition
27
44
 
28
- > **Fewer than 3 agents = not orchestration.**
29
- >
30
- > Before marking any orchestration session as complete, count the agents invoked. If the count is less than 3, activate more. A single agent delegated to is just a delegation.
45
+ Break the goal into atomic, non-overlapping worker tasks:
31
46
 
32
- ---
47
+ ```
48
+ Goal: Review the full checkout feature before launch
33
49
 
34
- ## Agent Selection by Task Type
50
+ Decomposed Workers:
51
+ ├── Worker A [backend-specialist]: Review API routes for auth and validation
52
+ ├── Worker B [database-architect]: Review DB queries for N+1 and transactions
53
+ ├── Worker C [frontend-specialist]: Review UI components for RSC compliance
54
+ └── Worker D [security-auditor]: Review the full checkout flow for OWASP issues
55
+ ```
35
56
 
36
- | Task | Required Specialists |
37
- |---|---|
38
- | Full-stack feature | `frontend-specialist` + `backend-specialist` + `test-engineer` |
39
- | API build | `backend-specialist` + `security-auditor` + `test-engineer` |
40
- | Database-heavy work | `database-architect` + `backend-specialist` + `security-auditor` |
41
- | Complete product | `project-planner` + `frontend-specialist` + `backend-specialist` + `devops-engineer` |
42
- | Security investigation | `security-auditor` + `penetration-tester` + `devops-engineer` |
43
- | Complex bug | `debugger` + `explorer-agent` + `test-engineer` |
44
- | New codebase or unknown repo | `explorer-agent` + relevant specialists |
57
+ **Worker files cannot overlap.** If two workers both need to modify the same file → one worker owns it.
45
58
 
46
59
  ---
47
60
 
48
- ## Two-Phase Protocol (Strict)
49
-
50
- ### Phase A — Planning Only
61
+ ## Fan-Out Pattern (Parallel Dispatch)
51
62
 
52
- Only two agents are allowed during planning:
63
+ When tasks are independent, dispatch all simultaneously:
53
64
 
54
65
  ```
55
- project-planner → writes docs/PLAN-{slug}.md
56
- explorer-agent → (if working in existing code) maps the codebase structure
66
+ ━━━ Wave 1: Fan-Out ━━━━━━━━━━━━━━━━━━━━━━━
67
+ Worker A (backend)RUNNING (reading: src/app/api/checkout/)
68
+ Worker B (database) → RUNNING (reading: prisma/schema.prisma, checkout queries)
69
+ Worker C (frontend) → RUNNING (reading: src/app/checkout/page.tsx)
70
+ Worker D (security) → RUNNING (reading: all of the above)
71
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
+
73
+ Wait for ALL workers (allSettled — single worker failure doesn't cancel siblings)
74
+
75
+ ━━━ Wave 1: Results ━━━━━━━━━━━━━━━━━━━━━━━
76
+ Worker A: ✅ COMPLETE
77
+ Worker B: ✅ COMPLETE
78
+ Worker C: ⚠️ BLOCKED (missing: what state management pattern to assume)
79
+ Worker D: ✅ COMPLETE
80
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
81
+
82
+ Supervisor provides missing info to Worker C → redispatch
57
83
  ```
58
84
 
59
- No other agent runs. No code is produced.
85
+ ---
60
86
 
61
- After planning, the plan is shown to the user:
87
+ ## BLOCKED Worker Protocol
62
88
 
63
- ```
64
- ✅ Plan ready: docs/PLAN-{slug}.md
89
+ When a worker cannot proceed:
65
90
 
66
- Approve to start implementation? (Y / N)
91
+ ```
92
+ Status: BLOCKED
93
+ Reason: Missing context — the auth middleware file is not in provided scope
94
+ Unblocked by: Read src/middleware.ts first and pass auth pattern to worker
95
+
96
+ Supervisor action:
97
+ 1. Provide the missing context if available
98
+ 2. Escalate to human if decision is needed
99
+ 3. Never guess — BLOCKED beats hallucinating
67
100
  ```
68
101
 
69
- **Phase B does NOT start without a Y.**
102
+ ---
70
103
 
71
- ### Phase B — Implementation (Manager & Micro-Workers)
104
+ ## Sequential Wave Execution
72
105
 
73
- After approval, the Orchestrator acts as Manager and dispatches Micro-Workers using **isolated JSON payloads**.
106
+ When tasks depend on each other:
74
107
 
75
108
  ```
76
- Wave 1: database-architect + security-auditor (JSON dispatch #1)
77
-
78
- [Wait for completion & Tribunal review]
79
-
80
- Wave 2: backend-specialist + frontend-specialist (JSON dispatch #2)
81
-
82
- [Wait for completion & Tribunal review]
83
-
84
- Wave 3: test-engineer (JSON dispatch #3)
85
-
86
- [Wait for completion & Human Gate]
109
+ Wave 1 Foundation (must complete first)
110
+ Wave 2 → Depends on Wave 1 output (receives context_summary, not full output)
111
+ Wave 3 Synthesis (combines all wave outputs)
87
112
  ```
88
113
 
89
- Workers execute in parallel **within** their wave, but waves execute **sequentially**. Each wave waits for the previous wave's Tribunal gate before proceeding.
114
+ **Context discipline between waves:** Summarize Wave N output in 3-5 bullets before passing to Wave N+1.
90
115
 
91
116
  ---
92
117
 
93
- ## Hierarchical Context Pruning
94
-
95
- When dispatching workers, the Orchestrator MUST use the `dispatch_micro_workers` JSON format.
118
+ ## Fan-In Synthesis
96
119
 
97
- **Context discipline is strictly enforced:**
120
+ After all workers complete:
98
121
 
99
122
  ```
100
- Never pass full chat histories to workers
101
- Never attach every file attach only files the worker will actually read
102
- The context_summary injected by the Orchestrator is the ONLY shared context
103
- Files attached are strictly limited to what's needed for that specific task
123
+ 1. Merge findings by severity
124
+ 2. Identify conflicts (Worker A says X, Worker B says Y)
125
+ 3. Resolve conflicts with evidence (which worker has specific file evidence?)
126
+ 4. Produce unified output sorted by priority
104
127
  ```
105
128
 
106
- **Per-worker context limit:** Excerpt only the relevant function or schema section — never the entire file.
107
-
108
129
  ---
109
130
 
110
- ## Retry Protocol
131
+ ## Human Gate
111
132
 
112
133
  ```
113
- Attempt 1 → Worker runs with original parameters
114
- Attempt 2 → Worker runs with stricter constraints + failure feedback
115
- Attempt 3 → Worker runs with max constraints + full context dump
116
- Attempt 4 → HALT. Report to human with full failure history.
117
- ```
134
+ ━━━ Orchestration Complete ━━━━━━━━━━━━━━━━━
118
135
 
119
- Hard limit: **3 retries per worker**. After 3 failures, escalate — do not silently proceed.
136
+ Workers: 4 dispatched / 4 complete / 0 blocked
120
137
 
121
- ---
138
+ ━━━ Synthesized Findings ━━━━━━━━━━━━━━━━━━
139
+ [Critical issues first, then high, then medium]
122
140
 
123
- ## Hallucination Guard
141
+ ━━━ Required Changes ━━━━━━━━━━━━━━━━━━━━━
142
+ Files to modify: [list]
143
+ Files to create: [list]
124
144
 
125
- - Every agent's output goes through Tribunal before it reaches the user
126
- - The Human Gate fires before any file is written — user sees the diff and approves
127
- - Per-agent scope is enforced — `frontend-specialist` **never** writes DB migrations
128
- - Retry limit: 3 Maker revisions per agent; after 3 failures → stop and report
129
- - `context_summary` is the only mechanism for sharing context across agents — no full dumps
145
+ ━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
+ Approve? Y = proceed | N = discard | R = revise
147
+ ```
130
148
 
131
149
  ---
132
150
 
133
- ## Cross-Workflow Navigation
151
+ ## Error Recovery
134
152
 
135
- | When /orchestrate reveals... | Go to |
136
- |---|---|
137
- | Worker keeps failing after 3 retries | `/debug` the isolated worker task |
138
- | Plan needed before orchestrating | `/plan` first, then run `/orchestrate` against it |
139
- | Fully parallel independent sub-tasks | `/swarm` is more efficient |
140
- | Single domain needs specialist audit | Use the domain-specific `/tribunal-*` |
153
+ ```
154
+ Worker failure (after 3 retries):
155
+ Report: agent=[name], task=[what], attempts=3, last_error=[error], suggestion=[what to check]
156
+ Action: continue remaining workers, include failure in final synthesis
157
+ ```
141
158
 
142
159
  ---
143
160
 
144
- ## Usage
161
+ ## Usage Examples
145
162
 
146
163
  ```
147
- /orchestrate build a complete auth system with JWT and refresh tokens
148
- /orchestrate review the entire API layer for security issues
149
- /orchestrate build a multi-tenant SaaS onboarding flow
150
- /orchestrate analyze this repo and implement all security findings
164
+ /orchestrate review the entire authentication system for security and correctness
165
+ /orchestrate analyze the payment feature: backend logic + DB queries + frontend UX
166
+ /orchestrate comprehensive code review before launch: security + tests + performance
167
+ /orchestrate compare three different caching strategies and recommend the best fit
151
168
  ```
@@ -1,305 +1,114 @@
1
1
  ---
2
- description: Run standardized performance benchmarks including Lighthouse, bundle analysis, and latency checks.
2
+ description: Run standardized performance benchmarks including Lighthouse CI, bundle analysis, and API latency checks. Records before/after metrics. No optimization claims without measured evidence.
3
3
  ---
4
4
 
5
- # /performance-benchmarker — Automated Performance Audit
5
+ # /performance-benchmarker — Evidence-Based Performance Measurement
6
6
 
7
7
  $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command runs a comprehensive suite of performance benchmarks against your project and generates a structured report with numerical scores, regression detection, and prioritized actionable fixes.
11
+ ## When to Use /performance-benchmarker
12
12
 
13
- ---
14
-
15
- ## When to Use
16
-
17
- - Before any `/deploy` to catch performance regressions.
18
- - After adding new dependencies or large features.
19
- - When user reports "it feels slow" or asks to "check performance".
20
- - When triggered by `benchmark`, `lighthouse`, `bundle size`, or `latency` keywords.
21
-
22
- ---
23
-
24
- ## Pipeline Flow
25
-
26
- ```
27
- Request (scope: full / web-vitals / bundle / api)
28
-
29
-
30
- Environment detection — framework, build tool, package manager
31
-
32
-
33
- Tool availability check — lighthouse? build script? dev server?
34
-
35
-
36
- Benchmark execution — run selected checks
37
-
38
-
39
- Score calculation — weighted composite
40
-
41
-
42
- Regression detection — compare against previous baselines (if available)
43
-
44
-
45
- Report — scores, pass/fail, recommendations, fix priority
46
- ```
13
+ |Use `/performance-benchmarker` when...|Use something else when...|
14
+ |:---|:---|
15
+ |Establishing performance baseline|Code optimization decisions → `/tribunal-performance`|
16
+ |After optimization — verify improvement|Memory leaks investigation → `/debug`|
17
+ |Pre-release performance gate|Bundle analysis only run ANALYZE=true npm run build|
18
+ |Regular weekly benchmark|API review only `/tribunal-backend`|
47
19
 
48
20
  ---
49
21
 
50
- ## Benchmark Suite
22
+ ## Benchmark Suite (Run in Order)
51
23
 
52
- ### 1. Web Vitals (Frontend Performance)
53
-
54
- | Metric | Good | Needs Work | Poor | Measurement |
55
- |---|---|---|---|---|
56
- | LCP (Largest Contentful Paint) | < 2.5s | 2.5-4.0s | > 4.0s | Lighthouse or `web-vitals` library |
57
- | INP (Interaction to Next Paint) | < 200ms | 200-500ms | > 500ms | Lab approximation via TBT |
58
- | CLS (Cumulative Layout Shift) | < 0.1 | 0.1-0.25 | > 0.25 | Layout shift detection |
59
- | TTFB (Time to First Byte) | < 800ms | 800-1800ms | > 1800ms | Server response timing |
60
- | FCP (First Contentful Paint) | < 1.8s | 1.8-3.0s | > 3.0s | Lighthouse |
61
- | Speed Index | < 3.4s | 3.4-5.8s | > 5.8s | Lighthouse |
62
-
63
- **How to Run:**
64
24
  ```bash
65
- # If lighthouse is available
66
- npx lighthouse http://localhost:3000 --output json --chrome-flags="--headless"
67
-
68
- # If web-vitals is installed, inject into page and measure
69
- # VERIFY: check if lighthouse-cli is available before running
25
+ # 1. Lighthouse CI — Core Web Vitals
26
+ npx lighthouse http://localhost:3000 \
27
+ --output=json \
28
+ --output-path=./reports/lighthouse-$(date +%Y%m%d).json \
29
+ --only-categories=performance,accessibility,best-practices,seo
30
+
31
+ # 2. Bundle Analysis
32
+ ANALYZE=true npm run build
33
+
34
+ # 3. API latency (using autocannon for load test)
35
+ npx autocannon -c 10 -d 20 http://localhost:3000/api/products
36
+ # -c: 10 concurrent connections
37
+ # -d: 20 second duration
38
+
39
+ # 4. Database query analysis
40
+ # (Prisma): Add to your test route temporarily
41
+ const plan = await prisma.$queryRaw`EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = ${userId}`;
42
+ console.log(plan);
70
43
  ```
71
44
 
72
- **Common Fixes by Metric:**
73
-
74
- | Metric | Fix | Impact |
75
- |---|---|---|
76
- | LCP slow | Preload hero image, use `fetchpriority="high"` | High |
77
- | LCP slow | Eliminate render-blocking CSS/JS | High |
78
- | INP slow | Break long tasks > 50ms into smaller chunks | High |
79
- | INP slow | Use `requestIdleCallback` for non-critical work | Medium |
80
- | CLS high | Set explicit `width`/`height` on images/embeds | High |
81
- | CLS high | Use `font-display: swap` + font preload | Medium |
82
- | TTFB slow | Add caching headers, use CDN | High |
83
- | TTFB slow | Optimize database queries, add indexes | High |
84
- | FCP slow | Inline critical CSS, defer non-critical | High |
85
-
86
- ### 2. Bundle Analysis (JavaScript/CSS)
87
-
88
- | Check | Target | Warning | Fail | Tool |
89
- |---|---|---|---|---|
90
- | Total JS (gzipped) | < 100KB | 100-200KB | > 200KB | Build output |
91
- | Largest chunk (gzipped) | < 50KB | 50-100KB | > 100KB | Build output |
92
- | CSS total | < 50KB | 50-100KB | > 100KB | Build output |
93
- | Unused CSS | < 5% | 5-15% | > 15% | PurgeCSS |
94
- | Duplicate packages | 0 | 1-2 | > 2 | Bundle analyzer |
95
- | Tree-shaking | No side-effect barrel exports | — | Side-effect imports found | Manual analysis |
96
-
97
- **How to Run:**
98
- ```bash
99
- # Build and analyze
100
- npm run build -- --stats
101
- # VERIFY: check if the build script supports --stats flag
102
-
103
- # Alternative: analyze existing build output
104
- npx source-map-explorer dist/**/*.js
105
- # VERIFY: check if source-map-explorer is available
106
- ```
107
-
108
- **Common Fixes:**
109
-
110
- | Issue | Fix | Savings |
111
- |---|---|---|
112
- | Large lodash import | `import debounce from 'lodash/debounce'` not `import { debounce } from 'lodash'` | 50-80KB |
113
- | Moment.js | Replace with `dayjs` or `date-fns` | 60-70KB |
114
- | Full icon library | Use tree-shakeable imports or individual icon files | 20-100KB |
115
- | Uncompressed images | Use WebP/AVIF, add `loading="lazy"` | 50-500KB |
116
- | CSS framework unused | PurgeCSS or `content` config in Tailwind | 30-90KB |
117
-
118
- ### 3. API Latency (Backend Performance)
119
-
120
- | Check | Target | Warning | Fail | Method |
121
- |---|---|---|---|---|
122
- | Avg response (simple GET) | < 100ms | 100-300ms | > 300ms | 10 sequential requests |
123
- | Avg response (complex query) | < 300ms | 300-800ms | > 800ms | 10 sequential requests |
124
- | P95 response | < 500ms | 500-1000ms | > 1000ms | Sort, pick 95th percentile |
125
- | P99 response | < 1000ms | 1-3s | > 3s | Sort, pick 99th percentile |
126
- | Cold start | < 1s | 1-3s | > 3s | First request after 30s idle |
127
- | Concurrent handling | Linear scaling up to 10 req | — | Exponential degradation | 10 parallel requests |
128
-
129
- **How to Run:**
130
- ```bash
131
- # Using curl timing
132
- curl -o /dev/null -s -w "time_total: %{time_total}s\n" http://localhost:3000/api/health
133
-
134
- # Loop for average
135
- for i in $(seq 1 10); do
136
- curl -o /dev/null -s -w "%{time_total}\n" http://localhost:3000/api/endpoint
137
- done
138
- ```
139
-
140
- **Common Fixes:**
141
-
142
- | Symptom | Likely Cause | Fix |
143
- |---|---|---|
144
- | Slow first request | Cold start, no connection pool | Pre-warm, use connection pooling |
145
- | Slow list endpoints | N+1 queries | Add eager loading / `include` |
146
- | Slow under load | No caching | Add Redis/in-memory cache for hot paths |
147
- | Inconsistent P95 | GC pauses | Optimize memory allocation, reduce object churn |
148
-
149
- ### 4. Build Performance (DX)
150
-
151
- | Check | Target | Warning | Fail |
152
- |---|---|---|---|
153
- | Dev server cold start | < 3s | 3-8s | > 8s |
154
- | Hot reload (HMR) | < 200ms | 200-500ms | > 500ms |
155
- | Full production build | < 30s | 30-60s | > 60s |
156
- | TypeScript type-check | < 15s | 15-30s | > 30s |
157
-
158
45
  ---
159
46
 
160
- ## Composite Score
47
+ ## Benchmark Report Format
161
48
 
162
49
  ```
163
- Performance Score = (
164
- Web_Vitals_Score × 0.35 +
165
- Bundle_Score × 0.25 +
166
- API_Score × 0.25 +
167
- Build_Score × 0.15
168
- ) × 100
169
-
170
- Grade:
171
- 90-100 → A (Ship with confidence)
172
- 75-89 → B (Minor optimizations available)
173
- 60-74 → C (Notable performance issues)
174
- 40-59 → D (Significant problems fix before deploy)
175
- < 40 → F (Critical likely impacts user retention)
50
+ ━━━ Performance Benchmark [date] ━━━━━━━━━
51
+
52
+ ━━━ Core Web Vitals (Lighthouse) ━━━━━━━━━━
53
+ LCP: [time] [✅ Good | ⚠️ Needs Work | ❌ Poor]
54
+ INP: [time] [✅ Good | ⚠️ Needs Work | ❌ Poor]
55
+ CLS: [score] [✅ Good | ⚠️ Needs Work | ❌ Poor]
56
+ FCP: [time]
57
+ TTFB: [time]
58
+
59
+ Performance Score: [N]/100
60
+
61
+ ━━━ Bundle Sizes ━━━━━━━━━━━━━━━━━━━━━━━━━
62
+ First Load JS (shared): [size]
63
+ Largest page: [size] ([route])
64
+ Largest 3 bundles:
65
+ [bundle]: [size]
66
+ [bundle]: [size]
67
+ [bundle]: [size]
68
+
69
+ ━━━ API Latency (10 concurrent, 20s) ━━━━━━
70
+ GET /api/products: avg [ms] | p99 [ms] | [req/s] req/s
71
+ POST /api/orders: avg [ms] | p99 [ms]
72
+
73
+ ━━━ Comparison (vs last run) ━━━━━━━━━━━━━━
74
+ LCP: 4.2s → 1.9s ▼ IMPROVED ✅
75
+ INP: 480ms → 140ms ▼ IMPROVED ✅
76
+ Bundle: 890kb → 310kb ▼ IMPROVED ✅
77
+ p99 latency: 230ms → 89ms ▼ IMPROVED ✅
176
78
  ```
177
79
 
178
- Each sub-score is calculated as: `(checks_passed / total_checks)` weighted by target (1.0), warning (0.6), fail (0.0).
179
-
180
80
  ---
181
81
 
182
- ## Output Format
82
+ ## Performance Gates (Fail Criteria)
183
83
 
184
84
  ```
185
- ━━━ Performance Benchmark Report ━━━━━━━━━
186
-
187
- Project: [name]
188
- Date: [timestamp]
189
- Score: [0-100] / 100 Grade [A-F]
190
-
191
- ━━━ Web Vitals ━━━━━━━━━━━━━━━━━━━━━━━━━
192
-
193
- LCP: 1.8s ✅ Good (target: < 2.5s)
194
- INP: 95ms Good (target: < 200ms)
195
- CLS: 0.05 ✅ Good (target: < 0.1)
196
- TTFB: 420ms Good (target: < 800ms)
197
- FCP: 1.2s ✅ Good (target: < 1.8s)
198
- Score: 92/100
199
-
200
- ━━━ Bundle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
201
-
202
- Total JS: 156KB gzipped 🟡 Warning (target: < 100KB)
203
- Largest chunk: 82KB gzipped 🟡 Warning (target: < 50KB)
204
- CSS total: 28KB gzipped ✅ Good
205
- Unused CSS: 4.2% ✅ Good
206
- Duplicates: 0 ✅ Good
207
- Score: 72/100
208
-
209
- ━━━ API Latency ━━━━━━━━━━━━━━━━━━━━━━━━
210
-
211
- GET /api/users: avg 89ms ✅ | p95 142ms ✅
212
- POST /api/auth: avg 210ms 🟡 | p95 480ms 🟡
213
- GET /api/dashboard: avg 340ms ❌ | p95 820ms ❌
214
- Cold start: 680ms ✅
215
- Score: 58/100
216
-
217
- ━━━ Build ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
218
-
219
- Dev cold start: 2.1s ✅
220
- HMR: 89ms ✅
221
- Production build: 18s ✅
222
- Type-check: 12s ✅
223
- Score: 100/100
224
-
225
- ━━━ Fix Priority (by impact) ━━━━━━━━━━━
226
-
227
- 1. 🔴 GET /api/dashboard avg 340ms
228
- → Add database index on dashboard query joins
229
- → Expected: < 100ms (70% improvement)
230
-
231
- 2. 🟡 Total JS 156KB
232
- → Lazy-load chart library (80KB)
233
- → Expected: < 80KB initial (50% reduction)
234
-
235
- 3. 🟡 POST /api/auth avg 210ms
236
- → Cache user lookup in auth flow
237
- → Expected: < 100ms (50% improvement)
238
-
239
- ━━━ Trend (if baseline available) ━━━━━━
240
-
241
- LCP: 1.8s → 1.8s → (no change)
242
- Bundle: 140KB → 156KB ↑ (+11%) ⚠️ Regression
243
- API p95: 400ms → 480ms ↑ (+20%) ⚠️ Regression
85
+ Failing these means optimization is blocking — not optional:
86
+
87
+ LCP > 4.0s → ❌ Must fix — users see blank page
88
+ INP > 500ms → ❌ Must fix — UI feels unresponsive
89
+ CLS > 0.25 → Must fix layout jumps are jarring
90
+ Bundle > 1mb → ❌ Must fix — 3G users abandon
91
+ p99 API > 2000ms → ❌ Must fix — timeout risk on slow connections
92
+
93
+ Warning range (fix before major release):
94
+ LCP 2.5–4.0s ⚠️
95
+ INP 200–500ms ⚠️
96
+ Bundle 500kb–1mb ⚠️
244
97
  ```
245
98
 
246
99
  ---
247
100
 
248
- ## Regression Detection
249
-
250
- If a previous benchmark baseline exists (stored in `perf-baseline.json` or similar):
101
+ ## Historical Tracking
251
102
 
252
- | Metric | Change | Status |
253
- |---|---|---|
254
- | < 5% increase | No change | ✅ Stable |
255
- | 5-15% increase | Minor regression | 🟡 Flag |
256
- | > 15% increase | Significant regression | 🔴 Block deploy |
257
- | Any decrease | Improvement | 🎉 Celebrate |
258
-
259
- ---
260
-
261
- ## Baseline Management
262
-
263
- After a successful benchmark, save a baseline to detect future regressions:
103
+ Save every benchmark run:
264
104
 
265
105
  ```bash
266
- # Save current benchmark as baseline
267
- python .agent/scripts/bundle_analyzer.py . --save-baseline
106
+ # Benchmarks should be saved with date stamps
107
+ ./reports/lighthouse-2026-04-02.json
108
+ ./reports/bundle-2026-04-02.txt
109
+ ./reports/latency-2026-04-02.txt
268
110
  ```
269
111
 
270
- The baseline file is `perf-baseline.json` in the project root. Check it into version control so regressions are caught in CI.
271
-
272
- ---
273
-
274
- ## Cross-Workflow Navigation
275
-
276
- | After /performance-benchmarker shows... | Go to |
277
- |---|---|
278
- | Grade D or F | `/tribunal-performance` on the slowest code paths |
279
- | Bundle regression (+15%) | `/audit` for dependency analysis, then `/fix` |
280
- | API latency P95 > 500ms | `/debug` to identify the slow query or operation |
281
- | Web vitals LCP > 4s | `/enhance` to add image preloading and critical CSS |
282
- | Grade A or B, ready for deploy | `/deploy` following pre-flight checklist |
112
+ This enables trend analysis: is performance improving or degrading over time?
283
113
 
284
114
  ---
285
-
286
- ## Hallucination Guard
287
-
288
- - **Only run benchmarks with installed tools** — check with `which` or `npx --dry-run` first.
289
- - **Never fabricate benchmark numbers** — report "SKIPPED: [tool] not installed" if unavailable.
290
- - **Flag anomalies**: `// NOTE: unusually fast — may be cached` or `// NOTE: first run, cold start included`.
291
- - **Mark tool availability**: `// VERIFY: lighthouse-cli not detected, using fallback estimation`.
292
- - **Don't guess fixes** — only recommend fixes for issues that have measured evidence.
293
-
294
- ---
295
-
296
- ## Usage
297
-
298
- ```
299
- /performance-benchmarker full audit
300
- /performance-benchmarker web vitals only
301
- /performance-benchmarker bundle analysis
302
- /performance-benchmarker api latency for /api/users /api/posts
303
- /performance-benchmarker build performance
304
- /performance-benchmarker compare with baseline
305
- ```