chore: regenerate SKILL.md files for file-polling feedback loop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-27 09:52:51 -06:00
parent 025f7b2701
commit 1fbf6c4b46
3 changed files with 112 additions and 36 deletions

View File

@@ -717,12 +717,35 @@ $D compare --images "$_DESIGN_DIR/variant-A.png,$_DESIGN_DIR/variant-B.png,$_DES
``` ```
This command generates the board HTML, starts an HTTP server on a random port, This command generates the board HTML, starts an HTTP server on a random port,
and opens it in the user's default browser. It blocks until the user submits and opens it in the user's default browser. **Run it in the background** with `&`
feedback. The feedback JSON is printed to stdout. because the agent needs to keep running while the user interacts with the board.
**Reading the result:** **IMPORTANT: Reading feedback via file polling (not stdout):**
The agent reads stdout. The JSON has this shape: The server writes feedback to files next to the board HTML. The agent polls for these:
- `$_DESIGN_DIR/feedback.json` — written when user clicks Submit (final choice)
- `$_DESIGN_DIR/feedback-pending.json` — written when user clicks Regenerate/Remix/More Like This
**Polling loop** (run after launching `$D serve` in background):
```bash
# Poll for feedback files every 5 seconds (up to 10 minutes)
for i in $(seq 1 120); do
if [ -f "$_DESIGN_DIR/feedback.json" ]; then
echo "SUBMIT_RECEIVED"
cat "$_DESIGN_DIR/feedback.json"
break
elif [ -f "$_DESIGN_DIR/feedback-pending.json" ]; then
echo "REGENERATE_RECEIVED"
cat "$_DESIGN_DIR/feedback-pending.json"
rm "$_DESIGN_DIR/feedback-pending.json"
break
fi
sleep 5
done
```
The feedback JSON has this shape:
```json ```json
{ {
"preferred": "A", "preferred": "A",
@@ -733,23 +756,23 @@ The agent reads stdout. The JSON has this shape:
} }
``` ```
**If `"regenerated": true`:** **If `feedback-pending.json` found (`"regenerated": true`):**
1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`, 1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`,
`"remix"`, or custom text) `"remix"`, or custom text)
2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`) 2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`)
3. Generate new variants with `$D iterate` or `$D variants` using updated brief 3. Generate new variants with `$D iterate` or `$D variants` using updated brief
4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"` 4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"`
5. Reload the running server: parse the port from stderr (`SERVE_STARTED: port=XXXXX`), 5. Parse the port from the `$D serve` stderr output (`SERVE_STARTED: port=XXXXX`),
then POST the new HTML: then reload the board in the user's browser (same tab):
`curl -s -X POST http://localhost:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'` `curl -s -X POST http://127.0.0.1:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'`
6. The board auto-refreshes in the same browser tab. Wait for the next stdout line. 6. The board auto-refreshes. **Poll again** for the next feedback file.
7. Repeat until `"regenerated": false`. 7. Repeat until `feedback.json` appears (user clicked Submit).
**If `"regenerated": false`:** **If `feedback.json` found (`"regenerated": false`):**
1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON 1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON
2. Proceed with the approved variant 2. Proceed with the approved variant
**If `$D serve` fails or times out:** Fall back to AskUserQuestion: **If `$D serve` fails or no feedback within 10 minutes:** Fall back to AskUserQuestion:
"I've opened the design board. Which variant do you prefer? Any feedback?" "I've opened the design board. Which variant do you prefer? Any feedback?"
**After receiving feedback (any path):** Output a clear summary confirming **After receiving feedback (any path):** Output a clear summary confirming

View File

@@ -33,8 +33,10 @@ _PROACTIVE=$(~/.claude/skills/gstack/bin/gstack-config get proactive 2>/dev/null
_PROACTIVE_PROMPTED=$([ -f ~/.gstack/.proactive-prompted ] && echo "yes" || echo "no") _PROACTIVE_PROMPTED=$([ -f ~/.gstack/.proactive-prompted ] && echo "yes" || echo "no")
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown") _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "BRANCH: $_BRANCH" echo "BRANCH: $_BRANCH"
_SKILL_PREFIX=$(~/.claude/skills/gstack/bin/gstack-config get skill_prefix 2>/dev/null || echo "false")
echo "PROACTIVE: $_PROACTIVE" echo "PROACTIVE: $_PROACTIVE"
echo "PROACTIVE_PROMPTED: $_PROACTIVE_PROMPTED" echo "PROACTIVE_PROMPTED: $_PROACTIVE_PROMPTED"
echo "SKILL_PREFIX: $_SKILL_PREFIX"
source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
REPO_MODE=${REPO_MODE:-unknown} REPO_MODE=${REPO_MODE:-unknown}
echo "REPO_MODE: $REPO_MODE" echo "REPO_MODE: $REPO_MODE"
@@ -58,6 +60,11 @@ types (e.g., /qa, /ship). If you would have auto-invoked a skill, instead briefl
"I think /skillname might help here — want me to run it?" and wait for confirmation. "I think /skillname might help here — want me to run it?" and wait for confirmation.
The user opted out of proactive behavior. The user opted out of proactive behavior.
If `SKILL_PREFIX` is `"true"`, the user has namespaced skill names. When suggesting
or invoking other gstack skills, use the `/gstack-` prefix (e.g., `/gstack-qa` instead
of `/qa`, `/gstack-ship` instead of `/ship`). Disk paths are unaffected — always use
`~/.claude/skills/gstack/[skill-name]/SKILL.md` for reading skill files.
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue. If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle. If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
@@ -507,12 +514,35 @@ $D compare --images "$_DESIGN_DIR/variant-A.png,$_DESIGN_DIR/variant-B.png,$_DES
``` ```
This command generates the board HTML, starts an HTTP server on a random port, This command generates the board HTML, starts an HTTP server on a random port,
and opens it in the user's default browser. It blocks until the user submits and opens it in the user's default browser. **Run it in the background** with `&`
feedback. The feedback JSON is printed to stdout. because the agent needs to keep running while the user interacts with the board.
**Reading the result:** **IMPORTANT: Reading feedback via file polling (not stdout):**
The agent reads stdout. The JSON has this shape: The server writes feedback to files next to the board HTML. The agent polls for these:
- `$_DESIGN_DIR/feedback.json` — written when user clicks Submit (final choice)
- `$_DESIGN_DIR/feedback-pending.json` — written when user clicks Regenerate/Remix/More Like This
**Polling loop** (run after launching `$D serve` in background):
```bash
# Poll for feedback files every 5 seconds (up to 10 minutes)
for i in $(seq 1 120); do
if [ -f "$_DESIGN_DIR/feedback.json" ]; then
echo "SUBMIT_RECEIVED"
cat "$_DESIGN_DIR/feedback.json"
break
elif [ -f "$_DESIGN_DIR/feedback-pending.json" ]; then
echo "REGENERATE_RECEIVED"
cat "$_DESIGN_DIR/feedback-pending.json"
rm "$_DESIGN_DIR/feedback-pending.json"
break
fi
sleep 5
done
```
The feedback JSON has this shape:
```json ```json
{ {
"preferred": "A", "preferred": "A",
@@ -523,23 +553,23 @@ The agent reads stdout. The JSON has this shape:
} }
``` ```
**If `"regenerated": true`:** **If `feedback-pending.json` found (`"regenerated": true`):**
1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`, 1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`,
`"remix"`, or custom text) `"remix"`, or custom text)
2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`) 2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`)
3. Generate new variants with `$D iterate` or `$D variants` using updated brief 3. Generate new variants with `$D iterate` or `$D variants` using updated brief
4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"` 4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"`
5. Reload the running server: parse the port from stderr (`SERVE_STARTED: port=XXXXX`), 5. Parse the port from the `$D serve` stderr output (`SERVE_STARTED: port=XXXXX`),
then POST the new HTML: then reload the board in the user's browser (same tab):
`curl -s -X POST http://localhost:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'` `curl -s -X POST http://127.0.0.1:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'`
6. The board auto-refreshes in the same browser tab. Wait for the next stdout line. 6. The board auto-refreshes. **Poll again** for the next feedback file.
7. Repeat until `"regenerated": false`. 7. Repeat until `feedback.json` appears (user clicked Submit).
**If `"regenerated": false`:** **If `feedback.json` found (`"regenerated": false`):**
1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON 1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON
2. Proceed with the approved variant 2. Proceed with the approved variant
**If `$D serve` fails or times out:** Fall back to AskUserQuestion: **If `$D serve` fails or no feedback within 10 minutes:** Fall back to AskUserQuestion:
"I've opened the design board. Which variant do you prefer? Any feedback?" "I've opened the design board. Which variant do you prefer? Any feedback?"
**After receiving feedback (any path):** Output a clear summary confirming **After receiving feedback (any path):** Output a clear summary confirming

View File

@@ -608,12 +608,35 @@ $D compare --images "$_DESIGN_DIR/variant-A.png,$_DESIGN_DIR/variant-B.png,$_DES
``` ```
This command generates the board HTML, starts an HTTP server on a random port, This command generates the board HTML, starts an HTTP server on a random port,
and opens it in the user's default browser. It blocks until the user submits and opens it in the user's default browser. **Run it in the background** with `&`
feedback. The feedback JSON is printed to stdout. because the agent needs to keep running while the user interacts with the board.
**Reading the result:** **IMPORTANT: Reading feedback via file polling (not stdout):**
The agent reads stdout. The JSON has this shape: The server writes feedback to files next to the board HTML. The agent polls for these:
- `$_DESIGN_DIR/feedback.json` — written when user clicks Submit (final choice)
- `$_DESIGN_DIR/feedback-pending.json` — written when user clicks Regenerate/Remix/More Like This
**Polling loop** (run after launching `$D serve` in background):
```bash
# Poll for feedback files every 5 seconds (up to 10 minutes)
for i in $(seq 1 120); do
if [ -f "$_DESIGN_DIR/feedback.json" ]; then
echo "SUBMIT_RECEIVED"
cat "$_DESIGN_DIR/feedback.json"
break
elif [ -f "$_DESIGN_DIR/feedback-pending.json" ]; then
echo "REGENERATE_RECEIVED"
cat "$_DESIGN_DIR/feedback-pending.json"
rm "$_DESIGN_DIR/feedback-pending.json"
break
fi
sleep 5
done
```
The feedback JSON has this shape:
```json ```json
{ {
"preferred": "A", "preferred": "A",
@@ -624,23 +647,23 @@ The agent reads stdout. The JSON has this shape:
} }
``` ```
**If `"regenerated": true`:** **If `feedback-pending.json` found (`"regenerated": true`):**
1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`, 1. Read `regenerateAction` from the JSON (`"different"`, `"match"`, `"more_like_B"`,
`"remix"`, or custom text) `"remix"`, or custom text)
2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`) 2. If `regenerateAction` is `"remix"`, read `remixSpec` (e.g. `{"layout":"A","colors":"B"}`)
3. Generate new variants with `$D iterate` or `$D variants` using updated brief 3. Generate new variants with `$D iterate` or `$D variants` using updated brief
4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"` 4. Create new board: `$D compare --images "..." --output "$_DESIGN_DIR/design-board.html"`
5. Reload the running server: parse the port from stderr (`SERVE_STARTED: port=XXXXX`), 5. Parse the port from the `$D serve` stderr output (`SERVE_STARTED: port=XXXXX`),
then POST the new HTML: then reload the board in the user's browser (same tab):
`curl -s -X POST http://localhost:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'` `curl -s -X POST http://127.0.0.1:PORT/api/reload -H 'Content-Type: application/json' -d '{"html":"$_DESIGN_DIR/design-board.html"}'`
6. The board auto-refreshes in the same browser tab. Wait for the next stdout line. 6. The board auto-refreshes. **Poll again** for the next feedback file.
7. Repeat until `"regenerated": false`. 7. Repeat until `feedback.json` appears (user clicked Submit).
**If `"regenerated": false`:** **If `feedback.json` found (`"regenerated": false`):**
1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON 1. Read `preferred`, `ratings`, `comments`, `overall` from the JSON
2. Proceed with the approved variant 2. Proceed with the approved variant
**If `$D serve` fails or times out:** Fall back to AskUserQuestion: **If `$D serve` fails or no feedback within 10 minutes:** Fall back to AskUserQuestion:
"I've opened the design board. Which variant do you prefer? Any feedback?" "I've opened the design board. Which variant do you prefer? Any feedback?"
**After receiving feedback (any path):** Output a clear summary confirming **After receiving feedback (any path):** Output a clear summary confirming