@agent-native/core 0.37.2 → 0.37.3

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.
@@ -185,7 +185,7 @@ iteration, or a human-in-the-loop choice among design directions.
185
185
  - If you inspect local MCP config, redact \`Authorization\`, \`http_headers\`,
186
186
  and token values. Never paste bearer tokens into chat or logs.
187
187
  `;
188
- const VISUAL_PLANS_SKILL_MD = `---
188
+ export const VISUAL_PLANS_SKILL_MD = `---
189
189
  name: visual-plan
190
190
  description: >-
191
191
  Use Agent-Native Plans when coding-agent work needs an interactive structured
@@ -197,255 +197,279 @@ metadata:
197
197
 
198
198
  # Agent-Native Plans
199
199
 
200
- Agent-Native Plans is structured visual planning mode for coding agents.
201
- Generate the kind of plan you would normally write in Markdown, but as a
202
- scannable plan document with editable blocks mixed in: diagrams, wireframes,
203
- mockups, prototype options, tradeoff cards, file/symbol implementation maps,
204
- code previews, bounded custom HTML fragments, and annotation prompts. It is a
205
- plan document, not a marketing page.
200
+ Agent-Native Plans is structured visual planning mode for coding agents. Build
201
+ the plan you would normally write in Markdown, but as a scannable document with
202
+ editable blocks mixed in: an optional pan/zoom wireframe canvas on top and a
203
+ Notion-like technical document below. The user reacts to visuals first and reads
204
+ prose only where it helps.
206
205
 
207
- The goal is impatient review. The user should be able to react to visuals first
208
- and read prose only where it helps.
209
-
210
- Install with the Agent-Native CLI. It adds the skills and the MCP connector:
211
-
212
- \`\`\`bash
213
- npx @agent-native/core@latest skills add visual-plan
214
- \`\`\`
215
-
216
- Then start typing \`/visual-plan\` for a fresh general plan, \`/ui-plan\` for a
217
- UI-first high-fidelity plan, \`/visual-questions\` to force visual intake before
218
- a plan, or \`/visualize-plan\` to turn an existing Codex, Claude Code, Markdown,
219
- or pasted plan into a visual companion. The hosted MCP app opens inline where
220
- supported and falls back to a browser link everywhere else.
221
-
222
- ## Slash Commands
223
-
224
- - \`/visual-plan\`: create a fresh rich visual plan before implementation. Include
225
- a docs-level plan, visual architecture/flow diagrams, detailed wireframes or
226
- mockups when UI is involved, an implementation map with files/symbols/snippets,
227
- tradeoffs, open questions, and clear feedback prompts.
228
- - \`/visual-questions\`: manually force the visual intake step before a plan.
229
- Use it for chip questions, freeform answers, mockup choice tabs, sketch
230
- diagrams, and a generated answer summary that can feed \`/visual-plan\`,
231
- \`/ui-plan\`, \`/visualize-plan\`, or an existing plan update.
232
- - \`/ui-plan\`: create a UI-first high-fidelity visual plan before implementation.
233
- Use an optional top pan/zoom wireframe or diagram canvas when visuals clarify
234
- the flow, then continue as a refined Notion-like document with rich tabs,
235
- comments/drawing prompts, code tabs, and agent handoff notes.
236
- - \`/visualize-plan\`: import an existing Codex, Claude Code, Markdown, or pasted
237
- text plan and turn it into a visual companion. Preserve the plan's intent,
238
- then add diagrams, wireframes, option cards, file/symbol maps, and annotation
239
- prompts.
206
+ \`/visual-plan\` is the canonical command and the main entry point. Use \`/ui-plan\`
207
+ when the work is primarily product UI and review should start with the screens.
208
+ Use \`/visual-questions\` to run a visual intake form first. Use \`/visualize-plan\`
209
+ to turn an existing Codex, Claude Code, Markdown, or pasted plan into a visual
210
+ companion.
240
211
 
241
212
  ## When To Use
242
213
 
243
- Create or update a visual plan when:
244
-
245
- - the user asks for a plan, visual plan, HTML plan, plannotate-style review,
246
- diagrams, wireframes, mockups, prototype options, comments, or annotations;
247
- - work is multi-file, ambiguous, long-running, risky, or UI-heavy;
248
- - the user needs to react quickly to direction rather than read prose;
249
- - architecture, data flow, UI direction, options, or open questions would be
250
- clearer visually;
251
- - you need the user to react before implementation.
252
-
253
- The companion \`visual-questions\` and \`visualize-plan\` skills are installed
254
- with this one. Use \`visual-questions\` as the manual override when the user or
255
- agent wants intake first; use \`visualize-plan\` when the user already has a
256
- Codex, Claude Code, Markdown, or pasted text plan and wants a visual companion
257
- instead of a fresh plan.
258
-
259
- ## Automatic Visual-Question Preflight
260
-
261
- \`/visual-plan\` stays the main entry point. Before calling
262
- \`create-visual-plan\`, decide whether a visual-question preflight would make the
263
- plan meaningfully better.
264
-
265
- Run \`create-visual-questions\` first when:
266
-
267
- - UI direction, form factor, layout model, feature scope, visual style,
268
- architecture shape, or flow depth is fuzzy enough that 2-6 answers would
269
- change the plan;
270
- - there are multiple plausible visual options and the user would benefit from
271
- comparing mockups, diagrams, or chips before reading a plan;
272
- - the user asks to see choices, answer questions, pick a direction, or review
273
- intake before planning.
274
-
275
- Skip the preflight when the work is trivial, the right answer is clear from the
276
- codebase, the missing details can be safely stated as assumptions in the plan,
277
- or asking questions would only slow down an otherwise concrete task. If the user
278
- types \`/visual-questions\`, honor it as a manual override even if the heuristic
279
- would normally skip intake.
214
+ Create a visual plan when work is multi-file, ambiguous, long-running, risky, or
215
+ UI-heavy, when architecture / data flow / UI direction / options / open
216
+ questions would be clearer visually, or when the user needs to react to a
217
+ direction before you implement.
280
218
 
281
219
  ## Plan Discipline
282
220
 
283
- Plan mode protects the user from wasted work; it is not ceremony. Hold this
284
- discipline before and around the plan document:
285
-
286
- - **Right-size first.** Build a visual plan when work is multi-file, ambiguous,
287
- risky, architectural, UI-heavy, has multiple valid approaches, or the code is
288
- unfamiliar. Skip it for trivial, unambiguous work — typos, one-line fixes, a
289
- single well-specified function, anything whose diff you could describe in one
290
- sentence — and just make the change. A polished visual plan is the most
291
- expensive plan form; only invest when a wrong direction is costly. Never pad a
292
- plan with filler or ship a single-step plan.
221
+ - **Gate hard.** A polished visual plan is the most expensive plan form; only
222
+ invest when a wrong direction is costly. Skip it for trivial, unambiguous work
223
+ — typos, one-line fixes, a single well-specified function, anything whose diff
224
+ you could describe in one sentence and just make the change. Never pad a plan
225
+ with filler and never ship a single-step plan.
293
226
  - **Research before you draft.** Read the real files, actions, schema, and
294
- existing patterns first, and name actual files, symbols, and data shapes in
295
- the plan instead of inventing them. Check existing \`actions/\` before proposing
296
- endpoints and prefer named client helpers over raw fetch. Delegate wide
297
- exploration to a sub-agent so the main context stays clear.
298
- - **Planning is read-only.** Make no source edits while building or reviewing
299
- the plan. Start editing code only after the user approves the direction.
300
- - **Clarify vs. assume.** Do not ask the user how to build it explore and
301
- present the approach and options in the plan. Ask a clarifying question only
302
- when an ambiguity would change the design and you cannot resolve it from the
303
- code or a sensible default; batch a small set (2-4) of high-leverage,
304
- decision-changing questions before finalizing. Otherwise state the most
305
- reasonable assumption explicitly and proceed. Put anything still unresolved in
306
- a dedicated open-questions / needs-clarification blocknever guess silently,
307
- and never fill it with detail you could infer.
308
- - **Be specific.** Every plan states the objective and what "done" means,
309
- explicit scope and non-goals, ordered verifiable steps that name real files,
310
- symbols, and actions, the key choices with rationale, risks, and a closing
311
- verification step (tests, build, or a checkable behavior). Replace vague prose
312
- with specifics; never ship a step like "make it work."
313
- - **The plan is the approval gate.** After surfacing the plan, explicitly ask
314
- the user to review and approve before you write any code, and name which
315
- files/areas and permissions the work will touch so approval grants scope.
316
- Presenting the plan and requesting sign-off is the approval step — do not ask
317
- a separate "does this look good?" question.
318
- - **The document is the source of truth, not the chat.** When scope shifts
319
- during review or implementation, update the plan with \`update-visual-plan\`
320
- rather than only changing course in chat, and re-read the approved plan before
321
- major steps so the work does not drift.
227
+ patterns first; name actual files, symbols, and data shapes instead of
228
+ inventing them. Check existing \`actions/\` before proposing endpoints and prefer
229
+ named client helpers over raw fetch. Delegate wide exploration to a sub-agent.
230
+ - **Planning is read-only.** Make no source edits while building or reviewing the
231
+ plan. Start editing only after the user approves the direction.
232
+ - **Clarify vs. assume.** Do not ask how to build it — explore and present the
233
+ approach and options in the plan. Ask a clarifying question only when an
234
+ ambiguity would change the design and you cannot resolve it from the code; batch
235
+ 2-4 high-leverage questions before finalizing. Otherwise state the assumption
236
+ explicitly and proceed, and put anything unresolved in an open-questions block.
237
+ - **The plan is the approval gate.** After surfacing it, ask the user to review
238
+ and approve before you write code, and name which files/areas the work touches.
239
+ Presenting the plan and requesting sign-off is the approval step do not ask a
240
+ separate "does this look good?" question.
241
+ - **The document is the source of truth, not the chat.** When scope shifts,
242
+ update the plan with \`update-visual-plan\` rather than only changing course in
243
+ chat, and re-read the approved plan before major steps.
322
244
 
323
245
  ## Core Workflow
324
246
 
325
247
  1. Call \`create-visual-plan\` with the title, brief, source, repo path, and
326
- either structured \`content\` blocks or readable \`sections\` before
327
- implementation.
328
- 2. Prefer structured \`content\` for every new plan. Use \`rich-text\`,
329
- \`sketch-diagram\`, \`sketch-wireframe\`, \`tabs\`, \`code-tabs\`,
330
- \`implementation-map\`, \`decision\`, \`checklist\`, \`table\`,
331
- \`visual-questions\`, and bounded \`custom-html\` blocks. Do not send a full
332
- standalone HTML document unless importing a legacy artifact.
333
- 3. Surface the returned Plans link or inline MCP App. In CLI hosts, ask the user
334
- to review the plan visually.
335
- 4. Prefer diagrams, wireframes, UI mockups, option cards, implementation maps,
336
- and small interactive prototypes over paragraphs.
337
- 5. Call \`get-plan-feedback\` before editing, after review, after any long pause,
248
+ structured \`content\` blocks.
249
+ 2. Compose the canvas from the kit and write the document with native blocks
250
+ (see the two cores below). Skip the canvas for non-visual work.
251
+ 3. Surface the returned Plans link or inline MCP App and ask the user to review.
252
+ 4. Call \`get-plan-feedback\` before editing, after review, after any long pause,
338
253
  and before the final response.
339
- 6. Incorporate comments/corrections with \`update-visual-plan\`. Prefer
340
- \`contentPatches\` for targeted changes: \`update-rich-text\`,
341
- \`replace-block\`, \`update-wireframe-region\`,
342
- \`replace-wireframe-regions\`, \`update-canvas-frame\`, \`append-block\`,
343
- \`remove-block\`, or \`update-custom-html\`. Use full \`content\` only for
344
- broad restructuring.
345
- 7. Export an HTML/JSON/Markdown receipt with \`export-visual-plan\` when the
346
- user wants a shareable summary.
347
-
348
- ## Visual Defaults
349
-
350
- - Use implementation-plan structure first: objective, scope/non-goals, proposed
351
- approach, phases or steps, files/symbols/snippets, risks, open questions, and
352
- validation.
353
- - UI work gets detailed wireframes, mockups, or prototype options before coding.
354
- - Use \`/ui-plan\` when UI direction is the center of the work. \`/visual-plan\`
355
- stays the general plan command for architecture, backend, refactors, and
356
- mixed implementation planning.
357
- - Wireframes should be concrete enough to critique: layout regions, controls,
358
- states, empty/loading/error paths, review affordances, and copy placeholders.
359
- - Sketch wireframes and diagrams should visibly use the app-owned
360
- Rough.js/sketch renderer with subtle grids where useful, imperfect strokes,
361
- and Virgil-style labels. Labels must not overlap rough lines, connectors, or
362
- nodes. If the result looks like crisp boxes with normal borders, revise the
363
- block data or renderer before asking for review.
364
- - For component, popover, or widget plans, show one broader app-context frame
365
- when placement affects understanding, then focused component states. Avoid
366
- fake desktop/mobile flows unless real responsive behavior changes layout.
367
- - Layered surfaces such as popovers and floating panels need an opaque sketch
368
- surface; do not let background frames show through them.
369
- - Placeholder text strokes should be sparse, aligned, and separated from labels
370
- so they read as content rhythm instead of noisy gray bars. In compact cards,
371
- use one or two thin strokes or omit strokes entirely rather than stacking bars
372
- into the label area.
373
- - Keep sketch regions padded. Labels, placeholder strokes, and buttons need
374
- visible breathing room from rough borders; avoid placing UI marks directly on
375
- frame edges.
376
- - Buttons and primary actions in UI mockups must look actionable, not like inert
377
- labels or decorative chips.
378
- - When a top canvas is present, include Figma-like annotation text/arrows on the
379
- canvas itself, not only in prose below. Prefer plain annotation text plus
380
- arrows over boxed cards with borders, backgrounds, or shadows. Place each note
381
- close to the frame it explains, aligned with that frame when possible, instead
382
- of parking notes in unrelated canvas gaps.
383
- - Tabs for UI states, component notes, or interaction notes should include a
384
- relevant visual block unless they are intentionally document-only. Do not
385
- create large tab controls that reveal only prose.
386
- - Backend/refactor work gets architecture and data-flow diagrams.
387
- - Complex tradeoffs get two or three option cards with consequences.
388
- - Open questions are surfaced as visual callouts, not buried in paragraphs.
389
- - Long prose is split into readable document sections with clear headings.
390
- - Visuals should be review aids, not decoration. Avoid decorative hero art,
391
- gradient/hero backgrounds, brand/logo chrome, nav bars, slogans, fluffy value
392
- props, huge landing-page H1s, or marketing-style cards unless the user
393
- explicitly asks.
394
- - Implementation plans include a file map: file path, symbols/components to
395
- touch, reason for the change, risk/coordination notes when relevant, and short
396
- syntax-highlighted snippets for the code shape the agent expects to modify.
397
- - File previews should be concise and reviewable. Do not paste entire large
398
- files; show the key region, public API, component boundary, schema, action, or
399
- selector that matters for review.
400
- - Include README-like detail when helpful: command names, tool behavior,
401
- install flow, MCP/link fallback, data shape, and what is in or out of scope.
402
- - Comments, corrections, replacements, and annotations should feel
403
- plannotator-style: fast to mark up, structured enough for the agent to
404
- consume, and easy to share when the user chooses.
254
+ 5. Apply changes with \`update-visual-plan\`, preferring targeted \`contentPatches\`.
255
+ When the user wants source-control friendly edits, use
256
+ \`patch-visual-plan-source\` against the MDX files instead of regenerating the
257
+ plan.
258
+ 6. Export with \`export-visual-plan\` only when the user wants a shareable receipt
259
+ or repo-check-in artifacts.
260
+
261
+ <!-- SHARED-CORE:wireframe-canvas START -->
262
+ ## Wireframe & Canvas Core
263
+
264
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
265
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
266
+ canvas work. Do not paraphrase it per command.
267
+
268
+ **The renderer owns all visual quality. You emit content, never styling.** Flex
269
+ layout, fonts, density, spacing, theme, and the hand-drawn wobble all live in
270
+ the app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a
271
+ wireframe's internals. Your job is to pick a surface, compose real product
272
+ content from the kit, and annotate nothing else.
273
+
274
+ **A wireframe block's data is a declarative kit tree, not geometry:**
275
+
276
+ \`\`\`json
277
+ {
278
+ "surface": "desktop",
279
+ "screen": [
280
+ { "el": "browserBar", "title": "tasklist" },
281
+ { "el": "row", "children": [
282
+ { "el": "sidebar", "children": [
283
+ { "el": "navItem", "label": "Inbox", "count": 12, "active": true },
284
+ { "el": "navItem", "label": "Today", "count": 4 },
285
+ { "el": "navItem", "label": "Done" }
286
+ ] },
287
+ { "el": "main", "children": [
288
+ { "el": "title", "text": "Today", "script": true },
289
+ { "el": "chips", "items": [
290
+ { "label": "All", "active": true }, { "label": "Active" }, { "label": "Done" }
291
+ ] },
292
+ { "el": "section", "label": "OVERDUE", "tone": "warn" },
293
+ { "el": "taskRow", "title": "Send invoice to Acme Co.", "due": "Yesterday", "dueTone": "warn", "prio": 1 },
294
+ { "el": "taskRow", "title": "Reply to design feedback", "due": "Today", "prio": 2 }
295
+ ] }
296
+ ] }
297
+ ]
298
+ }
299
+ \`\`\`
300
+
301
+ The renderer maps each node to a flex kit component and applies one whole-frame
302
+ wobble. Layout is always flex: \`row\`, \`col\`, \`sidebar\`, and \`main\` set the flex
303
+ direction; everything aligns by construction, so you never get overlap or drift.
304
+
305
+ **Surface presets match the real footprint, never default to desktop+mobile.**
306
+ Pick the \`surface\` that matches what the user will actually see:
307
+
308
+ - \`desktop\`: a full page or app shell.
309
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
310
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
311
+ - \`panel\`: a side panel, inspector, or sidebar widget.
312
+ - \`browser\`: a page that needs a browser chrome frame around it.
313
+
314
+ A sidebar popover renders as a small surface, not a desktop page and a phone
315
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
316
+ actually changes the layout. For a component or widget, show one broader
317
+ app-context frame only when placement affects understanding, then the focused
318
+ component states.
319
+
320
+ **Node vocabulary (\`el\` values).** Every node is \`{ el, ...props, children? }\`:
321
+
322
+ - Layout: \`screen\`, \`row\`, \`col\`, \`sidebar\`, \`main\`, \`card{children}\`,
323
+ \`column{title,count?,children}\`, \`box{children,dashed?}\`, \`divider\`.
324
+ - Chrome: \`browserBar{title}\`, \`statusBar\`, \`searchBar\`, \`toolbar\`.
325
+ - Navigation: \`navItem{label,count?,active?,dot?}\`, \`tabs\`/\`chips{items:[{label,active?}]}\`,
326
+ \`chip{label,active?}\`, \`pill{label,tone?}\`.
327
+ - Content: \`title{text,script?}\`, \`text{value,color?,weight?}\`,
328
+ \`lines{n?,widths?}\`, \`section{label,tone?}\`,
329
+ \`taskRow{title,note?,due?,dueTone?,prio?,done?}\`, \`kv{rows:[{k,v}]}\`,
330
+ \`avatar\`, \`iconSquare{active?}\`.
331
+ - Inputs: \`field{label?,value?,placeholder?,area?}\`, \`check{done?,shape?}\`,
332
+ \`btn{label,solid?,full?}\`, \`fab{icon?}\`.
333
+
334
+ Put **real product content** in props: real labels, real dates, real counts,
335
+ real button text grounded in the actual screen or component you read. Use
336
+ \`lines\`/\`text\` (with no \`value\`) only for genuine placeholder body copy — never
337
+ fill a screen with gray placeholder bars. Buttons (\`btn\`, \`fab\`) must read as
338
+ actionable controls.
339
+
340
+ **Default crisp.** Sketchiness is a low default (a subtle single wobble over the
341
+ whole frame), not a heavy scribble. Do not ask for or assume a heavy sketch
342
+ look.
343
+
344
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
345
+ present, sprinkle Figma-style notes near the frames they explain: a short
346
+ heading, supporting text, and bullets — plain text layers, never bordered or
347
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
348
+ from frames, so place each note by the frame it describes. Use an arrow only to
349
+ point at one specific control or transition; for a broad frame-level note, write
350
+ text beside the frame with no connector. Connectors are for real sequences only —
351
+ never fake "Step 1 → Step 2" lines between independent states.
352
+
353
+ **Patching.** Edit one wireframe node, canvas annotation, or block with targeted \`contentPatches\`
354
+ (for example \`update-wireframe-node\`, \`update-block\`, \`replace-blocks\`) rather
355
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
356
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
357
+ edits. If an agent is working from exported source files, use
358
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
359
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
360
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
361
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
362
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
363
+
364
+ **Legacy imports only.** Old or imported plans may carry coordinate-based
365
+ regions or a full standalone HTML document; the renderer still displays them.
366
+ Never emit geometry, regions, or a standalone HTML document for a new plan —
367
+ compose the kit tree instead.
368
+ <!-- SHARED-CORE:wireframe-canvas END -->
369
+
370
+ <!-- SHARED-CORE:document-quality START -->
371
+ ## Document Quality Core
372
+
373
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
374
+ \`/visualize-plan\`. It is the single source of truth for the document below the
375
+ canvas. Do not paraphrase it per command.
376
+
377
+ **The document is a serious technical plan, not marketing.** Write it the way a
378
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
379
+ self-contained, and specific. State the objective and what "done" means, the
380
+ scope and non-goals, the proposed approach with the key decisions and their
381
+ rationale, ordered steps that name real files, symbols, actions, and data
382
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
383
+ behavior). Replace vague prose with specifics; never ship a step like "make it
384
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
385
+ landing-page headings, or marketing cards unless the user explicitly asks.
386
+
387
+ **Canvas and document never duplicate each other.** The UI story lives on the
388
+ canvas with on-canvas annotations; the document carries the technical depth the
389
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
390
+ snippets, migration or implementation phases, risks, and validation. Repeat a
391
+ wireframe in the document only for a genuinely new detail view or comparison.
392
+ Skip the canvas entirely for non-visual work and write a clean rich document.
393
+
394
+ **Use the right block, and make it carry substance:**
395
+
396
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
397
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
398
+ symbols/components to touch, the reason, risk/coordination notes, and a
399
+ concise syntax-highlighted snippet of the code shape — never the whole file,
400
+ never a prose-only file list.
401
+ - \`decision\` for two or three option cards with consequences. These are static
402
+ records; do not style them like clickable tabs or chips unless the renderer
403
+ truly supports changing the selection.
404
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
405
+ relationships, only when it clarifies something real. Labels must not overlap
406
+ nodes, connectors, or each other.
407
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
408
+ only prose usually means the plan is under-specified — include a relevant
409
+ visual unless the tab is intentionally document-only.
410
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
411
+
412
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
413
+ a dedicated open-questions / needs-clarification block. Never put a
414
+ questions/decisions wall inside the plan narrative.
415
+
416
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
417
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a placeholder,
418
+ density demo, or proof that custom HTML works. Prefer the native blocks; they
419
+ cover real plans.
420
+
421
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
422
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
423
+ unreadable diagrams before asking for approval.
424
+ <!-- SHARED-CORE:document-quality END -->
425
+
426
+ <!-- SHARED-CORE:exemplar START -->
427
+ ## Good vs. Bad Exemplar
428
+
429
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard
430
+ composed from the kit — a sidebar of real \`navItem\`s (\`Inbox 12\`, \`Today 4\`,
431
+ \`Done\`), a \`main\` with a scripted \`title\`, real \`chips\`, a \`section\` labeled
432
+ \`OVERDUE\`, and \`taskRow\`s carrying real titles, due dates, and priorities — one
433
+ subtle whole-frame wobble, correct desktop footprint, and plain-text designer
434
+ notes spaced off the frames pointing only at the controls that need explanation.
435
+ Below it, a Claude/Codex-grade document: objective and done-criteria, an
436
+ \`implementation-map\` naming the real components and actions with short
437
+ highlighted snippets, a \`decision\` card weighing two real approaches, and a
438
+ validation step — none of it repeating the canvas. This is the bar.
439
+
440
+ **BAD.** Empty coordinate boxes placed by \`x/y/width/height\`, gray placeholder
441
+ bars "insinuating" text, crisp double-bordered rectangles or a heavy scribble, a
442
+ forced desktop + mobile pair for a popover, floating bordered annotation cards
443
+ hugging the frames, and a marketing-style document with a hero heading and value
444
+ props that just restates what the canvas already shows. Never produce this.
445
+ <!-- SHARED-CORE:exemplar END -->
405
446
 
406
447
  ## Tool Guidance
407
448
 
408
449
  - \`create-visual-plan\`: start one structured visual plan per agent task/run.
409
- - \`create-ui-plan\`: start a UI-first plan with high-fidelity screen/state tabs.
410
- - \`create-visual-questions\`: ask a visual intake questionnaire before creating
411
- or updating a plan.
412
- - \`visualize-plan\`: create a visual companion from an existing text plan.
413
- - \`update-visual-plan\`: revise content blocks, sections, status, or comments.
414
- Prefer targeted \`contentPatches\` over regenerating the whole plan.
415
- \`contentPatches\` are part of the public MCP action schema, so Claude Code,
416
- Codex, and other MCP hosts can make surgical edits without regenerating a
417
- whole artifact.
418
- - \`get-visual-plan\`: read the current structured plan, exported HTML, and annotations.
450
+ - \`create-ui-plan\`: start a UI-first plan when the work is primarily product UI.
451
+ - \`create-visual-questions\`: run a visual intake form before planning.
452
+ - \`visualize-plan\`: build a visual companion from an existing text plan.
453
+ - \`update-visual-plan\`: revise content, status, or comments; prefer
454
+ \`contentPatches\` over regenerating the whole plan.
455
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
456
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
457
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
458
+ artboard, annotation, component, or wireframe-node id.
459
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
460
+ - \`get-visual-plan\`: read the current structured plan, exported HTML, and
461
+ annotations; it also returns the MDX folder for source workflows.
419
462
  - \`get-plan-feedback\`: read unconsumed human feedback. Use it frequently.
420
- - \`export-visual-plan\`: export HTML, Markdown fallback, and structured JSON.
421
-
422
- ## Structured Content Guidance
423
-
424
- - Prefer structured content blocks over raw HTML. Rich text blocks should carry
425
- implementation-plan substance, while diagrams, wireframes, code tabs, and
426
- implementation maps make the work reviewable.
427
- - Use \`custom-html\` only for bounded fragments inside a block. Never include
428
- \`html\`, \`head\`, \`body\`, or \`script\` tags in custom fragments.
429
- - \`sketch-diagram\` blocks must be legible: labels cannot overlap nodes,
430
- connectors, rough lines, or each other; omit the diagram when it does not
431
- clarify a real architecture, sequence, dependency, or state relationship.
432
- - Match Agent-Native's restrained theme unless the user asks otherwise.
433
- - Keep the first viewport legible and plan-like: title, brief, concise scope,
434
- and a useful diagram/checklist/table when it helps.
435
- - Use tabs or small interactions only when they make review faster.
436
- - Do not paste huge artifacts into chat. Store the plan in Plans and surface the
437
- MCP app or link.
438
-
439
- ## Guardrails
440
-
441
- - Keep it simple. Do not build a ten-tab dashboard unless the user asks.
442
- - Do not hand-roll MCP HTTP requests with curl. Use host-exposed tools after
443
- restart/reload, or use the returned browser/deep-link fallback.
444
- - Hosted default: connect
445
- \`https://plan.agent-native.com/_agent-native/mcp\`. Do not put shared
446
- secrets in skill files.
463
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
464
+ files for repo check-in.
465
+
466
+ When the user critiques a plan's look or structure, fix the renderer or this
467
+ skill never hand-edit one stored plan. Turn feedback into better guidance.
468
+
469
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`. Do
470
+ not put shared secrets in skill files.
447
471
  `;
448
- const UI_PLAN_SKILL_MD = `---
472
+ export const UI_PLAN_SKILL_MD = `---
449
473
  name: ui-plan
450
474
  description: >-
451
475
  Use Agent-Native Plans for UI-first planning with an optional top pan/zoom
@@ -458,248 +482,303 @@ metadata:
458
482
  # UI Plan
459
483
 
460
484
  Use \`/ui-plan\` when the task is primarily about product UI, user flows,
461
- interaction states, component layout, responsive behavior, or visual direction.
462
- This is a specialized Agent-Native Plans workflow: the reviewable UI comes
463
- first, and implementation details come after the user has something concrete to
485
+ interaction states, component layout, or visual direction. The reviewable UI
486
+ comes first; implementation detail comes after the user has something concrete to
464
487
  react to.
465
488
 
466
- \`/visual-plan\` remains the general rich planning command for architecture,
467
- backend, refactors, migrations, and mixed work. Use \`/visualize-plan\` when a
468
- text plan already exists and should become a visual companion.
489
+ \`/visual-plan\` remains the general command for architecture, backend, refactors,
490
+ and mixed work. Use \`/visual-questions\` first when the user should answer intake
491
+ questions, and \`/visualize-plan\` when a text plan already exists.
469
492
 
470
493
  ## Plan Discipline
471
494
 
472
- - **Right-size first.** Use a UI plan when the surface is new, ambiguous, spans
473
- several screens or states, or the direction needs agreement before coding.
474
- Skip it for cosmetic one-liners — a color, a label, a spacing tweak — and just
475
- make the change.
476
- - **Research before you draft.** Read the real components, routes, design
477
- tokens, and existing patterns first, and ground mockups and the file map in
478
- actual files and symbols rather than inventing them. Delegate wide exploration
479
- to a sub-agent when the surface is large.
480
- - **Planning is read-only.** Make no source edits while building or reviewing
481
- the plan. Start editing only after the user approves the UI direction.
482
- - **Clarify vs. assume.** Do not ask the user how to build the UI — explore and
483
- present the direction and options as mockups and tabs. Ask a clarifying
484
- question only when an ambiguity would change the design and you cannot resolve
485
- it from the code or a sensible default; batch 2-4 high-leverage,
486
- decision-changing questions before finalizing. Otherwise state the assumption
487
- in the plan and proceed.
488
- - **The plan is the approval gate.** Explicitly ask the user to review and
489
- approve the UI direction before you write any code, and name the files/areas
490
- the work will touch. Presenting the plan and requesting sign-off is the
491
- approval step — do not ask a separate "does this look good?" question.
495
+ - **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several
496
+ screens or states, or the direction needs agreement before coding. Skip it for
497
+ cosmetic one-liners — a color, a label, a spacing tweak — and just make the
498
+ change. Never ship a single-step or filler plan.
499
+ - **Research before you draft.** Read the real components, routes, and design
500
+ tokens first; ground every mockup and the file map in actual files and symbols.
501
+ Delegate wide exploration to a sub-agent when the surface is large.
502
+ - **Planning is read-only.** Make no source edits while building or reviewing.
503
+ Start editing only after the user approves the UI direction.
504
+ - **Clarify vs. assume.** Do not ask how to build the UI — present the direction
505
+ and options as mockups and tabs. Ask a clarifying question only when an
506
+ ambiguity would change the design; batch 2-4 before finalizing. Otherwise state
507
+ the assumption in the plan and proceed.
508
+ - **The plan is the approval gate.** Ask the user to review and approve the UI
509
+ direction before you write code, and name the files/areas the work touches.
492
510
 
493
511
  ## UI-First Workflow
494
512
 
495
- 1. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path,
496
- and structured \`content\` when you need custom blocks. Otherwise provide
497
- \`states\`, \`components\`, and \`implementationNotes\` so Plans can generate
498
- the native editable canvas and document.
499
- 2. When the plan has meaningful UI flows, screens, or diagrams, make the top
500
- of the document a bounded pan/zoom sketch canvas with the key artboards,
501
- connectors, margin notes, and commentable visual anchors.
502
- Use the app-owned Rough.js/sketch renderer: subtle grid field, deliberately
503
- imperfect lines, Virgil-style wireframe labels, and Figma-like annotation
504
- text/arrows on the top canvas. Labels must sit clear of rough lines,
505
- connectors, controls, and neighboring notes.
506
- Treat notes like Figma text layers: sprinkle headings, supporting text,
507
- bullets, arrows, and labels around the artboards, but do not overlap the
508
- wireframes or wrap the artboards in explanatory cards.
509
- In dark mode, keep the canvas field slightly darker than the document, and
510
- keep wireframe artboards flat rather than shadowed.
511
- 3. Continue below the canvas as a restrained, Notion-like interactive document:
512
- clear prose, horizontal state tabs, inline wireframes, sketchy diagrams,
513
- tables, vertical code tabs, and concise implementation notes.
514
- 4. Skip the top canvas when wireframes or diagrams would not clarify the work;
515
- in that case, keep the plan as a clean rich document.
516
- 5. Put files, symbols, data/actions, migrations, risks, and validation lower in
517
- the document after the visual review area.
518
- 6. Call \`get-plan-feedback\` before implementation, after review, after a long
519
- pause, and before the final response. Apply changes with
520
- \`update-visual-plan\`. Prefer targeted \`contentPatches\` for small changes
521
- to one state tab, wireframe region, canvas frame, code tab, or document
522
- block.
523
-
524
- ## Mockup Quality Bar
525
-
526
- - Build high-fidelity screen sections with realistic spacing, controls,
527
- hierarchy, text, and state-specific content. Avoid vague gray boxes.
528
- - Show the actual workflow the user will use: navigation, toolbar actions,
529
- forms, dialogs, empty states, error recovery, loading affordances, and
530
- confirmation/success states.
531
- - Include desktop and mobile/responsive states when layout decisions could
532
- change. Put them in tabs or adjacent panels rather than burying them in prose.
533
- - Use concrete labels and copy placeholders that expose content length,
534
- truncation, disabled states, and destructive actions.
535
- - Buttons and primary actions must look actionable: visible affordance,
536
- readable label/icon, and enabled/disabled treatment when relevant.
537
- - Make state tabs span the plan content width. Small cards are fine for repeated
538
- items, but the primary UI preview should not be trapped in a tiny thumbnail.
539
- - Keep visuals review-focused, not decorative. Do not make a marketing page,
540
- hero section, brand deck, or abstract mood board unless the user asks.
541
-
542
- ## Component And Widget Plans
543
-
544
- When the work is a component, popover, sidebar widget, toolbar, card, modal, or
545
- other small surface, do not generate a full app flow. Use compact component
546
- states instead.
547
-
548
- - Prefer square or vertical frames that match the component's real footprint. A
549
- sidebar popover should look like a sidebar popover, not a desktop page or
550
- phone screen.
551
- - When placement matters, include one broader app-context frame showing the
552
- surrounding page, sidebar, or toolbar, then focused component states.
553
- - Layered surfaces such as popovers, menus, and floating inspectors need an
554
- opaque sketch surface so they read as overlays instead of transparent boxes.
555
- - Use state tabs such as \`Default\`, \`Expanded\`, \`Map\`, \`Loading\`, \`Empty\`,
556
- and \`Error\`. Do not add \`Desktop\`, \`Mobile\`, or responsive states unless the
557
- component actually changes layout across breakpoints.
558
- - Draw only connectors for real sequences. Do not connect independent states
559
- with fake "Step 1" lines.
560
- - Ground every frame in the real product hierarchy: visible title, controls,
561
- content groups, state labels, actions, empty/error copy, and realistic
562
- density. If you have seen a screenshot or component code, reflect it.
563
- - Keep labels outside collision zones. Text must never overlap wireframes,
564
- connectors, toolbar controls, or neighboring notes.
565
- - Placeholder text strokes should be sparse, aligned, and below labels; avoid
566
- random-looking gray bars that collide with copy or make the sketch messy. In
567
- compact cards, use one or two thin strokes or omit strokes rather than filling
568
- the card with bars.
569
- - Keep every sketch region padded. Labels, placeholder strokes, and buttons need
570
- visible breathing room from rough borders; avoid edge-hugging component
571
- layouts.
572
- - Use the app-owned Rough.js/sketch renderer for wireframes and diagrams. The
573
- result should look deliberately hand-drawn/scribbly with Virgil-style labels,
574
- not like crisp bordered boxes on a grid.
575
-
576
- ## State Tabs
577
-
578
- When showing multiple UI states, prefer the structured \`tabs\` block. Each tab
579
- can contain rich text, sketch wireframes, diagrams, code tabs, or bounded custom
580
- HTML fragments. Raw HTML tab attributes are only for legacy imported artifacts.
581
- For UI-first plans, tabs named like component notes, interaction notes, screen
582
- states, or review states should include a relevant visual block unless they are
583
- intentionally document-only; prose-only tabs are usually a sign the plan is
584
- under-specified.
585
-
586
- Good state tab sets include:
587
-
588
- - \`Default\`, \`Loading\`, \`Empty\`, \`Error\`
589
- - \`List\`, \`Detail\`, \`Edit\`, \`Confirm\`
590
- - \`Desktop\`, \`Tablet\`, \`Mobile\`
591
- - \`Owner\`, \`Reviewer\`, \`Signed out\`
592
-
593
- ## UI Flow Document
594
-
595
- Generated \`/ui-plan\` documents use one default shape: an optional Figma-style
596
- pan/zoom visual preface followed by a refined Notion-like document. There is no
597
- mode boolean. Provide \`states\` and \`components\` when the top canvas will help
598
- the reviewer understand the flow; omit them when the plan should be
599
- document-only. Use structured blocks for custom states, diagrams, and code
600
- detail instead of full standalone HTML.
601
-
602
- The document below the canvas should still include the same planning substance:
603
- screen states, component notes, implementation map, review prompts, comments,
604
- drawing-friendly space, and agent handoff. Treat it like a designer handed over
605
- a Figma file plus a crisp product spec: the reviewer should understand the UI
606
- flow from a bird's-eye view, then keep scrolling into a clean interactive
607
- document with notes explaining how the screens work together.
608
-
609
- ## Comments, Drawing, And Handoff
610
-
611
- - Add visible annotation prompts beside the mockups: "Comment on layout",
612
- "Circle unclear copy", "Mark missing state", or "Pick this option". Canvas
613
- annotations should feel like Figma callouts: plain text plus arrows, without
614
- card borders, shadows, or background panels unless editing UI is required.
615
- Place notes close to the frame they explain, aligned with that target frame
616
- when possible, instead of parking notes in unrelated canvas gaps.
617
- - Leave enough whitespace around key UI regions for drawing and callouts.
618
- - Label important regions so comments can reference them without ambiguity.
619
- - Include an "Agent Handoff" section after the mockups that summarizes the
620
- chosen UI direction, unresolved visual questions, and feedback that must be
621
- read before code changes.
622
- - Never claim feedback has been applied until \`get-plan-feedback\` or the user
623
- has supplied the feedback in chat.
624
-
625
- ## Implementation Details Lower Down
626
-
627
- After the visual canvas and document review blocks, include a concise
628
- implementation section:
629
-
630
- - file paths and symbols/components to touch;
631
- - data/actions/hooks/routes needed for the UI;
632
- - state ownership, optimistic updates, and sync expectations;
633
- - accessibility, responsive, and keyboard considerations;
634
- - test and verification plan;
635
- - short code-shape snippets only where they clarify the implementation.
636
-
637
- Do not paste whole files or let implementation prose crowd out the mockups.
638
- The purpose of \`/ui-plan\` is to get visual direction approved before the agent
639
- starts editing.
513
+ 1. Call \`create-ui-plan\` with a UI-specific title, brief, source, repo path, and
514
+ structured \`content\`. The canvas comes first, the document second.
515
+ 2. Compose the top canvas from the kit (see the cores below): the key artboards
516
+ with real product content, designer notes, and connectors only for real
517
+ sequences. Skip the canvas when wireframes would not clarify the work.
518
+ 3. Continue below as a concise technical document not a second copy of the
519
+ canvas — covering concrete files, contracts, phases, risks, and validation.
520
+ 4. Call \`get-plan-feedback\` before implementation, after review, after a long
521
+ pause, and before the final response. Apply changes with \`update-visual-plan\`,
522
+ preferring \`contentPatches\` for one frame, annotation, node, tab, or block. When the user
523
+ wants source-control friendly edits, use \`patch-visual-plan-source\` against
524
+ the MDX files instead of regenerating the plan.
525
+
526
+ ## Agent Handoff
527
+
528
+ After the canvas and document, add a short handoff that names the chosen UI
529
+ direction, unresolved visual questions, and feedback that must be read before
530
+ code changes. Never claim feedback has been applied until \`get-plan-feedback\` or
531
+ the user has supplied it.
532
+
533
+ <!-- SHARED-CORE:wireframe-canvas START -->
534
+ ## Wireframe & Canvas Core
535
+
536
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
537
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
538
+ canvas work. Do not paraphrase it per command.
539
+
540
+ **The renderer owns all visual quality. You emit content, never styling.** Flex
541
+ layout, fonts, density, spacing, theme, and the hand-drawn wobble all live in
542
+ the app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a
543
+ wireframe's internals. Your job is to pick a surface, compose real product
544
+ content from the kit, and annotate nothing else.
545
+
546
+ **A wireframe block's data is a declarative kit tree, not geometry:**
547
+
548
+ \`\`\`json
549
+ {
550
+ "surface": "desktop",
551
+ "screen": [
552
+ { "el": "browserBar", "title": "tasklist" },
553
+ { "el": "row", "children": [
554
+ { "el": "sidebar", "children": [
555
+ { "el": "navItem", "label": "Inbox", "count": 12, "active": true },
556
+ { "el": "navItem", "label": "Today", "count": 4 },
557
+ { "el": "navItem", "label": "Done" }
558
+ ] },
559
+ { "el": "main", "children": [
560
+ { "el": "title", "text": "Today", "script": true },
561
+ { "el": "chips", "items": [
562
+ { "label": "All", "active": true }, { "label": "Active" }, { "label": "Done" }
563
+ ] },
564
+ { "el": "section", "label": "OVERDUE", "tone": "warn" },
565
+ { "el": "taskRow", "title": "Send invoice to Acme Co.", "due": "Yesterday", "dueTone": "warn", "prio": 1 },
566
+ { "el": "taskRow", "title": "Reply to design feedback", "due": "Today", "prio": 2 }
567
+ ] }
568
+ ] }
569
+ ]
570
+ }
571
+ \`\`\`
572
+
573
+ The renderer maps each node to a flex kit component and applies one whole-frame
574
+ wobble. Layout is always flex: \`row\`, \`col\`, \`sidebar\`, and \`main\` set the flex
575
+ direction; everything aligns by construction, so you never get overlap or drift.
576
+
577
+ **Surface presets match the real footprint, never default to desktop+mobile.**
578
+ Pick the \`surface\` that matches what the user will actually see:
579
+
580
+ - \`desktop\`: a full page or app shell.
581
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
582
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
583
+ - \`panel\`: a side panel, inspector, or sidebar widget.
584
+ - \`browser\`: a page that needs a browser chrome frame around it.
585
+
586
+ A sidebar popover renders as a small surface, not a desktop page and a phone
587
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
588
+ actually changes the layout. For a component or widget, show one broader
589
+ app-context frame only when placement affects understanding, then the focused
590
+ component states.
591
+
592
+ **Node vocabulary (\`el\` values).** Every node is \`{ el, ...props, children? }\`:
593
+
594
+ - Layout: \`screen\`, \`row\`, \`col\`, \`sidebar\`, \`main\`, \`card{children}\`,
595
+ \`column{title,count?,children}\`, \`box{children,dashed?}\`, \`divider\`.
596
+ - Chrome: \`browserBar{title}\`, \`statusBar\`, \`searchBar\`, \`toolbar\`.
597
+ - Navigation: \`navItem{label,count?,active?,dot?}\`, \`tabs\`/\`chips{items:[{label,active?}]}\`,
598
+ \`chip{label,active?}\`, \`pill{label,tone?}\`.
599
+ - Content: \`title{text,script?}\`, \`text{value,color?,weight?}\`,
600
+ \`lines{n?,widths?}\`, \`section{label,tone?}\`,
601
+ \`taskRow{title,note?,due?,dueTone?,prio?,done?}\`, \`kv{rows:[{k,v}]}\`,
602
+ \`avatar\`, \`iconSquare{active?}\`.
603
+ - Inputs: \`field{label?,value?,placeholder?,area?}\`, \`check{done?,shape?}\`,
604
+ \`btn{label,solid?,full?}\`, \`fab{icon?}\`.
605
+
606
+ Put **real product content** in props: real labels, real dates, real counts,
607
+ real button text grounded in the actual screen or component you read. Use
608
+ \`lines\`/\`text\` (with no \`value\`) only for genuine placeholder body copy — never
609
+ fill a screen with gray placeholder bars. Buttons (\`btn\`, \`fab\`) must read as
610
+ actionable controls.
611
+
612
+ **Default crisp.** Sketchiness is a low default (a subtle single wobble over the
613
+ whole frame), not a heavy scribble. Do not ask for or assume a heavy sketch
614
+ look.
615
+
616
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
617
+ present, sprinkle Figma-style notes near the frames they explain: a short
618
+ heading, supporting text, and bullets — plain text layers, never bordered or
619
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
620
+ from frames, so place each note by the frame it describes. Use an arrow only to
621
+ point at one specific control or transition; for a broad frame-level note, write
622
+ text beside the frame with no connector. Connectors are for real sequences only
623
+ never fake "Step 1 Step 2" lines between independent states.
624
+
625
+ **Patching.** Edit one wireframe node, canvas annotation, or block with targeted \`contentPatches\`
626
+ (for example \`update-wireframe-node\`, \`update-block\`, \`replace-blocks\`) rather
627
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
628
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
629
+ edits. If an agent is working from exported source files, use
630
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
631
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
632
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
633
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
634
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
635
+
636
+ **Legacy imports only.** Old or imported plans may carry coordinate-based
637
+ regions or a full standalone HTML document; the renderer still displays them.
638
+ Never emit geometry, regions, or a standalone HTML document for a new plan —
639
+ compose the kit tree instead.
640
+ <!-- SHARED-CORE:wireframe-canvas END -->
641
+
642
+ <!-- SHARED-CORE:document-quality START -->
643
+ ## Document Quality Core
644
+
645
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
646
+ \`/visualize-plan\`. It is the single source of truth for the document below the
647
+ canvas. Do not paraphrase it per command.
648
+
649
+ **The document is a serious technical plan, not marketing.** Write it the way a
650
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
651
+ self-contained, and specific. State the objective and what "done" means, the
652
+ scope and non-goals, the proposed approach with the key decisions and their
653
+ rationale, ordered steps that name real files, symbols, actions, and data
654
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
655
+ behavior). Replace vague prose with specifics; never ship a step like "make it
656
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
657
+ landing-page headings, or marketing cards unless the user explicitly asks.
658
+
659
+ **Canvas and document never duplicate each other.** The UI story lives on the
660
+ canvas with on-canvas annotations; the document carries the technical depth the
661
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
662
+ snippets, migration or implementation phases, risks, and validation. Repeat a
663
+ wireframe in the document only for a genuinely new detail view or comparison.
664
+ Skip the canvas entirely for non-visual work and write a clean rich document.
665
+
666
+ **Use the right block, and make it carry substance:**
667
+
668
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
669
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
670
+ symbols/components to touch, the reason, risk/coordination notes, and a
671
+ concise syntax-highlighted snippet of the code shape — never the whole file,
672
+ never a prose-only file list.
673
+ - \`decision\` for two or three option cards with consequences. These are static
674
+ records; do not style them like clickable tabs or chips unless the renderer
675
+ truly supports changing the selection.
676
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
677
+ relationships, only when it clarifies something real. Labels must not overlap
678
+ nodes, connectors, or each other.
679
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
680
+ only prose usually means the plan is under-specified — include a relevant
681
+ visual unless the tab is intentionally document-only.
682
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
683
+
684
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
685
+ a dedicated open-questions / needs-clarification block. Never put a
686
+ questions/decisions wall inside the plan narrative.
687
+
688
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
689
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a placeholder,
690
+ density demo, or proof that custom HTML works. Prefer the native blocks; they
691
+ cover real plans.
692
+
693
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
694
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
695
+ unreadable diagrams before asking for approval.
696
+ <!-- SHARED-CORE:document-quality END -->
697
+
698
+ <!-- SHARED-CORE:exemplar START -->
699
+ ## Good vs. Bad Exemplar
700
+
701
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard
702
+ composed from the kit — a sidebar of real \`navItem\`s (\`Inbox 12\`, \`Today 4\`,
703
+ \`Done\`), a \`main\` with a scripted \`title\`, real \`chips\`, a \`section\` labeled
704
+ \`OVERDUE\`, and \`taskRow\`s carrying real titles, due dates, and priorities — one
705
+ subtle whole-frame wobble, correct desktop footprint, and plain-text designer
706
+ notes spaced off the frames pointing only at the controls that need explanation.
707
+ Below it, a Claude/Codex-grade document: objective and done-criteria, an
708
+ \`implementation-map\` naming the real components and actions with short
709
+ highlighted snippets, a \`decision\` card weighing two real approaches, and a
710
+ validation step — none of it repeating the canvas. This is the bar.
711
+
712
+ **BAD.** Empty coordinate boxes placed by \`x/y/width/height\`, gray placeholder
713
+ bars "insinuating" text, crisp double-bordered rectangles or a heavy scribble, a
714
+ forced desktop + mobile pair for a popover, floating bordered annotation cards
715
+ hugging the frames, and a marketing-style document with a hero heading and value
716
+ props that just restates what the canvas already shows. Never produce this.
717
+ <!-- SHARED-CORE:exemplar END -->
640
718
 
641
719
  ## Tool Guidance
642
720
 
643
721
  - \`create-ui-plan\`: create the UI-first structured visual plan.
644
- - \`update-visual-plan\`: revise content blocks, mockups, comments, or handoff notes.
645
- Prefer targeted \`contentPatches\` over regenerating the whole UI plan.
646
- - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and annotations.
722
+ - \`create-visual-questions\`: run a visual intake form before the UI plan.
723
+ - \`update-visual-plan\`: revise content, mockups, comments, or handoff notes;
724
+ prefer targeted \`contentPatches\`.
725
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
726
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
727
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
728
+ artboard, annotation, component, or wireframe-node id.
729
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
730
+ - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and
731
+ annotations; it also returns the MDX folder for source workflows.
647
732
  - \`get-plan-feedback\`: read unconsumed reviewer comments before coding.
648
- - \`export-visual-plan\`: export a review receipt when needed.
733
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
734
+ files for repo check-in.
735
+
736
+ When the user critiques a plan's look or structure, fix the renderer or this
737
+ skill — never hand-edit one stored plan. Turn feedback into better guidance.
649
738
 
650
739
  Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`.
651
740
  `;
652
- const VISUAL_QUESTIONS_SKILL_MD = `---
741
+ export const VISUAL_QUESTIONS_SKILL_MD = `---
653
742
  name: visual-questions
654
743
  description: >-
655
744
  Use Agent-Native Plans to ask rich visual intake questions before creating a
656
745
  UI plan or visual plan.
657
746
  metadata:
658
- visibility: exported
747
+ visibility: both
659
748
  ---
660
749
 
661
750
  # Visual Questions
662
751
 
663
752
  Use \`/visual-questions\` when the next best step is not a plan yet, but a
664
753
  reviewable visual intake: single-choice chips, multi-select chips, freeform
665
- notes, sketchy mockup choices, sketch diagrams, and a generated answer summary
666
- that feeds the next planning prompt.
667
-
668
- \`/visual-questions\` is the manual override for the automatic preflight that
669
- \`/visual-plan\` may run. Use it when the user explicitly asks for intake first
670
- or when the plan would be materially better after 2-6 visual choices.
754
+ notes, mockup choices, sketch diagrams, and a generated answer summary that feeds
755
+ the next planning prompt. It composes with \`/visual-plan\`, \`/ui-plan\`, and
756
+ \`/visualize-plan\`.
671
757
 
672
758
  ## When To Use
673
759
 
674
760
  - The user asks to be shown options before the agent writes a plan.
675
- - UI direction, form factor, layout model, feature set, architecture shape,
676
- flow depth, or visual style is still fuzzy enough that 2-6 answers would
677
- materially change the plan.
761
+ - UI direction, form factor, layout model, feature set, or visual style is fuzzy
762
+ enough that 2-6 answers would materially change the plan.
678
763
  - The user would benefit from choosing between visual mockups or diagrams rather
679
- than answering text-only terminal prompts.
680
- - The next flow should be: answer questions -> create UI plan, answer questions
681
- -> create visual plan, answer questions -> update/visualize an existing plan.
764
+ than answering text-only prompts.
682
765
 
683
- Skip this for tiny, unambiguous changes. If the agent can reasonably infer the
684
- answer, prefer \`/visual-plan\` or \`/ui-plan\` directly and put assumptions in
685
- the plan.
766
+ Gate hard: skip this for tiny, unambiguous changes. If the agent can reasonably
767
+ infer the answer, prefer \`/ui-plan\` or \`/visual-plan\` directly and put
768
+ assumptions in the plan.
686
769
 
687
770
  ## Workflow
688
771
 
689
772
  1. Call \`create-visual-questions\` with a clear title, brief, source, and repo
690
773
  path when known.
691
- 2. Omit \`questions\` for the default UI intake. Provide a custom \`questions\`
692
- array only when the task has domain-specific choices.
774
+ 2. Omit \`questions\` for the default UI intake. Provide a custom \`questions\` array
775
+ only when the task has domain-specific choices.
693
776
  3. Surface the returned Plans link and ask the user to answer visually.
694
- 4. The user can click \`Copy prompt\` or \`Send to agent\`; that generated
695
- summary should drive the next step:
696
- - call \`create-ui-plan\` for UI flow plans;
697
- - call \`create-visual-plan\` for general visual plans;
698
- - call \`visualize-plan\` when the user already has a text plan;
699
- - call \`update-visual-plan\` with targeted \`contentPatches\` when the active
700
- plan should absorb answers.
701
- 5. If the user leaves comments on the visual questionnaire, call
702
- \`get-plan-feedback\` before using the answers.
777
+ 4. The generated summary drives the next step: \`create-ui-plan\` for UI flows,
778
+ \`create-visual-plan\` for general plans, \`visualize-plan\` when a text plan
779
+ already exists, or \`update-visual-plan\` with targeted \`contentPatches\` to fold
780
+ answers into an active plan.
781
+ 5. If the user leaves comments, call \`get-plan-feedback\` before using the answers.
703
782
 
704
783
  ## Question Types
705
784
 
@@ -708,24 +787,24 @@ Supported \`questions\` entries:
708
787
  - \`single\`: chip group where one option wins.
709
788
  - \`multi\`: chip group where multiple options can be selected.
710
789
  - \`freeform\`: textarea for constraints, inspirations, or things to avoid.
711
- - \`visual\`: visual options with sketch previews. Use this
712
- for layout direction, flow depth, mobile/desktop choices, or diagram choices.
790
+ - \`visual\`: visual options with sketch previews use for layout direction, flow
791
+ depth, surface choice, or diagram choices.
713
792
 
714
793
  Each option can include \`label\`, \`value\`, \`description\`, \`recommended\`,
715
- \`preview\`, and \`bullets\`. Valid \`preview\` values are \`desktop\`,
716
- \`mobile\`, \`split\`, \`flow\`, and \`diagram\`.
794
+ \`preview\`, and \`bullets\`. Valid \`preview\` values match the wireframe surfaces:
795
+ \`desktop\`, \`mobile\`, \`popover\`, \`panel\`, \`component\`, \`split\`, \`flow\`, and
796
+ \`diagram\`. Pick the preview that matches the real footprint — do not offer a
797
+ desktop/mobile pair for a popover, panel, or component.
717
798
 
718
799
  ## Quality Bar
719
800
 
720
- - Ask only decision-changing questions. A beautiful form with low-value
721
- questions is still friction.
801
+ - Ask only decision-changing questions. A beautiful form with low-value questions
802
+ is still friction.
722
803
  - Prefer visible, answerable options over abstract prose.
723
- - Use visual tabs when users need to compare layout/flow shapes.
804
+ - Use visual tabs when users need to compare layout or flow shapes.
724
805
  - Keep the output calm and document-like, not a landing page.
725
- - Use native visual-question content. Do not provide a full standalone HTML form
726
- unless importing a legacy artifact.
727
- - The generated answer summary is not the final plan; it is the intake prompt
728
- for the next agent step.
806
+ - The generated answer summary is not the final plan; it is the intake prompt for
807
+ the next agent step.
729
808
 
730
809
  ## Tool Guidance
731
810
 
@@ -735,11 +814,17 @@ Each option can include \`label\`, \`value\`, \`description\`, \`recommended\`,
735
814
  - \`create-ui-plan\`: create a UI-first plan from the answers.
736
815
  - \`create-visual-plan\`: create a general visual plan from the answers.
737
816
  - \`visualize-plan\`: enrich an existing text plan after answers are gathered.
817
+ - \`export-visual-plan\`: export answer plans as HTML, Markdown fallback,
818
+ structured JSON, and MDX files when the intake needs to be checked into a repo.
819
+ - \`read-visual-plan-source\` / \`patch-visual-plan-source\`: inspect or patch the
820
+ MDX source if another agent is operating from checked-in plan files.
821
+
822
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`.
738
823
  `;
739
- const VISUALIZE_PLAN_SKILL_MD = `---
824
+ export const VISUALIZE_PLAN_SKILL_MD = `---
740
825
  name: visualize-plan
741
826
  description: >-
742
- Convert an existing Codex, Claude Code, Markdown, or pasted plan into a
827
+ Convert an existing Codex, Claude Code, Markdown, or pasted plan into an
743
828
  Agent-Native Plans visual companion with diagrams, wireframes, annotations, and
744
829
  feedback.
745
830
  metadata:
@@ -748,108 +833,252 @@ metadata:
748
833
 
749
834
  # Visualize Plan
750
835
 
751
- Use this as the visual companion for an existing text plan. The native Codex or
752
- Claude Code plan can stay exactly where it is; Agent-Native Plans turns it into
753
- a structured visual review surface with diagrams, wireframes, prototype options,
754
- annotations, questions, feedback, and an HTML export.
755
-
756
- This is for impatient review. Default to things the user can scan and react to.
757
- It should still read like a plan, not a marketing page.
758
-
759
- Install with the Agent-Native CLI if Plans is not already available:
760
-
761
- \`\`\`bash
762
- npx @agent-native/core@latest skills add visual-plan
763
- \`\`\`
764
-
765
- That installs \`/visual-plan\`, \`/visual-questions\`, \`/ui-plan\`, and
766
- \`/visualize-plan\` plus the MCP connector.
767
-
768
- ## When To Use
769
-
770
- Use \`visualize-plan\` when:
771
-
772
- - the user has an existing Codex, Claude Code, Markdown, or pasted plan;
773
- - the user asks to visualize, annotate, plannotate, mock up, diagram, or make a
774
- plan easier to review;
775
- - the plan is long enough that the user may not read it closely;
776
- - UI direction, architecture, data flow, risky assumptions, or open questions
777
- would be clearer visually;
778
- - the user wants feedback on wireframes, design/prototype options, diagrams, or
779
- tradeoffs before implementation.
780
-
781
- If there is no existing plan text available, ask for it, use \`visual-plan\`
782
- to create a fresh general plan, or use \`ui-plan\` when the work is UI-heavy and
783
- should start with high-fidelity state mockups.
836
+ Use \`/visualize-plan\` when a plan already exists and the user wants it easier to
837
+ review. The native Codex or Claude Code plan can stay where it is; Agent-Native
838
+ Plans creates a structured visual companion beside it diagrams, wireframes,
839
+ state sketches, option cards, and comment prompts instead of a wall of text. It
840
+ still reads like a plan, not a marketing page.
784
841
 
785
842
  ## Plan Discipline
786
843
 
787
- - **Right-size first.** If the source plan is for trivial, unambiguous work,
788
- skip the companion and just implement. A visual companion is worth it only
789
- when the plan is long, risky, or hard to react to as text.
844
+ - **Gate hard.** A visual companion is worth it only when the source plan is
845
+ long, risky, or hard to react to as text. If the source plan is for trivial,
846
+ unambiguous work, skip the companion and just implement.
790
847
  - **Stay grounded and read-only.** Preserve the source plan's intent, do not
791
848
  invent codebase facts, and label anything inferred as inferred. Make no source
792
849
  edits while building or reviewing the companion.
793
850
  - **The companion is the approval gate.** Ask the user to review and approve the
794
- direction before you write any code, and name which files/areas the work will
795
- touch. Carry unresolved assumptions and open questions into a clear block
796
- instead of guessing silently.
851
+ direction before you write code, and name which files/areas the work touches.
852
+ Carry unresolved assumptions and open questions into a clear block instead of
853
+ guessing silently.
797
854
 
798
855
  ## Workflow
799
856
 
800
857
  1. Gather the existing plan text from the user's paste, a referenced file, or
801
- the recent agent-visible plan. Do not invent a source plan.
802
- 2. Call \`visualize-plan\` with \`planText\`, \`title\`, \`goal\`, \`source\`,
803
- and \`repoPath\` when available.
858
+ recent visible agent context. Do not invent the source plan. If no plan text
859
+ exists and the work is UI-heavy, use \`/ui-plan\` instead.
860
+ 2. Call \`visualize-plan\` with \`planText\`, \`title\`, \`brief\`, \`source\`, and
861
+ \`repoPath\` when available.
804
862
  3. Surface the returned Plans link or inline MCP App.
805
- 4. Enrich the imported plan with \`update-visual-plan\` when helpful:
806
- - diagrams for architecture, data flow, state machines, or dependencies;
807
- - detailed wireframes/mockups for user-visible UI changes, including layout,
808
- controls, states, empty/loading/error paths, and copy placeholders;
809
- - two or three option cards when there are real tradeoffs;
810
- - small prototype sketches for interactions, states, or animation choices;
811
- - reviewable assumptions and open questions;
812
- Prefer targeted \`contentPatches\` for small edits to one imported block,
813
- wireframe region, diagram, or implementation map instead of replacing the
814
- whole plan content.
815
- 5. Ask the user to react in the visual plan. Then call \`get-plan-feedback\`
816
- before implementing, after review, and before final response.
817
- 6. Treat the imported text as source material. Structured Plans state is
818
- canonical for feedback, assumptions, and decisions.
819
-
820
- If there is no existing plan text and the work is UI-heavy, use \`/ui-plan\`
821
- instead so full-width state mockups, comments/drawing affordances, and agent
822
- handoff come before file implementation details.
823
-
824
- ## Visual Defaults
825
-
826
- - Keep the first screen simple and plan-like: title, brief, concise scope, and
827
- one useful diagram/checklist/table when it helps.
828
- - Prefer one strong diagram or wireframe over a wall of sections.
829
- - Preserve the source plan's implementation substance: phases or steps,
830
- files/symbols/snippets, risks, open questions, and validation.
831
- - Hide long prose behind disclosure controls or source references when it helps
832
- review speed.
833
- - Add README-like detail when the source is too terse: slash commands, tool
834
- behavior, install flow, MCP/link fallback, data shape, and scope.
835
- - Avoid decorative hero art, gradient/hero backgrounds, logos, nav bars,
836
- slogans, fluffy value props, huge landing-page H1s, and marketing-style cards
837
- unless the user explicitly asks.
838
- - Visuals should be review aids, not decoration.
839
- - Label inferred items as possible, not confirmed.
840
- - Ask for feedback with targeted prompts: "Which option?", "Is this flow
841
- right?", "What assumption is wrong?", "What should change?"
842
- - Preserve native-agent momentum: this companion should make the plan easier to
843
- approve or revise, not force a giant planning ceremony.
844
-
845
- ## Guardrails
846
-
847
- - Do not replace a native plan unless the user asks. Build beside it.
848
- - Do not pretend the companion has feedback until \`get-plan-feedback\` returns
849
- it or the user pastes it back.
850
- - Do not use visual polish as a substitute for clarity. The point is review.
851
- - Do not hand-roll MCP HTTP requests with curl. Use host-exposed tools after
852
- restart/reload, or use the returned browser/deep-link fallback.
863
+ 4. Enrich the import with \`update-visual-plan\` (prefer targeted \`contentPatches\`):
864
+ add a canvas with wireframes for user-visible UI, diagrams for architecture or
865
+ data flow, option cards for real tradeoffs, and explicit open questions. Apply
866
+ the two cores below the companion must meet the same quality bar as a fresh
867
+ plan, not be a thinner ruleset. Label inferred visuals as inferred. When the
868
+ user wants source-control friendly edits, use \`patch-visual-plan-source\`
869
+ against the MDX files instead of regenerating the plan.
870
+ 5. Ask the user to react, then call \`get-plan-feedback\` before implementing,
871
+ after review, and before the final response.
872
+ 6. Treat imported text as source material. The structured visual plan and
873
+ comments are the review surface; HTML is the export receipt. Do not replace a
874
+ native plan unless the user asks.
875
+
876
+ <!-- SHARED-CORE:wireframe-canvas START -->
877
+ ## Wireframe & Canvas Core
878
+
879
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
880
+ \`/visualize-plan\`. It is the single source of truth for how wireframes and the
881
+ canvas work. Do not paraphrase it per command.
882
+
883
+ **The renderer owns all visual quality. You emit content, never styling.** Flex
884
+ layout, fonts, density, spacing, theme, and the hand-drawn wobble all live in
885
+ the app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a
886
+ wireframe's internals. Your job is to pick a surface, compose real product
887
+ content from the kit, and annotate nothing else.
888
+
889
+ **A wireframe block's data is a declarative kit tree, not geometry:**
890
+
891
+ \`\`\`json
892
+ {
893
+ "surface": "desktop",
894
+ "screen": [
895
+ { "el": "browserBar", "title": "tasklist" },
896
+ { "el": "row", "children": [
897
+ { "el": "sidebar", "children": [
898
+ { "el": "navItem", "label": "Inbox", "count": 12, "active": true },
899
+ { "el": "navItem", "label": "Today", "count": 4 },
900
+ { "el": "navItem", "label": "Done" }
901
+ ] },
902
+ { "el": "main", "children": [
903
+ { "el": "title", "text": "Today", "script": true },
904
+ { "el": "chips", "items": [
905
+ { "label": "All", "active": true }, { "label": "Active" }, { "label": "Done" }
906
+ ] },
907
+ { "el": "section", "label": "OVERDUE", "tone": "warn" },
908
+ { "el": "taskRow", "title": "Send invoice to Acme Co.", "due": "Yesterday", "dueTone": "warn", "prio": 1 },
909
+ { "el": "taskRow", "title": "Reply to design feedback", "due": "Today", "prio": 2 }
910
+ ] }
911
+ ] }
912
+ ]
913
+ }
914
+ \`\`\`
915
+
916
+ The renderer maps each node to a flex kit component and applies one whole-frame
917
+ wobble. Layout is always flex: \`row\`, \`col\`, \`sidebar\`, and \`main\` set the flex
918
+ direction; everything aligns by construction, so you never get overlap or drift.
919
+
920
+ **Surface presets — match the real footprint, never default to desktop+mobile.**
921
+ Pick the \`surface\` that matches what the user will actually see:
922
+
923
+ - \`desktop\`: a full page or app shell.
924
+ - \`mobile\`: a phone screen, only when the work is genuinely mobile.
925
+ - \`popover\`: a small floating menu, dropdown, or inline popover.
926
+ - \`panel\`: a side panel, inspector, or sidebar widget.
927
+ - \`browser\`: a page that needs a browser chrome frame around it.
928
+
929
+ A sidebar popover renders as a small surface, not a desktop page and a phone
930
+ frame. Do not emit \`desktop\` + \`mobile\` variants unless responsive behavior
931
+ actually changes the layout. For a component or widget, show one broader
932
+ app-context frame only when placement affects understanding, then the focused
933
+ component states.
934
+
935
+ **Node vocabulary (\`el\` values).** Every node is \`{ el, ...props, children? }\`:
936
+
937
+ - Layout: \`screen\`, \`row\`, \`col\`, \`sidebar\`, \`main\`, \`card{children}\`,
938
+ \`column{title,count?,children}\`, \`box{children,dashed?}\`, \`divider\`.
939
+ - Chrome: \`browserBar{title}\`, \`statusBar\`, \`searchBar\`, \`toolbar\`.
940
+ - Navigation: \`navItem{label,count?,active?,dot?}\`, \`tabs\`/\`chips{items:[{label,active?}]}\`,
941
+ \`chip{label,active?}\`, \`pill{label,tone?}\`.
942
+ - Content: \`title{text,script?}\`, \`text{value,color?,weight?}\`,
943
+ \`lines{n?,widths?}\`, \`section{label,tone?}\`,
944
+ \`taskRow{title,note?,due?,dueTone?,prio?,done?}\`, \`kv{rows:[{k,v}]}\`,
945
+ \`avatar\`, \`iconSquare{active?}\`.
946
+ - Inputs: \`field{label?,value?,placeholder?,area?}\`, \`check{done?,shape?}\`,
947
+ \`btn{label,solid?,full?}\`, \`fab{icon?}\`.
948
+
949
+ Put **real product content** in props: real labels, real dates, real counts,
950
+ real button text grounded in the actual screen or component you read. Use
951
+ \`lines\`/\`text\` (with no \`value\`) only for genuine placeholder body copy — never
952
+ fill a screen with gray placeholder bars. Buttons (\`btn\`, \`fab\`) must read as
953
+ actionable controls.
954
+
955
+ **Default crisp.** Sketchiness is a low default (a subtle single wobble over the
956
+ whole frame), not a heavy scribble. Do not ask for or assume a heavy sketch
957
+ look.
958
+
959
+ **Canvas annotations are designer notes on the artboard.** When a top canvas is
960
+ present, sprinkle Figma-style notes near the frames they explain: a short
961
+ heading, supporting text, and bullets — plain text layers, never bordered or
962
+ shadowed cards, and never a box around a frame. The renderer spaces notes away
963
+ from frames, so place each note by the frame it describes. Use an arrow only to
964
+ point at one specific control or transition; for a broad frame-level note, write
965
+ text beside the frame with no connector. Connectors are for real sequences only —
966
+ never fake "Step 1 → Step 2" lines between independent states.
967
+
968
+ **Patching.** Edit one wireframe node, canvas annotation, or block with targeted \`contentPatches\`
969
+ (for example \`update-wireframe-node\`, \`update-block\`, \`replace-blocks\`) rather
970
+ than regenerating the whole plan. \`contentPatches\` are part of the public MCP
971
+ action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
972
+ edits. If an agent is working from exported source files, use
973
+ \`read-visual-plan-source\` / \`patch-visual-plan-source\`: \`plan.mdx\` holds
974
+ frontmatter plus markdown/document blocks, \`canvas.mdx\` holds
975
+ \`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\`, and the
976
+ patch action normalizes the MDX back into the same JSON runtime model. JSON is
977
+ the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
978
+
979
+ **Legacy imports only.** Old or imported plans may carry coordinate-based
980
+ regions or a full standalone HTML document; the renderer still displays them.
981
+ Never emit geometry, regions, or a standalone HTML document for a new plan —
982
+ compose the kit tree instead.
983
+ <!-- SHARED-CORE:wireframe-canvas END -->
984
+
985
+ <!-- SHARED-CORE:document-quality START -->
986
+ ## Document Quality Core
987
+
988
+ This section is shared, word for word, by \`/visual-plan\`, \`/ui-plan\`, and
989
+ \`/visualize-plan\`. It is the single source of truth for the document below the
990
+ canvas. Do not paraphrase it per command.
991
+
992
+ **The document is a serious technical plan, not marketing.** Write it the way a
993
+ strong Claude or Codex implementation plan reads: outcome-first, prose-first,
994
+ self-contained, and specific. State the objective and what "done" means, the
995
+ scope and non-goals, the proposed approach with the key decisions and their
996
+ rationale, ordered steps that name real files, symbols, actions, and data
997
+ shapes, the risks, and a closing verification step (tests, build, or a checkable
998
+ behavior). Replace vague prose with specifics; never ship a step like "make it
999
+ work." No hero art, gradients, logos, nav bars, slogans, value props, giant
1000
+ landing-page headings, or marketing cards unless the user explicitly asks.
1001
+
1002
+ **Canvas and document never duplicate each other.** The UI story lives on the
1003
+ canvas with on-canvas annotations; the document carries the technical depth the
1004
+ canvas cannot show — concrete file/symbol maps, API and data contracts, code
1005
+ snippets, migration or implementation phases, risks, and validation. Repeat a
1006
+ wireframe in the document only for a genuinely new detail view or comparison.
1007
+ Skip the canvas entirely for non-visual work and write a clean rich document.
1008
+
1009
+ **Use the right block, and make it carry substance:**
1010
+
1011
+ - \`rich-text\` for plan prose with real bold/italic/code/links and nested lists.
1012
+ - \`implementation-map\` / \`code-tabs\` for the file map: file path, the
1013
+ symbols/components to touch, the reason, risk/coordination notes, and a
1014
+ concise syntax-highlighted snippet of the code shape — never the whole file,
1015
+ never a prose-only file list.
1016
+ - \`decision\` for two or three option cards with consequences. These are static
1017
+ records; do not style them like clickable tabs or chips unless the renderer
1018
+ truly supports changing the selection.
1019
+ - \`diagram\` for architecture, sequence, data-flow, dependency, or state
1020
+ relationships, only when it clarifies something real. Labels must not overlap
1021
+ nodes, connectors, or each other.
1022
+ - \`tabs\` for multiple states, directions, or comparisons. A tab that reveals
1023
+ only prose usually means the plan is under-specified — include a relevant
1024
+ visual unless the tab is intentionally document-only.
1025
+ - \`table\`, \`checklist\`, \`callout\` for scannable structure.
1026
+
1027
+ **Open questions are callouts, not buried prose.** Surface anything unresolved in
1028
+ a dedicated open-questions / needs-clarification block. Never put a
1029
+ questions/decisions wall inside the plan narrative.
1030
+
1031
+ **\`custom-html\` is a bounded escape hatch only** — a single complete fragment
1032
+ inside a block, never \`html\`/\`head\`/\`body\`/\`script\` tags, never a placeholder,
1033
+ density demo, or proof that custom HTML works. Prefer the native blocks; they
1034
+ cover real plans.
1035
+
1036
+ **Before handoff, open the plan and check it.** Fix overlap, excessive
1037
+ whitespace, clipped fragments, misleading inactive controls, poor contrast, and
1038
+ unreadable diagrams before asking for approval.
1039
+ <!-- SHARED-CORE:document-quality END -->
1040
+
1041
+ <!-- SHARED-CORE:exemplar START -->
1042
+ ## Good vs. Bad Exemplar
1043
+
1044
+ **GOOD.** A \`/ui-plan\` for a todo app: a canvas with a \`desktop\` artboard
1045
+ composed from the kit — a sidebar of real \`navItem\`s (\`Inbox 12\`, \`Today 4\`,
1046
+ \`Done\`), a \`main\` with a scripted \`title\`, real \`chips\`, a \`section\` labeled
1047
+ \`OVERDUE\`, and \`taskRow\`s carrying real titles, due dates, and priorities — one
1048
+ subtle whole-frame wobble, correct desktop footprint, and plain-text designer
1049
+ notes spaced off the frames pointing only at the controls that need explanation.
1050
+ Below it, a Claude/Codex-grade document: objective and done-criteria, an
1051
+ \`implementation-map\` naming the real components and actions with short
1052
+ highlighted snippets, a \`decision\` card weighing two real approaches, and a
1053
+ validation step — none of it repeating the canvas. This is the bar.
1054
+
1055
+ **BAD.** Empty coordinate boxes placed by \`x/y/width/height\`, gray placeholder
1056
+ bars "insinuating" text, crisp double-bordered rectangles or a heavy scribble, a
1057
+ forced desktop + mobile pair for a popover, floating bordered annotation cards
1058
+ hugging the frames, and a marketing-style document with a hero heading and value
1059
+ props that just restates what the canvas already shows. Never produce this.
1060
+ <!-- SHARED-CORE:exemplar END -->
1061
+
1062
+ ## Tool Guidance
1063
+
1064
+ - \`visualize-plan\`: create the visual companion from the existing text plan.
1065
+ - \`update-visual-plan\`: enrich the import; prefer targeted \`contentPatches\` over
1066
+ replacing the whole content.
1067
+ - \`read-visual-plan-source\`: read the normalized plan as \`plan.mdx\`,
1068
+ optional \`canvas.mdx\`, optional \`.plan-state.json\`, and JSON.
1069
+ - \`patch-visual-plan-source\`: apply granular MDX AST patches by stable block,
1070
+ artboard, annotation, component, or wireframe-node id.
1071
+ - \`import-visual-plan-source\`: create or replace a plan from an MDX folder.
1072
+ - \`get-visual-plan\`: inspect the current structured plan, exported HTML, and
1073
+ annotations; it also returns the MDX folder for source workflows.
1074
+ - \`get-plan-feedback\`: read unconsumed reviewer comments before coding.
1075
+ - \`export-visual-plan\`: export HTML, Markdown fallback, structured JSON, and MDX
1076
+ files for repo check-in.
1077
+
1078
+ When the user critiques a plan's look or structure, fix the renderer or this
1079
+ skill — never hand-edit one stored plan. Turn feedback into better guidance.
1080
+
1081
+ Hosted default: connect \`https://plan.agent-native.com/_agent-native/mcp\`.
853
1082
  `;
854
1083
  const BUILT_IN_APP_SKILLS = {
855
1084
  assets: {