@jamie-tam/forge 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: build-tdd
3
+ description: "Use when writing production code (post-harden, Phase 6) and the user asks to add a feature, fix a bug, or add tests for new behavior. Drives strict RED-GREEN-REFACTOR with integration coverage at module boundaries. Triggers on phrases like 'add test for', 'TDD this', 'write a failing test', 'implement <feature>'. Skip during prototype phases (Phase 4 iterate-prototype) where mock-heavy tests under-catch wiring bugs."
4
+ ---
5
+
6
+ # Test-Driven Development (TDD)
7
+
8
+ ## Overview
9
+
10
+ Write the test first. Watch it fail. Write minimal code to pass.
11
+
12
+ **Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
13
+
14
+ **Announce at start:** "I'm using the build-tdd skill to implement this with strict TDD."
15
+
16
+ ## When to Use
17
+
18
+ This skill is the Phase 6 (production-build) discipline. Phase 4 (prototype) is exempt — that work runs through `build-prototype` / `iterate-prototype` with manual click-through verification instead.
19
+
20
+ **Within Phase 6:** New features, bug fixes, behavior changes.
21
+
22
+ **Refactoring:** Always — but if existing tests already cover the code being refactored (passing coverage), use them as the safety net directly. Write characterization tests only for untested code paths. The Iron Law still applies to any *new behavior*. For pure refactoring (no behavior change), existing passing tests serve as the failing-test equivalent — if they break, the refactoring changed behavior.
23
+
24
+ **Exceptions (ask your human partner):** Throwaway prototypes, generated code, configuration files.
25
+
26
+ ## The Iron Law
27
+
28
+ ```
29
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
30
+ ```
31
+
32
+ Write code before the test? Delete it. Start over. Do not keep it as "reference." Do not "adapt" it while writing tests.
33
+
34
+ ## The Cycle
35
+
36
+ | Step | What | Mandatory verification |
37
+ |---|---|---|
38
+ | **RED** | Write one minimal failing test for the next behavior | Run the test — confirm it fails because the feature is missing (not syntax/import errors) |
39
+ | **GREEN** | Write the simplest code that passes | Run the test — confirm new test passes AND existing tests still pass |
40
+ | **REFACTOR** | Clean up after green; remove duplication, improve names | Keep tests green; do not add behavior |
41
+
42
+ The detailed methodology — examples per step, common rationalizations, red flags, when-stuck guidance — is canonical in `agents/builder.md`. **When this skill runs inline, Read `agents/builder.md` before starting and follow its protocol exactly.** When this skill dispatches the **builder** subagent, the agent loads that methodology automatically.
43
+
44
+ ## Wiring Coverage
45
+
46
+ After GREEN, if the slice crosses a module boundary defined in architecture artifacts, write one contract or integration test that exercises the real wiring (no mocks at the boundary). If you can't, that's a wiring-test debt; record in `support-gotcha`.
47
+
48
+ Module boundaries from `harden`'s slice graph commonly include: CLI entry points, filesystem reads/writes, child-process invocations, manifest I/O, external service calls. Unit-level tests with mocks at these seams are necessary but not sufficient — the load-bearing question is whether the real components compose correctly. If every boundary in the slice has at least one no-mock test somewhere in the suite, the slice is wired; if any boundary is mock-only across the whole suite, file a `support-gotcha` entry naming the boundary and the missing test so the next pass can close it.
49
+
50
+ ## Execution Mode
51
+
52
+ This skill dispatches the **builder** subagent or executes inline, based on persisted manifest state.
53
+
54
+ Read `execution.mode` from `.forge/work/{type}/{name}/manifest.yaml` (set by `plan-task-decompose` during execution handoff):
55
+
56
+ | Manifest state | Mode |
57
+ |---|---|
58
+ | `execution.mode: subagent` | Dispatch **builder** subagent with the task + architecture artifacts inline in prompt |
59
+ | `execution.mode: inline` | Execute RED-GREEN-REFACTOR directly in current session — Read `agents/builder.md` first |
60
+ | No manifest or no field | Inline (default) |
61
+
62
+ When dispatching **builder**, pass the task and required artifacts ONLY. Do NOT include TDD methodology in the prompt; builder owns that methodology inline.
63
+
64
+ Do not ask the user. The decision was persisted at task decompose handoff.
65
+
66
+ ## Architecture Constraints
67
+
68
+ When architecture artifacts exist (from `plan-architecture` or `harden`), use them to set unit-test expectations for shapes, constraints, and error behavior. Treat those contracts as the source of truth for assertions at the unit boundary. Integration tests at boundaries identified by `harden`'s slice graph are required per the Wiring Coverage subsection above — they are not optional even when the task description omits them.
69
+
70
+ ## Codex Integration
71
+
72
+ **Mode:** Delegate | **Protocol:** `protocols/codex.md`
73
+
74
+ **When:** Before the task execution loop begins. User explicitly requests: "Use Codex as builder for this feature."
75
+
76
+ **All-or-nothing:** If the user chooses Codex as builder, ALL tasks in the feature use Codex. No per-task or per-phase mixing. To switch back to Claude mid-feature, the user says "switch to Claude builder" — completed Codex tasks are kept, remaining tasks proceed with Claude.
77
+
78
+ **Context to pass:**
79
+ - Path to the specific task description from `tasks.md`
80
+ - Path to `architecture/` directory (all artifacts)
81
+ - Path to `codebase-analysis.md` (if existing project)
82
+ - Path to `agents/builder.md` — Codex reads and follows the TDD methodology
83
+
84
+ **Prompt focus:** "Implement the following task using strict TDD methodology as defined in agents/builder.md. Architecture artifacts are at [paths]. Write the failing test first, verify it fails, then implement minimally to pass."
85
+
86
+ **Quality gate:** Every Codex-built task goes through:
87
+ 1. Tests pass (test runner from project profile)
88
+ 2. Coverage meets threshold (80%+, 100% for critical paths)
89
+ 3. `quality-code-review` by Claude (cross-review — Claude reviews Codex's work)
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: build-wireframe
3
+ description: "Use when the user wants to build a wireframe, annotated mockup, click-through prototype demo, presales walkthrough, or any HTML artifact with callout/leader lines pointing into a UI design — even if they don't say 'wireframe'. Also use when extending an existing wireframe HTML (new screens, callouts, demo flows). Triggers on 'wireframe', 'annotated mockup', 'click-through', 'callouts', 'legend lines', 'leader lines', 'tabs to switch screens/states', 'presales artifact'. This skill encodes hard-won fixes (label clipping, sticky-tabbar overlap, demo state races) so don't re-derive from scratch."
4
+ ---
5
+
6
+ # Build wireframe
7
+
8
+ You are building a **single self-contained HTML file** that renders multiple annotated wireframe states accessible via tab navigation, plus optionally interactive click-through demos. Every wireframe state has callouts ("legend lines") in the side gutters explaining its key components.
9
+
10
+ This artifact format is for **concept verification, annotated walkthroughs, and prototype design discussions** — visual fidelity, no real backend, no real interactivity beyond the click-through demos. The deliverable opens directly in any modern browser; no build step.
11
+
12
+ ## When to load each reference
13
+
14
+ The full rule set and the iteration history are in references — load on demand:
15
+
16
+ - **`references/legend-lines.md`** — the 7 visual rules for callouts, with the "why" behind each. Read this when adding callouts to a new state or when a leader is rendering wrong.
17
+ - **`references/demo-walkthroughs.md`** — the per-step callouts pattern with `dynamicCallouts` state and cleanup-on-unmount. Read this when building or modifying a click-through demo.
18
+ - **`references/gotchas.md`** — the iteration history. Read this when something doesn't render right despite following the rules — often it's a known race or layout trap.
19
+
20
+ The baseline template at **`assets/baseline-template.html`** is your starting point. It contains all the boilerplate (React + Tailwind + Babel CDN, primitives, StateShell, Tabs, Callouts, App with hash routing, one example state). **Always start from this template** — don't write the boilerplate from scratch.
21
+
22
+ ## Architecture in one breath
23
+
24
+ ```
25
+ single index.html
26
+ ├── React + Tailwind + Babel + Lucide via CDN (no build step)
27
+ ├── Inter font from Google Fonts
28
+ ├── Stage = 1920×1080 16:9 div, scaled to fit viewport via transform: scale()
29
+ ├── 320px symmetric gutters (where callout labels live)
30
+ ├── Tab strip at the top (NOT sticky — it would cover top callouts)
31
+ ├── State components, each rendered inside StateShell
32
+ ├── Each state has its own _CALLOUTS array (id + side + anchor + label)
33
+ ├── Callouts overlay reads view.callouts (or App.dynamicCallouts for demo views)
34
+ └── Hash routing (#s1, #demo-inbound, etc.) so views are linkable
35
+ ```
36
+
37
+ ## Three view types
38
+
39
+ | Type | Has callouts? | Has internal state? | Example |
40
+ |---|---|---|---|
41
+ | **Static state** | Yes — array on `view.callouts` | No | Home screen, Live ops dashboard |
42
+ | **Interactive demo** | Yes — per-step array via `dynamicCallouts` | Yes — `useState` for current step | Inbound walkthrough |
43
+ | **Flow diagram** | No — the layout itself is the explanation | No | Agent flow, Supervisor flow |
44
+
45
+ ## The 7 visual rules for callouts
46
+
47
+ These rules are non-negotiable. Read `references/legend-lines.md` for examples and the math behind each one.
48
+
49
+ 1. **Anchor on the section's edge facing its label.** Right-side label → dot on the element's right edge. Left-side label → left edge. Don't put the dot in the centre or the far edge.
50
+ 2. **Leader is mostly a single straight run.** One horizontal or vertical segment from anchor to label. No diagonals through the wireframe.
51
+ 3. **Bend only in the gutter, never over UI.** When the label sits at a different y from the anchor, the leader bends 16px inside the gutter — not over the wireframe stage.
52
+ 4. **Comprehensive over minimal.** Aim for 5–8 callouts per main-shell state, covering each chrome column AND each section of the main-content area. Drop a callout only if the leader genuinely cannot avoid crossing other UI.
53
+ 5. **Collision-avoidance push direction is fixed.** Top/bottom labels push right (later labels move x+). Left/right labels push down (later labels move y+).
54
+ 6. **Overlay states annotate the overlay, not the underlying shell.** Modal / sheet / banner states draw callouts targeting overlay anchors. The dimmed shell underneath is context, not content.
55
+ 7. **Closest path wins — for both `side` and `anchor`.** Pick the side whose gutter is NEAREST the anchor element. Then anchor on the element's edge facing that gutter. A banner at the top of the wireframe gets `side: "top"`, NEVER `"bottom"`. A toast in the top-right corner gets `side: "top"` (or `"right"`). For row-spanning components (a row of cards, a footer strip, a multi-column row), the dot lands on the outer ROW's edge — humans read that as "this row of components", not "this single column".
56
+
57
+ ## Stage geometry (memorize these numbers)
58
+
59
+ | Knob | Value | Why |
60
+ |---|---|---|
61
+ | Stage design size | 1920 × 1080 | 16:9, kiosk-shaped, wide enough for 3-column shells |
62
+ | Outer max-width | 2400px | Lets stage hit 1:1 on wide monitors |
63
+ | Stage maxWidth | 1920px | Caps scale at 1.0 |
64
+ | Gutter | 320 px each side | Label width 230 + offset 60 + slack 30 |
65
+ | Top/bottom callout offset | 60 px | Breathing room above/below stage |
66
+ | Tab-bar clearance | mt-32 (128 px) | Top callouts must clear tab bar — see gotchas |
67
+ | Label width | 230 px | Fits ~2 lines of body copy |
68
+ | Label height (estimated) | ~32 px | Two-line labels grow upward from `bottom: …` |
69
+
70
+ Don't change these without good reason. The numbers are interlocked: `gutter ≥ label_width + offset` is a hard constraint, and the tab-bar clearance is what separates "labels are visible" from "labels are clipped above viewport".
71
+
72
+ ## Workflow
73
+
74
+ ### Adding a static state
75
+
76
+ 1. Build the state component as a JSX function returning `<StateShell>...</StateShell>`. Reuse `Topbar`, `Sidebar`, `LeftCaseList`, `RightRail` shared components where they apply.
77
+ 2. For each element you want to annotate, give it `id="a-something"` (descriptive prefix, kebab-case). For elements that should be highlighted with a 0-size dot, use a `<span id="a-..." className="absolute ..." data-callout-anchor="" />` inside the parent. The span's position determines where the dot lands.
78
+ 3. Define `<NewState>_CALLOUTS = [{id, side, anchor, label}, ...]` next to the state. Apply rules 1–7. Aim for 5–8 entries on a main-shell state.
79
+ 4. Register in `VIEWS`: `"key": {label: "User-facing tab label", group: "agent" | "sup" | "demo", render: NewState, callouts: NewState_CALLOUTS}`.
80
+ 5. Add the key to the right group's tab list.
81
+ 6. **Verify in the browser.** Use Playwright (or any browser) to measure: no clipping (label fits in viewport), no overlap with the tab bar, leader lines hit visible elements. See `references/gotchas.md` for the exact measurement queries.
82
+
83
+ ### Adding an interactive demo
84
+
85
+ Read `references/demo-walkthroughs.md` first. Key pattern: the demo holds a `step` state, defines a `D{N}_STEP_CALLOUTS` array indexed by step, pushes the active step's slice via `useEffect` keyed on `[step, setCallouts]` with a **cleanup that nulls** `setCallouts(null)` on unmount. The cleanup is critical — without it you get stale callouts on tab switches.
86
+
87
+ ### Fixing wrong callout placement
88
+
89
+ Symptom → first thing to check:
90
+ - **Label clipped at viewport edge** → gutter too narrow OR the outer container has `overflow: hidden` clipping the label box. Bump gutter to ≥ label_width + offset + 30.
91
+ - **Top label hidden behind tab bar** → tab bar is `sticky` (don't do that) OR top padding above stage is < tab_bar_height + ~50. Add `mt-32` to the stage wrapper.
92
+ - **Leader cuts across UI** → wrong `side` (you picked the far gutter) or wrong `anchor` (dot landed inside the element instead of on its edge). Apply rule 7.
93
+ - **Dot at zero-length leader** (label flush against wireframe edge) → element is at the wireframe edge AND `anchor` is on the same edge. Flip `anchor` to the opposite edge so the leader has visible travel, OR move the anchor to the outer row wrapper.
94
+ - **Leader points at the wrong row** when a section spans multiple columns → anchor span is inside ONE cell instead of the outer row. Add `relative` to the outer row wrapper and host the span there.
95
+
96
+ ## When NOT to add a callout
97
+
98
+ - Pure flow views (the layout itself is the explanation).
99
+ - A second callout pointing at the same `id` as another callout in the same view (one is enough — duplicate IDs produce two leaders into the same dot).
100
+ - An element whose function is obvious from its on-screen label (a search box that says "Search…" doesn't need annotation).
101
+
102
+ ## Output format
103
+
104
+ The deliverable is `index.html` in a directory you can recommend (e.g. `pocs/wireframe/index.html`). Open with `open index.html` or via a local HTTP server (`npx http-server -p 8767 -c-1`) — http-server is required if your demo or asset paths use `file://`-incompatible features.
105
+
106
+ Always alongside the HTML: write a short `README.md` that lists the views, hash routes, and which deck slides / spec docs each view derives from. This is the index a future contributor reads first.
107
+
108
+ ## When the user says "iterate" or shows a screenshot of broken callouts
109
+
110
+ Don't redesign. The 7 rules + the gotchas catalog cover ~95% of issues. Read `references/gotchas.md`, identify the failure mode, apply the fix. If the user is on the first iteration of a new project, start from `assets/baseline-template.html` — copy it to their target path and extend.