opencastle 0.31.6 → 0.32.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 (210) hide show
  1. package/LICENSE +93 -21
  2. package/README.md +9 -3
  3. package/bin/cli.mjs +15 -0
  4. package/dist/cli/agents.d.ts.map +1 -1
  5. package/dist/cli/agents.js +19 -5
  6. package/dist/cli/agents.js.map +1 -1
  7. package/dist/cli/artifacts-cli.d.ts +3 -0
  8. package/dist/cli/artifacts-cli.d.ts.map +1 -0
  9. package/dist/cli/artifacts-cli.js +36 -0
  10. package/dist/cli/artifacts-cli.js.map +1 -0
  11. package/dist/cli/baselines.d.ts.map +1 -1
  12. package/dist/cli/baselines.js +11 -0
  13. package/dist/cli/baselines.js.map +1 -1
  14. package/dist/cli/convoy/artifacts.d.ts +25 -0
  15. package/dist/cli/convoy/artifacts.d.ts.map +1 -0
  16. package/dist/cli/convoy/artifacts.js +129 -0
  17. package/dist/cli/convoy/artifacts.js.map +1 -0
  18. package/dist/cli/convoy/artifacts.test.d.ts +2 -0
  19. package/dist/cli/convoy/artifacts.test.d.ts.map +1 -0
  20. package/dist/cli/convoy/artifacts.test.js +169 -0
  21. package/dist/cli/convoy/artifacts.test.js.map +1 -0
  22. package/dist/cli/convoy/compaction.d.ts +23 -0
  23. package/dist/cli/convoy/compaction.d.ts.map +1 -0
  24. package/dist/cli/convoy/compaction.js +117 -0
  25. package/dist/cli/convoy/compaction.js.map +1 -0
  26. package/dist/cli/convoy/compaction.test.d.ts +2 -0
  27. package/dist/cli/convoy/compaction.test.d.ts.map +1 -0
  28. package/dist/cli/convoy/compaction.test.js +205 -0
  29. package/dist/cli/convoy/compaction.test.js.map +1 -0
  30. package/dist/cli/convoy/contracts.d.ts +22 -0
  31. package/dist/cli/convoy/contracts.d.ts.map +1 -0
  32. package/dist/cli/convoy/contracts.js +254 -0
  33. package/dist/cli/convoy/contracts.js.map +1 -0
  34. package/dist/cli/convoy/contracts.test.d.ts +2 -0
  35. package/dist/cli/convoy/contracts.test.d.ts.map +1 -0
  36. package/dist/cli/convoy/contracts.test.js +239 -0
  37. package/dist/cli/convoy/contracts.test.js.map +1 -0
  38. package/dist/cli/convoy/dag-analysis.d.ts +40 -0
  39. package/dist/cli/convoy/dag-analysis.d.ts.map +1 -0
  40. package/dist/cli/convoy/dag-analysis.js +282 -0
  41. package/dist/cli/convoy/dag-analysis.js.map +1 -0
  42. package/dist/cli/convoy/dag-analysis.test.d.ts +2 -0
  43. package/dist/cli/convoy/dag-analysis.test.d.ts.map +1 -0
  44. package/dist/cli/convoy/dag-analysis.test.js +289 -0
  45. package/dist/cli/convoy/dag-analysis.test.js.map +1 -0
  46. package/dist/cli/convoy/effort-scaling.d.ts +20 -0
  47. package/dist/cli/convoy/effort-scaling.d.ts.map +1 -0
  48. package/dist/cli/convoy/effort-scaling.js +82 -0
  49. package/dist/cli/convoy/effort-scaling.js.map +1 -0
  50. package/dist/cli/convoy/effort-scaling.test.d.ts +2 -0
  51. package/dist/cli/convoy/effort-scaling.test.d.ts.map +1 -0
  52. package/dist/cli/convoy/effort-scaling.test.js +120 -0
  53. package/dist/cli/convoy/effort-scaling.test.js.map +1 -0
  54. package/dist/cli/convoy/engine.d.ts.map +1 -1
  55. package/dist/cli/convoy/engine.js +298 -11
  56. package/dist/cli/convoy/engine.js.map +1 -1
  57. package/dist/cli/convoy/engine.test.js +155 -18
  58. package/dist/cli/convoy/engine.test.js.map +1 -1
  59. package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
  60. package/dist/cli/convoy/event-schemas.js +55 -0
  61. package/dist/cli/convoy/event-schemas.js.map +1 -1
  62. package/dist/cli/convoy/isolation.d.ts +27 -0
  63. package/dist/cli/convoy/isolation.d.ts.map +1 -0
  64. package/dist/cli/convoy/isolation.js +120 -0
  65. package/dist/cli/convoy/isolation.js.map +1 -0
  66. package/dist/cli/convoy/isolation.test.d.ts +2 -0
  67. package/dist/cli/convoy/isolation.test.d.ts.map +1 -0
  68. package/dist/cli/convoy/isolation.test.js +105 -0
  69. package/dist/cli/convoy/isolation.test.js.map +1 -0
  70. package/dist/cli/convoy/review-stages.d.ts +9 -0
  71. package/dist/cli/convoy/review-stages.d.ts.map +1 -0
  72. package/dist/cli/convoy/review-stages.js +134 -0
  73. package/dist/cli/convoy/review-stages.js.map +1 -0
  74. package/dist/cli/convoy/review-stages.test.d.ts +2 -0
  75. package/dist/cli/convoy/review-stages.test.d.ts.map +1 -0
  76. package/dist/cli/convoy/review-stages.test.js +197 -0
  77. package/dist/cli/convoy/review-stages.test.js.map +1 -0
  78. package/dist/cli/convoy/skill-refinement.d.ts +39 -0
  79. package/dist/cli/convoy/skill-refinement.d.ts.map +1 -0
  80. package/dist/cli/convoy/skill-refinement.js +239 -0
  81. package/dist/cli/convoy/skill-refinement.js.map +1 -0
  82. package/dist/cli/convoy/skill-refinement.test.d.ts +2 -0
  83. package/dist/cli/convoy/skill-refinement.test.d.ts.map +1 -0
  84. package/dist/cli/convoy/skill-refinement.test.js +230 -0
  85. package/dist/cli/convoy/skill-refinement.test.js.map +1 -0
  86. package/dist/cli/convoy/spec-builder.d.ts +1 -0
  87. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  88. package/dist/cli/convoy/spec-builder.js +11 -0
  89. package/dist/cli/convoy/spec-builder.js.map +1 -1
  90. package/dist/cli/convoy/spec-builder.test.js +54 -0
  91. package/dist/cli/convoy/spec-builder.test.js.map +1 -1
  92. package/dist/cli/convoy/store.d.ts +3 -2
  93. package/dist/cli/convoy/store.d.ts.map +1 -1
  94. package/dist/cli/convoy/store.js +20 -2
  95. package/dist/cli/convoy/store.js.map +1 -1
  96. package/dist/cli/convoy/store.test.js +15 -15
  97. package/dist/cli/convoy/store.test.js.map +1 -1
  98. package/dist/cli/convoy/tdd-gate.d.ts +15 -0
  99. package/dist/cli/convoy/tdd-gate.d.ts.map +1 -0
  100. package/dist/cli/convoy/tdd-gate.js +119 -0
  101. package/dist/cli/convoy/tdd-gate.js.map +1 -0
  102. package/dist/cli/convoy/tdd-gate.test.d.ts +2 -0
  103. package/dist/cli/convoy/tdd-gate.test.d.ts.map +1 -0
  104. package/dist/cli/convoy/tdd-gate.test.js +227 -0
  105. package/dist/cli/convoy/tdd-gate.test.js.map +1 -0
  106. package/dist/cli/convoy/types.d.ts +91 -0
  107. package/dist/cli/convoy/types.d.ts.map +1 -1
  108. package/dist/cli/convoy/types.js +8 -0
  109. package/dist/cli/convoy/types.js.map +1 -1
  110. package/dist/cli/dashboard.d.ts.map +1 -1
  111. package/dist/cli/dashboard.js +54 -0
  112. package/dist/cli/dashboard.js.map +1 -1
  113. package/dist/cli/insights.d.ts +3 -0
  114. package/dist/cli/insights.d.ts.map +1 -0
  115. package/dist/cli/insights.js +94 -0
  116. package/dist/cli/insights.js.map +1 -0
  117. package/dist/cli/lesson.d.ts.map +1 -1
  118. package/dist/cli/lesson.js +7 -0
  119. package/dist/cli/lesson.js.map +1 -1
  120. package/dist/cli/log.d.ts.map +1 -1
  121. package/dist/cli/log.js +7 -0
  122. package/dist/cli/log.js.map +1 -1
  123. package/dist/cli/package-config.d.ts +12 -0
  124. package/dist/cli/package-config.d.ts.map +1 -0
  125. package/dist/cli/package-config.js +37 -0
  126. package/dist/cli/package-config.js.map +1 -0
  127. package/dist/cli/package.d.ts +23 -0
  128. package/dist/cli/package.d.ts.map +1 -0
  129. package/dist/cli/package.js +285 -0
  130. package/dist/cli/package.js.map +1 -0
  131. package/dist/cli/package.test.d.ts +2 -0
  132. package/dist/cli/package.test.d.ts.map +1 -0
  133. package/dist/cli/package.test.js +236 -0
  134. package/dist/cli/package.test.js.map +1 -0
  135. package/dist/cli/pipeline.d.ts +6 -0
  136. package/dist/cli/pipeline.d.ts.map +1 -1
  137. package/dist/cli/pipeline.js +15 -2
  138. package/dist/cli/pipeline.js.map +1 -1
  139. package/dist/cli/run/schema.d.ts.map +1 -1
  140. package/dist/cli/run/schema.js +32 -0
  141. package/dist/cli/run/schema.js.map +1 -1
  142. package/dist/cli/run/schema.test.js +51 -0
  143. package/dist/cli/run/schema.test.js.map +1 -1
  144. package/dist/cli/run.d.ts.map +1 -1
  145. package/dist/cli/run.js +10 -1
  146. package/dist/cli/run.js.map +1 -1
  147. package/dist/cli/skills.d.ts +3 -0
  148. package/dist/cli/skills.d.ts.map +1 -0
  149. package/dist/cli/skills.js +107 -0
  150. package/dist/cli/skills.js.map +1 -0
  151. package/dist/cli/types.d.ts +4 -1
  152. package/dist/cli/types.d.ts.map +1 -1
  153. package/dist/cli/update.js +2 -2
  154. package/package.json +3 -2
  155. package/src/cli/agents.ts +20 -5
  156. package/src/cli/artifacts-cli.ts +41 -0
  157. package/src/cli/baselines.ts +12 -0
  158. package/src/cli/convoy/artifacts.test.ts +201 -0
  159. package/src/cli/convoy/artifacts.ts +186 -0
  160. package/src/cli/convoy/compaction.test.ts +245 -0
  161. package/src/cli/convoy/compaction.ts +164 -0
  162. package/src/cli/convoy/contracts.test.ts +279 -0
  163. package/src/cli/convoy/contracts.ts +280 -0
  164. package/src/cli/convoy/dag-analysis.test.ts +349 -0
  165. package/src/cli/convoy/dag-analysis.ts +371 -0
  166. package/src/cli/convoy/effort-scaling.test.ts +140 -0
  167. package/src/cli/convoy/effort-scaling.ts +90 -0
  168. package/src/cli/convoy/engine.test.ts +175 -18
  169. package/src/cli/convoy/engine.ts +315 -12
  170. package/src/cli/convoy/event-schemas.ts +55 -0
  171. package/src/cli/convoy/isolation.test.ts +137 -0
  172. package/src/cli/convoy/isolation.ts +165 -0
  173. package/src/cli/convoy/review-stages.test.ts +235 -0
  174. package/src/cli/convoy/review-stages.ts +166 -0
  175. package/src/cli/convoy/skill-refinement.test.ts +277 -0
  176. package/src/cli/convoy/skill-refinement.ts +306 -0
  177. package/src/cli/convoy/spec-builder.test.ts +61 -0
  178. package/src/cli/convoy/spec-builder.ts +9 -0
  179. package/src/cli/convoy/store.test.ts +15 -15
  180. package/src/cli/convoy/store.ts +26 -4
  181. package/src/cli/convoy/tdd-gate.test.ts +281 -0
  182. package/src/cli/convoy/tdd-gate.ts +154 -0
  183. package/src/cli/convoy/types.ts +51 -0
  184. package/src/cli/dashboard.ts +55 -0
  185. package/src/cli/insights.ts +99 -0
  186. package/src/cli/lesson.ts +8 -0
  187. package/src/cli/log.ts +8 -0
  188. package/src/cli/package-config.ts +48 -0
  189. package/src/cli/package.test.ts +276 -0
  190. package/src/cli/package.ts +329 -0
  191. package/src/cli/pipeline.ts +21 -2
  192. package/src/cli/run/schema.test.ts +58 -0
  193. package/src/cli/run/schema.ts +33 -0
  194. package/src/cli/run.ts +14 -1
  195. package/src/cli/skills.ts +121 -0
  196. package/src/cli/types.ts +4 -1
  197. package/src/cli/update.ts +2 -2
  198. package/src/dashboard/dist/_astro/{index.Je1YjU_y.css → index.BRDFmNzR.css} +1 -1
  199. package/src/dashboard/dist/index.html +163 -2
  200. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  201. package/src/dashboard/src/pages/index.astro +162 -1
  202. package/src/dashboard/src/styles/dashboard.css +85 -0
  203. package/src/orchestrator/agents/developer.agent.md +8 -0
  204. package/src/orchestrator/agents/ui-ux-expert.agent.md +7 -0
  205. package/src/orchestrator/prompts/assess-complexity.prompt.md +13 -0
  206. package/src/orchestrator/prompts/brainstorm.prompt.md +18 -0
  207. package/src/orchestrator/prompts/generate-convoy.prompt.md +61 -0
  208. package/src/orchestrator/skills/decomposition/SKILL.md +35 -0
  209. package/src/orchestrator/skills/frontend-design/SKILL.md +27 -1
  210. package/src/orchestrator/skills/project-consistency/SKILL.md +350 -0
@@ -2735,3 +2735,88 @@ body {
2735
2735
  max-width: 180px;
2736
2736
  }
2737
2737
  }
2738
+
2739
+ /* Waiting for convoy banner */
2740
+ .waiting-banner {
2741
+ text-align: center;
2742
+ padding: 3rem 2rem;
2743
+ margin-bottom: 2rem;
2744
+ border-radius: var(--radius-lg, 12px);
2745
+ background: var(--bg-surface, #1e1e2e);
2746
+ border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
2747
+ }
2748
+ .waiting-banner__content {
2749
+ display: flex;
2750
+ flex-direction: column;
2751
+ align-items: center;
2752
+ gap: 0.75rem;
2753
+ }
2754
+ .waiting-banner__spinner {
2755
+ width: 32px;
2756
+ height: 32px;
2757
+ border: 3px solid var(--border-subtle, rgba(255,255,255,0.1));
2758
+ border-top-color: var(--accent, #60a5fa);
2759
+ border-radius: 50%;
2760
+ animation: spin 1s linear infinite;
2761
+ }
2762
+ @keyframes spin {
2763
+ to { transform: rotate(360deg); }
2764
+ }
2765
+ .waiting-banner__title {
2766
+ font-size: 1.25rem;
2767
+ font-weight: 600;
2768
+ margin: 0;
2769
+ color: var(--text-primary, #e2e8f0);
2770
+ }
2771
+ .waiting-banner__subtitle {
2772
+ font-size: 0.875rem;
2773
+ color: var(--text-muted, #94a3b8);
2774
+ margin: 0;
2775
+ }
2776
+
2777
+ /* Pipeline chain navigation */
2778
+ .pipeline-chain-nav {
2779
+ display: flex;
2780
+ align-items: center;
2781
+ gap: 0.5rem;
2782
+ padding: 0.5rem 0;
2783
+ margin-bottom: 0.5rem;
2784
+ flex-wrap: wrap;
2785
+ }
2786
+ .pipeline-chain__label {
2787
+ font-size: 0.75rem;
2788
+ font-weight: 600;
2789
+ text-transform: uppercase;
2790
+ letter-spacing: 0.05em;
2791
+ color: var(--text-muted, #94a3b8);
2792
+ margin-right: 0.25rem;
2793
+ }
2794
+ .pipeline-chain__item {
2795
+ display: inline-flex;
2796
+ align-items: center;
2797
+ gap: 0.375rem;
2798
+ padding: 0.25rem 0.625rem;
2799
+ font-size: 0.8125rem;
2800
+ border-radius: var(--radius-sm, 6px);
2801
+ border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
2802
+ background: var(--bg-surface, #1e1e2e);
2803
+ color: var(--text-secondary, #cbd5e1);
2804
+ cursor: pointer;
2805
+ transition: border-color 0.15s, background 0.15s;
2806
+ }
2807
+ .pipeline-chain__item:hover {
2808
+ border-color: var(--border-hover, rgba(255,255,255,0.15));
2809
+ background: var(--bg-hover, rgba(255,255,255,0.04));
2810
+ }
2811
+ .pipeline-chain__item--active {
2812
+ border-color: var(--accent, #60a5fa);
2813
+ background: rgba(96, 165, 250, 0.08);
2814
+ color: var(--text-primary, #e2e8f0);
2815
+ }
2816
+ .pipeline-chain__dot {
2817
+ display: inline-block;
2818
+ width: 8px;
2819
+ height: 8px;
2820
+ border-radius: 50%;
2821
+ flex-shrink: 0;
2822
+ }
@@ -33,6 +33,14 @@ After code changes, always run lint, test, and build for affected projects.
33
33
  - Co-locate component files (component, styles, tests) in the same directory
34
34
  - Place shared components in the UI library, queries in the data layer
35
35
 
36
+ ### Multi-Page Convoy Consistency
37
+
38
+ When working on a page task within a multi-agent convoy:
39
+ - **Import** design tokens, layout component, and UI components from the foundation — do not recreate them
40
+ - **Follow** the aesthetic direction and content tone specified in your task prompt's Foundation References
41
+ - If a needed design token is missing, flag it in your output — never add inline values as workarounds
42
+ - Load the **project-consistency** skill for the full consistency contract
43
+
36
44
  ## Done When
37
45
 
38
46
  - All acceptance criteria from the tracker issue are met
@@ -32,6 +32,13 @@ Resolve all skills (slots and direct) via [skill-matrix.json](.opencastle/agents
32
32
  - Use `clsx` for conditional class composition
33
33
  - Export all components from the UI library's index
34
34
 
35
+ ### Multi-Page Convoy Consistency
36
+
37
+ When working on a page task within a multi-agent convoy:
38
+ - **If you are the foundation task:** create comprehensive design tokens, shared layout, and UI component library. Your choices become the project contract — be explicit and decisive.
39
+ - **If you are a page task:** consume the foundation. Import tokens, layout, and UI components — do not recreate them. No new design values.
40
+ - Load the **project-consistency** skill for full guidance on foundation artifacts and page task rules.
41
+
35
42
  ## Done When
36
43
 
37
44
  - Components render correctly at all project-defined responsive breakpoints
@@ -43,6 +43,14 @@ Analyze the PRD below and produce a complexity assessment as a **single JSON obj
43
43
  "phases": [<phase numbers>],
44
44
  "depends_on": ["<group name>", ...]
45
45
  }
46
+ ],
47
+ "task_complexity": [
48
+ {
49
+ "workstream": "<workstream title from PRD Task Breakdown>",
50
+ "phase": <phase number>,
51
+ "complexity": 1 | 2 | 3 | 5 | 8 | 13,
52
+ "rationale": "<brief reason>"
53
+ }
46
54
  ]
47
55
  }
48
56
  ```
@@ -65,3 +73,8 @@ Analyze the PRD below and produce a complexity assessment as a **single JSON obj
65
73
  - **Minimum 3 tasks per group.** Never create a group that would produce a convoy with only 1–2 tasks — merge small groups with adjacent ones. A convoy with a single task is pointless overhead.
66
74
  - **Do NOT map phases 1:1 to groups.** Groups should bundle multiple related phases when tasks are tightly coupled (e.g., config + data in one group, components + pages in another). Only split at genuine domain boundaries where failure isolation matters.
67
75
  - Maximum 3 groups for projects with ≤ 15 tasks. Maximum 4 groups for 16+ tasks.
76
+ - `task_complexity`: Array of per-workstream complexity assessments using Fibonacci scale.
77
+ - `workstream`: Exact workstream title from the PRD's Task Breakdown section.
78
+ - `phase`: Phase number the workstream belongs to.
79
+ - `complexity`: Fibonacci score: `1` (trivial — single file edit), `2` (simple — small fix, one test), `3` (moderate — new component/endpoint), `5` (significant — multi-file feature), `8` (complex — cross-cutting), `13` (epic — architecture-level).
80
+ - `rationale`: One sentence explaining the score.
@@ -73,6 +73,18 @@ Draw a clear boundary:
73
73
  - **Out of scope:** What it explicitly will NOT do (and why)
74
74
  - **Deferred:** What could be done later as a follow-up
75
75
 
76
+ #### Design Direction (for multi-page projects)
77
+
78
+ If the request involves building 2+ pages or UI sections, define the design direction during brainstorming — not during implementation:
79
+
80
+ - **Aesthetic direction:** 2-3 words (e.g., "warm editorial", "clean minimal", "brutalist edge")
81
+ - **Typography pairing:** display font + body font (avoid generic defaults like Inter/Roboto)
82
+ - **Color intent:** dominant purpose, accent purpose, mood
83
+ - **Content tone:** formal/casual, active/passive, target audience voice
84
+ - **Key terminology:** terms that could be said multiple ways — pick one (e.g., "projects" not "portfolio")
85
+
86
+ Include this in the Brainstorm Report so the planning phase can inject it into convoy foundation tasks.
87
+
76
88
  ### 6. Output
77
89
 
78
90
  Summarize the brainstorm as a **Brainstorm Report** — this becomes the input for the planning/decomposition phase:
@@ -98,6 +110,12 @@ Summarize the brainstorm as a **Brainstorm Report** — this becomes the input f
98
110
 
99
111
  ### Open Questions
100
112
  - [Any unresolved questions for the user]
113
+
114
+ ### Design Direction (if multi-page)
115
+ - **Aesthetic:** [direction]
116
+ - **Typography:** [display font] + [body font]
117
+ - **Tone:** [description]
118
+ - **Key terms:** [glossary]
101
119
  ```
102
120
 
103
121
  ## When to Skip Brainstorming
@@ -52,6 +52,13 @@ You are the Team Lead. The user wants to run `opencastle run` to execute a batch
52
52
  | `max_retries` | integer | no | Override retry count for this task |
53
53
  | `review` | `fast` \| `panel` \| `none` \| `auto` | no | Review level |
54
54
  | `gates` | list of strings | no | Per-task gate commands |
55
+ | `complexity` | `1` \| `2` \| `3` \| `5` \| `8` \| `13` | no | Fibonacci complexity score. Auto-populates timeout/retries/review from effort table. |
56
+
57
+ ### Complexity Scores
58
+
59
+ If a **Pre-Computed Task Complexity** table is present in the context, use those scores directly — do not re-derive them. Map each convoy task to the closest workstream; for combined workstreams use the highest score.
60
+
61
+ If no pre-computed data is available, assess complexity yourself: `1` (trivial), `2` (simple), `3` (moderate), `5` (significant), `8` (complex), `13` (epic).
55
62
 
56
63
  ### Agent Roster
57
64
 
@@ -93,6 +100,39 @@ For each workstream, break it down into the smallest meaningful unit. Follow the
93
100
  5. **Appropriate agent** — pick the agent whose speciality matches the task (e.g. `testing-expert` for tests, `database-engineer` for migrations).
94
101
  6. **Realistic timeouts** — `30m` for most tasks; `1h` for large refactors; `10m` for small docs or config.
95
102
 
103
+ ### 2.5 Foundation Phase for Multi-Page Projects
104
+
105
+ When the goal involves building **2 or more pages, views, or UI sections**, apply the Foundation-First Pattern to prevent consistency drift across parallel agents:
106
+
107
+ 1. **Create a foundation task** (`id: foundation-setup`) as the FIRST task. This task:
108
+ - Creates a **design tokens file** (CSS custom properties for colors, typography, spacing, motion, shadows, breakpoints)
109
+ - Creates a **shared layout component** (page container with header, footer, navigation)
110
+ - Creates a **UI component library** (Button, Card, Heading, Text, Section, Container, Grid)
111
+ - Establishes the **style guide** (aesthetic direction, content tone, terminology, navigation labels)
112
+ - Agent: `ui-ux-expert` or `developer`
113
+
114
+ 2. **All page tasks must `depends_on: [foundation-setup]`** — they cannot run until the foundation is in place.
115
+
116
+ 3. **Every page task prompt must include Foundation References** — these 5 mandatory lines constrain the agent to `use` existing artifacts instead of `creating` new ones:
117
+ ```
118
+ ### Foundation References (MANDATORY)
119
+ - Design tokens: `[path to tokens file]` — use ONLY these variables. No new color/font/spacing values.
120
+ - Layout: `[path to Layout component]` — wrap all content in this layout.
121
+ - UI components: `[path to ui/ directory]` — import shared components. Do not recreate Button/Card/etc.
122
+ - Aesthetic: [2-3 word direction from foundation]
123
+ - Tone: [content tone from foundation]
124
+ ```
125
+
126
+ 4. **The foundation prompt itself** should specify:
127
+ - The aesthetic direction (2-3 words + elaboration)
128
+ - The typography pairing (display + body font)
129
+ - The color palette intent (dominant, accent, muted)
130
+ - The navigation labels (exact text for every nav link)
131
+ - The content tone (formal/casual, active/passive)
132
+ - Terminology choices (e.g., "projects" not "portfolio")
133
+
134
+ > **Why:** Without this pattern, parallel agents independently choose fonts, colors, component APIs, and content tone. The result looks like it was built by different teams — because it was. Foundation-first makes consistency structural, not aspirational.
135
+
96
136
  ### 3. Define the Dependency Graph (DAG)
97
137
 
98
138
  - Tasks with no dependencies run first (in parallel up to `concurrency`).
@@ -127,6 +167,12 @@ Each task `prompt` must be a **complete, standalone instruction**. Include:
127
167
  >
128
168
  > **Strong prompt:** "Write unit tests for `libs/auth/src/server.ts` covering token refresh, expiry edge cases, and invalid signatures. Place tests in `libs/auth/src/__tests__/server.test.ts`. Follow the existing test conventions. Achieve ≥ 95% coverage for `server.ts`. Run the project's test command with coverage and fix any failures."
129
169
 
170
+ > **Multi-page prompt pattern:** For page tasks in a multi-page project, always include the Foundation References block (from Step 2.5). The foundation task creates the design system; page tasks consume it.
171
+ >
172
+ > **Strong page prompt:** "Build the About page at `app/about/page.tsx`. **Foundation References:** Design tokens: `src/styles/tokens.css` — use ONLY these variables. Layout: `src/components/Layout.tsx` — wrap content in this layout. UI components: `src/components/ui/` — use Heading, Text, Section. Aesthetic: warm editorial. Tone: conversational and authentic. Include a bio section, skills grid (use Card from UI lib), and a timeline of experience. Responsive at 320px, 768px, 1280px."
173
+ >
174
+ > **Weak page prompt:** "Build the About page with a bio and skills section." — No foundation references, agent will create its own styles.
175
+
130
176
  ### 6. Validate Before Outputting
131
177
 
132
178
  - [ ] Every task has a unique `id`
@@ -141,6 +187,9 @@ Each task `prompt` must be a **complete, standalone instruction**. Include:
141
187
  - [ ] **File list completeness**: Every file mentioned in a task's prompt that the agent will create or modify MUST appear in that task's `files` list. Don't omit utility files, sub-components, or config files if the prompt instructs the agent to create them.
142
188
  - [ ] **Prompt instruction accuracy**: Don't include instructions that contradict the dependency graph. If a task depends on another task (via `depends_on`), the depended task's outputs will exist when this task runs — don't add `@ts-expect-error` comments, stub files, or "if not found" fallbacks for files produced by dependencies.
143
189
  - [ ] **Content research rule compliance**: If a prompt concerns real people, places, or organisations, it includes a research instruction telling the agent to search the internet first.
190
+ - [ ] **Foundation phase present**: If the plan involves 2+ pages or UI sections, a `foundation-setup` task exists with no dependencies, and all page tasks depend on it
191
+ - [ ] **Foundation references in page prompts**: Every page-building task prompt includes the 5 mandatory Foundation References (design tokens path, layout path, UI component path, aesthetic direction, content tone)
192
+ - [ ] **No token duplication**: Page task prompts do NOT instruct agents to create new design tokens, layout components, or shared UI primitives — only to import and use existing ones from the foundation
144
193
 
145
194
  ### 7. Output
146
195
 
@@ -184,3 +233,15 @@ When chain mode is detected:
184
233
  }
185
234
  ````
186
235
 
236
+ ## Historical Performance Context
237
+
238
+ When historical execution data is available (via `opencastle insights --json`), the Team Lead should include a compact summary in the context. Example:
239
+
240
+ ### Historical Performance (auto-generated)
241
+ Based on {N} past convoys:
242
+ - Tasks on `src/cli/` succeed 92% with Developer (avg 8min)
243
+ - Recommended concurrency for {task_count} tasks: {recommended}
244
+ - Agents to watch: {high_retry_agents}
245
+
246
+ Use this data to make evidence-based decisions about agent assignment, concurrency, and timeout settings.
247
+
@@ -121,3 +121,38 @@ Phase 4 (background): Validation — Security audit + Tests + Docs (parallel)
121
121
  Phase 5 (sub-agent): QA gate — verify all phases, run builds, self-review
122
122
  Phase 6 (sub-agent): Panel review — load panel-majority-vote skill for high-stakes validation
123
123
  ```
124
+
125
+ ## Foundation-First Decomposition
126
+
127
+ When decomposing a multi-page or multi-component project, always apply the Foundation-First Pattern to maintain cross-agent consistency:
128
+
129
+ ### When to apply
130
+
131
+ - Goal involves 2+ pages, views, or UI sections
132
+ - Multiple agents (same or different phase) will produce visual output
133
+ - The project doesn't have an existing design system
134
+
135
+ ### Phase structure
136
+
137
+ ```
138
+ Phase 1: foundation-setup
139
+ ├── Creates: design tokens, layout, UI component library
140
+ ├── Defines: style guide brief (aesthetic, tone, terminology)
141
+ └── All visual tasks → depends_on: [foundation-setup]
142
+
143
+ Phase 2+: page tasks (parallel)
144
+ ├── Each prompt includes 5 Foundation References
145
+ └── Agents consume tokens — never create new values
146
+ ```
147
+
148
+ ### Partition rules for foundation
149
+
150
+ - Foundation task owns: `src/styles/`, `src/components/Layout.*`, `src/components/ui/`
151
+ - Page tasks own: their specific page file + page-specific components only
152
+ - No page task may list a foundation-owned path in its `files[]`
153
+
154
+ ### Common mistake
155
+
156
+ Decomposing pages as independent Phase 1 tasks (no foundation). This produces partition-clean, dependency-valid specs that fail aesthetically — each agent invents its own design. Always add the foundation task as the root of the DAG for visual work.
157
+
158
+ > Load the **project-consistency** skill for the full Foundation Phase pattern, prompt templates, and anti-patterns.
@@ -192,4 +192,30 @@ Run this checklist before delivering any frontend work. Every item is a gate —
192
192
  - [ ] No hardcoded widths that break at unexpected viewports
193
193
  - [ ] Images and decorative elements have proper `alt` text or `aria-hidden`
194
194
  - [ ] Focus indicators are visible and styled to match the aesthetic
195
- - [ ] Performance: no layout thrashing from scroll-triggered animations without `will-change`
195
+ - [ ] Performance: no layout thrashing from scroll-triggered animations without `will-change`
196
+ ## Convoy-Aware Design
197
+
198
+ When building as part of a multi-agent convoy (multiple pages or sections built in parallel), additional rules apply:
199
+
200
+ ### If you ARE the foundation task agent
201
+
202
+ You are establishing the design system for the entire project. Your output is the source of truth that all other agents will consume. Focus on:
203
+
204
+ 1. **Design tokens file** — comprehensive CSS custom properties covering all visual dimensions
205
+ 2. **Layout component** — shared page container used by every page
206
+ 3. **UI component library** — shared primitives (Button, Card, Heading, etc.)
207
+ 4. **Style guide brief** — aesthetic direction, content tone, terminology, nav labels
208
+
209
+ Make explicit, decisive choices. Ambiguity in the foundation cascades into inconsistency across pages.
210
+
211
+ ### If you are a page task agent (consuming the foundation)
212
+
213
+ You are NOT making design decisions — you are executing within an established system.
214
+
215
+ - **Import** design tokens. **Do not** create new color values, font sizes, or spacing units.
216
+ - **Import** the Layout component. **Do not** create a page-local layout wrapper.
217
+ - **Import** UI components (Button, Card, etc.). **Do not** recreate them.
218
+ - **Follow** the aesthetic direction and content tone from the foundation.
219
+ - If a token you need doesn't exist, flag it in your output — NEVER add an inline value as a workaround.
220
+
221
+ > Load the **project-consistency** skill for the full Foundation Phase pattern and prompt templates.