@bonesofspring/ai-rules 0.2.51 → 0.2.52

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 (275) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/bin/cli.js +14 -1
  3. package/bin/lib/ai-local-drift.js +55 -14
  4. package/bin/lib/seed-ai-local-team.js +18 -7
  5. package/bin/mavis-install.js +2 -0
  6. package/bin/opencode-install.js +2 -0
  7. package/docs/LOCAL-OVERLAY.md +1 -1
  8. package/docs/PRESET-CONTRIBUTION.md +11 -9
  9. package/package.json +5 -1
  10. package/presets/_shared/ai-local/scripts/manifest.mjs +13 -3
  11. package/presets/_shared/ai-local/scripts/rule-improver.mjs +428 -91
  12. package/presets/_shared/ai-local/scripts/run.mjs +22 -4
  13. package/presets/_shared/ai-local/scripts/signals.mjs +4 -1
  14. package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
  15. package/presets/_shared/core/quality/interactive-questions.md +8 -8
  16. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -0
  17. package/presets/claude/android-kotlin/rules/tooling-and-review/interactive-questions.md +8 -8
  18. package/presets/claude/android-kotlin/rules/tooling-and-review/language-policy.md +1 -1
  19. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  20. package/presets/claude/go/agents/code-reviewer.md +1 -0
  21. package/presets/claude/go/rules/tooling-and-review/interactive-questions.md +8 -8
  22. package/presets/claude/go/rules/tooling-and-review/language-policy.md +1 -1
  23. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  24. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -0
  25. package/presets/claude/ios-swift/rules/tooling-and-review/interactive-questions.md +8 -8
  26. package/presets/claude/ios-swift/rules/tooling-and-review/language-policy.md +1 -1
  27. package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +1 -1
  28. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  29. package/presets/claude/java/agents/code-reviewer.md +1 -0
  30. package/presets/claude/java/rules/tooling-and-review/interactive-questions.md +8 -8
  31. package/presets/claude/java/rules/tooling-and-review/language-policy.md +1 -1
  32. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  33. package/presets/claude/mcp-ts/rules/tooling-and-review/interactive-questions.md +8 -8
  34. package/presets/claude/mcp-ts/rules/tooling-and-review/language-policy.md +1 -1
  35. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  36. package/presets/claude/next/MCP.md +7 -0
  37. package/presets/claude/next/README.md +1 -1
  38. package/presets/claude/next/REPO_AGENTS.md +1 -1
  39. package/presets/claude/next/agents/README.md +3 -3
  40. package/presets/claude/next/agents/build-verifier.md +9 -3
  41. package/presets/claude/next/agents/code-reviewer.md +2 -1
  42. package/presets/claude/next/agents/codebase-analyzer.md +1 -1
  43. package/presets/claude/next/agents/feature-developer.md +18 -8
  44. package/presets/claude/next/agents/openspec-author.md +1 -1
  45. package/presets/claude/next/agents/playwright-test-generator.md +22 -68
  46. package/presets/claude/next/agents/playwright-test-healer.md +27 -54
  47. package/presets/claude/next/agents/playwright-test-planner.md +18 -51
  48. package/presets/claude/next/agents/task-analyst.md +25 -9
  49. package/presets/claude/next/agents/task-router.md +1 -1
  50. package/presets/claude/next/agents/tech-writer.md +1 -1
  51. package/presets/claude/next/mcp.json +3 -3
  52. package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +1 -1
  53. package/presets/claude/next/rules/architecture/layer-barrel-exports.md +1 -1
  54. package/presets/claude/next/rules/architecture/reference-features.md +1 -1
  55. package/presets/claude/next/rules/stack/navigation-router-ui.md +1 -1
  56. package/presets/claude/next/rules/stack/navigation-router.md +14 -0
  57. package/presets/claude/next/rules/stack/next-app-core.md +19 -17
  58. package/presets/claude/next/rules/stack/next-app-router.md +5 -17
  59. package/presets/claude/next/rules/stack/next-static-export.md +1 -1
  60. package/presets/claude/next/rules/tooling-and-review/interactive-questions.md +8 -8
  61. package/presets/claude/next/rules/tooling-and-review/language-policy.md +1 -1
  62. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +1 -1
  63. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  64. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
  65. package/presets/claude/next/rules/tooling-and-review/security-next.md +28 -3
  66. package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +1 -1
  67. package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +4 -4
  68. package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +2 -2
  69. package/presets/claude/next/team/README.md +11 -0
  70. package/presets/claude/next/team/fixtures/feature-with-figma-url.json +10 -0
  71. package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  72. package/presets/claude/next/team/fixtures/mockup-review-standalone.json +9 -0
  73. package/presets/claude/next/team/fixtures/ux-design-standalone.json +9 -0
  74. package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
  75. package/presets/claude/nuxt/rules/architecture/layer-barrel-exports.md +1 -1
  76. package/presets/claude/nuxt/rules/stack/navigation-router-ui.md +1 -1
  77. package/presets/claude/nuxt/rules/tooling-and-review/interactive-questions.md +8 -8
  78. package/presets/claude/nuxt/rules/tooling-and-review/language-policy.md +1 -1
  79. package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +1 -1
  80. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  81. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -0
  82. package/presets/claude/php-hexagonal/rules/tooling-and-review/interactive-questions.md +8 -8
  83. package/presets/claude/php-hexagonal/rules/tooling-and-review/language-policy.md +1 -1
  84. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  85. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -0
  86. package/presets/claude/php-laravel/rules/tooling-and-review/interactive-questions.md +8 -8
  87. package/presets/claude/php-laravel/rules/tooling-and-review/language-policy.md +1 -1
  88. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  89. package/presets/claude/svelte/agents/code-reviewer.md +1 -0
  90. package/presets/claude/svelte/rules/architecture/layer-barrel-exports.md +1 -1
  91. package/presets/claude/svelte/rules/tooling-and-review/interactive-questions.md +8 -8
  92. package/presets/claude/svelte/rules/tooling-and-review/language-policy.md +1 -1
  93. package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +1 -1
  94. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  95. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -0
  96. package/presets/cursor/android-kotlin/rules/README.md +1 -0
  97. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
  98. package/presets/cursor/android-kotlin/rules/interactive-questions.mdc +8 -8
  99. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
  100. package/presets/cursor/go/agents/code-reviewer.md +1 -0
  101. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -2
  102. package/presets/cursor/go/rules/interactive-questions.mdc +8 -8
  103. package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
  104. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -0
  105. package/presets/cursor/ios-swift/rules/README.md +1 -0
  106. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
  107. package/presets/cursor/ios-swift/rules/interactive-questions.mdc +8 -8
  108. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
  109. package/presets/cursor/java/agents/code-reviewer.md +1 -0
  110. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -2
  111. package/presets/cursor/java/rules/interactive-questions.mdc +8 -8
  112. package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
  113. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -2
  114. package/presets/cursor/mcp-ts/rules/interactive-questions.mdc +8 -8
  115. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
  116. package/presets/cursor/next/MCP.md +7 -0
  117. package/presets/cursor/next/REPO_AGENTS.md +1 -1
  118. package/presets/cursor/next/agents/code-reviewer.md +1 -0
  119. package/presets/cursor/next/agents/playwright-test-healer.md +1 -0
  120. package/presets/cursor/next/ai-local/rules-library/router-pages.md +5 -5
  121. package/presets/cursor/next/mcp.json +3 -3
  122. package/presets/cursor/next/rules/README.md +1 -1
  123. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  124. package/presets/cursor/next/rules/css-property-order-stylelint.mdc +1 -1
  125. package/presets/cursor/next/rules/design-tokens-binding.mdc +4 -4
  126. package/presets/cursor/next/rules/forms-validation.mdc +2 -2
  127. package/presets/cursor/next/rules/interactive-questions.mdc +8 -8
  128. package/presets/cursor/next/rules/navigation-router-stack.mdc +14 -1
  129. package/presets/cursor/next/rules/next-app-core.mdc +19 -17
  130. package/presets/cursor/next/rules/next-app-router.mdc +5 -17
  131. package/presets/cursor/next/rules/next-static-export.mdc +1 -1
  132. package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
  133. package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
  134. package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +1 -1
  135. package/presets/cursor/next/rules/reference-features.mdc +1 -1
  136. package/presets/cursor/next/rules/security-next.mdc +28 -3
  137. package/presets/cursor/next/team/README.md +11 -0
  138. package/presets/cursor/next/team/fixtures/feature-with-figma-url.json +10 -0
  139. package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  140. package/presets/cursor/next/team/fixtures/mockup-review-standalone.json +9 -0
  141. package/presets/cursor/next/team/fixtures/ux-design-standalone.json +9 -0
  142. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -0
  143. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  144. package/presets/cursor/nuxt/rules/interactive-questions.mdc +8 -8
  145. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
  146. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -0
  147. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -2
  148. package/presets/cursor/php-hexagonal/rules/interactive-questions.mdc +8 -8
  149. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
  150. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -0
  151. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -2
  152. package/presets/cursor/php-laravel/rules/interactive-questions.mdc +8 -8
  153. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
  154. package/presets/cursor/svelte/agents/code-reviewer.md +1 -0
  155. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  156. package/presets/cursor/svelte/rules/interactive-questions.mdc +8 -8
  157. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
  158. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  159. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -0
  160. package/presets/mavis/android-kotlin/rules/interactive-questions.md +8 -8
  161. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
  162. package/presets/mavis/go/adapter-map.json +1 -1
  163. package/presets/mavis/go/agents/code-reviewer.md +1 -0
  164. package/presets/mavis/go/rules/interactive-questions.md +8 -8
  165. package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
  166. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  167. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -0
  168. package/presets/mavis/ios-swift/rules/interactive-questions.md +8 -8
  169. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
  170. package/presets/mavis/java/adapter-map.json +1 -1
  171. package/presets/mavis/java/agents/code-reviewer.md +1 -0
  172. package/presets/mavis/java/rules/interactive-questions.md +8 -8
  173. package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
  174. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  175. package/presets/mavis/mcp-ts/rules/interactive-questions.md +8 -8
  176. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
  177. package/presets/mavis/next/MCP.md +7 -0
  178. package/presets/mavis/next/REPO_AGENTS.md +1 -1
  179. package/presets/mavis/next/adapter-map.json +1 -1
  180. package/presets/mavis/next/agents/code-reviewer.md +1 -0
  181. package/presets/mavis/next/agents/playwright-test-healer.md +1 -0
  182. package/presets/mavis/next/ai-local/rules-library/router-pages.md +5 -5
  183. package/presets/mavis/next/mcp.json +3 -3
  184. package/presets/mavis/next/rules/css-property-order-stylelint.md +1 -1
  185. package/presets/mavis/next/rules/design-tokens-binding.md +4 -4
  186. package/presets/mavis/next/rules/forms-validation.md +2 -2
  187. package/presets/mavis/next/rules/interactive-questions.md +8 -8
  188. package/presets/mavis/next/rules/navigation-router-stack.md +12 -0
  189. package/presets/mavis/next/rules/next-app-core.md +18 -17
  190. package/presets/mavis/next/rules/next-app-router.md +4 -17
  191. package/presets/mavis/next/rules/next-static-export.md +1 -1
  192. package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
  193. package/presets/mavis/next/rules/react-next-anti-hallucination.md +1 -1
  194. package/presets/mavis/next/rules/reference-features.md +1 -1
  195. package/presets/mavis/next/rules/security-next.md +24 -3
  196. package/presets/mavis/next/team/README.md +11 -0
  197. package/presets/mavis/next/team/fixtures/feature-with-figma-url.json +10 -0
  198. package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  199. package/presets/mavis/next/team/fixtures/mockup-review-standalone.json +9 -0
  200. package/presets/mavis/next/team/fixtures/ux-design-standalone.json +9 -0
  201. package/presets/mavis/nuxt/adapter-map.json +1 -1
  202. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -0
  203. package/presets/mavis/nuxt/rules/interactive-questions.md +8 -8
  204. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
  205. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  206. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -0
  207. package/presets/mavis/php-hexagonal/rules/interactive-questions.md +8 -8
  208. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
  209. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  210. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -0
  211. package/presets/mavis/php-laravel/rules/interactive-questions.md +8 -8
  212. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
  213. package/presets/mavis/svelte/adapter-map.json +1 -1
  214. package/presets/mavis/svelte/agents/code-reviewer.md +1 -0
  215. package/presets/mavis/svelte/rules/interactive-questions.md +8 -8
  216. package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
  217. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  218. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -0
  219. package/presets/opencode/android-kotlin/rules/interactive-questions.md +8 -8
  220. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
  221. package/presets/opencode/go/adapter-map.json +1 -1
  222. package/presets/opencode/go/agents/code-reviewer.md +1 -0
  223. package/presets/opencode/go/rules/interactive-questions.md +8 -8
  224. package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
  225. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  226. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -0
  227. package/presets/opencode/ios-swift/rules/interactive-questions.md +8 -8
  228. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
  229. package/presets/opencode/java/adapter-map.json +1 -1
  230. package/presets/opencode/java/agents/code-reviewer.md +1 -0
  231. package/presets/opencode/java/rules/interactive-questions.md +8 -8
  232. package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
  233. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  234. package/presets/opencode/mcp-ts/rules/interactive-questions.md +8 -8
  235. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
  236. package/presets/opencode/next/MCP.md +7 -0
  237. package/presets/opencode/next/REPO_AGENTS.md +1 -1
  238. package/presets/opencode/next/adapter-map.json +1 -1
  239. package/presets/opencode/next/agents/code-reviewer.md +1 -0
  240. package/presets/opencode/next/agents/playwright-test-healer.md +1 -0
  241. package/presets/opencode/next/ai-local/rules-library/router-pages.md +5 -5
  242. package/presets/opencode/next/opencode.json +3 -3
  243. package/presets/opencode/next/rules/css-property-order-stylelint.md +1 -1
  244. package/presets/opencode/next/rules/design-tokens-binding.md +4 -4
  245. package/presets/opencode/next/rules/forms-validation.md +2 -2
  246. package/presets/opencode/next/rules/interactive-questions.md +8 -8
  247. package/presets/opencode/next/rules/navigation-router-stack.md +12 -0
  248. package/presets/opencode/next/rules/next-app-core.md +18 -17
  249. package/presets/opencode/next/rules/next-app-router.md +4 -17
  250. package/presets/opencode/next/rules/next-static-export.md +1 -1
  251. package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
  252. package/presets/opencode/next/rules/react-next-anti-hallucination.md +1 -1
  253. package/presets/opencode/next/rules/reference-features.md +1 -1
  254. package/presets/opencode/next/rules/security-next.md +24 -3
  255. package/presets/opencode/next/team/README.md +11 -0
  256. package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +10 -0
  257. package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  258. package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +9 -0
  259. package/presets/opencode/next/team/fixtures/ux-design-standalone.json +9 -0
  260. package/presets/opencode/nuxt/adapter-map.json +1 -1
  261. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -0
  262. package/presets/opencode/nuxt/rules/interactive-questions.md +8 -8
  263. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
  264. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  265. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -0
  266. package/presets/opencode/php-hexagonal/rules/interactive-questions.md +8 -8
  267. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
  268. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  269. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -0
  270. package/presets/opencode/php-laravel/rules/interactive-questions.md +8 -8
  271. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
  272. package/presets/opencode/svelte/adapter-map.json +1 -1
  273. package/presets/opencode/svelte/agents/code-reviewer.md +1 -0
  274. package/presets/opencode/svelte/rules/interactive-questions.md +8 -8
  275. package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
@@ -11,15 +11,15 @@ This rule drops the preset's `next-app-router` rule from context for repos using
11
11
 
12
12
  ## Rules
13
13
 
14
- - Route files live in `src/pages/<route>/index.tsx` (or `<route>.tsx`), thin wrappers.
15
- - Domain UI lives in `src/ui/pages/<Name>Page`; route files do not contain layout/business logic.
14
+ - Route files live in `app/src/pages/<route>/index.tsx` (or `<route>.tsx`), thin wrappers.
15
+ - Domain UI lives in `app/src/ui/pages/<Name>Page`; route files do not contain layout/business logic.
16
16
  - Navigation: `next/router` (`useRouter`) and `next/link`. **Never** `next/navigation`.
17
- - `_app.tsx` / `_document.tsx` stay in `src/pages/`.
17
+ - `_app.tsx` / `_document.tsx` stay in `app/src/pages/`.
18
18
  - Dynamic routes: the dynamic segment is **last**, `[id].tsx` → `[id].html`; do **not** add catch-all `[...slug]` routes. Read a dynamic param only after the router is ready (`useRouterReady()` analog) and parse it with the repo's slug helper; push `/404` when it is invalid.
19
19
 
20
20
  ## Forbidden
21
21
 
22
- - Creating App Router files (`src/app/**`, `page.tsx`, `layout.tsx`, `loading.tsx`, `error.tsx`, `route.ts`).
22
+ - Creating App Router files (`app/src/app/**`, `page.tsx`, `layout.tsx`, `loading.tsx`, `error.tsx`, `route.ts`).
23
23
  - Importing `next/navigation` or App Router server APIs (`cookies()`, `headers()`, `redirect()`).
24
24
  - `getServerSideProps` / `getStaticProps` — the app is a client-rendered static export; data goes through the store/`@/api`.
25
- - Reading `router.query` before `router.isReady` (cold-load crash); non-integer / non-final dynamic segments (nginx serves only integer slugs at the end).
25
+ - Reading `router.query` before `router.isReady` (cold-load crash); non-integer / non-final dynamic segments (nginx serves only integer slugs at the end).
@@ -2,15 +2,15 @@
2
2
  "mcpServers": {
3
3
  "context7": {
4
4
  "command": "npx",
5
- "args": ["-y", "@upstash/context7-mcp@4.0.2"]
5
+ "args": ["-y", "@upstash/context7-mcp@4.5.0"]
6
6
  },
7
7
  "playwright": {
8
8
  "command": "npx",
9
- "args": ["-y", "@playwright/mcp@0.0.79"]
9
+ "args": ["-y", "@playwright/mcp@0.0.84"]
10
10
  },
11
11
  "chrome-devtools": {
12
12
  "command": "npx",
13
- "args": ["-y", "chrome-devtools-mcp@1.7.0"]
13
+ "args": ["-y", "chrome-devtools-mcp@1.12.0"]
14
14
  },
15
15
  "figma": {
16
16
  "url": "http://127.0.0.1:3845/mcp"
@@ -11,7 +11,7 @@
11
11
 
12
12
  - **`alwaysApply: true`** (Cursor) / **without `paths:`** (Claude) — base invariants (Cursor/Claude 3–10):
13
13
  - Cursor: `next-app-core`, `package-manager`, `code-quality-and-refactoring`, `ai-local-overlay`
14
- - Claude: `next-app-core`, `package-manager`, `code-quality`
14
+ - Claude: `next-app-core`, `package-manager`, `code-quality` (`code-quality-and-refactoring`), `ai-local-overlay`
15
15
  - **On-demand / requestable** — `post-change-lint` (**required after code edits**, not always-on), `agent-team-intake` (via orchestrator/commands), `agent-team-orchestrator`, architecture, imports, UI, tests, feature-delivery-workflow, `design-guidance`, `mcp-usage`, `anti-sycophancy-discipline`, `interactive-questions`, `anti-hallucination-contract`, `react-next-anti-hallucination`, reference-features, product-specs, product-specs-authoring, next-app-router, next-static-export, `security-next`, react-a11y-coding, component-catalog-gate, forms-validation, `technical-retro`, `mockup-review`, `ux-design`, `design-tokens-binding`
16
16
  - **Preset author meta** (globs `packages/ai-rules/presets/**`, never alwaysApply): `preset-goals`, `preset-writing-style`, `preset-layering`, `preset-twin-sync`, `preset-token-budget`, `preset-pr-checklist`, `preset-no-cross-stack-leakage`
17
17
  - **Skills** — long procedures (`feature-delivery`, `spec-authoring`, `spec-discovery`, `code-review`, …)
@@ -140,7 +140,7 @@ Each producing agent runs a **pre-receipt self-review** of its own output — go
140
140
 
141
141
  ## Context budget & checkpoint/resume
142
142
 
143
- Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
143
+ Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. Mechanical waves (generation, embed sync) are delegated to repo scripts. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
144
144
 
145
145
  ## status.json (pipeline mode)
146
146
 
@@ -11,7 +11,7 @@ alwaysApply: false
11
11
 
12
12
  # CSS property order (as in Stylelint)
13
13
 
14
- For CSS in `.css`, `styles.ts(x)`, `styled` / Linaria — property order matches **`app/.stylelintrc`** (`@sh/stylelint-config-react` → `stylelint-config-idiomatic-order`).
14
+ For CSS in `.css`, `styles.ts(x)`, `styled` / Linaria — property order matches the repo's Stylelint config (this preset's stack: **`app/.stylelintrc`** with `@sh/stylelint-config-react` → `stylelint-config-idiomatic-order`).
15
15
 
16
16
  Do not duplicate the property list by hand. Auto-fix from `app/`: **`yarn lint:css --fix`** (or the repo package manager). Full gate — **`post-change-lint.mdc`**.
17
17
 
@@ -22,25 +22,25 @@ The **binding baseline** is the frozen contract `.ai.local/team/tasks/<slug>/fig
22
22
  ## Typography
23
23
 
24
24
  - Bind to the Figma **text style** used by the node — extract via Figma MCP `get_design_context` / `get_variable_defs` and the node metadata. Do not invent `font-size: 14px; line-height: 20px;` when a Figma text style exists.
25
- - Repo mapping: font family, size, line-height, weight, letter-spacing → `@sds/tokens-typography` (or the project token module). In Linaria / styled: `font: var(--font-body-m, …)` / equivalent token.
25
+ - Repo mapping when the repo ships this stack's DS: font family, size, line-height, weight, letter-spacing → `@sds/tokens-typography`; otherwise the project token module. In Linaria / styled: `font: var(--font-body-m, …)` / equivalent token.
26
26
  - Prefer a typography variant / DS text component that already binds the token (e.g. `Text variant="body-m"`) over a styled wrapper with raw values.
27
27
 
28
28
  ## Color
29
29
 
30
30
  - Bind to the Figma **fill / stroke variable** (`get_variable_defs`). Do not write raw `#…` or `rgb(…)`.
31
- - Repo mapping: `@sds/tokens-colors`, `@sds/brand-colors`, or the project token module (`color: var(--text-primary, …)`).
31
+ - Repo mapping when present: `@sds/tokens-colors`, `@sds/brand-colors`, else the project token module (`color: var(--text-primary, …)`).
32
32
  - A raw value is allowed only with an inline `// token-pending: <Figma-variable-name>` comment and a follow-up to bind it. The reviewer treats unbound raw values as a finding.
33
33
 
34
34
  ## Spacing / radius / shadow
35
35
 
36
36
  - Bind to Figma **spacing / radius / effect variables** or the repo spacing scale. Do not write raw `padding: 16px; gap: 12px;` if a token exists.
37
- - Repo mapping: spacing tokens from `@sds/tokens` / the project scale; Linaria `css\`…\`` uses `var(--space-…, …)`.
37
+ - Repo mapping when present: spacing tokens from `@sds/tokens`, else the project scale; Linaria `css\`…\`` uses `var(--space-…, …)`.
38
38
  - **Auto-layout intent:** respect Figma auto-layout (direction, gap, padding, alignment). Switching to absolute positioning for a region that is the only responsive evidence is a finding. `display: flex` with the same gap/padding is the safe mirror; do not reflow to a different layout without a reason in the brief.
39
39
 
40
40
  ## Imagery & icons
41
41
 
42
42
  - **Images:** use the Figma asset source from `get_design_context` / the node’s image fill. Repo: **the project’s image primitive** — check the nearest component in the same layer (often a plain `<img>` or a DS image component; `next/image` only where the config keeps the optimizer enabled). Derive `src`, `width`, `height` from Figma. Do not use a placeholder, do not invent a URL, do not change aspect ratio.
43
- - **Icons:** use the `@sds/icon` (or project DS) symbol name from the Figma component instance / metadata. Do not invent icon names. The Figma node’s component name (e.g. `Icon / chevron-right`) maps to the DS symbol.
43
+ - **Icons:** use the `@sds/icon` (or the repo DS, e.g. `@sds/*`) symbol name from the Figma component instance / metadata. Do not invent icon names. The Figma node’s component name (e.g. `Icon / chevron-right`) maps to the DS symbol.
44
44
  - `alt` text from the Figma node name when meaningful; otherwise from the design context copy.
45
45
 
46
46
  ## Font, effect, and asset availability
@@ -24,8 +24,8 @@ Use the form solution already in the repo (`package.json` + the nearest form com
24
24
 
25
25
  ## Stack notes
26
26
 
27
- - Library: `react-hook-form` + `yup` resolver; `mode: 'onTouched'`.
28
- - DS fields: `app/src/ui/components/_form/**`; shared validators: `app/src/lib/utils/validations/**`; masks: `imask` / `react-imask`.
27
+ - When the repo ships this preset's stack: form library `react-hook-form` + `yup` resolver; `mode: 'onTouched'`; use the repo equivalents otherwise.
28
+ - DS fields `app/src/ui/components/_form/**`; shared validators `app/src/lib/utils/validations/**`; masks `imask` / `react-imask` — the repo's own paths and mask library when its stack differs.
29
29
 
30
30
  ## Related
31
31
 
@@ -7,7 +7,7 @@ alwaysApply: false
7
7
 
8
8
  # Interactive questions (requestable)
9
9
 
10
- How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool (OpenCode `question`, Claude Code `AskUserQuestion`, a client dialog). The always-on quality rule keeps the short preference; this file carries the full contract.
10
+ How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool. The always-on quality rule keeps the short preference; this file carries the full contract.
11
11
 
12
12
  ## When to ask
13
13
 
@@ -17,16 +17,16 @@ How to put a user-only decision to the user. Load when the answer blocks the wor
17
17
 
18
18
  ## Widget format
19
19
 
20
- 4. **Header** → a short label (≤30 characters).
21
- 5. **Option label** → 1–5 words, in the user's terms.
20
+ 4. **Header** → a short label. Stay inside the host schema's length limit.
21
+ 5. **Option label** → a few words, in the user's terms, inside the host schema's label limit.
22
22
  6. **Option description** → the consequence or the trade-off, not a restatement of the label.
23
- 7. **Two to five options.** Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
- 8. **Multi-select** only when the choices are not mutually exclusive. The host's own free-form entry does not count toward the range.
23
+ 7. **Option count** → the host schema's range. Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
+ 8. **Multi-select** only when the choices are not mutually exclusive. A free-form entry the host adds itself does not count toward the range.
25
25
 
26
- ## The free-form answer is mandatory, the option is not
26
+ ## Free-form is a property of the host
27
27
 
28
- 9. OpenCode `question` and Claude Code `AskUserQuestion` append their own free-form entry for single and multi select. Never add an “other” option there: option values are labels, so a chosen “Other” returns that word, not the user’s text.
29
- 10. A host without that entry (a custom `dialog.select`, an MCP elicitation `enum`, a headless run) needs an explicit “Other” whose selection opens a text prompt — or prose when the answer cannot be enumerated.
28
+ 9. Use the host's free-form channel. When that channel already accepts typed text, do not add an option labeled "Other": a plain option returns its label, and the typed text belongs in the host's free-form field.
29
+ 10. A host with no free-form channel (an enum that returns only the selected label, a headless run) needs an explicit "Other" whose selection opens a text prompt — or prose when the answer cannot be enumerated.
30
30
 
31
31
  ## Fallback
32
32
 
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  description: Choose navigation API by project stack (Next.js vs React Router)
3
- globs: app/src/app/**/*,app/**/app/**/*
3
+ globs: app/src/app/**/*,app/**/app/**/*,app/src/pages/**/*
4
4
  alwaysApply: false
5
+ impact: HIGH
5
6
  ---
6
7
 
7
8
  # Navigation and routing: project stack first
@@ -60,3 +61,15 @@ Before proposing a navigation pattern **align with how the repo already does it*
60
61
  - **Mandatory check:** current **`dependencies`** in the relevant workspace `package.json` + **how routes and imports are already implemented** (repo search, neighboring files). Do not rely on a single signal alone (e.g. only the presence of an `app/` folder).
61
62
  - If the stack is unclear (two routers in dependencies, hybrid) — **cross-check lockfile / installed packages** and **dominant imports** in `src`/`app`, then choose the API.
62
63
  - Detect router mode and deployment model first (**`next-app-core.mdc`**); App Router guidance (`next/navigation`) applies only when the repo uses App Router.
64
+
65
+ ## Incorrect
66
+
67
+ ```tsx
68
+ import { useRouter } from 'next/navigation' // in a Pages Router page
69
+ ```
70
+
71
+ ## Correct
72
+
73
+ ```tsx
74
+ import { useRouter } from 'next/router' // Pages Router
75
+ ```
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Core principles, stack, and architecture of a Next.js application (preset)
3
3
  alwaysApply: true
4
+ impact: HIGH
4
5
  ---
5
6
 
6
7
  # Stack and environment
@@ -15,28 +16,29 @@ Concrete versions come **from `package.json` and configs of the target repositor
15
16
  - **Router mode:** detect from the repo before adding routes — App Router (`app/src/app/**`, `page.tsx`) vs Pages Router (`app/src/pages/**`, `_app.tsx`). Do **not** assume App Router; follow the mode already in use (`next-app-router.mdc`, `navigation-router-stack.mdc`).
16
17
  - **Deployment model:** read `output` in `next.config.*`. With `output: 'export'` the app is a static SPA — no server runtime, no API routes / middleware / SSR (`next-static-export.mdc`).
17
18
  - **Consumer context:** when `.ai/context/**` exists, read it for the repo's compressed architecture, domain glossary, and test-placement conventions before deriving them yourself.
18
- - **Env access:** read `NEXT_PUBLIC_*` through the repo's config module (e.g. `@/config`); new public keys must also be listed in `next.config.*` `env`. Never read `process.env` inside components.
19
+ - **Env access:** `NEXT_PUBLIC_*` in `.env*` is inlined at build and is read through the repo's config module (e.g. `@/config`); `next.config.*` `env` is optional and used only when the repo already does.
20
+ - **Server/client env:** Server Components may read server-only env; Client Components never read `process.env` — import a server-only module or pass the value down as a prop.
19
21
 
20
22
  # Architectural layers
21
23
 
22
- | Layer | Directory | Details |
23
- |-------|-----------|---------|
24
- | UI | `app/src/ui/**` (pages, components) | `react-ui.mdc`, `architecture-boundaries-ui.mdc` |
25
- | Store | `app/src/store/**` (slices, middleware) | `store-rtk.mdc` |
26
- | API | `app/src/api/**` (services, clients, barrel) | `api-services.mdc`, `http-client.mdc` |
27
- | HTTP | `app/src/lib/clients/**`, `app/src/api/clients/**` | `http-client.mdc` |
28
- | Types | `app/src/types/**` | `public-imports.mdc`, `types-jsdoc.mdc` |
29
- | Mocks | `app/src/mocks/**` | per repository layout |
30
-
31
- Layer boundaries, ports/adapters, UI→API — **`architecture-boundaries.mdc`**. Imports of `@/types`, `@/api` — **`public-imports.mdc`**.
24
+ - UI `app/src/ui/**` · Store `app/src/store/**` · API `app/src/api/**` · HTTP `app/src/lib/clients/**` / `app/src/api/clients/**` · Types `app/src/types/**` · Mocks `app/src/mocks/**`.
25
+ - Boundaries, ports/adapters, UI→API — `architecture-boundaries.mdc`; `@/types` / `@/api` imports — `public-imports.mdc`.
32
26
 
33
27
  # Agent work
34
28
 
35
- - Architecture and imports: `architecture-boundaries.mdc`, `public-imports.mdc`
36
- - Features: `feature-delivery-workflow.mdc` + skill `feature-delivery`
37
- - After edits: **invoke** `post-change-lint.mdc` (requestable, required after code edits); package manager: `package-manager.mdc`
38
- - Copy patterns from neighboring files in the target layer; do not use `any` (prefer `unknown` + narrowing)
29
+ - Architecture and imports — `architecture-boundaries.mdc`, `public-imports.mdc`; features — `feature-delivery-workflow.mdc` + skill `feature-delivery`.
30
+ - After edits: **invoke** `post-change-lint.mdc` (requestable, required after code edits); package manager: `package-manager.mdc`.
31
+ - Copy patterns from neighboring files in the target layer; do not use `any` (prefer `unknown` + narrowing).
32
+ - **Language:** resolve the dialogue language on every user message and reply in the user's **native language** (`language-policy.mdc`); development, reasoning, and artifacts stay **English**.
33
+
34
+ ## Incorrect
35
+
36
+ ```tsx
37
+ const apiUrl = process.env.NEXT_PUBLIC_API_URL
38
+ ```
39
39
 
40
- ## Language
40
+ ## Correct
41
41
 
42
- On every user message, before you answer, resolve the dialogue language and reply in the user's **native language**, including a question and a message without a slash command. Order: stored task `language:`, else `.ai.local` (`## Language`), else the prompt, else English. Development, reasoning, and artifacts stay **English**. Commands reuse this resolution. See `language-policy`.
42
+ ```tsx
43
+ const apiUrl = publicConfig.apiUrl // from the repo config module
44
+ ```
@@ -2,6 +2,7 @@
2
2
  description: Next.js App Router — Server/Client Components, data fetching, loading and error UI
3
3
  globs: app/src/app/**/*,app/**/app/**/*
4
4
  alwaysApply: false
5
+ impact: HIGH
5
6
  ---
6
7
 
7
8
  # Next.js App Router
@@ -39,7 +40,7 @@ Less guessed code is better than more. Cross-check APIs against the Next version
39
40
  |---------|----------|
40
41
  | Sync `params` / `searchParams` / `cookies()` / `headers()` when the installed Next treats them as async | `await params` / `await cookies()` / patterns from existing pages |
41
42
  | Invented `getSession()`-only server auth without project verify | Server session verify used by the repo (`security-next.mdc`) |
42
- | Auth enforcement only in Edge middleware | Layout/page/Server Action checks + middleware refresh if present |
43
+ | Auth enforcement only in `middleware` / `proxy` | Layout/page/Server Action checks + `middleware`/`proxy` token refresh if present |
43
44
  | New App Router APIs not in the installed Next major | Copy from a sibling route; mark `VERIFY` if unsure |
44
45
  | Client `fetch` in `page.tsx` bypassing `@/api` | Services via `@/api` / established data loaders |
45
46
 
@@ -52,26 +53,13 @@ Look at an existing route of similar complexity in `app/src/app/**` and repeat i
52
53
  ## Incorrect
53
54
 
54
55
  ```tsx
55
- import Head from 'next/head'
56
- import { useRouter } from 'next/router'
57
-
58
- export default function Page() {
59
- const router = useRouter()
60
- return <Head><title>Order</title></Head>
61
- }
56
+ 'use client'; export const metadata = { title: 'Order' }
62
57
  ```
63
58
 
64
59
  ## Correct
65
60
 
66
61
  ```tsx
67
- 'use client'
68
-
69
- import { useRouter } from 'next/navigation'
70
-
71
- export default function Page() {
72
- const router = useRouter()
73
- return null
74
- }
62
+ export const metadata = { title: 'Order' } // server page.tsx or layout.tsx
75
63
  ```
76
64
 
77
- App Router pages do not import `next/head` or `next/router`. Metadata lives in `export const metadata`. RTK hooks stay in a Client Component. Server data is loaded in the Server Component, not with `getServerSideProps`.
65
+ Metadata cannot be exported from a `'use client'` file: keep it in a server `layout.tsx` / `page.tsx` or a separate server wrapper.
@@ -12,7 +12,7 @@ Detect the deployment model **before** writing data-fetching or routing code: re
12
12
  ## Unavailable
13
13
 
14
14
  - `getServerSideProps`, `getInitialProps`.
15
- - API routes (`pages/api/**`, App Router `route.ts`) and `middleware.ts`.
15
+ - API routes (`pages/api/**`, App Router `route.ts`), `middleware.ts`, and `proxy.ts`.
16
16
  - Server Actions; server `cookies()` / `headers()`.
17
17
  - ISR / `revalidate` / `dynamic = 'force-dynamic'`.
18
18
  - The image optimizer when `images.unoptimized: true` (`next/image` `loader` / `sizes` buy nothing).
@@ -36,7 +36,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
36
36
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
37
37
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
38
38
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
39
- - [ ] **Rule eval (soft):** `node packages/ai-rules/scripts/check-rule-eval.mjs` when rule bodies changed
39
+ - [ ] **Rule eval (hard):** `node packages/ai-rules/scripts/check-rule-eval.mjs` runs inside `yarn check:preset-structure`; keep every registered golden stem paired
40
40
  - [ ] **Anti-hallucination:** `check-anti-hallucination-coverage.mjs` is green inside `yarn check:preset-structure`. Every role loads `anti-hallucination-contract`. Writer roles, including `code-reviewer`, also load `STACK_FLOOR_STEMS`. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`) or the gate FAILs.
41
41
  - [ ] **Gate:** `yarn check:preset-structure` from `packages/ai-rules/` (twin-map, token-budget, leakage, drift, i18n, local overlay, anti-hallucination coverage)
42
42
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Preset authoring: ≤3 always-on / session-start; meta rules never alwaysApply."
2
+ description: "Preset authoring: 3–10 always-on / session-start; meta rules never alwaysApply."
3
3
  globs:
4
4
  - packages/ai-rules/presets/**/*
5
5
  - packages/ai-rules/scripts/**/*
@@ -56,7 +56,7 @@ The installed `next` may bundle version-pinned agent docs and a managed `AGENTS.
56
56
  |---------|----------|
57
57
  | Client `fetch` / raw HTTP from UI or `page.tsx` bypassing `@/api` | Services via `@/api` / established loaders (`api-services.mdc`, `http-client.mdc`) |
58
58
  | Invented `next/link` props that siblings never use (e.g. fake prefetch enums) | Match existing `<Link>` usage; verify against installed Next |
59
- | `getServerSideProps` / `getInitialProps`, `pages/api/**`, `route.ts`, `middleware.ts` in an `output: 'export'` repo | build-time `getStaticProps` / `getStaticPaths` or client store/thunk fetch (`next-static-export.mdc`) |
59
+ | `getServerSideProps` / `getInitialProps`, `pages/api/**`, `route.ts`, `middleware.ts` / `proxy.ts` in an `output: 'export'` repo | build-time `getStaticProps` / `getStaticPaths` or client store/thunk fetch (`next-static-export.mdc`) |
60
60
  | Hardcoded `/` root for links / assets when the repo uses `basePath` / `assetPrefix` | Derive from `basePath` / `assetPrefix` |
61
61
  | `next/image` `loader` / `sizes` / `quality` expecting the optimizer in a repo with `images.unoptimized: true` | The repo's image primitive; no optimizer assumptions |
62
62
 
@@ -11,7 +11,7 @@ alwaysApply: false
11
11
 
12
12
  Before implementing, find a feature of the same type and **mirror its structure**; do not invent a new file organization.
13
13
 
14
- Taxonomy / shared core: [`presets/_shared/README.md`](../../../_shared/README.md) · [Preset contribution guide](../../../../docs/PRESET-CONTRIBUTION.md).
14
+ The preset source tree and the contribution guide are not installed in a consumer repo; copy patterns from your own codebase.
15
15
 
16
16
  ## Reference table
17
17
 
@@ -3,9 +3,13 @@ description: Next.js frontend security — secrets, auth, XSS, Server Actions, e
3
3
  globs:
4
4
  - "**/*Auth*.{ts,tsx}"
5
5
  - "**/*Session*.{ts,tsx}"
6
+ - "**/auth*.{ts,tsx}"
7
+ - "**/session*.{ts,tsx}"
6
8
  - "**/.env*"
7
9
  - "app/**/middleware.ts"
8
10
  - "app/src/**/*middleware*.{ts,tsx}"
11
+ - "app/**/proxy.ts"
12
+ - "app/src/**/proxy*.{ts,tsx}"
9
13
  - "app/src/**/*action*.{ts,tsx}"
10
14
  alwaysApply: false
11
15
  impact: CRITICAL
@@ -25,8 +29,9 @@ Coding-time checklist. Full audit → agent `security-reviewer` + skill `code-re
25
29
 
26
30
  ## Auth and session
27
31
 
28
- - Enforce auth on the **server** (layouts, pages, Server Actions, route handlers) — not only Edge middleware.
29
- - Middleware may refresh sessions; do not treat middleware alone as authorization.
32
+ - Enforce auth on the **server** — in the page, Server Action, route handler, or data-access function that reads the data. That server check is the boundary.
33
+ - Token refresh may live in `middleware` or `proxy` (Next 16 renamed the `middleware` convention to `proxy`); neither is an authorisation boundary on its own.
34
+ - A layout-only check is not a reliable boundary: layouts do not guard route handlers or actions on their own — verify in the page, action, or data-access function.
30
35
  - Prefer httpOnly secure cookies over `localStorage` for tokens when the repo pattern allows.
31
36
  - Never trust client-only session claims without a server verify step used by the project.
32
37
  - **Static-export / SPA repos:** there is no server session verify — use the repo's client route guard plus BFF-issued httpOnly cookies; do not invent a server verifier.
@@ -54,7 +59,7 @@ Coding-time checklist. Full audit → agent `security-reviewer` + skill `code-re
54
59
  |---------|----------|
55
60
  | Invented auth helpers not in `package.json` / codebase | Copy patterns from existing auth routes |
56
61
  | Putting secrets in `NEXT_PUBLIC_*` | Server-only env + server modules |
57
- | Auth only in middleware | Server `getUser` / session verify in layout/page/action |
62
+ | Auth only in `middleware` / `proxy` | Server `getUser` / session verify in the page, action, or data-access function |
58
63
  | Server session verifier / Server Action in a static-export repo | Client route guard + BFF-issued httpOnly cookie |
59
64
 
60
65
  ## Compliance / personal data (regulated apps)
@@ -81,3 +86,23 @@ const key = process.env.SECRET_KEY
81
86
  // Secret stays on the BFF. The client reads only NEXT_PUBLIC_* through the repo config module.
82
87
  const apiUrl = publicConfig.apiUrl
83
88
  ```
89
+
90
+ ## Incorrect
91
+
92
+ ```tsx
93
+ // proxy.ts — treated as the only auth check
94
+ export function proxy(request: NextRequest) {
95
+ if (!request.cookies.has('session')) return NextResponse.redirect(new URL('/login', request.url))
96
+ return NextResponse.next()
97
+ }
98
+ ```
99
+
100
+ ## Correct
101
+
102
+ ```tsx
103
+ // app/orders/page.tsx — the server check that reads the data is the boundary
104
+ export default async function OrdersPage() {
105
+ const user = await requireUser()
106
+ return <OrdersTable orders={await ordersFor(user.id)} />
107
+ }
108
+ ```
@@ -32,6 +32,17 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
32
32
  "slug": "order-history-date-filter",
33
33
  "intent": "feature",
34
34
  "specMode": "consume",
35
+ "profile": "standard",
36
+ "routingDecision": {
37
+ "complexity": "moderate",
38
+ "riskFlags": ["cross-layer"],
39
+ "routingReasons": [
40
+ "The filter spans UI state and the API service, so implementation and validation stay separate steps.",
41
+ "One human gate after decomposition; no architecture or security specialist is required."
42
+ ],
43
+ "estimatedWorkPackages": 1,
44
+ "openDecisionCount": 0
45
+ },
35
46
  "summary": "Add date filter to Order History",
36
47
  "steps": [
37
48
  { "agent": "task-analyst", "label": "Clarify and decompose" },
@@ -2,6 +2,16 @@
2
2
  "slug": "example-feature-with-figma",
3
3
  "intent": "feature",
4
4
  "profile": "full",
5
+ "routingDecision": {
6
+ "complexity": "high",
7
+ "riskFlags": ["cross-layer", "broad-test-surface"],
8
+ "routingReasons": [
9
+ "The Figma mockup adds a UI surface whose tokens and states must match a frozen contract, so `mockup-reviewer` runs before the architect.",
10
+ "The flow spans UI and data boundaries, so the full profile keeps architecture, implementation, validation, and review as separate checkpoints."
11
+ ],
12
+ "estimatedWorkPackages": 2,
13
+ "openDecisionCount": 1
14
+ },
5
15
  "summary": "Feature with Figma mockup URL — mockup-reviewer after analyst, before architect and developer",
6
16
  "steps": [
7
17
  { "agent": "task-analyst", "label": "Clarify and decompose" },
@@ -2,6 +2,16 @@
2
2
  "slug": "example-feature-with-ux-no-figma",
3
3
  "intent": "feature",
4
4
  "profile": "standard",
5
+ "routingDecision": {
6
+ "complexity": "moderate",
7
+ "riskFlags": ["cross-layer"],
8
+ "routingReasons": [
9
+ "Required-signal UX adds a behavioral design pass before decomposition even without a Figma URL.",
10
+ "UI scope forces `mockup-reviewer` against the AC and `ux-design.md`; validation and review stay separate."
11
+ ],
12
+ "estimatedWorkPackages": 2,
13
+ "openDecisionCount": 1
14
+ },
5
15
  "summary": "UI-scope feature with required-signal UX and no Figma URL — task-analyst loads skill ux-design; UI scope forces mockup-reviewer (reviewed against AC / ux-design.md)",
6
16
  "steps": [
7
17
  { "agent": "task-analyst", "label": "Clarify, UX design, decompose" },
@@ -2,6 +2,15 @@
2
2
  "slug": "example-mockup-review-standalone",
3
3
  "intent": "mockup-review",
4
4
  "profile": "light",
5
+ "routingDecision": {
6
+ "complexity": "low",
7
+ "riskFlags": [],
8
+ "routingReasons": [
9
+ "Report-only review of one frozen Figma surface: no production code changes, so a single specialist step is enough."
10
+ ],
11
+ "estimatedWorkPackages": 1,
12
+ "openDecisionCount": 0
13
+ },
5
14
  "summary": "Standalone Figma mockup review (report-only)",
6
15
  "steps": [
7
16
  { "agent": "mockup-reviewer", "label": "Figma mockup review", "model": "strong" }
@@ -2,6 +2,15 @@
2
2
  "slug": "example-ux-design-standalone",
3
3
  "intent": "ux-design",
4
4
  "profile": "light",
5
+ "routingDecision": {
6
+ "complexity": "low",
7
+ "riskFlags": [],
8
+ "routingReasons": [
9
+ "Behavioral UX synthesis with no Figma URL and no implementation step; the analyst owns the report."
10
+ ],
11
+ "estimatedWorkPackages": 1,
12
+ "openDecisionCount": 0
13
+ },
5
14
  "summary": "Standalone behavioral UX design (analyst + skill ux-design; report-only; no developer)",
6
15
  "steps": [
7
16
  { "agent": "task-analyst", "label": "UX design (skill ux-design)" }
@@ -68,6 +68,7 @@ Findings carry `path:line`, severity, `confidence`, and a fix direction — rule
68
68
  ## Depth passes
69
69
  | Pass | Outcome | Evidence or reason |
70
70
  |------|---------|--------------------|
71
+ | Call-site sweep | `no finding` | what was searched or read |
71
72
 
72
73
  ## AC coverage
73
74
  | Criterion | Status | Notes |
@@ -123,7 +123,7 @@ Each producing agent runs a **pre-receipt self-review** of its own output — go
123
123
 
124
124
  ## Context budget & checkpoint/resume
125
125
 
126
- Work in bounded waves (one artifact class across the surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record produced paths on the `implementation` manifest entry `authoritativePaths`. A resumed run (e.g. `/task-continue`) reads `artifact-manifest.json` + `.memlog.md` and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. Mechanical waves (generation, embed sync) are delegated to repo scripts.
126
+ Work in bounded waves (one artifact class across the surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record produced paths on the `implementation` manifest entry `authoritativePaths`. A resumed run (e.g. `/task-continue`) reads `artifact-manifest.json` + `.memlog.md` and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. Mechanical waves (generation, embed sync) are delegated to repo scripts.
127
127
 
128
128
  ## status.json (pipeline mode)
129
129
 
@@ -7,7 +7,7 @@ alwaysApply: false
7
7
 
8
8
  # Interactive questions (requestable)
9
9
 
10
- How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool (OpenCode `question`, Claude Code `AskUserQuestion`, a client dialog). The always-on quality rule keeps the short preference; this file carries the full contract.
10
+ How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool. The always-on quality rule keeps the short preference; this file carries the full contract.
11
11
 
12
12
  ## When to ask
13
13
 
@@ -17,16 +17,16 @@ How to put a user-only decision to the user. Load when the answer blocks the wor
17
17
 
18
18
  ## Widget format
19
19
 
20
- 4. **Header** → a short label (≤30 characters).
21
- 5. **Option label** → 1–5 words, in the user's terms.
20
+ 4. **Header** → a short label. Stay inside the host schema's length limit.
21
+ 5. **Option label** → a few words, in the user's terms, inside the host schema's label limit.
22
22
  6. **Option description** → the consequence or the trade-off, not a restatement of the label.
23
- 7. **Two to five options.** Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
- 8. **Multi-select** only when the choices are not mutually exclusive. The host's own free-form entry does not count toward the range.
23
+ 7. **Option count** → the host schema's range. Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
+ 8. **Multi-select** only when the choices are not mutually exclusive. A free-form entry the host adds itself does not count toward the range.
25
25
 
26
- ## The free-form answer is mandatory, the option is not
26
+ ## Free-form is a property of the host
27
27
 
28
- 9. OpenCode `question` and Claude Code `AskUserQuestion` append their own free-form entry for single and multi select. Never add an “other” option there: option values are labels, so a chosen “Other” returns that word, not the user’s text.
29
- 10. A host without that entry (a custom `dialog.select`, an MCP elicitation `enum`, a headless run) needs an explicit “Other” whose selection opens a text prompt — or prose when the answer cannot be enumerated.
28
+ 9. Use the host's free-form channel. When that channel already accepts typed text, do not add an option labeled "Other": a plain option returns its label, and the typed text belongs in the host's free-form field.
29
+ 10. A host with no free-form channel (an enum that returns only the selected label, a headless run) needs an explicit "Other" whose selection opens a text prompt — or prose when the answer cannot be enumerated.
30
30
 
31
31
  ## Fallback
32
32
 
@@ -36,7 +36,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
36
36
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
37
37
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
38
38
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
39
- - [ ] **Rule eval (soft):** `node packages/ai-rules/scripts/check-rule-eval.mjs` when rule bodies changed
39
+ - [ ] **Rule eval (hard):** `node packages/ai-rules/scripts/check-rule-eval.mjs` runs inside `yarn check:preset-structure`; keep every registered golden stem paired
40
40
  - [ ] **Anti-hallucination:** `check-anti-hallucination-coverage.mjs` is green inside `yarn check:preset-structure`. Every role loads `anti-hallucination-contract`. Writer roles, including `code-reviewer`, also load `STACK_FLOOR_STEMS`. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`) or the gate FAILs.
41
41
  - [ ] **Gate:** `yarn check:preset-structure` from `packages/ai-rules/` (twin-map, token-budget, leakage, drift, i18n, local overlay, anti-hallucination coverage)
42
42
 
@@ -78,6 +78,7 @@ Findings carry `path:line`, severity, `confidence`, and a fix direction — rule
78
78
  ## Depth passes
79
79
  | Pass | Outcome | Evidence or reason |
80
80
  |------|---------|--------------------|
81
+ | Call-site sweep | `no finding` | what was searched or read |
81
82
 
82
83
  ## AC coverage
83
84
  | Criterion | Status | Notes |
@@ -9,7 +9,7 @@ alwaysApply: false
9
9
 
10
10
  # Agent team orchestrator
11
11
 
12
- Parent agent = **manager**. Router plans; specialists execute. Artifacts: `.ai.local/team/tasks/<slug>/` (Claude: `.ai.local/team/tasks/<slug>/`).
12
+ Parent agent = **manager**. Router plans; specialists execute. Artifacts: `.ai.local/team/tasks/<slug>/`.
13
13
 
14
14
  Work request without `/task` — see **agent-team-intake** (when to suggest the router instead of coding directly).
15
15
 
@@ -99,7 +99,7 @@ Each producing agent runs a **pre-receipt self-review** of its own output — go
99
99
 
100
100
  ## Context budget & checkpoint/resume
101
101
 
102
- Work in bounded waves (one artifact class across the surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record produced paths on the `implementation` manifest entry `authoritativePaths`. A resumed run (e.g. `/task-continue`) reads `artifact-manifest.json` + `.memlog.md` and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. Mechanical waves (generation, embed sync) are delegated to repo scripts.
102
+ Work in bounded waves (one artifact class across the surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record produced paths on the `implementation` manifest entry `authoritativePaths`. A resumed run (e.g. `/task-continue`) reads `artifact-manifest.json` + `.memlog.md` and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. Mechanical waves (generation, embed sync) are delegated to repo scripts.
103
103
 
104
104
  ## status.json (pipeline mode)
105
105