@agent-native/core 0.37.2 → 0.38.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 (377) hide show
  1. package/README.md +19 -6
  2. package/dist/action.d.ts +60 -2
  3. package/dist/action.d.ts.map +1 -1
  4. package/dist/action.js +6 -2
  5. package/dist/action.js.map +1 -1
  6. package/dist/agent/production-agent.d.ts +12 -6
  7. package/dist/agent/production-agent.d.ts.map +1 -1
  8. package/dist/agent/production-agent.js +161 -11
  9. package/dist/agent/production-agent.js.map +1 -1
  10. package/dist/agent/types.d.ts +2 -0
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/agent/types.js.map +1 -1
  13. package/dist/catalog.json +2 -2
  14. package/dist/cli/connect.d.ts.map +1 -1
  15. package/dist/cli/connect.js +15 -0
  16. package/dist/cli/connect.js.map +1 -1
  17. package/dist/cli/index.js +10 -6
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/cli/plan-publish-store.d.ts +52 -0
  20. package/dist/cli/plan-publish-store.d.ts.map +1 -0
  21. package/dist/cli/plan-publish-store.js +103 -0
  22. package/dist/cli/plan-publish-store.js.map +1 -0
  23. package/dist/cli/skills.d.ts +29 -0
  24. package/dist/cli/skills.d.ts.map +1 -1
  25. package/dist/cli/skills.js +1349 -544
  26. package/dist/cli/skills.js.map +1 -1
  27. package/dist/cli/templates-meta.js +12 -12
  28. package/dist/cli/templates-meta.js.map +1 -1
  29. package/dist/client/AssistantChat.d.ts +3 -1
  30. package/dist/client/AssistantChat.d.ts.map +1 -1
  31. package/dist/client/AssistantChat.js +65 -15
  32. package/dist/client/AssistantChat.js.map +1 -1
  33. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  34. package/dist/client/MultiTabAssistantChat.js +20 -2
  35. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  36. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  37. package/dist/client/agent-chat-adapter.js +12 -0
  38. package/dist/client/agent-chat-adapter.js.map +1 -1
  39. package/dist/client/agent-engine-key.d.ts +24 -0
  40. package/dist/client/agent-engine-key.d.ts.map +1 -0
  41. package/dist/client/agent-engine-key.js +49 -0
  42. package/dist/client/agent-engine-key.js.map +1 -0
  43. package/dist/client/analytics.d.ts.map +1 -1
  44. package/dist/client/analytics.js +34 -0
  45. package/dist/client/analytics.js.map +1 -1
  46. package/dist/client/blocks/BlockView.d.ts +26 -0
  47. package/dist/client/blocks/BlockView.d.ts.map +1 -0
  48. package/dist/client/blocks/BlockView.js +24 -0
  49. package/dist/client/blocks/BlockView.js.map +1 -0
  50. package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
  51. package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
  52. package/dist/client/blocks/SchemaBlockEditor.js +72 -0
  53. package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
  54. package/dist/client/blocks/agent.d.ts +30 -0
  55. package/dist/client/blocks/agent.d.ts.map +1 -0
  56. package/dist/client/blocks/agent.js +61 -0
  57. package/dist/client/blocks/agent.js.map +1 -0
  58. package/dist/client/blocks/index.d.ts +34 -0
  59. package/dist/client/blocks/index.d.ts.map +1 -0
  60. package/dist/client/blocks/index.js +42 -0
  61. package/dist/client/blocks/index.js.map +1 -0
  62. package/dist/client/blocks/library/checklist.config.d.ts +36 -0
  63. package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
  64. package/dist/client/blocks/library/checklist.config.js +25 -0
  65. package/dist/client/blocks/library/checklist.config.js.map +1 -0
  66. package/dist/client/blocks/library/checklist.d.ts +26 -0
  67. package/dist/client/blocks/library/checklist.d.ts.map +1 -0
  68. package/dist/client/blocks/library/checklist.js +76 -0
  69. package/dist/client/blocks/library/checklist.js.map +1 -0
  70. package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
  71. package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
  72. package/dist/client/blocks/library/code-tabs.config.js +30 -0
  73. package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
  74. package/dist/client/blocks/library/code-tabs.d.ts +3 -0
  75. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
  76. package/dist/client/blocks/library/code-tabs.js +165 -0
  77. package/dist/client/blocks/library/code-tabs.js.map +1 -0
  78. package/dist/client/blocks/library/html.config.d.ts +37 -0
  79. package/dist/client/blocks/library/html.config.d.ts.map +1 -0
  80. package/dist/client/blocks/library/html.config.js +46 -0
  81. package/dist/client/blocks/library/html.config.js.map +1 -0
  82. package/dist/client/blocks/library/html.d.ts +21 -0
  83. package/dist/client/blocks/library/html.d.ts.map +1 -0
  84. package/dist/client/blocks/library/html.js +69 -0
  85. package/dist/client/blocks/library/html.js.map +1 -0
  86. package/dist/client/blocks/library/table.config.d.ts +30 -0
  87. package/dist/client/blocks/library/table.config.d.ts.map +1 -0
  88. package/dist/client/blocks/library/table.config.js +22 -0
  89. package/dist/client/blocks/library/table.config.js.map +1 -0
  90. package/dist/client/blocks/library/table.d.ts +8 -0
  91. package/dist/client/blocks/library/table.d.ts.map +1 -0
  92. package/dist/client/blocks/library/table.js +107 -0
  93. package/dist/client/blocks/library/table.js.map +1 -0
  94. package/dist/client/blocks/library/tabs.config.d.ts +56 -0
  95. package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
  96. package/dist/client/blocks/library/tabs.config.js +36 -0
  97. package/dist/client/blocks/library/tabs.config.js.map +1 -0
  98. package/dist/client/blocks/library/tabs.d.ts +20 -0
  99. package/dist/client/blocks/library/tabs.d.ts.map +1 -0
  100. package/dist/client/blocks/library/tabs.js +123 -0
  101. package/dist/client/blocks/library/tabs.js.map +1 -0
  102. package/dist/client/blocks/mdx.d.ts +74 -0
  103. package/dist/client/blocks/mdx.d.ts.map +1 -0
  104. package/dist/client/blocks/mdx.js +205 -0
  105. package/dist/client/blocks/mdx.js.map +1 -0
  106. package/dist/client/blocks/provider.d.ts +25 -0
  107. package/dist/client/blocks/provider.d.ts.map +1 -0
  108. package/dist/client/blocks/provider.js +19 -0
  109. package/dist/client/blocks/provider.js.map +1 -0
  110. package/dist/client/blocks/registry.d.ts +24 -0
  111. package/dist/client/blocks/registry.d.ts.map +1 -0
  112. package/dist/client/blocks/registry.js +50 -0
  113. package/dist/client/blocks/registry.js.map +1 -0
  114. package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
  115. package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
  116. package/dist/client/blocks/schema-form/introspect.js +164 -0
  117. package/dist/client/blocks/schema-form/introspect.js.map +1 -0
  118. package/dist/client/blocks/server.d.ts +22 -0
  119. package/dist/client/blocks/server.d.ts.map +1 -0
  120. package/dist/client/blocks/server.js +25 -0
  121. package/dist/client/blocks/server.js.map +1 -0
  122. package/dist/client/blocks/types.d.ts +212 -0
  123. package/dist/client/blocks/types.d.ts.map +1 -0
  124. package/dist/client/blocks/types.js +5 -0
  125. package/dist/client/blocks/types.js.map +1 -0
  126. package/dist/client/composer/ComposerPlusMenu.js +10 -1
  127. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  128. package/dist/client/guided-questions.d.ts +68 -0
  129. package/dist/client/guided-questions.d.ts.map +1 -1
  130. package/dist/client/guided-questions.js +158 -3
  131. package/dist/client/guided-questions.js.map +1 -1
  132. package/dist/client/index.d.ts +5 -1
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +15 -1
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
  137. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
  138. package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
  139. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
  140. package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
  141. package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
  142. package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
  143. package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
  144. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
  145. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
  146. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
  147. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
  148. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +61 -0
  149. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
  150. package/dist/client/rich-markdown-editor/SharedRichEditor.js +121 -0
  151. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
  152. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
  153. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
  154. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
  155. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
  156. package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
  157. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
  158. package/dist/client/rich-markdown-editor/extensions.js +222 -0
  159. package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
  160. package/dist/client/rich-markdown-editor/index.d.ts +9 -0
  161. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
  162. package/dist/client/rich-markdown-editor/index.js +9 -0
  163. package/dist/client/rich-markdown-editor/index.js.map +1 -0
  164. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
  165. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
  166. package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
  167. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
  168. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
  169. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
  170. package/dist/client/rich-markdown-editor/useCollabReconcile.js +342 -0
  171. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
  172. package/dist/client/track.d.ts +25 -0
  173. package/dist/client/track.d.ts.map +1 -0
  174. package/dist/client/track.js +53 -0
  175. package/dist/client/track.js.map +1 -0
  176. package/dist/client/use-action.d.ts.map +1 -1
  177. package/dist/client/use-action.js +6 -0
  178. package/dist/client/use-action.js.map +1 -1
  179. package/dist/client/use-session.d.ts +3 -2
  180. package/dist/client/use-session.d.ts.map +1 -1
  181. package/dist/client/use-session.js +3 -2
  182. package/dist/client/use-session.js.map +1 -1
  183. package/dist/deploy/build.d.ts +5 -0
  184. package/dist/deploy/build.d.ts.map +1 -1
  185. package/dist/deploy/build.js +67 -1
  186. package/dist/deploy/build.js.map +1 -1
  187. package/dist/extensions/schema.d.ts +1 -1
  188. package/dist/mcp/build-server.d.ts.map +1 -1
  189. package/dist/mcp/build-server.js +9 -2
  190. package/dist/mcp/build-server.js.map +1 -1
  191. package/dist/mcp/server.d.ts +1 -1
  192. package/dist/mcp/server.d.ts.map +1 -1
  193. package/dist/mcp/server.js +35 -2
  194. package/dist/mcp/server.js.map +1 -1
  195. package/dist/provider-api/index.d.ts +1 -1
  196. package/dist/provider-api/index.d.ts.map +1 -1
  197. package/dist/scripts/docs/search.d.ts.map +1 -1
  198. package/dist/scripts/docs/search.js +5 -2
  199. package/dist/scripts/docs/search.js.map +1 -1
  200. package/dist/scripts/runner.d.ts.map +1 -1
  201. package/dist/scripts/runner.js +16 -3
  202. package/dist/scripts/runner.js.map +1 -1
  203. package/dist/server/action-discovery.d.ts.map +1 -1
  204. package/dist/server/action-discovery.js +2 -0
  205. package/dist/server/action-discovery.js.map +1 -1
  206. package/dist/server/action-routes.d.ts.map +1 -1
  207. package/dist/server/action-routes.js +30 -4
  208. package/dist/server/action-routes.js.map +1 -1
  209. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  210. package/dist/server/agent-chat-plugin.js +65 -19
  211. package/dist/server/agent-chat-plugin.js.map +1 -1
  212. package/dist/server/agent-teams.d.ts.map +1 -1
  213. package/dist/server/agent-teams.js +8 -1
  214. package/dist/server/agent-teams.js.map +1 -1
  215. package/dist/server/agents-bundle.d.ts +27 -1
  216. package/dist/server/agents-bundle.d.ts.map +1 -1
  217. package/dist/server/agents-bundle.js +41 -3
  218. package/dist/server/agents-bundle.js.map +1 -1
  219. package/dist/server/auth.d.ts.map +1 -1
  220. package/dist/server/auth.js +76 -3
  221. package/dist/server/auth.js.map +1 -1
  222. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  223. package/dist/server/core-routes-plugin.js +60 -0
  224. package/dist/server/core-routes-plugin.js.map +1 -1
  225. package/dist/server/onboarding-html.d.ts.map +1 -1
  226. package/dist/server/onboarding-html.js +160 -22
  227. package/dist/server/onboarding-html.js.map +1 -1
  228. package/dist/server/sentry.d.ts.map +1 -1
  229. package/dist/server/sentry.js +6 -0
  230. package/dist/server/sentry.js.map +1 -1
  231. package/dist/server/social-og-image.d.ts +2 -1
  232. package/dist/server/social-og-image.d.ts.map +1 -1
  233. package/dist/server/social-og-image.js +24 -4
  234. package/dist/server/social-og-image.js.map +1 -1
  235. package/dist/sharing/schema.d.ts +1 -1
  236. package/dist/styles/agent-native.css +1 -0
  237. package/dist/styles/rich-markdown-editor.css +439 -0
  238. package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
  239. package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
  240. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  241. package/dist/templates/default/AGENTS.md +1 -0
  242. package/dist/templates/default/DEVELOPING.md +2 -0
  243. package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  244. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  245. package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  246. package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  247. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  248. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  249. package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  250. package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  251. package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  252. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  253. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  254. package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  255. package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  256. package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  257. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  258. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  259. package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  260. package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  261. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  262. package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  263. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  264. package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  265. package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  266. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  267. package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  268. package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  269. package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  270. package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  271. package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  272. package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  273. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  274. package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  275. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  276. package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  277. package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  278. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  279. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  280. package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  281. package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  282. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  283. package/dist/templates/workspace-core/AGENTS.md +5 -1
  284. package/dist/templates/workspace-root/AGENTS.md +5 -2
  285. package/dist/tracking/route.d.ts +43 -0
  286. package/dist/tracking/route.d.ts.map +1 -0
  287. package/dist/tracking/route.js +85 -0
  288. package/dist/tracking/route.js.map +1 -0
  289. package/dist/vite/client.d.ts.map +1 -1
  290. package/dist/vite/client.js +15 -0
  291. package/dist/vite/client.js.map +1 -1
  292. package/docs/content/a2a-protocol.md +18 -4
  293. package/docs/content/actions.md +87 -0
  294. package/docs/content/agent-mentions.md +2 -1
  295. package/docs/content/authentication.md +2 -1
  296. package/docs/content/client.md +64 -13
  297. package/docs/content/cloneable-saas.md +1 -1
  298. package/docs/content/code-agents-ui.md +17 -11
  299. package/docs/content/context-awareness.md +23 -28
  300. package/docs/content/creating-templates.md +1 -1
  301. package/docs/content/drop-in-agent.md +2 -0
  302. package/docs/content/getting-started.md +2 -2
  303. package/docs/content/key-concepts.md +2 -2
  304. package/docs/content/messaging.md +57 -15
  305. package/docs/content/migration-workbench.md +1 -1
  306. package/docs/content/multi-app-workspace.md +1 -1
  307. package/docs/content/multi-tenancy.md +17 -15
  308. package/docs/content/real-time-collaboration.md +1 -1
  309. package/docs/content/recurring-jobs.md +1 -1
  310. package/docs/content/security.md +2 -2
  311. package/docs/content/server.md +4 -4
  312. package/docs/content/skills-guide.md +30 -0
  313. package/docs/content/template-analytics.md +2 -2
  314. package/docs/content/template-assets.md +17 -1
  315. package/docs/content/template-brain.md +2 -2
  316. package/docs/content/template-calendar.md +1 -1
  317. package/docs/content/template-clips.md +3 -3
  318. package/docs/content/template-content.md +2 -2
  319. package/docs/content/template-design.md +2 -2
  320. package/docs/content/template-dispatch.md +3 -3
  321. package/docs/content/template-forms.md +14 -2
  322. package/docs/content/template-mail.md +1 -3
  323. package/docs/content/template-plan.md +118 -0
  324. package/docs/content/template-slides.md +5 -4
  325. package/docs/content/template-starter.md +4 -4
  326. package/docs/content/template-videos.md +6 -11
  327. package/docs/content/tracking.md +21 -1
  328. package/docs/content/visual-plans.md +72 -0
  329. package/docs/content/workspace.md +9 -9
  330. package/package.json +26 -11
  331. package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
  332. package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
  333. package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  334. package/src/templates/default/AGENTS.md +1 -0
  335. package/src/templates/default/DEVELOPING.md +2 -0
  336. package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  337. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  338. package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  339. package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  340. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  341. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  342. package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  343. package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  344. package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  345. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  346. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  347. package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  348. package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  349. package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  350. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  351. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  352. package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  353. package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  354. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  355. package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  356. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  357. package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  358. package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  359. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  360. package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  361. package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  362. package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  363. package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  364. package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  365. package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  366. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  367. package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  368. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  369. package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  370. package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  371. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  372. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  373. package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  374. package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  375. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  376. package/src/templates/workspace-core/AGENTS.md +5 -1
  377. package/src/templates/workspace-root/AGENTS.md +5 -2
@@ -8,30 +8,39 @@ import os from "node:os";
8
8
  import path from "node:path";
9
9
  import { spawn } from "node:child_process";
10
10
  import { buildAppSkillPack, ensureAppSkill, loadAppSkillManifest, normalizeAppSkillManifest, } from "./app-skill.js";
11
- import { readConnectClientPreferences, resolveClients, writeConnectClientPreferences, } from "./connect.js";
11
+ import { readConnectClientPreferences, resolveClients, runConnect, writeConnectClientPreferences, } from "./connect.js";
12
12
  import { CONTEXT_XRAY_SKILL_MD, installLocalContextXray, } from "./context-xray-local.js";
13
13
  import { CLIENTS } from "./mcp-config-writers.js";
14
14
  const HELP = `agent-native skills
15
15
 
16
16
  Usage:
17
17
  agent-native skills list
18
- agent-native skills add assets|design-exploration|visual-plan|visual-questions|ui-plan|visualize-plan|context-xray [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--mcp-url <url>] [--yes] [--dry-run] [--json]
18
+ agent-native skills add assets|design-exploration|visual-plan|visual-questions|ui-plan|visualize-plan|context-xray [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--mcp-url <url>] [--no-connect] [--yes] [--dry-run] [--json]
19
19
  agent-native skills add <manifest-or-app-dir> [--client ...] [--yes]
20
20
 
21
21
  Examples:
22
22
  agent-native skills add assets
23
23
  agent-native skills add design-exploration
24
24
  agent-native skills add visual-plan
25
+ agent-native skills add visual-plan --no-connect
25
26
  agent-native skills add context-xray --client all
26
27
  agent-native skills add assets --client claude-code
27
28
  agent-native skills add assets --mcp-url https://my-app.ngrok-free.dev
28
29
  agent-native skills add ./dist/assets-skill --client codex
29
30
 
30
- The add command wraps the Vercel Labs/open skills CLI for SKILL.md
31
- installation, then registers the app-backed MCP connector. Running
32
- "npx skills add ..." directly installs instructions only; use this Agent Native
33
- CLI path when you want MCP setup too. Pass --mcp-url to register that connector
34
- against a custom origin (an ngrok tunnel, a local dev server, or a self-hosted
31
+ The add command installs the SKILL.md instructions, registers the app-backed
32
+ MCP connector, and then authenticates it in one step so you do not hit an OAuth
33
+ wall on the first tool call. Authentication reuses "agent-native connect":
34
+ OAuth-capable clients (Claude Code) get a URL-only entry and a /mcp authenticate
35
+ prompt, while Codex / Cowork run the browser device-code flow. In a
36
+ non-interactive shell or CI the auth step is skipped and the exact
37
+ "agent-native connect <url>" command is printed instead.
38
+
39
+ Running "npx skills add ..." directly installs instructions only; use this Agent
40
+ Native CLI path when you want MCP setup and auth too. Pass --no-connect to
41
+ register the connector without authenticating (leave auth to the host or run
42
+ "agent-native connect" later). Pass --mcp-url to register that connector against
43
+ a custom origin (an ngrok tunnel, a local dev server, or a self-hosted
35
44
  deployment) instead of the built-in hosted default — a bare origin gets the
36
45
  standard /_agent-native/mcp path appended. Use app-skill pack for marketplace
37
46
  bundles and custom adapter output.`;
@@ -185,7 +194,51 @@ iteration, or a human-in-the-loop choice among design directions.
185
194
  - If you inspect local MCP config, redact \`Authorization\`, \`http_headers\`,
186
195
  and token values. Never paste bearer tokens into chat or logs.
187
196
  `;
188
- const VISUAL_PLANS_SKILL_MD = `---
197
+ /**
198
+ * Shared setup/auth block for every Plans skill (`/visual-plan`, `/ui-plan`,
199
+ * `/visual-questions`, `/visualize-plan`). Interpolated into each skill markdown
200
+ * so the install + one-step authenticate instructions never drift between them.
201
+ * Keep this in sync with the copies under `templates/plan/.agents/skills/*` and
202
+ * top-level `skills/*` (this skill's SKILL.md is triplicated with no sync test).
203
+ */
204
+ const PLAN_SETUP_AUTH_MD = `## Setup & Authentication
205
+
206
+ There are two ways into Plans.
207
+
208
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
209
+ installs the Plans skills, registers the hosted Plans MCP connector, and
210
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
211
+ intended), so the first tool call does not hit an OAuth wall:
212
+
213
+ \`\`\`bash
214
+ agent-native skills add visual-plan
215
+ \`\`\`
216
+
217
+ After that, \`/visual-plan\` (and \`/ui-plan\`, \`/visual-questions\`,
218
+ \`/visualize-plan\`) generate a plan and open the editor. Pass \`--no-connect\` to
219
+ register the connector without authenticating, then run
220
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
221
+
222
+ **Browser (people you share with).** Open the Plans editor and create & edit
223
+ with no sign-up — you work as a guest. Sign in only when you want to save or
224
+ share; signing in claims the plans you made as a guest into your account.
225
+
226
+ Sharing and commenting require an account: public/shared plans are viewable by
227
+ anyone with the link, but commenting on them needs an agent-native account.
228
+
229
+ For fully offline, no-account use, run the Plans app locally and sync plans to
230
+ your repo as MDX. This local mode is a separate advanced path, not the default
231
+ hosted flow.
232
+
233
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
234
+ do not keep retrying the tool. Authenticate the connector with
235
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
236
+ instead re-run /mcp and choose Authenticate), then continue once the connector
237
+ is available.
238
+
239
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
240
+ not put shared secrets in skill files.`;
241
+ export const VISUAL_PLANS_SKILL_MD = `---
189
242
  name: visual-plan
190
243
  description: >-
191
244
  Use Agent-Native Plans when coding-agent work needs an interactive structured
@@ -197,255 +250,412 @@ metadata:
197
250
 
198
251
  # Agent-Native Plans
199
252
 
200
- Agent-Native Plans is structured visual planning mode for coding agents.
201
- Generate the kind of plan you would normally write in Markdown, but as a
202
- scannable plan document with editable blocks mixed in: diagrams, wireframes,
203
- mockups, prototype options, tradeoff cards, file/symbol implementation maps,
204
- code previews, bounded custom HTML fragments, and annotation prompts. It is a
205
- plan document, not a marketing page.
253
+ Agent-Native Plans is structured visual planning mode for coding agents. Build
254
+ the plan you would normally write in Markdown, but as a scannable document with
255
+ editable blocks mixed in: an optional pan/zoom wireframe canvas on top and a
256
+ Notion-like technical document below. The user reacts to visuals first and reads
257
+ prose only where it helps.
206
258
 
207
- The goal is impatient review. The user should be able to react to visuals first
208
- and read prose only where it helps.
259
+ \`/visual-plan\` is the canonical command and the main entry point. Use \`/ui-plan\`
260
+ when the work is primarily product UI and review should start with the screens.
261
+ Use \`/visual-questions\` only when the user explicitly wants a visual intake form
262
+ before planning. Use \`/visualize-plan\` to turn an existing Codex, Claude Code,
263
+ Markdown, or pasted plan into a visual companion.
209
264
 
210
- Install with the Agent-Native CLI. It adds the skills and the MCP connector:
265
+ ## When To Use
211
266
 
212
- \`\`\`bash
213
- npx @agent-native/core@latest skills add visual-plan
214
- \`\`\`
267
+ Create a visual plan when work is multi-file, ambiguous, long-running, risky, or
268
+ UI-heavy, when architecture / data flow / UI direction / options / open
269
+ questions would be clearer visually, or when the user needs to react to a
270
+ direction before you implement.
215
271
 
216
- Then start typing \`/visual-plan\` for a fresh general plan, \`/ui-plan\` for a
217
- UI-first high-fidelity plan, \`/visual-questions\` to force visual intake before
218
- a plan, or \`/visualize-plan\` to turn an existing Codex, Claude Code, Markdown,
219
- or pasted plan into a visual companion. The hosted MCP app opens inline where
220
- supported and falls back to a browser link everywhere else.
221
-
222
- ## Slash Commands
223
-
224
- - \`/visual-plan\`: create a fresh rich visual plan before implementation. Include
225
- a docs-level plan, visual architecture/flow diagrams, detailed wireframes or
226
- mockups when UI is involved, an implementation map with files/symbols/snippets,
227
- tradeoffs, open questions, and clear feedback prompts.
228
- - \`/visual-questions\`: manually force the visual intake step before a plan.
229
- Use it for chip questions, freeform answers, mockup choice tabs, sketch
230
- diagrams, and a generated answer summary that can feed \`/visual-plan\`,
231
- \`/ui-plan\`, \`/visualize-plan\`, or an existing plan update.
232
- - \`/ui-plan\`: create a UI-first high-fidelity visual plan before implementation.
233
- Use an optional top pan/zoom wireframe or diagram canvas when visuals clarify
234
- the flow, then continue as a refined Notion-like document with rich tabs,
235
- comments/drawing prompts, code tabs, and agent handoff notes.
236
- - \`/visualize-plan\`: import an existing Codex, Claude Code, Markdown, or pasted
237
- text plan and turn it into a visual companion. Preserve the plan's intent,
238
- then add diagrams, wireframes, option cards, file/symbol maps, and annotation
239
- prompts.
272
+ ## Plan Discipline
240
273
 
241
- ## When To Use
274
+ - **Gate hard.** A polished visual plan is the most expensive plan form; only
275
+ invest when a wrong direction is costly. Skip it for trivial, unambiguous work
276
+ — typos, one-line fixes, a single well-specified function, anything whose diff
277
+ you could describe in one sentence — and just make the change. Never pad a plan
278
+ with filler and never ship a single-step plan.
279
+ - **Research before you draft.** Read the real files, actions, schema, and
280
+ patterns first; name actual files, symbols, and data shapes instead of
281
+ inventing them. Check existing \`actions/\` before proposing endpoints and prefer
282
+ named client helpers over raw fetch. Delegate wide exploration to a sub-agent.
283
+ - **Planning is read-only.** Make no source edits while building or reviewing the
284
+ plan. Start editing only after the user approves the direction.
285
+ - **Clarify vs. assume.** Do not ask how to build it — explore and present the
286
+ approach and options in the plan. Ask a clarifying question only when an
287
+ ambiguity would change the design and you cannot resolve it from the code; use
288
+ the host agent's normal ask-user-question flow and batch 2-4 high-leverage
289
+ questions before finalizing. Do not create visual questions from \`/visual-plan\`.
290
+ Otherwise state the assumption explicitly and proceed, and put anything
291
+ unresolved in an open-questions block.
292
+ - **The plan is the approval gate.** After surfacing it, ask the user to review
293
+ and approve before you write code, and name which files/areas the work touches.
294
+ Presenting the plan and requesting sign-off is the approval step — do not ask a
295
+ separate "does this look good?" question.
296
+ - **The document is the source of truth, not the chat.** When scope shifts,
297
+ update the plan with \`update-visual-plan\` rather than only changing course in
298
+ chat, and re-read the approved plan before major steps.
242
299
 
243
- Create or update a visual plan when:
300
+ ## Core Workflow
244
301
 
245
- - the user asks for a plan, visual plan, HTML plan, plannotate-style review,
246
- diagrams, wireframes, mockups, prototype options, comments, or annotations;
247
- - work is multi-file, ambiguous, long-running, risky, or UI-heavy;
248
- - the user needs to react quickly to direction rather than read prose;
249
- - architecture, data flow, UI direction, options, or open questions would be
250
- clearer visually;
251
- - you need the user to react before implementation.
302
+ 1. Follow the host agent's normal planning flow: inspect the codebase, delegate
303
+ wide exploration when useful, gather the info needed, and ask native
304
+ clarifying questions as needed before generating the plan.
305
+ 2. Call \`create-visual-plan\` with the title, brief, source, repo path, and
306
+ structured \`content\` blocks.
307
+ 3. Compose the canvas from the kit and write the document with native blocks
308
+ (see the two cores below). Keep the document close to the Markdown plan the
309
+ agent would normally output; add diagrams, wireframes, and visual callouts
310
+ only where they clarify the plan. Skip the canvas for non-visual work.
311
+ 4. Surface the returned Plans link or inline MCP App and ask the user to review.
312
+ Always include the actual URL in chat so the next step is a click in CLI or
313
+ other text-only hosts. When the host exposes an embedded browser/preview panel
314
+ and a tool can open arbitrary URLs there, open the returned plan URL
315
+ automatically for convenient review; do not rely on this as the only handoff.
316
+ 5. Call \`get-plan-feedback\` before editing, after review, after any long pause,
317
+ and before the final response.
318
+ 6. Apply changes with \`update-visual-plan\`, preferring targeted \`contentPatches\`.
319
+ When the user wants source-control friendly edits, use
320
+ \`patch-visual-plan-source\` against the MDX files instead of regenerating the
321
+ plan.
322
+ 7. Export with \`export-visual-plan\` only when the user wants a shareable receipt
323
+ or repo-check-in artifacts.
324
+
325
+ <!-- SHARED-CORE:wireframe-canvas START -->
326
+
327
+ ## Wireframe & Canvas Core
328
+
329
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
330
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
331
+ canvas work. Do not paraphrase it per command.
332
+
333
+ **A wireframe is an HTML mockup. The renderer owns the look; you write the
334
+ content.** Set \`data.html\` to a self-contained, semantic HTML fragment of the
335
+ screen and set \`data.surface\`. The renderer owns the surface footprint/aspect,
336
+ the dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you
337
+ never write \`<html>\`/\`<body>\`/\`<script>\`/\`<style>\` tags, font-family, hex colors,
338
+ or any width/height/coordinates. You write real HTML layout and real product
339
+ content; the renderer styles and roughens it.
340
+
341
+ **A wireframe block's data is an HTML screen plus a surface:**
342
+
343
+ \`\`\`json
344
+ {
345
+ "surface": "browser",
346
+ "html": "<div style=\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\"><h1>Sign in</h1><p class=\\"wf-muted\\">Use your work email to continue.</p><div class=\\"wf-card\\" style=\\"display:flex;flex-direction:column;gap:10px\\"><label>Email<input value=\\"jane@acme.co\\" /></label><label>Password<input value=\\"••••••••\\" /></label><label style=\\"display:flex;align-items:center;gap:8px\\"><input type=\\"checkbox\\" checked /> Remember me</label><button class=\\"primary\\">Sign in</button></div><a href=\\"#\\">Forgot password?</a></div>"
347
+ }
348
+ \`\`\`
252
349
 
253
- The companion \`visual-questions\` and \`visualize-plan\` skills are installed
254
- with this one. Use \`visual-questions\` as the manual override when the user or
255
- agent wants intake first; use \`visualize-plan\` when the user already has a
256
- Codex, Claude Code, Markdown, or pasted text plan and wants a visual companion
257
- instead of a fresh plan.
350
+ **Write PLAIN semantic HTML and let the renderer style it.** Bare elements
351
+ (\`h1\`/\`h2\`/\`h3\`, \`p\`, \`button\`, \`input\`, \`<input type="checkbox">\`, \`a\`, \`hr\`)
352
+ are auto-themed no classes needed. Helper classes carry the rest:
353
+
354
+ - \`.wf-card\` / \`.wf-box\` — a bordered, padded container (a panel, a list item).
355
+ - \`.wf-pill\` / \`.wf-chip\` — a rounded tag or filter; add \`.accent\`
356
+ (\`<span class="wf-pill accent">\`) for the accent-filled variant.
357
+ - \`.wf-muted\` — secondary/muted text (or use \`<small>\`).
358
+ - \`button.primary\` or any element with \`[data-primary]\` — the accent-filled
359
+ primary button.
360
+
361
+ **Use the \`--wf-*\` tokens for any custom color, never hex.** The renderer flips
362
+ these on light/dark, so reading them is what keeps a mockup correct in both
363
+ themes. For any inline border, background, or text color, reference a token:
364
+ \`style="border:1.4px solid var(--wf-line)"\`. The tokens are \`--wf-ink\` (text),
365
+ \`--wf-muted\` (secondary text), \`--wf-line\` (borders/dividers), \`--wf-paper\`
366
+ (page background), \`--wf-card\` (raised surface), \`--wf-accent\` /
367
+ \`--wf-accent-fg\` / \`--wf-accent-soft\` (brand action), \`--wf-warn\`, \`--wf-ok\`,
368
+ and \`--wf-radius\`. Never hard-code a hex color and never set \`font-family\` — the
369
+ renderer owns the sketch/clean font.
370
+
371
+ **Lay out with inline \`style\` flex/grid.** You write the real layout —
372
+ \`display:flex; flex-direction:column; gap:10px; padding:16px\` and so on — and the
373
+ renderer never repositions anything. Compose the actual product: reproduce the
374
+ current screen, then show the modification. Real labels, real counts, real dates,
375
+ real button text grounded in the screen you read; not lorem or gray bars.
376
+
377
+ **Surface presets — match the real footprint, never default to desktop+mobile.**
378
+ Pick the \`surface\` that matches what the user will actually see:
379
+
380
+ - \`browser\`: a web page that needs a browser chrome frame around it.
381
+ - \`desktop\`: a full desktop app page or app shell.
382
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
383
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
384
+ - \`panel\`: a side panel, inspector, or sidebar widget.
385
+
386
+ The surface locks the footprint and aspect; never set width/height/coordinates.
387
+ A sidebar popover renders as a small surface, not a desktop page and a phone
388
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
389
+ actually changes the layout. For a component or widget, show one broader
390
+ app-context frame only when placement affects understanding, then the focused
391
+ component states.
392
+
393
+ **Modify, don't redesign.** When the task changes an existing screen, reproduce
394
+ the current screen's real layout and footprint FIRST, then change only the delta
395
+ and call it out with a single annotation. Do not restack the page into a new
396
+ layout. For net-new surfaces, compose from the real app shell.
397
+
398
+ **Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a
399
+ popover, menu, dialog, toast), show the full screen once, then add a small
400
+ separate artboard whose \`html\` contains ONLY that sub-surface — do not re-draw
401
+ the whole page around it, and do not scale a duplicate up. Pick the matching
402
+ \`surface\` (e.g. \`popover\`) so the footprint is right; never widen a popover to
403
+ page width.
404
+
405
+ **Loading / skeleton states.** Set \`data.skeleton: true\` on the wireframe and
406
+ fill the \`html\` with neutral, textless placeholder geometry — boxes and bars
407
+ built as \`<div>\`s with \`background:var(--wf-line)\` and explicit heights/widths,
408
+ no labels or copy. The renderer drops borders, sketch, and color into the
409
+ skeleton register automatically. Never escape to a \`custom-html\` document block
410
+ to fake a loader, and never move a mockup out of the canvas — mockups always
411
+ live in canvas artboards.
412
+
413
+ **Editing an existing mockup.** To change one element, text, or color in an
414
+ existing html mockup, do NOT regenerate the frame — call \`update-visual-plan\`
415
+ with \`contentPatches: [{ op: "patch-wireframe-html", blockId, edits: [{ find,
416
+ replace }] }]\`. Each \`find\` is a unique snippet of the current html (read it
417
+ first with \`get-visual-plan\`); set \`all: true\` on an edit to replace every
418
+ occurrence. The result is re-sanitized.
419
+
420
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
421
+ present, sprinkle Figma-style notes near the frames they explain: a short
422
+ heading, supporting text, and bullets — plain text layers, never bordered or
423
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
424
+ from frames, so place each note by the frame it describes. Use an arrow only to
425
+ point at one specific control or transition; for a broad frame-level note, write
426
+ text beside the frame with no connector. Connectors are for real sequences only —
427
+ never fake "Step 1 → Step 2" lines between independent states.
428
+
429
+ **Do not create overlapping annotations.** Anchor each note to the frame it
430
+ explains with \`targetId\` + \`placement\` (top/right/bottom/left). The renderer
431
+ parks notes in a gutter beside the frame and lays them out automatically — never
432
+ supply x/y or points for anchored notes; hand-placed coordinates fight the
433
+ auto-layout and cause the overlap you're trying to avoid. Reserve arrows for a
434
+ note that must point at a specific control inside a frame; a note that simply
435
+ sits beside its frame needs no arrow.
436
+
437
+ **Patching.** Edit one wireframe, canvas annotation, or block with targeted \`contentPatches\`
438
+ (for example \`update-block\`, \`replace-blocks\`, \`update-canvas-annotation\`) rather
439
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
440
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
441
+ edits. If an agent is working from exported source files, use
442
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
443
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
444
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
445
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
446
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
447
+ In the browser, humans edit \`rich-text\` prose inline; agents should still use
448
+ \`update-rich-text\` content patches or source patches for prose, and use
449
+ comments/structured patches for canvas, artboard, wireframe, and diagram edits.
450
+
451
+ **Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \`html\` wireframe (or reference a wireframe block via \`blockId\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.
452
+
453
+ **Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\`flex:1\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).
454
+
455
+ **Good example — a contacts list, surface \`browser\`.** A small, real screen
456
+ composed from the helper classes and tokens, layout in inline flex, no fonts or
457
+ hex colors:
458
+
459
+ \`\`\`html
460
+ <div style="display:flex;flex-direction:column;gap:12px;padding:16px;height:100%">
461
+ <div style="display:flex;align-items:center;justify-content:space-between">
462
+ <h1>Contacts</h1>
463
+ <button class="primary">New contact</button>
464
+ </div>
465
+ <div style="display:flex;gap:6px">
466
+ <span class="wf-pill accent">All 128</span>
467
+ <span class="wf-pill">Favorites</span>
468
+ <span class="wf-pill">Archived</span>
469
+ </div>
470
+ <div class="wf-card" style="display:flex;flex-direction:column;gap:0;padding:0">
471
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)">
472
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
473
+ <div style="flex:1"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>
474
+ <span class="wf-pill">Lead</span>
475
+ </div>
476
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px">
477
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
478
+ <div style="flex:1"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>
479
+ <span class="wf-pill">Customer</span>
480
+ </div>
481
+ </div>
482
+ </div>
483
+ \`\`\`
258
484
 
259
- ## Automatic Visual-Question Preflight
485
+ **Mockups belong on the canvas.** When the user asks for a mockup, UI state,
486
+ loading state, prototype, layout, screen, or visual comparison, make the top
487
+ canvas the primary home for that visual. Document blocks can explain, compare,
488
+ or map implementation, but they should not host the primary mockup just because
489
+ \`custom-html\`, screenshots, or prose are easier to produce. If the canvas cannot
490
+ represent the requested fidelity, still keep a canvas artboard and call out or
491
+ extend the needed canvas renderer capability.
492
+
493
+ **Legacy kit tree.** Older plans set a \`screen\` array of \`{ el, ...props }\` kit
494
+ nodes instead of \`html\`; the renderer still accepts and displays it, but new
495
+ plans emit \`html\`. Do not author fresh kit-tree screens — write the HTML mockup
496
+ instead. Likewise, old or imported plans may carry coordinate-based regions or
497
+ free-float x/y on notes or artboards; those are legacy escape hatches the
498
+ renderer still shows but you must never produce. The \`surface\` drives the aspect
499
+ and footprint, the canvas auto-places artboards, and the gutter parks notes by
500
+ \`targetId\` + \`placement\`; never supply width, height, or coordinates for a new
501
+ plan.
502
+
503
+ <!-- SHARED-CORE:wireframe-canvas END -->
504
+
505
+ <!-- SHARED-CORE:document-quality START -->
506
+
507
+ ## Document Quality Core
508
+
509
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
510
+ \`/visualize-plan\`. It is the single source of truth for the document below the
511
+ canvas. Do not paraphrase it per command.
512
+
513
+ **The document is a serious technical plan, not marketing.** Write it the way a
514
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
515
+ self-contained, and specific. State the objective and what "done" means, the
516
+ scope and non-goals, the proposed approach with the key decisions and their
517
+ rationale, ordered steps that name real files, symbols, actions, and data
518
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
519
+ behavior). Replace vague prose with specifics; never ship a step like "make it
520
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
521
+ landing-page headings, or marketing cards unless the user explicitly asks.
522
+
523
+ **Canvas and document never duplicate each other.** The UI story lives on the
524
+ canvas with on-canvas annotations; the document carries the technical depth the
525
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
526
+ snippets, migration or implementation phases, risks, and validation. Repeat a
527
+ wireframe in the document only for a genuinely new detail view or comparison.
528
+ Skip the canvas entirely for non-visual work and write a clean rich document.
529
+
530
+ **Use the right block, and make it carry substance.** For the authoritative,
531
+ machine-checked list of block types and their data schemas, call \`get-plan-blocks\`
532
+ — it returns the live registry vocabulary (type, MDX tag, placement, key fields)
533
+ so you never emit a block the editor cannot render or round-trip:
534
+
535
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
536
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
537
+ symbols/components to touch, the reason, risk/coordination notes, and a
538
+ concise syntax-highlighted snippet of the code shape — never the whole file,
539
+ never a prose-only file list.
540
+ - \`decision\` for two or three option cards with consequences. These are static
541
+ records; do not style them like clickable tabs or chips unless the renderer
542
+ truly supports changing the selection.
543
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
544
+ relationships, only when it clarifies something real. Labels must not overlap
545
+ nodes, connectors, or each other.
546
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
547
+ only prose usually means the plan is under-specified — include a relevant
548
+ visual unless the tab is intentionally document-only.
549
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
550
+
551
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
552
+ a dedicated open-questions / needs-clarification block. Never put a
553
+ questions/decisions wall inside the plan narrative.
554
+
555
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
556
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a generic
557
+ placeholder, density demo, or proof that custom HTML works. Prefer the native
558
+ blocks for normal plans. It may support supplemental demos or references, but it
559
+ is never the primary home for a requested mockup, UI state, or visual
560
+ comparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the
561
+ product fix is canvas support for that artifact type, not moving the mockup into
562
+ the document.
563
+
564
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
565
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
566
+ unreadable diagrams before asking for approval.
567
+
568
+ <!-- SHARED-CORE:document-quality END -->
569
+
570
+ <!-- SHARED-CORE:exemplar START -->
571
+
572
+ ## Good vs. Bad Exemplar
573
+
574
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard whose
575
+ \`data.html\` is a real flex layout — a sidebar of links (\`Inbox 12\`, \`Today 4\`,
576
+ \`Done\`), a main column with an \`<h1>Today</h1>\`, accent \`.wf-pill\`s for the
577
+ filters, a muted section label \`OVERDUE\`, and \`.wf-card\` task rows carrying real
578
+ titles, due dates, and a primary \`button.primary\` — styled only through bare
579
+ elements, helper classes, and \`--wf-*\` tokens, so the renderer applies the
580
+ correct desktop footprint, theme, and one subtle whole-frame wobble. Plain-text
581
+ designer notes sit spaced off the frame, pointing only at the controls that need
582
+ explanation. Below it, a Claude/Codex-grade document: objective and
583
+ done-criteria, an \`implementation-map\` naming the real components and actions
584
+ with short highlighted snippets, a \`decision\` card weighing two real approaches,
585
+ and a validation step — none of it repeating the canvas. This is the bar.
586
+
587
+ **BAD.** A \`data.html\` with hard-coded hex colors, a \`font-family\`, or fixed
588
+ pixel width/height; gray placeholder bars "insinuating" text on a non-skeleton
589
+ frame; a forced desktop + mobile pair for a popover; floating bordered
590
+ annotation cards hugging the frames; a fresh hand-authored kit-tree \`screen\`
591
+ instead of \`html\`; a mockup escaped into a document \`custom-html\` block; and a
592
+ marketing-style document with a hero heading and value props that just restates
593
+ what the canvas already shows. Never produce this.
594
+
595
+ <!-- SHARED-CORE:exemplar END -->
260
596
 
261
- \`/visual-plan\` stays the main entry point. Before calling
262
- \`create-visual-plan\`, decide whether a visual-question preflight would make the
263
- plan meaningfully better.
597
+ ## Tool Guidance
264
598
 
265
- Run \`create-visual-questions\` first when:
599
+ - \`create-visual-plan\`: start one structured visual plan per agent task/run.
600
+ - \`create-ui-plan\`: start a UI-first plan when the work is primarily product UI.
601
+ - \`create-visual-questions\`: use only for the explicit \`/visual-questions\`
602
+ command, not as \`/visual-plan\` preflight.
603
+ - \`visualize-plan\`: build a visual companion from an existing text plan.
604
+ - \`update-visual-plan\`: revise content, status, or comments; prefer
605
+ \`contentPatches\` over regenerating the whole plan.
606
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
607
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
608
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
609
+ artboard, annotation, component, or wireframe-node id.
610
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
611
+ - \`get-visual-plan\`: read the current structured plan, exported HTML, and
612
+ annotations; it also returns the MDX folder for source workflows.
613
+ - \`get-plan-feedback\`: read unconsumed human feedback. Use it frequently.
614
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
615
+ files for repo check-in.
266
616
 
267
- - UI direction, form factor, layout model, feature scope, visual style,
268
- architecture shape, or flow depth is fuzzy enough that 2-6 answers would
269
- change the plan;
270
- - there are multiple plausible visual options and the user would benefit from
271
- comparing mockups, diagrams, or chips before reading a plan;
272
- - the user asks to see choices, answer questions, pick a direction, or review
273
- intake before planning.
617
+ When the user critiques a plan's look or structure, fix the renderer or this
618
+ skill never hand-edit one stored plan. Turn feedback into better guidance.
274
619
 
275
- Skip the preflight when the work is trivial, the right answer is clear from the
276
- codebase, the missing details can be safely stated as assumptions in the plan,
277
- or asking questions would only slow down an otherwise concrete task. If the user
278
- types \`/visual-questions\`, honor it as a manual override even if the heuristic
279
- would normally skip intake.
620
+ ## Setup & Authentication
280
621
 
281
- ## Plan Discipline
622
+ There are two ways into Plans.
282
623
 
283
- Plan mode protects the user from wasted work; it is not ceremony. Hold this
284
- discipline before and around the plan document:
624
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
625
+ installs the Plans skills, registers the hosted Plans MCP connector, and
626
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
627
+ intended), so the first tool call does not hit an OAuth wall:
285
628
 
286
- - **Right-size first.** Build a visual plan when work is multi-file, ambiguous,
287
- risky, architectural, UI-heavy, has multiple valid approaches, or the code is
288
- unfamiliar. Skip it for trivial, unambiguous work — typos, one-line fixes, a
289
- single well-specified function, anything whose diff you could describe in one
290
- sentence — and just make the change. A polished visual plan is the most
291
- expensive plan form; only invest when a wrong direction is costly. Never pad a
292
- plan with filler or ship a single-step plan.
293
- - **Research before you draft.** Read the real files, actions, schema, and
294
- existing patterns first, and name actual files, symbols, and data shapes in
295
- the plan instead of inventing them. Check existing \`actions/\` before proposing
296
- endpoints and prefer named client helpers over raw fetch. Delegate wide
297
- exploration to a sub-agent so the main context stays clear.
298
- - **Planning is read-only.** Make no source edits while building or reviewing
299
- the plan. Start editing code only after the user approves the direction.
300
- - **Clarify vs. assume.** Do not ask the user how to build it — explore and
301
- present the approach and options in the plan. Ask a clarifying question only
302
- when an ambiguity would change the design and you cannot resolve it from the
303
- code or a sensible default; batch a small set (2-4) of high-leverage,
304
- decision-changing questions before finalizing. Otherwise state the most
305
- reasonable assumption explicitly and proceed. Put anything still unresolved in
306
- a dedicated open-questions / needs-clarification block — never guess silently,
307
- and never fill it with detail you could infer.
308
- - **Be specific.** Every plan states the objective and what "done" means,
309
- explicit scope and non-goals, ordered verifiable steps that name real files,
310
- symbols, and actions, the key choices with rationale, risks, and a closing
311
- verification step (tests, build, or a checkable behavior). Replace vague prose
312
- with specifics; never ship a step like "make it work."
313
- - **The plan is the approval gate.** After surfacing the plan, explicitly ask
314
- the user to review and approve before you write any code, and name which
315
- files/areas and permissions the work will touch so approval grants scope.
316
- Presenting the plan and requesting sign-off is the approval step — do not ask
317
- a separate "does this look good?" question.
318
- - **The document is the source of truth, not the chat.** When scope shifts
319
- during review or implementation, update the plan with \`update-visual-plan\`
320
- rather than only changing course in chat, and re-read the approved plan before
321
- major steps so the work does not drift.
629
+ \`\`\`bash
630
+ agent-native skills add visual-plan
631
+ \`\`\`
322
632
 
323
- ## Core Workflow
633
+ After that, \`/visual-plan\` (and \`/ui-plan\`, \`/visual-questions\`,
634
+ \`/visualize-plan\`) generate a plan and open the editor. Pass \`--no-connect\` to
635
+ register the connector without authenticating, then run
636
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
324
637
 
325
- 1. Call \`create-visual-plan\` with the title, brief, source, repo path, and
326
- either structured \`content\` blocks or readable \`sections\` before
327
- implementation.
328
- 2. Prefer structured \`content\` for every new plan. Use \`rich-text\`,
329
- \`sketch-diagram\`, \`sketch-wireframe\`, \`tabs\`, \`code-tabs\`,
330
- \`implementation-map\`, \`decision\`, \`checklist\`, \`table\`,
331
- \`visual-questions\`, and bounded \`custom-html\` blocks. Do not send a full
332
- standalone HTML document unless importing a legacy artifact.
333
- 3. Surface the returned Plans link or inline MCP App. In CLI hosts, ask the user
334
- to review the plan visually.
335
- 4. Prefer diagrams, wireframes, UI mockups, option cards, implementation maps,
336
- and small interactive prototypes over paragraphs.
337
- 5. Call \`get-plan-feedback\` before editing, after review, after any long pause,
338
- and before the final response.
339
- 6. Incorporate comments/corrections with \`update-visual-plan\`. Prefer
340
- \`contentPatches\` for targeted changes: \`update-rich-text\`,
341
- \`replace-block\`, \`update-wireframe-region\`,
342
- \`replace-wireframe-regions\`, \`update-canvas-frame\`, \`append-block\`,
343
- \`remove-block\`, or \`update-custom-html\`. Use full \`content\` only for
344
- broad restructuring.
345
- 7. Export an HTML/JSON/Markdown receipt with \`export-visual-plan\` when the
346
- user wants a shareable summary.
347
-
348
- ## Visual Defaults
349
-
350
- - Use implementation-plan structure first: objective, scope/non-goals, proposed
351
- approach, phases or steps, files/symbols/snippets, risks, open questions, and
352
- validation.
353
- - UI work gets detailed wireframes, mockups, or prototype options before coding.
354
- - Use \`/ui-plan\` when UI direction is the center of the work. \`/visual-plan\`
355
- stays the general plan command for architecture, backend, refactors, and
356
- mixed implementation planning.
357
- - Wireframes should be concrete enough to critique: layout regions, controls,
358
- states, empty/loading/error paths, review affordances, and copy placeholders.
359
- - Sketch wireframes and diagrams should visibly use the app-owned
360
- Rough.js/sketch renderer with subtle grids where useful, imperfect strokes,
361
- and Virgil-style labels. Labels must not overlap rough lines, connectors, or
362
- nodes. If the result looks like crisp boxes with normal borders, revise the
363
- block data or renderer before asking for review.
364
- - For component, popover, or widget plans, show one broader app-context frame
365
- when placement affects understanding, then focused component states. Avoid
366
- fake desktop/mobile flows unless real responsive behavior changes layout.
367
- - Layered surfaces such as popovers and floating panels need an opaque sketch
368
- surface; do not let background frames show through them.
369
- - Placeholder text strokes should be sparse, aligned, and separated from labels
370
- so they read as content rhythm instead of noisy gray bars. In compact cards,
371
- use one or two thin strokes or omit strokes entirely rather than stacking bars
372
- into the label area.
373
- - Keep sketch regions padded. Labels, placeholder strokes, and buttons need
374
- visible breathing room from rough borders; avoid placing UI marks directly on
375
- frame edges.
376
- - Buttons and primary actions in UI mockups must look actionable, not like inert
377
- labels or decorative chips.
378
- - When a top canvas is present, include Figma-like annotation text/arrows on the
379
- canvas itself, not only in prose below. Prefer plain annotation text plus
380
- arrows over boxed cards with borders, backgrounds, or shadows. Place each note
381
- close to the frame it explains, aligned with that frame when possible, instead
382
- of parking notes in unrelated canvas gaps.
383
- - Tabs for UI states, component notes, or interaction notes should include a
384
- relevant visual block unless they are intentionally document-only. Do not
385
- create large tab controls that reveal only prose.
386
- - Backend/refactor work gets architecture and data-flow diagrams.
387
- - Complex tradeoffs get two or three option cards with consequences.
388
- - Open questions are surfaced as visual callouts, not buried in paragraphs.
389
- - Long prose is split into readable document sections with clear headings.
390
- - Visuals should be review aids, not decoration. Avoid decorative hero art,
391
- gradient/hero backgrounds, brand/logo chrome, nav bars, slogans, fluffy value
392
- props, huge landing-page H1s, or marketing-style cards unless the user
393
- explicitly asks.
394
- - Implementation plans include a file map: file path, symbols/components to
395
- touch, reason for the change, risk/coordination notes when relevant, and short
396
- syntax-highlighted snippets for the code shape the agent expects to modify.
397
- - File previews should be concise and reviewable. Do not paste entire large
398
- files; show the key region, public API, component boundary, schema, action, or
399
- selector that matters for review.
400
- - Include README-like detail when helpful: command names, tool behavior,
401
- install flow, MCP/link fallback, data shape, and what is in or out of scope.
402
- - Comments, corrections, replacements, and annotations should feel
403
- plannotator-style: fast to mark up, structured enough for the agent to
404
- consume, and easy to share when the user chooses.
638
+ **Browser (people you share with).** Open the Plans editor and create & edit
639
+ with no sign-up you work as a guest. Sign in only when you want to save or
640
+ share; signing in claims the plans you made as a guest into your account.
405
641
 
406
- ## Tool Guidance
642
+ Sharing and commenting require an account: public/shared plans are viewable by
643
+ anyone with the link, but commenting on them needs an agent-native account.
407
644
 
408
- - \`create-visual-plan\`: start one structured visual plan per agent task/run.
409
- - \`create-ui-plan\`: start a UI-first plan with high-fidelity screen/state tabs.
410
- - \`create-visual-questions\`: ask a visual intake questionnaire before creating
411
- or updating a plan.
412
- - \`visualize-plan\`: create a visual companion from an existing text plan.
413
- - \`update-visual-plan\`: revise content blocks, sections, status, or comments.
414
- Prefer targeted \`contentPatches\` over regenerating the whole plan.
415
- \`contentPatches\` are part of the public MCP action schema, so Claude Code,
416
- Codex, and other MCP hosts can make surgical edits without regenerating a
417
- whole artifact.
418
- - \`get-visual-plan\`: read the current structured plan, exported HTML, and annotations.
419
- - \`get-plan-feedback\`: read unconsumed human feedback. Use it frequently.
420
- - \`export-visual-plan\`: export HTML, Markdown fallback, and structured JSON.
421
-
422
- ## Structured Content Guidance
423
-
424
- - Prefer structured content blocks over raw HTML. Rich text blocks should carry
425
- implementation-plan substance, while diagrams, wireframes, code tabs, and
426
- implementation maps make the work reviewable.
427
- - Use \`custom-html\` only for bounded fragments inside a block. Never include
428
- \`html\`, \`head\`, \`body\`, or \`script\` tags in custom fragments.
429
- - \`sketch-diagram\` blocks must be legible: labels cannot overlap nodes,
430
- connectors, rough lines, or each other; omit the diagram when it does not
431
- clarify a real architecture, sequence, dependency, or state relationship.
432
- - Match Agent-Native's restrained theme unless the user asks otherwise.
433
- - Keep the first viewport legible and plan-like: title, brief, concise scope,
434
- and a useful diagram/checklist/table when it helps.
435
- - Use tabs or small interactions only when they make review faster.
436
- - Do not paste huge artifacts into chat. Store the plan in Plans and surface the
437
- MCP app or link.
438
-
439
- ## Guardrails
440
-
441
- - Keep it simple. Do not build a ten-tab dashboard unless the user asks.
442
- - Do not hand-roll MCP HTTP requests with curl. Use host-exposed tools after
443
- restart/reload, or use the returned browser/deep-link fallback.
444
- - Hosted default: connect
445
- \`https://plan.agent-native.com/_agent-native/mcp\`. Do not put shared
446
- secrets in skill files.
645
+ For fully offline, no-account use, run the Plans app locally and sync plans to
646
+ your repo as MDX. This local mode is a separate advanced path, not the default
647
+ hosted flow.
648
+
649
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
650
+ do not keep retrying the tool. Authenticate the connector with
651
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
652
+ instead re-run /mcp and choose Authenticate), then continue once the connector
653
+ is available.
654
+
655
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
656
+ not put shared secrets in skill files.
447
657
  `;
448
- const UI_PLAN_SKILL_MD = `---
658
+ export const UI_PLAN_SKILL_MD = `---
449
659
  name: ui-plan
450
660
  description: >-
451
661
  Use Agent-Native Plans for UI-first planning with an optional top pan/zoom
@@ -458,248 +668,437 @@ metadata:
458
668
  # UI Plan
459
669
 
460
670
  Use \`/ui-plan\` when the task is primarily about product UI, user flows,
461
- interaction states, component layout, responsive behavior, or visual direction.
462
- This is a specialized Agent-Native Plans workflow: the reviewable UI comes
463
- first, and implementation details come after the user has something concrete to
671
+ interaction states, component layout, or visual direction. The reviewable UI
672
+ comes first; implementation detail comes after the user has something concrete to
464
673
  react to.
465
674
 
466
- \`/visual-plan\` remains the general rich planning command for architecture,
467
- backend, refactors, migrations, and mixed work. Use \`/visualize-plan\` when a
468
- text plan already exists and should become a visual companion.
675
+ \`/visual-plan\` remains the general command for architecture, backend, refactors,
676
+ and mixed work. Use \`/visual-questions\` only when the user explicitly wants
677
+ visual intake before planning, and \`/visualize-plan\` when a text plan already
678
+ exists.
469
679
 
470
680
  ## Plan Discipline
471
681
 
472
- - **Right-size first.** Use a UI plan when the surface is new, ambiguous, spans
473
- several screens or states, or the direction needs agreement before coding.
474
- Skip it for cosmetic one-liners — a color, a label, a spacing tweak — and just
475
- make the change.
476
- - **Research before you draft.** Read the real components, routes, design
477
- tokens, and existing patterns first, and ground mockups and the file map in
478
- actual files and symbols rather than inventing them. Delegate wide exploration
479
- to a sub-agent when the surface is large.
480
- - **Planning is read-only.** Make no source edits while building or reviewing
481
- the plan. Start editing only after the user approves the UI direction.
482
- - **Clarify vs. assume.** Do not ask the user how to build the UI — explore and
483
- present the direction and options as mockups and tabs. Ask a clarifying
484
- question only when an ambiguity would change the design and you cannot resolve
485
- it from the code or a sensible default; batch 2-4 high-leverage,
486
- decision-changing questions before finalizing. Otherwise state the assumption
487
- in the plan and proceed.
488
- - **The plan is the approval gate.** Explicitly ask the user to review and
489
- approve the UI direction before you write any code, and name the files/areas
490
- the work will touch. Presenting the plan and requesting sign-off is the
491
- approval step — do not ask a separate "does this look good?" question.
682
+ - **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several
683
+ screens or states, or the direction needs agreement before coding. Skip it for
684
+ cosmetic one-liners — a color, a label, a spacing tweak — and just make the
685
+ change. Never ship a single-step or filler plan.
686
+ - **Research before you draft.** Read the real components, routes, and design
687
+ tokens first; ground every mockup and the file map in actual files and symbols.
688
+ Delegate wide exploration to a sub-agent when the surface is large.
689
+ - **Planning is read-only.** Make no source edits while building or reviewing.
690
+ Start editing only after the user approves the UI direction.
691
+ - **Clarify vs. assume.** Do not ask how to build the UI — present the direction
692
+ and options as mockups and tabs. Ask a clarifying question only when an
693
+ ambiguity would change the design; use the host agent's normal
694
+ ask-user-question flow and batch 2-4 before finalizing. Do not create visual
695
+ questions from \`/ui-plan\`. Otherwise state the assumption in the plan and
696
+ proceed.
697
+ - **The plan is the approval gate.** Ask the user to review and approve the UI
698
+ direction before you write code, and name the files/areas the work touches.
492
699
 
493
700
  ## UI-First Workflow
494
701
 
495
- 1. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path,
496
- and structured \`content\` when you need custom blocks. Otherwise provide
497
- \`states\`, \`components\`, and \`implementationNotes\` so Plans can generate
498
- the native editable canvas and document.
499
- 2. When the plan has meaningful UI flows, screens, or diagrams, make the top
500
- of the document a bounded pan/zoom sketch canvas with the key artboards,
501
- connectors, margin notes, and commentable visual anchors.
502
- Use the app-owned Rough.js/sketch renderer: subtle grid field, deliberately
503
- imperfect lines, Virgil-style wireframe labels, and Figma-like annotation
504
- text/arrows on the top canvas. Labels must sit clear of rough lines,
505
- connectors, controls, and neighboring notes.
506
- Treat notes like Figma text layers: sprinkle headings, supporting text,
507
- bullets, arrows, and labels around the artboards, but do not overlap the
508
- wireframes or wrap the artboards in explanatory cards.
509
- In dark mode, keep the canvas field slightly darker than the document, and
510
- keep wireframe artboards flat rather than shadowed.
511
- 3. Continue below the canvas as a restrained, Notion-like interactive document:
512
- clear prose, horizontal state tabs, inline wireframes, sketchy diagrams,
513
- tables, vertical code tabs, and concise implementation notes.
514
- 4. Skip the top canvas when wireframes or diagrams would not clarify the work;
515
- in that case, keep the plan as a clean rich document.
516
- 5. Put files, symbols, data/actions, migrations, risks, and validation lower in
517
- the document after the visual review area.
518
- 6. Call \`get-plan-feedback\` before implementation, after review, after a long
519
- pause, and before the final response. Apply changes with
520
- \`update-visual-plan\`. Prefer targeted \`contentPatches\` for small changes
521
- to one state tab, wireframe region, canvas frame, code tab, or document
522
- block.
523
-
524
- ## Mockup Quality Bar
525
-
526
- - Build high-fidelity screen sections with realistic spacing, controls,
527
- hierarchy, text, and state-specific content. Avoid vague gray boxes.
528
- - Show the actual workflow the user will use: navigation, toolbar actions,
529
- forms, dialogs, empty states, error recovery, loading affordances, and
530
- confirmation/success states.
531
- - Include desktop and mobile/responsive states when layout decisions could
532
- change. Put them in tabs or adjacent panels rather than burying them in prose.
533
- - Use concrete labels and copy placeholders that expose content length,
534
- truncation, disabled states, and destructive actions.
535
- - Buttons and primary actions must look actionable: visible affordance,
536
- readable label/icon, and enabled/disabled treatment when relevant.
537
- - Make state tabs span the plan content width. Small cards are fine for repeated
538
- items, but the primary UI preview should not be trapped in a tiny thumbnail.
539
- - Keep visuals review-focused, not decorative. Do not make a marketing page,
540
- hero section, brand deck, or abstract mood board unless the user asks.
541
-
542
- ## Component And Widget Plans
543
-
544
- When the work is a component, popover, sidebar widget, toolbar, card, modal, or
545
- other small surface, do not generate a full app flow. Use compact component
546
- states instead.
547
-
548
- - Prefer square or vertical frames that match the component's real footprint. A
549
- sidebar popover should look like a sidebar popover, not a desktop page or
550
- phone screen.
551
- - When placement matters, include one broader app-context frame showing the
552
- surrounding page, sidebar, or toolbar, then focused component states.
553
- - Layered surfaces such as popovers, menus, and floating inspectors need an
554
- opaque sketch surface so they read as overlays instead of transparent boxes.
555
- - Use state tabs such as \`Default\`, \`Expanded\`, \`Map\`, \`Loading\`, \`Empty\`,
556
- and \`Error\`. Do not add \`Desktop\`, \`Mobile\`, or responsive states unless the
557
- component actually changes layout across breakpoints.
558
- - Draw only connectors for real sequences. Do not connect independent states
559
- with fake "Step 1" lines.
560
- - Ground every frame in the real product hierarchy: visible title, controls,
561
- content groups, state labels, actions, empty/error copy, and realistic
562
- density. If you have seen a screenshot or component code, reflect it.
563
- - Keep labels outside collision zones. Text must never overlap wireframes,
564
- connectors, toolbar controls, or neighboring notes.
565
- - Placeholder text strokes should be sparse, aligned, and below labels; avoid
566
- random-looking gray bars that collide with copy or make the sketch messy. In
567
- compact cards, use one or two thin strokes or omit strokes rather than filling
568
- the card with bars.
569
- - Keep every sketch region padded. Labels, placeholder strokes, and buttons need
570
- visible breathing room from rough borders; avoid edge-hugging component
571
- layouts.
572
- - Use the app-owned Rough.js/sketch renderer for wireframes and diagrams. The
573
- result should look deliberately hand-drawn/scribbly with Virgil-style labels,
574
- not like crisp bordered boxes on a grid.
575
-
576
- ## State Tabs
577
-
578
- When showing multiple UI states, prefer the structured \`tabs\` block. Each tab
579
- can contain rich text, sketch wireframes, diagrams, code tabs, or bounded custom
580
- HTML fragments. Raw HTML tab attributes are only for legacy imported artifacts.
581
- For UI-first plans, tabs named like component notes, interaction notes, screen
582
- states, or review states should include a relevant visual block unless they are
583
- intentionally document-only; prose-only tabs are usually a sign the plan is
584
- under-specified.
585
-
586
- Good state tab sets include:
587
-
588
- - \`Default\`, \`Loading\`, \`Empty\`, \`Error\`
589
- - \`List\`, \`Detail\`, \`Edit\`, \`Confirm\`
590
- - \`Desktop\`, \`Tablet\`, \`Mobile\`
591
- - \`Owner\`, \`Reviewer\`, \`Signed out\`
592
-
593
- ## UI Flow Document
594
-
595
- Generated \`/ui-plan\` documents use one default shape: an optional Figma-style
596
- pan/zoom visual preface followed by a refined Notion-like document. There is no
597
- mode boolean. Provide \`states\` and \`components\` when the top canvas will help
598
- the reviewer understand the flow; omit them when the plan should be
599
- document-only. Use structured blocks for custom states, diagrams, and code
600
- detail instead of full standalone HTML.
601
-
602
- The document below the canvas should still include the same planning substance:
603
- screen states, component notes, implementation map, review prompts, comments,
604
- drawing-friendly space, and agent handoff. Treat it like a designer handed over
605
- a Figma file plus a crisp product spec: the reviewer should understand the UI
606
- flow from a bird's-eye view, then keep scrolling into a clean interactive
607
- document with notes explaining how the screens work together.
608
-
609
- ## Comments, Drawing, And Handoff
610
-
611
- - Add visible annotation prompts beside the mockups: "Comment on layout",
612
- "Circle unclear copy", "Mark missing state", or "Pick this option". Canvas
613
- annotations should feel like Figma callouts: plain text plus arrows, without
614
- card borders, shadows, or background panels unless editing UI is required.
615
- Place notes close to the frame they explain, aligned with that target frame
616
- when possible, instead of parking notes in unrelated canvas gaps.
617
- - Leave enough whitespace around key UI regions for drawing and callouts.
618
- - Label important regions so comments can reference them without ambiguity.
619
- - Include an "Agent Handoff" section after the mockups that summarizes the
620
- chosen UI direction, unresolved visual questions, and feedback that must be
621
- read before code changes.
622
- - Never claim feedback has been applied until \`get-plan-feedback\` or the user
623
- has supplied the feedback in chat.
624
-
625
- ## Implementation Details Lower Down
626
-
627
- After the visual canvas and document review blocks, include a concise
628
- implementation section:
629
-
630
- - file paths and symbols/components to touch;
631
- - data/actions/hooks/routes needed for the UI;
632
- - state ownership, optimistic updates, and sync expectations;
633
- - accessibility, responsive, and keyboard considerations;
634
- - test and verification plan;
635
- - short code-shape snippets only where they clarify the implementation.
636
-
637
- Do not paste whole files or let implementation prose crowd out the mockups.
638
- The purpose of \`/ui-plan\` is to get visual direction approved before the agent
639
- starts editing.
702
+ 1. Follow the host agent's normal planning flow: inspect the codebase, gather
703
+ the UI/component context needed, and ask native clarifying questions as needed
704
+ before generating the plan.
705
+ 2. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path, and
706
+ structured \`content\`. The canvas comes first, the document second.
707
+ 3. Compose the top canvas from the kit (see the cores below): the key artboards
708
+ with real product content, designer notes, and connectors only for real
709
+ sequences. Skip the canvas when wireframes would not clarify the work.
710
+ 4. Continue below as a concise technical document that stays close to the
711
+ Markdown plan the agent would normally output not a second copy of the
712
+ canvas — covering concrete files, contracts, phases, risks, and validation.
713
+ 5. Call \`get-plan-feedback\` before implementation, after review, after a long
714
+ pause, and before the final response. Apply changes with \`update-visual-plan\`,
715
+ preferring \`contentPatches\` for one frame, annotation, node, tab, or block. When the user
716
+ wants source-control friendly edits, use \`patch-visual-plan-source\` against
717
+ the MDX files instead of regenerating the plan.
718
+
719
+ ## Agent Handoff
720
+
721
+ After the canvas and document, add a short handoff that names the chosen UI
722
+ direction, unresolved visual questions, and feedback that must be read before
723
+ code changes. Never claim feedback has been applied until \`get-plan-feedback\` or
724
+ the user has supplied it.
725
+
726
+ <!-- SHARED-CORE:wireframe-canvas START -->
727
+
728
+ ## Wireframe & Canvas Core
729
+
730
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
731
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
732
+ canvas work. Do not paraphrase it per command.
733
+
734
+ **A wireframe is an HTML mockup. The renderer owns the look; you write the
735
+ content.** Set \`data.html\` to a self-contained, semantic HTML fragment of the
736
+ screen and set \`data.surface\`. The renderer owns the surface footprint/aspect,
737
+ the dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you
738
+ never write \`<html>\`/\`<body>\`/\`<script>\`/\`<style>\` tags, font-family, hex colors,
739
+ or any width/height/coordinates. You write real HTML layout and real product
740
+ content; the renderer styles and roughens it.
741
+
742
+ **A wireframe block's data is an HTML screen plus a surface:**
743
+
744
+ \`\`\`json
745
+ {
746
+ "surface": "browser",
747
+ "html": "<div style=\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\"><h1>Sign in</h1><p class=\\"wf-muted\\">Use your work email to continue.</p><div class=\\"wf-card\\" style=\\"display:flex;flex-direction:column;gap:10px\\"><label>Email<input value=\\"jane@acme.co\\" /></label><label>Password<input value=\\"••••••••\\" /></label><label style=\\"display:flex;align-items:center;gap:8px\\"><input type=\\"checkbox\\" checked /> Remember me</label><button class=\\"primary\\">Sign in</button></div><a href=\\"#\\">Forgot password?</a></div>"
748
+ }
749
+ \`\`\`
750
+
751
+ **Write PLAIN semantic HTML and let the renderer style it.** Bare elements
752
+ (\`h1\`/\`h2\`/\`h3\`, \`p\`, \`button\`, \`input\`, \`<input type="checkbox">\`, \`a\`, \`hr\`)
753
+ are auto-themed — no classes needed. Helper classes carry the rest:
754
+
755
+ - \`.wf-card\` / \`.wf-box\` a bordered, padded container (a panel, a list item).
756
+ - \`.wf-pill\` / \`.wf-chip\` a rounded tag or filter; add \`.accent\`
757
+ (\`<span class="wf-pill accent">\`) for the accent-filled variant.
758
+ - \`.wf-muted\` secondary/muted text (or use \`<small>\`).
759
+ - \`button.primary\` or any element with \`[data-primary]\` — the accent-filled
760
+ primary button.
761
+
762
+ **Use the \`--wf-*\` tokens for any custom color, never hex.** The renderer flips
763
+ these on light/dark, so reading them is what keeps a mockup correct in both
764
+ themes. For any inline border, background, or text color, reference a token:
765
+ \`style="border:1.4px solid var(--wf-line)"\`. The tokens are \`--wf-ink\` (text),
766
+ \`--wf-muted\` (secondary text), \`--wf-line\` (borders/dividers), \`--wf-paper\`
767
+ (page background), \`--wf-card\` (raised surface), \`--wf-accent\` /
768
+ \`--wf-accent-fg\` / \`--wf-accent-soft\` (brand action), \`--wf-warn\`, \`--wf-ok\`,
769
+ and \`--wf-radius\`. Never hard-code a hex color and never set \`font-family\` — the
770
+ renderer owns the sketch/clean font.
771
+
772
+ **Lay out with inline \`style\` flex/grid.** You write the real layout
773
+ \`display:flex; flex-direction:column; gap:10px; padding:16px\` and so on and the
774
+ renderer never repositions anything. Compose the actual product: reproduce the
775
+ current screen, then show the modification. Real labels, real counts, real dates,
776
+ real button text grounded in the screen you read; not lorem or gray bars.
777
+
778
+ **Surface presets — match the real footprint, never default to desktop+mobile.**
779
+ Pick the \`surface\` that matches what the user will actually see:
780
+
781
+ - \`browser\`: a web page that needs a browser chrome frame around it.
782
+ - \`desktop\`: a full desktop app page or app shell.
783
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
784
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
785
+ - \`panel\`: a side panel, inspector, or sidebar widget.
786
+
787
+ The surface locks the footprint and aspect; never set width/height/coordinates.
788
+ A sidebar popover renders as a small surface, not a desktop page and a phone
789
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
790
+ actually changes the layout. For a component or widget, show one broader
791
+ app-context frame only when placement affects understanding, then the focused
792
+ component states.
793
+
794
+ **Modify, don't redesign.** When the task changes an existing screen, reproduce
795
+ the current screen's real layout and footprint FIRST, then change only the delta
796
+ and call it out with a single annotation. Do not restack the page into a new
797
+ layout. For net-new surfaces, compose from the real app shell.
798
+
799
+ **Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a
800
+ popover, menu, dialog, toast), show the full screen once, then add a small
801
+ separate artboard whose \`html\` contains ONLY that sub-surface — do not re-draw
802
+ the whole page around it, and do not scale a duplicate up. Pick the matching
803
+ \`surface\` (e.g. \`popover\`) so the footprint is right; never widen a popover to
804
+ page width.
805
+
806
+ **Loading / skeleton states.** Set \`data.skeleton: true\` on the wireframe and
807
+ fill the \`html\` with neutral, textless placeholder geometry — boxes and bars
808
+ built as \`<div>\`s with \`background:var(--wf-line)\` and explicit heights/widths,
809
+ no labels or copy. The renderer drops borders, sketch, and color into the
810
+ skeleton register automatically. Never escape to a \`custom-html\` document block
811
+ to fake a loader, and never move a mockup out of the canvas — mockups always
812
+ live in canvas artboards.
813
+
814
+ **Editing an existing mockup.** To change one element, text, or color in an
815
+ existing html mockup, do NOT regenerate the frame — call \`update-visual-plan\`
816
+ with \`contentPatches: [{ op: "patch-wireframe-html", blockId, edits: [{ find,
817
+ replace }] }]\`. Each \`find\` is a unique snippet of the current html (read it
818
+ first with \`get-visual-plan\`); set \`all: true\` on an edit to replace every
819
+ occurrence. The result is re-sanitized.
820
+
821
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
822
+ present, sprinkle Figma-style notes near the frames they explain: a short
823
+ heading, supporting text, and bullets plain text layers, never bordered or
824
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
825
+ from frames, so place each note by the frame it describes. Use an arrow only to
826
+ point at one specific control or transition; for a broad frame-level note, write
827
+ text beside the frame with no connector. Connectors are for real sequences only —
828
+ never fake "Step 1 → Step 2" lines between independent states.
829
+
830
+ **Do not create overlapping annotations.** Anchor each note to the frame it
831
+ explains with \`targetId\` + \`placement\` (top/right/bottom/left). The renderer
832
+ parks notes in a gutter beside the frame and lays them out automatically — never
833
+ supply x/y or points for anchored notes; hand-placed coordinates fight the
834
+ auto-layout and cause the overlap you're trying to avoid. Reserve arrows for a
835
+ note that must point at a specific control inside a frame; a note that simply
836
+ sits beside its frame needs no arrow.
837
+
838
+ **Patching.** Edit one wireframe, canvas annotation, or block with targeted \`contentPatches\`
839
+ (for example \`update-block\`, \`replace-blocks\`, \`update-canvas-annotation\`) rather
840
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
841
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
842
+ edits. If an agent is working from exported source files, use
843
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
844
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
845
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
846
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
847
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
848
+ In the browser, humans edit \`rich-text\` prose inline; agents should still use
849
+ \`update-rich-text\` content patches or source patches for prose, and use
850
+ comments/structured patches for canvas, artboard, wireframe, and diagram edits.
851
+
852
+ **Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \`html\` wireframe (or reference a wireframe block via \`blockId\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.
853
+
854
+ **Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\`flex:1\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).
855
+
856
+ **Good example — a contacts list, surface \`browser\`.** A small, real screen
857
+ composed from the helper classes and tokens, layout in inline flex, no fonts or
858
+ hex colors:
859
+
860
+ \`\`\`html
861
+ <div style="display:flex;flex-direction:column;gap:12px;padding:16px;height:100%">
862
+ <div style="display:flex;align-items:center;justify-content:space-between">
863
+ <h1>Contacts</h1>
864
+ <button class="primary">New contact</button>
865
+ </div>
866
+ <div style="display:flex;gap:6px">
867
+ <span class="wf-pill accent">All 128</span>
868
+ <span class="wf-pill">Favorites</span>
869
+ <span class="wf-pill">Archived</span>
870
+ </div>
871
+ <div class="wf-card" style="display:flex;flex-direction:column;gap:0;padding:0">
872
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)">
873
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
874
+ <div style="flex:1"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>
875
+ <span class="wf-pill">Lead</span>
876
+ </div>
877
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px">
878
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
879
+ <div style="flex:1"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>
880
+ <span class="wf-pill">Customer</span>
881
+ </div>
882
+ </div>
883
+ </div>
884
+ \`\`\`
885
+
886
+ **Mockups belong on the canvas.** When the user asks for a mockup, UI state,
887
+ loading state, prototype, layout, screen, or visual comparison, make the top
888
+ canvas the primary home for that visual. Document blocks can explain, compare,
889
+ or map implementation, but they should not host the primary mockup just because
890
+ \`custom-html\`, screenshots, or prose are easier to produce. If the canvas cannot
891
+ represent the requested fidelity, still keep a canvas artboard and call out or
892
+ extend the needed canvas renderer capability.
893
+
894
+ **Legacy kit tree.** Older plans set a \`screen\` array of \`{ el, ...props }\` kit
895
+ nodes instead of \`html\`; the renderer still accepts and displays it, but new
896
+ plans emit \`html\`. Do not author fresh kit-tree screens — write the HTML mockup
897
+ instead. Likewise, old or imported plans may carry coordinate-based regions or
898
+ free-float x/y on notes or artboards; those are legacy escape hatches the
899
+ renderer still shows but you must never produce. The \`surface\` drives the aspect
900
+ and footprint, the canvas auto-places artboards, and the gutter parks notes by
901
+ \`targetId\` + \`placement\`; never supply width, height, or coordinates for a new
902
+ plan.
903
+
904
+ <!-- SHARED-CORE:wireframe-canvas END -->
905
+
906
+ <!-- SHARED-CORE:document-quality START -->
907
+
908
+ ## Document Quality Core
909
+
910
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
911
+ \`/visualize-plan\`. It is the single source of truth for the document below the
912
+ canvas. Do not paraphrase it per command.
913
+
914
+ **The document is a serious technical plan, not marketing.** Write it the way a
915
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
916
+ self-contained, and specific. State the objective and what "done" means, the
917
+ scope and non-goals, the proposed approach with the key decisions and their
918
+ rationale, ordered steps that name real files, symbols, actions, and data
919
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
920
+ behavior). Replace vague prose with specifics; never ship a step like "make it
921
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
922
+ landing-page headings, or marketing cards unless the user explicitly asks.
923
+
924
+ **Canvas and document never duplicate each other.** The UI story lives on the
925
+ canvas with on-canvas annotations; the document carries the technical depth the
926
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
927
+ snippets, migration or implementation phases, risks, and validation. Repeat a
928
+ wireframe in the document only for a genuinely new detail view or comparison.
929
+ Skip the canvas entirely for non-visual work and write a clean rich document.
930
+
931
+ **Use the right block, and make it carry substance.** For the authoritative,
932
+ machine-checked list of block types and their data schemas, call \`get-plan-blocks\`
933
+ — it returns the live registry vocabulary (type, MDX tag, placement, key fields)
934
+ so you never emit a block the editor cannot render or round-trip:
935
+
936
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
937
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
938
+ symbols/components to touch, the reason, risk/coordination notes, and a
939
+ concise syntax-highlighted snippet of the code shape — never the whole file,
940
+ never a prose-only file list.
941
+ - \`decision\` for two or three option cards with consequences. These are static
942
+ records; do not style them like clickable tabs or chips unless the renderer
943
+ truly supports changing the selection.
944
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
945
+ relationships, only when it clarifies something real. Labels must not overlap
946
+ nodes, connectors, or each other.
947
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
948
+ only prose usually means the plan is under-specified — include a relevant
949
+ visual unless the tab is intentionally document-only.
950
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
951
+
952
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
953
+ a dedicated open-questions / needs-clarification block. Never put a
954
+ questions/decisions wall inside the plan narrative.
955
+
956
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
957
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a generic
958
+ placeholder, density demo, or proof that custom HTML works. Prefer the native
959
+ blocks for normal plans. It may support supplemental demos or references, but it
960
+ is never the primary home for a requested mockup, UI state, or visual
961
+ comparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the
962
+ product fix is canvas support for that artifact type, not moving the mockup into
963
+ the document.
964
+
965
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
966
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
967
+ unreadable diagrams before asking for approval.
968
+
969
+ <!-- SHARED-CORE:document-quality END -->
970
+
971
+ <!-- SHARED-CORE:exemplar START -->
972
+
973
+ ## Good vs. Bad Exemplar
974
+
975
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard whose
976
+ \`data.html\` is a real flex layout — a sidebar of links (\`Inbox 12\`, \`Today 4\`,
977
+ \`Done\`), a main column with an \`<h1>Today</h1>\`, accent \`.wf-pill\`s for the
978
+ filters, a muted section label \`OVERDUE\`, and \`.wf-card\` task rows carrying real
979
+ titles, due dates, and a primary \`button.primary\` — styled only through bare
980
+ elements, helper classes, and \`--wf-*\` tokens, so the renderer applies the
981
+ correct desktop footprint, theme, and one subtle whole-frame wobble. Plain-text
982
+ designer notes sit spaced off the frame, pointing only at the controls that need
983
+ explanation. Below it, a Claude/Codex-grade document: objective and
984
+ done-criteria, an \`implementation-map\` naming the real components and actions
985
+ with short highlighted snippets, a \`decision\` card weighing two real approaches,
986
+ and a validation step — none of it repeating the canvas. This is the bar.
987
+
988
+ **BAD.** A \`data.html\` with hard-coded hex colors, a \`font-family\`, or fixed
989
+ pixel width/height; gray placeholder bars "insinuating" text on a non-skeleton
990
+ frame; a forced desktop + mobile pair for a popover; floating bordered
991
+ annotation cards hugging the frames; a fresh hand-authored kit-tree \`screen\`
992
+ instead of \`html\`; a mockup escaped into a document \`custom-html\` block; and a
993
+ marketing-style document with a hero heading and value props that just restates
994
+ what the canvas already shows. Never produce this.
995
+
996
+ <!-- SHARED-CORE:exemplar END -->
640
997
 
641
998
  ## Tool Guidance
642
999
 
643
1000
  - \`create-ui-plan\`: create the UI-first structured visual plan.
644
- - \`update-visual-plan\`: revise content blocks, mockups, comments, or handoff notes.
645
- Prefer targeted \`contentPatches\` over regenerating the whole UI plan.
646
- - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and annotations.
1001
+ - \`create-visual-questions\`: use only for the explicit \`/visual-questions\`
1002
+ command, not as \`/ui-plan\` preflight.
1003
+ - \`update-visual-plan\`: revise content, mockups, comments, or handoff notes;
1004
+ prefer targeted \`contentPatches\`.
1005
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
1006
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
1007
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
1008
+ artboard, annotation, component, or wireframe-node id.
1009
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
1010
+ - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and
1011
+ annotations; it also returns the MDX folder for source workflows.
647
1012
  - \`get-plan-feedback\`: read unconsumed reviewer comments before coding.
648
- - \`export-visual-plan\`: export a review receipt when needed.
1013
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
1014
+ files for repo check-in.
1015
+
1016
+ When the user critiques a plan's look or structure, fix the renderer or this
1017
+ skill — never hand-edit one stored plan. Turn feedback into better guidance.
649
1018
 
650
- Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`.
1019
+ ## Setup & Authentication
1020
+
1021
+ There are two ways into Plans.
1022
+
1023
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
1024
+ installs the Plans skills, registers the hosted Plans MCP connector, and
1025
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
1026
+ intended), so the first tool call does not hit an OAuth wall:
1027
+
1028
+ \`\`\`bash
1029
+ agent-native skills add visual-plan
1030
+ \`\`\`
1031
+
1032
+ After that, \`/visual-plan\` (and \`/ui-plan\`, \`/visual-questions\`,
1033
+ \`/visualize-plan\`) generate a plan and open the editor. Pass \`--no-connect\` to
1034
+ register the connector without authenticating, then run
1035
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1036
+
1037
+ **Browser (people you share with).** Open the Plans editor and create & edit
1038
+ with no sign-up — you work as a guest. Sign in only when you want to save or
1039
+ share; signing in claims the plans you made as a guest into your account.
1040
+
1041
+ Sharing and commenting require an account: public/shared plans are viewable by
1042
+ anyone with the link, but commenting on them needs an agent-native account.
1043
+
1044
+ For fully offline, no-account use, run the Plans app locally and sync plans to
1045
+ your repo as MDX. This local mode is a separate advanced path, not the default
1046
+ hosted flow.
1047
+
1048
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
1049
+ do not keep retrying the tool. Authenticate the connector with
1050
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
1051
+ instead re-run /mcp and choose Authenticate), then continue once the connector
1052
+ is available.
1053
+
1054
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
1055
+ not put shared secrets in skill files.
651
1056
  `;
652
- const VISUAL_QUESTIONS_SKILL_MD = `---
1057
+ export const VISUAL_QUESTIONS_SKILL_MD = `---
653
1058
  name: visual-questions
654
1059
  description: >-
655
- Use Agent-Native Plans to ask rich visual intake questions before creating a
656
- UI plan or visual plan.
1060
+ Use Agent-Native Plans to ask rich visual intake questions when
1061
+ /visual-questions is explicitly requested before creating a UI plan or visual
1062
+ plan.
657
1063
  metadata:
658
- visibility: exported
1064
+ visibility: both
659
1065
  ---
660
1066
 
661
1067
  # Visual Questions
662
1068
 
663
1069
  Use \`/visual-questions\` when the next best step is not a plan yet, but a
664
1070
  reviewable visual intake: single-choice chips, multi-select chips, freeform
665
- notes, sketchy mockup choices, sketch diagrams, and a generated answer summary
666
- that feeds the next planning prompt.
667
-
668
- \`/visual-questions\` is the manual override for the automatic preflight that
669
- \`/visual-plan\` may run. Use it when the user explicitly asks for intake first
670
- or when the plan would be materially better after 2-6 visual choices.
1071
+ notes, mockup choices, sketch diagrams, and a generated answer summary that feeds
1072
+ the next planning prompt. It composes with \`/visual-plan\`, \`/ui-plan\`, and
1073
+ \`/visualize-plan\`.
671
1074
 
672
1075
  ## When To Use
673
1076
 
674
1077
  - The user asks to be shown options before the agent writes a plan.
675
- - UI direction, form factor, layout model, feature set, architecture shape,
676
- flow depth, or visual style is still fuzzy enough that 2-6 answers would
677
- materially change the plan.
1078
+ - UI direction, form factor, layout model, feature set, or visual style is fuzzy
1079
+ enough that 2-6 answers would materially change the plan.
678
1080
  - The user would benefit from choosing between visual mockups or diagrams rather
679
- than answering text-only terminal prompts.
680
- - The next flow should be: answer questions -> create UI plan, answer questions
681
- -> create visual plan, answer questions -> update/visualize an existing plan.
1081
+ than answering text-only prompts.
1082
+
1083
+ Gate hard: skip this for tiny, unambiguous changes. If the agent can reasonably
1084
+ infer the answer, prefer \`/ui-plan\` or \`/visual-plan\` directly and put
1085
+ assumptions in the plan.
682
1086
 
683
- Skip this for tiny, unambiguous changes. If the agent can reasonably infer the
684
- answer, prefer \`/visual-plan\` or \`/ui-plan\` directly and put assumptions in
685
- the plan.
1087
+ Visual questions are an explicit intake command, not an automatic preflight for
1088
+ \`/visual-plan\` or \`/ui-plan\`.
686
1089
 
687
1090
  ## Workflow
688
1091
 
689
1092
  1. Call \`create-visual-questions\` with a clear title, brief, source, and repo
690
1093
  path when known.
691
- 2. Omit \`questions\` for the default UI intake. Provide a custom \`questions\`
692
- array only when the task has domain-specific choices.
1094
+ 2. Omit \`questions\` for the default UI intake. Provide a custom \`questions\` array
1095
+ only when the task has domain-specific choices.
693
1096
  3. Surface the returned Plans link and ask the user to answer visually.
694
- 4. The user can click \`Copy prompt\` or \`Send to agent\`; that generated
695
- summary should drive the next step:
696
- - call \`create-ui-plan\` for UI flow plans;
697
- - call \`create-visual-plan\` for general visual plans;
698
- - call \`visualize-plan\` when the user already has a text plan;
699
- - call \`update-visual-plan\` with targeted \`contentPatches\` when the active
700
- plan should absorb answers.
701
- 5. If the user leaves comments on the visual questionnaire, call
702
- \`get-plan-feedback\` before using the answers.
1097
+ 4. The generated summary drives the next step: \`create-ui-plan\` for UI flows,
1098
+ \`create-visual-plan\` for general plans, \`visualize-plan\` when a text plan
1099
+ already exists, or \`update-visual-plan\` with targeted \`contentPatches\` to fold
1100
+ answers into an active plan.
1101
+ 5. If the user leaves comments, call \`get-plan-feedback\` before using the answers.
703
1102
 
704
1103
  ## Question Types
705
1104
 
@@ -708,24 +1107,24 @@ Supported \`questions\` entries:
708
1107
  - \`single\`: chip group where one option wins.
709
1108
  - \`multi\`: chip group where multiple options can be selected.
710
1109
  - \`freeform\`: textarea for constraints, inspirations, or things to avoid.
711
- - \`visual\`: visual options with sketch previews. Use this
712
- for layout direction, flow depth, mobile/desktop choices, or diagram choices.
1110
+ - \`visual\`: visual options with sketch previews use for layout direction, flow
1111
+ depth, surface choice, or diagram choices.
713
1112
 
714
1113
  Each option can include \`label\`, \`value\`, \`description\`, \`recommended\`,
715
- \`preview\`, and \`bullets\`. Valid \`preview\` values are \`desktop\`,
716
- \`mobile\`, \`split\`, \`flow\`, and \`diagram\`.
1114
+ \`preview\`, and \`bullets\`. Valid \`preview\` values match the wireframe surfaces:
1115
+ \`desktop\`, \`mobile\`, \`popover\`, \`panel\`, \`component\`, \`split\`, \`flow\`, and
1116
+ \`diagram\`. Pick the preview that matches the real footprint — do not offer a
1117
+ desktop/mobile pair for a popover, panel, or component.
717
1118
 
718
1119
  ## Quality Bar
719
1120
 
720
- - Ask only decision-changing questions. A beautiful form with low-value
721
- questions is still friction.
1121
+ - Ask only decision-changing questions. A beautiful form with low-value questions
1122
+ is still friction.
722
1123
  - Prefer visible, answerable options over abstract prose.
723
- - Use visual tabs when users need to compare layout/flow shapes.
1124
+ - Use visual tabs when users need to compare layout or flow shapes.
724
1125
  - Keep the output calm and document-like, not a landing page.
725
- - Use native visual-question content. Do not provide a full standalone HTML form
726
- unless importing a legacy artifact.
727
- - The generated answer summary is not the final plan; it is the intake prompt
728
- for the next agent step.
1126
+ - The generated answer summary is not the final plan; it is the intake prompt for
1127
+ the next agent step.
729
1128
 
730
1129
  ## Tool Guidance
731
1130
 
@@ -735,11 +1134,53 @@ Each option can include \`label\`, \`value\`, \`description\`, \`recommended\`,
735
1134
  - \`create-ui-plan\`: create a UI-first plan from the answers.
736
1135
  - \`create-visual-plan\`: create a general visual plan from the answers.
737
1136
  - \`visualize-plan\`: enrich an existing text plan after answers are gathered.
1137
+ - \`export-visual-plan\`: export answer plans as HTML, Markdown fallback,
1138
+ structured JSON, and MDX files when the intake needs to be checked into a repo.
1139
+ - \`read-visual-plan-source\` / \`patch-visual-plan-source\`: inspect or patch the
1140
+ MDX source if another agent is operating from checked-in plan files.
1141
+
1142
+ ## Setup & Authentication
1143
+
1144
+ There are two ways into Plans.
1145
+
1146
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
1147
+ installs the Plans skills, registers the hosted Plans MCP connector, and
1148
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
1149
+ intended), so the first tool call does not hit an OAuth wall:
1150
+
1151
+ \`\`\`bash
1152
+ agent-native skills add visual-plan
1153
+ \`\`\`
1154
+
1155
+ After that, \`/visual-plan\` (and \`/ui-plan\`, \`/visual-questions\`,
1156
+ \`/visualize-plan\`) generate a plan and open the editor. Pass \`--no-connect\` to
1157
+ register the connector without authenticating, then run
1158
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1159
+
1160
+ **Browser (people you share with).** Open the Plans editor and create & edit
1161
+ with no sign-up — you work as a guest. Sign in only when you want to save or
1162
+ share; signing in claims the plans you made as a guest into your account.
1163
+
1164
+ Sharing and commenting require an account: public/shared plans are viewable by
1165
+ anyone with the link, but commenting on them needs an agent-native account.
1166
+
1167
+ For fully offline, no-account use, run the Plans app locally and sync plans to
1168
+ your repo as MDX. This local mode is a separate advanced path, not the default
1169
+ hosted flow.
1170
+
1171
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
1172
+ do not keep retrying the tool. Authenticate the connector with
1173
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
1174
+ instead re-run /mcp and choose Authenticate), then continue once the connector
1175
+ is available.
1176
+
1177
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
1178
+ not put shared secrets in skill files.
738
1179
  `;
739
- const VISUALIZE_PLAN_SKILL_MD = `---
1180
+ export const VISUALIZE_PLAN_SKILL_MD = `---
740
1181
  name: visualize-plan
741
1182
  description: >-
742
- Convert an existing Codex, Claude Code, Markdown, or pasted plan into a
1183
+ Convert an existing Codex, Claude Code, Markdown, or pasted plan into an
743
1184
  Agent-Native Plans visual companion with diagrams, wireframes, annotations, and
744
1185
  feedback.
745
1186
  metadata:
@@ -748,108 +1189,374 @@ metadata:
748
1189
 
749
1190
  # Visualize Plan
750
1191
 
751
- Use this as the visual companion for an existing text plan. The native Codex or
752
- Claude Code plan can stay exactly where it is; Agent-Native Plans turns it into
753
- a structured visual review surface with diagrams, wireframes, prototype options,
754
- annotations, questions, feedback, and an HTML export.
1192
+ Use \`/visualize-plan\` when a plan already exists and the user wants it easier to
1193
+ review. The native Codex or Claude Code plan can stay where it is; Agent-Native
1194
+ Plans creates a structured visual companion beside it diagrams, wireframes,
1195
+ state sketches, option cards, and comment prompts instead of a wall of text. It
1196
+ still reads like a plan, not a marketing page.
755
1197
 
756
- This is for impatient review. Default to things the user can scan and react to.
757
- It should still read like a plan, not a marketing page.
1198
+ ## Plan Discipline
758
1199
 
759
- Install with the Agent-Native CLI if Plans is not already available:
1200
+ - **Gate hard.** A visual companion is worth it only when the source plan is
1201
+ long, risky, or hard to react to as text. If the source plan is for trivial,
1202
+ unambiguous work, skip the companion and just implement.
1203
+ - **Stay grounded and read-only.** Preserve the source plan's intent, do not
1204
+ invent codebase facts, and label anything inferred as inferred. Make no source
1205
+ edits while building or reviewing the companion.
1206
+ - **The companion is the approval gate.** Ask the user to review and approve the
1207
+ direction before you write code, and name which files/areas the work touches.
1208
+ Carry unresolved assumptions and open questions into a clear block instead of
1209
+ guessing silently.
760
1210
 
761
- \`\`\`bash
762
- npx @agent-native/core@latest skills add visual-plan
1211
+ ## Workflow
1212
+
1213
+ 1. Gather the existing plan text from the user's paste, a referenced file, or
1214
+ recent visible agent context. Do not invent the source plan. If no plan text
1215
+ exists and the work is UI-heavy, use \`/ui-plan\` instead.
1216
+ 2. Call \`visualize-plan\` with \`planText\`, \`title\`, \`brief\`, \`source\`, and
1217
+ \`repoPath\` when available.
1218
+ 3. Surface the returned Plans link or inline MCP App.
1219
+ 4. Enrich the import with \`update-visual-plan\` (prefer targeted \`contentPatches\`):
1220
+ add a canvas with wireframes for user-visible UI, diagrams for architecture or
1221
+ data flow, option cards for real tradeoffs, and explicit open questions. Apply
1222
+ the two cores below — the companion must meet the same quality bar as a fresh
1223
+ plan, not be a thinner ruleset. Label inferred visuals as inferred. When the
1224
+ user wants source-control friendly edits, use \`patch-visual-plan-source\`
1225
+ against the MDX files instead of regenerating the plan.
1226
+ 5. Ask the user to react, then call \`get-plan-feedback\` before implementing,
1227
+ after review, and before the final response.
1228
+ 6. Treat imported text as source material. The structured visual plan and
1229
+ comments are the review surface; HTML is the export receipt. Do not replace a
1230
+ native plan unless the user asks.
1231
+
1232
+ <!-- SHARED-CORE:wireframe-canvas START -->
1233
+
1234
+ ## Wireframe & Canvas Core
1235
+
1236
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
1237
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
1238
+ canvas work. Do not paraphrase it per command.
1239
+
1240
+ **A wireframe is an HTML mockup. The renderer owns the look; you write the
1241
+ content.** Set \`data.html\` to a self-contained, semantic HTML fragment of the
1242
+ screen and set \`data.surface\`. The renderer owns the surface footprint/aspect,
1243
+ the dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you
1244
+ never write \`<html>\`/\`<body>\`/\`<script>\`/\`<style>\` tags, font-family, hex colors,
1245
+ or any width/height/coordinates. You write real HTML layout and real product
1246
+ content; the renderer styles and roughens it.
1247
+
1248
+ **A wireframe block's data is an HTML screen plus a surface:**
1249
+
1250
+ \`\`\`json
1251
+ {
1252
+ "surface": "browser",
1253
+ "html": "<div style=\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\"><h1>Sign in</h1><p class=\\"wf-muted\\">Use your work email to continue.</p><div class=\\"wf-card\\" style=\\"display:flex;flex-direction:column;gap:10px\\"><label>Email<input value=\\"jane@acme.co\\" /></label><label>Password<input value=\\"••••••••\\" /></label><label style=\\"display:flex;align-items:center;gap:8px\\"><input type=\\"checkbox\\" checked /> Remember me</label><button class=\\"primary\\">Sign in</button></div><a href=\\"#\\">Forgot password?</a></div>"
1254
+ }
763
1255
  \`\`\`
764
1256
 
765
- That installs \`/visual-plan\`, \`/visual-questions\`, \`/ui-plan\`, and
766
- \`/visualize-plan\` plus the MCP connector.
1257
+ **Write PLAIN semantic HTML and let the renderer style it.** Bare elements
1258
+ (\`h1\`/\`h2\`/\`h3\`, \`p\`, \`button\`, \`input\`, \`<input type="checkbox">\`, \`a\`, \`hr\`)
1259
+ are auto-themed — no classes needed. Helper classes carry the rest:
1260
+
1261
+ - \`.wf-card\` / \`.wf-box\` — a bordered, padded container (a panel, a list item).
1262
+ - \`.wf-pill\` / \`.wf-chip\` — a rounded tag or filter; add \`.accent\`
1263
+ (\`<span class="wf-pill accent">\`) for the accent-filled variant.
1264
+ - \`.wf-muted\` — secondary/muted text (or use \`<small>\`).
1265
+ - \`button.primary\` or any element with \`[data-primary]\` — the accent-filled
1266
+ primary button.
1267
+
1268
+ **Use the \`--wf-*\` tokens for any custom color, never hex.** The renderer flips
1269
+ these on light/dark, so reading them is what keeps a mockup correct in both
1270
+ themes. For any inline border, background, or text color, reference a token:
1271
+ \`style="border:1.4px solid var(--wf-line)"\`. The tokens are \`--wf-ink\` (text),
1272
+ \`--wf-muted\` (secondary text), \`--wf-line\` (borders/dividers), \`--wf-paper\`
1273
+ (page background), \`--wf-card\` (raised surface), \`--wf-accent\` /
1274
+ \`--wf-accent-fg\` / \`--wf-accent-soft\` (brand action), \`--wf-warn\`, \`--wf-ok\`,
1275
+ and \`--wf-radius\`. Never hard-code a hex color and never set \`font-family\` — the
1276
+ renderer owns the sketch/clean font.
1277
+
1278
+ **Lay out with inline \`style\` flex/grid.** You write the real layout —
1279
+ \`display:flex; flex-direction:column; gap:10px; padding:16px\` and so on — and the
1280
+ renderer never repositions anything. Compose the actual product: reproduce the
1281
+ current screen, then show the modification. Real labels, real counts, real dates,
1282
+ real button text grounded in the screen you read; not lorem or gray bars.
1283
+
1284
+ **Surface presets — match the real footprint, never default to desktop+mobile.**
1285
+ Pick the \`surface\` that matches what the user will actually see:
1286
+
1287
+ - \`browser\`: a web page that needs a browser chrome frame around it.
1288
+ - \`desktop\`: a full desktop app page or app shell.
1289
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
1290
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
1291
+ - \`panel\`: a side panel, inspector, or sidebar widget.
1292
+
1293
+ The surface locks the footprint and aspect; never set width/height/coordinates.
1294
+ A sidebar popover renders as a small surface, not a desktop page and a phone
1295
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
1296
+ actually changes the layout. For a component or widget, show one broader
1297
+ app-context frame only when placement affects understanding, then the focused
1298
+ component states.
1299
+
1300
+ **Modify, don't redesign.** When the task changes an existing screen, reproduce
1301
+ the current screen's real layout and footprint FIRST, then change only the delta
1302
+ and call it out with a single annotation. Do not restack the page into a new
1303
+ layout. For net-new surfaces, compose from the real app shell.
1304
+
1305
+ **Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a
1306
+ popover, menu, dialog, toast), show the full screen once, then add a small
1307
+ separate artboard whose \`html\` contains ONLY that sub-surface — do not re-draw
1308
+ the whole page around it, and do not scale a duplicate up. Pick the matching
1309
+ \`surface\` (e.g. \`popover\`) so the footprint is right; never widen a popover to
1310
+ page width.
1311
+
1312
+ **Loading / skeleton states.** Set \`data.skeleton: true\` on the wireframe and
1313
+ fill the \`html\` with neutral, textless placeholder geometry — boxes and bars
1314
+ built as \`<div>\`s with \`background:var(--wf-line)\` and explicit heights/widths,
1315
+ no labels or copy. The renderer drops borders, sketch, and color into the
1316
+ skeleton register automatically. Never escape to a \`custom-html\` document block
1317
+ to fake a loader, and never move a mockup out of the canvas — mockups always
1318
+ live in canvas artboards.
1319
+
1320
+ **Editing an existing mockup.** To change one element, text, or color in an
1321
+ existing html mockup, do NOT regenerate the frame — call \`update-visual-plan\`
1322
+ with \`contentPatches: [{ op: "patch-wireframe-html", blockId, edits: [{ find,
1323
+ replace }] }]\`. Each \`find\` is a unique snippet of the current html (read it
1324
+ first with \`get-visual-plan\`); set \`all: true\` on an edit to replace every
1325
+ occurrence. The result is re-sanitized.
1326
+
1327
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
1328
+ present, sprinkle Figma-style notes near the frames they explain: a short
1329
+ heading, supporting text, and bullets — plain text layers, never bordered or
1330
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
1331
+ from frames, so place each note by the frame it describes. Use an arrow only to
1332
+ point at one specific control or transition; for a broad frame-level note, write
1333
+ text beside the frame with no connector. Connectors are for real sequences only —
1334
+ never fake "Step 1 → Step 2" lines between independent states.
1335
+
1336
+ **Do not create overlapping annotations.** Anchor each note to the frame it
1337
+ explains with \`targetId\` + \`placement\` (top/right/bottom/left). The renderer
1338
+ parks notes in a gutter beside the frame and lays them out automatically — never
1339
+ supply x/y or points for anchored notes; hand-placed coordinates fight the
1340
+ auto-layout and cause the overlap you're trying to avoid. Reserve arrows for a
1341
+ note that must point at a specific control inside a frame; a note that simply
1342
+ sits beside its frame needs no arrow.
1343
+
1344
+ **Patching.** Edit one wireframe, canvas annotation, or block with targeted \`contentPatches\`
1345
+ (for example \`update-block\`, \`replace-blocks\`, \`update-canvas-annotation\`) rather
1346
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
1347
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
1348
+ edits. If an agent is working from exported source files, use
1349
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
1350
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
1351
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
1352
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
1353
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
1354
+ In the browser, humans edit \`rich-text\` prose inline; agents should still use
1355
+ \`update-rich-text\` content patches or source patches for prose, and use
1356
+ comments/structured patches for canvas, artboard, wireframe, and diagram edits.
1357
+
1358
+ **Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \`html\` wireframe (or reference a wireframe block via \`blockId\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.
1359
+
1360
+ **Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\`flex:1\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).
1361
+
1362
+ **Good example — a contacts list, surface \`browser\`.** A small, real screen
1363
+ composed from the helper classes and tokens, layout in inline flex, no fonts or
1364
+ hex colors:
1365
+
1366
+ \`\`\`html
1367
+ <div style="display:flex;flex-direction:column;gap:12px;padding:16px;height:100%">
1368
+ <div style="display:flex;align-items:center;justify-content:space-between">
1369
+ <h1>Contacts</h1>
1370
+ <button class="primary">New contact</button>
1371
+ </div>
1372
+ <div style="display:flex;gap:6px">
1373
+ <span class="wf-pill accent">All 128</span>
1374
+ <span class="wf-pill">Favorites</span>
1375
+ <span class="wf-pill">Archived</span>
1376
+ </div>
1377
+ <div class="wf-card" style="display:flex;flex-direction:column;gap:0;padding:0">
1378
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)">
1379
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
1380
+ <div style="flex:1"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>
1381
+ <span class="wf-pill">Lead</span>
1382
+ </div>
1383
+ <div style="display:flex;align-items:center;gap:10px;padding:10px 12px">
1384
+ <div style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"></div>
1385
+ <div style="flex:1"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>
1386
+ <span class="wf-pill">Customer</span>
1387
+ </div>
1388
+ </div>
1389
+ </div>
1390
+ \`\`\`
767
1391
 
768
- ## When To Use
1392
+ **Mockups belong on the canvas.** When the user asks for a mockup, UI state,
1393
+ loading state, prototype, layout, screen, or visual comparison, make the top
1394
+ canvas the primary home for that visual. Document blocks can explain, compare,
1395
+ or map implementation, but they should not host the primary mockup just because
1396
+ \`custom-html\`, screenshots, or prose are easier to produce. If the canvas cannot
1397
+ represent the requested fidelity, still keep a canvas artboard and call out or
1398
+ extend the needed canvas renderer capability.
1399
+
1400
+ **Legacy kit tree.** Older plans set a \`screen\` array of \`{ el, ...props }\` kit
1401
+ nodes instead of \`html\`; the renderer still accepts and displays it, but new
1402
+ plans emit \`html\`. Do not author fresh kit-tree screens — write the HTML mockup
1403
+ instead. Likewise, old or imported plans may carry coordinate-based regions or
1404
+ free-float x/y on notes or artboards; those are legacy escape hatches the
1405
+ renderer still shows but you must never produce. The \`surface\` drives the aspect
1406
+ and footprint, the canvas auto-places artboards, and the gutter parks notes by
1407
+ \`targetId\` + \`placement\`; never supply width, height, or coordinates for a new
1408
+ plan.
1409
+
1410
+ <!-- SHARED-CORE:wireframe-canvas END -->
1411
+
1412
+ <!-- SHARED-CORE:document-quality START -->
1413
+
1414
+ ## Document Quality Core
1415
+
1416
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
1417
+ \`/visualize-plan\`. It is the single source of truth for the document below the
1418
+ canvas. Do not paraphrase it per command.
1419
+
1420
+ **The document is a serious technical plan, not marketing.** Write it the way a
1421
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
1422
+ self-contained, and specific. State the objective and what "done" means, the
1423
+ scope and non-goals, the proposed approach with the key decisions and their
1424
+ rationale, ordered steps that name real files, symbols, actions, and data
1425
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
1426
+ behavior). Replace vague prose with specifics; never ship a step like "make it
1427
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
1428
+ landing-page headings, or marketing cards unless the user explicitly asks.
1429
+
1430
+ **Canvas and document never duplicate each other.** The UI story lives on the
1431
+ canvas with on-canvas annotations; the document carries the technical depth the
1432
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
1433
+ snippets, migration or implementation phases, risks, and validation. Repeat a
1434
+ wireframe in the document only for a genuinely new detail view or comparison.
1435
+ Skip the canvas entirely for non-visual work and write a clean rich document.
1436
+
1437
+ **Use the right block, and make it carry substance.** For the authoritative,
1438
+ machine-checked list of block types and their data schemas, call \`get-plan-blocks\`
1439
+ — it returns the live registry vocabulary (type, MDX tag, placement, key fields)
1440
+ so you never emit a block the editor cannot render or round-trip:
1441
+
1442
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
1443
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
1444
+ symbols/components to touch, the reason, risk/coordination notes, and a
1445
+ concise syntax-highlighted snippet of the code shape — never the whole file,
1446
+ never a prose-only file list.
1447
+ - \`decision\` for two or three option cards with consequences. These are static
1448
+ records; do not style them like clickable tabs or chips unless the renderer
1449
+ truly supports changing the selection.
1450
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
1451
+ relationships, only when it clarifies something real. Labels must not overlap
1452
+ nodes, connectors, or each other.
1453
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
1454
+ only prose usually means the plan is under-specified — include a relevant
1455
+ visual unless the tab is intentionally document-only.
1456
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
1457
+
1458
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
1459
+ a dedicated open-questions / needs-clarification block. Never put a
1460
+ questions/decisions wall inside the plan narrative.
1461
+
1462
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
1463
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a generic
1464
+ placeholder, density demo, or proof that custom HTML works. Prefer the native
1465
+ blocks for normal plans. It may support supplemental demos or references, but it
1466
+ is never the primary home for a requested mockup, UI state, or visual
1467
+ comparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the
1468
+ product fix is canvas support for that artifact type, not moving the mockup into
1469
+ the document.
1470
+
1471
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
1472
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
1473
+ unreadable diagrams before asking for approval.
1474
+
1475
+ <!-- SHARED-CORE:document-quality END -->
1476
+
1477
+ <!-- SHARED-CORE:exemplar START -->
1478
+
1479
+ ## Good vs. Bad Exemplar
1480
+
1481
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard whose
1482
+ \`data.html\` is a real flex layout — a sidebar of links (\`Inbox 12\`, \`Today 4\`,
1483
+ \`Done\`), a main column with an \`<h1>Today</h1>\`, accent \`.wf-pill\`s for the
1484
+ filters, a muted section label \`OVERDUE\`, and \`.wf-card\` task rows carrying real
1485
+ titles, due dates, and a primary \`button.primary\` — styled only through bare
1486
+ elements, helper classes, and \`--wf-*\` tokens, so the renderer applies the
1487
+ correct desktop footprint, theme, and one subtle whole-frame wobble. Plain-text
1488
+ designer notes sit spaced off the frame, pointing only at the controls that need
1489
+ explanation. Below it, a Claude/Codex-grade document: objective and
1490
+ done-criteria, an \`implementation-map\` naming the real components and actions
1491
+ with short highlighted snippets, a \`decision\` card weighing two real approaches,
1492
+ and a validation step — none of it repeating the canvas. This is the bar.
1493
+
1494
+ **BAD.** A \`data.html\` with hard-coded hex colors, a \`font-family\`, or fixed
1495
+ pixel width/height; gray placeholder bars "insinuating" text on a non-skeleton
1496
+ frame; a forced desktop + mobile pair for a popover; floating bordered
1497
+ annotation cards hugging the frames; a fresh hand-authored kit-tree \`screen\`
1498
+ instead of \`html\`; a mockup escaped into a document \`custom-html\` block; and a
1499
+ marketing-style document with a hero heading and value props that just restates
1500
+ what the canvas already shows. Never produce this.
1501
+
1502
+ <!-- SHARED-CORE:exemplar END -->
769
1503
 
770
- Use \`visualize-plan\` when:
1504
+ ## Tool Guidance
771
1505
 
772
- - the user has an existing Codex, Claude Code, Markdown, or pasted plan;
773
- - the user asks to visualize, annotate, plannotate, mock up, diagram, or make a
774
- plan easier to review;
775
- - the plan is long enough that the user may not read it closely;
776
- - UI direction, architecture, data flow, risky assumptions, or open questions
777
- would be clearer visually;
778
- - the user wants feedback on wireframes, design/prototype options, diagrams, or
779
- tradeoffs before implementation.
1506
+ - \`visualize-plan\`: create the visual companion from the existing text plan.
1507
+ - \`update-visual-plan\`: enrich the import; prefer targeted \`contentPatches\` over
1508
+ replacing the whole content.
1509
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
1510
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
1511
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
1512
+ artboard, annotation, component, or wireframe-node id.
1513
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
1514
+ - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and
1515
+ annotations; it also returns the MDX folder for source workflows.
1516
+ - \`get-plan-feedback\`: read unconsumed reviewer comments before coding.
1517
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
1518
+ files for repo check-in.
780
1519
 
781
- If there is no existing plan text available, ask for it, use \`visual-plan\`
782
- to create a fresh general plan, or use \`ui-plan\` when the work is UI-heavy and
783
- should start with high-fidelity state mockups.
1520
+ When the user critiques a plan's look or structure, fix the renderer or this
1521
+ skill never hand-edit one stored plan. Turn feedback into better guidance.
784
1522
 
785
- ## Plan Discipline
1523
+ ## Setup & Authentication
786
1524
 
787
- - **Right-size first.** If the source plan is for trivial, unambiguous work,
788
- skip the companion and just implement. A visual companion is worth it only
789
- when the plan is long, risky, or hard to react to as text.
790
- - **Stay grounded and read-only.** Preserve the source plan's intent, do not
791
- invent codebase facts, and label anything inferred as inferred. Make no source
792
- edits while building or reviewing the companion.
793
- - **The companion is the approval gate.** Ask the user to review and approve the
794
- direction before you write any code, and name which files/areas the work will
795
- touch. Carry unresolved assumptions and open questions into a clear block
796
- instead of guessing silently.
1525
+ There are two ways into Plans.
797
1526
 
798
- ## Workflow
1527
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
1528
+ installs the Plans skills, registers the hosted Plans MCP connector, and
1529
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
1530
+ intended), so the first tool call does not hit an OAuth wall:
799
1531
 
800
- 1. Gather the existing plan text from the user's paste, a referenced file, or
801
- the recent agent-visible plan. Do not invent a source plan.
802
- 2. Call \`visualize-plan\` with \`planText\`, \`title\`, \`goal\`, \`source\`,
803
- and \`repoPath\` when available.
804
- 3. Surface the returned Plans link or inline MCP App.
805
- 4. Enrich the imported plan with \`update-visual-plan\` when helpful:
806
- - diagrams for architecture, data flow, state machines, or dependencies;
807
- - detailed wireframes/mockups for user-visible UI changes, including layout,
808
- controls, states, empty/loading/error paths, and copy placeholders;
809
- - two or three option cards when there are real tradeoffs;
810
- - small prototype sketches for interactions, states, or animation choices;
811
- - reviewable assumptions and open questions;
812
- Prefer targeted \`contentPatches\` for small edits to one imported block,
813
- wireframe region, diagram, or implementation map instead of replacing the
814
- whole plan content.
815
- 5. Ask the user to react in the visual plan. Then call \`get-plan-feedback\`
816
- before implementing, after review, and before final response.
817
- 6. Treat the imported text as source material. Structured Plans state is
818
- canonical for feedback, assumptions, and decisions.
819
-
820
- If there is no existing plan text and the work is UI-heavy, use \`/ui-plan\`
821
- instead so full-width state mockups, comments/drawing affordances, and agent
822
- handoff come before file implementation details.
823
-
824
- ## Visual Defaults
825
-
826
- - Keep the first screen simple and plan-like: title, brief, concise scope, and
827
- one useful diagram/checklist/table when it helps.
828
- - Prefer one strong diagram or wireframe over a wall of sections.
829
- - Preserve the source plan's implementation substance: phases or steps,
830
- files/symbols/snippets, risks, open questions, and validation.
831
- - Hide long prose behind disclosure controls or source references when it helps
832
- review speed.
833
- - Add README-like detail when the source is too terse: slash commands, tool
834
- behavior, install flow, MCP/link fallback, data shape, and scope.
835
- - Avoid decorative hero art, gradient/hero backgrounds, logos, nav bars,
836
- slogans, fluffy value props, huge landing-page H1s, and marketing-style cards
837
- unless the user explicitly asks.
838
- - Visuals should be review aids, not decoration.
839
- - Label inferred items as possible, not confirmed.
840
- - Ask for feedback with targeted prompts: "Which option?", "Is this flow
841
- right?", "What assumption is wrong?", "What should change?"
842
- - Preserve native-agent momentum: this companion should make the plan easier to
843
- approve or revise, not force a giant planning ceremony.
844
-
845
- ## Guardrails
846
-
847
- - Do not replace a native plan unless the user asks. Build beside it.
848
- - Do not pretend the companion has feedback until \`get-plan-feedback\` returns
849
- it or the user pastes it back.
850
- - Do not use visual polish as a substitute for clarity. The point is review.
851
- - Do not hand-roll MCP HTTP requests with curl. Use host-exposed tools after
852
- restart/reload, or use the returned browser/deep-link fallback.
1532
+ \`\`\`bash
1533
+ agent-native skills add visual-plan
1534
+ \`\`\`
1535
+
1536
+ After that, \`/visual-plan\` (and \`/ui-plan\`, \`/visual-questions\`,
1537
+ \`/visualize-plan\`) generate a plan and open the editor. Pass \`--no-connect\` to
1538
+ register the connector without authenticating, then run
1539
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1540
+
1541
+ **Browser (people you share with).** Open the Plans editor and create & edit
1542
+ with no sign-up you work as a guest. Sign in only when you want to save or
1543
+ share; signing in claims the plans you made as a guest into your account.
1544
+
1545
+ Sharing and commenting require an account: public/shared plans are viewable by
1546
+ anyone with the link, but commenting on them needs an agent-native account.
1547
+
1548
+ For fully offline, no-account use, run the Plans app locally and sync plans to
1549
+ your repo as MDX. This local mode is a separate advanced path, not the default
1550
+ hosted flow.
1551
+
1552
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
1553
+ do not keep retrying the tool. Authenticate the connector with
1554
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
1555
+ instead re-run /mcp and choose Authenticate), then continue once the connector
1556
+ is available.
1557
+
1558
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
1559
+ not put shared secrets in skill files.
853
1560
  `;
854
1561
  const BUILT_IN_APP_SKILLS = {
855
1562
  assets: {
@@ -1266,6 +1973,7 @@ export function parseSkillsArgs(argv) {
1266
1973
  printJson: false,
1267
1974
  instructions: true,
1268
1975
  mcp: true,
1976
+ connect: true,
1269
1977
  };
1270
1978
  for (let i = 0; i < args.length; i++) {
1271
1979
  const arg = args[i];
@@ -1304,6 +2012,8 @@ export function parseSkillsArgs(argv) {
1304
2012
  out.instructions = false;
1305
2013
  else if (arg === "--instructions-only" || arg === "--no-mcp")
1306
2014
  out.mcp = false;
2015
+ else if (arg === "--no-connect" || arg === "--skip-connect")
2016
+ out.connect = false;
1307
2017
  else if (arg.startsWith("-"))
1308
2018
  throw new Error(`Unknown option: ${arg}`);
1309
2019
  else if (!out.target)
@@ -1434,6 +2144,8 @@ function dryRunInstallCommand(parsed, target) {
1434
2144
  args.push("--instructions-only");
1435
2145
  if (!parsed.instructions && parsed.mcp)
1436
2146
  args.push("--mcp-only");
2147
+ if (!parsed.connect)
2148
+ args.push("--no-connect");
1437
2149
  if (parsed.yes || isKnownSkill(target))
1438
2150
  args.push("--yes");
1439
2151
  return commandString("agent-native", args);
@@ -1507,6 +2219,72 @@ function withMcpUrlOverride(target, input) {
1507
2219
  },
1508
2220
  };
1509
2221
  }
2222
+ /**
2223
+ * Whether we can run the interactive browser/device auth flow. CI and
2224
+ * non-TTY shells must not block on a browser approval, so we skip the inline
2225
+ * flow there and surface the exact `agent-native connect` command instead.
2226
+ */
2227
+ function canRunInteractiveConnect(options) {
2228
+ if (options.isInteractive)
2229
+ return options.isInteractive();
2230
+ if (process.env.AGENT_NATIVE_NO_PROMPT === "1")
2231
+ return false;
2232
+ if (process.env.CI === "true")
2233
+ return false;
2234
+ return !!process.stdin.isTTY && !!process.stdout.isTTY;
2235
+ }
2236
+ /** Build the `agent-native connect <url> --client … --scope …` command. */
2237
+ function connectCommandFor(hostedUrl, clients, scope) {
2238
+ const args = [
2239
+ "connect",
2240
+ hostedUrl,
2241
+ "--client",
2242
+ clientArgForClients(clients),
2243
+ "--scope",
2244
+ scope,
2245
+ ];
2246
+ return commandString("agent-native", args);
2247
+ }
2248
+ /**
2249
+ * Authenticate the freshly-registered hosted MCP connector so the user does not
2250
+ * hit the OAuth wall on their first tool call. Reuses the existing
2251
+ * `agent-native connect` flow (OAuth-capable clients get URL-only config plus a
2252
+ * `/mcp` authenticate prompt; Codex / Cowork run the browser device-code flow).
2253
+ * In non-interactive shells we skip the inline flow and return the command to
2254
+ * run instead. Failures here are non-fatal: the connector is already registered,
2255
+ * so the user can authenticate later.
2256
+ */
2257
+ async function connectAfterEnsure(installTarget, clients, parsed, options) {
2258
+ const hostedUrl = installTarget.loaded.manifest.hosted.url;
2259
+ const authMode = installTarget.loaded.manifest.auth?.mode ?? "oauth";
2260
+ const connectCommand = connectCommandFor(hostedUrl, clients, parsed.scope);
2261
+ // Skills whose connector needs no auth (e.g. open/local-only) never need the
2262
+ // connect step.
2263
+ if (authMode === "none") {
2264
+ return { connected: false, connectCommand: "" };
2265
+ }
2266
+ if (!canRunInteractiveConnect(options)) {
2267
+ options.log?.(`Authentication skipped (non-interactive). To finish auth, run: ${connectCommand}`);
2268
+ return { connected: false, connectCommand };
2269
+ }
2270
+ options.log?.(`Authenticating ${installTarget.displayName}…`);
2271
+ try {
2272
+ await (options.runConnect ?? runConnect)([
2273
+ hostedUrl,
2274
+ "--client",
2275
+ clientArgForClients(clients),
2276
+ "--scope",
2277
+ parsed.scope,
2278
+ ]);
2279
+ return { connected: true, connectCommand: "" };
2280
+ }
2281
+ catch (err) {
2282
+ // Non-fatal: the MCP connector is registered. Surface the manual command.
2283
+ options.log?.(`Could not finish authentication automatically (${err?.message ?? err}). ` +
2284
+ `Run it later with: ${connectCommand}`);
2285
+ return { connected: false, connectCommand };
2286
+ }
2287
+ }
1510
2288
  export async function addAgentNativeSkill(parsed, options = {}) {
1511
2289
  const target = parsed.target ?? "assets";
1512
2290
  const knownTarget = normalizeKnownSkillTarget(target);
@@ -1583,6 +2361,8 @@ export async function addAgentNativeSkill(parsed, options = {}) {
1583
2361
  const commands = [];
1584
2362
  const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), "an-skills-add-"));
1585
2363
  let instructionSource;
2364
+ let connected = false;
2365
+ let connectCommand;
1586
2366
  try {
1587
2367
  if (parsed.instructions) {
1588
2368
  if (skillsAgents.length === 0) {
@@ -1624,6 +2404,17 @@ export async function addAgentNativeSkill(parsed, options = {}) {
1624
2404
  confirm: true,
1625
2405
  log: options.log,
1626
2406
  });
2407
+ // One-step install + authenticate: after registering a hosted MCP
2408
+ // connector, kick off the existing connect/device-code flow so the user
2409
+ // does not hit an OAuth wall on the first tool call. `--no-connect`
2410
+ // opts out; non-interactive shells get the exact command to run.
2411
+ if (parsed.connect) {
2412
+ const result = await connectAfterEnsure(installTarget, clients, parsed, options);
2413
+ connected = result.connected;
2414
+ connectCommand = result.connectCommand || undefined;
2415
+ if (connectCommand)
2416
+ commands.push(connectCommand);
2417
+ }
1627
2418
  }
1628
2419
  }
1629
2420
  return {
@@ -1636,6 +2427,8 @@ export async function addAgentNativeSkill(parsed, options = {}) {
1636
2427
  mcpClients: clients,
1637
2428
  dryRun: parsed.dryRun,
1638
2429
  commands,
2430
+ connected,
2431
+ connectCommand,
1639
2432
  };
1640
2433
  }
1641
2434
  finally {
@@ -1719,6 +2512,17 @@ export async function runSkills(argv, options = {}) {
1719
2512
  .filter((result) => result.local)
1720
2513
  .flatMap((result) => result.commands)),
1721
2514
  ];
2515
+ const authConnected = results.some((result) => result.connected);
2516
+ const pendingConnectCommands = [
2517
+ ...new Set(results
2518
+ .map((result) => result.connectCommand)
2519
+ .filter((command) => Boolean(command))),
2520
+ ];
2521
+ const authLine = authConnected
2522
+ ? "Authentication: completed."
2523
+ : pendingConnectCommands.length
2524
+ ? `Authentication: pending — run ${pendingConnectCommands.join(" && ")}`
2525
+ : "";
1722
2526
  process.stdout.write([
1723
2527
  `Installed ${installedNames} skill${results.length === 1 ? "" : "s"}.`,
1724
2528
  skillsAgents.length
@@ -1730,6 +2534,7 @@ export async function runSkills(argv, options = {}) {
1730
2534
  mcpUrls.length
1731
2535
  ? `MCP URL${mcpUrls.length === 1 ? "" : "s"}: ${mcpUrls.join(", ")}.`
1732
2536
  : "",
2537
+ authLine,
1733
2538
  localCommands.length ? `Local command: ${localCommands.join(", ")}.` : "",
1734
2539
  "Restart or reload selected agent clients if the skill is not visible yet.",
1735
2540
  parsed.clientExplicit