@hybridlabor-api/aos 4.17.0 → 4.18.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 (88) hide show
  1. package/.claude/hooks/aos-bus.mjs +8 -4
  2. package/.claude/hooks/go-gate.mjs +1 -1
  3. package/.claude/hooks/go-token.mjs +17 -2
  4. package/.claude/hooks/memb-inject.mjs +61 -37
  5. package/.codex-plugin/plugin.json +1 -1
  6. package/.opencode/commands/bdb-aos-plan.md +1 -1
  7. package/README.md +1 -0
  8. package/THIRD_PARTY_NOTICES.md +2 -2
  9. package/bin/aos-acp.mjs +27 -1
  10. package/bin/aos-doctor.mjs +36 -1
  11. package/bin/aos-uninstall.mjs +16 -2
  12. package/bin/go-check.mjs +79 -0
  13. package/bin/guarded-patterns.json +106 -0
  14. package/commands/plan.md +1 -1
  15. package/docs/codenotch.md +44 -0
  16. package/docs/codex-gate-smoke.md +43 -0
  17. package/docs/delegation-routing.md +32 -0
  18. package/docs/go-check.md +60 -0
  19. package/docs/master-session-acp.md +2 -0
  20. package/docs/opencode-setup.md +18 -0
  21. package/installer.js +155 -70
  22. package/lib/codenotch.js +389 -0
  23. package/lib/retired-skills.js +101 -0
  24. package/mcps/mcsc/README.md +1 -1
  25. package/mcps/mcsc/packages/core/src/adapters/agy.js +3 -1
  26. package/mcps/mcsc/packages/core/src/adapters/codex.js +2 -1
  27. package/mcps/mcsc/packages/core/src/adapters/opencode.js +2 -1
  28. package/mcps/mcsc/packages/core/src/depth.js +16 -0
  29. package/mcps/mcsc/packages/mcp/server.js +15 -2
  30. package/package.json +2 -2
  31. package/plugin-commands.json +1 -2
  32. package/plugin.json +1 -4
  33. package/plugins/bdb-aos-codex/.codex-plugin/plugin.json +1 -1
  34. package/plugins/bdb-aos-codex/skills/plan/SKILL.md +1 -1
  35. package/scripts/codex-gate-smoke.mjs +73 -0
  36. package/skills/basic/master-session/SKILL.md +11 -0
  37. package/skills/global_config/agenttrail/SKILL.md +3 -1
  38. package/skills/global_config/agenttrail/bin/agenttrail.mjs +255 -117
  39. package/skills/global_config/agenttrail/bin/ensure.mjs +60 -40
  40. package/skills/global_config/agenttrail/bin/repoid.mjs +70 -0
  41. package/skills/global_config/agenttrail/public/index.html +9 -1
  42. package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
  43. package/skills/global_config/bdb-memb-mcp/SKILL.md +5 -4
  44. package/skills/global_config/bdb-visual-edit/SKILL.md +28 -32
  45. package/skills/global_config/bdb-visual-edit/references/vite-react-source-attr.md +2 -2
  46. package/skills/global_config/bdb-visual-edit/scripts/locate-source.mjs +135 -0
  47. package/skills/global_config/bdb-visual-edit/scripts/sanitize-element.mjs +30 -2
  48. package/skills/global_config/mcsc/SKILL.md +9 -1
  49. package/skills/global_config/plan-arbiter/SKILL.md +1 -1
  50. package/skills/global_config/plan-canvas/SKILL.md +42 -4
  51. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/README.md +1 -1
  52. package/skills/global_config/plan-canvas/scripts/lib/plan-builder/render.js +2 -2
  53. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/geometry.js +76 -0
  54. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/index.js +596 -0
  55. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/model.js +192 -0
  56. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-client/toolbar.js +99 -0
  57. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotate-server.js +282 -0
  58. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/annotation-schema.js +210 -0
  59. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/route.js +10 -0
  60. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sdk.js +6 -230
  61. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/server.js +45 -4
  62. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/sessions.js +60 -21
  63. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/trail-on-approve.js +103 -0
  64. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +19 -7
  65. package/skills/global_config/plan-canvas/scripts/plan-canvas.js +118 -20
  66. package/skills/global_config/subagent-setup/SKILL.md +6 -0
  67. package/skills/global_config/subagent-setup/scripts/setup-subagents.mjs +20 -1
  68. package/skills/playbooks/pb-idea-to-launch/SKILL.md +2 -2
  69. package/skills/playbooks/pb-redesign-app/SKILL.md +3 -3
  70. package/skills/playbooks/pb-release-aos/SKILL.md +2 -2
  71. package/skills/playbooks/pb-ship/SKILL.md +2 -2
  72. package/skills/playbooks/pb-worktrees-land/SKILL.md +2 -2
  73. package/skills/global_config/bdb-visual-edit/scripts/pick-snippet.js +0 -27
  74. package/skills/global_config/visual-edit/README.md +0 -96
  75. package/skills/global_config/visual-edit/SKILL.md +0 -615
  76. package/skills/global_config/visual-plan/README.md +0 -93
  77. package/skills/global_config/visual-plan/SKILL.md +0 -544
  78. package/skills/global_config/visual-plan/references/canvas.md +0 -139
  79. package/skills/global_config/visual-plan/references/connection.md +0 -51
  80. package/skills/global_config/visual-plan/references/document-quality.md +0 -186
  81. package/skills/global_config/visual-plan/references/exemplar.md +0 -62
  82. package/skills/global_config/visual-plan/references/local-files.md +0 -99
  83. package/skills/global_config/visual-plan/references/wireframe.md +0 -319
  84. package/skills/global_config/visual-recap/README.md +0 -103
  85. package/skills/global_config/visual-recap/SKILL.md +0 -560
  86. package/skills/global_config/visual-recap/references/connection.md +0 -51
  87. package/skills/global_config/visual-recap/references/local-files.md +0 -99
  88. package/skills/global_config/visual-recap/references/wireframe.md +0 -319
@@ -1,139 +0,0 @@
1
- # Canvas & artboard placement — single source of truth
2
-
3
- This file is the canonical guide for how the visual-plan canvas works: artboard
4
- placement, lane layout, annotations, patching, and the legacy kit tree. Read it
5
- in full before authoring or editing any canvas/artboard content; do not author
6
- canvas layouts from memory or paraphrase these rules per mode.
7
-
8
- <!-- SHARED-CORE:canvas-surface START -->
9
-
10
- **The coordinate rule.** The `surface` sets each artboard's default footprint
11
- and width — never set width or use coordinates inside the wireframe HTML.
12
- Board-level artboard `x`/`y` IS allowed when it creates clear lanes. A
13
- larger explicit artboard `height` is allowed when the screen's content needs
14
- more vertical room; canvas frames do not scroll, so reserve enough height to
15
- show the entire UI. Let canvas auto-placement handle simple one-row boards.
16
-
17
- **Lay out mixed canvases in lanes.** When a canvas contains broad browser /
18
- desktop frames plus compact `mobile`, `popover`, or `panel` surfaces, do not put
19
- everything in one horizontal strip. Use board-level artboard `x`/`y` to reserve
20
- lanes with generous empty space: main flow on one row, compact surfaces in their
21
- own column or row, and loading/error states in a lower row. Keep at least 96px
22
- between rendered artboard rectangles plus room for annotation gutters; when a
23
- broad browser/desktop frame sits beside a compact panel/popover, leave at least
24
- 160px so frame borders, labels, and hover controls never touch. Connect only
25
- neighboring steps; never draw a long connector that skips across unrelated
26
- frames. Connector labels must sit in open canvas space. If the label would touch
27
- or cross either artboard, remove the label and explain the transition with a
28
- nearby annotation instead. Before handoff, inspect the top canvas at default zoom
29
- and move any frame whose label, connector, or annotation crosses another frame.
30
-
31
- **Board-unit spacing defaults.** The canvas coordinate system uses approximately 2 board units per screen pixel. `browser` frames occupy roughly 700 × 600 board units; `desktop` frames roughly 900 × 700 board units. Apply these minimum x/y gaps when placing frames explicitly — any less and frames will touch or overlap:
32
-
33
- - x-gap between `browser` frames: **≥ 1100** (700-unit frame + 400-unit gutter)
34
- - x-gap between `desktop` frames: **≥ 1300** (900-unit frame + 400-unit gutter)
35
- - y-gap between rows of any surface: **≥ 1400** (includes frame height + section header + buffer)
36
-
37
- When in doubt, use larger values — the canvas auto-zooms to fit everything.
38
-
39
- **Full-content artboards.** Canvas frames are pan/zoom surfaces, not scroll
40
- containers. Keep wireframe HTML in natural document flow without an inner
41
- scroll region or fixed child height. If the screen is taller than the default
42
- surface preset, set the artboard's `height` to the measured content height plus
43
- breathing room; keep the surface width unchanged. Before handoff, inspect the
44
- bottom edge of every artboard at default zoom and confirm no control, row, or
45
- footer is clipped.
46
-
47
- **Canvas annotations are designer notes on the artboard.** When a top canvas is
48
- present, sprinkle design-review notes near the frames they explain: a short
49
- heading, supporting text, and bullets — plain text layers, never bordered or
50
- shadowed cards, and never a box around a frame. The renderer spaces notes away
51
- from frames, so place each note by the frame it describes. Use an arrow only to
52
- point at one specific control or transition; for a broad frame-level note, write
53
- text beside the frame with no connector. Connectors are for real sequences only —
54
- never fake "Step 1 → Step 2" lines between independent states.
55
-
56
- **Do not create overlapping annotations.** Anchor each ordinary note to the
57
- frame it explains with `targetId` + `placement` (top/right/bottom/left), and
58
- omit `type` or use `type: "note"`. The renderer parks notes in a gutter beside
59
- the frame and lays them out automatically. Do not use `type: "callout"`,
60
- `type: "text"`, `type: "arrow"`, x/y, or points for ordinary notes; those are
61
- freeform review-markup layers and must be reserved for intentional markup in
62
- open canvas space. Reserve arrows for a note that must point at one specific
63
- control inside a frame; a note that simply sits beside its frame needs no arrow.
64
-
65
- **Patching.** Edit one wireframe, canvas annotation, diagram, or block with targeted `contentPatches`
66
- (for example `patch-wireframe-html`, `patch-diagram-html`, `update-block`,
67
- `replace-blocks`, `update-canvas-annotation`) rather
68
- than regenerating the whole plan. `contentPatches` are part of the public MCP
69
- action schema, so Claude Code, Codex, Cursor, and other hosts can make surgical
70
- edits. If an agent is working from exported source files, use
71
- `read-visual-plan-source` / `patch-visual-plan-source`: `plan.mdx` holds
72
- frontmatter plus markdown/document blocks, `canvas.mdx` holds
73
- `<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>`, and the
74
- patch action normalizes the MDX back into the same JSON runtime model. JSON is
75
- the canonical runtime shape; MDX is the repo-friendly authoring/export surface.
76
- In the browser, humans edit `rich-text` prose inline; agents should still use
77
- `update-rich-text` content patches or source patches for prose, and use
78
- comments/structured patches for canvas, artboard, wireframe, and diagram edits.
79
- Never send a partial top-level `content` object as a shortcut to add a canvas,
80
- frame, or block: `content` is a full structured replacement, so omitted blocks
81
- or surfaces can disappear. If a full replacement is truly unavoidable, read the
82
- complete source/JSON first, include every existing block and surface in the new
83
- payload, and verify the source/export immediately after the update.
84
-
85
- **Never emit a titled artboard with no interior wireframe content.** Every artboard
86
- you place on the canvas must carry an `html` wireframe or reference a wireframe
87
- block via `blockId`; when using `blockId`, the referenced `wireframe` /
88
- `legacy-wireframe` block must remain in the plan. If you remove a duplicate
89
- wireframe from the document body, first move its `data` inline onto the
90
- corresponding `content.canvas.frames[*].wireframe` / `legacyWireframe`. A
91
- label-only frame or a frame pointing at a deleted block renders empty and is
92
- rejected at parse time. If you only have a title, write it as a section header or
93
- annotation, not an empty artboard.
94
-
95
- **UI mockups belong in the top visual review area.** Static UI/product visuals
96
- live on the canvas; multi-step UI flows get both canvas wireframes and a
97
- prototype. When the user asks for a mockup, UI state, loading state, layout,
98
- screen, or visual comparison, make the canvas the primary home for that static
99
- visual. When the user asks for a prototype or the plan contains a sequence the
100
- reviewer must feel, keep the canvas artboards and add `content.prototype` so the
101
- top surface shows Wireframes / Prototype tabs. Architecture/code diagrams stay
102
- inline in the document (the SKILL.md Visual Surface Choice section owns that
103
- rule) unless the user explicitly asks for a spatial board. Document blocks
104
- can explain, compare, or map implementation, but they should not host the
105
- primary UI mockup or prototype just because `custom-html`, screenshots, or prose
106
- are easier to produce. If the canvas/prototype surface cannot represent the
107
- requested UI fidelity, still keep the closest top-surface representation and
108
- call out or extend the needed renderer capability. A skeleton/loading mockup
109
- also lives in a canvas artboard — never move a mockup out of the canvas.
110
-
111
- **Storyboards are canvas artifacts, not document diagrams.** When the requested
112
- output is a product flow, onboarding journey, "light storyboard", or canvas
113
- wireframe, author the flow as multiple top-canvas artboards with real screen
114
- content and neighboring connectors. Keep document-body `diagram` blocks for
115
- architecture and mechanics that are not themselves user-visible screens. A
116
- storyboard made from a single inline HTML diagram is the wrong surface.
117
-
118
- For abstract product concepts, use the canvas to create the first "I get it"
119
- moment: one real app state near the top showing how the concept appears to a
120
- user, followed by separate annotations or diagrams for mechanics. Do not make
121
- the first artboard a hybrid of app UI and architecture notes; the app screen
122
- should be inspectable as product UI on its own.
123
-
124
- **Legacy kit tree.** Older plans set a `screen` array of `{ el, ...props }` kit
125
- nodes instead of `html`; the renderer still accepts and displays it so saved
126
- plans round-trip, but new plans emit `html`. Do not author fresh kit-tree
127
- screens, and do not put nested kit components such as `<FrameScreen>`, `<Card>`,
128
- `<Row>`, `<Title>`, or `<Btn>` inside a canvas `<Screen>`. A new canvas artboard
129
- with kit-tree children is a defect: replace it with
130
- `<Screen surface="..." html={...} />` using the HTML wireframe rules. The HTML
131
- path is the one that gets the renderer-owned surface sizing, theme tokens,
132
- sketch/clean toggle, and safe text layout used by good document-body
133
- wireframes. Likewise, old or imported plans may carry coordinate-based regions
134
- or free-float x/y on notes; those are legacy escape hatches the renderer still
135
- shows but you must never produce. The gutter parks notes by `targetId` +
136
- `placement`, and the coordinate rule at the top of this file governs all
137
- new-plan placement.
138
-
139
- <!-- SHARED-CORE:canvas-surface END -->
@@ -1,51 +0,0 @@
1
- # Connecting & publishing — single source of truth
2
-
3
- This file is the canonical rule for the never-inline deliverable, finding the
4
- Plan MCP connector, and restoring it when its tools are missing. It is shared
5
- word for word by `/visual-plan` and `/visual-recap`. Read it when you are about
6
- to publish, or whenever a connector or auth error appears; do not improvise an
7
- inline fallback from memory.
8
-
9
- <!-- SHARED-CORE:connection START -->
10
-
11
- **The deliverable is ALWAYS a published Agent-Native Plan, never inline chat
12
- content.** Do not hand the plan or recap to the user as Markdown prose, an ASCII
13
- sketch, a table, a fenced "wireframe", or a "here's the summary" paragraph. The
14
- entire value is the hosted, interactive, annotatable Plan; an inline summary is
15
- the thing a Plan replaces, not a degraded version of one. The only supported
16
- output is to publish through the Plan MCP connector and return its absolute URL.
17
- Local-files privacy mode (`references/local-files.md`) is the one exception.
18
-
19
- **The connector is usually the `plan` server**, but older installed agents may
20
- expose the same hosted connector as `agent-native-plans` — both names are valid,
21
- so never report the connector as missing just because it is named
22
- `agent-native-plans` instead of `plan`. Some clients also lazy-load connector
23
- tools through a deferred tool registry instead of showing the namespace upfront.
24
- Before declaring the connector missing, search/load tools with the host's
25
- discovery surface (`tool_search` when available) for `create_visual_plan`,
26
- `create_visual_recap`, or `get_plan_blocks`, then use the tools it exposes.
27
-
28
- **If the tools are still missing after discovery, do NOT fall back to inline
29
- output.** The usual cause is a connector that did not finish connecting this
30
- session (it registers zero tools), NOT necessarily an auth problem — so do not
31
- assume the user must re-authenticate. Stop and give the user the exact restore
32
- step for their current client:
33
-
34
- - **Codex / Codex Desktop:** run
35
- `npx -y @agent-native/core@latest reconnect https://plan.agent-native.com --client codex`
36
- and start a new Codex session.
37
- - **Claude Code:** run `/mcp` and choose Authenticate/Reconnect, or run the same
38
- reconnect command with `--client claude-code` and restart Claude.
39
-
40
- The same applies when a Plan tool returns `needs auth`, `Unauthorized`, or
41
- `Session terminated`: stop retrying the tool and give the reconnect step instead.
42
-
43
- Auth is stored per client config/session, so one client's reconnect does not make
44
- another running client load tools. `--client all` refreshes every local client
45
- config that already has the Plan entry, but each running client still has to
46
- reload its MCP tools afterward. Reconnect re-authenticates WITHOUT reinstalling
47
- and finds the entry by URL regardless of connector name — never reinstall from
48
- scratch just to fix auth. Publish once the tool is reachable. Falling back to
49
- inline content is a defect, not a degraded mode.
50
-
51
- <!-- SHARED-CORE:connection END -->
@@ -1,186 +0,0 @@
1
- # Plan document quality — single source of truth
2
-
3
- This file is the canonical quality bar for the plan document below the canvas:
4
- how it reads, which blocks to use, how open questions are surfaced, and the
5
- pre-handoff check. Read it in full before authoring the plan document; it is the
6
- quality bar. Do not write the document from memory or paraphrase these rules per
7
- mode.
8
-
9
- <!-- SHARED-CORE:document-quality START -->
10
-
11
- **The document is a serious technical plan, not marketing.** Write it the way a
12
- strong Claude or Codex implementation plan reads: outcome-first, prose-first,
13
- self-contained, and specific. State the objective and what "done" means, the
14
- scope and non-goals, the proposed approach with the key decisions and their
15
- rationale, ordered steps that name real files, symbols, actions, and data
16
- shapes, the risks, and a closing verification step (tests, build, or a checkable
17
- behavior). Replace vague prose with specifics; never ship a step like "make it
18
- work." No hero art, gradients, logos, nav bars, slogans, value props, giant
19
- landing-page headings, or marketing cards unless the user explicitly asks.
20
-
21
- **Every published plan must stand alone.** Even when the agent is revising an
22
- existing plan, the output is a plan to do the work, not a changelog of the
23
- conversation. Do not write phrases like "preserve the previous plan", "do not
24
- drop the old idea", "as discussed above", "this revision", "unlike the prior
25
- version", or "correction from the earlier plan". Fold the right decisions into
26
- the plan as normal objective, architecture, scope, and roadmap prose. A reviewer
27
- who opens the plan from a link with no chat history should understand it. Avoid
28
- negative framing that only makes sense against absent context ("not the old
29
- mode", "not just X") unless the contrast is defined in the plan and genuinely
30
- helps; state the positive model directly.
31
-
32
- **Make abstract plans instantly legible.** If the idea is broad, strategic, or
33
- intended for a third-party reviewer, put one concrete product snapshot near the
34
- top before dense architecture, mode tables, manifests, or roadmaps. For
35
- UI-capable concepts, that snapshot is usually a top-canvas app state plus a
36
- short paragraph that says what the user sees and what changes under the hood.
37
- Then put mechanics, data flow, sync boundaries, and implementation detail in
38
- separate diagrams or document sections.
39
-
40
- **Preserve the user's level of abstraction.** A motivating use case is not
41
- automatically the architecture. When the prompt describes a broader framework,
42
- product mode, or reusable primitive, separate the reusable core from specific
43
- apps, providers, customers, scripts, or launch examples. Use the concrete
44
- example to make the plan understandable, then make clear which parts are core,
45
- which are app-specific adapters, and which are future examples.
46
-
47
- **When top visuals exist, they and the document never duplicate each other.**
48
- For UI work, the UI story lives in the top visual surface: canvas artboards for
49
- static inspection, plus prototype tabs when the flow should be functional. The
50
- document carries the technical depth the visuals cannot show — concrete
51
- file/symbol maps, API and data contracts, code snippets, migration or
52
- implementation phases, risks, and validation. For architecture/code reviews,
53
- invert that: the document is the visual surface, and each recommendation
54
- carries its own nearby inline `diagram` / `data-model` block plus file
55
- evidence (the `diagram` bullet below owns how to author those diagrams).
56
- Repeat a wireframe in the document only for a genuinely new detail view or
57
- comparison. Skip the visual surface entirely for non-visual work and write a
58
- clean rich document. For a simple binary UI visual choice, show the two
59
- directions in the canvas only; do not repeat the same options as body
60
- wireframes or prose. Put the actual choice in the bottom "Open Questions" form.
61
-
62
- **Use the right block, and make it carry substance.** For the authoritative,
63
- machine-checked list of block types and their data schemas, call `get-plan-blocks`
64
- — it returns the live registry vocabulary (type, MDX tag, placement, key fields)
65
- so you never emit a block the editor cannot render or round-trip:
66
-
67
- - `rich-text` for plan prose with real bold/italic/code/links and nested lists.
68
- - `annotated-code` for the file map: when a load-bearing file is worth
69
- highlighting, prefer the annotated walkthrough over a bare `code` block — carry
70
- the real, syntax-highlighted code AND anchor short margin notes to the lines
71
- that actually change (the new action, the changed schema, the wiring point), so
72
- the reader sees what matters and why instead of code for code's sake. Each
73
- annotation is `{ lines: "12" | "12-18"; label?; note }`; keep a few high-signal
74
- notes per file, not one per line. Highlight only the files worth reading; never
75
- an exhaustive list of every touched file, and never a prose-only description of
76
- a file. Drop to a plain `code` block only for a throwaway snippet with nothing
77
- to call out. When more than one file matters, group the blocks in a vertical
78
- `tabs` block (the standard tab primitive) rather than a bespoke container. If
79
- the exact code is unknown, show the smallest plausible planned shape or a
80
- commented stub naming what to fill in. (`code-tabs` and `implementation-map`
81
- are legacy: their renderers stay for old plans, but do not author new ones.)
82
- - For a decision: if the reviewer must still pick between a genuinely-open
83
- either/or, put it in the bottom Open Questions `question-form` as a `single`
84
- question — one option per real alternative, each with a short detail and
85
- `recommended: true` on the one you would choose; do not also restate the same
86
- choice elsewhere. If you have already committed to an approach, state it as
87
- settled prose or a `callout` with `tone="decision"`, optionally with a
88
- `columns` block for a side-by-side comparison of the options you weighed — not
89
- as a confusing mid-document form for a question you have already answered.
90
- - `columns` for side-by-side before/after or current/target comparisons where
91
- each side needs real nested blocks; label the columns clearly and avoid
92
- stacking comparison blocks vertically when parallel reading is the point.
93
- - `diagram` for two-dimensional architecture, dependency, data-flow, or state
94
- relationships, only when it clarifies something real. Prefer standard
95
- two-dimensional layouts — paired before/after panels, layered diagrams,
96
- swimlanes, dependency maps, matrices, or grouped regions; do not default to
97
- left-to-right chains, and use a line only when the relationship is truly a
98
- sequence. Do not use a body `diagram` as the primary artifact for a requested
99
- product canvas, light storyboard, UI flow, screen flow, or wireframe; those
100
- belong in the top canvas as artboards with `Screen` wireframes first. Use
101
- diagrams below that canvas only for architecture, data flow, or implementation
102
- mechanics. For architecture/code
103
- diagrams, prefer `data.html` / `data.css` with semantic HTML and inline SVG so
104
- the diagram can use panels, layers, matrices, arrows, annotations, and
105
- responsive layout directly. Author diagram HTML with renderer-owned primitives
106
- like `.diagram-panel`, `.diagram-card`, `.diagram-node`, `.diagram-box`,
107
- `.diagram-pill`, `.diagram-muted`, and `[data-rough]`; they map to the plan's
108
- Tailwind theme variables through `--wf-ink`, `--wf-muted`, `--wf-line`,
109
- `--wf-paper`, `--wf-card`, `--wf-accent`, `--wf-accent-soft`, `--wf-warn`, and
110
- `--wf-ok`, and switch to Excalifont plus rough.js outlines in sketchy mode. Do not
111
- set `font-family` and do not hard-code hex, rgb, or hsl colors in diagram HTML
112
- or CSS. Choose the outer `frame` intentionally: use `show` when the diagram
113
- stands alone in a recap, comparison, or prose section; use `hide` when the
114
- diagram sits inside docs chrome, columns, tabs, cards, a canvas surface, or
115
- already has visible `.diagram-panel` / `.diagram-box` structure. Leave room
116
- for the sketch font: keep labels short, give nodes generous width, and place
117
- boundary/annotation labels in unused space instead of over nodes; labels must
118
- not overlap nodes, connectors, or each other. For small text/SVG changes to an
119
- existing HTML diagram, use `patch-diagram-html` with a unique
120
- `find`/`replace` snippet instead of resending the whole `data.html` string.
121
- Use legacy `nodes` / `edges` only for small previews or truly
122
- sequential flows. In architecture/code plans, prefer a repeated section rhythm:
123
- recommendation title, confidence and category badges, code-path evidence, a
124
- local before/after or current/target spatial diagram, then concise
125
- Problem/Solution/Why text.
126
- - `tabs` for multiple states, directions, or comparisons. A tab that reveals
127
- only prose usually means the plan is under-specified — include a relevant
128
- visual unless the tab is intentionally document-only.
129
- - `table`, `checklist`, `callout` for scannable structure.
130
-
131
- **Open questions live at the bottom as a form when answers would change the
132
- plan.** Surface answerable unresolved decisions in a final `question-form`
133
- block titled "Open Questions" so the renderer presents it as a distinct section.
134
- That bottom form is the ONLY place that enumerates the open questions: never add
135
- a second "Open Questions" heading, list, or recap of the same questions earlier
136
- in the document. A one-line pointer in the overview prose ("a few decisions are
137
- still open — see Open Questions below") is fine, but do not reproduce the
138
- question list or a parallel questions/decisions section above it.
139
- Use `single` or `multi` for clear choices, `freeform` for constraints,
140
- `recommended: true` for the default you would pick, and option `wireframe` /
141
- `diagram` previews only when the options are not already visible in the top
142
- canvas. `single` and `multi` questions always render a write-in field so a
143
- reviewer can answer with a custom option — never add an explicit "Other" option
144
- yourself; set `allowOther: false` only when a free-text answer makes no sense.
145
- Keep non-answerable assumptions or risks as concise `callout` blocks in
146
- the relevant section. Never bury a questions/decisions wall inside the plan
147
- narrative, and never ask the same question twice.
148
-
149
- For complex plans, do not end without an open-question audit. If architecture,
150
- scope, UX, data shape, rollout, provider mapping, or ownership still depends on
151
- a choice, either commit to a recommendation with rationale or add it to the
152
- bottom form with a recommended default. A complex plan with no open questions is
153
- fine only when every meaningful decision has been explicitly made.
154
-
155
- **Verification must exercise the real workflow.** The final verification section
156
- should go beyond typecheck/unit tests when the plan changes UI, local files,
157
- sync, providers, browser behavior, or multi-app flows. Include at least one
158
- end-to-end smoke that matches the user journey, such as a fresh repo/folder,
159
- real manifest or data fixture, browser interaction, save/sync action, and an
160
- on-disk or database assertion. Name the command or manual browser path when it
161
- is known.
162
-
163
- **`custom-html` is a bounded escape hatch only** — a single complete fragment
164
- inside a block, never `html`/`head`/`body`/`script` tags, never a generic
165
- placeholder, density demo, or proof that custom HTML works. Prefer the native
166
- blocks for normal plans. For architecture/code reviews, use `diagram`
167
- `data.html` / `data.css` for rich local HTML/SVG diagrams instead of
168
- `custom-html`. For UI/product work, `custom-html` is never the primary home for a
169
- requested mockup, UI state, or visual comparison. If UI fidelity requires
170
- HTML/CSS, image capture, or real React/CSS, the product fix is canvas support
171
- for that artifact type, not moving the mockup into the document.
172
- When `custom-html` is genuinely needed, author it against the sandbox-provided
173
- theme tokens (`--wf-paper`, `--wf-card`, `--wf-ink`, `--wf-muted`,
174
- `--wf-line`, `--wf-radius`, and the matching `--plan-*` aliases). Do not hardcode
175
- hex/rgb/hsl light palettes such as white cards with dark ink; the same fragment
176
- must read in dark mode without a plan-specific patch.
177
-
178
- **Before handoff, open the plan and check it.** Fix overlap, excessive
179
- whitespace, clipped fragments, misleading inactive controls, poor contrast, and
180
- unreadable diagrams before asking for approval. Check the top canvas in the
181
- current Plan theme, especially dark mode: white mockup panels, low-contrast
182
- muted text, or invisible controls are defects. If a frame only works in one
183
- theme, rewrite the HTML with `--wf-*` tokens and semantic helper classes before
184
- surfacing the plan.
185
-
186
- <!-- SHARED-CORE:document-quality END -->
@@ -1,62 +0,0 @@
1
- # Good vs. bad exemplar — single source of truth
2
-
3
- This file is the canonical worked example of a great plan (and the anti-patterns
4
- to avoid). Read it alongside the document-quality and canvas references before
5
- authoring a plan; it is the bar these plans must clear.
6
-
7
- <!-- SHARED-CORE:exemplar START -->
8
-
9
- **GOOD.** A UI-first plan for a todo app: a canvas with a `desktop` artboard whose
10
- `data.html` is a real flex layout — a sidebar of links (`Inbox 12`, `Today 4`,
11
- `Done`), a main column with an `<h1>Today</h1>`, accent `.wf-pill`s for the
12
- filters, a muted section label `OVERDUE`, and `.wf-card` task rows carrying real
13
- titles, due dates, and a primary `button.primary` — styled only through bare
14
- elements, helper classes, and `--wf-*` tokens, so the renderer applies the
15
- correct desktop footprint, theme, and one subtle whole-frame wobble. Plain-text
16
- designer notes sit spaced off the frame, pointing only at the controls that need
17
- explanation. Below it, a Claude/Codex-grade document: objective and
18
- done-criteria, a few `code` blocks (grouped in a vertical `tabs` block when
19
- more than one) showing the real shape of the load-bearing files, a `callout`
20
- with `tone="decision"` stating the chosen approach with a `columns` block
21
- weighing the two real options behind it,
22
- and a validation step — none of it repeating the canvas. If the task also
23
- changes a multi-step completion flow, the same top area includes a Prototype tab
24
- whose screens use the same labels and states as the canvas artboards, with
25
- `data-goto` controls for the sequence. This is the bar.
26
-
27
- **GOOD.** A broad product-architecture plan opens with a plain recommendation
28
- and one concrete app state before the abstraction. The first canvas artboard is
29
- pure product UI that matches the current app shell; nearby notes explain the
30
- user-visible delta. A separate diagram below shows the mechanics, such as file
31
- or data flow. The document then separates the reusable core from app/provider
32
- adapters and examples, covers contracts, folder or schema shape, sync
33
- boundaries, roadmap, non-goals, a bottom Open Questions form for unresolved
34
- decisions, and a verification section with at least one realistic end-to-end
35
- smoke. A reviewer who was not in the chat gets the idea from the top snapshot
36
- before reading the technical plan.
37
-
38
- **GOOD.** A `/visual-plan` for a backend architecture review: no top canvas.
39
- The document opens with context and a legend, then repeats recommendation cards:
40
- title, confidence/category badges, a monospace grid of real file paths, one
41
- inline two-dimensional before/after or layered architecture diagram, and terse
42
- Problem/Solution/Why bullets using the codebase's vocabulary. The diagram uses
43
- space to show boundaries, layers, and ownership; it is not a default
44
- left-to-right chain. The plan ends with a top recommendation and a bottom
45
- question-form only if the next architecture direction is genuinely open. This is
46
- better than a top canvas because each diagram is local to the claim it supports.
47
-
48
- **BAD.** A `data.html` with hard-coded hex colors, a `font-family`, or fixed
49
- pixel width/height; gray placeholder bars "insinuating" text on a non-skeleton
50
- frame; a forced desktop + mobile pair for a popover; floating bordered
51
- annotation cards hugging the frames; a fresh hand-authored kit-tree `screen`
52
- instead of `html`; a multi-step UI flow with only static frames and no prototype
53
- tab; a mockup escaped into a document `custom-html` block; and a marketing-style
54
- document with a hero heading and value props that just restates what the canvas
55
- already shows. Also bad: an architecture-only plan forced into a top canvas of
56
- labeled boxes with overlapping text, where the actual code evidence and
57
- recommendations live elsewhere; a product wireframe that mixes a real screen
58
- with repo names, file-contract arrows, architecture explanations, or a made-up
59
- permanent inspector; and a plan that describes itself as a revision of a prior
60
- conversation instead of a standalone proposal. Never produce this.
61
-
62
- <!-- SHARED-CORE:exemplar END -->
@@ -1,99 +0,0 @@
1
- # Local-files privacy mode — single source of truth
2
-
3
- This file is the canonical contract for fully local, no-database planning and
4
- recaps. It is shared word for word by `/visual-plan` and `/visual-recap`. Read it
5
- in full before using local-files mode; do not call any hosted Plan tool for a
6
- local plan/recap except the schema-only block-catalog lookup described below.
7
-
8
- <!-- SHARED-CORE:local-files START -->
9
-
10
- **When to use it.** Use local-files privacy mode when the user explicitly asks
11
- for no DB writes, no hosted Plan database writes, no Plan MCP publish, fully local
12
- files, offline/private work, or repo-owned/source-controlled artifacts, or when
13
- `AGENT_NATIVE_PLANS_MODE=local-files` is set. Also use it when a user or repo
14
- policy says the work must stay under their own brand, domain, source control, or
15
- infrastructure. In this mode the plan/recap data must never be sent to the Plan
16
- MCP server or the Plan app action surface. This is the only exception to the
17
- always-publish rule in `references/connection.md`.
18
-
19
- The local-files contract:
20
-
21
- - **Read context locally.** Read source, diff, and stat context from local files
22
- and shell commands only. For recaps, the
23
- `npx @agent-native/core@latest recap collect-diff`, `scan`, and
24
- `build-prompt --local-files` helpers are safe — they operate on local files and
25
- do not write to the Plan database.
26
- - **Fetch the block catalog first** (it sends no plan content). Use the MCP
27
- `get-plan-blocks` tool if it is already available, or run
28
- `npx @agent-native/core@latest plan blocks --out plan-blocks.md` and read that
29
- file before authoring MDX; it calls the public no-auth `get-plan-blocks` route.
30
- Use `--format schema` when you need exact nested fields. If network access is
31
- unavailable, use the bundled `references/*.md` and rely on `plan local check` to
32
- catch invalid tags. Copy the catalog examples verbatim for the fields the
33
- registry table cannot encode: `checklist` items need `id` and `label`;
34
- `question-form` questions need `id`, `title`, and `mode`, and each option needs
35
- `id` and `label`; and `Code` / `AnnotatedCode` / `Diff` are whitespace-sensitive
36
- — encode multiline code as JSON string attributes such as `code={"const x =\n y"}`
37
- (a static template literal is accepted only when it has no `${...}`
38
- interpolation). `plan local check` is a quick OFFLINE lint (a subset of the
39
- renderer schema), so a green `check` does not guarantee the plan renders.
40
- `plan local verify` also stays on-device: it uses the offline lint unless it
41
- can reach a Plan renderer on an explicit loopback `--app-url`.
42
- - **Write a local MDX folder.** Use `plans/<slug>/` to check the artifact into the
43
- repo, or a repo-ignored/temporary folder such as `.agent-native/plans/<slug>/`
44
- or `/tmp/agent-native-plans/<slug>/` when it should not be checked in. The
45
- folder holds `plan.mdx`, optional `canvas.mdx`, optional `prototype.mdx`, and
46
- optional `.plan-state.json`. For a recap, set `kind: "recap"` and
47
- `localOnly: true` in the frontmatter/state. Use that exact folder as
48
- `<plan-dir>` in every command below.
49
- - **Check, then serve.** Run
50
- `npx @agent-native/core@latest plan local check --dir <plan-dir>` before any
51
- preview, then
52
- `npx @agent-native/core@latest plan local serve --dir <plan-dir> --kind <plan|recap> --open`
53
- (use `--kind plan` for plans, `--kind recap` for recaps). Report the local
54
- bridge URL from stdout or `<plan-dir>/.plan-url`; treat `.plan-url` as a local
55
- token file and do not commit it. The URL opens the hosted Plan UI but reads from
56
- the localhost bridge on this machine, so it is not shareable across machines.
57
- The token is carried in the URL fragment (which is not sent to the hosted
58
- origin), and the local-plan route disables DOM autocapture and session replay
59
- while retaining sanitized pageviews and error monitoring. On
60
- macOS `--open` prefers Chromium browsers; if Safari opens, switch to
61
- Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the
62
- HTTP localhost bridge. If the Plan app itself is running locally with the same
63
- `PLAN_LOCAL_DIR`, the `/local-plans/<slug>` route is also valid. In a truly
64
- offline environment, hand off the `<plan-dir>` path after `plan local check` and
65
- note that interactive preview requires network access to the hosted Plan UI or a
66
- running local Plan app.
67
- - **Headless verify.** Run
68
- `npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>`.
69
- It starts the bridge and checks the private-network preflight and JSON payload
70
- entirely on loopback. It never sends MDX or assets to a remote validation
71
- action. When `--app-url` points to a loopback Plan app, verify also validates
72
- against that local app's real renderer schema via `validate-local-plan-source`.
73
- A non-`ok` result with
74
- `validation.valid: false` lists the renderer's exact schema-path issues (e.g.
75
- `blocks[1].data.tabs[0]...`); fix those before handing off. If `validation.ran`
76
- is `false`, verify used the offline lint because the app URL was remote or the
77
- local Plan app was unavailable. Run a local Plan app and pass
78
- `--app-url http://localhost:8096` for the authoritative check. If the browser hangs on
79
- "Loading plan", fetch the `bridgeUrl` from the verify/serve JSON to read the
80
- concrete validation error.
81
- - **Never call hosted tools for that plan/recap.** Do not call
82
- `create-visual-plan`, `create-ui-plan`, `create-prototype-plan`,
83
- `create-plan-design`, `create-visual-recap`, `create-visual-questions`,
84
- `import-visual-plan-source`, `update-visual-plan`, `patch-visual-plan-source`,
85
- `get-plan-feedback`, `export-visual-plan`, `set-resource-visibility`, or any
86
- other hosted Plan tool — except the schema-only block-catalog lookup above.
87
- - **Feedback is file/chat feedback.** Update the MDX files directly, rerun
88
- `plan local check`, and rerun `serve` or `verify` when that preview path is
89
- available. Summarize the new local URL when one exists; otherwise summarize the
90
- checked `<plan-dir>` path. Hosted comments, sharing, screenshots, history, usage
91
- attachment, and publish/export receipts are unavailable until the user
92
- explicitly opts into publishing.
93
-
94
- Local-files mode prevents plan/recap content from being uploaded to the
95
- Agent-Native Plan server or database. It does not by itself make the coding agent's language model local;
96
- for that stronger boundary the host agent/model must also be local or otherwise
97
- approved by the user.
98
-
99
- <!-- SHARED-CORE:local-files END -->