← 教程列表
news

The Loop

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 8 阅读

1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`: - Before each write, check that `$STATE_DIR/server-info` exists. If it doesn't (or `$STATE_DIR/server-stopped` exists), the server has shut down — restart it with `start-server.sh` before continuing. The server auto-exits after 30 minutes of inactivity. - Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html` - **Never reuse filenames** — each screen gets a fresh file - Use Write tool — **never use cat/heredoc** (dumps noise into terminal) - Server automatically serves the newest file 2. **Tell user what to expect and end your turn:** - Remind them of the URL (every step, not just first) - Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage") - Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like." 3. **On your next turn** — after the user responds in the terminal: - Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines - Merge with the user's terminal text to get the full picture - The terminal message is the primary feedback; `state_dir/events` provides structured interaction data 4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated. 5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content: ```html

Continuing in terminal...

``` This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual. 6. Repeat until done.

← 返回教程列表 AI8899 · 内容仅供学习参考