mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-15 17:35:29 +02:00
* feat(aside): browser-driver contract, cookbook, research and fallback resolvers
{{ASIDE_SETUP}} (readiness probe + ten rules for driving the user's real browser), {{ASIDE_COOKBOOK}} (script shapes verified live against Aside CLI 1.26: one flow per aside repl script, CDP console hook before navigation, evidence lines, session-directory artifact handoff, GSTACK_STEP_OK sentinel), {{ASIDE_RESEARCH}} (research through aside exec, WebSearch when Aside is absent, knowledge otherwise) and {{BROWSE_FALLBACK}} (the fifteen-row Aside-step to $B-command table plus the rules that differ, so every browsing skill keeps working on gstack's own headless browser). test/aside-driver.test.ts pins the sentences and asserts every browsing skill carries the Aside block followed by the fallback; test/helpers/aside-available.ts is the shared live-Aside probe.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* feat(render): Aside-first local-HTML renderer with the bundled browser as fallback
lib/aside-render.ts serves the HTML's directory on loopback (Aside refuses file:// URLs), opens it with waitUntil load, prints through CDP Page.printToPDF so tagged output, outlines, header/footer templates and page numbers survive, emulates device metrics for sized screenshots, and writes in-page evaluations to files; when Aside is absent it runs the same spec through the browse daemon (newtab, load, js, pdf, screenshot, closetab) and reports ENGINE=aside|browse. bin/gstack-render.ts is the CLI skill templates call. lib/claude-bin.ts and lib/error-handling.ts become the canonical copies (browse/src re-exports them).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(browse): /browse drives Aside first, with the $B reference behind the fallback
Contract, cookbook, mode choice (aside repl by default, aside exec for reading), report format, the fallback section, and the full command reference carved on demand.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(qa): /qa and /qa-only drive Aside, fall back to $B
QA_METHODOLOGY runs every phase as Aside scripts (orient, explore, document, re-test, mobile viewport via CDP emulation, links via HEAD fetch); the authenticate phase is 'you are already signed in'; a 13th rule requires consent before mutating actions on non-local targets; the fallback section translates each step onto $B. The qa E2E tests run on whichever engine is present.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(design): design-review, design-consultation, design-shotgun, plan-design-review, design-html drive Aside
Design-system extraction is one script printing FONTS/COLORS/HEADINGS/TOUCH_TARGETS/NAV; competitor research confirms the exact URLs before opening them in the real browser and runs on the bundled browser when Aside is absent; design-html's viewport screenshots, sketches and comparison boards render through gstack-render.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(deploy): benchmark, canary, land-and-deploy Step 7, devex-review drive Aside
One aside repl script per page prints NAV/PAINT/LCP/RESOURCES/SCRIPTS/CSS/SUMMARY (benchmark), CONSOLE_ERRORS/NAV/TEXT + screenshot (canary, re-run every 60s), and the post-deploy check reads responseStatus from the navigation entry; each carries the $B fallback.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* feat(third-party-actions): Aside is the recommended driver; gstack's visible browser stays the fallback
The readiness probe is lifted from {{ASIDE_SETUP}} at gen time (byte-identity pinned) and rule 3 points at browse/SKILL.md for how to drive; the consent question offers Aside first and gstack's own visible browser (handoff/resume for sign-in) as the fallback, as v1.72 framed it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(scrape): /scrape reads pages through Aside; the browser-skills runtime rides the fallback
Look-then-extract scripts build the JSON inside the page and print it between JSON_START/JSON_END; aside exec for fuzzy intents; on the $B fallback the browser-skills match/prototype flow and /skillify apply as before.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(make-pdf): print through Aside first, the bundled browser otherwise
asideClient.ts replaces the direct $B client with one render() call per PDF (the exact option mapping the browse pdf command had: paper, margins, header/footer/page numbers, tagged, outline, printBackground, preferCSSPageSize, Paged.js wait); the diagram pre-pass, oversized-image downscale and DOCX rasters each run as one render script with per-fence try/catch; exit 4 now means no browser is available and names both remedies; $P setup reports which engine it found. The e2e gates run on whichever engine is present, so the Linux lane exercises the fallback.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(diagram): the triplet is one gstack-render call
SVG, PNG and excalidraw from one invocation over the content-addressed bundle staged under /tmp/gstack-render; every diagram type gets an excalidraw export; gstack-render picks the engine and prints ENGINE=; the diagram E2E gates on either engine.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* feat(research): web research runs in Aside first, WebSearch second
The planning, review, design, security and investigate skills research through {{ASIDE_RESEARCH}}; WebSearch stays in allowed-tools as the fallback; testing.ts's bootstrap step follows; skeleton ceilings ratcheted for the research block.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* feat(setup,gen-skill-docs): prune renders of skills that no longer exist
setup gains _prune_stale_generated for every host tree and the doc generator removes gstack-* output dirs it did not write, so a skill removed from the source tree can never linger in an install.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test: registries, budgets and suite reconciled for Aside-first with the $B fallback
Touchfiles + E2E tiers gain the Aside keys, coverage matrix and eval baselines updated, size budget re-baselined to parity-baseline-v1.80.0.0.json (the contract plus fallback ride in every browsing skill), parity ceilings ratcheted with measured values, LLM-judge prompts and the E2E fixtures speak Aside-first, browse-fallback.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs: Aside first, gstack browser fallback
README, BROWSER.md, docs/, CONTRIBUTING, CLAUDE.md, ARCHITECTURE, AGENTS.md, TODOS and the root router describe the one product story: Aside is the browser gstack drives first; the bundled headless browser is the automatic fallback (Linux, Windows, app closed) where cookie import, GStack Browser, pair-agent and browser-skills still apply.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* chore: regenerate SKILL.md docs, llms.txt, agents digest, ship goldens, context-budget fixture
bun run gen:skill-docs over the templates; goldens re-rendered; context-budget ceilings recaptured.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* v1.80.0.0: Aside is the browser gstack drives first; the bundled browser is the fallback
MINOR: new capability across ten skills, the renderer and research; nothing removed. CHANGELOG release summary + itemized changes; VERSION 1.80.0.0; package.json 1.80.0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs(todos): file non-Claude host ownership-gate and version-heading pin follow-ups
Two follow-ups from the /plan-ceo-review + /plan-eng-review pass on merging
PR #2804 with main's v1.80.0.0 ownership gate: bring the Codex/Factory/
OpenCode/Cursor/Kiro copy loops and the stale-render prune under the
.gstack-owned marker rule, and a free test pinning that the CHANGELOG top
heading equals VERSION (the collision that git cannot see).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix: pre-landing review fixes for the Aside-first branch
Review army + adversarial passes (Claude and Codex) on the merged branch:
setup
- _prune_stale_generated scans the host dirs too (the generator already
removed the render before setup ran, so the host branch was dead), skips
symlinks in the render tree (rm -rf on a slash-terminated link empties its
target), removes a host symlink only when it resolves into gstack, cleans a
bannered real dir through _cleanup_weak_dir, recognizes frontmatter-renamed
skills, and logs through log. The always-run codex render passes every host
dir that may link to it.
- NEEDS_BUILD checks all three binaries (with $_EXE) and lib/ sources; the
browser hint and the bootstrap summary honor GSTACK_SKIP_ASIDE, treat a
requested skip as a request, and derive one skill list.
lib/aside-render.ts + bin/gstack-render.ts
- The loopback server carries a per-render secret path, checks containment on
the real path (symlink escapes are 403), and rejects malformed encoding.
- Inline eval results are one base64 line, so page text cannot forge
ASIDE_DIR= or the sentinel; the last ASIDE_DIR wins.
- runProc escalates SIGTERM to SIGKILL, bounds every wait, and clears every
timer (an uncleared one kept gstack-render alive after printing OK).
- renderTmpDir refuses a shared /tmp name owned by someone else; the work dir
and server are created inside try; goto's budget follows the render budget.
- probeAside classifies a present-but-failing CLI as ASIDE_NOT_RUNNING like
the skills' bash probe; render() retries on gstack's own browser when Aside
could not start or its private CDP bridge is gone (never on a page error
or a timeout of a running script); the CLI reports the engine that actually
rendered, exits 0 on --help, rejects non-numeric flags, documents
--wait-timeout, fences EVAL/PAGE_ERRORS as untrusted content, and names the
daemon's cookie-import JS lock remedy.
- The browse path passes --scale only when asked (a scale change rebuilds
the daemon context) and restores the viewport after a sized screenshot.
resolvers / templates
- The bash probe honors GSTACK_SKIP_ASIDE and has a perl deadline on stock
macOS; .local is no longer LOCAL (mDNS); same-origin filters compare parsed
origins; link status is HEAD-checked only on LOCAL targets; every
aside exec goes through the receipted _aside_exec prelude
({{ASIDE_EXEC_PRELUDE}}), including nine template blocks that called it
bare; the design sketch and diagram staging use private directories.
- The generator prunes only bannered renders and never a host whose
generation failed.
Docs, stale comments and dead code cleaned; goldens re-rendered; tests
updated and added for every behavior above.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test: coverage for the render CLI, setup rebuild check, make-pdf exit codes, and prose $B spans
New free tests from the ship coverage audit: test/gstack-render-cli.test.ts
(argv guards, --help, output contract with a fake daemon, failure and
serve-root paths, no-browser case, prompt exit), test/setup-needs-build.test.ts
(every binary and source set flips NEEDS_BUILD, Windows suffixes),
make-pdf/test/cli-exit-codes.test.ts and setup-smoke.test.ts (error to exit
code mapping, runSetup stages, renderPdf's engine), and prose-span cases for
extractBrowseCommands in test/skill-parser.test.ts.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs: CHANGELOG and TODOS cover the review fixes (v1.81.0.0)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs: sync project docs with the v1.81.0.0 review fixes
BROWSER.md, ARCHITECTURE.md, CONTRIBUTING.md, README.md, CLAUDE.md,
docs/TESTING_INTERNALS.md and docs/PROJECT_STRUCTURE.md now describe the
shipped renderer and setup: the loopback render server's per-render secret
path and real-path containment, ENGINE= naming the engine that actually
rendered (mid-run retry on gstack's own browser), EVAL/PAGE_ERRORS fenced as
untrusted content, --wait-timeout and the CLI's argv guards, the receipted
_aside_exec prelude ({{ASIDE_EXEC_PRELUDE}} in the placeholder table), the
LOCAL host rule without .local, LOCAL-only HEAD checks in the links script,
GSTACK_SKIP_ASIDE across probe/renderer/setup, the ownership-gated
retired-skill prune, the widened NEEDS_BUILD check, and the new free tests
(gstack-render-cli, setup-prune-stale-generated, setup-browser-hint,
setup-needs-build, make-pdf cli-exit-codes and setup-smoke).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs: CHANGELOG states the precise mid-run retry rule
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(test): skill-e2e-bws slices the $B setup block from the Browser fallback section
browse/SKILL.md no longer has '## SETUP' / '## Core QA Patterns' (Aside is the
primary driver; the $B block moved under 'Browser fallback'), so the gate test
sliced an empty block and handed the agent nothing to run. Anchor on
'### Find the `$B` binary' up to the next heading. 7/7 pass.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(test): gate POSIX-only fixtures off Windows
windows-free-tests: the gstack-render CLI tests drive a shebang fake browse
that CreateProcess cannot exec, and two NEEDS_BUILD cases assert an execute
bit and a bare-name miss that MSYS bash does not have (test -x ignores mode
bits and resolves design -> design.exe). Those describes and cases now
self-skip on win32; argument guards, --help, the no-browser case, and every
other rebuild-check case still run there.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(render): runProc waits for the exit code until the kill deadline; newtab retries once on a cold daemon
A process whose pipes have reached EOF is exiting, but runProc gave the exit
code only five seconds to arrive and then returned null, which run() reports
as a failed command. Under CI's six-shard load one such render failed with the
artifact already written. The SIGTERM/SIGKILL timers already bound the wait,
so the exit race now runs to the kill deadline.
The first CLI call auto-starts the browse daemon; on a cold start it can
answer 'Unable to connect' once while the server is still coming up. That
single case is retried after 1.5s; every other newtab failure is not.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(aside-render): warm the daemon before live fallback cases; failures name the render error
- Live fallback cases run 'goto about:blank' up to twice before asserting and
skip (never fail) when the daemon cannot come up.
- expectOk() puts r.error and the browse transcript into the assertion so a
failed render is diagnosable from the CI log.
- The argv-contract cases dump the fake's log on a miss.
- File default timeout is 30s: the subject is the CLI contract, not latency.
- Two cases pin the cold-daemon newtab retry and that other errors are not
retried.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* docs: CHANGELOG notes the cold-start tolerance of the bundled-browser renderer
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Sina <sdroid674+github@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
365 lines
14 KiB
Cheetah
365 lines
14 KiB
Cheetah
---
|
|
name: design-shotgun
|
|
preamble-tier: 2
|
|
version: 1.0.0
|
|
description: |
|
|
Design shotgun: generate multiple AI design variants, open a comparison board,
|
|
collect structured feedback, and iterate. Standalone design exploration you can
|
|
run anytime. Use when: "explore designs", "show me options", "design variants",
|
|
"visual brainstorm", or "I don't like how this looks".
|
|
Proactively suggest when the user describes a UI feature but hasn't seen
|
|
what it could look like. (gstack)
|
|
triggers:
|
|
- explore design variants
|
|
- show me design options
|
|
- visual design brainstorm
|
|
allowed-tools:
|
|
- Bash
|
|
- Read
|
|
- Glob
|
|
- Grep
|
|
- Agent
|
|
- AskUserQuestion
|
|
gbrain:
|
|
schema: 1
|
|
context_queries:
|
|
- id: prior-approved-variants
|
|
kind: filesystem
|
|
glob: "~/.gstack/projects/{repo_slug}/designs/*/approved.json"
|
|
sort: mtime_desc
|
|
limit: 5
|
|
render_as: "## Prior approved design variants for this project"
|
|
- id: design-md
|
|
kind: filesystem
|
|
glob: "DESIGN.md"
|
|
tail: 1
|
|
render_as: "## DESIGN.md (project design system)"
|
|
- id: recent-design-docs
|
|
kind: filesystem
|
|
glob: "~/.gstack/projects/{repo_slug}/*-design-*.md"
|
|
sort: mtime_desc
|
|
limit: 3
|
|
render_as: "## Recent design docs"
|
|
---
|
|
|
|
{{PREAMBLE}}
|
|
|
|
# /design-shotgun: Visual Design Exploration
|
|
|
|
You are a design brainstorming partner. Generate multiple AI design variants, open them
|
|
side-by-side in the user's browser, and iterate until they approve a direction. This is
|
|
visual brainstorming, not a review process.
|
|
|
|
---
|
|
|
|
{{SECTION_INDEX:design-shotgun}}
|
|
|
|
---
|
|
|
|
{{DESIGN_SETUP}}
|
|
|
|
{{SECTION:doctrine}}
|
|
|
|
## Step 0: Session Detection
|
|
|
|
Check for prior design exploration sessions for this project:
|
|
|
|
```bash
|
|
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)"
|
|
setopt +o nomatch 2>/dev/null || true
|
|
_PREV=$(find ~/.gstack/projects/$SLUG/designs/ -name "approved.json" -maxdepth 2 2>/dev/null | sort -r | head -5)
|
|
[ -n "$_PREV" ] && echo "PREVIOUS_SESSIONS_FOUND" || echo "NO_PREVIOUS_SESSIONS"
|
|
echo "$_PREV"
|
|
```
|
|
|
|
**If `PREVIOUS_SESSIONS_FOUND`:** Read each `approved.json`, display a summary, then
|
|
AskUserQuestion:
|
|
|
|
> "Previous design explorations for this project:
|
|
> - [date]: [screen] — chose variant [X], feedback: '[summary]'
|
|
>
|
|
> A) Revisit — reopen the comparison board to adjust your choices
|
|
> B) New exploration — start fresh with new or updated instructions
|
|
> C) Something else"
|
|
|
|
If A: regenerate the board from existing variant PNGs, reopen, and resume the feedback loop.
|
|
If B: proceed to Step 1.
|
|
|
|
**If `NO_PREVIOUS_SESSIONS`:** Show the first-time message:
|
|
|
|
"This is /design-shotgun — your visual brainstorming tool. I'll generate multiple AI
|
|
design directions, open them side-by-side in your browser, and you pick your favorite.
|
|
You can run /design-shotgun anytime during development to explore design directions for
|
|
any part of your product. Let's start."
|
|
|
|
## Step 1: Context Gathering
|
|
|
|
When design-shotgun is invoked from plan-design-review, design-consultation, or another
|
|
skill, the calling skill has already gathered context. Check for `$_DESIGN_BRIEF` — if
|
|
it's set, skip to Step 2.
|
|
|
|
When run standalone, gather context to build a proper design brief.
|
|
|
|
**Required context (5 dimensions):**
|
|
1. **Who** — who is the design for? (persona, audience, expertise level)
|
|
2. **Job to be done** — what is the user trying to accomplish on this screen/page?
|
|
3. **What exists** — what's already in the codebase? (existing components, pages, patterns)
|
|
4. **User flow** — how do users arrive at this screen and where do they go next?
|
|
5. **Edge cases** — long names, zero results, error states, mobile, first-time vs power user
|
|
|
|
**Auto-gather first:**
|
|
|
|
```bash
|
|
cat DESIGN.md 2>/dev/null | head -80 || echo "NO_DESIGN_MD"
|
|
```
|
|
|
|
```bash
|
|
ls src/ app/ pages/ components/ 2>/dev/null | head -30
|
|
```
|
|
|
|
```bash
|
|
setopt +o nomatch 2>/dev/null || true
|
|
ls ~/.gstack/projects/$SLUG/*office-hours* 2>/dev/null | head -5
|
|
```
|
|
|
|
If DESIGN.md exists, tell the user: "I'll follow your design system in DESIGN.md by
|
|
default. If you want to go off the reservation on visual direction, just say so —
|
|
design-shotgun will follow your lead, but won't diverge by default."
|
|
|
|
**Check for a live site to screenshot** (for the "I don't like THIS" use case):
|
|
|
|
```bash
|
|
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 2>/dev/null || echo "NO_LOCAL_SITE"
|
|
```
|
|
|
|
If the user referenced a URL or said something like "I don't like how this looks,"
|
|
screenshot that page with Aside in Step 3c and use `$D evolve` instead of `$D variants`
|
|
to generate improvement variants from the existing design. If they didn't name the URL,
|
|
ask for it — never guess which page they mean. If the probe above printed `200`, offer
|
|
`http://localhost:3000` as the default in the AskUserQuestion below (still ask — never assume).
|
|
|
|
**AskUserQuestion with pre-filled context:** Pre-fill what you inferred from the codebase,
|
|
DESIGN.md, and office-hours output. Then ask for what's missing. Frame as ONE question
|
|
covering all gaps:
|
|
|
|
> "Here's what I know: [pre-filled context]. I'm missing [gaps].
|
|
> Tell me: [specific questions about the gaps].
|
|
> How many variants? (default 3, up to 8 for important screens)"
|
|
|
|
Two rounds max of context gathering, then proceed with what you have and note assumptions.
|
|
|
|
## Step 2: Taste Memory
|
|
|
|
Read both the persistent taste profile (cross-session) AND the per-session approved
|
|
designs to bias generation toward the user's demonstrated taste.
|
|
|
|
**Persistent taste profile (v1 schema at `~/.gstack/projects/$SLUG/taste-profile.json`):**
|
|
|
|
{{TASTE_PROFILE}}
|
|
|
|
**Per-session approved.json files (legacy, still supported):**
|
|
|
|
```bash
|
|
setopt +o nomatch 2>/dev/null || true
|
|
_TASTE=$(find ~/.gstack/projects/$SLUG/designs/ -name "approved.json" -maxdepth 2 2>/dev/null | sort -r | head -10)
|
|
```
|
|
|
|
If prior sessions exist, read each `approved.json` and extract patterns from the
|
|
approved variants. Merge these into the taste-profile.json-derived signal — if the
|
|
profile already says "user prefers Geist font" (from aggregated history), the
|
|
approved.json files add the specific recent approval context.
|
|
|
|
Limit to last 10 sessions. Try/catch JSON parse on each (skip corrupted files).
|
|
|
|
**Updating taste profile after a design-shotgun session:** When the user picks a
|
|
variant, call `{{BIN_DIR}}/gstack-taste-update approved <variant-path>`. When they
|
|
explicitly reject a variant, call `{{BIN_DIR}}/gstack-taste-update rejected <variant-path>`.
|
|
The CLI handles schema migration from approved.json, decay, and conflict flagging.
|
|
|
|
## Step 3: Generate Variants
|
|
|
|
Set up the output directory:
|
|
|
|
```bash
|
|
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)"
|
|
_DESIGN_DIR="$HOME/.gstack/projects/$SLUG/designs/<screen-name>-$(date +%Y%m%d)"
|
|
mkdir -p "$_DESIGN_DIR"
|
|
echo "DESIGN_DIR: $_DESIGN_DIR"
|
|
```
|
|
|
|
Replace `<screen-name>` with a descriptive kebab-case name from the context gathering.
|
|
|
|
### Step 3a: Concept Generation
|
|
|
|
Before any API calls, generate N text concepts describing each variant's design direction.
|
|
Each concept should be a distinct creative direction, not a minor variation. Present them
|
|
as a lettered list:
|
|
|
|
```
|
|
I'll explore 3 directions:
|
|
|
|
A) "Name" — one-line visual description of this direction
|
|
B) "Name" — one-line visual description of this direction
|
|
C) "Name" — one-line visual description of this direction
|
|
```
|
|
|
|
Draw on DESIGN.md, taste memory, and the user's request to make each concept distinct.
|
|
|
|
**Anti-convergence directive (hard requirement):** Each variant MUST use a different
|
|
font family, color palette, and layout approach. If two variants look like siblings
|
|
— same typographic feel, overlapping color temperature, comparable layout rhythm —
|
|
one of them failed. Regenerate the weaker one with a deliberately different direction.
|
|
|
|
Concrete test: if someone could swap the headline text between two variants without
|
|
noticing, they're too similar. Variants should feel like they came from three
|
|
different design teams, not the same team at three different coffee levels.
|
|
|
|
### Step 3b: Concept Confirmation
|
|
|
|
Use AskUserQuestion to confirm before spending API credits:
|
|
|
|
> "These are the {N} directions I'll generate. Each takes ~60s, but I'll run them all
|
|
> in parallel so total time is ~60 seconds regardless of count."
|
|
|
|
Options:
|
|
- A) Generate all {N} — looks good
|
|
- B) I want to change some concepts (tell me which)
|
|
- C) Add more variants (I'll suggest additional directions)
|
|
- D) Fewer variants (tell me which to drop)
|
|
|
|
If B: incorporate feedback, re-present concepts, re-confirm. Max 2 rounds.
|
|
If C: add concepts, re-present, re-confirm.
|
|
If D: drop specified concepts, re-present, re-confirm.
|
|
|
|
### Step 3c: Parallel Generation
|
|
|
|
**If evolving from a screenshot** (user said "I don't like THIS"), take ONE screenshot
|
|
of the page the user named, in Aside (PNG — `$D evolve` reads PNG):
|
|
|
|
```bash
|
|
aside repl '
|
|
const pg = await openTab("<url>");
|
|
await pg.screenshot({ path: "current.png", type: "png", fullPage: true });
|
|
console.log("ASIDE_DIR=" + pwd);
|
|
await closeTab(pg);
|
|
console.log("GSTACK_STEP_OK");
|
|
'
|
|
```
|
|
|
|
Then `cp "<ASIDE_DIR>/current.png" "$_DESIGN_DIR/current.png"` and Read it so the user
|
|
sees what you're evolving from.
|
|
|
|
**Launch N Agent subagents in a single message** (parallel execution). Use the Agent
|
|
tool with `subagent_type: "general-purpose"` and `run_in_background: false` for each
|
|
variant (parallel foreground calls in one message still run concurrently; subagents
|
|
default to background since Claude Code v2.1.198, and the comparison board needs every
|
|
variant's result). Each agent is independent
|
|
and handles its own generation, quality check, verification, and retry.
|
|
|
|
**Important: $D path propagation.** The `$D` variable from DESIGN SETUP is a shell
|
|
variable that agents do NOT inherit. Substitute the resolved absolute path (from the
|
|
`DESIGN_READY: /path/to/design` output in Step 0) into each agent prompt.
|
|
|
|
**Agent prompt template** (one per variant, substitute all `{...}` values):
|
|
|
|
```
|
|
Generate a design variant and save it.
|
|
|
|
Design binary: {absolute path to $D binary}
|
|
Brief: {the full variant-specific brief for this direction}
|
|
Output: /tmp/variant-{letter}.png
|
|
Final location: {_DESIGN_DIR absolute path}/variant-{letter}.png
|
|
|
|
Steps:
|
|
1. Run: {$D path} generate --brief "{brief}" --output /tmp/variant-{letter}.png
|
|
2. If the command fails with a rate limit error (429 or "rate limit"), wait 5 seconds
|
|
and retry. Up to 3 retries.
|
|
3. If the output file is missing or empty after the command succeeds, retry once.
|
|
4. Copy: cp /tmp/variant-{letter}.png {_DESIGN_DIR}/variant-{letter}.png
|
|
5. Quality check: {$D path} check --image {_DESIGN_DIR}/variant-{letter}.png --brief "{brief}"
|
|
If quality check fails, retry generation once.
|
|
6. Verify: ls -lh {_DESIGN_DIR}/variant-{letter}.png
|
|
7. Report exactly one of:
|
|
VARIANT_{letter}_DONE: {file size}
|
|
VARIANT_{letter}_FAILED: {error description}
|
|
VARIANT_{letter}_RATE_LIMITED: exhausted retries
|
|
```
|
|
|
|
For the evolve path, replace step 1 with:
|
|
```
|
|
{$D path} evolve --screenshot {_DESIGN_DIR}/current.png --brief "{brief}" --output /tmp/variant-{letter}.png
|
|
```
|
|
|
|
**Why /tmp/ then cp?** In observed sessions, `$D generate --output ~/.gstack/...`
|
|
failed with "The operation was aborted" while `--output /tmp/...` succeeded. This is
|
|
a sandbox restriction. Always generate to `/tmp/` first, then `cp`.
|
|
|
|
### Step 3d: Results
|
|
|
|
After all agents complete:
|
|
|
|
1. Read each generated PNG inline (Read tool) so the user sees all variants at once.
|
|
2. Report status: "All {N} variants generated in ~{actual time}. {successes} succeeded,
|
|
{failures} failed."
|
|
3. For any failures: report explicitly with the error. Do NOT silently skip.
|
|
4. If zero variants succeeded: fall back to sequential generation (one at a time with
|
|
`$D generate`, showing each as it lands). Tell the user: "Parallel generation failed
|
|
(likely rate limiting). Falling back to sequential..."
|
|
5. Proceed to Step 4 (comparison board).
|
|
|
|
**Dynamic image list for comparison board:** When proceeding to Step 4, construct the
|
|
image list from whatever variant files actually exist, not a hardcoded A/B/C list:
|
|
|
|
```bash
|
|
setopt +o nomatch 2>/dev/null || true # zsh compat
|
|
_IMAGES=$(ls "$_DESIGN_DIR"/variant-*.png 2>/dev/null | tr '\n' ',' | sed 's/,$//')
|
|
```
|
|
|
|
Use `$_IMAGES` in the `$D compare --images` command.
|
|
|
|
## Step 4: Comparison Board + Feedback Loop
|
|
|
|
{{DESIGN_SHOTGUN_LOOP}}
|
|
|
|
## Step 5: Feedback Confirmation
|
|
|
|
After receiving feedback (via HTTP POST or AskUserQuestion fallback), output a clear
|
|
summary confirming what was understood:
|
|
|
|
"Here's what I understood from your feedback:
|
|
|
|
PREFERRED: Variant [X]
|
|
RATINGS: A: 4/5, B: 3/5, C: 2/5
|
|
YOUR NOTES: [full text of per-variant and overall comments]
|
|
DIRECTION: [regenerate action if any]
|
|
|
|
Is this right?"
|
|
|
|
Use AskUserQuestion to confirm before saving.
|
|
|
|
## Step 6: Save & Next Steps
|
|
|
|
Write `approved.json` to `$_DESIGN_DIR/` (handled by the loop above).
|
|
|
|
If invoked from another skill: return the structured feedback for that skill to consume.
|
|
The calling skill reads `approved.json` and the approved variant PNG.
|
|
|
|
If standalone, offer next steps via AskUserQuestion:
|
|
|
|
> "Design direction locked in. What's next?
|
|
> A) Iterate more — refine the approved variant with specific feedback
|
|
> B) Finalize — generate production Pretext-native HTML/CSS with /design-html
|
|
> C) Save to plan — add this as an approved mockup reference in the current plan
|
|
> D) Done — I'll use this later"
|
|
|
|
## Important Rules
|
|
|
|
1. **Never save to `.context/`, `docs/designs/`, or `/tmp/`.** All design artifacts go
|
|
to `~/.gstack/projects/$SLUG/designs/`. This is enforced. See DESIGN_SETUP above.
|
|
2. **Show variants inline before opening the board.** The user should see designs
|
|
immediately in their terminal. The browser board is for detailed feedback.
|
|
3. **Confirm feedback before saving.** Always summarize what you understood and verify.
|
|
4. **Taste memory is automatic.** Prior approved designs inform new generations by default.
|
|
5. **Two rounds max on context gathering.** Don't over-interrogate. Proceed with assumptions.
|
|
6. **DESIGN.md is the default constraint.** Unless the user says otherwise.
|