ui_implement
Iteratively refine UI by capturing screenshots, comparing to design references, and applying changes until a visual match threshold is met.
Instructions
Implement/modify UI for task via an iterative, diff-gated vision loop.
Workflow:
1. Load .agy-ui-scope and create an isolated git worktree.
2. Start the dev server (from scope.serve) inside the worktree and
wait for it to be ready.
3. Loop up to max_iters: screenshot the route across viewports,
build a vision prompt listing the shot + design-ref paths, run
agy -p in the worktree, diff-gate the result, re-screenshot.
Stop early once a round produces no new in-scope changes.
4. Collect the final diff, stop the server, clean up the worktree.
Args:
project_dir: Absolute path to the project root (must contain the scope).
task: Natural-language description of the UI change.
design_refs: Optional absolute paths to design reference images.
target_route: Optional route appended to scope.serve.url (e.g.
"/login"); defaults to the base URL.
max_iters: Maximum vision-loop iterations.
apply: When True (default), copy the in-scope changed files from the
worktree back into project_dir so the user can git diff and
review/commit them. When False, the worktree is collected and torn
down without writing anything to the project.
match_threshold: Only used when design_refs is non-empty. agy is
asked to self-report a 0-100 match score against the mockup each
round; the loop stops early once that score reaches this threshold.
Returns:
A dict with files_changed, diff, escalations, iterations,
shots_before, shots_after, warnings, applied (whether
apply was requested), applied_files (paths written to the project),
match_score (the last self-reported 0-100 score, or None when no
design refs were supplied), and match_gaps (the last reported
remaining differences, or "").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_dir | Yes | ||
| task | Yes | ||
| design_refs | No | ||
| target_route | No | ||
| max_iters | No | ||
| apply | No | ||
| match_threshold | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||