Skip to content

Comments

feat: v0.3.0 — smart UI defaults, fix --design mode, loop engine overhaul#189

Merged
rubenmarcus merged 55 commits intomainfrom
test/round2-improvements
Feb 14, 2026
Merged

feat: v0.3.0 — smart UI defaults, fix --design mode, loop engine overhaul#189
rubenmarcus merged 55 commits intomainfrom
test/round2-improvements

Conversation

@rubenmarcus
Copy link
Member

Summary

  • fix --design mode: Structured 5-phase visual fix workflow with screenshot verification, CSS cascade conflict detection, and DESIGN_VERIFIED completion token
  • Smart UI defaults: Web projects default to Tailwind CSS v4 + shadcn/ui + motion-primitives (framework-aware: shadcn-vue for Vue, shadcn-svelte for Svelte)
  • Rich spec generation: Specs and AGENTS.md include Tailwind v4 setup notes, CSS cascade layer warnings, and shadcn component setup instructions
  • Loop engine overhaul: Git-independent change detection, task-aware stall detection, memoized plan parsing, cost ceilings, 20+ reliability/performance fixes
  • Version bump to 0.3.0

Key Changes

Smart UI Defaults (Part A)

  • Added uiLibrary field to TechStack interface
  • Web projects default to shadcn + tailwind + motion-primitives when no styling specified
  • Updated REFINEMENT_PROMPT to suggest UI libraries
  • Framework-aware: shadcn/ui for React, shadcn-vue for Vue, shadcn-svelte for Svelte

Rich Spec Generation (Part B)

  • Specs include Tailwind v4 Setup Notes section with cascade layer warnings
  • AGENTS.md includes explicit "Do NOT add manual CSS resets" instructions
  • shadcn UI Components section with setup commands

Design Fix Loop (Part C)

  • fix --design requires DESIGN_VERIFIED token for completion
  • CSS cascade conflict detection as priority 0 check
  • Default iterations increased to 7 for design mode
  • Screenshot/viewport activity prevents false stall detection

Loop Defense (Part D)

  • Design activity (screenshots) credited in stall detection
  • Conditional preamble: design mode uses task-specific completion flow

Test plan

  • pnpm build — clean (0 errors)
  • pnpm test — 171/171 passing
  • Manual: run ralph-starter wizard → verify UI library defaults in summary
  • Manual: run ralph-starter fix --design → verify 5-phase flow

🤖 Generated with Claude Code

rubenmarcus and others added 30 commits February 12, 2026 14:10
- Reset circuit breaker when tasks advance (prevents false positives
  during multi-task greenfield builds where early tasks can't pass tests)
- Add package manager detection: auto-detect pnpm/yarn/bun from lockfiles
  and packageManager field instead of hardcoding npm
- Add validation warm-up: skip validation until enough tasks are done for
  greenfield builds (auto-detected, configurable via --validation-warmup)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Track file changes across all iterations (not just iteration 1)
- Stop loop after 2 consecutive idle iterations (no file changes)
- Check IMPLEMENTATION_PLAN.md for pending tasks in all modes, not
  just when task string mentions the plan file
- Lower default max-iterations from 10 to 7 when no plan file exists

Fixes loops running all iterations for simple tasks where the agent
finishes early but the loop doesn't detect completion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When no IMPLEMENTATION_PLAN.md exists, estimate task count from the
spec content by analyzing structural elements (headings, bullet
points, numbered lists, checkboxes). This replaces the static
default of 7 with a data-driven estimate.

For the pet shop issue (#86): 4 headings + 12 bullets → ~5 iterations
instead of the old static 10.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add loop-aware preamble to every iteration with key Ralph Playbook
  language patterns: "study" not "read", "don't assume not implemented",
  "no placeholders or stubs", and AGENTS.md self-improvement
- For unstructured specs (no task headers), instruct agent to create
  IMPLEMENTATION_PLAN.md as first action instead of generic "implement
  all features" prompt
- Add spec file references in iterations 2+ so agent can re-read
  requirements from specs/ directory
- Add plan-creation reminder for later iterations without structured tasks
- Use playbook language in structured spec prompt too

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rnings

- Show Ralph ASCII art in run command via showWelcomeCompact() instead
  of plain text header
- Smart project location: detect existing project markers (package.json,
  .git, Cargo.toml, etc.) and default to "Current directory" when found
- Fix type:'list' → type:'select' for inquirer v13 compatibility in
  project location prompt (same bug fixed across 8 files previously)
- Replace scary [WARNING] silence message with calm chalk.dim status:
  "Agent is thinking..." at 30s, "Still working..." at 60s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Speed:
- Remove unnecessary 1-second sleep between loop iterations — saves ~1s
  per iteration (25s on a 25-iteration loop)

Bug fix:
- Fix validation feedback mutation that defeated context trimming. The
  executor was appending compressed errors to `taskWithSkills` (line 868),
  accumulating old validation errors across iterations. Now stores
  feedback in a separate variable and passes it through the context
  builder's existing `validationFeedback` parameter, which was previously
  passed as `undefined` (dead code). The context builder already handles
  per-iteration compression (2000 chars for iter 2-3, 500 for 4+).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… improve error hashing

- Fix progress entry always recording 'completed' even for non-done iterations (was ternary with
  identical branches). Now records 'partial' for iterations that didn't complete.
- Merge detectCompletion() and getCompletionReason() into single-pass detectCompletionWithReason()
  to eliminate duplicate analyzeResponse() calls per iteration.
- Remove unused _validationPassed variable.
- Improve circuit breaker error hashing: only normalize file:line:col locations, timestamps, hex
  addresses, and stack traces — preserving semantically meaningful content so different errors
  (e.g. "port 8000 in use" vs "file not found") hash differently.
- Add 'partial' status to ProgressEntry type with status badge.
- Update circuit breaker tests for new normalization behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t detection

- Add mtime-based caching to parsePlanTasks() — the same IMPLEMENTATION_PLAN.md file was
  being read and regex-parsed 4 times per iteration (init, progress check, completion check,
  display). The cache returns the stored result if the file's mtimeMs hasn't changed,
  eliminating ~75 redundant file reads across a 25-iteration loop.
- Parallelize agent detection in detectAvailableAgents() — each agent check spawns an
  independent subprocess (e.g. `claude --version`). Running them with Promise.all() instead
  of sequential for/of cuts startup time from ~2-3s to <1s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…configurable timeout

Safety:
- Add maxCost option to CostTracker and LoopOptions — the loop checks isOverBudget()
  before each iteration and exits with 'cost_ceiling' reason if exceeded. Prevents
  unexpected charges on long-running loops.
- Add output size limit (default 50MB) in agent runner — truncates to last 80% of
  buffer if exceeded, preventing OOM from verbose agent output.

UX:
- Run all validation commands instead of stopping at first failure — the agent now
  sees lint AND test AND build failures in a single pass, enabling multi-fix
  iterations instead of fix-one-rerun-fix-another chains.

Configuration:
- Add agentTimeout option to LoopOptions (default: 5 min) — propagated to agent
  runner's timeoutMs. Complex tasks can set longer timeouts.
- Add 'cost_ceiling' to LoopResult exit reasons.
- Add 'partial' status to ProgressEntry for non-done iterations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move timestamp regex before the :\d+:\d+ replacement. Previously,
a timestamp like "14:07:39" would match :\d+:\d+ first, mangling it
to "14:N:N" so the timestamp regex could never match. This caused
same errors with different timestamps to hash differently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cache

The file could change between stat (cache check) and readFileSync.
Now stat before and after reading: only cache if both mtimes match,
preventing stale content from being cached with a new mtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ounting

Addresses PR #185 review feedback:
- Remove outputTruncated flag so truncation can fire more than once
- Reset outputBytes after truncation to prevent counter drift
- Include stderr data in byte accounting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The compact RALPH_WELCOME_SMALL looked out of place compared to the
full RALPH_FULL art used in the wizard. Use showWelcome() consistently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Build validation (build + typecheck) now runs after every iteration
regardless of the --validate flag. This catches broken builds early:
- Missing file imports (components that don't exist yet)
- PostCSS/Tailwind misconfiguration
- TypeScript compilation errors

Key changes:
- Add detectBuildCommands() with AGENTS.md > package.json > tsc fallback
- Add runBuildValidation() with 2-min timeout (vs 5-min for full)
- Re-detect build commands per iteration for greenfield projects
- Skip when --validate already covers build/typecheck (no double-run)
- Add preamble rules: "create files before importing" + "verify compilation"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ovements

# Conflicts:
#	src/loop/executor.ts
…ovements

# Conflicts:
#	src/loop/context-builder.ts
…eld skills

- Add filesystem-based change detection as primary method (git-independent)
- Add getHeadCommitHash() and hasIterationChanges() for git-based secondary detection
- Remove hasChanges gate from build/full validation (unconditional after iter 1)
- Relax stall detection threshold (3 idle + i > 3)
- Add directory anchoring rule to preamble (prevent nested project dirs)
- Strengthen Tailwind v4 rules with exact setup instructions
- Enable skills auto-install by default for greenfield projects (no package.json)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
context-builder.ts:
- Fix wasTrimmed bug (was always true for iterations > 1)
- Replace unsafe prompt.slice() with semantic trimming at paragraph boundaries
- Section-aware feedback compression (keep first complete section, summarize rest)

task-counter.ts:
- Protect cache from consumer mutation via deep-clone
- Extract MAX_ESTIMATED_ITERATIONS constant (was magic number 25)

task-executor.ts:
- Don't cascade previousBranch on failure (prevents branching from broken state)
- Populate result.cost from loop cost stats (was dead field)

executor.ts:
- Task-aware stall detection (reset idle counter on task progress, not just file changes)
- Post-iteration cost ceiling check (prevents starting expensive iteration over budget)
- Reorder completion detection: cheap checks first, expensive semantic analysis last

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
npx skills find is an interactive fzf UI that returns garbage when piped
programmatically. Replace with skills.sh search API (https://skills.sh/api/search)
which returns real repos with install counts. Enable auto-install by default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Loop resilience:
- Increase default iterations 7→10, minimum 3→5, buffer 2→3
- Validation failures no longer count as idle (agent is debugging)
- Relax stall threshold for larger projects (4 idle for 5+ tasks)

Design quality:
- Add anti-AI-aesthetic rules to hard preamble (bans purple gradients,
  Inter/Roboto fonts, glass morphism)
- Expand skill auto-apply triggers (page, dashboard, app, shop, store)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nt results

- Check installed skills first: if frontend-design is already installed
  and relevant to the task, show "Using installed skills:" and skip API
- Add negative keyword filtering: react-native, mobile, ios, android,
  flutter etc. are filtered out for standard web projects
- Use detectClaudeSkills() for comprehensive installed-skill detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Don't early-return when skills are installed — always search for
  complementary ones (e.g., react-best-practices alongside frontend-design)
- Add React/Vue/Svelte-specific queries (best practices, composition)
- Auto-add SEO query for landing/marketing pages
- Increase max skills from 2 to 5
- Boost scoring for best-practices, composition, guidelines skills

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dynamic iterations:
- maxIterations now recalculates when agent expands the plan
  (e.g., spec has 3 tasks → agent creates 8 → budget adjusts to 11)
- Fixes premature "max_iterations" exit on greenfield projects

Ban dev server:
- Preamble now explicitly says "NEVER start a dev server" and to use
  npm run build instead. Dev servers block forever, create zombie
  processes, and eat up ports (5173, 5174, 5175...) across iterations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…al verification

- Add `ralph-starter fix` command for autonomous build/design fixing
- Fix skill re-installation bug: normalize skill IDs (spaces vs hyphens) for dedup
- Fix design skills not applied: add CSS/visual keywords to task detection
- Add visual verification instructions for design tasks (web-design-reviewer skill)
- Tiered validation: lint on intermediate iterations, build on final iteration
- Extend loop by 2 iterations when build fails on final iteration
- Fix TOCTOU race condition in task-counter.ts (CodeQL alert #164)
- Ban manual dev server in loop preamble (loop handles validation)
- Export shared WEB_TASK_KEYWORDS to eliminate keyword list divergence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rubenmarcus and others added 17 commits February 13, 2026 23:16
The fix command was exiting with "nothing to fix!" when build checks
passed and no custom task was given. But --design targets visual issues
that build checks can't detect, so it should always proceed to the
screenshot/analysis flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three issues fixed:
- Skills were showing "25 detected" because maxSkills wasn't threaded
  through LoopOptions to formatSkillsForPrompt. Now --design caps to 4.
- Startup display now shows "4 active (25 installed)" instead of raw count
- Design prompt now forcefully instructs the agent to start with dev
  server + screenshots as the VERY FIRST action, ignoring IMPLEMENTATION_PLAN.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The design fix prompt was too vague — "layout/spacing problems" led the
agent to suggest padding tweaks instead of catching obvious structural
issues like content not being centered or huge empty gaps.

Rewritten Phase 2 (Issue Identification) to:
- Prioritize page structure (centering, containers, max-width) over cosmetic
- Check for content pinned to edges, broken grid layouts, unbalanced columns
- Require CONCRETE issues visible in screenshots, not generic improvements

Rewritten Phase 3 (Fix Plan) to:
- Require exact file + CSS property for each fix
- Focus on minimal fixes, not redesigning entire components

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass user's custom task text (not the full generated prompt) to
autoInstallSkillsFromTask. The --design prompt contains dozens of
CSS/design keywords that triggered excessive skill search queries,
causing skills to accumulate globally (25+ after a few runs).

Also lower MAX_SKILLS_TO_INSTALL from 5 to 3 to cap accumulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The preamble said "Study IMPLEMENTATION_PLAN.md and work on ONE task"
which directly conflicted with the --design prompt's "Ignore
IMPLEMENTATION_PLAN.md — this is a visual fix pass." The preamble
appeared first and won, confusing the agent.

Add skipPlanInstructions option that replaces plan-related rules with
"This is a fix/review pass" when active. Set from fix --design.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix --design: 7 → 5 (5-phase structure should complete in 3-4 iters)
isDesignTask: 5 → 4 (visual tasks with keyword detection)

Reduces worst-case wall time from 35min to 25min.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each iteration now appends a summary to .ralph/iteration-log.md with
status (validation passed/failed), whether files changed, and agent
summary text. On iterations 2+, the last 3 entries are included in
the prompt as "## Previous Iterations" so the agent knows what was
already tried and can avoid repeating failed approaches.

This is a lightweight alternative to full session continuity (--resume)
which is deferred to 0.3.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Loop header shows "Design Fix", "Fix", or agent name based on fixMode
  instead of always showing "Running Claude Code"
- Subtask tree renders below header when current task has subtasks:
    [x] Create hero component
    [ ] Add responsive styles
- Add fixMode option to LoopOptions ('design' | 'scan' | 'custom')

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After each iteration in design mode, check ports 3000/5173/4321/8080
for orphaned dev server processes and SIGTERM them. This prevents
resource leaks when the agent crashes or times out without cleaning
up the dev server it started for visual verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add lastValidationFeedback field to SessionState so that when a
session is paused and later resumed, the agent gets the last
validation errors as context. The resume command now passes this
as initialValidationFeedback to runLoop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add uiLibrary as an optional field in TechStack to support UI component
library selection (shadcn/ui, shadcn-vue, shadcn-svelte, MUI, Chakra).
Updated normalizeTechStack, hasTechStack, and the wizard summary display.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…b projects

When no UI library/styling is specified, web projects now default to:
- Tailwind CSS for styling
- shadcn/ui (React/Next.js), shadcn-vue (Vue), or shadcn-svelte (Svelte)

Updated REFINEMENT_PROMPT to include uiLibrary field and guidance for
the LLM to suggest this default stack. Template fallback also sets
these defaults when the LLM is unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add uiLibrary to spec display (A4)
- Add Tailwind v4 setup instructions to AGENTS.md including cascade
  layers warning and explicit "no manual CSS resets" guidance (B1)
- Add shadcn/ui + motion-primitives setup instructions to AGENTS.md (B1)
- Add Setup Notes section to spec with Tailwind v4 + UI library
  details to prevent CSS cascade conflicts (B2)
- Add formatTech entries for shadcn, MUI, Chakra, motion-primitives

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… check

- C1: Require DESIGN_VERIFIED completion token for design mode, disable
  legacy "All tasks completed" markers via requireExitSignal
- C2: Update Phases 4-5 to instruct agent to emit DESIGN_VERIFIED only
  after taking verification screenshots
- C3: Increase default design iterations from 5 to 7 for fix+verify cycles
- C4: Add CSS cascade conflict check as priority 0 in Phase 2 — detects
  the "spacing broken + colors working" pattern caused by unlayered CSS
  overriding Tailwind v4 @layer utilities

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ruction

- D1: Credit screenshot/viewport activity as productive progress in
  design mode, preventing stall detector from killing analysis iterations
- D2: Suppress "All tasks completed" instruction for design mode
  (skipPlanInstructions=true), replacing with "Follow the completion
  instructions in the task below" to avoid conflicting with DESIGN_VERIFIED

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions
Copy link
Contributor

Issue Linking Reminder

This PR doesn't appear to have a linked issue. Consider linking to:

  • This repo: Closes #123
  • ralph-ideas: Closes multivmlabs/ralph-ideas#123

Using Closes, Fixes, or Resolves will auto-close the issue when this PR is merged.


If this PR doesn't need an issue, you can ignore this message.

@github-actions
Copy link
Contributor

✔️ Bundle Size Analysis

Metric Value
Base 1847.13 KB
PR 1847.13 KB
Diff 0 KB (0%)
Bundle breakdown
156K	dist/auth
28K	dist/automation
4.0K	dist/cli.d.ts
4.0K	dist/cli.d.ts.map
16K	dist/cli.js
12K	dist/cli.js.map
460K	dist/commands
28K	dist/config
4.0K	dist/index.d.ts
4.0K	dist/index.d.ts.map
4.0K	dist/index.js
4.0K	dist/index.js.map
536K	dist/integrations
84K	dist/llm
728K	dist/loop
172K	dist/mcp
32K	dist/presets
92K	dist/setup
36K	dist/skills
392K	dist/sources
76K	dist/ui
84K	dist/utils
336K	dist/wizard

@github-actions
Copy link
Contributor

🔗 Docs Preview

Preview URL: https://test-round2-improvements.ralph-starter-docs.pages.dev

This preview was deployed from the latest commit on this PR.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 14, 2026

Greptile Overview

Greptile Summary

This PR delivers four major improvements to ralph-starter's autonomous loop engine and wizard experience:

Smart UI Defaults: Web projects now default to Tailwind CSS v4 + framework-appropriate shadcn variant (shadcn/ui for React, shadcn-vue for Vue, shadcn-svelte for Svelte) + motion-primitives when no styling is specified. The wizard LLM prompt and spec generator produce rich technical documentation including Tailwind v4 setup instructions, CSS cascade layer warnings, and shadcn component installation commands.

Design Fix Mode: New fix --design command implements a structured 5-phase visual fix workflow requiring screenshot verification and explicit DESIGN_VERIFIED completion token. Priority 0 check detects CSS cascade conflicts (unlayered CSS overriding Tailwind utilities). Design mode increases default iterations to 7 and credits screenshot/viewport activity in stall detection.

Loop Engine Overhaul: 20+ reliability and performance improvements including git-independent change detection via filesystem snapshots, task-aware stall detection with design activity credit, memoized plan parsing with mtime cache, cost ceiling enforcement, dynamic iteration budget adjustment when plans expand, and refactored completion detection combining status and reason in a single pass.

Package Manager Awareness: New utility detects package manager from lock files and package.json, ensuring validation commands use the correct PM (pnpm/npm/yarn/bun) rather than hardcoded npm.

Confidence Score: 4/5

  • Safe to merge with minor verification - all tests pass, build clean, changes are well-structured
  • Score reflects comprehensive testing (171/171 tests passing, clean build) and well-architected changes across 45 files. The PR introduces significant new functionality (design fix mode, smart UI defaults) and major loop engine refactors, but follows established patterns and includes proper error handling. Minor points deducted for: (1) large surface area of changes (900+ lines in executor.ts alone increases review complexity), (2) new fix command should be manually tested with --design flag as noted in test plan, (3) memoization cache in task-counter could theoretically have race conditions in concurrent scenarios.
  • Pay close attention to src/commands/fix.ts (new command, should be manually tested), src/loop/executor.ts (major refactor with many edge cases), and src/loop/task-counter.ts (mtime-based memoization cache).

Important Files Changed

Filename Overview
src/commands/fix.ts New fix command with design mode support - comprehensive visual fix workflow with 5 phases, CSS cascade detection, and DESIGN_VERIFIED completion token
src/wizard/llm.ts Smart UI defaults implementation - defaults to Tailwind + framework-aware shadcn variant (shadcn/shadcn-vue/shadcn-svelte) for web projects
src/wizard/spec-generator.ts Rich spec generation with Tailwind v4 setup notes, CSS cascade warnings, shadcn component instructions, and package manager detection
src/loop/executor.ts Major loop engine overhaul - git-independent change detection, stall detection with design activity credit, cost ceilings, memoized plan parsing, completion refactor
src/loop/validation.ts Added detectBuildCommands, detectLintCommands, package manager aware validation commands, and removed early-exit-on-failure behavior
src/loop/task-counter.ts Memoized plan parsing with mtime cache, estimateTasksFromContent for spec-based estimation, increased buffers and max iterations to 25
src/utils/package-manager.ts New utility for package manager detection (lock files + package.json) and run command formatting

Flowchart

flowchart TD
    Start([ralph-starter fix --design]) --> ParseActivity{Parse .ralph/activity.md}
    ParseActivity -->|Failed validations found| ActivityMode[Mode: activity]
    ParseActivity -->|No failures| ScanMode[Mode: scan]
    
    ActivityMode --> RunValidation[Run validation commands]
    ScanMode --> RunValidation
    
    RunValidation --> CheckFailures{Build errors?}
    CheckFailures -->|No errors & no custom task| Done1([Exit: Nothing to fix])
    CheckFailures -->|Has errors| BuildFeedback[Format validation feedback]
    
    BuildFeedback --> DetectAgent[Detect best agent]
    DetectAgent --> BuildPrompt[Build design fix prompt]
    
    BuildPrompt --> Phase1[Phase 1: Visual Audit<br/>Start dev server + screenshots<br/>at 3 viewports]
    Phase1 --> Phase2[Phase 2: Issue Identification<br/>Priority 0: CSS cascade conflicts<br/>Priority 1-5: Structure/layout/spacing]
    Phase2 --> Phase3[Phase 3: Fix Plan<br/>Create DESIGN_FIX_PLAN.md]
    Phase3 --> Phase4[Phase 4: Execute & Verify<br/>Fix structural issues first<br/>Re-screenshot after each fix]
    Phase4 --> Phase5[Phase 5: Cleanup<br/>Stop dev server<br/>Output DESIGN_VERIFIED token]
    
    Phase5 --> LoopEngine[Loop executor with options:<br/>maxIterations: 7<br/>completionPromise: DESIGN_VERIFIED<br/>requireExitSignal: true]
    
    LoopEngine --> StallDetection{Stall detection}
    StallDetection -->|Screenshot activity| Credit[Credit as forward progress]
    StallDetection -->|No changes| Stall[Circuit breaker]
    
    Credit --> CheckCompletion{DESIGN_VERIFIED<br/>token found?}
    Stall --> CheckCompletion
    
    CheckCompletion -->|Yes| VerifyFix[Re-run validation commands]
    CheckCompletion -->|Max iterations| VerifyFix
    
    VerifyFix --> AllPass{All checks<br/>passing?}
    AllPass -->|Yes| Done2([Exit: Success])
    AllPass -->|No| Done3([Exit: Partial fix])
Loading

Last reviewed commit: 6ebd762

@rubenmarcus rubenmarcus changed the title v0.3.0: Smart UI defaults, fix --design mode, loop engine overhaul feat: v0.3.0 — smart UI defaults, fix --design mode, loop engine overhaul Feb 14, 2026
@rubenmarcus rubenmarcus merged commit 4921867 into main Feb 14, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant