Architecture: How to optimize the platform generation pipeline for speed, ...

Documentation for Sessions

🏗️ Architecture: How to optimize the platform generation pipeline for speed, ...

Date: 2026-03-23
Time: 19:52:04 UTC
Session: gspace1-261.9
Agent: backend
Confidence: 92%
Status: ✅ Documented


📋 Decision Context

Question:

How to optimize the platform generation pipeline for speed, cost, and interactivity?

Task: S257: Platform generation pipeline optimization


🎯 Decision Made

Chosen:

4-change optimization: (1) Switch default outputMode from VISUAL to CODE — activates existing S246 progressive preview code and removes visual from critical path. (2) Defer visual to background Haiku calls. (3) Enable Anthropic prompt caching on EXECUTE system prompts via cache_control content blocks. (4) Partial app shell synthesis with GeneratingComponent placeholder for progressive preview.

Options Considered:


💭 Reasoning

The generation pipeline had three problems: slow (15 min to first preview), expensive (~$2.50/gen), and unresponsive (dead screen). Root cause analysis revealed: default VISUAL mode meant SSE events carried no files (S246 progressive preview was dead code), the implement.prompt.md system prompt was re-sent identically for every module (no caching), and visual path ran in the critical path. Per-phase model routing was already fully wired (S212). Cost savings are modest (~11%) but time-to-first-preview drops from 15 min to ~3 min.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation