buildanything 1.8.0 → 2.1.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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +17 -3
- package/CHANGELOG.md +57 -0
- package/README.md +57 -61
- package/agents/a11y-architect.md +168 -0
- package/agents/briefing-officer.md +172 -0
- package/agents/business-model.md +82 -29
- package/agents/code-architect.md +80 -0
- package/agents/code-reviewer.md +256 -0
- package/agents/code-simplifier.md +72 -0
- package/agents/design-brand-guardian.md +312 -53
- package/agents/design-critic.md +144 -0
- package/agents/design-inclusive-visuals-specialist.md +8 -19
- package/agents/design-ui-designer.md +352 -56
- package/agents/design-ux-architect.md +418 -55
- package/agents/design-ux-researcher.md +359 -49
- package/agents/engineering-ai-engineer.md +28 -36
- package/agents/engineering-backend-architect.md +187 -36
- package/agents/engineering-data-engineer.md +227 -43
- package/agents/engineering-devops-automator.md +229 -74
- package/agents/engineering-frontend-developer.md +223 -34
- package/agents/engineering-mobile-app-builder.md +8 -1
- package/agents/engineering-rapid-prototyper.md +45 -11
- package/agents/engineering-security-engineer.md +265 -61
- package/agents/engineering-senior-developer.md +141 -19
- package/agents/engineering-sre.md +86 -0
- package/agents/engineering-technical-writer.md +287 -41
- package/agents/feature-intel.md +111 -0
- package/agents/ios-app-review-guardian.md +21 -2
- package/agents/ios-foundation-models-specialist.md +22 -2
- package/agents/ios-product-reality-auditor.md +292 -0
- package/agents/ios-storekit-specialist.md +11 -2
- package/agents/ios-swift-architect.md +29 -1
- package/agents/ios-swift-search.md +9 -1
- package/agents/ios-swift-ui-design.md +40 -5
- package/agents/marketing-app-store-optimizer.md +248 -64
- package/agents/planner.md +221 -0
- package/agents/pr-test-analyzer.md +64 -0
- package/agents/product-feedback-synthesizer.md +70 -2
- package/agents/product-owner.md +163 -0
- package/agents/product-reality-auditor.md +216 -0
- package/agents/product-spec-writer.md +176 -0
- package/agents/refactor-cleaner.md +110 -0
- package/agents/security-reviewer.md +129 -0
- package/agents/silent-failure-hunter.md +55 -0
- package/agents/swift-build-resolver.md +121 -0
- package/agents/swift-reviewer.md +113 -0
- package/agents/tech-feasibility.md +26 -4
- package/agents/testing-api-tester.md +238 -59
- package/agents/testing-evidence-collector.md +50 -1
- package/agents/testing-performance-benchmarker.md +23 -1
- package/agents/testing-reality-checker.md +7 -1
- package/agents/visual-research.md +118 -0
- package/bin/adapters/cycle-counter-tool.ts +155 -0
- package/bin/adapters/scribe-tool.ts +73 -0
- package/bin/adapters/state-save-tool.ts +130 -0
- package/bin/adapters/write-lease-tool.ts +127 -0
- package/bin/buildanything-runtime.js +15 -0
- package/bin/buildanything-runtime.ts +241 -0
- package/bin/graph-index.js +24 -0
- package/bin/graph-index.ts +340 -0
- package/bin/mcp-servers/graph-mcp.js +26 -0
- package/bin/mcp-servers/graph-mcp.ts +481 -0
- package/bin/mcp-servers/orchestrator-mcp.js +26 -0
- package/bin/mcp-servers/orchestrator-mcp.ts +361 -0
- package/bin/setup.js +312 -76
- package/commands/add-feature.md +2 -0
- package/commands/build.md +994 -265
- package/commands/fix.md +1 -1
- package/commands/idea-sweep.md +2 -2
- package/commands/self-check.md +121 -0
- package/commands/setup.md +61 -9
- package/commands/ux-review.md +5 -5
- package/commands/verify.md +9 -9
- package/docs/migration/agents.yaml +729 -0
- package/docs/migration/phase-graph.yaml +1504 -0
- package/docs/migration/sdk-host-compat.md +18 -0
- package/hooks/compile-writer-owner-cache.ts +171 -0
- package/hooks/design-md-lint +4 -0
- package/hooks/design-md-lint.ts +295 -0
- package/hooks/hooks.json +36 -0
- package/hooks/pre-tool-use +19 -0
- package/hooks/pre-tool-use.ts +807 -0
- package/hooks/record-mode-transitions.ts +235 -0
- package/hooks/session-start +71 -1
- package/hooks/subagent-start +17 -0
- package/hooks/subagent-start.ts +472 -0
- package/hooks/subagent-stop +17 -0
- package/hooks/subagent-stop.ts +153 -0
- package/package.json +26 -4
- package/protocols/agent-prompt-authoring.md +165 -0
- package/protocols/architecture-schema.md +178 -0
- package/protocols/cleanup.md +4 -0
- package/protocols/decision-log.md +135 -0
- package/protocols/design-md-authoring.md +520 -0
- package/protocols/design-md-spec.md +362 -0
- package/protocols/fake-data-detector.md +1 -1
- package/protocols/ios-context.md +10 -11
- package/protocols/ios-fake-data-detector.md +65 -0
- package/protocols/ios-phase-branches.md +299 -39
- package/protocols/launch-readiness.md +262 -0
- package/protocols/metric-loop.md +62 -2
- package/protocols/page-spec-schema.md +234 -0
- package/protocols/product-spec-schema.md +354 -0
- package/protocols/smoke-test.md +9 -1
- package/protocols/sprint-tasks-schema.md +53 -0
- package/protocols/state-schema.json +423 -0
- package/protocols/state-schema.md +202 -0
- package/protocols/verify.md +91 -3
- package/protocols/web-phase-branches.md +395 -75
- package/skills/ios/_VENDORED.md +2 -0
- package/skills/ios/app-store-connect-metadata/SKILL.md +148 -0
- package/skills/ios/asc-privacy-manifest/SKILL.md +350 -0
- package/skills/ios/hig-components-content/SKILL.md +86 -0
- package/skills/ios/hig-components-content/references/activity-views.md +79 -0
- package/skills/ios/hig-components-content/references/charts.md +180 -0
- package/skills/ios/hig-components-content/references/collections.md +48 -0
- package/skills/ios/hig-components-content/references/color-wells.md +42 -0
- package/skills/ios/hig-components-content/references/image-views.md +82 -0
- package/skills/ios/hig-components-content/references/image-wells.md +34 -0
- package/skills/ios/hig-components-content/references/lockups.md +78 -0
- package/skills/ios/hig-components-content/references/web-views.md +36 -0
- package/skills/ios/hig-components-controls/SKILL.md +88 -0
- package/skills/ios/hig-components-controls/references/combo-boxes.md +40 -0
- package/skills/ios/hig-components-controls/references/controls.md +112 -0
- package/skills/ios/hig-components-controls/references/gauges.md +74 -0
- package/skills/ios/hig-components-controls/references/labels.md +92 -0
- package/skills/ios/hig-components-controls/references/pickers.md +128 -0
- package/skills/ios/hig-components-controls/references/rating-indicators.md +38 -0
- package/skills/ios/hig-components-controls/references/segmented-controls.md +94 -0
- package/skills/ios/hig-components-controls/references/sliders.md +92 -0
- package/skills/ios/hig-components-controls/references/steppers.md +40 -0
- package/skills/ios/hig-components-controls/references/text-fields.md +88 -0
- package/skills/ios/hig-components-controls/references/text-views.md +56 -0
- package/skills/ios/hig-components-controls/references/toggles.md +127 -0
- package/skills/ios/hig-components-controls/references/token-fields.md +48 -0
- package/skills/ios/hig-components-controls/references/virtual-keyboards.md +156 -0
- package/skills/ios/hig-components-dialogs/SKILL.md +76 -0
- package/skills/ios/hig-components-dialogs/references/action-sheets.md +74 -0
- package/skills/ios/hig-components-dialogs/references/alerts.md +158 -0
- package/skills/ios/hig-components-dialogs/references/digit-entry-views.md +32 -0
- package/skills/ios/hig-components-dialogs/references/popovers.md +81 -0
- package/skills/ios/hig-components-dialogs/references/sheets.md +157 -0
- package/skills/ios/hig-components-layout/SKILL.md +99 -0
- package/skills/ios/hig-components-layout/references/boxes.md +48 -0
- package/skills/ios/hig-components-layout/references/column-views.md +44 -0
- package/skills/ios/hig-components-layout/references/lists-and-tables.md +99 -0
- package/skills/ios/hig-components-layout/references/ornaments.md +56 -0
- package/skills/ios/hig-components-layout/references/outline-views.md +64 -0
- package/skills/ios/hig-components-layout/references/panels.md +75 -0
- package/skills/ios/hig-components-layout/references/scroll-views.md +123 -0
- package/skills/ios/hig-components-layout/references/sidebars.md +109 -0
- package/skills/ios/hig-components-layout/references/split-views.md +110 -0
- package/skills/ios/hig-components-layout/references/tab-bars.md +173 -0
- package/skills/ios/hig-components-layout/references/tab-views.md +68 -0
- package/skills/ios/hig-components-layout/references/windows.md +188 -0
- package/skills/ios/hig-components-menus/SKILL.md +81 -0
- package/skills/ios/hig-components-menus/references/action-button.md +61 -0
- package/skills/ios/hig-components-menus/references/buttons.md +261 -0
- package/skills/ios/hig-components-menus/references/context-menus.md +105 -0
- package/skills/ios/hig-components-menus/references/disclosure-controls.md +84 -0
- package/skills/ios/hig-components-menus/references/dock-menus.md +40 -0
- package/skills/ios/hig-components-menus/references/edit-menus.md +88 -0
- package/skills/ios/hig-components-menus/references/menus.md +171 -0
- package/skills/ios/hig-components-menus/references/pop-up-buttons.md +70 -0
- package/skills/ios/hig-components-menus/references/pull-down-buttons.md +77 -0
- package/skills/ios/hig-components-menus/references/the-menu-bar.md +303 -0
- package/skills/ios/hig-components-menus/references/toolbars.md +256 -0
- package/skills/ios/hig-components-search/SKILL.md +68 -0
- package/skills/ios/hig-components-search/references/page-controls.md +120 -0
- package/skills/ios/hig-components-search/references/path-controls.md +40 -0
- package/skills/ios/hig-components-search/references/search-fields.md +189 -0
- package/skills/ios/hig-components-status/SKILL.md +80 -0
- package/skills/ios/hig-components-status/references/activity-rings.md +105 -0
- package/skills/ios/hig-components-status/references/progress-indicators.md +116 -0
- package/skills/ios/hig-components-status/references/status-bars.md +38 -0
- package/skills/ios/hig-components-system/SKILL.md +88 -0
- package/skills/ios/hig-components-system/references/app-clips.md +387 -0
- package/skills/ios/hig-components-system/references/app-shortcuts.md +114 -0
- package/skills/ios/hig-components-system/references/complications.md +425 -0
- package/skills/ios/hig-components-system/references/home-screen-quick-actions.md +42 -0
- package/skills/ios/hig-components-system/references/live-activities.md +442 -0
- package/skills/ios/hig-components-system/references/notifications.md +153 -0
- package/skills/ios/hig-components-system/references/top-shelf.md +135 -0
- package/skills/ios/hig-components-system/references/watch-faces.md +40 -0
- package/skills/ios/hig-components-system/references/widgets.md +517 -0
- package/skills/ios/hig-foundations/SKILL.md +98 -0
- package/skills/ios/hig-foundations/references/accessibility.md +291 -0
- package/skills/ios/hig-foundations/references/app-icons.md +210 -0
- package/skills/ios/hig-foundations/references/branding.md +44 -0
- package/skills/ios/hig-foundations/references/color.md +274 -0
- package/skills/ios/hig-foundations/references/dark-mode.md +116 -0
- package/skills/ios/hig-foundations/references/icons.md +263 -0
- package/skills/ios/hig-foundations/references/images.md +176 -0
- package/skills/ios/hig-foundations/references/immersive-experiences.md +174 -0
- package/skills/ios/hig-foundations/references/inclusion.md +189 -0
- package/skills/ios/hig-foundations/references/layout.md +425 -0
- package/skills/ios/hig-foundations/references/materials.md +238 -0
- package/skills/ios/hig-foundations/references/motion.md +103 -0
- package/skills/ios/hig-foundations/references/privacy.md +231 -0
- package/skills/ios/hig-foundations/references/right-to-left.md +206 -0
- package/skills/ios/hig-foundations/references/sf-symbols.md +310 -0
- package/skills/ios/hig-foundations/references/spatial-layout.md +142 -0
- package/skills/ios/hig-foundations/references/typography.md +1146 -0
- package/skills/ios/hig-foundations/references/writing.md +91 -0
- package/skills/ios/hig-inputs/SKILL.md +94 -0
- package/skills/ios/hig-inputs/references/apple-pencil-and-scribble.md +148 -0
- package/skills/ios/hig-inputs/references/camera-control.md +107 -0
- package/skills/ios/hig-inputs/references/digital-crown.md +83 -0
- package/skills/ios/hig-inputs/references/eyes.md +120 -0
- package/skills/ios/hig-inputs/references/focus-and-selection.md +120 -0
- package/skills/ios/hig-inputs/references/game-controls.md +156 -0
- package/skills/ios/hig-inputs/references/gestures.md +208 -0
- package/skills/ios/hig-inputs/references/gyro-and-accelerometer.md +40 -0
- package/skills/ios/hig-inputs/references/keyboards.md +234 -0
- package/skills/ios/hig-inputs/references/nearby-interactions.md +70 -0
- package/skills/ios/hig-inputs/references/pointing-devices.md +237 -0
- package/skills/ios/hig-inputs/references/remotes.md +67 -0
- package/skills/ios/hig-inputs/references/spatial-interactions.md +70 -0
- package/skills/ios/hig-patterns/SKILL.md +104 -0
- package/skills/ios/hig-patterns/references/charting-data.md +81 -0
- package/skills/ios/hig-patterns/references/collaboration-and-sharing.md +86 -0
- package/skills/ios/hig-patterns/references/drag-and-drop.md +134 -0
- package/skills/ios/hig-patterns/references/entering-data.md +69 -0
- package/skills/ios/hig-patterns/references/feedback.md +67 -0
- package/skills/ios/hig-patterns/references/file-management.md +135 -0
- package/skills/ios/hig-patterns/references/going-full-screen.md +79 -0
- package/skills/ios/hig-patterns/references/launching.md +81 -0
- package/skills/ios/hig-patterns/references/live-viewing-apps.md +79 -0
- package/skills/ios/hig-patterns/references/loading.md +59 -0
- package/skills/ios/hig-patterns/references/managing-accounts.md +107 -0
- package/skills/ios/hig-patterns/references/managing-notifications.md +99 -0
- package/skills/ios/hig-patterns/references/modality.md +82 -0
- package/skills/ios/hig-patterns/references/multitasking.md +131 -0
- package/skills/ios/hig-patterns/references/offering-help.md +117 -0
- package/skills/ios/hig-patterns/references/onboarding.md +69 -0
- package/skills/ios/hig-patterns/references/playing-audio.md +124 -0
- package/skills/ios/hig-patterns/references/playing-haptics.md +280 -0
- package/skills/ios/hig-patterns/references/playing-video.md +180 -0
- package/skills/ios/hig-patterns/references/printing.md +50 -0
- package/skills/ios/hig-patterns/references/ratings-and-reviews.md +48 -0
- package/skills/ios/hig-patterns/references/searching.md +70 -0
- package/skills/ios/hig-patterns/references/settings.md +84 -0
- package/skills/ios/hig-patterns/references/undo-and-redo.md +58 -0
- package/skills/ios/hig-patterns/references/workouts.md +76 -0
- package/skills/ios/hig-platforms/SKILL.md +84 -0
- package/skills/ios/hig-platforms/references/designing-for-games.md +159 -0
- package/skills/ios/hig-platforms/references/designing-for-ios.md +66 -0
- package/skills/ios/hig-platforms/references/designing-for-ipados.md +64 -0
- package/skills/ios/hig-platforms/references/designing-for-macos.md +70 -0
- package/skills/ios/hig-platforms/references/designing-for-tvos.md +68 -0
- package/skills/ios/hig-platforms/references/designing-for-visionos.md +85 -0
- package/skills/ios/hig-platforms/references/designing-for-watchos.md +74 -0
- package/skills/ios/hig-project-context/SKILL.md +133 -0
- package/skills/ios/hig-technologies/SKILL.md +107 -0
- package/skills/ios/hig-technologies/references/airplay.md +125 -0
- package/skills/ios/hig-technologies/references/always-on.md +62 -0
- package/skills/ios/hig-technologies/references/apple-pay.md +441 -0
- package/skills/ios/hig-technologies/references/augmented-reality.md +247 -0
- package/skills/ios/hig-technologies/references/carekit.md +224 -0
- package/skills/ios/hig-technologies/references/carplay.md +119 -0
- package/skills/ios/hig-technologies/references/game-center.md +343 -0
- package/skills/ios/hig-technologies/references/generative-ai.md +110 -0
- package/skills/ios/hig-technologies/references/healthkit.md +120 -0
- package/skills/ios/hig-technologies/references/homekit.md +343 -0
- package/skills/ios/hig-technologies/references/icloud.md +52 -0
- package/skills/ios/hig-technologies/references/id-verifier.md +73 -0
- package/skills/ios/hig-technologies/references/imessage-apps-and-stickers.md +105 -0
- package/skills/ios/hig-technologies/references/in-app-purchase.md +263 -0
- package/skills/ios/hig-technologies/references/live-photos.md +54 -0
- package/skills/ios/hig-technologies/references/mac-catalyst.md +216 -0
- package/skills/ios/hig-technologies/references/machine-learning.md +394 -0
- package/skills/ios/hig-technologies/references/maps.md +221 -0
- package/skills/ios/hig-technologies/references/nfc.md +51 -0
- package/skills/ios/hig-technologies/references/photo-editing.md +40 -0
- package/skills/ios/hig-technologies/references/researchkit.md +134 -0
- package/skills/ios/hig-technologies/references/shareplay.md +142 -0
- package/skills/ios/hig-technologies/references/shazamkit.md +47 -0
- package/skills/ios/hig-technologies/references/sign-in-with-apple.md +288 -0
- package/skills/ios/hig-technologies/references/siri.md +523 -0
- package/skills/ios/hig-technologies/references/tap-to-pay-on-iphone.md +208 -0
- package/skills/ios/hig-technologies/references/voiceover.md +90 -0
- package/skills/ios/hig-technologies/references/wallet.md +420 -0
- package/skills/ios/ios-bootstrap/SKILL.md +17 -8
- package/skills/ios/swift-actor-persistence/SKILL.md +143 -0
- package/skills/ios/swift-concurrency-6-2/SKILL.md +216 -0
- package/skills/ios/swift-protocol-di-testing/SKILL.md +190 -0
- package/skills/ios/swiftui-design-tokens/SKILL.md +475 -0
- package/skills/ios/writing-for-interfaces/SKILL.md +75 -0
- package/skills/web/accessibility/SKILL.md +146 -0
- package/skills/web/aceternity-ui/SKILL.md +719 -0
- package/skills/web/aceternity-ui/metadata.json +10 -0
- package/skills/web/api-design/SKILL.md +523 -0
- package/skills/web/chart-accessibility/SKILL.md +332 -0
- package/skills/web/composition-patterns/AGENTS.md +946 -0
- package/skills/web/composition-patterns/README.md +60 -0
- package/skills/web/composition-patterns/SKILL.md +89 -0
- package/skills/web/composition-patterns/metadata.json +11 -0
- package/skills/web/composition-patterns/rules/_sections.md +29 -0
- package/skills/web/composition-patterns/rules/_template.md +24 -0
- package/skills/web/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/skills/web/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/skills/web/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/skills/web/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/skills/web/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/skills/web/composition-patterns/rules/state-context-interface.md +191 -0
- package/skills/web/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/skills/web/composition-patterns/rules/state-lift-state.md +125 -0
- package/skills/web/cost-aware-llm-pipeline/SKILL.md +183 -0
- package/skills/web/database-migrations/SKILL.md +429 -0
- package/skills/web/deployment-patterns/SKILL.md +427 -0
- package/skills/web/docker-patterns/SKILL.md +364 -0
- package/skills/web/e2e-testing/SKILL.md +326 -0
- package/skills/web/lighthouse-ci/SKILL.md +361 -0
- package/skills/web/mcp-server-patterns/SKILL.md +69 -0
- package/skills/web/next-best-practices/SKILL.md +153 -0
- package/skills/web/next-best-practices/async-patterns.md +87 -0
- package/skills/web/next-best-practices/bundling.md +180 -0
- package/skills/web/next-best-practices/data-patterns.md +297 -0
- package/skills/web/next-best-practices/debug-tricks.md +105 -0
- package/skills/web/next-best-practices/directives.md +73 -0
- package/skills/web/next-best-practices/error-handling.md +227 -0
- package/skills/web/next-best-practices/file-conventions.md +140 -0
- package/skills/web/next-best-practices/font.md +245 -0
- package/skills/web/next-best-practices/functions.md +108 -0
- package/skills/web/next-best-practices/hydration-error.md +91 -0
- package/skills/web/next-best-practices/image.md +173 -0
- package/skills/web/next-best-practices/metadata.md +301 -0
- package/skills/web/next-best-practices/parallel-routes.md +287 -0
- package/skills/web/next-best-practices/route-handlers.md +146 -0
- package/skills/web/next-best-practices/rsc-boundaries.md +159 -0
- package/skills/web/next-best-practices/runtime-selection.md +39 -0
- package/skills/web/next-best-practices/scripts.md +141 -0
- package/skills/web/next-best-practices/self-hosting.md +371 -0
- package/skills/web/next-best-practices/suspense-boundaries.md +67 -0
- package/skills/web/next-cache-components/SKILL.md +411 -0
- package/skills/web/postgres-best-practices/SKILL.md +14 -0
- package/skills/web/postgres-best-practices/references/schema-design.md +9 -0
- package/skills/web/react-best-practices/AGENTS.md +3810 -0
- package/skills/web/react-best-practices/README.md +123 -0
- package/skills/web/react-best-practices/SKILL.md +149 -0
- package/skills/web/react-best-practices/metadata.json +15 -0
- package/skills/web/react-best-practices/rules/_sections.md +46 -0
- package/skills/web/react-best-practices/rules/_template.md +28 -0
- package/skills/web/react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/skills/web/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/skills/web/react-best-practices/rules/advanced-init-once.md +42 -0
- package/skills/web/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/skills/web/react-best-practices/rules/async-api-routes.md +38 -0
- package/skills/web/react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/skills/web/react-best-practices/rules/async-defer-await.md +82 -0
- package/skills/web/react-best-practices/rules/async-dependencies.md +51 -0
- package/skills/web/react-best-practices/rules/async-parallel.md +28 -0
- package/skills/web/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/skills/web/react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/skills/web/react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/skills/web/react-best-practices/rules/bundle-conditional.md +31 -0
- package/skills/web/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/skills/web/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/skills/web/react-best-practices/rules/bundle-preload.md +50 -0
- package/skills/web/react-best-practices/rules/client-event-listeners.md +74 -0
- package/skills/web/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/skills/web/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/skills/web/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/skills/web/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/skills/web/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/skills/web/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/skills/web/react-best-practices/rules/js-cache-storage.md +70 -0
- package/skills/web/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/skills/web/react-best-practices/rules/js-early-exit.md +50 -0
- package/skills/web/react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/skills/web/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/skills/web/react-best-practices/rules/js-index-maps.md +37 -0
- package/skills/web/react-best-practices/rules/js-length-check-first.md +49 -0
- package/skills/web/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/skills/web/react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/skills/web/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/skills/web/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/skills/web/react-best-practices/rules/rendering-activity.md +26 -0
- package/skills/web/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/skills/web/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/skills/web/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/skills/web/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/skills/web/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/skills/web/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/skills/web/react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/skills/web/react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/skills/web/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/skills/web/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/skills/web/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/skills/web/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/skills/web/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/skills/web/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/skills/web/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/skills/web/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/skills/web/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/skills/web/react-best-practices/rules/rerender-memo.md +44 -0
- package/skills/web/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/skills/web/react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/skills/web/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/skills/web/react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/skills/web/react-best-practices/rules/rerender-transitions.md +40 -0
- package/skills/web/react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/skills/web/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/skills/web/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/skills/web/react-best-practices/rules/server-auth-actions.md +96 -0
- package/skills/web/react-best-practices/rules/server-cache-lru.md +41 -0
- package/skills/web/react-best-practices/rules/server-cache-react.md +76 -0
- package/skills/web/react-best-practices/rules/server-dedup-props.md +65 -0
- package/skills/web/react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/skills/web/react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/skills/web/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/skills/web/react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/skills/web/react-best-practices/rules/server-serialization.md +38 -0
- package/skills/web/seo/SKILL.md +154 -0
- package/skills/web/web-design-guidelines/SKILL.md +39 -0
- package/skills/web/zap-scan-config/SKILL.md +444 -0
- package/skills/web/zap-scan-config/assets/.gitkeep +9 -0
- package/skills/web/zap-scan-config/assets/github_action.yml +207 -0
- package/skills/web/zap-scan-config/assets/gitlab_ci.yml +226 -0
- package/skills/web/zap-scan-config/assets/zap_automation.yaml +196 -0
- package/skills/web/zap-scan-config/assets/zap_context.xml +192 -0
- package/skills/web/zap-scan-config/references/EXAMPLE.md +40 -0
- package/skills/web/zap-scan-config/references/api_testing_guide.md +475 -0
- package/skills/web/zap-scan-config/references/authentication_guide.md +431 -0
- package/skills/web/zap-scan-config/references/false_positive_handling.md +427 -0
- package/skills/web/zap-scan-config/references/owasp_mapping.md +255 -0
- package/src/graph/ids.ts +86 -0
- package/src/graph/index.ts +32 -0
- package/src/graph/parser/architecture.ts +603 -0
- package/src/graph/parser/component-manifest.ts +268 -0
- package/src/graph/parser/decisions-jsonl.ts +407 -0
- package/src/graph/parser/design-md-pass2.ts +253 -0
- package/src/graph/parser/design-md.ts +477 -0
- package/src/graph/parser/page-spec.ts +496 -0
- package/src/graph/parser/product-spec.ts +930 -0
- package/src/graph/parser/screenshot.ts +342 -0
- package/src/graph/parser/sprint-tasks.ts +317 -0
- package/src/graph/storage/index.ts +1154 -0
- package/src/graph/types.ts +432 -0
- package/src/graph/util/dhash.ts +84 -0
- package/src/lrr/aggregator.ts +175 -0
- package/src/orchestrator/hooks/context-header.ts +119 -0
- package/src/orchestrator/hooks/token-accounting-emitter.ts +77 -0
- package/src/orchestrator/hooks/token-accounting.ts +112 -0
- package/src/orchestrator/mcp/cycle-counter.ts +130 -0
- package/src/orchestrator/mcp/scribe.ts +294 -0
- package/src/orchestrator/mcp/state-save.ts +149 -0
- package/src/orchestrator/mcp/write-lease.ts +184 -0
- package/src/orchestrator/phase4-shared-context.ts +57 -0
- package/src/orchestrator/schemas/backward-edge.ts +46 -0
- package/agents/agentic-identity-trust.md +0 -121
- package/agents/data-consolidation-agent.md +0 -39
- package/agents/design-image-prompt-engineer.md +0 -105
- package/agents/design-visual-storyteller.md +0 -147
- package/agents/design-whimsy-injector.md +0 -89
- package/agents/engineering-autonomous-optimization-architect.md +0 -105
- package/agents/market-intel.md +0 -35
- package/agents/marketing-instagram-curator.md +0 -111
- package/agents/marketing-reddit-community-builder.md +0 -121
- package/agents/marketing-social-media-strategist.md +0 -74
- package/agents/marketing-tiktok-strategist.md +0 -123
- package/agents/marketing-twitter-engager.md +0 -124
- package/agents/marketing-wechat-official-account.md +0 -143
- package/agents/marketing-xiaohongshu-specialist.md +0 -136
- package/agents/marketing-zhihu-strategist.md +0 -160
- package/agents/product-behavioral-nudge-engine.md +0 -78
- package/agents/project-management-experiment-tracker.md +0 -102
- package/agents/report-distribution-agent.md +0 -43
- package/agents/risk-analysis.md +0 -45
- package/agents/sales-data-extraction-agent.md +0 -46
- package/agents/specialized-cultural-intelligence-strategist.md +0 -65
- package/agents/specialized-developer-advocate.md +0 -146
- package/agents/support-analytics-reporter.md +0 -133
- package/agents/support-executive-summary-generator.md +0 -64
- package/agents/support-finance-tracker.md +0 -145
- package/agents/support-legal-compliance-checker.md +0 -129
- package/agents/support-support-responder.md +0 -91
- package/agents/testing-accessibility-auditor.md +0 -110
- package/agents/testing-test-results-analyzer.md +0 -97
- package/agents/testing-tool-evaluator.md +0 -76
- package/agents/testing-workflow-optimizer.md +0 -99
- package/agents/user-research.md +0 -40
- package/protocols/brainstorm.md +0 -99
- package/protocols/design.md +0 -269
- package/protocols/planning.md +0 -87
- package/skills/ios/ios-hig/SKILL.md +0 -41
- package/skills/ios/ios-hig/references/accessibility.md +0 -81
- package/skills/ios/ios-hig/references/content.md +0 -142
- package/skills/ios/ios-hig/references/feedback.md +0 -123
- package/skills/ios/ios-hig/references/interaction.md +0 -199
- package/skills/ios/ios-hig/references/performance-platform.md +0 -129
- package/skills/ios/ios-hig/references/privacy-permissions.md +0 -181
- package/skills/ios/ios-hig/references/visual-design.md +0 -84
package/commands/build.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Full product build pipeline — orchestrates specialist agents through brainstorming, research, architecture, implementation,
|
|
2
|
+
description: "Full product build pipeline — orchestrates specialist agents through brainstorming, research, architecture, design, implementation, audit, launch review, and ship"
|
|
3
3
|
argument-hint: "Describe what to build, or path to a design doc. --autonomous for unattended mode. --resume to continue a previous build."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -13,45 +13,134 @@ Every step below tells you to call the Agent tool. DO IT. Do not role-play as th
|
|
|
13
13
|
For implementation agents, set mode: "bypassPermissions".
|
|
14
14
|
For parallel work, put multiple Agent tool calls in ONE message.
|
|
15
15
|
|
|
16
|
-
Exception: Brainstorming
|
|
16
|
+
Exception: Brainstorming in Phase 1 Step 1.0 and Step 1.3 uses an INTERNAL Brainstorm Facilitator role — the orchestrator relays between the facilitator sub-agent and the user, never role-plays the agent itself.
|
|
17
17
|
</HARD-GATE>
|
|
18
18
|
|
|
19
|
+
<HARD-GATE>
|
|
20
|
+
SUBAGENT_TYPE REQUIRED.
|
|
21
|
+
|
|
22
|
+
Every Agent tool call MUST include a `subagent_type` field unless the dispatch is explicitly marked INTERNAL (inline role-string). INTERNAL dispatches are orchestrator helpers: Brainstorm Facilitator, Research Synthesizer, Design Doc Writer, Prereq Collector, Task DAG Validator, Refs Indexer, Briefing Officer, PM chapter, LRR Aggregator, Completion Report, Verify scaffolding dispatcher.
|
|
23
|
+
|
|
24
|
+
Missing `subagent_type` on a non-INTERNAL dispatch is a HARD-GATE violation. The orchestrator rejects dispatches that don't name a specific agent. If you catch yourself typing `description: "..."` without a `subagent_type:` line alongside it, STOP and look up the right agent from the per-phase dispatch tables further down in this file.
|
|
25
|
+
</HARD-GATE>
|
|
26
|
+
|
|
27
|
+
<HARD-GATE>
|
|
28
|
+
ARTIFACT WRITER-OWNER RULE.
|
|
29
|
+
|
|
30
|
+
Every shared artifact has ONE concurrent writer at any instant. The writer-owner table below defines which phase writes which file. Before any file write, the orchestrator verifies the current phase is the rightful writer. Non-owning phase writes are a HARD-GATE violation. For parallel-batch phases (e.g., Phase 4), intra-phase dispatches MUST NOT race on the same file — writes either target disjoint per-dispatch filenames OR route through an orchestrator-scribe handler (see `decisions.jsonl` handling below).
|
|
31
|
+
|
|
32
|
+
Live downstream docs (read across Phase 3+):
|
|
33
|
+
- `CLAUDE.md` — P1 writer (then auto-loaded into every subagent)
|
|
34
|
+
- `docs/plans/design-doc.md` (PRD) — P1 writer
|
|
35
|
+
- `docs/plans/product-spec.md` — P1 writer (Step 1.6), product-spec-writer writer
|
|
36
|
+
- `docs/plans/architecture.md` — P2 writer
|
|
37
|
+
- `docs/plans/sprint-tasks.md` — P2 writer
|
|
38
|
+
- `docs/plans/quality-targets.json` — P2 writer
|
|
39
|
+
- `docs/plans/phase-2-contracts/*.md` — P2 writer (per-architect post-debate contract files)
|
|
40
|
+
- `docs/plans/visual-dna-preview.md` — P2 writer, design-brand-guardian writer, ios-swift-ui-design writer (directional DNA preview at Gate 2)
|
|
41
|
+
- `DESIGN.md` — P3 writers: design-brand-guardian (Pass 1 at Step 3.0, both modes); design-ui-designer (Pass 2 at Step 3.4, web); ios-swift-ui-design (Pass 2 at Step 3.2-ios, iOS). Replaces former visual-dna.md + visual-design-spec.md pair (web) and ios-design-board.md (iOS). Repo root.
|
|
42
|
+
- `docs/plans/component-manifest.md` — P3 writer (web, HARD-GATE import source)
|
|
43
|
+
- `docs/plans/design-references.md` — visual-research writer (web, Step 3.1)
|
|
44
|
+
- `docs/plans/design-references/**` — visual-research writer (web, screenshots harvested by visual-research subagents)
|
|
45
|
+
- `docs/plans/dna-persona-check.md` — design-ux-researcher writer (web, Step 3.2b)
|
|
46
|
+
- `docs/plans/ux-architecture.md` — P3 writer (web)
|
|
47
|
+
- `docs/plans/ux-flow-validation.md` — design-ux-researcher writer (web, Step 3.3b)
|
|
48
|
+
- `docs/plans/inclusive-visuals-audit.md` — P3 writer (web)
|
|
49
|
+
- `docs/plans/a11y-design-review.md` — P3 writer, a11y-architect writer (web, Step 3.7)
|
|
50
|
+
- `docs/plans/page-specs/*.md` — P3 writer, design-ux-architect writer (web, Step 3.3 — per-screen wireframes + layout specs)
|
|
51
|
+
- `docs/plans/refs.json` — P2 writer, P3 writer (P3 extends after visual spec lands)
|
|
52
|
+
- `docs/plans/decisions.jsonl` — orchestrator-scribe ONLY via `scribe_decision` MCP tool (subagents return `deviation_row` objects; the orchestrator forwards each row through the MCP, which owns ID allocation and atomic append)
|
|
53
|
+
- `docs/plans/learnings.jsonl` — P5 writer, P7 writer
|
|
54
|
+
- `docs/plans/evidence/*.json` — P5 writer (P4 contributes per-task, P6/P7 readers)
|
|
55
|
+
- `docs/plans/evidence/*.md` — P5 writer, design-brand-guardian writer (brand-drift findings, fake-data-audit)
|
|
56
|
+
- `docs/plans/evidence/**/*.json` — P4 writer, P5 writer, P6 writer (nested per-task/per-run evidence JSON)
|
|
57
|
+
- `docs/plans/evidence/**/*.md` — P4 writer, P5 writer (nested per-task/per-run evidence markdown)
|
|
58
|
+
- `docs/plans/evidence/**/*.png` — P3 writer, P4 writer, P5 writer (screenshots: Playwright, SwiftUI Preview, Maestro, design-reference)
|
|
59
|
+
- `docs/plans/evidence/**/*.{txt,har}` — P4 writer, P5 writer (smoke-test HAR captures, DOM snapshots)
|
|
60
|
+
- `docs/plans/evidence/lrr/*.json` — code-reviewer writer, security-reviewer writer, engineering-sre writer, a11y-architect writer, design-brand-guardian writer, pr-test-analyzer writer (5 chapter verdicts + 1 sub-verdict)
|
|
61
|
+
- `docs/plans/evidence/lrr-aggregate.json` — phase-6-aggregator writer (Aggregator only)
|
|
62
|
+
- `docs/plans/evidence/lrr-incomplete.json` — phase-6-aggregator writer (file-completeness checkpoint)
|
|
63
|
+
- `docs/plans/evidence/lrr-routing.json` — phase-6-aggregator writer (BLOCK routing via decided_by)
|
|
64
|
+
- `docs/plans/evidence/reality-check-manifest.json` — testing-reality-checker writer (evidence-sweep manifest)
|
|
65
|
+
- `docs/plans/.build-state.json` — orchestrator writer (every phase boundary)
|
|
66
|
+
- `docs/plans/.build-state.md` — auto-rendered-view writer (regenerated from .build-state.json on every update)
|
|
67
|
+
- `docs/plans/.task-outputs/[task-id].json` — P4 writer (per-task output)
|
|
68
|
+
- `docs/plans/build-log.md` — every-phase writer (append on transition)
|
|
69
|
+
- `docs/plans/.active-learnings.md` — P0 writer (top-3 cross-run learnings for Phase 4 implementer briefings)
|
|
70
|
+
- `docs/plans/ios-verify-report.md` — P5 writer (iOS verify twin)
|
|
71
|
+
- `docs/plans/ios-ux-review-report.md` — P5 writer (iOS ux-review twin)
|
|
72
|
+
|
|
73
|
+
Phase-internal scaffolding (lives in `docs/plans/phase1-scratch/` after Gate 1, never read by P3+):
|
|
74
|
+
- `idea-draft.md`, `feature-intel.md`, `tech-feasibility.md`, `ux-research.md`, `business-model.md`, `findings-digest.md`, `suggested-questions.md`, `user-decisions.md`, `prereqs.json`
|
|
75
|
+
|
|
76
|
+
Phase 4 implementers never reference Phase 1 raw research files. They are SPENT after the Product Spec step (Step 1.6). The product spec is the LAST consumer of raw research. After Step 1.6, research insights survive in `product-spec.md`, `design-doc.md`, and `CLAUDE.md`.
|
|
77
|
+
</HARD-GATE>
|
|
78
|
+
|
|
79
|
+
> **Default-deny (Stage 2+):** Once Stage 2 of the SDK migration activates, any `Write|Edit` tool call targeting a path absent from this table will be denied by the `PreToolUse` hook with message `"path not in writer-owner table — please add to phase-graph.yaml or route through scribe MCP"`. This is a pre-announcement; actual hook wiring ships in Task 2.1.3.
|
|
80
|
+
|
|
81
|
+
<HARD-GATE>
|
|
82
|
+
CONTEXT HEADER — RENDER ONCE, HOIST AS STABLE PREFIX.
|
|
83
|
+
|
|
84
|
+
Every phase uses a CONTEXT header prepended to dispatch prompts. The orchestrator MUST render this header ONCE at the start of each phase by reading `.build-state.json` (and `DESIGN.md` `## Overview > ### Brand DNA` for web, Phase 4+) and resolving all values into concrete strings. The rendered header is then reused verbatim for every dispatch in that phase.
|
|
85
|
+
|
|
86
|
+
DO NOT paste `{read from .build-state.json}` placeholders into dispatch prompts. DO NOT re-read state files per dispatch. The values do not change within a phase.
|
|
87
|
+
|
|
88
|
+
**Canonical template** (orchestrator resolves before first dispatch of each phase):
|
|
89
|
+
```
|
|
90
|
+
CONTEXT:
|
|
91
|
+
project_type: <resolved value>
|
|
92
|
+
phase: <current phase number>
|
|
93
|
+
dna: <resolved from DESIGN.md `## Overview > ### Brand DNA` (7 axis values only, ~100 tokens) — INCLUDE only if project_type=web AND phase >= 4>
|
|
94
|
+
ios_features: <resolved from .build-state.json — INCLUDE only if project_type=ios>
|
|
95
|
+
|
|
96
|
+
TASK:
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Rendering procedure** (run once per phase boundary):
|
|
100
|
+
1. Read `docs/plans/.build-state.json`. Extract `project_type`, `ios_features`.
|
|
101
|
+
2. If `project_type=web` AND phase >= 4: read `DESIGN.md` and extract the DNA summary (first 5 lines or the `## Summary` section). Otherwise omit the `dna` field.
|
|
102
|
+
3. If `project_type=ios`: include `ios_features`. Otherwise omit.
|
|
103
|
+
4. Substitute all values into the template above. Store the result as `rendered_context_header`.
|
|
104
|
+
5. For every dispatch in this phase, prepend `rendered_context_header` — do NOT re-read or re-interpolate.
|
|
105
|
+
|
|
106
|
+
This keeps the prefix stable across parallel batches (enabling KV-cache reuse) and eliminates redundant state-file reads (~300K–1M tokens saved per build).
|
|
107
|
+
</HARD-GATE>
|
|
108
|
+
|
|
109
|
+
## SSOT Rule (machine-readable form is authoritative)
|
|
110
|
+
|
|
111
|
+
For every HARD-GATE promoted to code in Stages 2–5, the machine-readable form (`phase-graph.yaml`, `decisions.schema.json`, `state-schema.md`) is AUTHORITATIVE at runtime. Prose in `commands/build.md` and `protocols/*.md` is a narrative view of the machine-readable form. Prose edits without corresponding machine-readable edits are build-breaking PRs enforced by `eval/lint_phase_graph.py` in CI.
|
|
112
|
+
|
|
19
113
|
### Orchestrator Discipline
|
|
20
114
|
|
|
21
115
|
Your context window is precious. Protect it.
|
|
22
116
|
|
|
23
|
-
**You are a DISPATCHER, not a DOER.** Your job is: read state → decide next step → compose agent prompt → dispatch → process
|
|
117
|
+
**You are a DISPATCHER, not a DOER.** Your job is: read state → decide next step → compose agent prompt → dispatch → process compact return → decide next step.
|
|
24
118
|
|
|
25
119
|
**Two types of agents — handle their results differently:**
|
|
26
120
|
|
|
27
121
|
| Agent Type | Examples | What you keep |
|
|
28
122
|
|-----------|----------|---------------|
|
|
29
|
-
| **Research/analysis** |
|
|
30
|
-
| **Implementation** | Code writing, fixes, cleanup, verification, scaffolding | **Summary only** — their work product lives in the codebase. Keep: what was done, files changed, test results, pass/fail. Discard: code snippets, full build logs
|
|
31
|
-
|
|
32
|
-
**After implementation agents return:**
|
|
33
|
-
1. Extract: what was built, files changed, test pass/fail, any blockers
|
|
34
|
-
2. Record in `docs/plans/.build-state.md` under the current phase
|
|
35
|
-
3. The code is in the repo — you don't need it in your context
|
|
36
|
-
|
|
37
|
-
**After research/analysis agents return:**
|
|
38
|
-
1. Read and use the full output — this is your decision-making input
|
|
39
|
-
2. Save the output to the appropriate file in `docs/plans/` (research brief, architecture doc, etc.)
|
|
40
|
-
3. Once saved to disk, you can reference the file later instead of holding it all in context
|
|
123
|
+
| **Research/analysis** | Architecture design, audits, measurement, chapter verdicts | **Compact return only** — save full output to `docs/plans/`, keep the filename + headline verdict in context. Phase 1 research goes through the Research Synthesizer — the orchestrator never reads raw research. |
|
|
124
|
+
| **Implementation** | Code writing, fixes, cleanup, verification, scaffolding | **Summary only** — their work product lives in the codebase. Keep: what was done, files changed, test results, pass/fail. Discard: code snippets, full build logs. |
|
|
41
125
|
|
|
42
126
|
**Never do these yourself:**
|
|
43
|
-
- Read source code files to understand implementation details — spawn an
|
|
127
|
+
- Read source code files to understand implementation details — spawn an INTERNAL inline exploration agent (see Step 2.1)
|
|
44
128
|
- Write or edit code — spawn an implementation agent
|
|
45
129
|
- Debug failures — spawn a fix agent with the error message
|
|
130
|
+
- Read raw Phase 1 research files — the Research Synthesizer (Step 1.2) reads them; you only read the digest
|
|
46
131
|
|
|
47
132
|
If you catch yourself typing code or reading source files: STOP. You are wasting context. Spawn an agent.
|
|
48
133
|
|
|
49
|
-
**Dispatch Counter:** Track agent dispatches in `docs/plans/.build-state.
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
Increment after each agent returns (parallel dispatch of
|
|
134
|
+
**Dispatch Counter:** Track agent dispatches in `docs/plans/.build-state.json` (source of truth) under the `dispatch_count` and `last_save_phase` fields:
|
|
135
|
+
- `dispatch_count: [N]`
|
|
136
|
+
- `last_save_phase: [Phase.Step]`
|
|
137
|
+
Increment after each agent returns (parallel dispatch of 6 agents = +6). Reset to 0 after each compaction save. The rendered markdown view (`.build-state.md`) is regenerated from the JSON on every update — never edit the markdown directly.
|
|
138
|
+
|
|
139
|
+
**Compaction checkpoint format:** At every phase boundary, check `dispatch_count` in `docs/plans/.build-state.json`. If >= 8: save ALL state (current phase, task statuses, metric loop scores, decisions) to `docs/plans/.build-state.json` and regenerate `.build-state.md` as the rendered view. Reset `dispatch_count` to 0. TodoWrite does NOT survive compaction — rebuild it from the JSON state file on resume. See `protocols/state-schema.md` for the full schema and rendering contract.
|
|
53
140
|
|
|
54
|
-
|
|
141
|
+
Phase 4 context pressure: With 20+ tasks, compact returns accumulate ~30-40K tokens in the orchestrator's context. The compaction checkpoint (dispatch_count >= 8) is the primary relief valve. If Phase 4 has more than 15 tasks, force a compaction checkpoint after every wave transition regardless of dispatch_count.
|
|
142
|
+
|
|
143
|
+
**Cumulative-cost banner at phase boundaries:** When announcing a phase transition (e.g. "Phase N complete — proceeding to Phase N+1"), prefix the message with `[Cost so far: $X.XX • Y tokens]`. Source the values from the last-appended entry in `docs/plans/build-log.md`'s token-accounting lines (fields `cumulative_usd=...` plus the sum of `input_tokens=...` + `output_tokens=...`), written by `src/orchestrator/hooks/token-accounting.ts` (see module for exact schema). If the build-log has no token-accounting entries yet, omit the prefix rather than guessing.
|
|
55
144
|
|
|
56
145
|
Input: $ARGUMENTS
|
|
57
146
|
|
|
@@ -59,41 +148,52 @@ Input: $ARGUMENTS
|
|
|
59
148
|
|
|
60
149
|
If the input contains `--autonomous` or `--auto`, this build runs **unattended**. The user will not be present to approve quality gates. In autonomous mode:
|
|
61
150
|
- Quality gates auto-approve. Do NOT pause and wait for user input.
|
|
62
|
-
- Brainstorming runs in autonomous mode (
|
|
151
|
+
- Brainstorming runs in autonomous mode (Brainstorm Facilitator synthesizes directly from build request + available context).
|
|
63
152
|
- Metric loops that stall accept at >= 60% of target, skip below that.
|
|
64
|
-
- Log every decision to `docs/plans/build-log.md` so the user can review later.
|
|
65
153
|
|
|
66
154
|
If `--autonomous` is NOT present, all quality gates require user approval as described below.
|
|
67
155
|
|
|
68
156
|
When combining `--resume` with `--autonomous`: the current invocation's flags take precedence over saved state. If you resume a previously interactive build with `--autonomous`, it continues in autonomous mode.
|
|
69
157
|
|
|
70
|
-
###
|
|
158
|
+
### Always-On Build Log
|
|
159
|
+
|
|
160
|
+
`docs/plans/build-log.md` is written in **BOTH interactive and autonomous mode**. Every phase transition writes a one-line entry with the shape: `{timestamp, phase, step, action, outcome}`. Append to this file at EVERY phase boundary, EVERY LRR chapter dispatch, EVERY metric-loop iteration, and EVERY quality gate decision. In autonomous mode, ALSO log every auto-approval decision here so the user can review later.
|
|
71
161
|
|
|
72
|
-
|
|
162
|
+
### Metric Loop (callable service)
|
|
73
163
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
164
|
+
Every phase can invoke the **metric-driven iteration loop** as a service to drive quality. Read the full protocol at `protocols/metric-loop.md`. Called by Phase 3 (Design Critic loop), Phase 4 (per-task quality), Phase 5 (metric fix loop on failing audits), Phase 7 (documentation quality). Critical rules (survive compaction):
|
|
165
|
+
|
|
166
|
+
1. YOU define a metric for this phase based on context. The metric is NOT predefined.
|
|
167
|
+
2. Spawn a **measurement/critic agent** to score the artifact 0-100. Read its compact return.
|
|
168
|
+
3. Pick the ONE highest-impact issue. Spawn a separate **fix/generator agent** with ONLY that issue + file paths.
|
|
77
169
|
4. Re-measure. Repeat until: target met, stalled (2 consecutive delta <= 0), or max iterations.
|
|
78
|
-
5. Track all scores in `docs/plans/.build-state.
|
|
170
|
+
5. Track all scores in `docs/plans/.build-state.json` — this is your lifeline across compaction.
|
|
79
171
|
|
|
80
172
|
<HARD-GATE>
|
|
81
173
|
METRIC LOOP NON-NEGOTIABLES:
|
|
82
|
-
- Measurement agent and fix agent are SEPARATE Agent tool calls — never share context (author-bias elimination).
|
|
174
|
+
- Measurement/critic agent and fix/generator agent are SEPARATE Agent tool calls — never share context (author-bias elimination).
|
|
83
175
|
- Fix agent gets ONLY the top issue + file paths + acceptance criteria. NOT the full measurement findings.
|
|
84
176
|
- One fix per iteration. Measure impact before fixing the next thing.
|
|
85
177
|
- Each measurement is fresh — don't accumulate findings across iterations.
|
|
86
178
|
</HARD-GATE>
|
|
87
179
|
|
|
88
|
-
###
|
|
180
|
+
### Verify Protocol (callable service)
|
|
181
|
+
|
|
182
|
+
The 7-check verification gate is called by Phase 2 (architecture check), Phase 4 (per task), Phase 5 (audit), and Phase 7 (pre-ship). Full protocol at `protocols/verify.md`. Phase-internal — dispatched as INTERNAL inline role-string "Verify scaffolding" with agent running 7 checks sequentially: Build → Type-Check → Lint → Test → Security → Diff Review → Artifacts.
|
|
183
|
+
|
|
184
|
+
### Decision Log (callable service)
|
|
185
|
+
|
|
186
|
+
`docs/plans/decisions.jsonl` — append-only, ORCHESTRATOR-SCRIBE ONLY via the `scribe_decision` MCP tool. Subagents return `deviation_row` objects in their structured result; the orchestrator forwards each row through `scribe_decision`, which allocates `D-{phase}-<seq>` IDs and atomically appends. The orchestrator MUST NOT Write or Edit this file directly. Row-producing phases: Phase 1 synthesis (3 rows), Phase 2 architecture synthesis (4 rows), Phase 4 implementers (only on deviation). Readers: Phase 0 resume handler, Phase 5 Reality Checker, Phase 6 LRR Aggregator (the ⭐⭐ backward-routing read). Schema at `protocols/decision-log.md`. Dispatch flow: see Phase 4 "Orchestrator-scribe dispatch" section.
|
|
187
|
+
|
|
188
|
+
### Learnings (callable service)
|
|
89
189
|
|
|
90
|
-
|
|
190
|
+
`docs/plans/learnings.jsonl` — append-only cross-run learnings store. Writers: Phase 5 reality sweep, Phase 7. Readers: Phase 0 Learnings Loader (Step 0.1d) and Phase 5 reality sweep.
|
|
91
191
|
|
|
92
|
-
|
|
93
|
-
2. **Previous agent's output** — what the upstream agent produced (if any)
|
|
94
|
-
3. **Acceptance criteria** — what "done" looks like for THIS agent
|
|
192
|
+
### Refs-Not-Pastes Rule
|
|
95
193
|
|
|
96
|
-
For
|
|
194
|
+
For Phase 3+ agents, the orchestrator passes REFS to live downstream docs (`design-doc.md`, `architecture.md`, `DESIGN.md`, `sprint-tasks.md`, `quality-targets.json`, `decisions.jsonl`) — NOT pasted content. The orchestrator reads `docs/plans/refs.json` (produced by the Phase 2 Refs Indexer), resolves the task topic against the flat anchor index, and passes a short ref list to the agent. The agent uses the Read tool to pull refs it needs. This keeps orchestrator context lean and lets the agent widen its view on demand. Phase 1-2 agents still receive full documents because the architecture anchors don't exist yet.
|
|
195
|
+
|
|
196
|
+
**refs.json mutation invalidates sprint-context hash (Stage 6 / task 6.3.2).** Any orchestrator update to `docs/plans/refs.json` (Phase 2 Refs Indexer initial write, Phase 3 extension after `DESIGN.md` lands, or any subsequent correction) MUST be IMMEDIATELY followed by a `state_save` call that sets `.build-state.json.current_sprint_context_hash = null`. This invalidates the cached Phase 4 sprint-scoped shared-context block so the next subagent dispatch re-renders with fresh references. See `src/orchestrator/phase4-shared-context.ts#shouldInvalidate` for how the hash is consulted at render time. Skipping this invalidation causes Phase 4 implementers to read stale anchor indices — a silent correctness failure.
|
|
97
197
|
|
|
98
198
|
### Complexity Routing (Advisory)
|
|
99
199
|
|
|
@@ -101,39 +201,70 @@ Tag agent prompts with `[COMPLEXITY: S/M/L]` based on task size from `docs/plans
|
|
|
101
201
|
|
|
102
202
|
### Mode-Specific Tool Stacks
|
|
103
203
|
|
|
104
|
-
Mode-specific tool stacks, per-phase branches, and persona rules
|
|
204
|
+
Mode-specific tool stacks, per-phase branches, and persona rules live in separate files. Load ONE based on `project_type`:
|
|
105
205
|
- iOS: `protocols/ios-phase-branches.md` (includes iOS Mode Tool Stack)
|
|
106
206
|
- Web: `protocols/web-phase-branches.md` (web defaults)
|
|
107
207
|
|
|
208
|
+
### Backward Edges — Routing Fix
|
|
209
|
+
|
|
210
|
+
When a later phase finds a problem whose root cause lives earlier, control flows BACKWARD to the authoring phase. The orchestrator codifies these edges so problems are fixed where they were introduced, not patched locally.
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
PROBLEM FOUND AT ROUTES BACK TO
|
|
214
|
+
──────────────────────────────────────────────────────────────────────────────────
|
|
215
|
+
Gate 1 (human says "no") → Phase 1 Step 1.0 with feedback
|
|
216
|
+
Gate 2 (human says "no") → Phase 2 with feedback
|
|
217
|
+
phase-3.step-3.2b-DNA-persona-mismatch → phase-3.step-3.0
|
|
218
|
+
Phase 5 Audit (code issue) → Phase 4 target task
|
|
219
|
+
Phase 5 Audit (design issue) → Phase 3 target step
|
|
220
|
+
Phase 5 Audit (spec issue) → phase-2
|
|
221
|
+
phase-5-dogfood-classified → target_phase-per-classified-findings.json
|
|
222
|
+
phase-5-dogfood-feedback-synthesizer → phase-4.target-task
|
|
223
|
+
Phase 6 LRR BLOCK (⭐⭐) → authoring-phase (per decisions.jsonl.decided_by)
|
|
224
|
+
LRR-BLOCK-decided_by==architect → phase-2
|
|
225
|
+
LRR-BLOCK-decided_by==design-brand-guardian-or-phase-3-writer → phase-3
|
|
226
|
+
Phase 6 LRR NEEDS_WORK (code) → Phase 4 target feature (via BO re-planning)
|
|
227
|
+
LRR-NEEDS_WORK-code-level → phase-4.target-task
|
|
228
|
+
phase-6-LRR-NEEDS_WORK-structural → phase-2-or-phase-3
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The ⭐⭐ star rule: when the LRR Aggregator receives a BLOCK verdict, it reads the `related_decision_id` on the blocker, looks up that row in `decisions.jsonl`, finds which phase authored the decision (the `decided_by` field), and re-opens that phase with the finding as input. Infrastructure already exists (decision IDs, author tracking) — wired here.
|
|
232
|
+
|
|
233
|
+
**Re-entry halt rule (Stage 4 A7).** Before dispatching any backward routing (LRR BLOCK to Phase N re-open, Reality Checker BLOCK to Phase M re-entry, Gate "no" to Phase 1/2 re-entry, etc.), check `.build-state.json.backward_routing_count` AND the per-target-phase variant `.build-state.json.backward_routing_count_by_target_phase[<N>]`. If the new (post-increment) value of EITHER counter for the target phase would exceed `max_cycles` (currently 2, from `phase-graph.yaml:routing.max_cycles`) — i.e., on the attempted third backward iteration — the orchestrator MUST halt and escalate to the user instead of dispatching. The Stage 4 `cycle_counter_check` MCP is the authoritative enforcer at runtime — it increments atomically and returns `escalate_to_user` once the new value exceeds `max_cycles`. This prose documents the behavior for the markdown-mode rollback path and for human readers.
|
|
234
|
+
|
|
235
|
+
**Phase-entry `in_flight_backward_edge` clear (Stage 4 A3 / task 4.3.3).** On the FIRST `state_save` after any phase entry — whether forward progression or backward-edge re-entry — the orchestrator MUST explicitly set `.build-state.json.in_flight_backward_edge = null`. This is the "successful landing" signal that closes the atomic crash-seam opened by `cycle_counter_check` (which writes `in_flight_backward_edge` in the same atomic state_save that increments the counter). If the runtime crashes between edge dispatch and landing, `--resume` in `bin/buildanything-runtime.ts` observes a stale `in_flight_backward_edge` (age > 60s) and decrements the counter (see task 4.3.4). See `src/orchestrator/mcp/cycle-counter.ts#clearInFlightEdge` for the runtime primitive.
|
|
236
|
+
|
|
108
237
|
---
|
|
109
238
|
|
|
110
|
-
## Phase 0:
|
|
239
|
+
## Phase 0: Pre-flight (state read only)
|
|
240
|
+
|
|
241
|
+
Phase 0 is thin. No agent dispatch. No human input. Instant. The orchestrator reads state files and applies universal checks.
|
|
111
242
|
|
|
112
243
|
**Resuming?** If the input contains `--resume` OR if context was just compacted (SessionStart hook fired with active state):
|
|
113
|
-
1. Read `docs/plans/.build-state.
|
|
114
|
-
If
|
|
244
|
+
1. Read `docs/plans/.build-state.json` (source of truth) — verify it exists and has a `resume_point` field. Fall back to reading `docs/plans/.build-state.md` (rendered view) if the JSON file is missing but the markdown exists (graceful migration path from pre-W1-2 builds).
|
|
245
|
+
If neither exists, OR neither has a Resume Point, warn the user: 'No previous build state found. Starting fresh.' Then proceed to Step 0.1 as a new build.
|
|
115
246
|
2. Re-read this file and all protocol files in `protocols/`.
|
|
116
|
-
3. Re-read `docs/plans/sprint-tasks.md`, `docs/plans/architecture.md`,
|
|
117
|
-
4.
|
|
118
|
-
5.
|
|
119
|
-
6.
|
|
247
|
+
3. Re-read live downstream docs: `docs/plans/sprint-tasks.md`, `docs/plans/architecture.md`, `docs/plans/design-doc.md`, `DESIGN.md` (if exists), `CLAUDE.md`.
|
|
248
|
+
4. Read `docs/plans/decisions.jsonl` if it exists (top 5 most recent rows, filtered to the current phase and upstream phases). Pass short row fields + `ref` anchors into Phase 0 rehydration context — not the full row prose. See `protocols/decision-log.md`.
|
|
249
|
+
5. Rebuild TodoWrite from the state file (TodoWrite does NOT survive compaction or session breaks).
|
|
250
|
+
6. Reset `dispatches_since_save` to 0 (fresh context window).
|
|
251
|
+
7. Resume from the saved phase and step. Skip Phase 0.
|
|
120
252
|
|
|
121
253
|
### Step 0.1 — Read the Room
|
|
122
254
|
|
|
123
|
-
|
|
255
|
+
Scan for existing context:
|
|
124
256
|
|
|
125
257
|
- Check if the input is a file path (e.g., `docs/plans/brainstorm.md`). If so, read it.
|
|
126
258
|
- Check if `docs/plans/` or `docs/briefs/` exist with prior brainstorming, design docs, decision briefs, or research. Read them.
|
|
127
259
|
- Check if there's existing code in the project. If so, this is an enhancement, not greenfield.
|
|
128
260
|
- Check the conversation history — has the user been discussing this idea already?
|
|
129
|
-
- Check if `docs/plans/learnings.md` exists from a previous build. If so, read it. Apply relevant PATTERNS to agent prompt design, avoid listed PITFALLs, use HEURISTICS when applicable.
|
|
130
261
|
|
|
131
262
|
**Classify what you found:**
|
|
132
263
|
|
|
133
264
|
| Context Level | What You Have | What Happens |
|
|
134
265
|
|---|---|---|
|
|
135
266
|
| **Full design** | Design doc with decisions, scope, tech stack, data models | Skip Phase 1. Feed design into Phase 2. |
|
|
136
|
-
| **Decision brief** | An idea-sweep brief with verdicts and
|
|
267
|
+
| **Decision brief** | An idea-sweep brief with verdicts and product definition | Phase 1 skips Step 1.1 research (already done). Brainstorming refines the brief into a design. |
|
|
137
268
|
| **Partial context** | Some notes, conversation, rough sketch | Phase 1 runs fully. Feed context into brainstorming + research. |
|
|
138
269
|
| **Raw idea** | One-line build request, no prior work | Phase 1 runs fully from scratch. |
|
|
139
270
|
|
|
@@ -141,430 +272,1028 @@ Before doing anything, scan for existing context:
|
|
|
141
272
|
|
|
142
273
|
Scan the build request AND any context from Step 0.1 for iOS signals. Keywords: **iOS, iPhone, iPad, SwiftUI, Swift, App Store, TestFlight, Xcode, Apple, Liquid Glass, watchOS, visionOS, SwiftData, HIG**.
|
|
143
274
|
|
|
144
|
-
|
|
275
|
+
To avoid false positives (e.g., a web app mentioning "Apple Pay" or "Sign in with Apple"), require at least 2 iOS keywords OR 1 keyword + existing Swift/Xcode files before triggering the iOS confirmation prompt.
|
|
145
276
|
|
|
146
277
|
| Signal | Action |
|
|
147
278
|
|---|---|
|
|
148
279
|
| iOS keywords present in prompt | Confirm with user: "This looks like an iOS app — confirm? [y/n]" |
|
|
149
|
-
| User confirms OR says iOS during brainstorming | Set `project_type: ios` in `docs/plans/.build-state.
|
|
280
|
+
| User confirms OR says iOS during brainstorming | Set `project_type: ios` in `docs/plans/.build-state.json` (regenerate markdown view) |
|
|
150
281
|
| `.xcodeproj` / `Package.swift` / `*.swift` files in existing codebase | Set `project_type: ios` automatically |
|
|
151
|
-
| No iOS signals, no Swift files | Default `project_type: web`
|
|
282
|
+
| No iOS signals, no Swift files | Default `project_type: web` |
|
|
152
283
|
|
|
153
284
|
**Autonomous mode:** skip the confirmation prompt. If iOS keywords are present, set `project_type: ios` and log the inference to `docs/plans/build-log.md`.
|
|
154
285
|
|
|
155
286
|
**Conditional branch-file load:**
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
- Load only ONE branch file.
|
|
159
|
-
|
|
160
|
-
Record the classification in `docs/plans/.build-state.md` as a top-level field: `project_type: ios` or `project_type: web`. This field survives compaction and gates every branching block below.
|
|
287
|
+
- `project_type=ios`: load `protocols/ios-phase-branches.md` AND `protocols/ios-context.md`. Reference `protocols/ios-frameworks-map.md` by path only.
|
|
288
|
+
- `project_type=web`: load `protocols/web-phase-branches.md`.
|
|
289
|
+
- Load only ONE branch file.
|
|
161
290
|
|
|
162
|
-
|
|
291
|
+
Record the classification in `docs/plans/.build-state.json` as the top-level `project_type` field. Regenerate `.build-state.md` after the write. This field survives compaction and gates every branching block below.
|
|
163
292
|
|
|
164
|
-
|
|
293
|
+
**Mode-specific additions to Phase 0:** See `protocols/ios-phase-branches.md` §Phase 0 additions (iOS only).
|
|
165
294
|
|
|
166
|
-
|
|
295
|
+
### Step 0.1d — Learnings Loader (PITFALL replay)
|
|
167
296
|
|
|
168
|
-
-
|
|
169
|
-
- **Database setup** — Supabase, Postgres, etc. User needs to create it and provide credentials.
|
|
170
|
-
- **Repository** — Git repo on GitHub? Public or private?
|
|
171
|
-
- **Deployment** — Vercel, Railway, Fly.io? User needs to connect.
|
|
172
|
-
- **MCP servers** — Playwright for visual testing, database access, etc.
|
|
173
|
-
- **Local tooling** — Docker, specific runtimes, etc.
|
|
297
|
+
Read `docs/plans/learnings.jsonl` (cross-run learnings store). If the project-local file does not exist, fall back to `~/.claude/buildanything/learnings.jsonl`. If neither exists, proceed with an empty active-learnings file and skip the rest of this step.
|
|
174
298
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
299
|
+
If a learnings file exists:
|
|
300
|
+
1. Parse each line as a JSON row with the schema written at Phase 5 reality sweep: `{run_id, timestamp, project_type, phase_where_learning_surfaced, metric, top_issue, fix_applied, score_delta, pattern_type}`.
|
|
301
|
+
2. Filter entries where `project_type` matches the current build's classification.
|
|
302
|
+
3. Rank the filtered entries by composite score: prefer entries matching expected `pattern_type` (PITFALL > PATTERN > HEURISTIC), then by `phase_where_learning_surfaced` (earlier phases first), then by `score_delta` magnitude.
|
|
303
|
+
4. Select the top 3 most relevant entries.
|
|
304
|
+
5. Write them to `docs/plans/.active-learnings.md` as a short markdown section downstream agents inject into their prompts. Format:
|
|
179
305
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
[ ] GitHub repo → share the URL
|
|
183
|
-
[ ] [Deployment service] connected (optional)
|
|
306
|
+
```markdown
|
|
307
|
+
## Prior Learnings (top 3 relevant)
|
|
184
308
|
|
|
185
|
-
|
|
309
|
+
- **PITFALL (phase 4.x, iOS):** [top_issue] — fix: [fix_applied]
|
|
310
|
+
- **PATTERN (phase 5.x, web):** [top_issue] — fix: [fix_applied]
|
|
311
|
+
- **HEURISTIC (phase 4.x, iOS):** [top_issue] — fix: [fix_applied]
|
|
186
312
|
```
|
|
187
313
|
|
|
188
|
-
|
|
189
|
-
Interactive mode: DO NOT proceed until the user confirms prerequisites (or says to skip).
|
|
190
|
-
Autonomous mode: Log checklist to `docs/plans/build-log.md`. Create `.env.example` with required keys. Proceed — log missing keys as blockers if hit during build.
|
|
191
|
-
</HARD-GATE>
|
|
314
|
+
Phase 4 implementer dispatch reads `.active-learnings.md` and injects its contents into every implementer prompt under a `## Prior Learnings` section. This is how learnings from build N flow into build N+1.
|
|
192
315
|
|
|
193
|
-
### Step 0.
|
|
316
|
+
### Step 0.2 — Initialize
|
|
194
317
|
|
|
195
318
|
0. Create `docs/plans/` directory if it doesn't exist (greenfield projects won't have it).
|
|
196
319
|
1. Create a TodoWrite checklist with Phases 0-7.
|
|
197
|
-
2.
|
|
320
|
+
2. Write `docs/plans/.build-state.json` per the schema in `protocols/state-schema.md`. Required top-level fields: `project_type`, `phase`, `step`, `input`, `context_level`, `prerequisites`, `dispatch_count`, `last_save_phase`, `autonomous`, `session_id`, `session_started`, `completed_tasks[]`, `metric_loop_scores[]`, `decisions_next_id` (object keyed by phase number — see Phase 4 orchestrator-scribe handler), `resume_point { phase, step, completed_tasks, git_branch }`, `backward_routing_count_by_target_phase` (object), `feature_delegation_plan_path`, `current_wave`, `completed_features[]`, `feature_acceptance{}`, `feature_briefs{}`. See `protocols/state-schema.md` for the complete and authoritative field list. This inline list is a summary. Then regenerate `docs/plans/.build-state.md` from the JSON as a **read-only rendered view**.
|
|
198
321
|
3. Go to Phase 1 (or Phase 2 if context level is "Full design").
|
|
199
322
|
|
|
323
|
+
**NO prereq collection in Phase 0.** Stack isn't decided yet. Prereqs move to Step 1.5, after Gate 1. Asking for creds before the stack is picked means asking for wrong creds or re-asking on rejection.
|
|
324
|
+
|
|
325
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
326
|
+
|
|
200
327
|
---
|
|
201
328
|
|
|
202
329
|
## Phase -1: iOS Bootstrap (iOS-only, greenfield only)
|
|
203
330
|
|
|
204
|
-
**If `project_type=ios` AND no `.xcodeproj` exists:** follow `protocols/ios-phase-branches.md` §Phase -1 — iOS Bootstrap. Otherwise skip entirely
|
|
331
|
+
**If `project_type=ios` AND no `.xcodeproj` exists:** follow `protocols/ios-phase-branches.md` §Phase -1 — iOS Bootstrap. Otherwise skip entirely.
|
|
332
|
+
|
|
333
|
+
iOS structural changes are out of scope for this orchestrator migration.
|
|
205
334
|
|
|
206
|
-
**Compaction checkpoint.** Update
|
|
335
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
207
336
|
|
|
208
337
|
---
|
|
209
338
|
|
|
210
|
-
## Phase 1:
|
|
339
|
+
## Phase 1: Discover — BRAINSTORM ↔ RESEARCH loop
|
|
211
340
|
|
|
212
|
-
**Goal**: Turn the raw idea into a validated Design Document grounded in research. This ensures Phase 2 architects receive a
|
|
341
|
+
**Goal**: Turn the raw idea into a validated Design Document (the PRD) grounded in research. This ensures Phase 2 architects receive a PRD, not a guess.
|
|
213
342
|
|
|
214
343
|
**Skip if** Step 0.1 classified context as "Full design" — go straight to Phase 2.
|
|
215
344
|
|
|
345
|
+
**Orchestrator discipline in Phase 1**: Dispatch → wait → read compact return → dispatch next. No synthesis. No reasoning. No raw artifact reads. Keep it thin. The Research Synthesizer (Step 1.2) is the only agent that reads raw research files.
|
|
346
|
+
|
|
216
347
|
**Mode-specific branch:**
|
|
217
|
-
-
|
|
218
|
-
-
|
|
348
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 1 (iOS skill bundle, ios-swift-architect, App Store/TestFlight/iOS 26 research angles).
|
|
349
|
+
- `project_type=web`: no additional branch instructions.
|
|
350
|
+
|
|
351
|
+
### Step 1.0 — INITIAL BRAINSTORM
|
|
219
352
|
|
|
220
|
-
|
|
353
|
+
Dispatch the Brainstorm Facilitator as an INTERNAL inline role-string — NO `subagent_type`. The facilitator drives a conversation to capture the raw idea: what it is, who it's for, what problem it solves, hard constraints.
|
|
221
354
|
|
|
222
|
-
|
|
355
|
+
Call the Agent tool — description: "Initial brainstorm" — INTERNAL inline role-string — prompt: "You are the Brainstorm Facilitator (round 1). Your job is to drive a conversation with the user to capture the raw idea. Ask questions one at a time in plain language. Topics to cover: WHAT is being built (product/feature), WHO it's for (persona), WHAT problem it solves, HARD CONSTRAINTS (budget, timeline, platform, integrations). Keep it to 4-8 questions. Write the raw idea to `docs/plans/phase1-scratch/idea-draft.md` with a header and a section per topic. Orchestrator relays your questions to the user and relays the user's answers back to you."
|
|
223
356
|
|
|
224
|
-
|
|
357
|
+
**Autonomous mode:** facilitator synthesizes directly from build request + available context without asking questions. Logs rationale to `docs/plans/build-log.md`.
|
|
225
358
|
|
|
226
|
-
|
|
359
|
+
**Returns:** `docs/plans/phase1-scratch/idea-draft.md`
|
|
227
360
|
|
|
228
|
-
### Step 1.
|
|
361
|
+
### Step 1.1 — RESEARCH (TEAM of 4 parallel agents, ONE message)
|
|
229
362
|
|
|
230
363
|
Skip if context level is "Decision brief" (research already done).
|
|
231
364
|
|
|
232
|
-
Call the Agent tool
|
|
365
|
+
Call the Agent tool 4 times in a single message. Each gets the build request + `docs/plans/phase1-scratch/idea-draft.md`. Each writes its own output file. Raw files are NOT read by the orchestrator in Step 1.2 — a separate Research Synthesizer reads them. They ARE routed by domain to Phase 2 architects (hybrid routing — see Phase 2 Step 2.2).
|
|
233
366
|
|
|
234
|
-
|
|
367
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 1 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 1 research prompt below.
|
|
235
368
|
|
|
236
|
-
|
|
369
|
+
1. Description: "Feature intel" — subagent_type: `feature-intel` — Prompt: "[CONTEXT header above] Extract competitor feature matrix for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Walk 5-10 rivals. Return must-haves (features present in >=80% of rivals — table stakes) + stand-outs (features unique to individual rivals — differentiation opportunities), sorted by competitor. Save to `docs/plans/phase1-scratch/feature-intel.md`."
|
|
237
370
|
|
|
238
|
-
|
|
371
|
+
2. Description: "Tech feasibility" — subagent_type: `tech-feasibility` — Prompt: "[CONTEXT header above] Evaluate hard technical problems (Solved/Hard/Unsolved), build-vs-buy decisions, stack validation for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Verify APIs and libraries from the draft exist and are maintained. Save to `docs/plans/phase1-scratch/tech-feasibility.md`. Report with a Technical Verdict."
|
|
239
372
|
|
|
240
|
-
|
|
373
|
+
3. Description: "UX research" — subagent_type: `design-ux-researcher` — Prompt: "[CONTEXT header above] Analyze target persona, jobs-to-be-done, current alternatives, and behavioral barriers for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Save to `docs/plans/phase1-scratch/ux-research.md`. Report with a User Verdict."
|
|
241
374
|
|
|
242
|
-
|
|
375
|
+
4. Description: "Business model" — subagent_type: `business-model` — Prompt: "[CONTEXT header above] Light-touch revenue/channels/unit-economics analysis for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Surface product-impact conclusions only — which features the business model requires, which channels gate the feature set. Do not write full financial modeling. Save to `docs/plans/phase1-scratch/business-model.md`."
|
|
243
376
|
|
|
244
|
-
|
|
377
|
+
### Step 1.2 — RESEARCH DIGEST (context protection)
|
|
245
378
|
|
|
246
|
-
|
|
379
|
+
Dispatch the Research Synthesizer as an INTERNAL inline role-string — NO `subagent_type`. The synthesizer reads all 4 raw research files IN ITS OWN context, synthesizes, and returns a compact digest + dynamic questions. The orchestrator never loads the raw files. Saves ~3-5K tokens of orchestrator context per build.
|
|
247
380
|
|
|
248
|
-
|
|
381
|
+
Call the Agent tool — description: "Research digest" — INTERNAL inline role-string — prompt: "You are the Research Synthesizer. Read these 4 raw research files with your own Read tool:
|
|
382
|
+
- `docs/plans/phase1-scratch/feature-intel.md`
|
|
383
|
+
- `docs/plans/phase1-scratch/tech-feasibility.md`
|
|
384
|
+
- `docs/plans/phase1-scratch/ux-research.md`
|
|
385
|
+
- `docs/plans/phase1-scratch/business-model.md`
|
|
249
386
|
|
|
250
|
-
|
|
251
|
-
-
|
|
252
|
-
-
|
|
253
|
-
-
|
|
387
|
+
Synthesize a compact findings digest (~500 words, no padding) covering:
|
|
388
|
+
- Feature landscape summary (must-haves, stand-outs, gaps)
|
|
389
|
+
- Technical verdict with hard-problem callouts
|
|
390
|
+
- Persona + JTBD highlights
|
|
391
|
+
- Business-model implications for product scope
|
|
254
392
|
|
|
255
|
-
|
|
393
|
+
Then generate a DYNAMIC list of 4-8 brainstorm questions tuned to what actually surfaced — not a fixed script. Example: if tech-feasibility found an unsolved problem, surface a scope question. If UX research says persona is time-poor, surface a flow-simplification question.
|
|
256
394
|
|
|
257
|
-
|
|
395
|
+
Write:
|
|
396
|
+
1. `docs/plans/phase1-scratch/findings-digest.md` (~500 words)
|
|
397
|
+
2. `docs/plans/phase1-scratch/suggested-questions.md` (4-8 dynamic questions)
|
|
258
398
|
|
|
259
|
-
|
|
399
|
+
Return a compact summary to the orchestrator. The orchestrator does NOT read the raw files."
|
|
260
400
|
|
|
261
|
-
|
|
262
|
-
CLAUDE.md must be under 200 lines. It is not a wiki, not a conventions doc, not a dump of everything you know. It is the minimum context an agent needs to make correct decisions about this specific product.
|
|
263
|
-
</HARD-GATE>
|
|
401
|
+
### Step 1.3 — INFORMED BRAINSTORM
|
|
264
402
|
|
|
265
|
-
|
|
403
|
+
Dispatch the Brainstorm Facilitator (round 2) as an INTERNAL inline role-string. This is a dynamic conversation — questions adapt to what research surfaced, not a fixed script. User makes product decisions WITH research in hand.
|
|
404
|
+
|
|
405
|
+
Call the Agent tool — description: "Informed brainstorm" — INTERNAL inline role-string — prompt: "You are the Brainstorm Facilitator (round 2). Read `docs/plans/phase1-scratch/findings-digest.md` + `docs/plans/phase1-scratch/suggested-questions.md` via the Read tool. Drive a DYNAMIC conversation with the user using those questions — adapt based on answers, don't run a fixed script. Topics to cover (wording is dynamic, tuned to what surfaced):
|
|
406
|
+
- Which must-have features to include vs. cut
|
|
407
|
+
- Which stand-out features for differentiation
|
|
408
|
+
- Any persona / JTBD adjustments
|
|
409
|
+
- Does business model suggest specific features (e.g., freemium needs a free tier UI)
|
|
410
|
+
|
|
411
|
+
Orchestrator relays your questions to the user and relays answers back. Write decisions to `docs/plans/phase1-scratch/user-decisions.md`."
|
|
412
|
+
|
|
413
|
+
**Autonomous mode:** facilitator picks pragmatic defaults from the digest without asking questions. Logs rationale to `docs/plans/build-log.md`.
|
|
414
|
+
|
|
415
|
+
### Step 1.4 — DESIGN DOC + CLAUDE.md
|
|
416
|
+
|
|
417
|
+
Dispatch the Design Doc Writer as an INTERNAL inline role-string. Writes TWO outputs. The design doc is explicitly named **THE PRD** — the authoritative product document read by every Phase 2-7 agent via `refs.json` anchors, no full pastes.
|
|
418
|
+
|
|
419
|
+
Call the Agent tool — description: "Design doc and CLAUDE.md" — INTERNAL inline role-string — prompt: "You are the Design Doc Writer. Read with your own Read tool:
|
|
420
|
+
- `docs/plans/phase1-scratch/idea-draft.md`
|
|
421
|
+
- `docs/plans/phase1-scratch/findings-digest.md`
|
|
422
|
+
- `docs/plans/phase1-scratch/user-decisions.md`
|
|
423
|
+
|
|
424
|
+
Write TWO outputs.
|
|
425
|
+
|
|
426
|
+
OUTPUT 1 — `docs/plans/design-doc.md` — **THE PRD** (authoritative product document). Header MUST begin with `# [Product Name] — PRD`. Structure:
|
|
427
|
+
- Product — what it is, core value prop, success criteria
|
|
428
|
+
- User — persona, JTBD, hard constraints
|
|
429
|
+
- Scope — Features in scope (must-haves + chosen stand-outs), explicit Out-of-Scope boundary
|
|
430
|
+
- Tech Stack — chosen stack with 1-line rationale
|
|
431
|
+
- Data Model — shape of core entities
|
|
432
|
+
- Decisions — links to `decisions.jsonl` rows
|
|
433
|
+
|
|
434
|
+
This doc is read by all Phase 2-7 agents via `refs.json` anchors. Section headers should be stable (don't rename them later) so anchors survive.
|
|
435
|
+
|
|
436
|
+
OUTPUT 2 — `CLAUDE.md` (project root, NOT `docs/plans/`). <200-line product brain, auto-loaded into every spawned subagent context by Claude Code. The orchestrator NEVER pastes it. Structure:
|
|
266
437
|
|
|
267
438
|
```
|
|
268
439
|
## Product
|
|
269
440
|
[1-3 sentences: what this is, core value prop, what success looks like]
|
|
270
441
|
|
|
271
442
|
## User
|
|
272
|
-
[Primary persona: who they are, what they care about, pain points,
|
|
273
|
-
technical sophistication. This drives every UX decision.]
|
|
443
|
+
[Primary persona: who they are, what they care about, pain points, technical sophistication]
|
|
274
444
|
|
|
275
445
|
## Tech Stack
|
|
276
|
-
[Stack choices with 1-line rationale for each
|
|
277
|
-
key libraries, deployment target.]
|
|
446
|
+
[Stack choices with 1-line rationale for each]
|
|
278
447
|
|
|
279
448
|
## Scope
|
|
280
|
-
[What's in
|
|
281
|
-
from building features that aren't scoped.]
|
|
449
|
+
[What's in scope vs. deferred. Hard boundaries.]
|
|
282
450
|
|
|
283
451
|
## Rules
|
|
284
|
-
[Project-specific hard rules derived from the product and user context.
|
|
285
|
-
Examples: "All data must be real-time — no simulated/fake data",
|
|
286
|
-
"User must be able to pause/stop any automated process at any time",
|
|
287
|
-
"Every interactive element must have visible feedback within 200ms".
|
|
288
|
-
Only include rules this specific project needs — not generic best practices.]
|
|
452
|
+
[Project-specific hard rules derived from the product and user context.]
|
|
289
453
|
```
|
|
290
454
|
|
|
291
|
-
|
|
455
|
+
<HARD-GATE>
|
|
456
|
+
CLAUDE.md must be under 200 lines. Not a wiki, not a conventions doc, not a dump of everything. Minimum context an agent needs to make correct decisions about this specific product.
|
|
457
|
+
</HARD-GATE>
|
|
458
|
+
|
|
459
|
+
Return 3 decision rows in your structured result under a `phase_1_decisions` field — one each for tech stack, data model, and scope boundary. Each row shape: `{phase: 1, author: \"architect\", type: \"tech-stack\" | \"data-model\" | \"scope-boundary\", summary, rationale, related_files: [\"docs/plans/design-doc.md\"]}`. The orchestrator forwards each row through the `scribe_decision` MCP tool (see Phase 4 "Orchestrator-scribe dispatch"). DO NOT write `decisions.jsonl` directly."
|
|
460
|
+
|
|
461
|
+
**Writes:** `docs/plans/design-doc.md` (PRD), `CLAUDE.md`. Decision rows flow through the orchestrator's `scribe_decision` MCP calls.
|
|
462
|
+
|
|
463
|
+
**Post-Step 1.4 — CLAUDE.md size enforcement (mechanical check):**
|
|
464
|
+
After the Design Doc Writer returns, run `wc -l < CLAUDE.md` and capture the line count. If the count exceeds 200 lines:
|
|
465
|
+
1. FAIL the step. Log to `docs/plans/build-log.md`: `"CLAUDE.md size violation: {count} lines (limit: 200)"`.
|
|
466
|
+
2. Re-dispatch the Design Doc Writer with this additional instruction prepended: `"CLAUDE.md EXCEEDED 200 LINES ({count} lines). Rewrite CLAUDE.md to ≤200 lines. Cut aggressively — keep only what a subagent needs to make correct product decisions. No conventions, no wiki content, no boilerplate."`.
|
|
467
|
+
3. Max 2 retries. If still over 200 after 2 retries, HARD-FAIL and surface to user: `"CLAUDE.md is {count} lines after 2 rewrites. Please manually trim to ≤200 lines before proceeding — this file is auto-loaded into every subagent and bloat here multiplies across all Phases 2-7 dispatches."`.
|
|
292
468
|
|
|
293
469
|
### Quality Gate 1
|
|
294
470
|
|
|
295
|
-
**
|
|
471
|
+
**Interactive:** Present Design Doc summary + Research Digest findings to user. Ask: "Approve this design, or adjust?"
|
|
296
472
|
|
|
297
|
-
|
|
473
|
+
<HARD-GATE>
|
|
474
|
+
Gate 1 rejection path is codified:
|
|
475
|
+
- On NO → loop back to Phase 1 Step 1.0 with user feedback passed back to Brainstorm Facilitator (round 1 re-invocation).
|
|
476
|
+
- On YES → proceed to Step 1.5.
|
|
477
|
+
- DO NOT PROCEED without user approval in interactive mode.
|
|
478
|
+
</HARD-GATE>
|
|
298
479
|
|
|
299
|
-
|
|
480
|
+
**Autonomous:** Log design-doc path + digest path to `docs/plans/build-log.md`. Auto-approve. Proceed.
|
|
300
481
|
|
|
301
|
-
|
|
482
|
+
Update TodoWrite and `.build-state.json`.
|
|
483
|
+
|
|
484
|
+
### Step 1.5 — PREREQ COLLECTOR (post-Gate 1)
|
|
485
|
+
|
|
486
|
+
Dispatch the Prereq Collector as an INTERNAL inline role-string. Reads `design-doc.md` to determine which credentials are actually needed for the chosen stack. Asks the user ONLY for stack-specific creds.
|
|
487
|
+
|
|
488
|
+
Call the Agent tool — description: "Prereq collection" — INTERNAL inline role-string — prompt: "You are the Prereq Collector. Read `docs/plans/design-doc.md` with your own Read tool — focus on the Tech Stack section. Determine which credentials the chosen stack actually needs (do NOT ask for a generic laundry list — ask ONLY for what this stack uses).
|
|
489
|
+
|
|
490
|
+
Example: 'You chose Next.js + Supabase + Vercel — I need your Supabase URL, Supabase anon key, and Vercel auth token.' Skip anything the stack doesn't use.
|
|
491
|
+
|
|
492
|
+
Output: `docs/plans/phase1-scratch/prereqs.json` with shape `{supabase_url, supabase_anon_key, ...}`. Ask the user once. If they don't have a credential, mark it as `null` and note in the JSON that Phase 4 will surface it as a blocker if hit."
|
|
493
|
+
|
|
494
|
+
**Autonomous mode:** Create `.env.example` with required keys. Proceed. Log missing keys as blockers if hit during build.
|
|
495
|
+
|
|
496
|
+
**Why here:** at Phase 0 we don't yet know the stack (it's decided in Step 1.3). Asking for creds before Gate 1 means asking for wrong creds or re-asking on rejection.
|
|
497
|
+
|
|
498
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
### Step 1.6 — PRODUCT SPEC
|
|
503
|
+
|
|
504
|
+
Call the Agent tool — description: "Product spec" — subagent_type: `product-spec-writer` — prompt: "[CONTEXT header above] Write `docs/plans/product-spec.md` following the structure in `protocols/product-spec-schema.md`. Read ALL of these via your Read tool before writing (do NOT expect pasted content):
|
|
505
|
+
- `docs/plans/design-doc.md` — PRD: features, persona, JTBD, value prop, scope, tech stack
|
|
506
|
+
- `docs/plans/phase1-scratch/findings-digest.md` — research synthesis
|
|
507
|
+
- `docs/plans/phase1-scratch/ux-research.md` — behavioral patterns, pain points
|
|
508
|
+
- `docs/plans/phase1-scratch/feature-intel.md` — competitive matrix, table-stakes vs differentiators
|
|
509
|
+
- `docs/plans/phase1-scratch/business-model.md` — revenue model implications
|
|
510
|
+
- `docs/plans/phase1-scratch/tech-feasibility.md` — technical constraints, rate limits, API limitations
|
|
511
|
+
- `docs/plans/phase1-scratch/user-decisions.md` — user's product decisions from informed brainstorm
|
|
512
|
+
This is the LAST step that reads raw research files. Every actionable insight must survive in product-spec.md in structured, queryable form. Commit: 'feat: product spec'."
|
|
513
|
+
|
|
514
|
+
#### Step 1.6.idx — Slice 1 graph index
|
|
515
|
+
|
|
516
|
+
After `product-spec-writer` returns and `docs/plans/product-spec.md` is on disk, index it into the build graph. Slice 1 graph index — required for downstream agents.
|
|
517
|
+
|
|
518
|
+
Run via the Bash tool:
|
|
519
|
+
|
|
520
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/product-spec.md`
|
|
521
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
522
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. Downstream agents (BO, PO, implementers) require the graph — do not proceed without a successful index.
|
|
523
|
+
|
|
524
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
302
525
|
|
|
303
526
|
---
|
|
304
527
|
|
|
305
|
-
## Phase 2:
|
|
528
|
+
## Phase 2: Plan / Architect — TEAM of 6 + sequence
|
|
306
529
|
|
|
307
|
-
**Goal**: Convert the
|
|
530
|
+
**Goal**: Convert the PRD into a concrete architecture and ordered task list with explicit dependencies. Every architect receives the PRD (design-doc.md) + the Research Digest + its domain's raw research file (hybrid routing).
|
|
308
531
|
|
|
309
532
|
**Mode-specific branch:**
|
|
310
|
-
-
|
|
311
|
-
-
|
|
533
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 2 (replaces Backend/Frontend dispatch with SwiftUI/SwiftData/Concurrency/iOS security; adds Feature Flag Resolution at end of phase).
|
|
534
|
+
- `project_type=web`: no additional branch instructions.
|
|
312
535
|
|
|
313
|
-
### Step 2.1 — Explore
|
|
536
|
+
### Step 2.1 — Explore existing codebase (only if existing code)
|
|
314
537
|
|
|
315
|
-
If existing code, call the Agent tool — description: "Explore codebase" — prompt: "Explore
|
|
538
|
+
If existing code, call the Agent tool — description: "Explore codebase" — INTERNAL inline role-string — prompt: "Explore existing codebase. Map architecture layers, file conventions, testing patterns, existing features, integration points. Return a compact summary suitable for architects to consume — not a full dump."
|
|
316
539
|
|
|
317
540
|
If greenfield, skip to Step 2.2.
|
|
318
541
|
|
|
319
|
-
### Step 2.2 — Architecture Design (
|
|
542
|
+
### Step 2.2 — Architecture Design (TEAM of 6 architects coordinating via SendMessage)
|
|
543
|
+
|
|
544
|
+
The 6 architects design as a TEAM — not 6 isolated subagents. Cross-domain contract boundaries (Backend↔Frontend on API shape, Security↔Backend on auth, A11y↔Frontend on component patterns, Performance↔Backend+Data on query shapes) are caught at design time via peer SendMessage, not absorbed silently by a downstream stitcher.
|
|
545
|
+
|
|
546
|
+
**On re-entry from LRR backward routing:** If Phase 2 is being re-opened via the re-entry dispatch template (Step 6.3), skip team creation if the original `phase-2-architects` team is still live from this build; otherwise recreate it. Pass the re-entry payload (`{blocking_finding, prior_output: "docs/plans/architecture.md", decision_row}`) into the dispatch prompt of the architect(s) whose domain matches `decision_row.author` — only those architects re-run, not all 6. The re-dispatched architect revises its `docs/plans/phase-2-contracts/<name>.md` in place, SendMessages peers on any contract boundary it now changes, and the synthesizer re-runs once to re-stitch `architecture.md`. Do NOT redo unaffected domains.
|
|
547
|
+
|
|
548
|
+
After the synthesizer re-stitches `architecture.md`, re-run the Refs Indexer (Step 2.3 dispatch #4) to update `docs/plans/refs.json` with fresh anchors, and re-run the DAG Validator (Step 2.3 dispatch #3) to verify sprint-tasks.md still references valid architecture sections. Invalidate the sprint-context hash per the refs.json mutation rule.
|
|
549
|
+
|
|
550
|
+
**Step 2.2a — Create the team.**
|
|
551
|
+
|
|
552
|
+
Call `TeamCreate` with `team_name: "phase-2-architects"`. This team scopes the SendMessage channel for the 6 architects below. Capture the team id in `.build-state.json` for teardown.
|
|
553
|
+
|
|
554
|
+
**Step 2.2b — Dispatch 6 architects as teammates (ONE message).**
|
|
555
|
+
|
|
556
|
+
Call the Agent tool 6 times in a single message. Each call passes `team_name: "phase-2-architects"` and a unique `name` (listed below). Each architect receives: `docs/plans/design-doc.md` (PRD) + `docs/plans/phase1-scratch/findings-digest.md` + ITS DOMAIN'S RAW RESEARCH FILE (hybrid routing) + the team roster + cross-check pairings + the per-architect output file path.
|
|
557
|
+
|
|
558
|
+
Shared brief appended to every architect prompt:
|
|
559
|
+
|
|
560
|
+
```
|
|
561
|
+
TEAM: phase-2-architects
|
|
562
|
+
ROSTER:
|
|
563
|
+
- backend-architect (owns services, API contracts, DB schema)
|
|
564
|
+
- frontend-architect (owns component hierarchy, state mgmt, routing)
|
|
565
|
+
- data-engineer (owns ETL/ELT, schema versioning, query patterns)
|
|
566
|
+
- security-engineer (owns auth model, input validation, threat model)
|
|
567
|
+
- accessibility-auditor (owns WCAG 2.2 AA constraints on component/nav choice)
|
|
568
|
+
- performance-benchmarker (owns quality-targets.json, bundle + latency budgets)
|
|
569
|
+
|
|
570
|
+
CROSS-CHECK PAIRINGS (mandatory — if your design touches one of these boundaries, SendMessage the peer before you finalize):
|
|
571
|
+
- Backend ↔ Frontend on API contract shape (REST vs GraphQL, request/response schemas, error envelope)
|
|
572
|
+
- Security ↔ Backend on auth flow (token storage, refresh, session model, authz gates)
|
|
573
|
+
- Accessibility ↔ Frontend on component patterns (primitives, focus management, landmark structure)
|
|
574
|
+
- Performance ↔ Backend+Data on query shapes (N+1 risk, indexing strategy, bundle impact of data layer choices)
|
|
575
|
+
- Security ↔ Frontend on client-side auth (token storage location, CSRF protection, input sanitization, secure cookie flags)
|
|
576
|
+
|
|
577
|
+
COORDINATION RULES:
|
|
578
|
+
- Plain text in your output file is INVISIBLE to teammates. If a contract boundary intersects another architect's domain, you MUST `SendMessage` to that peer using the exact `name` from the roster above. Do not assume they will read your file.
|
|
579
|
+
- If a peer SendMessage challenges a decision you have written, revise your output file and SendMessage back with the resolution — do not silently ignore.
|
|
580
|
+
- Idle (exit) only after: (1) your initial read + draft is complete, AND (2) all cross-check pairings touching your domain have either been resolved via SendMessage or confirmed non-intersecting.
|
|
581
|
+
|
|
582
|
+
OUTPUT:
|
|
583
|
+
Write your findings to `docs/plans/phase-2-contracts/<your-name>.md` (e.g., `docs/plans/phase-2-contracts/backend-architect.md`). This file is the authoritative record of your post-debate position — include both your initial decisions AND any revisions driven by peer SendMessage.
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Per-architect dispatches:
|
|
587
|
+
|
|
588
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 2 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 2 architect prompt below.
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
1. Description: "Backend architecture" — subagent_type: `engineering-backend-architect` — team_name: `phase-2-architects` — name: `backend-architect` — Prompt: "[CONTEXT header above] Design system architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude services, data models, API contracts, database schema, integration points. Respect stack choices from PRD. Map per-feature Business Rules and States to specific endpoints, persistence schemas, and validation logic — every State the product spec defines must have a backend behavior.\n\n[paste shared team brief above]"
|
|
592
|
+
|
|
593
|
+
2. Description: "Frontend architecture" — subagent_type: `engineering-frontend-developer` — team_name: `phase-2-architects` — name: `frontend-architect` — Prompt: "[CONTEXT header above] Design frontend architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/ux-research.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude component hierarchy, layout strategy, responsive approach, state management, routing. Align UX with the persona from research. Map the Screen Inventory to your component hierarchy — every screen the product spec lists must have a routable view, and per-feature States must drive the component-state matrix.\n\n[paste shared team brief above]"
|
|
594
|
+
|
|
595
|
+
3. Description: "Data engineering" — subagent_type: `engineering-data-engineer` — team_name: `phase-2-architects` — name: `data-engineer` — Prompt: "[CONTEXT header above] Design data architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`\nInclude ETL/ELT patterns, schema versioning, query patterns, indexing strategy, data lineage, migration plan. Per-feature data requirements from the product spec drive your schema — derived fields, denormalizations, and access patterns must serve specific feature flows.\n\n[paste shared team brief above]"
|
|
596
|
+
|
|
597
|
+
4. Description: "Security architecture" — subagent_type: `engineering-security-engineer` — team_name: `phase-2-architects` — name: `security-engineer` — Prompt: "[CONTEXT header above] Security review. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`\nCover auth model, input validation, secrets management, threat model, dependency hygiene. Use the product spec's ## Permissions & Roles section to drive your auth model — roles in the product spec must map to enforceable permissions in the architecture.\n\n[paste shared team brief above]"
|
|
320
598
|
|
|
321
|
-
Read the
|
|
599
|
+
5. Description: "A11y constraints" — subagent_type: `a11y-architect` — team_name: `phase-2-architects` — name: `accessibility-auditor` — Prompt: "[CONTEXT header above] Accessibility-driven architecture constraints. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/ux-research.md`\nIdentify WCAG 2.2 AA requirements that affect component choice, navigation structure, form patterns, focus management, landmark regions. Per-feature Persona Constraints (e.g., \"user scans, doesn't read\", \"operator on a phone in the field\") drive component-level a11y constraints.\n\n[paste shared team brief above]"
|
|
322
600
|
|
|
323
|
-
|
|
601
|
+
6. Description: "Performance constraints" — subagent_type: `testing-performance-benchmarker` — team_name: `phase-2-architects` — name: `performance-benchmarker` — Prompt: "[CONTEXT header above] Define quality targets for this build. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`\nWrite `docs/plans/quality-targets.json` covering bundle budget, LCP, TTI, API p95, Lighthouse scores. Use per-Scope budgets: Marketing 500KB / Product 300KB / Dashboard 400KB / Internal 200KB gzipped. Per-feature critical-path performance derives from the product spec's Happy Path latency expectations.\n\n[paste shared team brief above]"
|
|
324
602
|
|
|
325
|
-
|
|
603
|
+
**Step 2.2c — Wait for all 6 teammates to idle**, then proceed to synthesis. The `docs/plans/phase-2-contracts/*.md` files now contain post-debate positions (initial draft plus any SendMessage-driven revisions). The orchestrator does NOT read these files — the synthesizer below does.
|
|
326
604
|
|
|
327
|
-
|
|
605
|
+
After all 6 teammates are idle, the 4 raw research files are **SPENT**. They sit on disk for audit but no downstream phase reads them — they are NOT in the `refs.json` index. The orchestrator MOVES them to `docs/plans/phase1-scratch/` if not already there, to make the distinction physically obvious.
|
|
328
606
|
|
|
329
|
-
|
|
607
|
+
**Step 2.2d — Team teardown.** After the synthesizer dispatch at Step 2.3 returns, call `TeamDelete` on `phase-2-architects` to clean up the team channel.
|
|
330
608
|
|
|
331
|
-
|
|
609
|
+
### Step 2.3 — Sequence: Implementation Blueprint → Sprint Breakdown → DAG Validator → Refs Indexer
|
|
332
610
|
|
|
333
|
-
|
|
611
|
+
Four sequential dispatches.
|
|
334
612
|
|
|
335
|
-
|
|
613
|
+
**CONTEXT header:** Reuse `rendered_context_header` from phase 2 (already rendered above). Prepend to Step 2.3 synthesizer + sprint-breakdown prompts.
|
|
336
614
|
|
|
337
|
-
|
|
615
|
+
1. Description: "Implementation blueprint" — subagent_type: `code-architect` — Prompt: "[CONTEXT header above] Implementation blueprint. Read the PRD via your Read tool: `docs/plans/design-doc.md`. Read the product spec: `docs/plans/product-spec.md` (Screen Inventory + per-feature behavioral sections — your blueprint's file-and-build-order list must cover every feature in the spec). Read all 6 post-debate architect positions via your own Read tool from `docs/plans/phase-2-contracts/`:\n - `backend-architect.md`\n - `frontend-architect.md`\n - `data-engineer.md`\n - `security-engineer.md`\n - `accessibility-auditor.md`\n - `performance-benchmarker.md`\n\nThese files are the authoritative team positions AFTER any SendMessage-driven revisions — the architects already cross-checked each other's contract boundaries, so you can stitch without re-debating. Your job is to assemble the 6 positions into a coherent architecture. Where positions conflict OUTSIDE the 5 mandatory cross-check pairings, flag the contradiction explicitly in `architecture.md` under a `### Unresolved Tensions` section and pick the safer default. Do not silently absorb contradictions. Include specific files to create/modify, build sequence, dependency order. Write `docs/plans/architecture.md` with stable section anchors per `protocols/architecture-schema.md`. Required top-level sections: Overview, Frontend, Backend, Data Model, Security, Infrastructure, Scope, Out of Scope. Scope to the boundary from the PRD. Every API endpoint heading in the Backend section MUST include feature attribution annotations — e.g. `**POST /api/orders** (provides: order-placement)` — using the feature kebab names from `product-spec.md`. These annotations are required for the graph indexer to emit cross-feature dependency edges."
|
|
338
616
|
|
|
339
|
-
|
|
617
|
+
2. Description: "Sprint breakdown" — subagent_type: `planner` — Prompt: "[CONTEXT header above] Break this architecture into ordered, atomic tasks. Each task needs: description, acceptance criteria, **dependencies** (list of task IDs this depends on), size (S/M/L), **Behavioral Test** field for every UI task (concrete interaction: 'Navigate to [page], click [element], verify [outcome]') or curl-based acceptance test for API tasks, **Feature** — the exact feature name from product-spec.md (e.g. 'Order Placement', 'Auth') that must match a `## Feature: X` heading in product-spec.md (use '—' for infrastructure tasks that don't belong to a specific feature), **Screens** — comma-separated screen names from the product-spec Screen Inventory (e.g. 'Catalog, Product Detail') that must match screen names in product-spec.md (use '—' for backend-only tasks). Read these files via your Read tool before starting:\n - ARCHITECTURE: `docs/plans/architecture.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (per-feature behavioral sections — every feature in the spec must have at least one task, and per-feature acceptance criteria become Behavioral Test field values)\n - PRD: `docs/plans/design-doc.md`\nSave to `docs/plans/sprint-tasks.md`. The table must have these columns in order: Task ID, Title, Size, Dependencies, Behavioral Test, Owns Files, Implementing Phase, Feature, Screens. Dependencies field is load-bearing — Phase 4 uses it to batch independent tasks in parallel. Each task's Behavioral Test field SHOULD reference a specific feature acceptance criterion from the product spec (e.g., \"User can submit form with valid email; submitted form appears in admin dashboard within 5s\" — derived from product-spec.md's Happy Path or per-state criteria)."
|
|
340
618
|
|
|
341
|
-
|
|
619
|
+
3. Description: "Task DAG validator" — INTERNAL inline role-string — Prompt: "You are the Task DAG Validator. Read `docs/plans/sprint-tasks.md`. Validate for DAG correctness:
|
|
620
|
+
- No circular dependencies
|
|
621
|
+
- All referenced task IDs in the Dependencies field exist
|
|
622
|
+
- Sizing is consistent (S/M/L)
|
|
623
|
+
- Dependencies match the architecture document (don't depend on a task that builds a component you don't need)
|
|
624
|
+
- Every UI task has a Behavioral Test field; every API task has a curl-based test
|
|
625
|
+
Report any violations. If clean, return PASS. If violations, return a list of fix requests — Sprint Breakdown re-dispatches once with the fix list."
|
|
342
626
|
|
|
343
|
-
|
|
627
|
+
4. Description: "Refs indexer" — INTERNAL inline role-string — Prompt: "You are the Refs Indexer. Generate `docs/plans/refs.json` covering ALL live downstream docs:
|
|
628
|
+
- `docs/plans/design-doc.md` (PRD)
|
|
629
|
+
- `docs/plans/architecture.md`
|
|
630
|
+
- `docs/plans/sprint-tasks.md`
|
|
631
|
+
- `docs/plans/quality-targets.json`
|
|
632
|
+
- `DESIGN.md` (if it exists yet — Phase 3 extends refs.json after it writes this file)
|
|
344
633
|
|
|
345
|
-
|
|
634
|
+
For each doc, extract section anchors into a flat index. Schema: `[{\"anchor\": \"design-doc.md#persona\", \"topic\": \"user persona\", \"file_path\": \"docs/plans/design-doc.md\"}, ...]`. This index is consumed by the Phase 4 Briefing Officer for per-task context maps. Do NOT include Phase 1 scratch files — they are SPENT."
|
|
346
635
|
|
|
347
|
-
|
|
636
|
+
**Architecture Metric Loop (callable service):** Run the Metric Loop Protocol (`protocols/metric-loop.md`) on `architecture.md`. Define a metric: coverage of PRD requirements, specificity, consistency across the 6 architects, and **simplicity** — is this the simplest architecture that meets the requirements? Could any service, abstraction, or dependency be eliminated? Penalize over-engineering. Max 3 iterations.
|
|
637
|
+
|
|
638
|
+
#### Step 2.3.1.idx — Architecture graph index
|
|
639
|
+
|
|
640
|
+
After `code-architect` returns from the Implementation Blueprint dispatch (#1 above) AND the Architecture Metric Loop exits with `architecture.md` on disk, index it into the build graph. Slice 4 graph index — required for downstream agents.
|
|
641
|
+
|
|
642
|
+
Run via the Bash tool:
|
|
643
|
+
|
|
644
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/architecture.md`
|
|
645
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
646
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. Downstream agents require the graph — do not proceed without a successful index.
|
|
647
|
+
|
|
648
|
+
#### Step 2.3.2.idx — Sprint tasks graph index
|
|
649
|
+
|
|
650
|
+
After `planner` returns from the Sprint Breakdown dispatch (#2 above) AND the Task DAG Validator (#3 above) returns PASS, index `sprint-tasks.md` into the build graph. Slice 4 graph index — best-effort.
|
|
651
|
+
|
|
652
|
+
Run via the Bash tool:
|
|
653
|
+
|
|
654
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/sprint-tasks.md`
|
|
655
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
656
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. Downstream agents require the graph — do not proceed without a successful index.
|
|
657
|
+
|
|
658
|
+
#### Step 2.3.4.idx — Decisions re-index (end of Phase 2)
|
|
659
|
+
|
|
660
|
+
After the four Step 2.3 dispatches complete and the orchestrator finishes routing the 4 Phase 2 `deviation_row` objects through `scribe_decision`, re-index `decisions.jsonl` so the Slice 4 fragment reflects every Phase 2 decision before the LRR aggregator or feedback synthesizer can read it. Skip silently if `docs/plans/decisions.jsonl` does not exist (no decisions written yet).
|
|
661
|
+
|
|
662
|
+
Run via the Bash tool:
|
|
663
|
+
|
|
664
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/decisions.jsonl`
|
|
665
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
666
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. The decisions graph fragment must be current before downstream consumers query it.
|
|
667
|
+
|
|
668
|
+
**Architecture decisions:** The Implementation Blueprint synthesizer returns 4 `deviation_row` objects (or a `phase_2_decisions` array of row objects) in its structured result — one per cross-cutting Phase 2 decision (API contract, persistence layer, auth model, framework choice). The orchestrator forwards each row through the `scribe_decision` MCP tool (see Phase 4 "Orchestrator-scribe dispatch"); the MCP allocates `D-2-<seq>` IDs and atomically appends to `docs/plans/decisions.jsonl`. Author = `architect`. Each row carries a `ref` anchor pointing into `architecture.md` per `protocols/decision-log.md`. Total: 4 rows.
|
|
669
|
+
|
|
670
|
+
**Writes:** `docs/plans/architecture.md`, `docs/plans/sprint-tasks.md`, `docs/plans/quality-targets.json`, `docs/plans/refs.json`. Decision rows (4) flow through the orchestrator's `scribe_decision` MCP calls.
|
|
348
671
|
|
|
349
672
|
### Quality Gate 2
|
|
350
673
|
|
|
351
|
-
**
|
|
674
|
+
**Interactive:** Present Architecture + Sprint Task List (with dependency graph). Ask: "Approve to start designing + building, or flag changes?"
|
|
352
675
|
|
|
353
|
-
|
|
676
|
+
<HARD-GATE>
|
|
677
|
+
Gate 2 rejection path is codified:
|
|
678
|
+
- On NO → loop back to Phase 2 with user feedback.
|
|
679
|
+
- On YES → proceed to Phase 3.
|
|
680
|
+
- DO NOT PROCEED without user approval in interactive mode.
|
|
681
|
+
- Also codifies the LRR BLOCK backward edge: `LRR BLOCK authoring=Phase 2 → back to Phase 2`. The ⭐⭐ star rule routes BLOCK findings via Aggregator decisions.jsonl `decided_by` lookup; if `decided_by == architect`, the build re-opens Phase 2 with the finding as input.
|
|
682
|
+
</HARD-GATE>
|
|
354
683
|
|
|
355
|
-
|
|
684
|
+
**Autonomous:** Log to `docs/plans/build-log.md`. Auto-approve. Proceed.
|
|
685
|
+
|
|
686
|
+
Update TodoWrite and `.build-state.json`.
|
|
356
687
|
|
|
357
688
|
**iOS feature flag resolution:** if `project_type=ios`, resolve `ios_features` before leaving Phase 2 per `protocols/ios-phase-branches.md` §Phase 2 → Feature Flag Resolution.
|
|
358
689
|
|
|
359
|
-
**Compaction checkpoint.** Update
|
|
690
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
360
691
|
|
|
361
692
|
---
|
|
362
693
|
|
|
363
|
-
## Phase 3: Design
|
|
694
|
+
## Phase 3: Design (DNA-first SEQUENCE)
|
|
695
|
+
|
|
696
|
+
**Goal**: Lock Visual DNA first, then research against it, then compose from library, then spec, then implement, then critique, then a11y.
|
|
364
697
|
|
|
365
|
-
**
|
|
698
|
+
**NOTE:** Runs AFTER Phase 2. Cannot parallelize — design decisions depend on architecture outcomes.
|
|
366
699
|
|
|
367
700
|
**Skip if** the project has no user-facing frontend (CLI tools, pure APIs, backend services).
|
|
368
701
|
|
|
369
702
|
<HARD-GATE>
|
|
370
|
-
UI/UX IS THE PRODUCT. This phase is a full peer to Architecture and Build — not a footnote, not an afterthought
|
|
703
|
+
UI/UX IS THE PRODUCT. This phase is a full peer to Architecture and Build — not a footnote, not an afterthought. Do NOT skip, compress, or rush this phase for any reason.
|
|
371
704
|
|
|
372
|
-
Phase 4
|
|
705
|
+
Phase 4 WILL NOT START without `DESIGN.md` (Pass 1 + Pass 2 complete). If the artifact does not exist, return here.
|
|
373
706
|
</HARD-GATE>
|
|
374
707
|
|
|
375
|
-
**Mode-specific branch:**
|
|
376
|
-
-
|
|
377
|
-
-
|
|
708
|
+
**Mode-specific branch files drive Phase 3 in detail:**
|
|
709
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 3 (HIG + App Store + screenlane harvest → iOS Design Board, SwiftUI Preview QA loop).
|
|
710
|
+
- `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 3 — this file contains the NEW structure with steps 3.0-3.7 covering Visual DNA Selection (Brand Guardian as DNA owner at 3.0), Visual Research, Component Library Mapping, UX Architecture, Visual Design Spec, Inclusive Visuals Check, Style Guide Implementation (wrapped in Design Critic metric loop), and A11y Design Review. See the Component Library Mapping step in that protocol for the component library strategy.
|
|
711
|
+
|
|
712
|
+
**Phase 3 branch-file dispatch table (subagent_type references for SSOT lint):**
|
|
713
|
+
- Step 3.0 Visual DNA Selection: subagent_type: `design-brand-guardian` (web)
|
|
714
|
+
- Step 3.1 Visual Research (2 parallel): subagent_type: `visual-research` (web, competitive-audit + inspiration-mining)
|
|
715
|
+
- Step 3.2 Component Library Mapping: subagent_type: `design-ui-designer` (web)
|
|
716
|
+
- Step 3.2b DNA Persona Check: subagent_type: `design-ux-researcher` (web, may route to 3.0)
|
|
717
|
+
- Step 3.3 UX Architecture: subagent_type: `design-ux-architect` (web)
|
|
718
|
+
- Step 3.5 Inclusive Visuals Check: subagent_type: `design-inclusive-visuals-specialist` (web)
|
|
719
|
+
- Step 3.2-ios iOS Design Board: subagent_type: `ios-swift-ui-design` (iOS)
|
|
720
|
+
|
|
721
|
+
**Phase 3 write discipline:** Phase 3 is the writer for `DESIGN.md` (web) and extends `docs/plans/refs.json` to cover the visual spec anchors once it lands. Phase 3 does NOT write to `architecture.md` or `sprint-tasks.md` — those are Phase 2's.
|
|
378
722
|
|
|
379
|
-
|
|
723
|
+
<HARD-GATE>
|
|
724
|
+
LRR BLOCK backward edge: `LRR BLOCK authoring=Phase 3 → back to Phase 3`. The ⭐⭐ star rule routes BLOCK findings via Aggregator decisions.jsonl `decided_by` lookup; if `decided_by == design-brand-guardian` or any Phase 3 writer, the build re-opens Phase 3 with the finding as input.
|
|
725
|
+
</HARD-GATE>
|
|
726
|
+
|
|
727
|
+
**On re-entry from LRR backward routing:** When Phase 3 is re-opened via the re-entry dispatch template (Step 6.3), the orchestrator passes the re-entry payload (`{blocking_finding, prior_output: "DESIGN.md", decision_row}`) into the specific Phase 3 step named by `decision_row.author`. That step revises the prior output to address `blocking_finding` only — DESIGN.md Pass 1 (Step 3.0), component manifest (Step 3.2), or DESIGN.md Pass 2 (Step 3.4) — and emits a new decision_row. Unaffected steps are NOT re-run. Mode-specific branch files (`protocols/web-phase-branches.md` / `protocols/ios-phase-branches.md`) define which step owns which `decided_by` value.
|
|
728
|
+
|
|
729
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
380
730
|
|
|
381
731
|
---
|
|
382
732
|
|
|
383
|
-
## Phase 4:
|
|
733
|
+
## Phase 4: Build — THREE-TIER FEATURE-BASED EXECUTION
|
|
384
734
|
|
|
385
735
|
<HARD-GATE>
|
|
386
|
-
Before starting Phase 4: Phase 2 must be approved
|
|
387
|
-
- Web: `docs/plans/visual-design-spec.md` must exist.
|
|
388
|
-
- iOS: `docs/plans/ios-design-board.md` must exist.
|
|
389
|
-
If the artifact does not exist, DO NOT PROCEED. Return to Phase 3.
|
|
390
|
-
Step 4.2 (Design System) MUST implement from the design artifact — not generic architecture tokens.
|
|
736
|
+
Before starting Phase 4: Phase 2 must be approved, Phase 3 must have produced the design artifact (`DESIGN.md` — Pass 1 + Pass 2 complete; broken-refs lint == 0), and `docs/plans/page-specs/` must contain at least one file (web). You MUST call the Agent tool for EVERY task. No exceptions.
|
|
391
737
|
</HARD-GATE>
|
|
392
738
|
|
|
393
|
-
**
|
|
394
|
-
|
|
395
|
-
-
|
|
739
|
+
**Goal**: Scaffold project, then execute sprint tasks organized by FEATURE with product adherence checked per-feature during build. Three tiers: Product Owner (product quality) → Briefing Officers (task planning per feature) → Execution Agents (code). The orchestrator drives all dispatches — PO and BO are planning agents that write artifacts to disk.
|
|
740
|
+
|
|
741
|
+
**Mode-specific branch:**
|
|
742
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 4 for scaffold details and execution agent prompts.
|
|
743
|
+
- `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 4 for scaffold details and execution agent prompts.
|
|
744
|
+
|
|
745
|
+
**Phase 4 dispatch table (subagent_type references for SSOT lint):**
|
|
746
|
+
- Product Owner (planning): subagent_type: `product-owner`
|
|
747
|
+
- Product Owner (acceptance): subagent_type: `product-owner`
|
|
748
|
+
- Briefing Officer (per feature): subagent_type: `briefing-officer`
|
|
749
|
+
- Web UI (S/M): subagent_type: `engineering-frontend-developer`
|
|
750
|
+
- Web UI (L): subagent_type: `engineering-senior-developer`
|
|
751
|
+
- Web backend: subagent_type: `engineering-backend-architect` OR `engineering-senior-developer`
|
|
752
|
+
- Web AI/ML: subagent_type: `engineering-ai-engineer`
|
|
753
|
+
- iOS UI planner: subagent_type: `ios-swift-ui-design`
|
|
754
|
+
- iOS UI impl: subagent_type: `engineering-senior-developer`, `engineering-mobile-app-builder`
|
|
755
|
+
- iOS Foundation Models: subagent_type: `ios-foundation-models-specialist`
|
|
756
|
+
- iOS StoreKit: subagent_type: `ios-storekit-specialist`
|
|
757
|
+
- iOS Swift review: subagent_type: `swift-reviewer`
|
|
758
|
+
- Security review: subagent_type: `security-reviewer`
|
|
759
|
+
- Cleanup: subagent_type: `code-simplifier`, `refactor-cleaner`
|
|
760
|
+
- Code review: subagent_type: `code-reviewer`, `silent-failure-hunter`
|
|
761
|
+
|
|
762
|
+
### Step 4.0 — Scaffold (unchanged)
|
|
763
|
+
|
|
764
|
+
Scaffolding is project skeleton + design system + acceptance test stubs. Three sequential dispatches (full details in the mode-specific branch file):
|
|
765
|
+
|
|
766
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 4 per the canonical template (see CONTEXT HEADER HARD-GATE above). Includes `dna` field for web projects. Prepend to every Phase 4 prompt below.
|
|
767
|
+
|
|
768
|
+
1. Description: "Project scaffolding" — subagent_type: `engineering-rapid-prototyper` — mode: "bypassPermissions" — prompt per branch file. [COMPLEXITY: M]
|
|
769
|
+
|
|
770
|
+
2. Description: "Design system setup" — subagent_type: `engineering-frontend-developer` — mode: "bypassPermissions" — prompt per branch file. Implements design tokens from `DESIGN.md`. [COMPLEXITY: M]
|
|
771
|
+
|
|
772
|
+
3. Description: "Scaffold acceptance tests" — INTERNAL inline role-string — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Scaffold acceptance tests from sprint-tasks.md. Use Page Object Model. For every task with a Behavioral Test field, create a Playwright test stub (web) or Maestro flow stub (iOS). Stubs must FAIL right now. Commit: 'test: scaffold acceptance tests from sprint tasks'."
|
|
773
|
+
|
|
774
|
+
**Scaffold verification:** Run the Verify Protocol with `scope: static` (checks 1-3 and 6 only: Build, Type-Check, Lint, Diff Review). Test stubs are designed to fail at this point — do not run checks 4, 5, or 7 until after task implementation.
|
|
396
775
|
|
|
397
|
-
### Step 4.
|
|
776
|
+
### Step 4.1 — Product Owner: Feature Planning
|
|
398
777
|
|
|
399
|
-
|
|
778
|
+
Dispatch the Product Owner in planning mode. It reads the full artifact set via graph queries, groups tasks by feature, sequences features into dependency-ordered waves, and writes a delegation plan.
|
|
400
779
|
|
|
401
|
-
|
|
780
|
+
Call the Agent tool — description: "Product Owner: feature planning" — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: planning.
|
|
402
781
|
|
|
403
|
-
|
|
404
|
-
-
|
|
405
|
-
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
782
|
+
Read these artifacts via graph queries:
|
|
783
|
+
- `docs/plans/product-spec.md` — feature list, cross-feature interactions, screen inventory
|
|
784
|
+
- `docs/plans/sprint-tasks.md` — task breakdown with dependencies
|
|
785
|
+
- `docs/plans/architecture.md` — cross-feature API contracts, shared data entities
|
|
786
|
+
- `docs/plans/page-specs/*.md` — screen assignments per feature
|
|
787
|
+
- `docs/plans/quality-targets.json` — NFRs
|
|
408
788
|
|
|
409
|
-
|
|
789
|
+
Produce `docs/plans/feature-delegation-plan.json` per the schema in `agents/product-owner.md`. For each feature: list assigned tasks (from sprint-tasks.md), write a product_context summary (~100-200 tokens: persona constraints, key business rules, critical error scenarios, competitive differentiators), extract cross-feature contracts, list page-spec refs (web: `page-specs/*.md` paths; iOS: `DESIGN.md` section anchors). Sequence features into waves by dependency order."
|
|
410
790
|
|
|
411
|
-
|
|
791
|
+
Output: `docs/plans/feature-delegation-plan.json`. Update `.build-state.json`: set `feature_delegation_plan_path`, initialize `current_wave: 1`, `completed_features: []`, `feature_acceptance: {}`.
|
|
412
792
|
|
|
413
|
-
|
|
793
|
+
### Step 4.2 — Wave Execution (repeat for each wave)
|
|
414
794
|
|
|
415
|
-
|
|
795
|
+
Read `feature-delegation-plan.json`. For each wave, execute all features. Features within a wave are independent and their Briefing Officers can be dispatched in parallel.
|
|
796
|
+
|
|
797
|
+
#### 4.2.a — Briefing Officer dispatch (one per feature, parallel within wave)
|
|
798
|
+
|
|
799
|
+
For each feature in the current wave, dispatch a Briefing Officer. If the wave has multiple independent features, dispatch all BOs in ONE message (parallel).
|
|
800
|
+
|
|
801
|
+
Call the Agent tool — description: "Briefing Officer: [feature name]" — subagent_type: `briefing-officer` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] FEATURE DELEGATION from Product Owner:
|
|
802
|
+
|
|
803
|
+
Feature: [feature name]
|
|
804
|
+
Product context: [paste product_context from delegation plan]
|
|
805
|
+
Cross-feature contracts: [paste contracts from delegation plan]
|
|
806
|
+
Assigned tasks: [paste task IDs]
|
|
807
|
+
Page spec refs: [paste page_spec_refs from delegation plan]
|
|
808
|
+
|
|
809
|
+
Read the full feature spec via graph query. Read task rows from `docs/plans/sprint-tasks.md`. Read page specs, architecture, component manifest, visual design spec for this feature's screens.
|
|
810
|
+
|
|
811
|
+
Write `docs/plans/feature-briefs/[feature].md` per the schema in `agents/briefing-officer.md`. For each task: specify agent type, skills, structured context payload (layout, components, API contract, error states, business rules, persona constraints), and acceptance criteria."
|
|
812
|
+
|
|
813
|
+
Output: `docs/plans/feature-briefs/[feature].md`. Update `.build-state.json.feature_briefs[feature]` with the path.
|
|
814
|
+
|
|
815
|
+
#### 4.2.b — Task execution (orchestrator reads BO brief, dispatches per task)
|
|
816
|
+
|
|
817
|
+
After the Briefing Officer writes the feature brief, the orchestrator reads it and executes each task. Tasks within a feature are executed in DAG-parallel batches (topological ordering from the Dependencies field — independent siblings run in parallel, yielding ~30-50% wall-clock saving). The per-task pipeline is unchanged in structure — only the input to the execution agent changes.
|
|
818
|
+
|
|
819
|
+
**For each task in the feature brief:**
|
|
820
|
+
|
|
821
|
+
**1. Implementer dispatch** — The orchestrator reads the task's execution spec from the feature brief and pastes the structured context directly into the execution agent's prompt. See mode-specific branch file (`protocols/web-phase-branches.md` §Phase 4 or `protocols/ios-phase-branches.md` §Phase 4) for the exact prompt template.
|
|
822
|
+
|
|
823
|
+
Call the Agent tool — description: "[task-id] [task name]" — subagent_type: [from BO brief] — mode: "bypassPermissions" — prompt: "[CONTEXT header above] [COMPLEXITY: S/M/L from sprint-tasks.md].
|
|
824
|
+
|
|
825
|
+
[Paste the full structured context payload from the feature brief — TASK, FEATURE CONTEXT, PAGE LAYOUT, COMPONENTS, API CONTRACT, ERROR STATES, BUSINESS RULES, SKILLS ASSIGNED, ACCEPTANCE. See branch file for exact format.]
|
|
826
|
+
|
|
827
|
+
## Prior Learnings
|
|
828
|
+
[paste contents of `docs/plans/.active-learnings.md` if it exists, otherwise omit this section]
|
|
829
|
+
|
|
830
|
+
## Deviation Reporting
|
|
831
|
+
If your implementation deviates from the planned architecture, return a `deviation_row` object per the schema in `protocols/decision-log.md`. If no deviation, return `deviation_row: null`. Do NOT write `decisions.jsonl` directly.
|
|
832
|
+
|
|
833
|
+
Implement fully with real code and tests. Commit: 'feat: [task]'. Report what you built, files changed, and test results."
|
|
834
|
+
|
|
835
|
+
**2. Per-task security review (auth/PII tasks only)** — unchanged from prior design.
|
|
836
|
+
|
|
837
|
+
Call the Agent tool — description: "Security review for [task-id]" — subagent_type: `security-reviewer` — prompt: "[CONTEXT header above] Review changed files from [task-id] for security issues. Scope: auth logic, input validation, secrets handling, dependency hygiene, OWASP Top 10 for web (or iOS Keychain / ATS / data protection for iOS). Return blocking findings only — 80%+ confidence threshold. Files to review: [list from implementer's changeset]."
|
|
838
|
+
|
|
839
|
+
**3. Senior Dev cleanup** — unchanged. Two-pass, changeset-scoped.
|
|
840
|
+
|
|
841
|
+
1. Call the Agent tool — description: "Simplify [task-id]" — subagent_type: `code-simplifier` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Simplify changed files from [task-id]. Remove dead code, unused imports, redundant abstractions. Do NOT add features. Do NOT change architecture. Do NOT touch files outside the changeset. Files: [list]."
|
|
842
|
+
|
|
843
|
+
2. If TS/JS task: Call the Agent tool — description: "Refactor [task-id]" — subagent_type: `refactor-cleaner` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Run knip/depcheck/ts-prune on changed files from [task-id]. Changeset only. Files: [list]."
|
|
844
|
+
|
|
845
|
+
**4. Per-task code review (parallel pair)** — unchanged.
|
|
846
|
+
|
|
847
|
+
Call the Agent tool 2 times in one message:
|
|
848
|
+
|
|
849
|
+
1. Description: "Code review for [task-id]" — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] Review changed files from [task-id]. 80%+ confidence threshold. Changeset only. Files: [list]."
|
|
850
|
+
|
|
851
|
+
2. Description: "Silent failure hunt for [task-id]" — subagent_type: `silent-failure-hunter` — Prompt: "[CONTEXT header above] Hunt silent failures in changed files from [task-id]. Files: [list]."
|
|
852
|
+
|
|
853
|
+
**5. Metric Loop** — unchanged. Authoritative behavioral check per `protocols/metric-loop.md`. Max 5 iterations.
|
|
854
|
+
|
|
855
|
+
**6. Verify Service** — unchanged. Static checks only (type-check, lint, build). Max 2 fix attempts.
|
|
856
|
+
|
|
857
|
+
**7. After each task completes** — Update TodoWrite and `.build-state.json`. Write summary to `docs/plans/.task-outputs/[task-id].json`.
|
|
858
|
+
|
|
859
|
+
**8. Orchestrator-scribe** — After all tasks in a feature complete, collect deviation_rows and forward through `scribe_decision` MCP. Same mechanics as before.
|
|
860
|
+
|
|
861
|
+
### Step 4.3 — Product Owner: Feature Acceptance
|
|
862
|
+
|
|
863
|
+
After all tasks for a feature complete, dispatch the Product Owner in acceptance mode. It checks whether the built feature matches the product spec.
|
|
864
|
+
|
|
865
|
+
Call the Agent tool — description: "Product Owner: accept [feature name]" — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: acceptance. FEATURE: [feature name].
|
|
866
|
+
|
|
867
|
+
Read the feature's acceptance criteria and business rules via graph query. Read the feature's page spec(s) from `docs/plans/page-specs/`. Use agent-browser (web) or XcodeBuildMCP + Maestro (iOS) to verify the built feature.
|
|
868
|
+
|
|
869
|
+
Check: (1) Does the feature implement the product spec's happy path? (2) Are business rules correct? (3) Are error states from the product spec handled? (4) Does the layout match the page spec? (5) Does component usage match the manifest?
|
|
870
|
+
|
|
871
|
+
Write verdict: ACCEPTED or NEEDS_REVISION with specific findings citing product-spec sections."
|
|
872
|
+
|
|
873
|
+
**Verdict routing:**
|
|
874
|
+
- `ACCEPTED` → mark feature complete in `.build-state.json.feature_acceptance`. Proceed.
|
|
875
|
+
- `NEEDS_REVISION` → orchestrator re-dispatches the Briefing Officer for this feature with the findings. BO writes an updated brief targeting only the failing tasks. Orchestrator re-executes those tasks. Max 2 revision cycles per feature. After 2nd NEEDS_REVISION: interactive → present findings to user. Autonomous → accept with gap note in build-log.md AND append a structured gap entry to `.build-state.json.feature_acceptance[feature].gaps[]` with shape `{finding, severity, accepted_at_cycle}`. The Phase 6 LRR Eng-Quality chapter reads these gaps as input evidence.
|
|
876
|
+
|
|
877
|
+
### Step 4.4 — Wave Transition
|
|
878
|
+
|
|
879
|
+
After all features in the current wave are ACCEPTED:
|
|
880
|
+
|
|
881
|
+
1. Update `.build-state.json`: add features to `completed_features`, increment `current_wave`.
|
|
882
|
+
2. Handle shared file mutations: if any BO flagged shared file changes needed by the next wave, apply them now. The orchestrator identifies shared files from BO cross-feature contract fields. For each shared file flagged by multiple features in the next wave, dispatch a single `code-architect` agent to reconcile the mutations before wave execution begins. Do NOT let multiple BOs independently modify the same shared file.
|
|
883
|
+
3. Run a quick Verify Protocol (static checks) to confirm the wave didn't break anything.
|
|
884
|
+
4. Proceed to next wave. Repeat Steps 4.2-4.4.
|
|
885
|
+
|
|
886
|
+
After all waves complete, Phase 4 is done.
|
|
887
|
+
|
|
888
|
+
#### Step 4.4.idx — Decisions re-index (end of wave)
|
|
889
|
+
|
|
890
|
+
After each wave's deviation rows have been routed through `scribe_decision` (per the Orchestrator-scribe dispatch below), re-index `decisions.jsonl` so the Slice 4 fragment reflects every wave-level decision before the next wave's BOs query open decisions. Skip silently if `docs/plans/decisions.jsonl` does not exist.
|
|
891
|
+
|
|
892
|
+
Run via the Bash tool:
|
|
893
|
+
|
|
894
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/decisions.jsonl`
|
|
895
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
896
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. The next wave's BOs require current decision data.
|
|
897
|
+
|
|
898
|
+
**Writes:** source code, `docs/plans/.task-outputs/`, `docs/plans/feature-delegation-plan.json`, `docs/plans/feature-briefs/*.md`. Deviation rows flow through the orchestrator's `scribe_decision` MCP calls.
|
|
899
|
+
|
|
900
|
+
<HARD-GATE>
|
|
901
|
+
DECISIONS.JSONL — ORCHESTRATOR-SCRIBE ONLY via `scribe_decision` MCP. Only the orchestrator may cause appends to `docs/plans/decisions.jsonl`, and it does so exclusively by invoking the `scribe_decision` MCP tool. Any dispatch prompt asking a subagent to write this file is a bug. The orchestrator itself MUST NOT Write or Edit the file directly. Subagents return `deviation_row` objects in their structured result; the orchestrator forwards them through the MCP, which owns ID allocation and atomic append.
|
|
902
|
+
</HARD-GATE>
|
|
903
|
+
|
|
904
|
+
#### Orchestrator-scribe dispatch (route deviation rows through `scribe_decision` MCP)
|
|
905
|
+
|
|
906
|
+
Runs after each feature's tasks complete. Same mechanics as before:
|
|
907
|
+
|
|
908
|
+
1. Collect non-null `deviation_row` from each subagent return.
|
|
909
|
+
2. For each row, invoke `scribe_decision` MCP. One call per row.
|
|
910
|
+
3. MCP allocates `decision_id`, stamps timestamp, validates, atomically appends.
|
|
911
|
+
4. Regenerate `.build-state.md`.
|
|
912
|
+
|
|
913
|
+
**On resume:** scribe MCP reconstructs its ID allocator by scanning `decisions.jsonl`. The `decisions_next_id` field in `.build-state.json` is deprecated (scribe owns ID allocation).
|
|
914
|
+
|
|
915
|
+
<HARD-GATE>
|
|
916
|
+
LRR NEEDS_WORK backward edge: `LRR NEEDS_WORK (code-level) → back to Phase 4 target feature`. The Aggregator classifies the finding and routes to the specific feature's Briefing Officer via `related_decision_id` lookup. The BO re-plans the affected task(s), orchestrator re-executes. Product-level issues route to the Product Owner, who re-delegates to the relevant BO.
|
|
917
|
+
</HARD-GATE>
|
|
918
|
+
|
|
919
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above. Feature-level state (`completed_features`, `current_wave`, `feature_acceptance`, `feature_briefs`) survives compaction — all planning artifacts are on disk.
|
|
416
920
|
|
|
417
921
|
---
|
|
418
922
|
|
|
419
|
-
## Phase 5:
|
|
923
|
+
## Phase 5: Audit — Track A (engineering reality) + Track B (product reality) + cross-cutting
|
|
420
924
|
|
|
421
925
|
<HARD-GATE>
|
|
422
|
-
Before starting
|
|
926
|
+
Before starting Phase 5: run the Verify Protocol (7 checks) one more time. All checks must pass before expensive audit agents fire.
|
|
423
927
|
</HARD-GATE>
|
|
424
928
|
|
|
425
|
-
**
|
|
426
|
-
- If `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 5 (iOS skill bundle, feature-flag-gated skill loading, iOS implement prompt, SwiftUI Preview metric loop, Maestro smoke tests)
|
|
427
|
-
- If `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 5 (web implement prompt, agent-browser metric loop, localhost smoke tests)
|
|
929
|
+
**Goal**: Surface quality issues before Launch Review. Phase 5 runs in three layers: Track A audits the engineering envelope (API / perf / a11y / security / brand drift), Track B audits the built product against `product-spec.md` per-feature (states, transitions, business rules, happy path, persona constraints, wiring, manifest coverage), and Cross-cutting checks (E2E user journeys, autonomous dogfood, fake-data detector) catch what neither track anticipates. Findings from all three layers route through one Feedback Synthesizer (Step 5.4) and one Fix loop (Step 5.5).
|
|
428
930
|
|
|
429
|
-
|
|
931
|
+
**Mode-specific branch:**
|
|
932
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 5 for iOS-adapted Track A/B + cross-cutting (XcodeBuildMCP + Maestro execution surface). Steps 5.1–5.3 are defined in the iOS protocol; Steps 5.4–5.5 below are shared.
|
|
933
|
+
- `project_type=web`: continue below.
|
|
430
934
|
|
|
431
|
-
|
|
935
|
+
### Step 5.1 — Track A: Engineering Reality (5 parallel auditors, ONE message)
|
|
432
936
|
|
|
433
|
-
|
|
937
|
+
Read the NFRs from `docs/plans/quality-targets.json`. Pass the relevant targets to each audit agent so they have concrete thresholds, not generic checks.
|
|
434
938
|
|
|
435
|
-
|
|
939
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 5 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Step 5.X dispatch prompt below.
|
|
436
940
|
|
|
437
|
-
|
|
941
|
+
Call the Agent tool 5 times in one message:
|
|
438
942
|
|
|
439
|
-
|
|
440
|
-
[COMPLEXITY: S]
|
|
441
|
-
- Skip if trivial (< 20 lines, single file).
|
|
442
|
-
- Cleanup agent is a SEPARATE agent from the implementer — no cleaning your own mess.
|
|
443
|
-
- Scope is sacred: ONLY files from the implementation changeset. Zero exceptions.
|
|
444
|
-
- Cleanup fixes: naming, dead code, unused imports, style, DRY. Does NOT: add features, change architecture, touch other files.
|
|
445
|
-
- If cleanup breaks acceptance criteria, revert and skip. Never block the metric loop on cleanup failure.
|
|
943
|
+
1. Description: "API testing" — subagent_type: `testing-api-tester` — Prompt: "[CONTEXT header above] Comprehensive API validation: all endpoints, edge cases, error responses, auth flows. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance and reliability thresholds. Report findings with severity counts."
|
|
446
944
|
|
|
447
|
-
|
|
945
|
+
2. Description: "Performance audit" — subagent_type: `testing-performance-benchmarker` — Prompt: "[CONTEXT header above] Measure response times, identify bottlenecks, flag performance issues. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance thresholds. Bundle size per-Scope budgets apply (Marketing 500KB / Product 300KB / Dashboard 400KB / Internal 200KB gzipped). Report benchmarks AGAINST these targets, not generic metrics."
|
|
448
946
|
|
|
449
|
-
|
|
947
|
+
3. Description: "A11y audit" — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] WCAG 2.2 AA runtime compliance audit on all interfaces. Check screen reader, keyboard nav, contrast, focus order, touch targets (>=44px), reduced-motion variants. Report issues with severity (Critical/Serious/Moderate/Minor)."
|
|
450
948
|
|
|
451
|
-
|
|
949
|
+
4. Description: "Security audit" — subagent_type: `engineering-security-engineer` — Prompt: "[CONTEXT header above] Security review at app level: auth, input validation, data exposure, dependency vulnerabilities. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for security thresholds. Report findings with severity."
|
|
452
950
|
|
|
453
|
-
|
|
951
|
+
5. Description: "Brand Guardian drift check" — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Phase 5 drift check. Read DESIGN.md (the DNA card locked at Phase 3.0) + the actually-built pages via Playwright screenshots under docs/plans/evidence/. Score whether Phase 4 implementers stayed true to the DNA or drifted away from it. Specifically check: does the built Character axis match the DNA? Does Density match? Is Material consistent? Is Motion aligned? Report drift count and specific elements. Save findings to docs/plans/evidence/brand-drift.md. Note: this is a drift check only — the Phase 6 LRR Brand Guardian chapter does the verdict. You do NOT issue a pass/fail here, only surface findings."
|
|
454
952
|
|
|
455
|
-
|
|
953
|
+
### Step 5.2 — Track B: Product Reality (parallel per-feature, ONE message)
|
|
456
954
|
|
|
457
|
-
|
|
458
|
-
- **Interactive:** present score history + top remaining issue to user.
|
|
459
|
-
- **Autonomous:** accept if score >= 60% of target, skip otherwise. Log to `docs/plans/build-log.md`.
|
|
955
|
+
Track B audits the built app against `product-spec.md` on a per-feature basis. Each feature gets its own auditor; all auditors run in parallel.
|
|
460
956
|
|
|
461
|
-
|
|
957
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 5 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Step 5.X dispatch prompt below.
|
|
462
958
|
|
|
463
|
-
|
|
959
|
+
**Feature enumeration:** Before dispatch, query the graph for the full feature inventory:
|
|
464
960
|
|
|
465
|
-
|
|
961
|
+
- Call `mcp__plugin_buildanything_graph__graph_list_features` (no arguments) to get the full feature inventory. Returns an array of `{id, label, kebab_anchor}` for every feature in the indexed product-spec. The orchestrator OWNS this enumeration — auditors never enumerate themselves.
|
|
962
|
+
- If the call fails, STOP. Log `TRACK B BLOCKED: graph_list_features failed` to `docs/plans/build-log.md` and report the error. The graph must be indexed correctly before Track B can run.
|
|
466
963
|
|
|
467
|
-
|
|
964
|
+
**Zero-feature gate:** If feature enumeration returns zero features, STOP. This indicates either the graph indexer is broken or `product-spec.md` has no recognizable `## Feature:` sections — neither is a Phase 5 problem. Log `TRACK B BLOCKED: zero features enumerated` to `docs/plans/build-log.md` and route the build back to Step 1.6 (product-spec-writer) via the standard backward-routing template. Do NOT proceed with Cross-cutting (Step 5.3) on a feature-less Track B run.
|
|
468
965
|
|
|
469
|
-
|
|
966
|
+
**Dispatch:** Call the Agent tool N times in ONE message — one per `feature_id`:
|
|
470
967
|
|
|
471
|
-
|
|
968
|
+
- Description: "Product Reality Audit: {feature_label}"
|
|
969
|
+
- subagent_type: product-reality-auditor
|
|
970
|
+
- Prompt: "[CONTEXT header above] Audit feature_id: {feature_id}. Follow your Cognitive Protocol (ABSORB → QUERY → SYNTHESIZE → EXECUTE → CLASSIFY → SCORE → WRITE). Write evidence to docs/plans/evidence/product-reality/{feature_id}/. Report manifest of evidence paths back."
|
|
472
971
|
|
|
473
|
-
|
|
972
|
+
**Post-dispatch verification:** After all Track B auditors return, verify each feature has the four evidence files (`tests-generated.md`, `results.json`, `findings.json`, `coverage.json`) AND that each JSON file parses as valid JSON. If any feature is missing a file or has a malformed JSON file, log `TRACK B EVIDENCE MISSING/MALFORMED: {feature_id}: {path}` to `docs/plans/build-log.md` and re-dispatch that feature's auditor once (this distinguishes the retry from the first attempt). If the second attempt still fails, emit a synthetic finding with `target_phase: 1, target_task_or_step: "1.6"` (the auditor failing twice on the same feature is a strong signal the spec for that feature is malformed) and let it route through the existing spec-gap path at Step 5.4.
|
|
474
973
|
|
|
475
|
-
|
|
974
|
+
**Note on the metric loop:** The Metric Loop callable service is no longer wired as a primary Phase 5 step. It can still be invoked ad-hoc by Track A audit fixes via Step 5.5 if a single check class needs iterative tightening, but the structured per-feature audit replaces the orchestrator-improvised eval cases that the previous Step 5.2 (Eval Harness → Metric Loop) drove.
|
|
476
975
|
|
|
477
|
-
|
|
976
|
+
### Step 5.3 — Cross-cutting (3 parallel, ONE message)
|
|
478
977
|
|
|
479
|
-
|
|
978
|
+
Call the Agent tool 3 times in one message:
|
|
979
|
+
|
|
980
|
+
1. Description: "E2E runner" — INTERNAL inline role-string — mode: "bypassPermissions" — Prompt: "Run Playwright E2E test generation, execution, and stability check per `protocols/web-phase-branches.md` Phase 5 E2E steps (generate and run E2E tests for User Journeys, 3 mandatory iterations for flakiness detection). Report results + artifact paths. Records results to `docs/plans/evidence/e2e/iter-3-results.json`. Scope: multi-feature User Journeys ONLY (login → browse → buy, signup → onboarding → first-action). Single-feature happy paths are covered by Track B per-feature auditors at Step 5.2 — do NOT duplicate. Additionally, read the `## Cross-Feature Interactions` section from `docs/plans/product-spec.md`. For each cross-feature rule (e.g., 'Auth → Checkout: user must be authenticated'), generate a targeted E2E test that verifies the rule holds. These are NOT user journeys — they are specific behavioral contracts between features."
|
|
981
|
+
|
|
982
|
+
2. Description: "Dogfood the app" — subagent_type: `testing-evidence-collector`
|
|
983
|
+
|
|
984
|
+
3. Description: "Fake-data detector" — subagent_type: `silent-failure-hunter` — mode: "bypassPermissions" — Prompt: "Run the Fake Data Detector Protocol (`protocols/fake-data-detector.md`). Static analysis: grep for Math.random() in business data paths, hardcoded API responses, setTimeout faking async, placeholder text. Dynamic analysis: inspect HAR files from `docs/plans/evidence/` for missing real API calls, static responses, absent WebSocket traffic. Write findings to `docs/plans/evidence/fake-data-audit.md` with file:line refs and severity."
|
|
985
|
+
|
|
986
|
+
### Step 5.4 — Feedback Synthesizer
|
|
987
|
+
|
|
988
|
+
The Dogfood findings used to dead-end. Now route them to fix loops.
|
|
480
989
|
|
|
481
|
-
|
|
990
|
+
**Pre-dispatch: finding count check.**
|
|
991
|
+
Before dispatching the synthesizer, count total findings across all 5 input streams:
|
|
992
|
+
- Count lines in each `evidence/product-reality/*/findings.json`
|
|
993
|
+
- Count findings in `evidence/dogfood/findings.md` (count `### Finding` headings or JSON array length)
|
|
994
|
+
- Count entries in `evidence/track-a/*.json`
|
|
995
|
+
- Count failures in `evidence/e2e/iter-3-results.json`
|
|
996
|
+
- Count findings in `evidence/fake-data-audit.md`
|
|
482
997
|
|
|
483
|
-
|
|
998
|
+
If total findings ≤ 40: dispatch the synthesizer as a single pass (existing behavior below).
|
|
484
999
|
|
|
485
|
-
|
|
1000
|
+
If total findings > 40: split into two sequential dispatches:
|
|
1001
|
+
- **Pass 1 (mechanical routing):** Track B findings (pre-routed, validate only) + Track A findings (static routing) + E2E failures (route to phase 4) + fake-data findings (route to phase 4). These require minimal graph queries. Output: `docs/plans/evidence/dogfood/classified-findings-pass1.json`.
|
|
1002
|
+
- **Pass 2 (graph-heavy classification):** Dogfood findings only (need full graph-based classification). Input includes pass-1 output for dedup. Output: merge pass-1 + pass-2 into final `docs/plans/evidence/dogfood/classified-findings.json`.
|
|
486
1003
|
|
|
487
|
-
|
|
488
|
-
- If `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 6 — dispatch iOS twin commands (`/buildanything:verify` → `/buildanything:ux-review` → `/buildanything:fix`) in sequence. Skip Steps 6.1, 6.1b, 6.2, 6.2b, 6.2c, 6.2d, 6.2e. Then run Step 6.4 Reality Check below with iOS evidence.
|
|
489
|
-
- If `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 6 — run Steps 6.1 (5-agent audit), 6.1b (eval harness), 6.2 (metric loop), 6.2b (eval re-run), 6.2c (Playwright E2E, 3 mandatory iterations), 6.2d (agent-browser dogfood), 6.2e (fake data detector). Then run Step 6.4 Reality Check below.
|
|
1004
|
+
Call the Agent tool — description: "Synthesize all findings" — subagent_type: `product-feedback-synthesizer` — Prompt: "[CONTEXT header above] Interpret findings from Track A, Track B, and Cross-cutting streams. Inputs:
|
|
490
1005
|
|
|
491
|
-
|
|
1006
|
+
- `docs/plans/evidence/dogfood/findings.md` — autonomous exploration findings, each requires classification + routing
|
|
1007
|
+
- `docs/plans/evidence/product-reality/*/findings.json` — one per feature (web uses agent-browser evidence; iOS uses XcodeBuildMCP + Maestro evidence). Each Track B finding ALREADY CARRIES `target_phase` and `target_task_or_step` set by the product-reality-auditor. VALIDATE these against the graph (same `graph_query_dependencies` walk used for dogfood findings) and pass through if valid; only re-route if validation fails (e.g., the targeted task no longer exists in the task DAG).
|
|
1008
|
+
- E2E test failures: `docs/plans/evidence/e2e/iter-3-results.json` — failures that persisted through 3 Playwright iterations. For each, set `source: "e2e"`, classify severity, route to `target_phase: 4`.
|
|
1009
|
+
- Fake-data findings: `docs/plans/evidence/fake-data-audit.md` — hardcoded/mock data in production paths. For each, set `source: "fake-data"`, classify severity, route to `target_phase: 4`.
|
|
1010
|
+
- Track A audit findings: `docs/plans/evidence/brand-drift.md`, `docs/plans/evidence/track-a/*.json` (API contract, performance, a11y, security). Web uses Playwright/Lighthouse; iOS uses XcodeBuildMCP/Instruments. These are engineering-focused findings. For each Track A finding, set `source: "track-a"`, classify severity, and route: API/perf/security findings → `target_phase: 4` (implementation fix); a11y findings → `target_phase: 4` (implementation fix); brand-drift findings → `target_phase: 3` (design fix, re-run Brand Guardian at Step 3.0).
|
|
1011
|
+
|
|
1012
|
+
For each finding, ensure it ends up classified with:
|
|
1013
|
+
- Code-level bug (broken feature, failing logic, fake data) → `target_phase: 4`, assign to the specific task that owns the affected file
|
|
1014
|
+
- Visual/design issue (styling drift, missing state, a11y gap) → `target_phase: 3`, assign to the Phase 3 step that owns the relevant artifact
|
|
1015
|
+
- Structural/architecture issue (missing feature, wrong data flow, API mismatch) → `target_phase: 2`, assign to the architecture section
|
|
1016
|
+
- Spec-gap (acceptance criteria too vague, persona constraint not measurable) → `target_phase: 1, target_task_or_step: "1.6"`
|
|
1017
|
+
|
|
1018
|
+
Output: `docs/plans/evidence/dogfood/classified-findings.json` with shape `[{finding_id, source: \"dogfood\" | \"product-reality\" | \"track-a\" | \"e2e\" | \"fake-data\", severity, target_phase, target_task_or_step, description, evidence_ref, related_decision_id?: string}, ...]`. The `source` field distinguishes the five input streams. The file also carries a footer object with: `graph_used: boolean` (false if any graph call failed and grep fallback ran), `re_routed_findings: [{finding_id, original_target, new_target, reason}, ...]` (Track B findings whose routing the synthesizer overrode after graph validation failed — empty array if none), `source_counts: {dogfood: N, product_reality: M, track_a: P, e2e: N, fake_data: N}` (count by input stream). This file is read by the Phase 5 fix loop and by the Phase 6 LRR Aggregator for backward routing."
|
|
1019
|
+
|
|
1020
|
+
### Step 5.5 — Fix loop
|
|
1021
|
+
|
|
1022
|
+
For each CRITICAL/HIGH classified finding, dispatch the appropriate fix agent based on `target_phase`. Max 2 fix cycles. Routing template at the bottom of this file ("Re-entry dispatch template"). Findings with `target_phase: 1, target_task_or_step: "1.6"` route back to `product-spec-writer` to tighten the spec, which re-triggers Track B for the affected feature on the next loop.
|
|
1023
|
+
|
|
1024
|
+
**Writes:** `docs/plans/evidence/*.json`, `docs/plans/evidence/fake-data-audit.md`, `docs/plans/evidence/dogfood/classified-findings.json`, `docs/plans/evidence/product-reality/*/{tests-generated.md, results.json, findings.json, coverage.json, screenshots/}`, `docs/plans/learnings.jsonl` (reality sweep writes PITFALL/PATTERN rows — see `protocols/decision-log.md` for the Dissent Log Revisit Pass path).
|
|
1025
|
+
|
|
1026
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
1027
|
+
|
|
1028
|
+
---
|
|
492
1029
|
|
|
493
|
-
|
|
1030
|
+
## Phase 6: Launch Readiness Review
|
|
494
1031
|
|
|
495
|
-
|
|
1032
|
+
**Goal**: 5 independent chapter judges + mechanical aggregator with file-completeness checkpoint + author-aware backward routing on BLOCK.
|
|
496
1033
|
|
|
497
|
-
|
|
1034
|
+
Split from old Phase 6. Old 6.4 (Reality Check) and 6.5 (LRR) merged and restructured. Reality Checker keeps its evidence sweep role only — the combined verdict authority moved to the LRR Aggregator.
|
|
498
1035
|
|
|
499
|
-
|
|
1036
|
+
#### Step 6.0.idx — Decisions re-index (pre-LRR backfill)
|
|
500
1037
|
|
|
501
|
-
1.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
1038
|
+
Before dispatching the Reality Checker (Step 6.0) and the LRR chapter judges (Step 6.1), re-index `decisions.jsonl` so the Slice 4 fragment reflects any decisions appended since the last Phase 4 wave transition. The aggregator's backward-routing walk at Step 6.2 (the ⭐⭐ star rule) reads the indexed fragment via `graph_query_decisions` — running this once here catches any drift from hand-edits or out-of-band scribe writes. Skip silently if `docs/plans/decisions.jsonl` does not exist.
|
|
1039
|
+
|
|
1040
|
+
Run via the Bash tool:
|
|
1041
|
+
|
|
1042
|
+
- Command: `node ${CLAUDE_PLUGIN_ROOT}/bin/graph-index.js docs/plans/decisions.jsonl`
|
|
1043
|
+
- On exit 0: log success to `docs/plans/build-log.md` and continue.
|
|
1044
|
+
- On non-zero exit: STOP. Log the error to `docs/plans/build-log.md` and report the failure. The LRR aggregator's backward-routing walk requires current decision data.
|
|
1045
|
+
|
|
1046
|
+
### Step 6.0 — Reality Check (evidence sweep + dissent log revisit pass)
|
|
1047
|
+
|
|
1048
|
+
Reality Checker runs its existing evidence sweep per `commands/build.md` precondition list. Writes the manifest to `docs/plans/evidence/reality-check-manifest.json`. Does NOT issue a combined verdict.
|
|
507
1049
|
|
|
508
1050
|
<HARD-GATE>
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1051
|
+
PRECONDITION (orchestrator-side, BEFORE dispatching Reality Checker):
|
|
1052
|
+
|
|
1053
|
+
REQUIRED EVIDENCE FOR ALL PROJECTS:
|
|
1054
|
+
- `docs/plans/.build-state.json` exists, contains current build session id, contains a recent `VERIFY: PASS` line from this session.
|
|
1055
|
+
|
|
1056
|
+
REQUIRED EVIDENCE FOR `project_type=web`:
|
|
1057
|
+
- `docs/plans/evidence/e2e/iter-3-results.json` (non-empty)
|
|
1058
|
+
- `docs/plans/evidence/dogfood/findings.md` (non-empty)
|
|
1059
|
+
- `docs/plans/evidence/dogfood/classified-findings.json` (non-empty)
|
|
1060
|
+
- `docs/plans/evidence/fake-data-audit.md` (non-empty)
|
|
1061
|
+
- `docs/plans/evidence/product-reality/*/coverage.json` — at least one per feature in product-spec.md (non-empty); a missing file for any feature listed in product-spec.md is itself a BLOCK
|
|
1062
|
+
- `docs/plans/evidence/product-reality/*/findings.json` (one per feature; may be an empty array `[]` if no failures)
|
|
1063
|
+
- `docs/plans/evidence/manifest.json`
|
|
1064
|
+
|
|
1065
|
+
REQUIRED EVIDENCE FOR `project_type=ios`:
|
|
1066
|
+
- `docs/plans/ios-verify-report.md` (non-empty)
|
|
1067
|
+
- `docs/plans/ios-ux-review-report.md` (non-empty)
|
|
1068
|
+
- At least one `*.yaml` file in `maestro/`
|
|
1069
|
+
- At least one `*.png` screenshot in `docs/plans/evidence/maestro-runs/` from this build session
|
|
1070
|
+
- `docs/plans/evidence/manifest.json`
|
|
1071
|
+
|
|
1072
|
+
If any required file does not exist or is empty, do NOT dispatch Reality Checker. Log "REALITY CHECK BLOCKED" with missing-file list. Interactive: present blocker to user. Autonomous: return to the failing step and re-dispatch once; if still missing, abort.
|
|
513
1073
|
</HARD-GATE>
|
|
514
1074
|
|
|
515
|
-
**
|
|
1075
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 6 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 6 prompt below (Reality Checker + the 5 LRR chapters).
|
|
516
1076
|
|
|
517
|
-
|
|
1077
|
+
Call the Agent tool — description: "Evidence sweep" — subagent_type: `testing-reality-checker` — Prompt: "[CONTEXT header above] You are the Reality Checker — evidence-sweep role only. Default verdict: NONE. You receive evidence by FILE PATH only — never by paste. Use Read and Glob tools to verify each file exists, is non-empty, was modified within this build session, contains no placeholder strings ('TODO', 'PLACEHOLDER', 'TBD', 'FIXME', 'XXX').
|
|
518
1078
|
|
|
519
|
-
|
|
1079
|
+
Evidence paths to verify: [orchestrator pastes the precondition list per project_type].
|
|
1080
|
+
|
|
1081
|
+
For every Behavioral Test field in `docs/plans/sprint-tasks.md`, verify a corresponding evidence file exists in `docs/plans/evidence/[task-slug]/` AND that the test-stub-detector (per `protocols/verify.md` Step 2) does not flag the corresponding test file as a stub.
|
|
1082
|
+
|
|
1083
|
+
For every architecture MUST in `docs/plans/architecture.md`, verify the implementation file exists via Glob AND contains the named symbol via Grep.
|
|
1084
|
+
|
|
1085
|
+
**Dissent Log Revisit Pass:** Read `docs/plans/decisions.jsonl`. For every row where `status == \"open\"` and `revisit_criterion` is non-empty, semantically evaluate the criterion against current evidence. If triggered:
|
|
1086
|
+
1. Emit a structural finding in the manifest: `revisit-criterion-triggered: D-N-M — [criterion]`
|
|
1087
|
+
2. Append a PITFALL row to `docs/plans/learnings.jsonl` with `{pattern_type: \"PITFALL\", top_issue: \"[decision] — [criterion]\", fix_applied: \"[what build did instead]\", provenance: {decision_id: \"D-N-M\"}}`
|
|
1088
|
+
3. Flag the triggered decision — this feeds LRR as a potential cross-chapter concern
|
|
1089
|
+
|
|
1090
|
+
Write the evidence manifest to `docs/plans/evidence/reality-check-manifest.json` with fields `{file_path, sha256, byte_count, modified_time, verdict_contribution}` per file. Emit any structural findings surfaced during the sweep. DO NOT issue a combined verdict — that authority moved to the LRR Aggregator at Step 6.1 below."
|
|
1091
|
+
|
|
1092
|
+
### Step 6.1 — LRR: 5 chapter judges in parallel (ONE message)
|
|
1093
|
+
|
|
1094
|
+
Follow the Launch Readiness Review Protocol (`protocols/launch-readiness.md`). The net-5 panel: Eng-Quality (merged Eng+QA with PM chapter folded in), Security, SRE (includes Performance), A11y (NEW SEAT), Brand Guardian (REPLACES old Design mechanical check).
|
|
1095
|
+
|
|
1096
|
+
Dispatch 5 chapter judges in parallel. Each receives fresh context, its own evidence slice, and the chapter verdict schema from `protocols/launch-readiness.md`.
|
|
1097
|
+
|
|
1098
|
+
Call the Agent tool 5 times in ONE message. Note: the Eng-Quality chapter dispatches `code-reviewer` as primary, with a parallel `pr-test-analyzer` sub-dispatch for test-coverage adequacy evidence that feeds into the Eng-Quality verdict file.
|
|
1099
|
+
|
|
1100
|
+
1. Description: "LRR Eng-Quality chapter" — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] You are the Eng-Quality chapter of the Launch Readiness Review. Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1101
|
+
|
|
1102
|
+
Read: `docs/plans/architecture.md`, `docs/plans/design-doc.md` (PRD), `docs/plans/sprint-tasks.md`, `docs/plans/.task-outputs/`, `protocols/verify.md` check outputs from `.build-state.json`, test results from Phase 4 and 5, `docs/plans/evidence/product-reality/*/coverage.json` (Track B per-feature coverage). Also read `docs/plans/decisions.jsonl` for cross-chapter context.
|
|
1103
|
+
|
|
1104
|
+
Requirements coverage is sourced from Phase 5 Track B evidence — do NOT recompute. Read every `docs/plans/evidence/product-reality/*/coverage.json` (one per feature). Aggregate the per-feature `coverage_pct` and `status` fields into a single `requirements_coverage[]` array on your verdict, one entry per feature with `{feature_id, feature_label, status, coverage_pct, blocker_summary}` where `blocker_summary` is a short string distilling `missing_states + broken_transitions + unenforced_rules + persona_constraint_violations` from coverage.json. Any `MISSING` status is a BLOCK finding. Any `PARTIAL` is CONCERNS at minimum. If a `coverage.json` file is missing for a feature listed in product-spec.md, that itself is a BLOCK finding (Track B did not run for that feature — pipeline integrity issue).
|
|
1105
|
+
|
|
1106
|
+
Before writing the final verdict, spawn a parallel subagent dispatch: description: 'LRR test coverage adequacy' — subagent_type: `pr-test-analyzer` — prompt: 'You are a test-coverage auditor for the Eng-Quality LRR chapter. Read the test files under tests/, task-outputs/, and behavioral-test stub detector output. Evaluate: (1) do declared behavioral tests have non-stub bodies, (2) does coverage match the PR diff scope, (3) are edge cases covered, (4) are any tests flaky markers set. Return a JSON summary with test_coverage_score (0-100), stub_flagged_count, edge_case_gap_count, recommendations[]. Save to docs/plans/evidence/lrr/eng-quality-coverage.json.' Read the resulting eng-quality-coverage.json and fold its findings into your verdict.
|
|
1107
|
+
|
|
1108
|
+
Evaluate code quality + test coverage adequacy + architecture conformance + requirements coverage TOGETHER (single coherent view — merged from old Eng + QA chapters). Check: do declared behavioral tests actually exercise the features? Are there stub-flagged tests? Do tests match task acceptance criteria? Does the built code match architecture MUSTs? Are features all COVERED?
|
|
1109
|
+
|
|
1110
|
+
Write verdict to `docs/plans/evidence/lrr/eng-quality.json` per `protocols/launch-readiness.md` schema. Fields: `chapter=eng-quality`, `verdict` (PASS|CONCERNS|BLOCK), `override_blocks_launch` (false unless BLOCK), `evidence_files_read` (non-empty, MUST include eng-quality-coverage.json), `findings[]` (each with `severity`, `description`, `evidence_ref`, `related_decision_id` if blocker ties to a decisions.jsonl row), `requirements_coverage[]` (shape per the Track B aggregation paragraph above — `{feature_id, feature_label, status, coverage_pct, blocker_summary}`), `follow_up_spawned=false`, `follow_up_findings=null`. Eng-Quality CANNOT spawn follow-ups."
|
|
1111
|
+
|
|
1112
|
+
2. Description: "LRR Security chapter" — subagent_type: `security-reviewer` — Prompt: "[CONTEXT header above] You are the Security chapter of the LRR. Read: `docs/plans/evidence/fake-data-audit.md`, Phase 5 security audit output (from Step 5.1). Also read `docs/plans/decisions.jsonl` for context.
|
|
1113
|
+
|
|
1114
|
+
Evaluate auth model, input validation, secrets management, dependency vulnerabilities. Write verdict to `docs/plans/evidence/lrr/security.json` per schema. Fields: `chapter=security`, `verdict`, `override_blocks_launch`, `evidence_files_read` (non-empty), `findings[]` (with `related_decision_id` when applicable), `follow_up_spawned` (boolean), `follow_up_findings` (null or typed object).
|
|
1115
|
+
|
|
1116
|
+
Security MAY spawn ONE read-only follow-up investigation, but ONLY if verdict would be BLOCK — NOT on suspicion. This is tightened from current behavior. Follow-up: read-only, Read/Grep/Glob only, max 15 tool calls, self-report tool_calls_used. See `protocols/launch-readiness.md` for follow-up flow."
|
|
1117
|
+
|
|
1118
|
+
3. Description: "LRR SRE chapter" — subagent_type: `engineering-sre` — Prompt: "[CONTEXT header above] You are the SRE chapter of the LRR. Read: performance-audit outputs from Phase 5 (Step 5.1 performance auditor), Performance Benchmarker evidence, NFRs from `docs/plans/quality-targets.json` and `docs/plans/sprint-tasks.md`, reliability checks. Also read `docs/plans/decisions.jsonl` for context.
|
|
1119
|
+
|
|
1120
|
+
Evaluate whether the build meets NFR targets (response time, load handling, error rates) and is production-ready under load. Bundle-size budget violations (>25% over Scope budget) auto-block. Write verdict to `docs/plans/evidence/lrr/sre.json` per schema.
|
|
1121
|
+
|
|
1122
|
+
SRE MAY spawn ONE read-only follow-up investigation, but ONLY if verdict would be BLOCK. Same caps as Security."
|
|
1123
|
+
|
|
1124
|
+
4. Description: "LRR A11y chapter" — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] You are the A11y chapter of the LRR (NEW SEAT in this panel — closes the biggest coverage gap). Read: Phase 5 a11y audit output (from Step 5.1), WCAG 2.2 AA runtime check, per-page accessibility findings, `docs/plans/quality-targets.json` a11y section.
|
|
1125
|
+
|
|
1126
|
+
Scoring rules:
|
|
1127
|
+
- PASS if zero Serious + zero Critical findings
|
|
1128
|
+
- CONCERNS if 1-3 Serious + 0 Critical
|
|
1129
|
+
- BLOCK if any Critical OR >3 Serious
|
|
1130
|
+
|
|
1131
|
+
Write verdict to `docs/plans/evidence/lrr/a11y.json` per schema. A11y CANNOT spawn follow-ups."
|
|
1132
|
+
|
|
1133
|
+
5. Description: "LRR Brand Guardian chapter" — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Brand Guardian chapter of the LRR (REPLACES the old Design mechanical check — real taste judgment, not a 15-line mechanical gate). Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1134
|
+
|
|
1135
|
+
Read: `DESIGN.md` (full file — `## Overview > ### Brand DNA` is the locked 7-axis card from Phase 3.0; YAML tokens are what Phase 4 was supposed to honor; `## Do's and Don'ts` are the explicit guardrails), `docs/plans/design-references.md`, Playwright screenshots under `docs/plans/evidence/` matching production pages, Phase 3.6 Design Critic final score from `.build-state.json`.
|
|
1136
|
+
|
|
1137
|
+
Evaluate DRIFT: did the built product stay true to DESIGN.md (DNA + tokens + guardrails)? Score the gap on 7 DNA axes (Scope, Density, Character, Material, Motion, Type, Copy) + 5 craft dimensions (whitespace rhythm, visual hierarchy, motion coherence, color harmony, typographic refinement). Cite specific elements ('the hero padding at landing.tsx:42 is 32px but DNA calls for Airy density — should be 48px+') — never vague ('needs polish').
|
|
1138
|
+
|
|
1139
|
+
Write verdict to `docs/plans/evidence/lrr/brand-guardian.json` per schema. Fields per protocol. Brand Guardian CANNOT spawn follow-ups."
|
|
1140
|
+
|
|
1141
|
+
**Security/SRE BLOCK-only follow-up dispatch — SDK-gated (Stage 5 / task 5.3.1).** The read-only follow-up investigations spawned by the Security and SRE chapters (BLOCK-only trigger per `protocols/launch-readiness.md`) are dispatched via a TS switch: when the SDK flag is active (default), the orchestrator dispatches the follow-up through `claude-agent-sdk` with `maxTurns: 15` — a hard safety rail that prevents runaway remediation loops. When the SDK is disabled (`BUILDANYTHING_SDK=off`), fall back to the standard Agent tool dispatch with the same 15 tool-call cap self-reported via `tool_calls_used` (the markdown-mode cap documented in `protocols/launch-readiness.md`). If a follow-up exceeds 15 turns under SDK mode, the orchestrator flags to the user (interactive) or logs a warning and treats the parent chapter as BLOCK confirmed (autonomous) — do NOT let the subagent churn indefinitely.
|
|
520
1142
|
|
|
521
|
-
|
|
522
|
-
- If `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 7 — ship pipeline is optional (simulator-only is a valid end-state). If shipping, run asc-* agents + fastlane. Skip web Step 7.1 below.
|
|
523
|
-
- If `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 7 (Step 7.1 documentation + deploy notes).
|
|
1143
|
+
### Step 6.1a — PM coverage fold-in
|
|
524
1144
|
|
|
525
|
-
|
|
1145
|
+
PM coverage is a sub-input of the Eng-Quality chapter — evaluated inline within the Eng-Quality dispatch at Step 6.1 above against `design-doc.md` scope and emitted as a `requirements_coverage[]` field on `eng-quality.json`. The LRR Aggregator runs exactly once. Chapter count stays 5.
|
|
526
1146
|
|
|
527
|
-
|
|
1147
|
+
### Step 6.2 — LRR Aggregator (sequential, after all 5 chapter files exist)
|
|
528
1148
|
|
|
529
|
-
|
|
1149
|
+
Call the Agent tool — description: "LRR Aggregator" — INTERNAL inline role-string — Prompt: "You are the LRR Aggregator. You mechanically apply the 6 aggregation rules from `protocols/launch-readiness.md`. You may NOT self-approve — you cite the triggering rule number on every verdict.
|
|
530
1150
|
|
|
531
|
-
|
|
1151
|
+
**STEP 1 — FILE-COMPLETENESS CHECKPOINT:** Before applying any aggregation rule, use Glob to list `docs/plans/evidence/lrr/*.json` and verify ALL 5 expected chapter files exist and parse as valid JSON:
|
|
1152
|
+
- `eng-quality.json`
|
|
1153
|
+
- `security.json`
|
|
1154
|
+
- `sre.json`
|
|
1155
|
+
- `a11y.json`
|
|
1156
|
+
- `brand-guardian.json`
|
|
532
1157
|
|
|
533
|
-
|
|
534
|
-
|-------------|------|------|----------|--------|
|
|
1158
|
+
If any are missing or malformed, log 'LRR INCOMPLETE' with the missing file list, write a partial status to `docs/plans/evidence/lrr-incomplete.json`, and STOP — do not emit a combined verdict. This is the file-completeness checkpoint that closes the partial-glob race the current Aggregator is vulnerable to.
|
|
535
1159
|
|
|
536
|
-
|
|
1160
|
+
**STEP 2 — APPLY 6 RULES per `protocols/launch-readiness.md`:**
|
|
1161
|
+
1. ANY `override_blocks_launch: true` → combined_verdict = BLOCKED
|
|
1162
|
+
2. ALL verdicts PASS AND zero follow-ups spawned → combined_verdict = PRODUCTION READY
|
|
1163
|
+
3. ANY verdict BLOCK (with override_blocks_launch: false) → combined_verdict = NEEDS WORK + findings routed to fix loop
|
|
1164
|
+
4. ANY verdict CONCERNS → combined_verdict = NEEDS WORK, concerns logged
|
|
1165
|
+
5. Follow-up spawned AND follow_up.confirmed: true → treat parent chapter verdict as if BLOCK
|
|
1166
|
+
6. Contradictions between chapters on typed fields → combined_verdict = BLOCKED with cross-chapter contradiction finding
|
|
537
1167
|
|
|
538
|
-
|
|
1168
|
+
**STEP 3 — ON BLOCK VERDICT (the ⭐⭐ star rule — backward routing):** For each BLOCK finding in any chapter, read the `related_decision_id` field. Look up that row in `docs/plans/decisions.jsonl`. Find the `decided_by` field (author of the decision — per the `decided_by` free-form role-string convention in `protocols/decision-log.md`. The Aggregator matches on the string value directly. Common values: `architect` (Phase 2 architecture decisions), `design-brand-guardian` (Phase 3 Visual DNA lock), `implementer` (Phase 4 deviation rows), `human` (Gate 1/2 user decisions)). Route BACKWARD to the authoring phase with the finding as input. This replaces the current 'stop and wait' BLOCK behavior with author-aware re-entry.
|
|
539
1169
|
|
|
540
|
-
|
|
1170
|
+
**BLOCK sequentialization (Stage 4 A6 / task 4.4.3).** When multiple chapters return BLOCK in the same LRR round, the aggregator MUST process the BLOCK findings one-at-a-time in chapter declaration order (Eng-Quality → Security → SRE → A11y → Brand Guardian). DO NOT dispatch backward-routing re-entries or Security/SRE follow-up investigations in parallel — sequentialize to preserve deterministic commit ordering, avoid writer-owner lease contention on shared artifacts (`decisions.jsonl`, `lrr-routing.json`), and make the per-target-phase cycle-counter increments monotonic. Parallel BLOCK dispatch is a hard error.
|
|
541
1171
|
|
|
542
|
-
|
|
1172
|
+
Write routing decisions to `docs/plans/evidence/lrr-routing.json` with shape `[{finding_id, chapter, related_decision_id, authoring_phase, action: \"re-open\"}, ...]`.
|
|
543
1173
|
|
|
544
|
-
|
|
1174
|
+
**STEP 4 — ON NEEDS_WORK:** Classify findings & route to Phase 4 (code-level — single-task fix) or Phase 2 (structural — re-architect) or Phase 3 (visual — re-design). Same routing file.
|
|
545
1175
|
|
|
546
|
-
|
|
1176
|
+
**STEP 5 — ON READY:** Write `docs/plans/evidence/lrr-aggregate.json` with shape:
|
|
547
1177
|
|
|
548
|
-
|
|
1178
|
+
```json
|
|
1179
|
+
{
|
|
1180
|
+
\"combined_verdict\": \"PRODUCTION READY | NEEDS WORK | BLOCKED\",
|
|
1181
|
+
\"chapter_verdicts\": {\"eng-quality\": \"PASS|CONCERNS|BLOCK\", \"security\": \"...\", \"sre\": \"...\", \"a11y\": \"...\", \"brand-guardian\": \"...\"},
|
|
1182
|
+
\"triggered_rule\": <1-6>,
|
|
1183
|
+
\"findings\": [...aggregated from all chapters...],
|
|
1184
|
+
\"follow_ups_spawned\": [list of chapters that spawned follow-ups],
|
|
1185
|
+
\"backward_routing\": [...from lrr-routing.json if any...],
|
|
1186
|
+
\"timestamp\": \"ISO-8601\"
|
|
1187
|
+
}
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
Forward to Phase 7.
|
|
549
1191
|
|
|
550
|
-
|
|
1192
|
+
Cite triggering rule number in output. No verdict is valid without citing the rule."
|
|
551
1193
|
|
|
552
|
-
|
|
553
|
-
- **PITFALL:** [what failed, caused waste, or required excessive iterations]
|
|
554
|
-
- **HEURISTIC:** [project-specific tuning discovered during this build]
|
|
1194
|
+
### Step 6.3 — Verdict resolution
|
|
555
1195
|
|
|
556
|
-
|
|
1196
|
+
The LRR Aggregator's `combined_verdict` is the authoritative verdict. Resolution rules:
|
|
557
1197
|
|
|
558
|
-
|
|
1198
|
+
- **PRODUCTION READY** → log aggregate path to `.build-state.json` and `build-log.md`. Proceed to Phase 7.
|
|
1199
|
+
- **NEEDS WORK** → apply backward routing from `lrr-routing.json` per the re-entry template below. Max 2 NEEDS_WORK cycles before presenting to user (interactive) or proceeding with warning (autonomous).
|
|
1200
|
+
- **BLOCKED** → apply backward routing (⭐⭐ star rule) per the re-entry template below. NEVER proceed to Phase 7 with BLOCKED.
|
|
559
1201
|
|
|
560
|
-
|
|
1202
|
+
**Re-entry dispatch template (used by backward routing from LRR BLOCK / NEEDS_WORK, and by the Phase 5 → Phase 4 fix loop):**
|
|
1203
|
+
|
|
1204
|
+
```
|
|
1205
|
+
On re-entry from LRR BLOCK:
|
|
1206
|
+
INPUT passed to the re-opened phase:
|
|
1207
|
+
blocking_finding: {chapter, finding_id, severity, description, related_decision_id, related_files}
|
|
1208
|
+
prior_output: path to the phase's previous artifact
|
|
1209
|
+
decision_row: the row from decisions.jsonl containing original reasoning + authorship
|
|
1210
|
+
cycle_number: current backward-routing cycle count for this target phase (from .build-state.json.backward_routing_count_by_target_phase)
|
|
1211
|
+
downstream_phases_affected: list of phases that consume this phase's output (e.g., Phase 2 re-entry affects Phases 3, 4, 5, 6)
|
|
1212
|
+
TASK for the re-opened phase:
|
|
1213
|
+
Revise prior_output to address blocking_finding. Do NOT redo unaffected work. Emit a new decision_row documenting the revision rationale.
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
The orchestrator assembles this payload from `lrr-routing.json` + `decisions.jsonl` + the prior artifact path, then invokes the target phase's "on re-entry" branch (see Phase 2 Step 2.2, Phase 3, and Phase 4 implementer dispatches).
|
|
1217
|
+
|
|
1218
|
+
<HARD-GATE>
|
|
1219
|
+
The LRR Aggregator is the ONLY agent that may emit `combined_verdict`. No other agent — not the orchestrator, not Reality Checker, not individual chapters — may self-issue a combined verdict. This is the non-negotiable independence guarantee.
|
|
1220
|
+
|
|
1221
|
+
Max 2 NEEDS_WORK cycles. If LRR returns NEEDS_WORK a third time:
|
|
1222
|
+
- Interactive: present all remaining issues. Ask for direction.
|
|
1223
|
+
- Autonomous: log remaining issues. Proceed to Phase 7 with a warning in the Completion Report.
|
|
1224
|
+
Do not loop forever.
|
|
1225
|
+
</HARD-GATE>
|
|
1226
|
+
|
|
1227
|
+
**Writes:** `docs/plans/evidence/lrr/*.json`, `docs/plans/evidence/lrr-aggregate.json`, `docs/plans/evidence/lrr-routing.json`.
|
|
1228
|
+
|
|
1229
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|
|
1230
|
+
|
|
1231
|
+
---
|
|
1232
|
+
|
|
1233
|
+
## Phase 7: Ship
|
|
1234
|
+
|
|
1235
|
+
**Pre-ship Verify gate:** Run the Verify Protocol (INTERNAL inline — "Verify scaffolding") before any Step 7.1 dispatch. All 7 checks (Build → Type-Check → Lint → Test → Security → Diff Review → Artifacts) must pass. If any check FAILS, dispatch a fix agent with the error, re-verify. Max 2 fix attempts. Do not proceed to Step 7.1 until PASS.
|
|
1236
|
+
|
|
1237
|
+
**Mode-specific branch:**
|
|
1238
|
+
- `project_type=ios`: follow `protocols/ios-phase-branches.md` §Phase 7 — ship pipeline is optional (simulator-only is a valid end-state). If shipping, run asc-* agents + fastlane.
|
|
1239
|
+
- `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 7 (Step 7.1 documentation + deploy notes).
|
|
1240
|
+
|
|
1241
|
+
### Step 7.1 — Sequence: Documentation → Doc Metric Loop → ASO (iOS) → Deploy → Completion Report
|
|
1242
|
+
|
|
1243
|
+
**CONTEXT header:** Render `rendered_context_header` for phase 7 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 7 prompt below.
|
|
1244
|
+
|
|
1245
|
+
1. Description: "Technical Writer" — subagent_type: `engineering-technical-writer` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Write project docs: README with setup/architecture/usage, API docs if applicable, deployment notes. The README is the first thing a new developer reads — optimize for that reader. Commit: 'docs: project documentation'. Deployment target per the PRD (Vercel/Netlify/Railway/Fly.io/etc.) — include the deploy flow specific to that target in the README."
|
|
1246
|
+
|
|
1247
|
+
2. Documentation Metric Loop: Run the Metric Loop Protocol (callable service) on documentation. Define a metric based on completeness and whether a new developer could follow the README end-to-end. Max 3 iterations.
|
|
1248
|
+
|
|
1249
|
+
3. Description: "App Store Optimizer" (iOS only, conditional on ship) — subagent_type: `marketing-app-store-optimizer` — Prompt per `protocols/ios-phase-branches.md` §Phase 7 (asc-* flow — app name, subtitle, keywords, description, screenshots, privacy labels). Prepend CONTEXT header above. Skip entirely for web.
|
|
1250
|
+
|
|
1251
|
+
4. Description: "Deploy" — subagent_type: `engineering-devops-automator` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Deploy the app to the target from the PRD (`docs/plans/design-doc.md#tech-stack`). Run pre-deploy checks: build, env vars, secrets. Execute deploy. Verify the deployed URL returns 200 and serves the built app (not the placeholder). Report deploy URL and any smoke-test findings."
|
|
1252
|
+
|
|
1253
|
+
5. Description: "Completion Report" — INTERNAL inline role-string — Prompt: "[CONTEXT header above] You are the Completion Report writer. Draw verification surface from THREE sources: the LRR Aggregator's structured output (`docs/plans/evidence/lrr-aggregate.json`), the Reality Checker evidence manifest (`docs/plans/evidence/reality-check-manifest.json`), and the build state (`docs/plans/.build-state.json` — for backward-routing counts and mode transitions per state-schema v2). Do NOT draw from orchestrator summary prose. Present:
|
|
561
1254
|
|
|
562
1255
|
```
|
|
563
1256
|
BUILD COMPLETE
|
|
564
1257
|
Project: [name] | Tasks: [done]/[total] | Tests: [count] passing
|
|
565
|
-
Agents used: [list] | Verdict: [
|
|
1258
|
+
Agents used: [list distinct subagent_types] | Verdict: [combined_verdict from lrr-aggregate.json]
|
|
566
1259
|
Metric loops run: [count] | Avg iterations: [N]
|
|
567
|
-
Remaining: [any NEEDS WORK items]
|
|
1260
|
+
Remaining: [any NEEDS WORK items from lrr-routing.json]
|
|
568
1261
|
```
|
|
569
1262
|
|
|
570
|
-
|
|
1263
|
+
**Verification table (MANDATORY — pulled from LRR aggregator output):**
|
|
1264
|
+
|
|
1265
|
+
| Metric | Count | Status |
|
|
1266
|
+
|--------|-------|--------|
|
|
1267
|
+
| Behavioral Tests declared in spec | from sprint-tasks.md | — |
|
|
1268
|
+
| Behavioral Tests with non-stub bodies | from Eng-Quality findings | PASS if equal |
|
|
1269
|
+
| Behavioral evidence files written | count from manifest | — |
|
|
1270
|
+
| Maestro flows present (iOS) | count of maestro/*.yaml | — |
|
|
1271
|
+
| Test-stub detector flagged files | from Eng-Quality findings | PASS if 0 |
|
|
1272
|
+
| Combined verdict | from lrr-aggregate.json | — |
|
|
1273
|
+
| LRR chapter verdicts | list of chapter:verdict pairs | — |
|
|
1274
|
+
| LRR follow-ups spawned | count | — |
|
|
1275
|
+
| LRR triggered rule | rule number 1-6 | — |
|
|
1276
|
+
|
|
1277
|
+
```
|
|
1278
|
+
QUALITY METRICS (from .build-state.json schema v2)
|
|
1279
|
+
================================================
|
|
1280
|
+
Backward routing: <total> events
|
|
1281
|
+
by target phase: <\"2\": N, \"3\": N, \"4\": N>
|
|
1282
|
+
top decisions re-opened: <decision_id: N> (up to 3)
|
|
1283
|
+
|
|
1284
|
+
Mode transitions: <count> (autonomous ↔ interactive)
|
|
1285
|
+
<if count > 0: list each transition timestamp + direction>
|
|
1286
|
+
|
|
1287
|
+
Interpretation:
|
|
1288
|
+
- Backward routing count is a quality signal — fewer means Phase 1-3 caught issues earlier.
|
|
1289
|
+
- A target phase appearing 3+ times suggests structural rework (re-architect or re-design); investigate the related decisions.
|
|
1290
|
+
- Mode transitions ≥ 2 in autonomous mode indicates the build hit a manual-review threshold — review the LRR rule that triggered.
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1293
|
+
If there's a Verification Gap (declared != passing, or stub-flagged > 0), surface a top-level 'Verification Gap' section BEFORE writing the report to disk. Ask user: 'Write Completion Report with this verification gap surfaced? [YES/NO]'. In autonomous mode: write but flag prominently.
|
|
1294
|
+
|
|
1295
|
+
Create final commit. Mark all TodoWrite items complete. Update `.build-state.json`: 'Phase: 7 COMPLETE'."
|
|
1296
|
+
|
|
1297
|
+
**Writes:** `docs/plans/learnings.jsonl` (late learnings only — doc friction, deploy blockers, late-surfacing gaps). If no late learnings surfaced, skip. Row schema: `{run_id, timestamp, project_type, phase_where_learning_surfaced: \"7.x\", metric, top_issue, fix_applied, score_delta, pattern_type}`.
|
|
1298
|
+
|
|
1299
|
+
**Compaction checkpoint.** Update `.build-state.json` per the format above.
|