Skip to content

Phase 5 — AI assistance (overlay)

AI is not its own phase — it overlays every other phase. You meet it in three distinct places:

  1. Decompose Wizard — fires after Phase 3 when you check “Use AI scaffold”. Idea → modules → features → criteria in ~90 seconds.
  2. Persona Critique — right pane in Phase 4. 5 default personas review the active block; 3 specialty personas behind the picker.
  3. Pattern D — Layer 2 suggestions in the Six-tab editor’s Behavior tab. AI generates structured action chains / view trees / scenarios.

This page covers all three.

A 4-step modal that turns a 1-2 sentence project idea into a full project tree.

┌──────────────────────────────────────┐
│ Pick the archetype: │
│ ◉ SaaS B2B ○ SaaS B2C │
│ ○ Mobile ○ Internal │
│ ○ API ○ CLI │
│ ○ Other │
│ │
│ Describe your idea (≥ 20 chars): │
│ ┌────────────────────────────────┐ │
│ │ A mobile habit tracker (iOS …) │ │
│ │ │ │
│ └────────────────────────────────┘ │
│ │
│ [ Suggest modules → ] │
└──────────────────────────────────────┘

7 archetypes seed the prompt with archetype-specific module patterns:

ArchetypeTypical modules suggested
saas-b2bAuth · Billing · Tenancy · Integrations · Admin
saas-b2cAuth · Profile · Notifications · Discovery · Subscription
mobileOnboarding · Habit list · Streak engine · Notifications · Settings
internalRoles · Forms · Reports · Workflow · Admin
apiAuth · Resources · Webhooks · Idempotency · Docs
cliCommands · Config · Output · Plugins · Update
other(open-ended; LLM picks)

Click Suggest modules → posts to POST /ai/decompose/modules with { archetype, ideaText }. Server returns 5-7 modules. Cached at sha256(archetype + ideaText + model).

If cached: a small toast “Cached AI response (free)” — repeated tries on the same idea are instant + free.

The wizard shows the suggested modules as a checklist:

☑ Habit list — Add, edit, archive habits with frequency rules.
☑ Streak engine — Compute current/longest streaks, handle timezones.
☑ Notifications — Daily reminders, AI-timed nudges.
☐ Social — Friends, leaderboards (out of scope per spec).
☑ Settings — Profile, theme, notification prefs.
[ ← Back ] [ Suggest features → ]

Uncheck what you don’t want. Need ≥ 1 kept to proceed.

Step 3 — Suggest features per kept module

Section titled “Step 3 — Suggest features per kept module”

Parallel calls to POST /ai/decompose/features, one per kept module. Each returns 4-7 feature suggestions:

Habit list
☑ Add new habit — User can add a habit with name + frequency.
☑ Edit habit — Change name / frequency / archive.
☑ Daily check-in — Tap to log today's completion.
☐ Bulk import — Defer to v2.
☑ Search & filter — Filter by tag, frequency.
Streak engine
☑ Compute current streak — From last consecutive checked days.
☑ Compute longest streak — All-time max.
☐ Streak freeze power-up — Premium feature.
☑ Timezone handling — Anchor to user's local midnight.
[ ← Back ] [ Suggest criteria → ]

Per-feature checkboxes; uncheck per-module. Same caching strategy.

Step 4 — Suggest criteria per kept feature

Section titled “Step 4 — Suggest criteria per kept feature”

Parallel calls to POST /ai/decompose/criteria, one per kept feature. Each returns 3-5 EARS-structured criteria:

Add new habit
☑ WHEN user submits valid name → habit appears in list within 200ms
☑ IF name is empty → form shows "Name required" inline
☑ IF user has 50 habits (free tier limit) → upgrade modal appears

This is the only step where you cannot uncheck partial criteria for a single feature — keep the feature or drop it. Granular criteria editing happens later in the workspace.

Click Install → the wizard mutes UI and fires:

For each kept module:
POST /api/projects/:projectId/blocks { atomKind: "module", title, metadata }
For each kept feature in module:
POST /api/projects/:projectId/blocks { atomKind: "feature", title, parentId, metadata }
For each kept criterion in feature:
POST /api/projects/:projectId/blocks { atomKind: "criterion", title, parentId, metadata }

Bulk endpoint coming in W12. For now sequential POSTs. ~5-10 seconds for a typical 5-module / 20-feature / 60-criterion seed.

On success the wizard closes; the workspace tree pane refreshes; the user lands inside the first kept module + first kept feature, ring at ~30%.

/projects/:id/workspace?wizard=1 → the wizard renders open by default. Triggered by:

  • “Use AI scaffold” checked at project creation.
  • Dashboard’s ”✨ AI Decompose” quick action.
  • Sample gallery click.

?wizard=0 (or no param) → the workspace renders normally; user opens wizard manually from the right pane.

Right-pane sub-tab. 5 personas visible by default + 3 in the picker overflow:

IDPersonaEmojiSpecialty
coachCoach🎓Gap-finder. What’s missing? Edge cases, error paths, untested criteria.
pm-criticPM Critic📋Tightens user stories, value props, scope.
architectArchitect🏗Architectural concerns, ADRs, dependencies.
qaQA🔍Test holes, suggests EARS criteria for skipped paths.
uxUX🎨Interaction, copy, accessibility.
securitySecurity🔒OWASP, STRIDE, secrets, RBAC.
performancePerformanceBottlenecks, p99, caching, payload size.
accessibilityAccessibilityWCAG 2.2, screen reader, keyboard.

The 5 default cover most reviews; the 3 specialty personas (Security / Performance / Accessibility) appear behind the picker for targeted critiques.

  1. Click a persona button → mutate setPersona(id) + clear current critique.
  2. Click Critique this blockPOST /ai/critique with:
    { persona, blockKind, blockTitle, blockMetadata, contextFeatureName, contextModuleName }
  3. Server checks cache (sha256 of all 6 inputs + model). On hit returns instantly with cacheHit: true.
  4. On miss runs the LLM (default: claude-sonnet-4.6 via OpenRouter). Cost recorded.
  5. Returns { critique: string, cost: number, cacheHit: boolean }.
  6. UI renders the critique in a card with the persona avatar + a small cached indicator if cacheHit.

A single block can be critiqued by multiple personas; each persona renders its own critique card. Each critique is plain markdown — typically 3-5 numbered concerns, severity badges (🔴 / 🟡 / 🟢), and suggested next blocks at the bottom.

  • A critique on an unchanged block is free — re-clicking doesn’t burn tokens.
  • A critique on a patched block (any metadata change) cache-misses → fresh LLM call.
  • Patterns: edit block → re-critique to see how concerns shifted; the diff between the two critiques is the qualitative reviewer view.

Inside the Six-tab editor’s Behavior tab (Tab 4), for the 5 atom kinds that carry Layer 2 (feature, ui_view, rule, criterion, fixture):

ButtonPatternWhat it does
🟡 Re-inferCDeterministic synthesis from related atoms (free).
Suggest with AIDLLM call returns structured Layer 2 (~$0.001-0.01/call).

Both open a Diff modal before applying: current vs suggested side-by-side, with the locked fields (🔒) preserved. Click Apply to merge; Cancel to discard.

Pattern D’s prompt includes:

  • Atom kind + current top-level fields (kind-specific).
  • Layer 1 prose (intent.userStory, intent.notes).
  • Linked atoms (via relations) and their existing Layer 2 — the model has surrounding context.
  • A kind-specific system prompt instructing it to emit JSON matching the Layer 2 Zod schema.

The validator rejects shapes that don’t fit before they reach the diff modal. A failed suggestion shows an error toast + the raw response in dev mode; the user can re-run.

See Concepts → Four patterns for the full provenance model and the merge logic, and Spec → Layer 2 schemas for the structures the LLM emits.

SurfacePer-call cost (claude-sonnet-4.6)Cache keyFree re-runs?
Decompose Wizard step 1 (modules)~$0.005archetype + ideaText + modelYes — same idea, same archetype.
Decompose Wizard step 2 (features × N modules)~$0.005 × Nper-module keyYes — per-module.
Decompose Wizard step 3 (criteria × N features)~$0.003 × Nper-feature keyYes — per-feature.
Persona Critique~$0.003persona + block + metadata + modelYes — unchanged block.
Pattern D suggestion~$0.001-0.01atom kind + Layer 1 + Layer 2 current + linked atoms + modelYes — exact-match cache.

Plan limits (Phase 1): FREE = 50 calls/day across all surfaces; SOLO = 500/day; TEAM = unlimited (rate-limited to ~10 req/min/user).