tribunal-kit 5.8.5 → 6.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 (298) hide show
  1. package/.agent/ARCHITECTURE.md +219 -215
  2. package/.agent/agents/accessibility-reviewer.md +66 -151
  3. package/.agent/agents/ai-code-reviewer.md +22 -2
  4. package/.agent/agents/anti-pattern-reviewer.md +99 -0
  5. package/.agent/agents/api-architect.md +19 -2
  6. package/.agent/agents/backend-specialist.md +25 -3
  7. package/.agent/agents/cloud-engineer.md +21 -0
  8. package/.agent/agents/code-archaeologist.md +20 -3
  9. package/.agent/agents/complexity-reviewer.md +22 -2
  10. package/.agent/agents/database-architect.md +24 -3
  11. package/.agent/agents/db-latency-auditor.md +22 -2
  12. package/.agent/agents/debugger.md +19 -3
  13. package/.agent/agents/dependency-reviewer.md +19 -2
  14. package/.agent/agents/devops-engineer.md +24 -3
  15. package/.agent/agents/documentation-writer.md +21 -3
  16. package/.agent/agents/explorer-agent.md +21 -3
  17. package/.agent/agents/frontend-reviewer.md +19 -3
  18. package/.agent/agents/frontend-specialist.md +72 -224
  19. package/.agent/agents/game-developer.md +22 -3
  20. package/.agent/agents/interaction-reviewer.md +118 -0
  21. package/.agent/agents/logic-reviewer.md +18 -3
  22. package/.agent/agents/minimalist-reviewer.md +98 -0
  23. package/.agent/agents/mobile-developer.md +21 -3
  24. package/.agent/agents/mobile-reviewer.md +22 -2
  25. package/.agent/agents/orchestrator.md +19 -3
  26. package/.agent/agents/penetration-tester.md +22 -3
  27. package/.agent/agents/performance-optimizer.md +21 -3
  28. package/.agent/agents/performance-reviewer.md +2 -0
  29. package/.agent/agents/precedence-reviewer.md +19 -5
  30. package/.agent/agents/product-manager.md +20 -3
  31. package/.agent/agents/product-owner.md +22 -1
  32. package/.agent/agents/product-reviewer.md +98 -0
  33. package/.agent/agents/project-planner.md +19 -3
  34. package/.agent/agents/qa-automation-engineer.md +24 -3
  35. package/.agent/agents/resilience-reviewer.md +21 -2
  36. package/.agent/agents/schema-reviewer.md +21 -2
  37. package/.agent/agents/security-auditor.md +7 -1
  38. package/.agent/agents/seo-specialist.md +18 -3
  39. package/.agent/agents/sql-reviewer.md +22 -2
  40. package/.agent/agents/supervisor-agent.md +22 -3
  41. package/.agent/agents/swarm-worker-registry.md +7 -0
  42. package/.agent/agents/system-architect.md +19 -0
  43. package/.agent/agents/test-coverage-reviewer.md +22 -2
  44. package/.agent/agents/test-engineer.md +21 -2
  45. package/.agent/agents/throughput-optimizer.md +22 -2
  46. package/.agent/agents/type-safety-reviewer.md +21 -2
  47. package/.agent/agents/ui-ux-auditor.md +44 -242
  48. package/.agent/agents/ui-visual-auditor.md +99 -0
  49. package/.agent/agents/ux-reviewer.md +104 -0
  50. package/.agent/agents/visual-reviewer.md +98 -0
  51. package/.agent/agents/vitals-reviewer.md +23 -2
  52. package/.agent/history/README.md +53 -0
  53. package/.agent/history/case-law/cases/template-case.json +19 -0
  54. package/.agent/history/integrity_manifest.json +63 -33
  55. package/.agent/history/memory/.memory.idx +517 -1
  56. package/.agent/history/memory/MEMORY.md +35 -1
  57. package/.agent/routing_index.json +272 -690
  58. package/.agent/rules/GEMINI.md +10 -12
  59. package/.agent/rules/GEMINI_PLANNER.md +84 -0
  60. package/.agent/scripts/case_law_manager.js +2 -0
  61. package/.agent/scripts/context_broker.js +152 -0
  62. package/.agent/scripts/guardrail_engine.js +59 -4
  63. package/.agent/scripts/impact_classifier.js +167 -0
  64. package/.agent/scripts/minimal_change_engine.js +437 -0
  65. package/.agent/scripts/pipeline_engine.js +856 -0
  66. package/.agent/scripts/socratic_gate_policy.js +60 -0
  67. package/.agent/scripts/token_budget_broker.js +52 -0
  68. package/.agent/scripts/verify_all.js +13 -0
  69. package/.agent/scripts/visual_audit.js +92 -0
  70. package/.agent/skills/12-principles-of-animation/SKILL.md +19 -10
  71. package/.agent/skills/60fps-animation/SKILL.md +19 -10
  72. package/.agent/skills/accessible-animation/SKILL.md +19 -10
  73. package/.agent/skills/adapt/SKILL.md +19 -10
  74. package/.agent/skills/advanced-rag-pipelines/SKILL.md +21 -3
  75. package/.agent/skills/agent-organizer/SKILL.md +21 -7
  76. package/.agent/skills/agentic-patterns/SKILL.md +19 -7
  77. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +21 -7
  78. package/.agent/skills/animation-on-scroll/SKILL.md +19 -10
  79. package/.agent/skills/animation-systems/SKILL.md +19 -10
  80. package/.agent/skills/antfu-conventions/SKILL.md +21 -10
  81. package/.agent/skills/api-patterns/SKILL.md +21 -7
  82. package/.agent/skills/api-security-auditor/SKILL.md +21 -7
  83. package/.agent/skills/app-builder/SKILL.md +21 -7
  84. package/.agent/skills/apple-design/SKILL.md +19 -10
  85. package/.agent/skills/architecture/SKILL.md +21 -7
  86. package/.agent/skills/audit-and-fix/SKILL.md +19 -10
  87. package/.agent/skills/authentication-best-practices/SKILL.md +21 -7
  88. package/.agent/skills/backend-security-expert/SKILL.md +21 -7
  89. package/.agent/skills/baseline-ui/SKILL.md +19 -10
  90. package/.agent/skills/bash-linux/SKILL.md +21 -7
  91. package/.agent/skills/behavioral-modes/SKILL.md +19 -7
  92. package/.agent/skills/better-colors/SKILL.md +19 -10
  93. package/.agent/skills/better-ui/SKILL.md +19 -10
  94. package/.agent/skills/bolder/SKILL.md +19 -10
  95. package/.agent/skills/brainstorming/SKILL.md +17 -7
  96. package/.agent/skills/browser-native-ai/SKILL.md +19 -3
  97. package/.agent/skills/build-primitive/SKILL.md +19 -10
  98. package/.agent/skills/building-native-ui/SKILL.md +21 -7
  99. package/.agent/skills/cicd-pro/SKILL.md +21 -10
  100. package/.agent/skills/clarify/SKILL.md +19 -10
  101. package/.agent/skills/clean-code/SKILL.md +21 -7
  102. package/.agent/skills/cloud-architect/SKILL.md +21 -10
  103. package/.agent/skills/cobejs/SKILL.md +19 -10
  104. package/.agent/skills/code-review-checklist/SKILL.md +21 -7
  105. package/.agent/skills/codebase-design/SKILL.md +21 -10
  106. package/.agent/skills/colorize/SKILL.md +19 -10
  107. package/.agent/skills/compact-landing/SKILL.md +19 -10
  108. package/.agent/skills/company-logos/SKILL.md +19 -10
  109. package/.agent/skills/config-validator/SKILL.md +21 -7
  110. package/.agent/skills/containerization-pro/SKILL.md +21 -10
  111. package/.agent/skills/create-design-md/SKILL.md +19 -10
  112. package/.agent/skills/critique/SKILL.md +19 -10
  113. package/.agent/skills/csharp-developer/SKILL.md +21 -7
  114. package/.agent/skills/data-validation-schemas/SKILL.md +21 -7
  115. package/.agent/skills/database-design/SKILL.md +21 -7
  116. package/.agent/skills/delight/SKILL.md +19 -10
  117. package/.agent/skills/deployment-procedures/SKILL.md +21 -7
  118. package/.agent/skills/design-lab/SKILL.md +21 -10
  119. package/.agent/skills/devops-engineer/SKILL.md +21 -7
  120. package/.agent/skills/devops-incident-responder/SKILL.md +21 -7
  121. package/.agent/skills/diagnosing-bugs/SKILL.md +21 -10
  122. package/.agent/skills/distill/SKILL.md +19 -10
  123. package/.agent/skills/documentation-templates/SKILL.md +21 -7
  124. package/.agent/skills/domain-modeling/SKILL.md +21 -10
  125. package/.agent/skills/edge-computing/SKILL.md +21 -7
  126. package/.agent/skills/emil-design-eng/SKILL.md +19 -10
  127. package/.agent/skills/error-resilience/SKILL.md +21 -7
  128. package/.agent/skills/extract-design-system/SKILL.md +21 -7
  129. package/.agent/skills/fabel-protocol/SKILL.md +19 -2
  130. package/.agent/skills/fixing-accessibility/SKILL.md +19 -10
  131. package/.agent/skills/fixing-metadata/SKILL.md +19 -10
  132. package/.agent/skills/fixing-motion-performance/SKILL.md +19 -10
  133. package/.agent/skills/framer-motion-expert/SKILL.md +19 -6
  134. package/.agent/skills/frontend-design/SKILL.md +64 -201
  135. package/.agent/skills/frontend-security-expert/SKILL.md +21 -7
  136. package/.agent/skills/game-design-expert/SKILL.md +21 -7
  137. package/.agent/skills/game-engineering-expert/SKILL.md +21 -7
  138. package/.agent/skills/generative-ui-expert/SKILL.md +19 -3
  139. package/.agent/skills/geo-fundamentals/SKILL.md +21 -7
  140. package/.agent/skills/git-pro/SKILL.md +21 -10
  141. package/.agent/skills/github-operations/SKILL.md +21 -7
  142. package/.agent/skills/gpt-taste/SKILL.md +19 -10
  143. package/.agent/skills/gsap-core/SKILL.md +21 -4
  144. package/.agent/skills/gsap-frameworks/SKILL.md +21 -4
  145. package/.agent/skills/gsap-performance/SKILL.md +20 -5
  146. package/.agent/skills/gsap-plugins/SKILL.md +20 -5
  147. package/.agent/skills/gsap-react/SKILL.md +20 -5
  148. package/.agent/skills/gsap-scrolltrigger/SKILL.md +21 -4
  149. package/.agent/skills/gsap-timeline/SKILL.md +20 -5
  150. package/.agent/skills/gsap-utils/SKILL.md +20 -5
  151. package/.agent/skills/harden/SKILL.md +19 -10
  152. package/.agent/skills/harness-protocol/SKILL.md +20 -4
  153. package/.agent/skills/i18n-localization/SKILL.md +21 -7
  154. package/.agent/skills/impeccable/SKILL.md +19 -10
  155. package/.agent/skills/improve-codebase-architecture/SKILL.md +21 -10
  156. package/.agent/skills/improve-ui/SKILL.md +19 -10
  157. package/.agent/skills/intelligent-routing/SKILL.md +19 -7
  158. package/.agent/skills/knowledge-graph/SKILL.md +20 -4
  159. package/.agent/skills/landing-page/SKILL.md +20 -10
  160. package/.agent/skills/lint-and-validate/SKILL.md +21 -7
  161. package/.agent/skills/llm-engineering/SKILL.md +21 -7
  162. package/.agent/skills/local-first/SKILL.md +21 -7
  163. package/.agent/skills/local-first-architecture/SKILL.md +19 -10
  164. package/.agent/skills/lottie-animation/SKILL.md +19 -10
  165. package/.agent/skills/marquee-loop/SKILL.md +19 -10
  166. package/.agent/skills/masked-reveal/SKILL.md +19 -10
  167. package/.agent/skills/mcp-builder/SKILL.md +21 -7
  168. package/.agent/skills/micro-interaction/SKILL.md +19 -10
  169. package/.agent/skills/mobile-design/SKILL.md +21 -6
  170. package/.agent/skills/monorepo-management/SKILL.md +21 -7
  171. package/.agent/skills/morphing-icons/SKILL.md +19 -10
  172. package/.agent/skills/motion-engineering/SKILL.md +20 -7
  173. package/.agent/skills/nextjs-react-expert/SKILL.md +19 -7
  174. package/.agent/skills/nodejs-best-practices/SKILL.md +21 -7
  175. package/.agent/skills/observability/SKILL.md +21 -7
  176. package/.agent/skills/page-transition-animation/SKILL.md +19 -10
  177. package/.agent/skills/parallel-agents/SKILL.md +23 -7
  178. package/.agent/skills/performance-profiling/SKILL.md +21 -7
  179. package/.agent/skills/plan-writing/SKILL.md +21 -7
  180. package/.agent/skills/platform-engineer/SKILL.md +21 -7
  181. package/.agent/skills/playwright-best-practices/SKILL.md +21 -7
  182. package/.agent/skills/polish/SKILL.md +19 -10
  183. package/.agent/skills/powershell-windows/SKILL.md +21 -7
  184. package/.agent/skills/pricing-page/SKILL.md +19 -10
  185. package/.agent/skills/product-aware-heuristics/SKILL.md +358 -0
  186. package/.agent/skills/progressive-blur/SKILL.md +19 -10
  187. package/.agent/skills/project-idioms/SKILL.md +20 -8
  188. package/.agent/skills/python-patterns/SKILL.md +21 -7
  189. package/.agent/skills/python-pro/SKILL.md +21 -6
  190. package/.agent/skills/quieter/SKILL.md +19 -10
  191. package/.agent/skills/react-doctor/SKILL.md +19 -10
  192. package/.agent/skills/react-specialist/SKILL.md +19 -6
  193. package/.agent/skills/readme-builder/SKILL.md +21 -7
  194. package/.agent/skills/realtime-patterns/SKILL.md +21 -7
  195. package/.agent/skills/red-team-tactics/SKILL.md +21 -7
  196. package/.agent/skills/redesign-skill/SKILL.md +19 -10
  197. package/.agent/skills/review-animations/SKILL.md +21 -10
  198. package/.agent/skills/rust-pro/SKILL.md +21 -7
  199. package/.agent/skills/seo-fundamentals/SKILL.md +21 -7
  200. package/.agent/skills/server-management/SKILL.md +21 -7
  201. package/.agent/skills/shadcn-ui-expert/SKILL.md +21 -7
  202. package/.agent/skills/shape/SKILL.md +19 -10
  203. package/.agent/skills/skill-creator/SKILL.md +21 -7
  204. package/.agent/skills/soft-skill/SKILL.md +19 -10
  205. package/.agent/skills/sounds-on-the-web/SKILL.md +19 -10
  206. package/.agent/skills/sql-pro/SKILL.md +21 -7
  207. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +21 -7
  208. package/.agent/skills/svg-animation/SKILL.md +19 -10
  209. package/.agent/skills/swiftui-expert/SKILL.md +21 -7
  210. package/.agent/skills/swiss-design/SKILL.md +19 -10
  211. package/.agent/skills/system-design-pro/SKILL.md +21 -9
  212. package/.agent/skills/systematic-debugging/SKILL.md +21 -7
  213. package/.agent/skills/tailwind-patterns/SKILL.md +21 -7
  214. package/.agent/skills/taste-skill/SKILL.md +19 -10
  215. package/.agent/skills/tdd-workflow/SKILL.md +21 -10
  216. package/.agent/skills/test-result-analyzer/SKILL.md +18 -6
  217. package/.agent/skills/testing-patterns/SKILL.md +21 -7
  218. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +21 -10
  219. package/.agent/skills/thinking-protocol/SKILL.md +20 -8
  220. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +19 -10
  221. package/.agent/skills/transitions-dev/SKILL.md +19 -10
  222. package/.agent/skills/trend-researcher/SKILL.md +17 -6
  223. package/.agent/skills/typescript-advanced/SKILL.md +21 -7
  224. package/.agent/skills/typeset/SKILL.md +19 -10
  225. package/.agent/skills/ui-reasoning-engine/SKILL.md +154 -0
  226. package/.agent/skills/ui-skill-packs/SKILL.md +77 -0
  227. package/.agent/skills/ui-skills-root/SKILL.md +21 -9
  228. package/.agent/skills/ui-ux-pro-max/SKILL.md +62 -583
  229. package/.agent/skills/ui-ux-researcher/SKILL.md +17 -6
  230. package/.agent/skills/vue-expert/SKILL.md +19 -6
  231. package/.agent/skills/vulnerability-scanner/SKILL.md +21 -7
  232. package/.agent/skills/web-accessibility-auditor/SKILL.md +21 -7
  233. package/.agent/skills/web-design-guidelines/SKILL.md +32 -206
  234. package/.agent/skills/web-quality-audit/SKILL.md +19 -10
  235. package/.agent/skills/webapp-testing/SKILL.md +21 -7
  236. package/.agent/skills/webgpu-performance/SKILL.md +19 -3
  237. package/.agent/skills/whimsy-injector/SKILL.md +20 -10
  238. package/.agent/skills/workflow-optimizer/SKILL.md +16 -6
  239. package/.agent/templates/DESIGN.md +292 -0
  240. package/.agent/templates/design-tokens.json +137 -0
  241. package/.agent/workflows/acf.md +13 -6
  242. package/.agent/workflows/api-tester.md +15 -8
  243. package/.agent/workflows/audit.md +19 -8
  244. package/.agent/workflows/brainstorm.md +14 -9
  245. package/.agent/workflows/changelog.md +14 -8
  246. package/.agent/workflows/create.md +16 -8
  247. package/.agent/workflows/debug.md +15 -10
  248. package/.agent/workflows/deploy.md +16 -8
  249. package/.agent/workflows/enhance.md +15 -10
  250. package/.agent/workflows/fix.md +15 -8
  251. package/.agent/workflows/generate.md +17 -11
  252. package/.agent/workflows/marathon.md +15 -8
  253. package/.agent/workflows/migrate.md +16 -8
  254. package/.agent/workflows/minimal.md +94 -0
  255. package/.agent/workflows/orchestrate.md +15 -8
  256. package/.agent/workflows/performance-benchmarker.md +15 -8
  257. package/.agent/workflows/pipeline.md +155 -0
  258. package/.agent/workflows/plan.md +14 -10
  259. package/.agent/workflows/preview.md +14 -7
  260. package/.agent/workflows/refactor.md +16 -8
  261. package/.agent/workflows/review-ai.md +15 -7
  262. package/.agent/workflows/review.md +15 -7
  263. package/.agent/workflows/session.md +14 -7
  264. package/.agent/workflows/status.md +13 -7
  265. package/.agent/workflows/strengthen-skills.md +15 -6
  266. package/.agent/workflows/super-prompt.md +19 -10
  267. package/.agent/workflows/swarm.md +15 -7
  268. package/.agent/workflows/test.md +15 -8
  269. package/.agent/workflows/tribunal-backend.md +16 -9
  270. package/.agent/workflows/tribunal-database.md +15 -8
  271. package/.agent/workflows/tribunal-frontend.md +26 -11
  272. package/.agent/workflows/tribunal-full.md +29 -14
  273. package/.agent/workflows/tribunal-mobile.md +15 -8
  274. package/.agent/workflows/tribunal-performance.md +15 -8
  275. package/.agent/workflows/tribunal-speed.md +16 -9
  276. package/.agent/workflows/tribunal-ui.md +82 -0
  277. package/.agent/workflows/ui-ux-pro-max.md +51 -107
  278. package/CONTRIBUTING.md +2 -2
  279. package/README.md +5 -5
  280. package/bin/mcp-server.js +81 -31
  281. package/bin/wrapper.js +17 -6
  282. package/dist/cli.js +9 -1
  283. package/dist/commands/compile.js +7 -0
  284. package/dist/commands/context.js +8 -3
  285. package/dist/commands/graph.js +8 -2
  286. package/dist/commands/init.js +13 -2
  287. package/dist/commands/memory.js +119 -68
  288. package/dist/commands/minimal.js +71 -0
  289. package/dist/commands/optimize.js +15 -5
  290. package/dist/esm/index.mjs +26 -32
  291. package/dist/utils/fs.js +10 -4
  292. package/dist/utils/helpers.js +10 -1
  293. package/dist/utils/version.js +9 -2
  294. package/mcp_config.json +10 -1
  295. package/package.json +17 -14
  296. package/scripts/benchmark.js +16 -0
  297. package/scripts/sync-version.js +1 -1
  298. package/scripts/visual_audit.js +126 -0
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  description: Performance-specific Tribunal. Runs Logic + Performance reviewers. Use when code is slow, for optimization tasks, bundle analysis, Core Web Vitals improvement, memory leak investigation, and before deploying performance-critical features.
3
- required-skills: performance-profiling
3
+ tools: Read, Grep, Glob, Bash, Edit, Write
4
+ version: 3.0.0
5
+ last-updated: 2026-07-30
6
+ required-skills:
7
+ - performance-profiling
8
+ - 60fps-animation
9
+ - gsap-performance
10
+ scripts-binding:
11
+ - .agent/scripts/bundle_analyzer.js
12
+ - .agent/scripts/test_runner.js
4
13
  ---
5
14
 
6
15
  # /tribunal-performance — Performance Audit
@@ -9,14 +18,12 @@ $ARGUMENTS
9
18
 
10
19
  ---
11
20
 
12
- ## $CONTEXT_REQUIRED
21
+ ## Mandatory Pre-Flight Context Inspection
13
22
 
14
- ```
15
- Read BEFORE performance review:
16
- Target code files The code being optimized
17
- package.json Check for known heavy libraries (e.g. moment, lodash)
18
- □ Next.js / bundler config → Check for bundle optimization settings
19
- ```
23
+ Before optimizing code or running performance reviews, you MUST inspect:
24
+ 1. Target Source & Heavy Import Inspection (`package.json`, `next.config.js`) → Identify heavy library imports (`moment`, full `lodash`) for tree-shaking
25
+ 2. Measured Baseline Metrics Run `bundle_analyzer.js` or latency measurements; ban claiming performance improvements without measured proof
26
+ 3. 2-Reviewer Performance Gate Run logic-reviewer and performance-optimizer before approving optimization diffs
20
27
 
21
28
  ---
22
29
 
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  description: Full-stack parallel performance audit. Runs 3 scoped specialists simultaneously — vitals-reviewer (Frontend CWV), db-latency-auditor (SQL/ORM), throughput-optimizer (Node.js server) — then synthesizes a single ranked report. Maximum 5 AI calls regardless of project size. Use when full-stack performance profiling is needed.
3
- required-skills: performance-profiling, observability
3
+ tools: Read, Grep, Glob, Bash, Edit, Write
4
+ version: 3.0.0
5
+ last-updated: 2026-07-30
6
+ required-skills:
7
+ - performance-profiling
8
+ - observability
9
+ - edge-computing
10
+ scripts-binding:
11
+ - .agent/scripts/bundle_analyzer.js
12
+ - .agent/scripts/verify_all.js
4
13
  ---
5
14
 
6
15
  # /tribunal-speed — Full-Stack Performance Swarm
@@ -9,14 +18,12 @@ $ARGUMENTS
9
18
 
10
19
  ---
11
20
 
12
- ## $CONTEXT_REQUIRED
21
+ ## Mandatory Pre-Flight Context Inspection
13
22
 
14
- ```
15
- Read BEFORE performance swarm:
16
- Target directory/files Determine frontend vs backend vs DB code
17
- package.json Identify the full stack architecture
18
- □ Database schemas → Needed for the db-latency-auditor
19
- ```
23
+ Before running a full-stack performance audit, you MUST inspect:
24
+ 1. Target Full-Stack File Map → Determine frontend components, Node.js server routes, and database models
25
+ 2. Max 5 AI Call Ceiling Cap swarm executions to 3 parallel specialists + 1 synthesis step to prevent token explosion
26
+ 3. Ranked Impact Synthesis Output findings strictly in a single unified table prioritized by user-facing latency impact
20
27
 
21
28
  ---
22
29
 
@@ -181,7 +188,7 @@ If a specialist fails after 3 retries:
181
188
  | :------------------------- | :------------------------------- | :--------------------- | :--------------------------------------- |
182
189
  | `/tribunal-performance` | logic + performance-reviewer | Generic CWV check | Quick single-file perf scan |
183
190
  | `/tribunal-speed` | vitals + db-latency + throughput | Deep 3-domain parallel | Full-stack perf audit |
184
- | `/tribunal-full` | All 19 reviewers | Everything | Maximum coverage (security + perf + all) |
191
+ | `/tribunal-full` | All 21 reviewers | Everything | Maximum coverage (security + perf + all) |
185
192
  | `/performance-benchmarker` | Lighthouse + bundle | Measurement only | Get actual scores, not code review |
186
193
 
187
194
  ---
@@ -0,0 +1,82 @@
1
+ ---
2
+ description: Specialized UI/UX Tribunal. Runs UX + Visual + Interaction + Anti-Pattern + Product Heuristics + Accessibility + Visual Auditor reviewers. Use for all visual designs, component layouts, and design-system reviews.
3
+ tools: Read, Grep, Glob, Bash, Edit, Write
4
+ version: 3.0.0
5
+ last-updated: 2026-07-30
6
+ required-skills:
7
+ - ui-reasoning-engine
8
+ - product-aware-heuristics
9
+ - ui-ux-pro-max
10
+ - frontend-design
11
+ - web-design-guidelines
12
+ scripts-binding:
13
+ - .agent/scripts/lint_runner.js
14
+ - .agent/scripts/verify_all.js
15
+ ---
16
+
17
+ # /tribunal-ui — Dedicated UI/UX Review Pipeline
18
+
19
+ $ARGUMENTS
20
+
21
+ ---
22
+
23
+ ## Mandatory Pre-Flight Context Inspection
24
+
25
+ Before executing dedicated UI/UX audits or design-system reviews, you MUST inspect:
26
+ 1. Active Design Tokens & Guidelines (`DESIGN.md`, CSS custom properties) → Confirm typography scale, color system, and corner radius tokens
27
+ 2. Product Domain Category → Select category heuristics (Dashboard, E-Commerce, Landing Page, Mobile App, Marketing)
28
+ 3. 7-Reviewer Dedicated UI Gate → Run ux-auditor, visual-auditor, interaction-auditor, anti-pattern-auditor, product-heuristics, a11y-auditor, and visual-auditor before passing designs
29
+
30
+ ---
31
+
32
+ ## When to Use /tribunal-ui
33
+
34
+ | Use `/tribunal-ui` when... | Use instead when... |
35
+ | :--- | :--- |
36
+ | Auditing visual hierarchy & rhythm | Reviewing backend routing → `/tribunal-backend` |
37
+ | Verifying interactive states and hover/focus | Reviewing database transaction code → `/tribunal-database` |
38
+ | Checking responsive behavior and ergonomics | Doing general logical code checks → `/tribunal-frontend` |
39
+ | Banning generic AI templates & purple gradients | |
40
+ | Testing accessibility compliance (WCAG 2.2 AA) | |
41
+
42
+ ---
43
+
44
+ ## 7 Specialized UI Reviewers (Running Simultaneously)
45
+
46
+ ### 1. ux-reviewer
47
+ * **Focus:** Hick's Law, Fitts's Law, cognitive load, scanning patterns, scannability, and progressive disclosure.
48
+ * **Check:** Are primary action targets separated from destructive ones? Is choice overload prevented?
49
+
50
+ ### 2. visual-reviewer
51
+ * **Focus:** Typographical scaling, alignment, margins, 8px grid discipline, and line lengths.
52
+ * **Check:** Do Display headings balanced-wrap (`text-wrap: balance`)? Is negative space utilized?
53
+
54
+ ### 3. interaction-reviewer
55
+ * **Focus:** Full interactive state styling (Default, Hover, Active/Pressed, Disabled, Focus-visible, Loading).
56
+ * **Check:** Is there scale-down active click feedback? Are focus outlines visible and offset?
57
+
58
+ ### 4. anti-pattern-reviewer
59
+ * **Focus:** Blocking generic AI visual clichés.
60
+ * **Check:** Blocks purple/violet primary colors, radial mesh gradients, bento grid overload, flat cards lacking depth, and card-in-card overlap.
61
+
62
+ ### 5. product-reviewer
63
+ * **Focus:** Matching the UI structure to product category heuristics (SaaS, DevTool, AI Interface, Landing, Fintech).
64
+ * **Check:** Tabular numbers used for financial data? Monospace code snippets for DevTools? Typing skeleton streams for AI?
65
+
66
+ ### 6. accessibility-reviewer
67
+ * **Focus:** WCAG 2.2 Level AA compliance.
68
+ * **Check:** Minimum target size 24px (standard AA) and 44px (touch). Semantic headings, accessible ARIA names, and keyboard trap focus in dialogs.
69
+
70
+ ### 7. ui-visual-auditor (Closed-Loop Visual Gate)
71
+ * **Focus:** Screenshot or DOM layout verification.
72
+ * **Check:** Checks vertical overflow, layout shifts (CLS), alignment shifts, and contrast ratios.
73
+
74
+ ---
75
+
76
+ ## Verdict System
77
+
78
+ ```
79
+ If ANY reviewer → ❌ REJECTED: Maker must fix and resubmit before Human Gate
80
+ If any reviewer → ⚠️ WARNING: highlighted at Human Gate, must fix before deploy
81
+ If all reviewers → ✅ APPROVED: Passes to Human Gate for writing approval
82
+ ```
@@ -1,6 +1,17 @@
1
1
  ---
2
- description: Plan and implement cutting-edge advanced UI/UX. Creates distinctive, production-grade frontend interfaces with high design quality that avoid generic AI aesthetics. Now uses a modular swarm architecture to decompose layout, styling, and motion tasks.
3
- required-skills: ui-ux-researcher, frontend-design, emil-design-eng, motion-engineering, agent-organizer, parallel-agents
2
+ description: Plan and implement cutting-edge advanced UI/UX. Uses the UI Reasoning Engine to structure layout and styling, and routes through the dedicated `/tribunal-ui` reviewer pipeline.
3
+ tools: Read, Grep, Glob, Bash, Edit, Write
4
+ version: 3.0.0
5
+ last-updated: 2026-07-30
6
+ required-skills:
7
+ - ui-reasoning-engine
8
+ - product-aware-heuristics
9
+ - ui-ux-pro-max
10
+ - frontend-design
11
+ - web-design-guidelines
12
+ scripts-binding:
13
+ - .agent/scripts/lint_runner.js
14
+ - .agent/scripts/auto_preview.js
4
15
  ---
5
16
 
6
17
  # /ui-ux-pro-max — Advanced UI/UX Design
@@ -9,126 +20,62 @@ $ARGUMENTS
9
20
 
10
21
  ---
11
22
 
12
- ## $CONTEXT_REQUIRED
23
+ ## Mandatory Pre-Flight Context Inspection
13
24
 
14
- ```
15
- Read BEFORE designing:
16
- Current UI components Follow project idioms and design systems
17
- .agent/skills/frontend-design/SKILL.mdRefresh UI guidelines
18
- ```
25
+ Before designing or implementing advanced UI/UX layouts, you MUST inspect:
26
+ 1. Active Design Tokens & System (`DESIGN.md`, CSS custom properties) → Verify OKLCH color palettes, typography scale, and spacing grid
27
+ 2. UI Reasoning Engine 16-Step Pipeline (`.agent/skills/ui-reasoning-engine/SKILL.md`) Structure component layout, micro-interactions, and accessibility before coding
28
+ 3. Anti-Generic Aesthetic Rule Ban plain purple/violet AI gradients and stock hero templates; enforce bespoke visual hierarchy and tactile micro-interactions
19
29
 
20
30
  ---
21
31
 
22
32
  ## When to Use /ui-ux-pro-max
23
33
 
24
- | Use `/ui-ux-pro-max` when... | Use instead when... |
25
- | :---------------------------------------- | :-------------------------------------- |
34
+ | Use `/ui-ux-pro-max` when... | Use instead when... |
35
+ | :--- | :--- |
26
36
  | Building a visually distinctive interface | Functional-only component → `/generate` |
27
- | Design quality is the primary goal | Fast page needed → `/enhance` |
28
- | Creating from a design brief | Bug fix in UI → `/debug` |
29
- | Mobile + web parity required | |
37
+ | Design quality is the primary goal | Fast page needed → `/enhance` |
38
+ | Creating from a design brief | Bug fix in UI → `/debug` |
39
+ | Mobile + web parity required | |
30
40
 
31
41
  ---
32
42
 
33
- ## Phase 1 — Design Intent (Mandatory)
43
+ ## Phase 1 — Design Intent & Product Aware Reasoning (Mandatory)
34
44
 
35
- Answer these before any design work:
45
+ Answer these before writing any code (using the `ui-reasoning-engine` skill):
46
+ 1. **Who is the user?** (Casual consumer vs expert operator).
47
+ 2. **What is the product category?** (SaaS, DevTool, AI Interface, Landing, Fintech).
48
+ 3. **What is the visual direction?** (Brutalist, Editorial, Soft Minimal, Dark Luxury, Swiss).
49
+ 4. **What is the primary user goal?** (Optimize the layout and click paths for this action).
50
+ 5. **What are the accessibility requirements?** (Focus paths, target size, Lc contrast).
36
51
 
37
- ```
38
- 1. Who is the user? (developer tools feel different from consumer apps)
39
- 2. What emotion should the interface evoke? (calm focus, urgent speed, playful delight)
40
- 3. What is the ONE thing users do most? (hero interaction gets maximum design attention)
41
- 4. What existing interfaces does the user love? (don't copy — understand the WHY)
42
- 5. What makes this interface DIFFERENT from every competitor?
43
- ```
52
+ Write the **🧠 UI Reasoning Engine Trace** in your response as a collapsed markdown block before the code.
44
53
 
45
54
  ---
46
55
 
47
- ## Phase 2 — Design Identity
56
+ ## Phase 2 — Visual Identity & Design Tokens
48
57
 
49
- Every interface built by /ui-ux-pro-max has a distinct visual identity:
50
-
51
- ```
52
- Forbidden defaults (generic AI aesthetics):
53
- ❌ Purple/violet as primary color
54
- ❌ Left text / right image hero section
55
- ❌ Mesh gradient backgrounds
56
- ❌ Bento grid as the only layout
57
- ❌ Emoji as icons
58
- ❌ shadcn without explicit user request
59
-
60
- Distinctive alternatives:
61
- ✅ Signal orange, acid green, warm slate, deep red — intentional palettes
62
- ✅ Typographic-first hero sections
63
- ✅ Grain textures, solid contrast, radial depth
64
- ✅ Asymmetric or broken-grid layouts
65
- ✅ SVG icons (lucide-react or custom)
66
- ✅ Motion that communicates meaning (not decoration)
67
- ```
58
+ Every interface must use custom variables defined in `DESIGN.md` and `design-tokens.json`:
59
+ * ❌ **Banned Clichés:** Purple/violet accents, mesh gradients, glassmorphism overuse, default library themes.
60
+ * ✅ **Intentional Styling:** Dynamic OKLCH colors, 8px grid alignment, variable font sizes with CSS `clamp()`, and 1px luminous borders.
68
61
 
69
62
  ---
70
63
 
71
- ## Phase 3 — Interaction Craft
64
+ ## Phase 3 — Interaction States & Micro-interactions
72
65
 
73
- Every interactive element has 4 states designed:
74
-
75
- ```
76
- 1. Default: The base state
77
- 2. Hover: Indicates interactability (cursor change, subtle lift, color shift)
78
- 3. Active: Confirms click/press (scale down, darker, haptic feedback on mobile)
79
- 4. Disabled: Communicates unavailability (reduced opacity, cursor change, tooltip why)
80
- ```
81
-
82
- Micro-animations are required, not optional:
83
-
84
- ```
85
- Entry animations: elements fade/slide in on mount
86
- State transitions: smooth color + scale changes (150–200ms)
87
- Loading states: skeleton screens, not spinners (skeleton shows shape)
88
- Error shake: invalid form input shakes (4px left-right)
89
- Success pulse: confirmed actions pulse green briefly
90
- ```
66
+ Ensure every interactive element has styling defined for:
67
+ * `hover`, `focus-visible`, `active`/`pressed`, and `disabled` states.
68
+ * Confirm clicks with spring scale-down transitions (`active:scale-[0.97]`).
69
+ * Trap keyboard focus within modals/dialogs and return it to the trigger on close.
91
70
 
92
71
  ---
93
72
 
94
- ## Phase 4 — Swarm Implementation (Modular Generation)
95
-
96
- Instead of a single agent generating the entire UI, `/ui-ux-pro-max` leverages a Fan-Out/Fan-In swarm architecture using `.agent/scripts/swarm_dispatcher.js`. The Supervisor decomposes the component into a structured JSON contract for three specialized workers:
73
+ ## Phase 4 — Swarm Implementation & UI Review Pipeline
97
74
 
98
- ### Worker 1: Layout Architect (`frontend-specialist`)
99
- - **Focus**: Semantic HTML, accessibility tree, and component composition.
100
- - **Rules**: Zero styling, just the raw structure and React state logic.
101
- - **WCAG Checks**: Keyboard navigation, screen reader semantics (role, label).
102
-
103
- ### Worker 2: Styling & Token Specialist (`frontend-design`)
104
- - **Focus**: Applies Tailwind classes and design tokens based on the Phase 2 Identity.
105
- - **Rules**: Must enforce color contrast (4.5:1 minimum) and spacing scale; strictly avoids generic AI defaults.
106
-
107
- ### Worker 3: Motion Engineer (`motion-engineering` + `emil-design-eng`)
108
- - **Focus**: Injects GSAP, Framer Motion, or CSS springs for micro-interactions (Phase 3).
109
- - **Rules**: Enforces Emil Kowalski's non-negotiable UI standards: all UI animations <300ms, popovers are origin-aware, entering elements strictly use `ease-out`, and `prefers-reduced-motion` is honored.
110
-
111
- **Execution Flow**:
112
- 1. Supervisor builds the JSON contract for the 3 workers.
113
- 2. Dispatches workers in parallel via `swarm_dispatcher.js`.
114
- 3. Fan-in synthesis merges the layout, styles, and motion into the final component file.
115
- 4. Final code is routed through `/tribunal-frontend` (which now includes the `review-animations` strict UI constraint gate) for the Human Gate.
116
-
117
- ---
118
-
119
- ## Phase 5 — Design Verification
120
-
121
- Before finalizing:
122
-
123
- ```
124
- □ Open in mobile viewport (375px) — does it work?
125
- □ Open in dark mode — does it look intentional?
126
- □ Keyboard-navigate through the critical path — is it complete?
127
- □ Screenshot and ask: "Would I scroll past this on Dribbble?"
128
- □ Screen reader test with VoiceOver or NVDA
129
- ```
130
-
131
- ---
75
+ 1. **Layout Design:** Create the structural grid and semantic accessibility tree.
76
+ 2. **Token Application:** Apply Tailwind classes or style blocks using variables.
77
+ 3. **Motion Integration:** Add GSAP or Framer Motion transitions (keeping motion <300ms, respecting reduced motion).
78
+ 4. **Tribunal Review Gate:** Route the generated component through `/tribunal-ui` for parallel verification.
132
79
 
133
80
  ---
134
81
 
@@ -138,18 +85,15 @@ Before finalizing:
138
85
  /ui-ux-pro-max design a SaaS dashboard for an analytics platform
139
86
  /ui-ux-pro-max redesign the checkout flow with better conversion UX
140
87
  /ui-ux-pro-max create an onboarding flow for a developer tool
141
- /ui-ux-pro-max design the landing page hero section with distinctive layout
142
- /ui-ux-pro-max create a data visualization dashboard with real-time updates
88
+ /ui-ux-pro-max design the landing page hero section with a distinctive visual style
143
89
  ```
144
90
 
145
91
  ---
146
92
 
147
93
  ## After /ui-ux-pro-max — Next Steps
148
94
 
149
- | Outcome | Next Command |
150
- | :------------------------ | :------------------------------------- |
151
- | Design complete | → `/preview start` to see it in action |
152
- | Need responsive checks | → `/review` or manual viewport testing |
153
- | Needs backend integration | → `/tribunal-backend` to hook up APIs |
154
-
155
- ---
95
+ | Outcome | Next Command |
96
+ | :--- | :--- |
97
+ | Design complete | → `/preview start` to see it in action |
98
+ | Reviewers reject with fixes | → Apply fixes, then run `/tribunal-ui` again |
99
+ | Performance concerns | → `/performance-benchmarker` for Lighthouse/CWV |
package/CONTRIBUTING.md CHANGED
@@ -42,9 +42,9 @@ tribunal-kit/
42
42
  │ └── index.d.ts # TypeScript declarations
43
43
  ├── crates/core/ # Rust core engine (Tokio-based)
44
44
  ├── .agent/ # The intelligence payload (agents, skills, workflows)
45
- │ ├── agents/ # 44 specialist and reviewer agent definitions
45
+ │ ├── agents/ # 51 specialist and reviewer agent definitions
46
46
  │ ├── skills/ # Reusable skill packs
47
- │ ├── workflows/ # 34 workflow definitions
47
+ │ ├── workflows/ # 37 workflow definitions
48
48
  │ └── scripts/ # Automation scripts
49
49
  ├── test/
50
50
  │ ├── unit/ # Unit tests (Jest)
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  <img src="https://img.shields.io/badge/License-MIT-1a1a1f?style=for-the-badge&color=2d2d30" alt="License" />
21
21
  </a>
22
22
  <a href="CHANGELOG.md">
23
- <img src="https://img.shields.io/badge/Release-v5.8.5-ccff00?style=for-the-badge&color=111111&logo=github&logoColor=ccff00" alt="Release Version" />
23
+ <img src="https://img.shields.io/badge/Release-v6.0.0-ccff00?style=for-the-badge&color=111111&logo=github&logoColor=ccff00" alt="Release Version" />
24
24
  </a>
25
25
  <a href="mcp_config.json">
26
26
  <img src="https://img.shields.io/badge/MCP-Ready-00c2ff?style=for-the-badge&logo=openai&logoColor=111" alt="MCP Server" />
@@ -40,7 +40,7 @@
40
40
  <strong style="color: #ffffff; font-size: 1.1em;">AI GENERATES CODE. TRIBUNAL KIT GOVERNS IT.</strong>
41
41
  </div>
42
42
  <p style="color: #c9c9d1; font-size: 0.95em; line-height: 1.6; margin: 0;">
43
- A zero-bloat <strong>.agent/</strong> intelligence payload and <strong>Model Context Protocol (MCP) server</strong> that upgrades your IDEs (<a href="#" style="color: #ccff00; text-decoration: none;">Cursor</a>, <a href="#" style="color: #ccff00; text-decoration: none;">VSCode</a>, <a href="#" style="color: #ccff00; text-decoration: none;">Windsurf</a>) and terminal AI coding assistants (<a href="#" style="color: #ccff00; text-decoration: none;">Claude Code</a>, <a href="#" style="color: #ccff00; text-decoration: none;">Aider</a>) with <strong>44 specialist agents</strong>, <strong>34 workflows</strong>, and a parallel <strong>19-reviewer Tribunal pipeline</strong>. Establishes absolute runtime correctness, optimizes context windows, and heavily mitigates AI code hallucinations.
43
+ A zero-bloat <strong>.agent/</strong> intelligence payload and <strong>Model Context Protocol (MCP) server</strong> that upgrades your IDEs (<a href="#" style="color: #ccff00; text-decoration: none;">Cursor</a>, <a href="#" style="color: #ccff00; text-decoration: none;">VSCode</a>, <a href="#" style="color: #ccff00; text-decoration: none;">Windsurf</a>) and terminal AI coding assistants (<a href="#" style="color: #ccff00; text-decoration: none;">Claude Code</a>, <a href="#" style="color: #ccff00; text-decoration: none;">Aider</a>) with <strong>51 specialist agents</strong>, <strong>37 workflows</strong>, <strong>171 reusable skills</strong>, and a parallel <strong>27-reviewer Tribunal pipeline</strong>. Establishes absolute runtime correctness, optimizes context windows, and heavily mitigates AI code hallucinations.
44
44
  </p>
45
45
  </div>
46
46
 
@@ -173,7 +173,7 @@ AI engineering requires more than static template rules or raw linters. See how
173
173
  <!-- SECTION 3 -->
174
174
  ## ⚡ State-of-the-Art Performance (Rust Core)
175
175
 
176
- Tribunal Kit v5 splits heavy computational tasks between a native Rust core and a flexible JS orchestrator:
176
+ Tribunal Kit v6 splits heavy computational tasks between a native Rust core and a flexible JS orchestrator:
177
177
 
178
178
  * **Compiled Rust Core (`tribunal-core`)**: Powers all deterministic operations, such as path-traversal sandboxing, Levenshtein distance calculations, text merges, and memory database reads to eliminate Node startup latency.
179
179
  * **Zero-Latency Hash Manifests**: File synchronization and updates use SHA-256 incremental hash diffs, copying only modified assets and reducing CLI setup time by **95%**.
@@ -210,7 +210,7 @@ npx tribunal-kit status
210
210
 
211
211
  Code generation is solved. **Code correctness is the frontier.**
212
212
 
213
- The Tribunal Pipeline intercepts raw agent generation and routes it through a parallel suite of **19 domain-specific reviewers** before presenting changes to the developer:
213
+ The Tribunal Pipeline intercepts raw agent generation and routes it through a parallel suite of **27 domain-specific reviewers** before presenting changes to the developer:
214
214
 
215
215
  ```mermaid
216
216
  graph TD
@@ -221,7 +221,7 @@ graph TD
221
221
  C -.->|Failed| E[Maker Auto-Correction]
222
222
  E -.-> C
223
223
 
224
- D -->|19 Domain Reviewers| F[Human Gate]
224
+ D -->|27 Domain Reviewers| F[Human Gate]
225
225
  F -->|Approved| G((Committed to Disk))
226
226
 
227
227
  classDef default fill:#1a1a1a,stroke:#333,stroke-width:2px,color:#fff;
package/bin/mcp-server.js CHANGED
@@ -93,6 +93,10 @@ function searchCaseLaw(query) {
93
93
  timeout: SPAWN_TIMEOUT_MS,
94
94
  },
95
95
  );
96
+ if (result.error) {
97
+ if (result.error.code === "ETIMEDOUT") return "Error: Case law search timed out (exceeded 30s limit)";
98
+ return `Error executing case law search: ${result.error.message}`;
99
+ }
96
100
  return result.stdout || result.stderr || "No results";
97
101
  }
98
102
 
@@ -107,12 +111,27 @@ function stripBoilerplate(text) {
107
111
  }
108
112
 
109
113
  function handleRequest(req) {
114
+ if (req.method === "notifications/initialized" || req.method === "notifications/cancelled") {
115
+ return null;
116
+ }
117
+ if (req.method === "ping") {
118
+ return {};
119
+ }
120
+ if (req.method === "resources/list") {
121
+ return { resources: [] };
122
+ }
123
+ if (req.method === "prompts/list") {
124
+ return { prompts: [] };
125
+ }
126
+
110
127
  // MCP spec: method names follow path-style convention
111
128
  if (req.method === "initialize") {
112
129
  return {
113
130
  protocolVersion: "2024-11-05",
114
131
  capabilities: {
115
132
  tools: {},
133
+ resources: { subscribe: false, listChanged: false },
134
+ prompts: { listChanged: false },
116
135
  },
117
136
  serverInfo: {
118
137
  name: "tribunal-kit-mcp",
@@ -364,10 +383,12 @@ function handleRequest(req) {
364
383
  if (toolName === "get_tribunal_agent") {
365
384
  const fs = require("fs");
366
385
  const name = req.params?.arguments?.name;
367
- if (!name) throw { code: -32602, message: "Missing argument: name" };
368
- const path = require("path");
386
+ if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
369
387
  const sanitizedName = path.basename(name);
370
- const agentPath = path.join(process.cwd(), ".agent", "agents", `${sanitizedName}.md`);
388
+ const agentsDir = path.resolve(process.cwd(), ".agent", "agents");
389
+ const agentPath = path.resolve(agentsDir, `${sanitizedName}.md`);
390
+ // Path containment: ensure resolved path stays within agents directory
391
+ if (!agentPath.startsWith(agentsDir)) throw { code: -32602, message: "Invalid agent name: path traversal detected" };
371
392
  if (!fs.existsSync(agentPath)) return { content: [{ type: "text", text: `Agent '${sanitizedName}' not found.` }] };
372
393
  const text = fs.readFileSync(agentPath, "utf8");
373
394
  return { content: [{ type: "text", text: stripBoilerplate(text) }] };
@@ -384,10 +405,12 @@ function handleRequest(req) {
384
405
  if (toolName === "get_tribunal_skill") {
385
406
  const fs = require("fs");
386
407
  const name = req.params?.arguments?.name;
387
- if (!name) throw { code: -32602, message: "Missing argument: name" };
388
- const path = require("path");
408
+ if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
389
409
  const sanitizedName = path.basename(name);
390
- const skillPath = path.join(process.cwd(), ".agent", "skills", sanitizedName, "SKILL.md");
410
+ const skillsDir = path.resolve(process.cwd(), ".agent", "skills");
411
+ const skillPath = path.resolve(skillsDir, sanitizedName, "SKILL.md");
412
+ // Path containment: ensure resolved path stays within skills directory
413
+ if (!skillPath.startsWith(skillsDir)) throw { code: -32602, message: "Invalid skill name: path traversal detected" };
391
414
  if (!fs.existsSync(skillPath)) return { content: [{ type: "text", text: `Skill '${sanitizedName}' not found.` }] };
392
415
  const text = fs.readFileSync(skillPath, "utf8");
393
416
  return { content: [{ type: "text", text: stripBoilerplate(text) }] };
@@ -407,7 +430,8 @@ function handleRequest(req) {
407
430
  }
408
431
 
409
432
  try {
410
- const { broker } = require("../.agent/scripts/context_broker.js");
433
+ const brokerScript = path.join(agentDest, "scripts", "context_broker.js");
434
+ const { broker } = require(brokerScript);
411
435
  const brokerResult = broker(task, files, model, agentDest);
412
436
  return { content: [{ type: "text", text: stripBoilerplate(brokerResult.promptText) }] };
413
437
  } catch (e) {
@@ -498,7 +522,42 @@ function handleRequest(req) {
498
522
  throw { code: -32601, message: `Unknown method: ${req.method}` };
499
523
  }
500
524
 
525
+ function processSingleRequest(req) {
526
+ try {
527
+ const result = handleRequest(req);
528
+ // If it's a notification, do not send a response
529
+ if (req.id === undefined || req.id === null) {
530
+ return null;
531
+ }
532
+ return { jsonrpc: "2.0", id: req.id, result };
533
+ } catch (e) {
534
+ const code = e && typeof e.code === "number" ? e.code : -32603;
535
+ const message = e && e.message ? e.message : "Internal server error";
536
+ if (req.id === undefined || req.id === null) {
537
+ return {
538
+ jsonrpc: "2.0",
539
+ id: null,
540
+ error: { code, message },
541
+ };
542
+ }
543
+ return {
544
+ jsonrpc: "2.0",
545
+ id: req.id,
546
+ error: { code, message },
547
+ };
548
+ }
549
+ }
550
+
501
551
  rl.on("line", (line) => {
552
+ if (line.length > 1048576) { // 1MB limit
553
+ const errorRes = {
554
+ jsonrpc: "2.0",
555
+ id: null,
556
+ error: { code: -32700, message: "Parse error: input line too long (exceeds 1MB limit)" },
557
+ };
558
+ console.log(JSON.stringify(errorRes));
559
+ return;
560
+ }
502
561
  if (!line.trim()) return;
503
562
 
504
563
  let req;
@@ -515,31 +574,22 @@ rl.on("line", (line) => {
515
574
  return;
516
575
  }
517
576
 
518
- try {
519
- const result = handleRequest(req);
520
- const res = { jsonrpc: "2.0", id: req.id, result };
521
- console.log(JSON.stringify(res));
522
-
523
- // After initialize, send the initialized notification per MCP spec
524
- if (req.method === "initialize") {
525
- console.log(
526
- JSON.stringify({
527
- jsonrpc: "2.0",
528
- method: "notifications/initialized",
529
- params: {},
530
- }),
531
- );
577
+ if (Array.isArray(req)) {
578
+ const responses = [];
579
+ for (const singleReq of req) {
580
+ const response = processSingleRequest(singleReq);
581
+ if (response) {
582
+ responses.push(response);
583
+ }
584
+ }
585
+ if (responses.length > 0) {
586
+ console.log(JSON.stringify(responses));
587
+ }
588
+ } else {
589
+ const response = processSingleRequest(req);
590
+ if (response) {
591
+ console.log(JSON.stringify(response));
532
592
  }
533
- } catch (e) {
534
- // Send proper JSON-RPC error response
535
- const code = e && typeof e.code === "number" ? e.code : -32603;
536
- const message = e && e.message ? e.message : "Internal server error";
537
- const errorRes = {
538
- jsonrpc: "2.0",
539
- id: req.id || null,
540
- error: { code, message },
541
- };
542
- console.log(JSON.stringify(errorRes));
543
593
  }
544
594
  });
545
595
 
package/bin/wrapper.js CHANGED
@@ -24,6 +24,7 @@ const RUST_COMMANDS = new Set([
24
24
  "min-context",
25
25
  "dag-schedule",
26
26
  "context-compress",
27
+ "context-broker",
27
28
  "optimize-step",
28
29
  ]);
29
30
 
@@ -87,6 +88,7 @@ function getBinaryPath() {
87
88
  const buildResult = spawnSync("cargo", ["build", "--release"], {
88
89
  cwd: path.resolve(__dirname, ".."),
89
90
  stdio: "ignore",
91
+ timeout: 60000,
90
92
  });
91
93
  if (buildResult.status === 0) {
92
94
  const releasePath = candidatePaths[0];
@@ -115,10 +117,13 @@ function runRustBinary(binPath, args) {
115
117
  });
116
118
 
117
119
  if (result.error) {
118
- console.error(
119
- `\x1b[91m✖ Failed to execute Rust engine:\x1b[0m ${result.error.message}`,
120
+ // Graceful degradation: fall back to JS engine instead of hard-crashing.
121
+ // Spawn errors include missing binaries, permission denied, corrupted
122
+ // executables, missing shared libraries, and OS-level exec failures.
123
+ console.warn(
124
+ `\x1b[93m⚠ Rust engine failed (${result.error.code || result.error.message}). Falling back to JS engine.\x1b[0m`,
120
125
  );
121
- process.exit(1);
126
+ return false; // Signal caller to fall back
122
127
  }
123
128
 
124
129
  process.exit(result.status || 0);
@@ -128,7 +133,10 @@ function runLegacyFallback() {
128
133
  // Use the modular dist/ CLI with lazy-loaded commands for faster cold-start.
129
134
  // Each command module is require()'d only when invoked (~70% fewer files loaded).
130
135
  const { main } = require("../dist/cli.js");
131
- main();
136
+ main().catch((err) => {
137
+ console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
138
+ process.exit(1);
139
+ });
132
140
  }
133
141
 
134
142
  function main() {
@@ -150,8 +158,11 @@ function main() {
150
158
 
151
159
  // Route to Rust engine
152
160
  // console.log('\x1b[90m⚡ Executing via Rust Core Engine\x1b[0m');
153
- runRustBinary(binPath, args);
154
- return;
161
+ const rustResult = runRustBinary(binPath, args);
162
+ if (rustResult !== false) {
163
+ return; // Rust engine handled it (process.exit was called)
164
+ }
165
+ // rustResult === false means spawn error; fall through to JS fallback
155
166
  } else {
156
167
  // Warn if Rust command was requested but binary is missing
157
168
  console.warn(