H1MOLINO — LOCKED EXECUTION PLAN
H20. CURRENT BASELINE
The following are treated as stable enough to continue:
- document generation
- AI → document write flow
- engine/wagon pagination
- section ordering
- overflow splitting
- page-fit / layout baseline
- hidden/default section behavior
Document generation can now be built on as a working base.
H21. LOCKED PRINCIPLES
H3Core separation
- AI = content or structured intent
- Document = structure + projection
- Folio = rendering + pagination
- Actions = persistence + orchestration
- Entities = canonical domain truth
H3Persistence rule
- UI emits intent
- local state updates immediately
- server action persists
- revalidate rebuilds
- Folio re-renders from persisted truth
H3Boundaries
- no Prisma in pages or components
- no mutation in pages
- no bypassing
queueSave - no duplicate persistence authorities
- no speculative schema redesign during this phase
H22. FREEZE
Do not redesign these while executing the next milestone:
- Prisma schema
- Folio engine architecture
- Document route architecture
- engine/wagon aggregate model
queueSave → onSave → action → Prisma → revalidateensureBlocks- pagination reducer contracts
Allowed:
- bugfixes
- naming cleanup
- compatibility cleanup
- action routing
- toolbar wiring
- sidebar tool cleanup
- AI mode simplification
- page builder section fixes
H23. SYSTEM MODEL
H3Domain truth
Canonical truth lives in entities and DB:
- Project
- Trip
- Experience
- Product
- Offer
- Order
- LineItem
- related entities
H3Document role
Document is:
- projection container
- orchestration surface
- editable working surface
- export surface
Document is not:
- domain truth for all entities
H3Folio role
Folio is:
- deterministic renderer
- flow normalizer
- pagination distributor
- page composer
Folio is not:
- business logic
- persistence layer
- domain truth
H3Action role
Actions are:
- sole mutation authority
- Prisma boundary
- orchestration layer for internal and external tools
H24. DOCUMENT CONTRACT
H3Canonical field names
Use only:
topSurfaceSectioncontentSections
Never use as canonical:
conentSectioncontentSection
H3Engine / wagon contract
- engine owns page-1 surface state
- wagon pages persist overflow page surfaces
- repagination rebuilds from engine + persisted wagon surfaces
- wagon pages remain editable
- wagon edits persist first, then repaginate safely
H3Save loop
User intent
→ queueSave
→ commitUpdate
→ local UI update
→ onSave
→ server action
→ Prisma write
→ revalidate
→ server rebuild
→ PaperStack refresh
H25. STRICT EXECUTION ORDER
- mode cleanup
- AI write fix
- data contract fix
- coaching router
- toolbar command classification
- Apps Script generic tool layer
- sidebar tool cleanup
- page builder section re-activation and fix
- sponsor system
- public trips UI
- magazine/export refinement
- CSS homogenization
- deploy
H26. STEP DETAILS
H2STEP 1 — MODE CLEANUP
H3Goal
Reduce user-facing AI modes to the canonical safe set.
H3Canonical type
export type AIMode = "general" | "coaching";
H3Rule
Keep internal pipelines hidden if they still exist, but not user-selectable.
H3UI result
Keep only:
generalcoaching
H3Stop check
- only 2 modes visible
- no local duplicated mode unions
- no TS mode drift
H2STEP 2 — AI WRITE FIX
H3Goal
AI writes content, not document structure.
H3Rules
- AI never overwrites title
- AI writes into
topSurfaceSection contentSectionsstays empty unless an explicit structured pipeline needs it- AI does not decide final document layout
H3Stop check
- AI output visible in document
- title preserved
- no pagination regression
H2STEP 3 — DATA CONTRACT FIX
H3Goal
Eliminate naming drift and silent corruption.
H3Actions
- replace all
conentSection - replace remaining
contentSectionusages where they still act as canonical data names - enforce shape before persist
H3Minimum invariant
topSurfaceSectionmust be arraycontentSectionsmust be array- visibility flags must be boolean or undefined
H3Stop check
- no field drift
- no undefined surface crashes
- no old field names in active document flow
H2STEP 4 — COACHING ROUTER
H3Goal
Make coaching a structured router instead of a parallel loose mode.
H3Rule
general= plain content generationcoaching= route-aware structured generation / action preparation
H3Minimal routing
- trip context → trip planning/generation
- document context → document generation/structure
- fallback → general
H3Stop check
- coaching routes correctly
- general unchanged
- no document regression
H2STEP 5 — TOOLBAR COMMAND CLASSIFICATION
H3Goal
Turn toolbar into the canonical execution surface.
H3Each button must be classified as one of:
- open sidebar tool
- direct document action
- external export/action
- navigation
H3Immediate direct command set
- New Doc
- Open Docs
- Browse
- Export PDF
- Commit & Reflow
- Paginate
- Add Page
H3Rule
No mixed ad hoc button behavior.
H2STEP 6 — APPS SCRIPT GENERIC TOOL LAYER
H3Goal
Standardize external Google Workspace execution.
H3Architecture
- Apps Script endpoints = atomic capability layer
- Next server actions = orchestration layer
- toolbar = execution surface
- sidebar = composition surface
- entities/sections = payload/context sources
H3First generic tools
docs.createdocs.exportPdfgmail.sendcalendar.createEventsheets.appendRowsdrive.sharedrive.list
H3Rule
Apps Script performs side effects only. Next actions handle business logic, persistence, and revalidation.
H2STEP 7 — SIDEBAR TOOL CLEANUP
H3Goal
Make sidebar the canonical composition surface.
H3Sidebar responsibilities
- entity controllers
- AI composition zone
- payload/context preparation
- scoped tool registries
H3Rule
Sidebar tools prepare and route work. They do not become uncontrolled side-effect surfaces.
H2STEP 8 — PAGE BUILDER SECTION RE-ACTIVATION
H3Goal
Re-enable and stabilize project page builder sections already present in the codebase.
H3Required outcome
- sections load correctly
- sections save correctly
- sections can be edited repeatedly
- sections persist and reload correctly
- section naming and field alignment matches current canonical patterns
H3Constraint
This is a repair/reactivation task, not a redesign.
H2STEP 9 — SPONSOR SYSTEM
H3Scope
- Assignment / WeekAssignment if still required
- ActivitySelector
- ForecastPreview
- WeekGrid
- ActiveWeek
H3Constraint
No broader schema redesign beyond the required assignment unit.
H2STEP 10 — PUBLIC TRIPS UI
H3Role
Separate public interface from Folio/document internals.
H3Documents/Folio
- internal planning
- drafting
- orchestration
- export
- offer building support
H3Public Trips App
- trip browsing
- date/session selection
- pricing display
- booking path
- FareHarbor links/widgets
- custom inquiry path
H3Rule
Documents support trip operations but are not the public trip UI.
H2STEP 11 — MAGAZINE / EXPORT REFINEMENT
H3Rule
Document → transformed output only.
No duplication of truth. No secondary editable truth.
H3Includes
- magazine transformation
- export refinements
- structured publishing outputs
H2STEP 12 — CSS HOMOGENIZATION
H3Do only after behavior is stable.
H3Target surfaces
- page
- section
- card
- label
- CTA
- document shell consistency
- sidebar/layout consistency
- page builder consistency where applicable
H2STEP 13 — DEPLOY
H1STAGE 2
Only after:
- AI modes simplified
- toolbar classified
- first external tools wired
- sidebar authority cleaned
- page builder sections reactivated
- sponsor/trips direction stable
H27. AI / TOOL / UI RELATION
H3Final role split
- Toolbar = execute
- Sidebar = compose
- AI general = generate content
- AI coaching = generate structured intent / fill drafts / route work
- Actions = persist and orchestrate
- Apps Script = execute Google side effects
H3Coaching target
Prompt → structured intent → prefilled form / payload / draft entity → user tweaks if needed → action executes → result persists
Possible results:
- prefilled Trip draft
- prefilled Product draft
- prefilled Experience draft
- generated Offer doc
- created meeting/event schedule
- exported Google Doc
- logged activity
H28. APPS SCRIPT CONTRACT
H3Canonical rule
Unify the interface, not necessarily every internal script implementation.
H3Standardize
- request envelope
- response envelope
- action naming
- auth
- error format
- request id / logging
H3Rule
Apps Script remains generic and atomic. Next server actions remain domain-aware and orchestration-aware.
H29. SUCCESS STATE FOR THIS MILESTONE
H3Framework completion checkpoint
- AI general/coaching modes stable
- document generation stable
- document editing stable
- pagination stable enough for production continuation
- toolbar works as execution router
- sidebar works as composition router
- first Google/App Script generic tools wired
- page builder sections active and stable again
H3Product continuation checkpoint
- sponsor system can proceed safely
- public trips UI can proceed as a separate surface
H210. FINAL PRINCIPLE
AI provides content or structured intent. Document system owns structure. Folio owns rendering and pagination. Actions own persistence and orchestration. External tools execute side effects.