@agent-native/core 0.39.2 → 0.40.1

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 (154) hide show
  1. package/README.md +1 -1
  2. package/dist/action.js +12 -0
  3. package/dist/action.js.map +1 -1
  4. package/dist/cli/create.d.ts.map +1 -1
  5. package/dist/cli/create.js +5 -1
  6. package/dist/cli/create.js.map +1 -1
  7. package/dist/cli/skills.d.ts +4 -3
  8. package/dist/cli/skills.d.ts.map +1 -1
  9. package/dist/cli/skills.js +756 -694
  10. package/dist/cli/skills.js.map +1 -1
  11. package/dist/client/blocks/AiEditableField.d.ts +8 -0
  12. package/dist/client/blocks/AiEditableField.d.ts.map +1 -0
  13. package/dist/client/blocks/AiEditableField.js +10 -0
  14. package/dist/client/blocks/AiEditableField.js.map +1 -0
  15. package/dist/client/blocks/BlockView.d.ts +3 -3
  16. package/dist/client/blocks/BlockView.d.ts.map +1 -1
  17. package/dist/client/blocks/BlockView.js +15 -3
  18. package/dist/client/blocks/BlockView.js.map +1 -1
  19. package/dist/client/blocks/SchemaBlockEditor.js +2 -2
  20. package/dist/client/blocks/SchemaBlockEditor.js.map +1 -1
  21. package/dist/client/blocks/index.d.ts +5 -2
  22. package/dist/client/blocks/index.d.ts.map +1 -1
  23. package/dist/client/blocks/index.js +6 -3
  24. package/dist/client/blocks/index.js.map +1 -1
  25. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
  26. package/dist/client/blocks/library/ApiEndpointBlock.js +20 -6
  27. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
  28. package/dist/client/blocks/library/DiffBlock.d.ts +29 -0
  29. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  30. package/dist/client/blocks/library/DiffBlock.js +190 -30
  31. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  32. package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -1
  33. package/dist/client/blocks/library/FileTreeBlock.js +46 -7
  34. package/dist/client/blocks/library/FileTreeBlock.js.map +1 -1
  35. package/dist/client/blocks/library/HighlightedCode.d.ts +10 -0
  36. package/dist/client/blocks/library/HighlightedCode.d.ts.map +1 -0
  37. package/dist/client/blocks/library/HighlightedCode.js +92 -0
  38. package/dist/client/blocks/library/HighlightedCode.js.map +1 -0
  39. package/dist/client/blocks/library/JsonExplorerBlock.d.ts +9 -4
  40. package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -1
  41. package/dist/client/blocks/library/JsonExplorerBlock.js +66 -30
  42. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -1
  43. package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -1
  44. package/dist/client/blocks/library/MermaidBlock.js +73 -44
  45. package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
  46. package/dist/client/blocks/library/OpenApiSpecBlock.d.ts.map +1 -1
  47. package/dist/client/blocks/library/OpenApiSpecBlock.js +3 -2
  48. package/dist/client/blocks/library/OpenApiSpecBlock.js.map +1 -1
  49. package/dist/client/blocks/library/checklist.d.ts.map +1 -1
  50. package/dist/client/blocks/library/checklist.js +1 -0
  51. package/dist/client/blocks/library/checklist.js.map +1 -1
  52. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -1
  53. package/dist/client/blocks/library/code-tabs.js +183 -102
  54. package/dist/client/blocks/library/code-tabs.js.map +1 -1
  55. package/dist/client/blocks/library/columns.config.d.ts +60 -0
  56. package/dist/client/blocks/library/columns.config.d.ts.map +1 -0
  57. package/dist/client/blocks/library/columns.config.js +37 -0
  58. package/dist/client/blocks/library/columns.config.js.map +1 -0
  59. package/dist/client/blocks/library/columns.d.ts +25 -0
  60. package/dist/client/blocks/library/columns.d.ts.map +1 -0
  61. package/dist/client/blocks/library/columns.js +199 -0
  62. package/dist/client/blocks/library/columns.js.map +1 -0
  63. package/dist/client/blocks/library/dev-doc-ui.d.ts +2 -1
  64. package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -1
  65. package/dist/client/blocks/library/dev-doc-ui.js +2 -1
  66. package/dist/client/blocks/library/dev-doc-ui.js.map +1 -1
  67. package/dist/client/blocks/library/html.d.ts +1 -1
  68. package/dist/client/blocks/library/html.d.ts.map +1 -1
  69. package/dist/client/blocks/library/html.js +34 -4
  70. package/dist/client/blocks/library/html.js.map +1 -1
  71. package/dist/client/blocks/library/json-explorer.config.d.ts +3 -1
  72. package/dist/client/blocks/library/json-explorer.config.d.ts.map +1 -1
  73. package/dist/client/blocks/library/json-explorer.config.js +30 -1
  74. package/dist/client/blocks/library/json-explorer.config.js.map +1 -1
  75. package/dist/client/blocks/library/server-specs.d.ts.map +1 -1
  76. package/dist/client/blocks/library/server-specs.js +13 -3
  77. package/dist/client/blocks/library/server-specs.js.map +1 -1
  78. package/dist/client/blocks/library/specs.d.ts +4 -4
  79. package/dist/client/blocks/library/specs.d.ts.map +1 -1
  80. package/dist/client/blocks/library/specs.js +21 -16
  81. package/dist/client/blocks/library/specs.js.map +1 -1
  82. package/dist/client/blocks/library/table.config.d.ts +3 -0
  83. package/dist/client/blocks/library/table.config.d.ts.map +1 -1
  84. package/dist/client/blocks/library/table.config.js +13 -1
  85. package/dist/client/blocks/library/table.config.js.map +1 -1
  86. package/dist/client/blocks/library/table.d.ts.map +1 -1
  87. package/dist/client/blocks/library/table.js +90 -9
  88. package/dist/client/blocks/library/table.js.map +1 -1
  89. package/dist/client/blocks/library/tabs.config.d.ts +16 -8
  90. package/dist/client/blocks/library/tabs.config.d.ts.map +1 -1
  91. package/dist/client/blocks/library/tabs.config.js +10 -4
  92. package/dist/client/blocks/library/tabs.config.js.map +1 -1
  93. package/dist/client/blocks/library/tabs.d.ts.map +1 -1
  94. package/dist/client/blocks/library/tabs.js +146 -21
  95. package/dist/client/blocks/library/tabs.js.map +1 -1
  96. package/dist/client/blocks/server.d.ts +2 -1
  97. package/dist/client/blocks/server.d.ts.map +1 -1
  98. package/dist/client/blocks/server.js +1 -0
  99. package/dist/client/blocks/server.js.map +1 -1
  100. package/dist/client/blocks/types.d.ts +99 -9
  101. package/dist/client/blocks/types.d.ts.map +1 -1
  102. package/dist/client/blocks/types.js.map +1 -1
  103. package/dist/client/index.d.ts +1 -1
  104. package/dist/client/index.d.ts.map +1 -1
  105. package/dist/client/index.js +2 -2
  106. package/dist/client/index.js.map +1 -1
  107. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -1
  108. package/dist/client/rich-markdown-editor/BubbleToolbar.js +13 -3
  109. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -1
  110. package/dist/client/rich-markdown-editor/DragHandle.d.ts +49 -4
  111. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -1
  112. package/dist/client/rich-markdown-editor/DragHandle.js +656 -88
  113. package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -1
  114. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +10 -1
  115. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
  116. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +180 -15
  117. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
  118. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +2 -1
  119. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
  120. package/dist/client/rich-markdown-editor/SharedRichEditor.js +3 -1
  121. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
  122. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +5 -0
  123. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -1
  124. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +33 -5
  125. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -1
  126. package/dist/client/rich-markdown-editor/index.d.ts +3 -3
  127. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
  128. package/dist/client/rich-markdown-editor/index.js +2 -2
  129. package/dist/client/rich-markdown-editor/index.js.map +1 -1
  130. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +14 -0
  131. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -1
  132. package/dist/client/rich-markdown-editor/registrySlashCommands.js +38 -0
  133. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -1
  134. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +1 -0
  135. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
  136. package/dist/client/rich-markdown-editor/useCollabReconcile.js +4 -0
  137. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
  138. package/dist/db/client.d.ts.map +1 -1
  139. package/dist/db/client.js +17 -1
  140. package/dist/db/client.js.map +1 -1
  141. package/dist/deploy/build.js +68 -0
  142. package/dist/deploy/build.js.map +1 -1
  143. package/dist/sharing/access.d.ts +4 -2
  144. package/dist/sharing/access.d.ts.map +1 -1
  145. package/dist/sharing/access.js +8 -3
  146. package/dist/sharing/access.js.map +1 -1
  147. package/dist/sharing/actions/set-resource-visibility.d.ts.map +1 -1
  148. package/dist/sharing/actions/set-resource-visibility.js +2 -3
  149. package/dist/sharing/actions/set-resource-visibility.js.map +1 -1
  150. package/dist/sharing/registry.d.ts +13 -0
  151. package/dist/sharing/registry.d.ts.map +1 -1
  152. package/dist/sharing/registry.js.map +1 -1
  153. package/dist/styles/rich-markdown-editor.css +15 -0
  154. package/package.json +16 -1
@@ -15,7 +15,7 @@ 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|prototype-plan|plan-design|context-xray [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--mcp-url <url>] [--no-connect] [--yes] [--dry-run] [--json]
18
+ agent-native skills add assets|design-exploration|visual-plan|visual-recap|visual-questions|ui-plan|prototype-plan|plan-design|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:
@@ -195,8 +195,9 @@ iteration, or a human-in-the-loop choice among design directions.
195
195
  and token values. Never paste bearer tokens into chat or logs.
196
196
  `;
197
197
  /**
198
- * Shared setup/auth block for every Plans skill (`/visual-plan`, `/ui-plan`,
199
- * `/prototype-plan`, `/plan-design`, `/visual-questions`). Interpolated into each skill markdown
198
+ * Shared setup/auth block for every Plans skill (`/visual-plan`,
199
+ * `/visual-recap`, `/ui-plan`, `/prototype-plan`, `/plan-design`,
200
+ * `/visual-questions`). Interpolated into each skill markdown
200
201
  * so the install + one-step authenticate instructions never drift between them.
201
202
  * Keep this in sync with the copies under `templates/plan/.agents/skills/*` and
202
203
  * top-level `skills/*` (this skill's SKILL.md is triplicated with no sync test).
@@ -214,8 +215,9 @@ intended), so the first tool call does not hit an OAuth wall:
214
215
  agent-native skills add visual-plan
215
216
  \`\`\`
216
217
 
217
- After that, \`/visual-plan\` (and \`/ui-plan\`, \`/prototype-plan\`, \`/plan-design\`,
218
- \`/visual-questions\`) generate a plan and open the editor. Pass \`--no-connect\` to
218
+ After that, \`/visual-plan\` (and \`/visual-recap\`, \`/ui-plan\`,
219
+ \`/prototype-plan\`, \`/plan-design\`, \`/visual-questions\`) generate a plan and open
220
+ the editor. Pass \`--no-connect\` to
219
221
  register the connector without authenticating, then run
220
222
  \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
221
223
 
@@ -238,155 +240,21 @@ is available.
238
240
 
239
241
  Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
240
242
  not put shared secrets in skill files.`;
241
- export const VISUAL_PLANS_SKILL_MD = `---
242
- name: visual-plan
243
- description: >-
244
- Use Agent-Native Plans when coding-agent work needs an interactive structured
245
- plan document with inline diagrams, implementation maps, optional UI/product
246
- wireframes or prototypes, annotations, and comments.
247
- metadata:
248
- visibility: exported
249
- ---
250
-
251
- # Agent-Native Plans
252
-
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: inline diagrams, implementation maps, code previews,
256
- open questions, and an optional top visual review area (wireframe canvas, live
257
- prototype, or both in tabs). Architecture, backend, data, and refactor plans
258
- usually start in the document with local diagrams near each claim. UI and product
259
- plans should still start with the top canvas/prototype when screens or behavior
260
- are what the user needs to review.
261
-
262
- \`/visual-plan\` is the canonical command and the main entry point. Use \`/ui-plan\`
263
- when the work is primarily product UI and review should start with the screens.
264
- Use \`/prototype-plan\` when review should start with a functional live prototype.
265
- Use \`/plan-design\` when review should start with full-fidelity branded design.
266
- Use \`/visual-questions\` only when the user explicitly wants a visual intake form
267
- before planning. When a Codex, Claude Code, Markdown, or pasted plan already
268
- exists, \`/visual-plan\` uses that source plan as the starting point and builds
269
- the review surface from it instead of starting over.
270
-
271
- ## When To Use
272
-
273
- Create or adapt a visual plan when work is multi-file, ambiguous, long-running,
274
- risky, or UI-heavy, when architecture / data flow / UI direction / options /
275
- open questions would benefit from inline diagrams or structured blocks, when the
276
- user needs to react to a direction before you implement, or when an existing text
277
- plan needs a richer review surface.
278
-
279
- ## Plan Discipline
280
-
281
- - **Gate hard.** A polished visual plan is the most expensive plan form; only
282
- invest when a wrong direction is costly. Skip it for trivial, unambiguous work
283
- — typos, one-line fixes, a single well-specified function, anything whose diff
284
- you could describe in one sentence — and just make the change. Never pad a plan
285
- with filler and never ship a single-step plan.
286
- - **Research before you draft.** Read the real files, actions, schema, and
287
- patterns first; name actual files, symbols, and data shapes instead of
288
- inventing them. Check existing \`actions/\` before proposing endpoints and prefer
289
- named client helpers over raw fetch. Delegate wide exploration to a sub-agent.
290
- - **Preserve existing plans.** If the user pasted, referenced, or already has a
291
- Codex / Claude Code / Markdown plan, treat it as source material. Preserve its
292
- intent, do not invent codebase facts, label inferred visuals as inferred, and
293
- build the visual review structure around the plan the user already has.
294
- - **Planning is read-only.** Make no source edits while building or reviewing the
295
- plan. Start editing only after the user approves the direction.
296
- - **Clarify vs. assume.** Do not ask how to build it — explore and present the
297
- approach and options in the plan. Ask a clarifying question only when an
298
- ambiguity would change the design and you cannot resolve it from the code; use
299
- the host agent's normal ask-user-question flow and batch 2-4 high-leverage
300
- questions before finalizing. Do not call \`create-visual-questions\` from
301
- \`/visual-plan\`; keep any answerable follow-up inside the plan itself as a
302
- bottom \`question-form\` Open Questions block. Otherwise state the assumption
303
- explicitly and proceed, and put anything unresolved in an open-questions block.
304
- - **The plan is the approval gate.** After surfacing it, ask the user to review
305
- and approve before you write code, and name which files/areas the work touches.
306
- Presenting the plan and requesting sign-off is the approval step — do not ask a
307
- separate "does this look good?" question.
308
- - **The document is the source of truth, not the chat.** When scope shifts,
309
- update the plan with \`update-visual-plan\` rather than only changing course in
310
- chat, and re-read the approved plan before major steps.
311
-
312
- ## Core Workflow
313
-
314
- 1. Follow the host agent's normal planning flow: inspect the codebase, delegate
315
- wide exploration when useful, gather the info needed, and ask native
316
- clarifying questions as needed before generating the plan. If a source plan
317
- already exists, gather its exact text from the user's paste, a referenced
318
- file, or recent visible agent context; do not invent source text.
319
- 2. Decide whether the plan needs a top visual surface with the rules below, then call
320
- \`create-visual-plan\` with the title, brief, source, repo path, and structured
321
- \`content\` blocks. When a source plan already exists, pass it as \`planText\`
322
- and preserve the original plan's intent while adding structured review
323
- content.
324
- 3. Compose or enrich any top UI/product visual surface from the kit and write the
325
- document with native blocks (see the cores below). Keep the document close to
326
- the Markdown plan the agent would normally output, or to the existing plan
327
- when one was provided. For architecture, backend, refactor, API, data-model,
328
- migration, or code plans, usually omit \`content.canvas\` and
329
- \`content.prototype\`; put \`diagram\`, \`mermaid\`, \`data-model\`, \`file-tree\`,
330
- \`implementation-map\`, \`code-tabs\`, and \`annotated-code\` blocks directly next
331
- to the relevant prose. Skip the top visual surface for non-visual work.
332
- 4. Surface the returned Plans link or inline MCP App and ask the user to review.
333
- Always include the actual URL in chat so the next step is a click in CLI or
334
- other text-only hosts. When the host exposes an embedded browser/preview panel
335
- and a tool can open arbitrary URLs there, open the returned plan URL
336
- automatically for convenient review; do not rely on this as the only handoff.
337
- Treat that browser open as a convenience and smoke test, not as the access
338
- model. Plans should load out of the box for the local agent and local browser
339
- session; if a signed-in embedded browser cannot read a local plan that an
340
- anonymous/tool check can read, fix the app/action ownership or access path
341
- rather than patching one plan by hand.
342
- 5. Call \`get-plan-feedback\` before editing, after review, after any long pause,
343
- and before the final response. Treat \`anchorDetails\`, resolver intent, recent
344
- review events, and any focused screenshots from browser handoff as the source
345
- of truth for exactly what changed and exactly what each comment points at.
346
- 6. Apply changes with \`update-visual-plan\`, preferring targeted \`contentPatches\`.
347
- When the user wants source-control friendly edits, use
348
- \`patch-visual-plan-source\` against the MDX files instead of regenerating the
349
- plan.
350
- 7. Export with \`export-visual-plan\` only when the user wants a shareable receipt
351
- or repo-check-in artifacts.
352
-
353
- ## Visual Surface Choice
354
-
355
- Choose the surface before creating the plan or after reading the source plan. Do
356
- not add visual chrome by default:
357
-
358
- - **No visual surface** for architecture-only, backend-only, data migration,
359
- copy-only, or otherwise non-visual plans. Do not use the top canvas for
360
- architecture diagrams, dependency maps, file plans, API contracts, or
361
- data-flow-only reviews. Use a strong document with local inline diagrams
362
- only when relationships need a visual explanation, usually one spatial diagram
363
- per recommendation or decision. Prefer grouped regions, layers, quadrants,
364
- matrices, or before/after panels over a single-axis chain unless the
365
- relationship is truly sequential.
366
- - **Canvas only** for one static screen, a before/after comparison, a component
367
- state, a small popover, or a visual direction that does not require clicking.
368
- Put those wireframes in \`content.canvas\` and omit \`content.prototype\`.
369
- - **Canvas + prototype** for multi-step UI flows, onboarding, wizards,
370
- review/approval flows, navigation changes, or anything where the reviewer
371
- needs to operate the behavior. Keep the static wireframes in
372
- \`content.canvas\`, add the aligned functional prototype in
373
- \`content.prototype\`, and rely on the top visual tabs to switch between them.
374
- - **Prototype-first** when the user explicitly asks for \`/prototype-plan\`, asks
375
- to operate the UI, or when interaction is the main question. Use
376
- \`create-prototype-plan\`, which still preserves static mocks where useful.
377
-
378
- For mixed canvas + prototype plans, reuse the same real labels, app statuses,
379
- and screen ids across both surfaces. The canvas is the inspectable static reference;
380
- the prototype is the interactive version of that same flow, not a separate
381
- design direction.
382
-
383
- <!-- SHARED-CORE:wireframe-canvas START -->
384
-
385
- ## Wireframe & Canvas Core
386
-
387
- This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
388
- the single source of truth for how wireframes and the canvas work. Do not
389
- paraphrase it per command.
243
+ // Single-source shared cores. Each partial is a heading-less BODY string that
244
+ // begins and ends with its own SHARED-CORE marker comment, so the marker-region
245
+ // sync guard can extract and compare it across the skills that consume it. The
246
+ // skill constants below interpolate these partials at module-eval time; the
247
+ // distributed artifact stays a flat string, so distribution is unchanged.
248
+ //
249
+ // Consumers:
250
+ // WIREFRAME_QUALITY_CORE visual-plan, ui-plan, visual-recap (surface-agnostic)
251
+ // CANVAS_SURFACE_CORE — visual-plan, ui-plan (canvas/artboard mechanics)
252
+ // DOCUMENT_QUALITY_CORE — visual-plan, ui-plan
253
+ // EXEMPLAR_CORE — visual-plan, ui-plan
254
+ // Surface-agnostic HTML wireframe quality rules. Applies equally to a standalone
255
+ // WireframeBlock/<Screen> (visual-recap) and to a canvas artboard (visual-plan /
256
+ // ui-plan). Do not put canvas/artboard placement mechanics here.
257
+ const WIREFRAME_QUALITY_CORE = `<!-- SHARED-CORE:wireframe-quality START -->
390
258
 
391
259
  **A wireframe is an HTML mockup. The renderer owns the look; you write the
392
260
  content.** Set \`data.html\` to a self-contained, semantic HTML fragment of the
@@ -441,13 +309,22 @@ Pick the \`surface\` that matches what the user will actually see:
441
309
  - \`popover\`: a small floating menu, dropdown, or inline popover.
442
310
  - \`panel\`: a side panel, inspector, or sidebar widget.
443
311
 
444
- The surface locks the footprint and aspect; never set width/height/coordinates.
445
312
  A sidebar popover renders as a small surface, not a desktop page and a phone
446
313
  frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
447
314
  actually changes the layout. For a component or widget, show one broader
448
315
  app-context frame only when placement affects understanding, then the focused
449
316
  component states.
450
317
 
318
+ **Model the actual component shell for small surfaces.** A rendered UI change
319
+ belongs in a wireframe; reserve \`diagram\` for architecture, dependency, state,
320
+ or data-flow relationships. Popovers, dropdown menus, command palettes, and
321
+ context menus use \`surface: "popover"\` unless the surrounding page placement is
322
+ the point of the change. Dialogs, sheets, inspectors, sidebars, and long
323
+ property panels use the matching \`panel\` / \`desktop\` surface as appropriate.
324
+ Show the real chrome: trigger or anchor when it matters, title/header row,
325
+ top-right actions, separators, fields, options, selected states, body content,
326
+ and footer actions that are visible in the workflow.
327
+
451
328
  **Modify, don't redesign.** When the task changes an existing screen, reproduce
452
329
  the current screen's real layout and footprint FIRST, then change only the delta
453
330
  and call it out with a single annotation. Do not restack the page into a new
@@ -474,8 +351,7 @@ fill the \`html\` with neutral, textless placeholder geometry — boxes and bars
474
351
  built as \`<div>\`s with \`background:var(--wf-line)\` and explicit heights/widths,
475
352
  no labels or copy. The renderer drops borders, sketch, and color into the
476
353
  skeleton register automatically. Never escape to a \`custom-html\` document block
477
- to fake a loader, and never move a mockup out of the canvas — mockups always
478
- live in canvas artboards.
354
+ to fake a loader.
479
355
 
480
356
  **Editing an existing mockup.** To change one element, text, or color in an
481
357
  existing html mockup, do NOT regenerate the frame — call \`update-visual-plan\`
@@ -484,49 +360,45 @@ replace }] }]\`. Each \`find\` is a unique snippet of the current html (read it
484
360
  first with \`get-visual-plan\`); set \`all: true\` on an edit to replace every
485
361
  occurrence. The result is re-sanitized.
486
362
 
487
- **Canvas annotations are designer notes on the artboard.** When a top canvas is
488
- present, sprinkle Figma-style notes near the frames they explain: a short
489
- heading, supporting text, and bullets plain text layers, never bordered or
490
- shadowed cards, and never a box around a frame. The renderer spaces notes away
491
- from frames, so place each note by the frame it describes. Use an arrow only to
492
- point at one specific control or transition; for a broad frame-level note, write
493
- text beside the frame with no connector. Connectors are for real sequences only —
494
- never fake "Step 1 → Step 2" lines between independent states.
495
-
496
- **Do not create overlapping annotations.** Anchor each note to the frame it
497
- explains with \`targetId\` + \`placement\` (top/right/bottom/left). The renderer
498
- parks notes in a gutter beside the frame and lays them out automatically — never
499
- supply x/y or points for anchored notes; hand-placed coordinates fight the
500
- auto-layout and cause the overlap you're trying to avoid. Reserve arrows for a
501
- note that must point at a specific control inside a frame; a note that simply
502
- sits beside its frame needs no arrow.
503
-
504
- **Patching.** Edit one wireframe, canvas annotation, or block with targeted \`contentPatches\`
505
- (for example \`update-block\`, \`replace-blocks\`, \`update-canvas-annotation\`) rather
506
- than regenerating the whole plan. \`contentPatches\` are part of the public MCP
507
- action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
508
- edits. If an agent is working from exported source files, use
509
- \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
510
- frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
511
- \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
512
- patch action normalizes the MDX back into the same JSON runtime model. JSON is
513
- the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
514
- In the browser, humans edit \`rich-text\` prose inline; agents should still use
515
- \`update-rich-text\` content patches or source patches for prose, and use
516
- comments/structured patches for canvas, artboard, wireframe, and diagram edits.
517
-
518
- **Never emit a titled artboard with no interior wireframe content.** Every artboard
519
- you place on the canvas must carry an \`html\` wireframe or reference a wireframe
520
- block via \`blockId\`; when using \`blockId\`, the referenced \`wireframe\` /
521
- \`legacy-wireframe\` block must remain in the plan. If you remove a duplicate
522
- wireframe from the document body, first move its \`data\` inline onto the
523
- corresponding \`content.canvas.frames[*].wireframe\` / \`legacyWireframe\`. A
524
- label-only frame or a frame pointing at a deleted block renders empty and is
525
- rejected at parse time. If you only have a title, write it as a section header or
526
- annotation, not an empty artboard.
363
+ **Treat the wireframe border as part of the visible design.** Always wrap HTML
364
+ wireframe content in a root container with real inner padding before drawing
365
+ cards, fields, pills, labels, or controls. Use at least 14-16px of padding,
366
+ \`box-sizing: border-box\`, \`height: 100%\`, and \`gap\` between child rows so the
367
+ first row never sits flush against the screen border. Keep text away from
368
+ borders: every container, field, button, menu item, and annotation needs enough
369
+ padding and line-height to read cleanly in the rendered Plan view.
370
+
371
+ **Lay out children safely so they never collide.** Use HTML flex/grid with
372
+ \`gap\`, \`min-width: 0\`, and sensible overflow. Avoid negative margins, absolute
373
+ positioning, or fixed child widths that can collide when the renderer switches
374
+ between light/dark, sketch/clean, or different zoom levels.
375
+
376
+ **Do not wrap intentionally single-line labels.** For tab rails, breadcrumbs,
377
+ file chips, code filenames, and other deliberately single-line labels, do not
378
+ let long text wrap. It is acceptable and usually preferable to use
379
+ \`white-space: nowrap\`, \`overflow: hidden\`, and \`text-overflow: ellipsis\` (or
380
+ abstract bars) so the wireframe demonstrates the actual layout behavior instead
381
+ of producing ugly vertical text. Use horizontally scrollable or clipped rails
382
+ for overflow.
527
383
 
528
384
  **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).
529
385
 
386
+ **Before / after must be comparable.** When showing a state change, preserve the
387
+ unchanged controls in both states so the reviewer can see exactly what moved or
388
+ appeared; do not show an added control as a generic box floating elsewhere in
389
+ the surface. Place the new/changed affordance where the implementation puts it —
390
+ for example, a new \`Edit with AI\` action in a popover header belongs in the
391
+ top-right header slot, aligned with the title, not in the body or footer. Use
392
+ the same frame size, scale, outer padding, border radius, and visual density on
393
+ both sides unless the change itself alters those properties, and let the frame
394
+ height fit the content rather than leaving a tall empty lower half. Choose the
395
+ before/after layout by geometry: use a \`columns\` block labeled \`Before\`/\`After\`
396
+ when each state stays legible side by side; stack \`Before\` then \`After\`
397
+ vertically in normal document flow when the surface is very wide, when
398
+ full-width scanning matters, or when columns would shrink or crop the detail.
399
+ Label each state visibly (for example, a header pill) so cropped screenshots
400
+ stay unambiguous.
401
+
530
402
  **Good example — a contacts list, surface \`browser\`.** A small, real screen
531
403
  composed from the helper classes and tokens, layout in inline flex, no fonts or
532
404
  hex colors:
@@ -572,6 +444,70 @@ hex colors:
572
444
  </div>
573
445
  \`\`\`
574
446
 
447
+ <!-- SHARED-CORE:wireframe-quality END -->`;
448
+ // Canvas/artboard placement mechanics. Used only by visual-plan and ui-plan
449
+ // (visual-recap renders standalone wireframes, not a canvas).
450
+ const CANVAS_SURFACE_CORE = `<!-- SHARED-CORE:canvas-surface START -->
451
+
452
+ **Artboard placement is locked by the \`surface\`, not by coordinates.** The
453
+ surface locks the footprint and aspect; never set artboard width/height and
454
+ never use coordinates inside the wireframe HTML. Let canvas auto-placement
455
+ handle simple one-row boards. For mixed-footprint canvases, board-level artboard
456
+ \`x\`/\`y\` is allowed and expected when it creates clear lanes.
457
+
458
+ **Lay out mixed canvases in lanes.** When a canvas contains broad browser /
459
+ desktop frames plus compact \`mobile\`, \`popover\`, or \`panel\` surfaces, do not put
460
+ everything in one horizontal strip. Use board-level artboard \`x\`/\`y\` to reserve
461
+ lanes with generous empty space: main flow on one row, compact surfaces in their
462
+ own column or row, and loading/error states in a lower row. Keep at least 96px
463
+ between rendered artboard rectangles plus room for annotation gutters. Connect
464
+ only neighboring steps; never draw a long connector that skips across unrelated
465
+ frames. Before handoff, inspect the top canvas at default zoom and move any
466
+ frame whose label, connector, or annotation crosses another frame.
467
+
468
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
469
+ present, sprinkle Figma-style notes near the frames they explain: a short
470
+ heading, supporting text, and bullets — plain text layers, never bordered or
471
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
472
+ from frames, so place each note by the frame it describes. Use an arrow only to
473
+ point at one specific control or transition; for a broad frame-level note, write
474
+ text beside the frame with no connector. Connectors are for real sequences only —
475
+ never fake "Step 1 → Step 2" lines between independent states.
476
+
477
+ **Do not create overlapping annotations.** Anchor each ordinary note to the
478
+ frame it explains with \`targetId\` + \`placement\` (top/right/bottom/left), and
479
+ omit \`type\` or use \`type: "note"\`. The renderer parks notes in a gutter beside
480
+ the frame and lays them out automatically. Do not use \`type: "callout"\`,
481
+ \`type: "text"\`, \`type: "arrow"\`, x/y, or points for ordinary notes; those are
482
+ freeform review-markup layers and must be reserved for intentional markup in
483
+ open canvas space. Reserve arrows for a note that must point at one specific
484
+ control inside a frame; a note that simply sits beside its frame needs no arrow.
485
+
486
+ **Patching.** Edit one wireframe, canvas annotation, diagram, or block with targeted \`contentPatches\`
487
+ (for example \`patch-wireframe-html\`, \`patch-diagram-html\`, \`update-block\`,
488
+ \`replace-blocks\`, \`update-canvas-annotation\`) rather
489
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
490
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
491
+ edits. If an agent is working from exported source files, use
492
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
493
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
494
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
495
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
496
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
497
+ In the browser, humans edit \`rich-text\` prose inline; agents should still use
498
+ \`update-rich-text\` content patches or source patches for prose, and use
499
+ comments/structured patches for canvas, artboard, wireframe, and diagram edits.
500
+
501
+ **Never emit a titled artboard with no interior wireframe content.** Every artboard
502
+ you place on the canvas must carry an \`html\` wireframe or reference a wireframe
503
+ block via \`blockId\`; when using \`blockId\`, the referenced \`wireframe\` /
504
+ \`legacy-wireframe\` block must remain in the plan. If you remove a duplicate
505
+ wireframe from the document body, first move its \`data\` inline onto the
506
+ corresponding \`content.canvas.frames[*].wireframe\` / \`legacyWireframe\`. A
507
+ label-only frame or a frame pointing at a deleted block renders empty and is
508
+ rejected at parse time. If you only have a title, write it as a section header or
509
+ annotation, not an empty artboard.
510
+
575
511
  **UI mockups belong in the top visual review area.** Static UI/product visuals
576
512
  live on the canvas; multi-step UI flows get both canvas wireframes and a
577
513
  prototype. When the user asks for a mockup, UI state, loading state, layout,
@@ -585,27 +521,22 @@ can explain, compare, or map implementation, but they should not host the
585
521
  primary UI mockup or prototype just because \`custom-html\`, screenshots, or prose
586
522
  are easier to produce. If the canvas/prototype surface cannot represent the
587
523
  requested UI fidelity, still keep the closest top-surface representation and
588
- call out or extend the needed renderer capability.
524
+ call out or extend the needed renderer capability. A skeleton/loading mockup
525
+ also lives in a canvas artboard — never move a mockup out of the canvas.
589
526
 
590
527
  **Legacy kit tree.** Older plans set a \`screen\` array of \`{ el, ...props }\` kit
591
528
  nodes instead of \`html\`; the renderer still accepts and displays it, but new
592
- plans emit \`html\`. Do not author fresh kit-tree screens write the HTML mockup
529
+ plans emit \`html\`. Do not author fresh kit-tree screens - write the HTML mockup
593
530
  instead. Likewise, old or imported plans may carry coordinate-based regions or
594
- free-float x/y on notes or artboards; those are legacy escape hatches the
595
- renderer still shows but you must never produce. The \`surface\` drives the aspect
596
- and footprint, the canvas auto-places artboards, and the gutter parks notes by
597
- \`targetId\` + \`placement\`; never supply width, height, or coordinates for a new
598
- plan.
599
-
600
- <!-- SHARED-CORE:wireframe-canvas END -->
601
-
602
- <!-- SHARED-CORE:document-quality START -->
603
-
604
- ## Document Quality Core
531
+ free-float x/y on notes; those are legacy escape hatches the renderer still
532
+ shows but you must never produce. The \`surface\` drives each artboard's aspect
533
+ and footprint, and the gutter parks notes by \`targetId\` + \`placement\`. The only
534
+ new-plan coordinate exception is deliberate board-level artboard \`x\`/\`y\` for
535
+ multi-lane mixed-surface canvases; never supply artboard width/height, note
536
+ coordinates, or wireframe-internal coordinates.
605
537
 
606
- This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
607
- the single source of truth for the document below the canvas. Do not paraphrase
608
- it per command.
538
+ <!-- SHARED-CORE:canvas-surface END -->`;
539
+ const DOCUMENT_QUALITY_CORE = `<!-- SHARED-CORE:document-quality START -->
609
540
 
610
541
  **The document is a serious technical plan, not marketing.** Write it the way a
611
542
  strong Claude or Codex implementation plan reads: outcome-first, prose-first,
@@ -631,13 +562,17 @@ swimlanes, dependency maps, matrices, or grouped regions. Do not default to
631
562
  left-to-right chains; use a line only when the relationship is truly a sequence.
632
563
  Use native \`diagram\` blocks with \`data.html\` / \`data.css\` for these richer
633
564
  layouts; the fragment may use semantic HTML and inline SVG, and the renderer
634
- applies the viewer's sketch/clean style. Legacy \`nodes\` / \`edges\` are only for
635
- tiny previews or genuinely linear step flows. Repeat a wireframe in the document
636
- only for a genuinely new detail view or comparison. Skip the visual surface
637
- entirely for non-visual work and write a clean rich document. For a simple
638
- binary UI visual choice, show the two directions in the canvas only; do not
639
- repeat the same options as body wireframes, a \`decision\` block, or prose. Put
640
- the actual choice in the bottom "Open Questions" form.
565
+ applies the viewer's sketch/clean style. Leave room for the sketch font: keep
566
+ labels short, give nodes generous width, and place boundary/annotation labels in
567
+ unused space instead of over nodes. For small text/SVG changes to an existing
568
+ HTML diagram, use \`patch-diagram-html\` with a unique \`find\`/\`replace\` snippet
569
+ instead of resending the whole \`data.html\` string. Legacy \`nodes\` / \`edges\` are
570
+ only for tiny previews or genuinely linear step flows. Repeat a wireframe in the document only
571
+ for a genuinely new detail view or comparison. Skip the visual surface entirely
572
+ for non-visual work and write a clean rich document. For a simple binary UI
573
+ visual choice, show the two directions in the canvas only; do not repeat the
574
+ same options as body wireframes, a \`decision\` block, or prose. Put the actual
575
+ choice in the bottom "Open Questions" form.
641
576
 
642
577
  **Use the right block, and make it carry substance.** For the authoritative,
643
578
  machine-checked list of block types and their data schemas, call \`get-plan-blocks\`
@@ -654,16 +589,26 @@ so you never emit a block the editor cannot render or round-trip:
654
589
  - \`decision\` for two or three option cards with consequences. These are static
655
590
  records; do not style them like clickable tabs or chips unless the renderer
656
591
  truly supports changing the selection.
592
+ - \`columns\` for side-by-side before/after or current/target comparisons where
593
+ each side needs real nested blocks; label the columns clearly and avoid
594
+ stacking comparison blocks vertically when parallel reading is the point.
657
595
  - \`diagram\` for two-dimensional architecture, dependency, data-flow, or state
658
596
  relationships, only when it clarifies something real. For architecture/code
659
597
  diagrams, prefer \`data.html\` / \`data.css\` with semantic HTML and inline SVG so
660
598
  the diagram can use panels, layers, matrices, arrows, annotations, and
661
- responsive layout directly. Use legacy \`nodes\` / \`edges\` only for small
662
- previews or truly sequential flows. In architecture/code plans, prefer a
663
- repeated section rhythm: recommendation title, confidence and category badges,
664
- code-path evidence, a local before/after or current/target spatial diagram,
665
- then concise Problem/Solution/Why text. Labels must not overlap nodes,
666
- connectors, or each other.
599
+ responsive layout directly. Author diagram HTML with renderer-owned primitives
600
+ like \`.diagram-panel\`, \`.diagram-card\`, \`.diagram-node\`, \`.diagram-box\`,
601
+ \`.diagram-pill\`, \`.diagram-muted\`, and \`[data-rough]\`; they map to the plan's
602
+ Tailwind theme variables through \`--wf-ink\`, \`--wf-muted\`, \`--wf-line\`,
603
+ \`--wf-paper\`, \`--wf-card\`, \`--wf-accent\`, \`--wf-accent-soft\`, \`--wf-warn\`, and
604
+ \`--wf-ok\`, and switch to Virgil plus rough.js outlines in sketchy mode. Do not
605
+ set \`font-family\` and do not hard-code hex, rgb, or hsl colors in diagram HTML
606
+ or CSS. Use legacy \`nodes\` / \`edges\` only for small previews or truly
607
+ sequential flows. In architecture/code plans, prefer a repeated section rhythm:
608
+ recommendation title, confidence and category badges, code-path evidence, a
609
+ local before/after or current/target spatial diagram, then concise
610
+ Problem/Solution/Why text. Labels must not overlap nodes, connectors, or each
611
+ other.
667
612
  - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
668
613
  only prose usually means the plan is under-specified — include a relevant
669
614
  visual unless the tab is intentionally document-only.
@@ -694,11 +639,8 @@ for that artifact type, not moving the mockup into the document.
694
639
  whitespace, clipped fragments, misleading inactive controls, poor contrast, and
695
640
  unreadable diagrams before asking for approval.
696
641
 
697
- <!-- SHARED-CORE:document-quality END -->
698
-
699
- <!-- SHARED-CORE:exemplar START -->
700
-
701
- ## Good vs. Bad Exemplar
642
+ <!-- SHARED-CORE:document-quality END -->`;
643
+ const EXEMPLAR_CORE = `<!-- SHARED-CORE:exemplar START -->
702
644
 
703
645
  **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard whose
704
646
  \`data.html\` is a real flex layout — a sidebar of links (\`Inbox 12\`, \`Today 4\`,
@@ -737,510 +679,343 @@ already shows. Also bad: an architecture-only plan forced into a top canvas of
737
679
  labeled boxes with overlapping text, where the actual code evidence and
738
680
  recommendations live elsewhere. Never produce this.
739
681
 
740
- <!-- SHARED-CORE:exemplar END -->
682
+ <!-- SHARED-CORE:exemplar END -->`;
683
+ export const VISUAL_PLANS_SKILL_MD = `---
684
+ name: visual-plan
685
+ description: >-
686
+ Use Agent-Native Plans when coding-agent work needs an interactive structured
687
+ plan document with inline diagrams, implementation maps, optional UI/product
688
+ wireframes or prototypes, annotations, and comments.
689
+ metadata:
690
+ visibility: exported
691
+ ---
741
692
 
742
- ## Tool Guidance
693
+ # Agent-Native Plans
743
694
 
744
- - \`create-visual-plan\`: start one structured visual plan per agent task/run, or
745
- import an existing text plan by passing \`planText\`; \`content\` may include no
746
- visual surface, canvas only, or canvas + prototype.
747
- - \`create-ui-plan\`: start a UI-first plan when the work is primarily product UI.
748
- - \`create-prototype-plan\`: start a prototype-first plan with a functional top
749
- review surface.
750
- - \`create-plan-design\`: start a full-fidelity branded Design-tab plan with an
751
- optional matching Prototype tab.
752
- - \`convert-visual-plan-to-prototype\`: convert an existing HTML wireframe canvas
753
- into a prototype plan.
754
- - \`create-visual-questions\`: use only for the explicit \`/visual-questions\`
755
- command, not as \`/visual-plan\` preflight.
756
- - \`update-visual-plan\`: revise content, status, or comments; prefer
757
- \`contentPatches\` over regenerating the whole plan.
758
- - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
759
- optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
760
- - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
761
- artboard, annotation, component, or wireframe-node id.
762
- - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
763
- - \`get-visual-plan\`: read the current structured plan, exported HTML, and
764
- annotations; it also returns the MDX folder for source workflows.
765
- - \`get-plan-feedback\`: read unconsumed human feedback. Use it frequently; it
766
- returns grouped threads, exact anchor details, expected resolver, and recent
767
- review-event payloads so agents can act only on the comments meant for them.
768
- - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
769
- files for repo check-in.
770
-
771
- When the user critiques a plan's look or structure, fix the renderer or this
772
- skill — never hand-edit one stored plan. Turn feedback into better guidance.
773
-
774
- ## Setup & Authentication
775
-
776
- There are two ways into Plans.
777
-
778
- **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
779
- installs the Plans skills, registers the hosted Plans MCP connector, and
780
- authenticates it in the same step (a one-time browser sign-in at setup — this is
781
- intended), so the first tool call does not hit an OAuth wall:
782
-
783
- \`\`\`bash
784
- agent-native skills add visual-plan
785
- \`\`\`
786
-
787
- After that, \`/visual-plan\` (and \`/ui-plan\`, \`/prototype-plan\`, \`/plan-design\`,
788
- \`/visual-questions\`) generate a plan and open the editor. Pass \`--no-connect\` to
789
- register the connector without authenticating, then run
790
- \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
791
-
792
- **Browser (people you share with).** Open the Plans editor and create & edit
793
- with no sign-up — you work as a guest. Sign in only when you want to save or
794
- share; signing in claims the plans you made as a guest into your account.
795
-
796
- Sharing and commenting require an account: public/shared plans are viewable by
797
- anyone with the link, but commenting on them needs an agent-native account.
798
-
799
- For fully offline, no-account use, run the Plans app locally and sync plans to
800
- your repo as MDX. This local mode is a separate advanced path, not the default
801
- hosted flow.
802
-
803
- If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
804
- do not keep retrying the tool. Authenticate the connector with
805
- \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
806
- instead re-run /mcp and choose Authenticate), then continue once the connector
807
- is available.
808
-
809
- Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
810
- not put shared secrets in skill files.
811
- `;
812
- export const UI_PLAN_SKILL_MD = `---
813
- name: ui-plan
814
- description: >-
815
- Use Agent-Native Plans for UI-first planning with an optional top pan/zoom
816
- wireframe canvas, a refined Notion-like document, rich tabs, diagrams,
817
- comments, drawing, and agent handoff.
818
- metadata:
819
- visibility: exported
820
- ---
695
+ Agent-Native Plans is structured visual planning mode for coding agents. Build
696
+ the plan you would normally write in Markdown, but as a scannable document with
697
+ editable blocks mixed in: inline diagrams, implementation maps, code previews,
698
+ open questions, and an optional top visual review area (wireframe canvas, live
699
+ prototype, or both in tabs). Architecture, backend, data, and refactor plans
700
+ usually start in the document with local diagrams near each claim. UI and product
701
+ plans should still start with the top canvas/prototype when screens or behavior
702
+ are what the user needs to review.
821
703
 
822
- # UI Plan
704
+ \`/visual-plan\` is the canonical command and the main entry point. Use \`/ui-plan\`
705
+ when the work is primarily product UI and review should start with the screens.
706
+ Use \`/prototype-plan\` when review should start with a functional live prototype.
707
+ Use \`/plan-design\` when review should start with full-fidelity branded design.
708
+ Use \`/visual-questions\` only when the user explicitly wants a visual intake form
709
+ before planning. When a Codex, Claude Code, Markdown, or pasted plan already
710
+ exists, \`/visual-plan\` uses that source plan as the starting point and builds
711
+ the review surface from it instead of starting over.
823
712
 
824
- Use \`/ui-plan\` when the task is primarily about product UI, user flows,
825
- interaction details, component layout, or visual direction. The reviewable UI
826
- comes first; implementation detail comes after the user has something concrete to
827
- react to.
713
+ ## When To Use
828
714
 
829
- \`/visual-plan\` remains the general command for architecture, backend, refactors,
830
- and mixed work. Use \`/prototype-plan\` when the UI review needs a functional live
831
- prototype instead of static screens. Use \`/plan-design\` when polish, brand, or
832
- visual fidelity are material to the decision. Use \`/visual-questions\` only when
833
- the user explicitly wants visual intake before planning. Use \`/visual-plan\` when
834
- a text plan already exists and should become the source material for the review.
715
+ Create or adapt a visual plan when work is multi-file, ambiguous, long-running,
716
+ risky, or UI-heavy, when architecture / data flow / UI direction / options /
717
+ open questions would benefit from inline diagrams or structured blocks, when the
718
+ user needs to react to a direction before you implement, or when an existing text
719
+ plan needs a richer review surface.
835
720
 
836
721
  ## Plan Discipline
837
722
 
838
- - **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several
839
- screens or states, or the direction needs agreement before coding. Skip it for
840
- cosmetic one-liners a color, a label, a spacing tweak and just make the
841
- change. Never ship a single-step or filler plan.
842
- - **Research before you draft.** Read the real components, routes, and design
843
- tokens first; ground every mockup and the file map in actual files and symbols.
844
- Delegate wide exploration to a sub-agent when the surface is large.
845
- - **Planning is read-only.** Make no source edits while building or reviewing.
846
- Start editing only after the user approves the UI direction.
847
- - **Clarify vs. assume.** Do not ask how to build the UI — present the direction
848
- and options as mockups and tabs. Ask a clarifying question only when an
849
- ambiguity would change the design; use the host agent's normal
850
- ask-user-question flow and batch 2-4 before finalizing. Do not call
851
- \`create-visual-questions\` from \`/ui-plan\`; keep answerable follow-up inside
852
- the same plan as a bottom \`question-form\` Open Questions block. Otherwise
853
- state the assumption in the plan and proceed.
854
- - **The plan is the approval gate.** Ask the user to review and approve the UI
855
- direction before you write code, and name the files/areas the work touches.
856
-
857
- ## UI-First Workflow
858
-
859
- 1. Follow the host agent's normal planning flow: inspect the codebase, gather
860
- the UI/component context needed, and ask native clarifying questions as needed
861
- before generating the plan.
862
- 2. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path, and
863
- structured \`content\`. The canvas comes first, the document second.
864
- 3. Compose the top canvas from the kit (see the cores below): the key artboards
865
- with real product content, designer notes, and connectors only for real
866
- sequences. Skip the canvas when wireframes would not clarify the work.
867
- 4. Continue below as a concise technical document that stays close to the
868
- Markdown plan the agent would normally output — not a second copy of the
869
- canvas — covering concrete files, contracts, phases, risks, and validation.
870
- 5. Call \`get-plan-feedback\` before implementation, after review, after a long
871
- pause, and before the final response. Treat \`anchorDetails\`, resolver intent,
872
- recent review events, and any focused screenshots from browser handoff as the
873
- source of truth for exactly what changed and exactly what each UI comment
874
- points at. Apply changes with \`update-visual-plan\`, preferring
875
- \`contentPatches\` for one frame, annotation, node, tab, or block. When the
876
- user wants source-control friendly edits, use \`patch-visual-plan-source\`
877
- against the MDX files instead of regenerating the plan.
878
-
879
- ## Agent Handoff
880
-
881
- After the canvas and document, add a short handoff that names the chosen UI
882
- direction, unresolved visual questions, and feedback that must be read before
883
- code changes. Never claim feedback has been applied until \`get-plan-feedback\` or
884
- the user has supplied it.
885
-
886
- <!-- SHARED-CORE:wireframe-canvas START -->
887
-
888
- ## Wireframe & Canvas Core
889
-
890
- This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
891
- the single source of truth for how wireframes and the canvas work. Do not
892
- paraphrase it per command.
893
-
894
- **A wireframe is an HTML mockup. The renderer owns the look; you write the
895
- content.** Set \`data.html\` to a self-contained, semantic HTML fragment of the
896
- screen and set \`data.surface\`. The renderer owns the surface footprint/aspect,
897
- the dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you
898
- never write \`<html>\`/\`<body>\`/\`<script>\`/\`<style>\` tags, font-family, hex colors,
899
- or any width/height/coordinates. You write real HTML layout and real product
900
- content; the renderer styles and roughens it.
901
-
902
- **A wireframe block's data is an HTML screen plus a surface:**
903
-
904
- \`\`\`json
905
- {
906
- "surface": "browser",
907
- "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>"
908
- }
909
- \`\`\`
910
-
911
- **Write PLAIN semantic HTML and let the renderer style it.** Bare elements
912
- (\`h1\`/\`h2\`/\`h3\`, \`p\`, \`button\`, \`input\`, \`<input type="checkbox">\`, \`a\`, \`hr\`)
913
- are auto-themed — no classes needed. Helper classes carry the rest:
914
-
915
- - \`.wf-card\` / \`.wf-box\` — a bordered, padded container (a panel, a list item).
916
- - \`.wf-pill\` / \`.wf-chip\` — a rounded tag or filter; add \`.accent\`
917
- (\`<span class="wf-pill accent">\`) for the accent-filled variant.
918
- - \`.wf-muted\` — secondary/muted text (or use \`<small>\`).
919
- - \`button.primary\` or any element with \`[data-primary]\` — the accent-filled
920
- primary button.
723
+ - **Gate hard.** A polished visual plan is the most expensive plan form; only
724
+ invest when a wrong direction is costly. Skip it for trivial, unambiguous work
725
+ typos, one-line fixes, a single well-specified function, anything whose diff
726
+ you could describe in one sentence — and just make the change. Never pad a plan
727
+ with filler and never ship a single-step plan.
728
+ - **Research before you draft.** Read the real files, actions, schema, and
729
+ patterns first; name actual files, symbols, and data shapes instead of
730
+ inventing them. Check existing \`actions/\` before proposing endpoints and prefer
731
+ named client helpers over raw fetch. Delegate wide exploration to a sub-agent.
732
+ - **Preserve existing plans.** If the user pasted, referenced, or already has a
733
+ Codex / Claude Code / Markdown plan, treat it as source material. Preserve its
734
+ intent, do not invent codebase facts, label inferred visuals as inferred, and
735
+ build the visual review structure around the plan the user already has.
736
+ - **Planning is read-only.** Make no source edits while building or reviewing the
737
+ plan. Start editing only after the user approves the direction.
738
+ - **Clarify vs. assume.** Do not ask how to build it — explore and present the
739
+ approach and options in the plan. Ask a clarifying question only when an
740
+ ambiguity would change the design and you cannot resolve it from the code; use
741
+ the host agent's normal ask-user-question flow and batch 2-4 high-leverage
742
+ questions before finalizing. Do not call \`create-visual-questions\` from
743
+ \`/visual-plan\`; keep any answerable follow-up inside the plan itself as a
744
+ bottom \`question-form\` Open Questions block. Otherwise state the assumption
745
+ explicitly and proceed, and put anything unresolved in an open-questions block.
746
+ - **The plan is the approval gate.** After surfacing it, ask the user to review
747
+ and approve before you write code, and name which files/areas the work touches.
748
+ Presenting the plan and requesting sign-off is the approval step — do not ask a
749
+ separate "does this look good?" question.
750
+ - **The document is the source of truth, not the chat.** When scope shifts,
751
+ update the plan with \`update-visual-plan\` rather than only changing course in
752
+ chat, and re-read the approved plan before major steps.
921
753
 
922
- **Use the \`--wf-*\` tokens for any custom color, never hex.** The renderer flips
923
- these on light/dark, so reading them is what keeps a mockup correct in both
924
- themes. For any inline border, background, or text color, reference a token:
925
- \`style="border:1.4px solid var(--wf-line)"\`. The tokens are \`--wf-ink\` (text),
926
- \`--wf-muted\` (secondary text), \`--wf-line\` (borders/dividers), \`--wf-paper\`
927
- (page background), \`--wf-card\` (raised surface), \`--wf-accent\` /
928
- \`--wf-accent-fg\` / \`--wf-accent-soft\` (brand action), \`--wf-warn\`, \`--wf-ok\`,
929
- and \`--wf-radius\`. Never hard-code a hex color and never set \`font-family\` — the
930
- renderer owns the sketch/clean font.
754
+ ## Core Workflow
931
755
 
932
- **Lay out with inline \`style\` flex/grid.** You write the real layout —
933
- \`display:flex; flex-direction:column; gap:10px; padding:16px\` and so on and the
934
- renderer never repositions anything. Compose the actual product: reproduce the
935
- current screen, then show the modification. Real labels, real counts, real dates,
936
- real button text grounded in the screen you read; not lorem or gray bars.
756
+ 1. Follow the host agent's normal planning flow: inspect the codebase, delegate
757
+ wide exploration when useful, gather the info needed, and ask native
758
+ clarifying questions as needed before generating the plan. If a source plan
759
+ already exists, gather its exact text from the user's paste, a referenced
760
+ file, or recent visible agent context; do not invent source text.
761
+ 2. Decide whether the plan needs a top visual surface with the rules below, then call
762
+ \`create-visual-plan\` with the title, brief, source, repo path, and structured
763
+ \`content\` blocks. When a source plan already exists, pass it as \`planText\`
764
+ and preserve the original plan's intent while adding structured review
765
+ content.
766
+ 3. Compose or enrich any top UI/product visual surface from the kit and write the
767
+ document with native blocks (see the cores below). Keep the document close to
768
+ the Markdown plan the agent would normally output, or to the existing plan
769
+ when one was provided. For architecture, backend, refactor, API, data-model,
770
+ migration, or code plans, usually omit \`content.canvas\` and
771
+ \`content.prototype\`; put \`diagram\`, \`mermaid\`, \`api-endpoint\`,
772
+ \`openapi-spec\`, \`data-model\`, \`diff\`, \`file-tree\`, \`json-explorer\`,
773
+ \`annotated-code\`,
774
+ \`implementation-map\` and \`code-tabs\` blocks directly next
775
+ to the relevant prose. Skip the top visual surface for non-visual work.
776
+ 4. Surface the returned Plans link or inline MCP App and ask the user to review.
777
+ Always include the actual URL in chat so the next step is a click in CLI or
778
+ other text-only hosts. When the host exposes an embedded browser/preview panel
779
+ and a tool can open arbitrary URLs there, open the returned plan URL
780
+ automatically for convenient review; do not rely on this as the only handoff.
781
+ Treat that browser open as a convenience and smoke test, not as the access
782
+ model. Plans should load out of the box for the local agent and local browser
783
+ session; if a signed-in embedded browser cannot read a local plan that an
784
+ anonymous/tool check can read, fix the app/action ownership or access path
785
+ rather than patching one plan by hand.
786
+ 5. Call \`get-plan-feedback\` before editing, after review, after any long pause,
787
+ and before the final response. Treat \`anchorDetails\`, resolver intent, recent
788
+ review events, and any focused screenshots from browser handoff as the source
789
+ of truth for exactly what changed and exactly what each comment points at.
790
+ 6. Apply changes with \`update-visual-plan\`, preferring targeted \`contentPatches\`.
791
+ When the user wants source-control friendly edits, use
792
+ \`patch-visual-plan-source\` against the MDX files instead of regenerating the
793
+ plan.
794
+ 7. Export with \`export-visual-plan\` only when the user wants a shareable receipt
795
+ or repo-check-in artifacts.
937
796
 
938
- **Surface presets match the real footprint, never default to desktop+mobile.**
939
- Pick the \`surface\` that matches what the user will actually see:
797
+ ## Visual Surface Choice
940
798
 
941
- - \`browser\`: a web page that needs a browser chrome frame around it.
942
- - \`desktop\`: a full desktop app page or app shell.
943
- - \`mobile\`: a phone screen, only when the work is genuinely mobile.
944
- - \`popover\`: a small floating menu, dropdown, or inline popover.
945
- - \`panel\`: a side panel, inspector, or sidebar widget.
799
+ Choose the surface before creating the plan or after reading the source plan. Do
800
+ not add visual chrome by default:
946
801
 
947
- The surface locks the footprint and aspect; never set width/height/coordinates.
948
- A sidebar popover renders as a small surface, not a desktop page and a phone
949
- frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
950
- actually changes the layout. For a component or widget, show one broader
951
- app-context frame only when placement affects understanding, then the focused
952
- component states.
802
+ - **No visual surface** for architecture-only, backend-only, data migration,
803
+ copy-only, or otherwise non-visual plans. Do not use the top canvas for
804
+ architecture diagrams, dependency maps, file plans, API contracts, or
805
+ data-flow-only reviews. Use a strong document with local inline diagrams
806
+ only when relationships need a visual explanation, usually one spatial diagram
807
+ per recommendation or decision. Prefer grouped regions, layers, quadrants,
808
+ matrices, or before/after panels over a single-axis chain unless the
809
+ relationship is truly sequential.
810
+ - **Canvas only** for one static screen, a before/after comparison, a component
811
+ state, a small popover, or a visual direction that does not require clicking.
812
+ Put those wireframes in \`content.canvas\` and omit \`content.prototype\`.
813
+ - **Canvas + prototype** for multi-step UI flows, onboarding, wizards,
814
+ review/approval flows, navigation changes, or anything where the reviewer
815
+ needs to operate the behavior. Keep the static wireframes in
816
+ \`content.canvas\`, add the aligned functional prototype in
817
+ \`content.prototype\`, and rely on the top visual tabs to switch between them.
818
+ - **Prototype-first** when the user explicitly asks for \`/prototype-plan\`, asks
819
+ to operate the UI, or when interaction is the main question. Use
820
+ \`create-prototype-plan\`, which still preserves static mocks where useful.
953
821
 
954
- **Modify, don't redesign.** When the task changes an existing screen, reproduce
955
- the current screen's real layout and footprint FIRST, then change only the delta
956
- and call it out with a single annotation. Do not restack the page into a new
957
- layout. For net-new surfaces, compose from the real app shell.
822
+ For mixed canvas + prototype plans, reuse the same real labels, app statuses,
823
+ and screen ids across both surfaces. The canvas is the inspectable static reference;
824
+ the prototype is the interactive version of that same flow, not a separate
825
+ design direction.
958
826
 
959
- **Classify mockup scope before implementation.** Before turning a plan mockup
960
- into source code, decide whether each artboard represents the whole page/app
961
- shell, a route body inside an existing shell, or a component/sub-surface. If an
962
- artboard includes navigation, sidebars, auth banners, or a signup/login form,
963
- map those pieces to the real shared shell/auth components instead of nesting the
964
- entire mockup inside the current page. When a mockup references the product's
965
- standard signup/login page, find and reuse that existing implementation; do not
966
- approximate it from the wireframe.
827
+ ## Wireframe & Canvas Core
967
828
 
968
- **Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a
969
- popover, menu, dialog, toast), show the full screen once, then add a small
970
- separate artboard whose \`html\` contains ONLY that sub-surface do not re-draw
971
- the whole page around it, and do not scale a duplicate up. Pick the matching
972
- \`surface\` (e.g. \`popover\`) so the footprint is right; never widen a popover to
973
- page width.
829
+ This section is shared by \`/visual-plan\` and \`/ui-plan\`, and is the single
830
+ source of truth for how wireframes and the canvas work. The wireframe-quality
831
+ rules below are additionally shared, word for word, with \`/visual-recap\`; the
832
+ canvas/artboard mechanics apply only to \`/visual-plan\` and \`/ui-plan\`. Do not
833
+ paraphrase any of it per command.
974
834
 
975
- **Loading / skeleton states.** Set \`data.skeleton: true\` on the wireframe and
976
- fill the \`html\` with neutral, textless placeholder geometry — boxes and bars
977
- built as \`<div>\`s with \`background:var(--wf-line)\` and explicit heights/widths,
978
- no labels or copy. The renderer drops borders, sketch, and color into the
979
- skeleton register automatically. Never escape to a \`custom-html\` document block
980
- to fake a loader, and never move a mockup out of the canvas — mockups always
981
- live in canvas artboards.
835
+ ${WIREFRAME_QUALITY_CORE}
982
836
 
983
- **Editing an existing mockup.** To change one element, text, or color in an
984
- existing html mockup, do NOT regenerate the frame — call \`update-visual-plan\`
985
- with \`contentPatches: [{ op: "patch-wireframe-html", blockId, edits: [{ find,
986
- replace }] }]\`. Each \`find\` is a unique snippet of the current html (read it
987
- first with \`get-visual-plan\`); set \`all: true\` on an edit to replace every
988
- occurrence. The result is re-sanitized.
837
+ ${CANVAS_SURFACE_CORE}
989
838
 
990
- **Canvas annotations are designer notes on the artboard.** When a top canvas is
991
- present, sprinkle Figma-style notes near the frames they explain: a short
992
- heading, supporting text, and bullets — plain text layers, never bordered or
993
- shadowed cards, and never a box around a frame. The renderer spaces notes away
994
- from frames, so place each note by the frame it describes. Use an arrow only to
995
- point at one specific control or transition; for a broad frame-level note, write
996
- text beside the frame with no connector. Connectors are for real sequences only —
997
- never fake "Step 1 → Step 2" lines between independent states.
839
+ ## Document Quality Core
998
840
 
999
- **Do not create overlapping annotations.** Anchor each note to the frame it
1000
- explains with \`targetId\` + \`placement\` (top/right/bottom/left). The renderer
1001
- parks notes in a gutter beside the frame and lays them out automatically — never
1002
- supply x/y or points for anchored notes; hand-placed coordinates fight the
1003
- auto-layout and cause the overlap you're trying to avoid. Reserve arrows for a
1004
- note that must point at a specific control inside a frame; a note that simply
1005
- sits beside its frame needs no arrow.
841
+ This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
842
+ the single source of truth for the document below the canvas. Do not paraphrase
843
+ it per command.
1006
844
 
1007
- **Patching.** Edit one wireframe, canvas annotation, or block with targeted \`contentPatches\`
1008
- (for example \`update-block\`, \`replace-blocks\`, \`update-canvas-annotation\`) rather
1009
- than regenerating the whole plan. \`contentPatches\` are part of the public MCP
1010
- action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
1011
- edits. If an agent is working from exported source files, use
1012
- \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
1013
- frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
1014
- \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
1015
- patch action normalizes the MDX back into the same JSON runtime model. JSON is
1016
- the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
1017
- In the browser, humans edit \`rich-text\` prose inline; agents should still use
1018
- \`update-rich-text\` content patches or source patches for prose, and use
1019
- comments/structured patches for canvas, artboard, wireframe, and diagram edits.
845
+ ${DOCUMENT_QUALITY_CORE}
1020
846
 
1021
- **Never emit a titled artboard with no interior wireframe content.** Every artboard
1022
- you place on the canvas must carry an \`html\` wireframe or reference a wireframe
1023
- block via \`blockId\`; when using \`blockId\`, the referenced \`wireframe\` /
1024
- \`legacy-wireframe\` block must remain in the plan. If you remove a duplicate
1025
- wireframe from the document body, first move its \`data\` inline onto the
1026
- corresponding \`content.canvas.frames[*].wireframe\` / \`legacyWireframe\`. A
1027
- label-only frame or a frame pointing at a deleted block renders empty and is
1028
- rejected at parse time. If you only have a title, write it as a section header or
1029
- annotation, not an empty artboard.
847
+ ## Good vs. Bad Exemplar
1030
848
 
1031
- **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).
849
+ ${EXEMPLAR_CORE}
1032
850
 
1033
- **Good example — a contacts list, surface \`browser\`.** A small, real screen
1034
- composed from the helper classes and tokens, layout in inline flex, no fonts or
1035
- hex colors:
851
+ ## Tool Guidance
1036
852
 
1037
- \`\`\`html
1038
- <div
1039
- style="display:flex;flex-direction:column;gap:12px;padding:16px;height:100%"
1040
- >
1041
- <div style="display:flex;align-items:center;justify-content:space-between">
1042
- <h1>Contacts</h1>
1043
- <button class="primary">New contact</button>
1044
- </div>
1045
- <div style="display:flex;gap:6px">
1046
- <span class="wf-pill accent">All 128</span>
1047
- <span class="wf-pill">Favorites</span>
1048
- <span class="wf-pill">Archived</span>
1049
- </div>
1050
- <div
1051
- class="wf-card"
1052
- style="display:flex;flex-direction:column;gap:0;padding:0"
1053
- >
1054
- <div
1055
- style="display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)"
1056
- >
1057
- <div
1058
- style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"
1059
- ></div>
1060
- <div style="flex:1">
1061
- <strong>Jane Cooper</strong><br /><small>jane@acme.co</small>
1062
- </div>
1063
- <span class="wf-pill">Lead</span>
1064
- </div>
1065
- <div style="display:flex;align-items:center;gap:10px;padding:10px 12px">
1066
- <div
1067
- style="width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)"
1068
- ></div>
1069
- <div style="flex:1">
1070
- <strong>Marcus Lee</strong><br /><small>marcus@globex.io</small>
1071
- </div>
1072
- <span class="wf-pill">Customer</span>
1073
- </div>
1074
- </div>
1075
- </div>
853
+ - \`create-visual-plan\`: start one structured visual plan per agent task/run, or
854
+ import an existing text plan by passing \`planText\`; \`content\` may include no
855
+ visual surface, canvas only, or canvas + prototype.
856
+ - \`create-ui-plan\`: start a UI-first plan when the work is primarily product UI.
857
+ - \`create-prototype-plan\`: start a prototype-first plan with a functional top
858
+ review surface.
859
+ - \`create-plan-design\`: start a full-fidelity branded Design-tab plan with an
860
+ optional matching Prototype tab.
861
+ - \`convert-visual-plan-to-prototype\`: convert an existing HTML wireframe canvas
862
+ into a prototype plan.
863
+ - \`create-visual-questions\`: use only for the explicit \`/visual-questions\`
864
+ command, not as \`/visual-plan\` preflight.
865
+ - \`update-visual-plan\`: revise content, status, or comments; prefer
866
+ \`contentPatches\` over regenerating the whole plan.
867
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
868
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
869
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
870
+ artboard, annotation, component, or wireframe-node id.
871
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
872
+ - \`get-visual-plan\`: read the current structured plan, exported HTML, and
873
+ annotations; it also returns the MDX folder for source workflows.
874
+ - \`get-plan-feedback\`: read unconsumed human feedback. Use it frequently; it
875
+ returns grouped threads, exact anchor details, expected resolver, and recent
876
+ review-event payloads so agents can act only on the comments meant for them.
877
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
878
+ files for repo check-in.
879
+
880
+ When the user critiques a plan's look or structure, fix the renderer or this
881
+ skill — never hand-edit one stored plan. Turn feedback into better guidance.
882
+
883
+ ## Setup & Authentication
884
+
885
+ There are two ways into Plans.
886
+
887
+ **Coding agent (CLI).** Install once with the Agent-Native CLI. The command
888
+ installs the Plans skills, registers the hosted Plans MCP connector, and
889
+ authenticates it in the same step (a one-time browser sign-in at setup — this is
890
+ intended), so the first tool call does not hit an OAuth wall:
891
+
892
+ \`\`\`bash
893
+ agent-native skills add visual-plan
1076
894
  \`\`\`
1077
895
 
1078
- **UI mockups belong in the top visual review area.** Static UI/product visuals
1079
- live on the canvas; multi-step UI flows get both canvas wireframes and a
1080
- prototype. When the user asks for a mockup, UI state, loading state, layout,
1081
- screen, or visual comparison, make the canvas the primary home for that static
1082
- visual. When the user asks for a prototype or the plan contains a sequence the
1083
- reviewer must feel, keep the canvas artboards and add \`content.prototype\` so the
1084
- top surface shows Wireframes / Prototype tabs. Architecture/code diagrams are
1085
- different: keep them inline in the document, close to the recommendation they
1086
- support, unless the user explicitly asks for a spatial board. Document blocks
1087
- can explain, compare, or map implementation, but they should not host the
1088
- primary UI mockup or prototype just because \`custom-html\`, screenshots, or prose
1089
- are easier to produce. If the canvas/prototype surface cannot represent the
1090
- requested UI fidelity, still keep the closest top-surface representation and
1091
- call out or extend the needed renderer capability.
896
+ After that, \`/visual-plan\` (and \`/visual-recap\`, \`/ui-plan\`,
897
+ \`/prototype-plan\`, \`/plan-design\`, \`/visual-questions\`) generate a plan and open
898
+ the editor. Pass \`--no-connect\` to
899
+ register the connector without authenticating, then run
900
+ \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1092
901
 
1093
- **Legacy kit tree.** Older plans set a \`screen\` array of \`{ el, ...props }\` kit
1094
- nodes instead of \`html\`; the renderer still accepts and displays it, but new
1095
- plans emit \`html\`. Do not author fresh kit-tree screens write the HTML mockup
1096
- instead. Likewise, old or imported plans may carry coordinate-based regions or
1097
- free-float x/y on notes or artboards; those are legacy escape hatches the
1098
- renderer still shows but you must never produce. The \`surface\` drives the aspect
1099
- and footprint, the canvas auto-places artboards, and the gutter parks notes by
1100
- \`targetId\` + \`placement\`; never supply width, height, or coordinates for a new
1101
- plan.
902
+ **Browser (people you share with).** Open the Plans editor and create & edit
903
+ with no sign-up you work as a guest. Sign in only when you want to save or
904
+ share; signing in claims the plans you made as a guest into your account.
1102
905
 
1103
- <!-- SHARED-CORE:wireframe-canvas END -->
906
+ Sharing and commenting require an account: public/shared plans are viewable by
907
+ anyone with the link, but commenting on them needs an agent-native account.
1104
908
 
1105
- <!-- SHARED-CORE:document-quality START -->
909
+ For fully offline, no-account use, run the Plans app locally and sync plans to
910
+ your repo as MDX. This local mode is a separate advanced path, not the default
911
+ hosted flow.
1106
912
 
1107
- ## Document Quality Core
913
+ If a Plans tool returns \`needs auth\`, \`Unauthorized\`, or \`Session terminated\`,
914
+ do not keep retrying the tool. Authenticate the connector with
915
+ \`agent-native connect https://plan.agent-native.com\` (OAuth-capable hosts can
916
+ instead re-run /mcp and choose Authenticate), then continue once the connector
917
+ is available.
1108
918
 
1109
- This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
1110
- the single source of truth for the document below the canvas. Do not paraphrase
1111
- it per command.
919
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
920
+ not put shared secrets in skill files.
921
+ `;
922
+ export const UI_PLAN_SKILL_MD = `---
923
+ name: ui-plan
924
+ description: >-
925
+ Use Agent-Native Plans for UI-first planning with an optional top pan/zoom
926
+ wireframe canvas, a refined Notion-like document, rich tabs, diagrams,
927
+ comments, drawing, and agent handoff.
928
+ metadata:
929
+ visibility: exported
930
+ ---
1112
931
 
1113
- **The document is a serious technical plan, not marketing.** Write it the way a
1114
- strong Claude or Codex implementation plan reads: outcome-first, prose-first,
1115
- self-contained, and specific. State the objective and what "done" means, the
1116
- scope and non-goals, the proposed approach with the key decisions and their
1117
- rationale, ordered steps that name real files, symbols, actions, and data
1118
- shapes, the risks, and a closing verification step (tests, build, or a checkable
1119
- behavior). Replace vague prose with specifics; never ship a step like "make it
1120
- work." No hero art, gradients, logos, nav bars, slogans, value props, giant
1121
- landing-page headings, or marketing cards unless the user explicitly asks.
932
+ # UI Plan
1122
933
 
1123
- **When top visuals exist, they and the document never duplicate each other.**
1124
- For UI work, the UI story lives in the top visual surface: canvas artboards for
1125
- static inspection, plus prototype tabs when the flow should be functional. The
1126
- document carries the technical depth the visuals cannot show — concrete
1127
- file/symbol maps, API and data contracts, code snippets, migration or
1128
- implementation phases, risks, and validation. For architecture/code reviews,
1129
- invert that: the document is the visual surface, and each recommendation should
1130
- carry its own nearby inline \`diagram\` / \`data-model\` block plus file evidence
1131
- and terse Problem/Solution/Why text. For architecture/code diagrams, prefer
1132
- standard two-dimensional layouts: paired before/after panels, layered diagrams,
1133
- swimlanes, dependency maps, matrices, or grouped regions. Do not default to
1134
- left-to-right chains; use a line only when the relationship is truly a sequence.
1135
- Use native \`diagram\` blocks with \`data.html\` / \`data.css\` for these richer
1136
- layouts; the fragment may use semantic HTML and inline SVG, and the renderer
1137
- applies the viewer's sketch/clean style. Legacy \`nodes\` / \`edges\` are only for
1138
- tiny previews or genuinely linear step flows. Repeat a wireframe in the document
1139
- only for a genuinely new detail view or comparison. Skip the visual surface
1140
- entirely for non-visual work and write a clean rich document. For a simple
1141
- binary UI visual choice, show the two directions in the canvas only; do not
1142
- repeat the same options as body wireframes, a \`decision\` block, or prose. Put
1143
- the actual choice in the bottom "Open Questions" form.
934
+ Use \`/ui-plan\` when the task is primarily about product UI, user flows,
935
+ interaction details, component layout, or visual direction. The reviewable UI
936
+ comes first; implementation detail comes after the user has something concrete to
937
+ react to.
1144
938
 
1145
- **Use the right block, and make it carry substance.** For the authoritative,
1146
- machine-checked list of block types and their data schemas, call \`get-plan-blocks\`
1147
- it returns the live registry vocabulary (type, MDX tag, placement, key fields)
1148
- so you never emit a block the editor cannot render or round-trip:
939
+ \`/visual-plan\` remains the general command for architecture, backend, refactors,
940
+ and mixed work. Use \`/prototype-plan\` when the UI review needs a functional live
941
+ prototype instead of static screens. Use \`/plan-design\` when polish, brand, or
942
+ visual fidelity are material to the decision. Use \`/visual-questions\` only when
943
+ the user explicitly wants visual intake before planning. Use \`/visual-plan\` when
944
+ a text plan already exists and should become the source material for the review.
1149
945
 
1150
- - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
1151
- - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
1152
- symbols/components to touch, the reason, risk/coordination notes, and a
1153
- concise syntax-highlighted snippet of the code shape in every file tab —
1154
- never the whole file, never a prose-only file list. If the exact code is not
1155
- known yet, include the smallest plausible planned shape or a short comment
1156
- stub that names what needs to be filled in.
1157
- - \`decision\` for two or three option cards with consequences. These are static
1158
- records; do not style them like clickable tabs or chips unless the renderer
1159
- truly supports changing the selection.
1160
- - \`diagram\` for two-dimensional architecture, dependency, data-flow, or state
1161
- relationships, only when it clarifies something real. For architecture/code
1162
- diagrams, prefer \`data.html\` / \`data.css\` with semantic HTML and inline SVG so
1163
- the diagram can use panels, layers, matrices, arrows, annotations, and
1164
- responsive layout directly. Use legacy \`nodes\` / \`edges\` only for small
1165
- previews or truly sequential flows. In architecture/code plans, prefer a
1166
- repeated section rhythm: recommendation title, confidence and category badges,
1167
- code-path evidence, a local before/after or current/target spatial diagram,
1168
- then concise Problem/Solution/Why text. Labels must not overlap nodes,
1169
- connectors, or each other.
1170
- - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
1171
- only prose usually means the plan is under-specified — include a relevant
1172
- visual unless the tab is intentionally document-only.
1173
- - \`table\`, \`checklist\`, \`callout\` for scannable structure.
946
+ ## Plan Discipline
1174
947
 
1175
- **Open questions live at the bottom as a form when answers would change the
1176
- plan.** Surface answerable unresolved decisions in a final \`question-form\`
1177
- block titled "Open Questions" so the renderer presents it as a distinct section.
1178
- Use \`single\` or \`multi\` for clear choices, \`freeform\` for constraints,
1179
- \`recommended: true\` for the default you would pick, and option \`wireframe\` /
1180
- \`diagram\` previews only when the options are not already visible in the top
1181
- canvas. Keep non-answerable assumptions or risks as concise \`callout\` blocks in
1182
- the relevant section. Never bury a questions/decisions wall inside the plan
1183
- narrative, and never ask the same question in both a \`decision\` block and a
1184
- \`question-form\`.
948
+ - **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several
949
+ screens or states, or the direction needs agreement before coding. Skip it for
950
+ cosmetic one-liners a color, a label, a spacing tweak and just make the
951
+ change. Never ship a single-step or filler plan.
952
+ - **Research before you draft.** Read the real components, routes, and design
953
+ tokens first; ground every mockup and the file map in actual files and symbols.
954
+ Delegate wide exploration to a sub-agent when the surface is large.
955
+ - **Planning is read-only.** Make no source edits while building or reviewing.
956
+ Start editing only after the user approves the UI direction.
957
+ - **Clarify vs. assume.** Do not ask how to build the UI — present the direction
958
+ and options as mockups and tabs. Ask a clarifying question only when an
959
+ ambiguity would change the design; use the host agent's normal
960
+ ask-user-question flow and batch 2-4 before finalizing. Do not call
961
+ \`create-visual-questions\` from \`/ui-plan\`; keep answerable follow-up inside
962
+ the same plan as a bottom \`question-form\` Open Questions block. Otherwise
963
+ state the assumption in the plan and proceed.
964
+ - **The plan is the approval gate.** Ask the user to review and approve the UI
965
+ direction before you write code, and name the files/areas the work touches.
1185
966
 
1186
- **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
1187
- inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a generic
1188
- placeholder, density demo, or proof that custom HTML works. Prefer the native
1189
- blocks for normal plans. For architecture/code reviews, use \`diagram\`
1190
- \`data.html\` / \`data.css\` for rich local HTML/SVG diagrams instead of
1191
- \`custom-html\`. For UI/product work, \`custom-html\` is never the primary home for a
1192
- requested mockup, UI state, or visual comparison. If UI fidelity requires
1193
- HTML/CSS, image capture, or real React/CSS, the product fix is canvas support
1194
- for that artifact type, not moving the mockup into the document.
967
+ ## UI-First Workflow
1195
968
 
1196
- **Before handoff, open the plan and check it.** Fix overlap, excessive
1197
- whitespace, clipped fragments, misleading inactive controls, poor contrast, and
1198
- unreadable diagrams before asking for approval.
969
+ 1. Follow the host agent's normal planning flow: inspect the codebase, gather
970
+ the UI/component context needed, and ask native clarifying questions as needed
971
+ before generating the plan.
972
+ 2. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path, and
973
+ structured \`content\`. The canvas comes first, the document second.
974
+ 3. Compose the top canvas from the kit (see the cores below): the key artboards
975
+ with real product content, designer notes, and connectors only for real
976
+ sequences. Skip the canvas when wireframes would not clarify the work.
977
+ 4. Continue below as a concise technical document that stays close to the
978
+ Markdown plan the agent would normally output — not a second copy of the
979
+ canvas — covering concrete files, contracts, phases, risks, and validation.
980
+ 5. Call \`get-plan-feedback\` before implementation, after review, after a long
981
+ pause, and before the final response. Treat \`anchorDetails\`, resolver intent,
982
+ recent review events, and any focused screenshots from browser handoff as the
983
+ source of truth for exactly what changed and exactly what each UI comment
984
+ points at. Apply changes with \`update-visual-plan\`, preferring
985
+ \`contentPatches\` for one frame, annotation, node, tab, or block. When the
986
+ user wants source-control friendly edits, use \`patch-visual-plan-source\`
987
+ against the MDX files instead of regenerating the plan.
988
+
989
+ ## Agent Handoff
990
+
991
+ After the canvas and document, add a short handoff that names the chosen UI
992
+ direction, unresolved visual questions, and feedback that must be read before
993
+ code changes. Never claim feedback has been applied until \`get-plan-feedback\` or
994
+ the user has supplied it.
1199
995
 
1200
- <!-- SHARED-CORE:document-quality END -->
996
+ ## Wireframe & Canvas Core
1201
997
 
1202
- <!-- SHARED-CORE:exemplar START -->
998
+ This section is shared by \`/visual-plan\` and \`/ui-plan\`, and is the single
999
+ source of truth for how wireframes and the canvas work. The wireframe-quality
1000
+ rules below are additionally shared, word for word, with \`/visual-recap\`; the
1001
+ canvas/artboard mechanics apply only to \`/visual-plan\` and \`/ui-plan\`. Do not
1002
+ paraphrase any of it per command.
1203
1003
 
1204
- ## Good vs. Bad Exemplar
1004
+ ${WIREFRAME_QUALITY_CORE}
1205
1005
 
1206
- **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard whose
1207
- \`data.html\` is a real flex layout — a sidebar of links (\`Inbox 12\`, \`Today 4\`,
1208
- \`Done\`), a main column with an \`<h1>Today</h1>\`, accent \`.wf-pill\`s for the
1209
- filters, a muted section label \`OVERDUE\`, and \`.wf-card\` task rows carrying real
1210
- titles, due dates, and a primary \`button.primary\` — styled only through bare
1211
- elements, helper classes, and \`--wf-*\` tokens, so the renderer applies the
1212
- correct desktop footprint, theme, and one subtle whole-frame wobble. Plain-text
1213
- designer notes sit spaced off the frame, pointing only at the controls that need
1214
- explanation. Below it, a Claude/Codex-grade document: objective and
1215
- done-criteria, an \`implementation-map\` naming the real components and actions
1216
- with short highlighted snippets, a \`decision\` card weighing two real approaches,
1217
- and a validation step — none of it repeating the canvas. If the task also
1218
- changes a multi-step completion flow, the same top area includes a Prototype tab
1219
- whose screens use the same labels and states as the canvas artboards, with
1220
- \`data-goto\` controls for the sequence. This is the bar.
1006
+ ${CANVAS_SURFACE_CORE}
1221
1007
 
1222
- **GOOD.** A \`/visual-plan\` for a backend architecture review: no top canvas.
1223
- The document opens with context and a legend, then repeats recommendation cards:
1224
- title, confidence/category badges, a monospace grid of real file paths, one
1225
- inline two-dimensional before/after or layered architecture diagram, and terse
1226
- Problem/Solution/Why bullets using the codebase's vocabulary. The diagram uses
1227
- space to show boundaries, layers, and ownership; it is not a default
1228
- left-to-right chain. The plan ends with a top recommendation and a bottom
1229
- question-form only if the next architecture direction is genuinely open. This is
1230
- better than a top canvas because each diagram is local to the claim it supports.
1008
+ ## Document Quality Core
1231
1009
 
1232
- **BAD.** A \`data.html\` with hard-coded hex colors, a \`font-family\`, or fixed
1233
- pixel width/height; gray placeholder bars "insinuating" text on a non-skeleton
1234
- frame; a forced desktop + mobile pair for a popover; floating bordered
1235
- annotation cards hugging the frames; a fresh hand-authored kit-tree \`screen\`
1236
- instead of \`html\`; a multi-step UI flow with only static frames and no prototype
1237
- tab; a mockup escaped into a document \`custom-html\` block; and a marketing-style
1238
- document with a hero heading and value props that just restates what the canvas
1239
- already shows. Also bad: an architecture-only plan forced into a top canvas of
1240
- labeled boxes with overlapping text, where the actual code evidence and
1241
- recommendations live elsewhere. Never produce this.
1010
+ This section is shared, word for word, by \`/visual-plan\` and \`/ui-plan\`. It is
1011
+ the single source of truth for the document below the canvas. Do not paraphrase
1012
+ it per command.
1013
+
1014
+ ${DOCUMENT_QUALITY_CORE}
1015
+
1016
+ ## Good vs. Bad Exemplar
1242
1017
 
1243
- <!-- SHARED-CORE:exemplar END -->
1018
+ ${EXEMPLAR_CORE}
1244
1019
 
1245
1020
  ## Tool Guidance
1246
1021
 
@@ -1284,8 +1059,9 @@ intended), so the first tool call does not hit an OAuth wall:
1284
1059
  agent-native skills add visual-plan
1285
1060
  \`\`\`
1286
1061
 
1287
- After that, \`/visual-plan\` (and \`/ui-plan\`, \`/prototype-plan\`, \`/plan-design\`,
1288
- \`/visual-questions\`) generate a plan and open the editor. Pass \`--no-connect\` to
1062
+ After that, \`/visual-plan\` (and \`/visual-recap\`, \`/ui-plan\`,
1063
+ \`/prototype-plan\`, \`/plan-design\`, \`/visual-questions\`) generate a plan and open
1064
+ the editor. Pass \`--no-connect\` to
1289
1065
  register the connector without authenticating, then run
1290
1066
  \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1291
1067
 
@@ -1576,6 +1352,273 @@ element details, and recent review events as the source of truth.
1576
1352
  - \`prototype-plan\`
1577
1353
  - \`frontend-design\`
1578
1354
  `;
1355
+ export const VISUAL_RECAP_SKILL_MD = `---
1356
+ name: visual-recap
1357
+ description: >-
1358
+ Use Agent-Native Plans to turn a code change, PR diff, or git diff into a
1359
+ visual recap plan for high-altitude review — schema, API, file, and
1360
+ before/after changes as grounded structured blocks instead of a wall of diff.
1361
+ metadata:
1362
+ visibility: exported
1363
+ ---
1364
+
1365
+ # Visual Recap
1366
+
1367
+ \`/visual-recap\` creates a visual plan built **from** a diff, not toward one. It
1368
+ is the reverse of forward planning: instead of describing the change you are
1369
+ about to make, you describe the change that was just made, at a higher altitude
1370
+ than line-by-line review. The same plan data model serves both directions —
1371
+ schema, API, file, and architecture changes become the same \`data-model\`,
1372
+ \`api-endpoint\`, \`file-tree\`, and \`diagram\` blocks a forward plan would use, only
1373
+ now they summarize work that exists. A reviewer scans the shape of the change
1374
+ before spending attention on the literal lines.
1375
+
1376
+ ## When To Use
1377
+
1378
+ Build a recap when a PR or commit is large, multi-file, or touches schema, API
1379
+ contracts, or architecture, and a reviewer would benefit from seeing the change
1380
+ mapped to structured blocks before reading the raw diff. A GitHub Action can
1381
+ generate one automatically from a PR diff; an agent can generate one on request
1382
+ ("recap this PR", "show me what this branch changed"). Skip it for small,
1383
+ single-file, or obvious diffs — a recap is review overhead, and a tiny change
1384
+ reviews faster as plain diff.
1385
+
1386
+ ## Recap The Whole Work Unit
1387
+
1388
+ When \`/visual-recap\` is invoked in a chat thread after work has already happened,
1389
+ the default scope is the whole current work unit/thread, not only the most recent
1390
+ user message, tool action, or follow-up fix. Gather the thread-owned changes
1391
+ across the conversation: original implementation work, later bug fixes, UI
1392
+ follow-ups, tests, changesets, skill/instruction updates, generated plan/source
1393
+ artifacts, and any local import/linking fixes needed to make the recap open.
1394
+
1395
+ Use the current diff plus conversation context to separate thread-owned changes
1396
+ from unrelated dirty work that existed before the thread. Exclude unrelated
1397
+ pre-existing edits. If the scope is genuinely ambiguous and cannot be inferred,
1398
+ state the assumption or ask a concise question before publishing.
1399
+
1400
+ When updating an existing recap after feedback, revise the recap so it still
1401
+ covers the whole thread/work unit plus the new correction. Do not replace a broad
1402
+ recap with a narrow recap of only the latest feedback unless the user explicitly
1403
+ asks for that narrower scope.
1404
+
1405
+ ## Keep The Recap Body Lean
1406
+
1407
+ Do not add boilerplate intro, disclaimer, provenance, or summary prose blocks to
1408
+ the generated plan body. In particular, do not create a \`rich-text\` block just to
1409
+ say the recap is an aid, that the reviewer should still review the diff, how many
1410
+ files changed, or which ref/working tree generated the recap. The plan title,
1411
+ brief, \`file-tree\`, and optional \`diffstat\` already carry that context.
1412
+
1413
+ Only add prose blocks when they tell the reviewer something specific about the
1414
+ change that the structured blocks do not: the objective, a real compatibility
1415
+ risk, an important decision visible in the diff, or a grounded review note.
1416
+
1417
+ ## UI Impact Needs Wireframes
1418
+
1419
+ When the diff changes rendered UI, layout, density, visual state, interaction
1420
+ affordances, navigation, controls, menus, dialogs, or design tokens, the recap
1421
+ MUST include one or more wireframes. Prose and file diffs are not a substitute
1422
+ for showing what changed visually.
1423
+
1424
+ Choose the smallest visual surface that makes the review clear:
1425
+
1426
+ - Use a \`Before\` / \`After\` wireframe pair when the reviewer benefits from direct
1427
+ comparison, such as a removed or added control, a changed state, layout
1428
+ density, ordering, navigation, or a visible component replacement. The
1429
+ Wireframe Quality core below owns how to lay that pair out (columns vs.
1430
+ vertical stack by geometry).
1431
+ - Use an after-only wireframe when the change is purely additive or the "before"
1432
+ state would only show absence without adding review value.
1433
+ - Use more than two wireframes when the UI change is flow-dependent, responsive,
1434
+ or stateful; show the meaningful states in order instead of forcing a single
1435
+ before/after pair.
1436
+ - For tiny surfaces like menus, popovers, dialogs, toasts, or panels, use the
1437
+ matching \`surface\` (\`popover\`, \`panel\`, etc.) and show the focused sub-surface.
1438
+ Do not redraw a full page unless placement in the page is itself part of the
1439
+ change.
1440
+
1441
+ Ground each wireframe in the changed UI behavior, component names, file paths,
1442
+ and diff-visible labels/states. If exact pixels are inferred rather than
1443
+ captured, say so in the wireframe caption or a concise annotation. For
1444
+ local/manual recaps, import or update the plan source that holds the wireframes
1445
+ so the rendered recap opens with the UI visual available.
1446
+
1447
+ ## Wireframe Quality
1448
+
1449
+ UI recap wireframes must look like the UI surface that changed, not like generic
1450
+ architecture boxes. The following bar is shared, word for word, with
1451
+ \`/visual-plan\` and \`/ui-plan\`: it is the single source of truth for HTML
1452
+ wireframe quality, and applies to a recap's standalone \`wireframe\` /
1453
+ \`WireframeBlock\` / \`<Screen>\` exactly as it applies to a plan's canvas artboard.
1454
+
1455
+ ${WIREFRAME_QUALITY_CORE}
1456
+
1457
+ Use the standard \`WireframeBlock\` / \`<Screen>\` format so the Plan viewer owns the
1458
+ surface frame, theme, and sketchy/clean toggle. HTML wireframes are appropriate
1459
+ when placement precision matters, especially popovers, menus, dialogs, and dense
1460
+ forms; kit-tree wireframes are appropriate for simpler layouts. For HTML
1461
+ wireframes, keep \`renderMode\` unset or \`wireframe\` unless a design-only editable
1462
+ mockup is explicitly required, because \`renderMode="design"\` disables the
1463
+ sketchy rough overlay.
1464
+
1465
+ Before sharing a UI-impact recap, render it in the Plan viewer and inspect it at
1466
+ the current theme. If any label, annotation, toolbar, or wireframe content
1467
+ overlaps another element, fix the MDX and re-import before reporting the link. A
1468
+ text-match screenshot is not enough; visually inspect the captured image.
1469
+
1470
+ ## Open And Report The Recap
1471
+
1472
+ After creating the recap, link the reviewer to the rendered plan with an
1473
+ **absolute URL**. Never make the primary link a local \`plan.mdx\` file, a local
1474
+ mirror folder, or a relative path such as \`/plans/<id>\`.
1475
+
1476
+ Resolve the URL in this order:
1477
+
1478
+ 1. When creating a recap for local edits and a running local/dev Plan app origin
1479
+ is known, prefer that local origin even if \`plan.mdx\` includes a hosted
1480
+ \`visualUrl\`, e.g. \`http://localhost:8081/plans/<id>\`.
1481
+ 2. Use the absolute \`visualUrl\` exported in \`plan.mdx\` frontmatter when present,
1482
+ e.g. \`https://plan.agent-native.com/plans/<id>\`.
1483
+ 3. If the action returns only a relative \`url\`/\`path\` and the running app origin
1484
+ is known, construct an absolute URL from that origin, e.g.
1485
+ \`http://localhost:5173/plans/<id>\`.
1486
+ 4. If only the plan id is available, build the hosted absolute URL
1487
+ \`https://plan.agent-native.com/plans/<id>\` and say if that URL was inferred.
1488
+
1489
+ When running in Codex and the Browser/in-app side browser tools are available,
1490
+ open the absolute recap URL there automatically after creation. Still include the
1491
+ same absolute URL in the final response. Local mirror files like
1492
+ \`plans/<slug>/plan.mdx\` may be mentioned only as secondary source-control
1493
+ artifacts, not as the main way to open the recap.
1494
+
1495
+ ## Diff → Block Mapping
1496
+
1497
+ Map each kind of change to the block that carries it, derived mechanically from
1498
+ the actual diff:
1499
+
1500
+ - **Schema / migration change** → \`data-model\` for the resulting entities,
1501
+ fields, and relations, plus a \`diff\` with \`mode: "split"\` for the literal SQL
1502
+ or schema text that changed. The \`data-model\` shows the new shape; the split
1503
+ \`diff\` shows exactly what moved.
1504
+ - **API / action / route change** → \`api-endpoint\` with the method, path,
1505
+ params, request, and responses as they are after the change. Mark removed
1506
+ endpoints with \`deprecated: true\` and explain in prose.
1507
+ Keep multiple API endpoints in the normal single-column document flow unless
1508
+ they are an explicit before/after contract comparison.
1509
+ - **Compatibility-sensitive change** → short \`rich-text\` notes beside the
1510
+ relevant \`data-model\` / \`api-endpoint\` block. Name the changed field,
1511
+ endpoint, or behavior and mark whether it is breaking, risky, or non-breaking;
1512
+ pair that note with a split \`diff\` for the literal lines.
1513
+ - **Any meaningful code hunk** → \`diff\` with \`mode: "split"\`, carrying the real
1514
+ \`before\` / \`after\` text and the \`filename\` / \`language\`. Split mode is the
1515
+ default for a recap because before/after legibility is the whole point.
1516
+ When several key files each need a substantial diff, group those \`diff\` blocks
1517
+ in a reusable \`tabs\` block with \`orientation: "vertical"\` so file labels form a
1518
+ left rail and the selected file's split diff renders on the right. Keep each
1519
+ tab label to the file path or a short basename plus directory hint.
1520
+ If the recap ends with more than one supporting diff, that trailing diff
1521
+ appendix should be one vertical \`tabs\` block, not a stack of separate \`diff\`
1522
+ blocks.
1523
+ - **Files added / removed / renamed** → \`file-tree\` with each entry's \`change\`
1524
+ flag (\`added\`, \`removed\`, \`modified\`, \`renamed\`) and a short \`note\`; attach a
1525
+ \`snippet\` only when one tells the reviewer something the path does not.
1526
+ - **Rendered UI / interaction change** → one or more wireframes showing the
1527
+ visible UI delta before the reviewer reads code. Use \`Before\` / \`After\`
1528
+ wireframes when the comparison clarifies the change; otherwise use after-only
1529
+ or a short state/flow sequence. Use realistic UI surfaces: for a popover
1530
+ change, show a popover with its title row, top-right actions, options/fields,
1531
+ and any opened prompt/menu anchored to the correct trigger. Keep the body lean:
1532
+ the wireframe carries the UI story, while the file tree and split \`diff\`
1533
+ blocks carry implementation evidence.
1534
+ - **Architecture or data-flow shift** → \`diagram\` with \`data.html\` / \`data.css\`
1535
+ as a two-panel before/after, layered, or swimlane layout, or \`mermaid\` for a
1536
+ quick graph. Use the two-dimensional layouts the Document Quality core
1537
+ prescribes; do not reduce a structural change to a left-to-right chain.
1538
+ Do not use \`diagram\` as a stand-in for rendered UI controls; UI changes need
1539
+ \`wireframe\` blocks.
1540
+ Diagram HTML/CSS should use renderer-owned primitives such as
1541
+ \`.diagram-panel\`, \`.diagram-card\`, \`.diagram-node\`, \`.diagram-box\`,
1542
+ \`.diagram-pill\`, \`.diagram-muted\`, and \`[data-rough]\`; these map to the plan's
1543
+ Tailwind theme variables through \`--wf-ink\`, \`--wf-muted\`, \`--wf-line\`,
1544
+ \`--wf-paper\`, \`--wf-card\`, \`--wf-accent\`, \`--wf-accent-soft\`, \`--wf-warn\`, and
1545
+ \`--wf-ok\`, and switch to Virgil plus rough.js outlines in sketchy mode. Do not
1546
+ set \`font-family\` and do not emit hex, rgb/hsl literals, or one-off dark/light
1547
+ palettes in diagram CSS.
1548
+ - **Outcome-first narrative** → \`rich-text\` for the "what changed and why" prose:
1549
+ the objective the diff served, the key decisions visible in it, and the risks a
1550
+ reviewer should weigh. This is the only place the model writes freely.
1551
+
1552
+ ## Before / After Is The Headline
1553
+
1554
+ The recap's center of gravity is the before/after comparison. For document-body
1555
+ comparisons there are two primitives, and they cover the whole need together:
1556
+
1557
+ - **\`columns\`** — the side-by-side container, for **structured** comparisons.
1558
+ Use two columns labeled \`Before\` and \`After\`, each holding a block (commonly a
1559
+ \`data-model\`, \`api-endpoint\`, or \`rich-text\`), so the reviewer reads the old
1560
+ shape against the new shape in one glance. This is the right primitive for
1561
+ "the schema went from X to Y" or "the endpoint contract changed like this."
1562
+ Do not use \`columns\` simply to compact or group a list of API endpoints.
1563
+ - **\`diff\` with \`mode: "split"\`** — for **code**. The split renders the literal
1564
+ removed and added lines side by side. Use it for the actual hunks.
1565
+
1566
+ For UI diffs, wireframes are the visual comparison primitive. Use before/after
1567
+ wireframes when the comparison clarifies the change; use after-only or a state
1568
+ sequence when that better matches the change. The visual headline must show
1569
+ exact placement, realistic chrome, and adequate padding before any abstract
1570
+ explanation. The Wireframe Quality core owns the before/after layout choice
1571
+ (side-by-side \`columns\` vs. vertical stack, picked by geometry); never
1572
+ hand-build a side-by-side wireframe layout in \`custom-html\`. For document-body
1573
+ comparisons, there is no other multi-column primitive — \`columns\` plus split
1574
+ \`diff\` are the whole comparison vocabulary. Do not hand-build side-by-side
1575
+ layouts in \`custom-html\`, and do not stack two \`data-model\` blocks vertically
1576
+ and call it a comparison when \`columns\` exists to put them side by side.
1577
+
1578
+ ## Grounding Rule
1579
+
1580
+ Structured blocks are **true by construction** only if they are derived from the
1581
+ actual changed lines. The \`diff\`, \`data-model\`, \`api-endpoint\`, and \`file-tree\`
1582
+ blocks MUST be built mechanically from the real diff — real paths, real fields,
1583
+ real method/path, real before/after text — never inferred, rounded, or invented.
1584
+ The model writes only the prose: the "why", the narrative, the risk read. A
1585
+ confidently wrong recap is dangerous in a review context, because a reviewer who
1586
+ trusts the summary may skip the very line the summary got wrong. When the diff
1587
+ does not contain a fact, leave it out rather than guess; mark anything the model
1588
+ inferred (not extracted) as inferred in prose.
1589
+
1590
+ ## Security
1591
+
1592
+ - **Gate visibility.** Recaps of a private repo are org/login-gated — set the
1593
+ plan's visibility to the owning org or login, never auto-public. A recap can
1594
+ expose unreleased schema, internal endpoints, and architecture; treat it like
1595
+ the source it summarizes.
1596
+ - **Never transcribe secrets.** A diff can contain API keys, tokens, webhook
1597
+ URLs, signing secrets, \`.env\` values, or credential-looking literals. Do not
1598
+ copy any of these into a \`diff\`, \`file-tree\` snippet, \`api-endpoint\`, or prose
1599
+ block — redact them (\`sk-•••\`, \`<redacted>\`). This mirrors the repo's
1600
+ hardcoded-secret rule: obviously fake placeholders only, never the real value,
1601
+ in any block, caption, or note.
1602
+
1603
+ ## Bidirectional Loop (Fast-Follow)
1604
+
1605
+ Because a recap is a real, editable plan, the same review loop as forward plans
1606
+ applies: a reviewer can annotate any block, and the coding agent reads
1607
+ \`get-plan-feedback\` to drive fixes back into the code — annotation → agent →
1608
+ diff, the same close-the-loop flow forward plans use. In v1, recaps are
1609
+ **read-only**: they summarize a merged or proposed change for review, and the
1610
+ annotate-to-fix loop is a fast-follow, not yet wired. Build the recap so the
1611
+ blocks are anchorable and the loop drops in later without restructuring.
1612
+
1613
+ ## Related Skills
1614
+
1615
+ - **visual-plan** — the canonical command and the source of the shared Wireframe
1616
+ & Canvas and Document Quality cores; a recap follows the same block discipline
1617
+ in reverse.
1618
+ - **security** — data scoping, secret handling, and the hardcoded-secret rule the
1619
+ recap's redaction and visibility gating mirror.
1620
+ - **sharing** — org/login-gated visibility for the plan that holds the recap.
1621
+ `;
1579
1622
  export const VISUAL_QUESTIONS_SKILL_MD = `---
1580
1623
  name: visual-questions
1581
1624
  description: >-
@@ -1681,8 +1724,9 @@ intended), so the first tool call does not hit an OAuth wall:
1681
1724
  agent-native skills add visual-plan
1682
1725
  \`\`\`
1683
1726
 
1684
- After that, \`/visual-plan\` (and \`/ui-plan\`, \`/prototype-plan\`, \`/plan-design\`,
1685
- \`/visual-questions\`) generate a plan and open the editor. Pass \`--no-connect\` to
1727
+ After that, \`/visual-plan\` (and \`/visual-recap\`, \`/ui-plan\`,
1728
+ \`/prototype-plan\`, \`/plan-design\`, \`/visual-questions\`) generate a plan and open
1729
+ the editor. Pass \`--no-connect\` to
1686
1730
  register the connector without authenticating, then run
1687
1731
  \`agent-native connect https://plan.agent-native.com\` whenever you are ready.
1688
1732
 
@@ -1796,6 +1840,7 @@ const BUILT_IN_APP_SKILLS = {
1796
1840
  "visual-plans": {
1797
1841
  skillName: "visual-plan",
1798
1842
  extraSkills: {
1843
+ "visual-recap": VISUAL_RECAP_SKILL_MD,
1799
1844
  "visual-questions": VISUAL_QUESTIONS_SKILL_MD,
1800
1845
  "ui-plan": UI_PLAN_SKILL_MD,
1801
1846
  "prototype-plan": PROTOTYPE_PLAN_SKILL_MD,
@@ -1813,7 +1858,7 @@ const BUILT_IN_APP_SKILLS = {
1813
1858
  mcp: { serverName: "agent-native-plans" },
1814
1859
  auth: {
1815
1860
  mode: "oauth",
1816
- setup: "Install with the Agent-Native CLI to add the /visual-plan, /ui-plan, /prototype-plan, /plan-design, and /visual-questions skills plus the Plans MCP connector. Authenticate only for hosted/account-backed sharing.",
1861
+ setup: "Install with the Agent-Native CLI to add the /visual-plan, /visual-recap, /ui-plan, /prototype-plan, /plan-design, and /visual-questions skills plus the Plans MCP connector. Authenticate only for hosted/account-backed sharing.",
1817
1862
  },
1818
1863
  surfaces: [
1819
1864
  {
@@ -1822,6 +1867,12 @@ const BUILT_IN_APP_SKILLS = {
1822
1867
  path: "/plans",
1823
1868
  description: "Create a general coding-agent plan. Architecture/code plans default to inline document blocks; top canvas/prototype surfaces are optional for UI/product review.",
1824
1869
  },
1870
+ {
1871
+ id: "visual-recap",
1872
+ action: "create-visual-recap",
1873
+ path: "/plans",
1874
+ description: "Create a visual recap plan from a PR, commit, branch, or git diff for high-altitude review.",
1875
+ },
1825
1876
  {
1826
1877
  id: "visual-questions",
1827
1878
  action: "create-visual-questions",
@@ -1853,6 +1904,11 @@ const BUILT_IN_APP_SKILLS = {
1853
1904
  visibility: "exported",
1854
1905
  exportAs: "visual-plan",
1855
1906
  },
1907
+ {
1908
+ path: "skills/visual-recap",
1909
+ visibility: "exported",
1910
+ exportAs: "visual-recap",
1911
+ },
1856
1912
  {
1857
1913
  path: "skills/visual-questions",
1858
1914
  visibility: "exported",
@@ -1936,6 +1992,10 @@ const BUILT_IN_APP_SKILL_ALIASES = {
1936
1992
  "agent-native-design-exploration": "design",
1937
1993
  "visual-plans": "visual-plans",
1938
1994
  "visual-plan": "visual-plans",
1995
+ "visual-recap": "visual-plans",
1996
+ "visual-recaps": "visual-plans",
1997
+ "code-review-recap": "visual-plans",
1998
+ "code-review-recaps": "visual-plans",
1939
1999
  "visual-questions": "visual-plans",
1940
2000
  "visual-question": "visual-plans",
1941
2001
  "ui-plan": "visual-plans",
@@ -1968,6 +2028,8 @@ const BUILT_IN_APP_SKILL_DISPLAY_ALIASES = {
1968
2028
  ],
1969
2029
  "visual-plans": [
1970
2030
  "visual-plan",
2031
+ "visual-recap",
2032
+ "code-review-recap",
1971
2033
  "visual-questions",
1972
2034
  "ui-plan",
1973
2035
  "prototype-plan",