aiConnected v2 Layout Manager PRD (Implementation-Grade)
Version:1.0Date:
March 26, 2026Status:
Draft for Engineering HandoffOwner:
Product + Systems (aiConnected v2)
1) Purpose
Define the complete MVP-to-build specification for the aiConnected Layout Manager subsystem: a platform-native visual + conversational construction environment used by privileged roles to compose UI structure, bind functionality intent, invoke AI for missing capability/component creation, and move drafts through save/preview/test/publish/rollback safely. This PRD is intentionally scoped to Layout Manager and its required interfaces/dependencies, not full platform architecture.2) Problem Statement
Current workflow is fragmented across external coding tools, code review loops, Git pushes, deployment, and rework due to mismatch between requested UI/behavior and generated implementation.The platform needs a native workflow where:
- Editing starts on the actual live screen.
- Structural UI composition happens visually.
- Functional intent is wired at component level.
- Missing behavior/components are created through guided AI.
- Output returns as editable drafts.
- Publish control remains explicit and safe.
3) Product Definition
The Layout Manager is the platform’s native authoring layer for:- Structural composition of screens/pages/modules using registered builder-safe components.
- Component property editing and functional intent wiring.
- Data source binding via Connect Existing or Create New.
- AI-assisted generation of missing functionality and reusable components (MVP).
- Durable persistence as structured layout + bindings (source of truth).
- Controlled lifecycle: Save, Preview, Test, Publish, Rollback.
4) Goals
- Reduce iteration time from idea to testable platform-native draft.
- Eliminate dependency on external vibe-coding loops for routine platform evolution.
- Ensure reuse-first construction via registered components/capabilities.
- Keep architecture clean: structure vs aesthetics vs business logic separation.
- Provide safe operational lifecycle with validation, history, rollback, and role controls.
5) Non-Goals
- Full platform PRD (tenant inheritance, marketplace distribution, full plugin lifecycle).
- Unrestricted raw CSS/theme authoring in builder.
- Arbitrary raw-code editing by end users in canvas.
- Open-ended regular-user access to authoring tools.
- Auto-publish without privileged review/approval action.
6) Product Principles
- Builder-first UX: users compose and refine in-platform, on real surfaces.
- AI owns technical translation: user defines intent, AI handles implementation shape.
- Reuse before creation: existing components/capabilities are preferred and surfaced first.
- Structured truth: layout JSON + bindings + metadata is canonical.
- Safe extensibility: AI-generated outputs are draft, testable, and rollback-capable.
- Clear separation of concerns:
- Layout Manager = structure/composition/intent wiring
- Theme System = aesthetics/brand
- Module/Service Layer = business logic
7) Personas and Role Boundaries
7.1 Super User
Permissions:- Access all Layout Manager entry points.
- Create/edit module/page layouts in permitted shell zones.
- Use Data Source Connect Existing/Create New.
- Trigger AI creation for new functionality/components.
- Run Preview/Test/Publish/Rollback within authorized scope.
7.2 Agency Admin
Permissions:- Access Layout Manager within agency scope.
- Edit agency-available module layouts and create scoped layouts.
- Invoke AI creation within scope.
- Publish within agency-controlled boundaries (no global shell override).
7.3 Developer Mode (Limited)
Permissions:- Technical inspection and assisted debugging of builder artifacts.
- Restricted publish unless elevated.
- Access logs/validation detail views not shown to admins.
7.4 Regular Users
- No unrestricted access to Layout Manager editing, AI generation, publish, or rollback.
8) Scope Boundaries and Dependencies
8.1 In Scope
- Builder workspace IA and interactions.
- Component registry integration.
- Layout source-of-truth schemas.
- Data source binding UX and contracts.
- AI orchestration states and returns.
- Lifecycle operations and validation model.
- Role-based access and builder-scope security controls.
8.2 Out of Scope (Referenced Dependency Only)
- Full theming subsystem internals.
- Full backend/module platform lifecycle policies.
- Full shell routing governance.
- Tenant inheritance architecture details.
- Marketplace/export workflows.
8.3 Required Dependencies
- Auth/RBAC service.
- Component Registry service.
- Capability/Endpoint Registry service.
- AI orchestration service.
- Build/deploy pipeline interface.
- Theme token service (read-only in builder context).
- Versioning and release metadata store.
9) Assumptions (Strong Defaults)
- Layout Manager persists state in a dedicated
layout_definitionsdomain store with version records. - Canvas rendering engine is React-based and supports nested tree editing.
- AI operations are asynchronous jobs with resumable status polling/streaming.
- Preview/Test run against isolated draft runtime context before Publish.
- Rollback uses immutable published snapshots.
- Component registry enforces compatibility metadata before component appears in library.
- Reusable AI-generated component publication requires validation + privileged approval.
10) Information Architecture and Entry Points
10.1 Entry Point A: In-Context Edit on Live Screens
- Privileged user sees edit trigger (pencil icon) on supported live screen.
- Clicking trigger opens Layout Manager with route context, current layout draft/published baseline loaded.
- User edits in context; Save/Preview/Test/Publish accessible per permission.
10.2 Entry Point B: Admin Sidebar
Path:Layout Manager
Modules- Browse existing module layouts/screens.
- Open existing draft or published version for editing.
Create New- Start conversational creation for new page/screen/module interface/capability-linked draft.
10.3 Workspace IA (Mandatory)
- Left Panel: Component library + sticky actions.
- Search, categories, draggable items, recent/favorites (optional but recommended for MVP).
- Bottom sticky controls:
SaveandPreview, side-by-side,50/50width.
- Center Panel: Canvas.
- Nested structural editing (sections/containers/components).
- Selection, drag/drop, reordering, duplicate, delete, move between valid containers.
- Right Panel (Tabbed):
Hierarchy(tree)PropertiesHistory(change log + undo/redo)
11) Detailed UX Flows
11.1 Edit Existing Screen Flow
- Enter from in-context trigger or Modules list.
- Layout baseline loads, with current draft if exists.
- User modifies tree on canvas.
- Properties update for selected node.
- Validation status updates in real time.
- User Save -> Preview -> Test -> Publish or continue editing.
11.2 Create New Flow (MVP Core)
- User opens
Layout Manager > Create New. - Conversational intake captures intended module/page/capability.
- AI clarification interview resolves ambiguity.
- Reuse check runs against existing capabilities/components.
- AI prepares plan and generates initial draft structure + bindings.
- System transitions to builder with returned editable draft.
- User refines visually, tests, and publishes.
11.3 Selected Component Behavior
- Click component in canvas or hierarchy.
- Properties tab shows:
- Basic settings (label/content/options).
- Structural settings (size, placement constraints).
- Limited interaction settings.
- Data Source section (mandatory when component type supports binding).
- Changes are logged in History and reversible.
11.4 Data Source Flow: Connect Existing
- Open Data Source section.
- Select
Connect Existing. - Search capability registry (endpoint/service/workflow/resource).
- Validate compatibility mapping with component contract.
- Bind and save; unresolved required mappings become blocking issues.
11.5 Data Source Flow: Create New
- Select
Create New. - User states intended behavior in natural language.
- AI workflow state sequence executes (defined in Section 15).
- AI returns draft capability + binding proposal.
- Builder reopens with editable result and explicit validation state.
11.6 AI-Generated Reusable Component Flow
- Component missing in registry for needed UX pattern.
- User requests component creation from builder context.
- AI clarifies behavior, props, structural footprint, accessibility expectations.
- AI generates component draft package and registry metadata draft.
- Validation + approval gates.
- Approved component appears in registry and reusable library.
11.7 History / Undo / Redo
- Every user action and significant AI action emits a history entry with readable label.
- Undo/redo operates on deterministic layout operations.
- Branching history is managed per draft session; Publish snapshots remain immutable.
12) Source of Truth: Data Model and Contracts
12.1 Canonical Data Objects
LayoutDefinition(logical identity and metadata)LayoutVersion(immutable snapshot; draft/published/rolled_back)LayoutNode(tree node)ComponentBinding(data/capability linkage)AIDraftArtifact(capability/component draft outputs)ValidationReportHistoryEvent
12.2 JSON Schema Example: LayoutDefinition
12.3 JSON Schema Example: LayoutVersion
12.4 JSON Schema Example: AI Create-New Draft Artifact
13) Component Registry Contract (Builder-Compatible)
13.1 Required Metadata Fields
componentKey(stable unique key)displayNamecategoryversionsource(system|ai_generated)footprint(block/inline/container requirements)allowedParentsallowedChildren(if container)propSchema(typed, editable property model)supportsDataSource(boolean)bindingSchema(if supports data source)capabilityCompatibility(optional list of compatible target types)a11yContract(required accessibility guarantees)status(draft|approved|deprecated)deprecationPolicylink/id
13.2 Registry API Contract Example
GET /api/layout-manager/component-registry/search?q=phone&category=input
13.3 Compatibility Rule
A component is draggable only when:- Registry status is
approved. - Parent-child context is valid by footprint contract.
- Required prop defaults and validation hooks are available.
14) API and Interface Contracts
14.1 Session and Draft APIs
POST /api/layout-manager/sessions
Input:screenId | moduleId, entry source (in_context|admin_modules|create_new)
Output: session id + loaded draft/published refs.GET /api/layouts/{layoutId}/draftPOST /api/layouts/{layoutId}/savePOST /api/layouts/{layoutId}/autosave
14.2 Lifecycle APIs
POST /api/layouts/{layoutId}/previewPOST /api/layouts/{layoutId}/testPOST /api/layouts/{layoutId}/publishPOST /api/layouts/{layoutId}/rollback
14.3 Binding APIs
GET /api/capabilities/searchPOST /api/layouts/{layoutId}/bindings/connect-existingPOST /api/layouts/{layoutId}/bindings/create-new/startGET /api/layouts/{layoutId}/bindings/create-new/{jobId}
14.4 AI Orchestration APIs
POST /api/layout-manager/ai/jobsGET /api/layout-manager/ai/jobs/{jobId}POST /api/layout-manager/ai/jobs/{jobId}/approve-planPOST /api/layout-manager/ai/jobs/{jobId}/return-to-builder
14.5 Event Stream Interface
layout.session.events (SSE/WebSocket):
AUTOSAVE_SUCCESSVALIDATION_UPDATEDAI_WORKFLOW_STATE_CHANGEDHISTORY_APPENDEDPREVIEW_READYTEST_RESULT_READYPUBLISH_COMPLETEDROLLBACK_COMPLETED
15) AI Orchestration Behavior (Mandatory State Machine)
Required states:intent_captured -> clarifying -> reuse_check -> plan_ready -> draft_generated -> builder_returned
15.1 State Definitions
intent_captured
User intent accepted, normalized, and linked to context node/layout.clarifying
AI asks focused questions to resolve ambiguity.reuse_check
AI queries component/capability registries; ranks reuse candidates.plan_ready
AI produces implementation plan and proposed artifacts.draft_generated
AI creates draft artifacts (bindings/capabilities/components/layout diffs).builder_returned
Draft merged into editable builder state with validation annotations.
15.2 AI Decision Rules
- Prefer reuse over net-new creation when compatibility score threshold is met.
- If multiple valid approaches exist, choose least-risk architecture and explain rationale in plan metadata.
- Never auto-publish.
- On failure, isolate AI artifact and preserve user draft unchanged.
15.3 AI Failure Isolation
- AI job failure cannot corrupt latest saved draft.
- Partial artifacts remain quarantined until validated or discarded.
- User can continue manual structural edits while AI retries.
16) Lifecycle Definition: Save, Preview, Test, Publish, Rollback
16.1 Save
- Persists current draft snapshot and history cursor.
- Runs lightweight structural validation.
- Does not affect live published experience.
16.2 Preview
- Builds renderable preview from draft snapshot + mock/live-safe bindings.
- Shows UI exactly as composed, including nested structure and resolved component props.
- Marks unresolved bindings visibly.
16.3 Test
- Executes functional checks for:
- Existing capability bindings.
- AI-created draft capabilities/components.
- Required input/output mapping.
- Produces pass/fail report with blocking/warning classification.
16.4 Publish
- Requires no blocking issues and valid permission.
- Creates immutable published snapshot.
- Triggers downstream implementation sync/deploy pipeline.
- Maintains audit entry with actor/time/version.
16.5 Rollback
- Select previous published version.
- System sets selected snapshot as active published state.
- New rollback event/version recorded.
- Rollback is atomic and reversible via forward publish.
17) Validation Model (Blocking vs Warning)
17.1 Blocking
- Invalid layout tree structure.
- Missing required component props.
- Broken component references.
- Required Data Source unset for binding-required component.
- Unresolved AI draft dependency required for behavior.
- Publish permission violation.
- Incompatible parent-child placement by footprint contract.
17.2 Warning
- Deprecated component usage.
- Suboptimal reuse opportunity detected.
- Non-critical accessibility improvement recommended.
- Performance risk patterns (excessive nested heavy components).
- Optional test coverage missing for non-critical branch.
17.3 Validation Output Contract
18) Testing Requirements (Builder Scope)
- Visual Preview Tests
- Render correctness for nested layouts and component props.
- Functional Binding Tests
- Existing capability response mapping checks.
- AI-Generated Draft Tests
- Draft capability/component smoke tests before publish.
- Lifecycle Tests
- Save/Preview/Test/Publish/Rollback transitions and state integrity.
- History Integrity Tests
- Undo/redo determinism across mixed user + AI actions.
- RBAC Tests
- Role restrictions for edit/publish/rollback.
19) Performance Requirements (MVP Targets)
- Canvas drag/drop and selection interactions should feel immediate in normal drafts.
- Component search results should return near-instantly for typical registry sizes.
- Property edits should reflect in canvas without perceptible lag.
- Autosave must complete in background without blocking editing.
- AI states must stream progress updates; no silent waiting.
- Preview generation should be fast enough for iterative workflows.
20) Reliability and Resilience Requirements
- Autosave with draft recovery after interruption/reload.
- Coherent history model across session reconnects.
- AI failure isolation from main draft integrity.
- Registry stability for approved reusable components.
- Rollback safety with immutable published snapshots.
- Idempotent publish/rollback operations.
- Recovery UX that offers “Restore last autosaved draft” when crash detected.
21) Security and Governance (Builder Scope)
- RBAC enforcement at API and UI layers.
- Scope-aware authorization (global vs agency).
- Audit logging for Save/Test/Publish/Rollback and AI generation actions.
- Capability access controls on Connect Existing search results.
- Prompt and artifact handling with PII-safe logging policy.
- No unrestricted regular user access to authoring endpoints.
22) MVP Definition
MVP includes:- Both entry points (in-context + admin sidebar modules/create new).
- Full 3-pane workspace with mandated tabs and sticky Save/Preview controls.
- Nested structural editing and hierarchy tree.
- Properties panel with mandatory Data Source modes.
- AI workflow states exactly as specified and integrated into builder return flow.
- AI-assisted creation for missing functionality and reusable components.
- Save/Preview/Test/Publish/Rollback lifecycle.
- Blocking/warning validation model.
- History log + undo/redo + AI action entries.
- RBAC boundaries for Super User, Agency Admin, limited Developer mode.
23) MVP Acceptance Criteria
- Privileged user can launch Layout Manager from live screen edit trigger and edit current screen in context.
- Privileged user can launch from
Layout Manager > Modulesand open/edit module screens. - Privileged user can launch
Layout Manager > Create New, complete conversational intake, and receive editable generated draft in builder. - Left panel contains searchable component library with sticky
SaveandPreviewbuttons side-by-side at equal width. - Center canvas supports nested sections/containers/components with drag/drop, reorder, duplicate, delete.
- Right panel includes tabs:
Hierarchy,Properties,History. - Selecting any component updates Properties with valid editable fields for that component.
- Binding-capable components always expose Data Source with both modes:
Connect ExistingandCreate New. Connect Existingallows searchable capability selection and validated binding mapping.Create Newruns required AI state sequence:intent_captured -> clarifying -> reuse_check -> plan_ready -> draft_generated -> builder_returned.- AI-generated result is editable in builder and not locked.
- Save persists draft without publishing.
- Preview renders draft representation with binding statuses.
- Test returns actionable functional report for existing and AI-generated connections.
- Publish is blocked when blocking issues exist.
- Publish succeeds only for authorized roles and creates immutable published snapshot.
- Rollback restores selected published snapshot safely and logs audit event.
- History shows user and notable AI actions with undo/redo functioning deterministically.
- Autosave and recovery restore draft after simulated interruption.
- AI failure does not corrupt saved draft or published state.
- Regular users cannot access authoring APIs or UI entry points.
- Reusable AI-generated component, once approved, appears in component library for later reuse.
24) Phased Roadmap
Phase 1 (MVP Build)
- Core builder IA and structural editing.
- Registry-driven component library.
- Data Source Connect Existing/Create New.
- AI workflow core states and draft return.
- Lifecycle controls and validation model.
- RBAC + audit + autosave/recovery.
Phase 2 (Hardening and Scale)
- Enhanced test harnesses and simulation data tooling.
- Advanced diff visualization and change review before publish.
- Better AI plan explainability and comparison options.
- Component deprecation assistant and migration prompts.
Phase 3 (Advanced Authoring)
- Multi-user concurrent editing controls.
- Richer generated component quality gates.
- Expanded scoped template kits and reusable flow blueprints.
- Broader orchestration integrations (still governed by structured source model).
25) Open Risks and Mitigations
- Risk: AI creates low-quality or over-complex artifacts.
Mitigation: strict plan review metadata, validation gates, draft-only return, approval workflow. - Risk: Registry inconsistency causes runtime/editor mismatch.
Mitigation: registry contract validation and compatibility checks at load and drop-time. - Risk: Scope creep into full theme editor.
Mitigation: enforce structural-only property schema and theme-system boundary. - Risk: Publish pipeline latency harms confidence.
Mitigation: explicit state feedback, progress telemetry, and rollback-first safety. - Risk: Role boundary confusion in multi-tenant contexts.
Mitigation: central RBAC policies + scope labels in UI + API enforcement. - Risk: History complexity with mixed AI/user events.
Mitigation: operation-based event model with deterministic undo semantics.
26) Requirements Traceability Matrix
| Requirement ID | Requirement Summary | PRD Section(s) |
|---|---|---|
| R1 | Layout Manager is core to aiConnected v2 | 1, 3, 22 |
| R2 | Platform-native visual + conversational environment | 3, 11, 15 |
| R3 | shadcn/ui-compatible default building blocks | 3, 13 |
| R4 | Source of truth = structured layout + bindings | 3, 12 |
| R5 | AI-assisted missing functionality + reusable components is MVP | 11.5, 11.6, 15, 22, 23 |
| R6 | Separation: layout vs theme vs backend logic | 6, 8 |
| R7 | Required IA: left/center/right + tabs + sticky controls | 10.3, 23 |
| R8 | Required entry points: in-context + admin modules/create new | 10.1, 10.2, 23 |
| R9 | Data Source mandatory with Connect Existing/Create New | 11.4, 11.5, 23 |
| R10 | Required AI workflow states sequence | 15, 23 |
| R11 | Lifecycle: Save, Preview, Test, Publish, Rollback | 16, 23 |
| R12 | Role boundaries: Super User, Agency Admin, limited Developer; no unrestricted regular users | 7, 21, 23 |
| R13 | Validation model: blocking vs warning | 17, 23 |
| R14 | Reliability: autosave/recovery, coherent history, AI failure isolation, rollback safety | 18, 20, 23 |
| R15 | Acceptance criteria implementation-verifiable | 23 |
| R16 | Include explicit API/interface contracts and schema examples | 12, 14, 17.3 |
| R17 | Include architecture boundaries and subsystem dependencies | 8 |
| R18 | Include component registry contract | 13 |
| R19 | Include phased roadmap and open risks | 24, 25 |
| R20 | Focus on Layout Manager subsystem, not full platform PRD | 1, 8.2 |