$npx -y skills add Jakubantalik/transitions.dev --skill refine-liveIn-chat fallback for the Timeline Inspector Refine agent. Use when the user runs /refine live, asks to "refine live", "go live", or answer refine jobs — but ONLY when no persistent agent is wired (no npx transitions-refine live). Prefer npx transitions-refine live for run-a
| 1 | # Refine Live |
| 2 | |
| 3 | ## Two modes |
| 4 | |
| 5 | **Persistent (recommended — run and forget)** |
| 6 | Run `npx transitions-refine live` from your project. The CLI starts the relay and wires `REFINE_AGENT_CMD` so the relay spawns your agent CLI **per Refine click**. No chat loop; idle = zero credit burn. Works hours later as long as the relay process keeps running. Stop with Ctrl-C (or `npx transitions-refine stop`). |
| 7 | |
| 8 | **In-chat loop (fallback — this skill)** |
| 9 | Run `/refine live` in Cursor/Claude/Codex when the relay is up but has **no** `REFINE_AGENT_CMD`. **You** become the poller via `GET /jobs/next`. The Agent tab stays available only while you keep polling — **each idle poll cycle consumes chat turns/credits**. Say "stop refine" to exit. |
| 10 | |
| 11 | Use the in-chat loop only when you cannot wire a persistent agent CLI. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | Turn yourself into the LLM behind the Timeline Inspector's **Refine** button (**in-chat fallback mode**). While |
| 16 | this loop runs, the panel's **LLM** tab is "available": each click sends one |
| 17 | transition here, you reason about it, and your suggestions appear in the panel. |
| 18 | |
| 19 | You are the poller. Nothing is installed — you just talk to a small local relay |
| 20 | (default `http://localhost:7331`) that the `npx` injector already started. |
| 21 | |
| 22 | ## How it works |
| 23 | |
| 24 | ``` |
| 25 | Browser (Refine, LLM tab) ──POST /jobs──► relay ──GET /jobs/next──► YOU |
| 26 | ◄──GET /jobs/:id── relay ◄──POST /jobs/:id/result── YOU |
| 27 | ``` |
| 28 | |
| 29 | ## The loop — stay live, but don't burn credits forever |
| 30 | |
| 31 | Keep polling so the panel's LLM tab stays "available", but this loop costs chat |
| 32 | turns/credits even while idle, so it is **not** truly run-and-forget — it has |
| 33 | three exits, in priority order: |
| 34 | |
| 35 | 1. **Relay stop signal (authoritative).** `GET /jobs/next` may return `200` with |
| 36 | `{"stop": true}`. The relay sends this when the user clicks **Stop** in the |
| 37 | panel, or automatically after ~10 min with no jobs. **Always honor it: stop |
| 38 | looping immediately**, tell the user the LLM tab will go unavailable and how to |
| 39 | resume (`/refine live`), and end your turn. Never re-poll after a stop signal. |
| 40 | 2. **The user says so** — "stop refine", "exit live", etc. |
| 41 | 3. **Your own idle backoff (safety net).** A long stretch of `204`s is normal — |
| 42 | it just means no one has clicked Refine yet — but to avoid spending credits on |
| 43 | a forgotten loop, **back off as idle grows** instead of hammering immediately: |
| 44 | re-poll right away for the first few empty cycles, then pause ~5s between polls, |
| 45 | and after ~10 min of unbroken idle stop on your own (same as the relay's |
| 46 | auto-stop) and tell the user how to resume. Any real job resets the backoff. |
| 47 | |
| 48 | The relay reports the agent as "available" for ~120s after your last poll, so |
| 49 | short pauses keep you live. A successful job always resets idle, so an active |
| 50 | session never backs off. |
| 51 | |
| 52 | 0. **Announce yourself once, before the first poll.** The relay keeps a *sticky* |
| 53 | Stop latch: after a panel **Stop** (or the idle auto-stop) it answers every |
| 54 | `GET /jobs/next` with `{"stop": true}` until a new agent explicitly resumes — |
| 55 | so a stopped session can't silently come back. Clear the latch a single time |
| 56 | at startup, then begin polling: |
| 57 | |
| 58 | ```bash |
| 59 | curl -s -X POST http://localhost:7331/poller/start |
| 60 | ``` |
| 61 | |
| 62 | Do **not** call this again mid-loop (it would defeat a user's Stop). Only on a |
| 63 | fresh `/refine live`. |
| 64 | |
| 65 | 1. **Claim the next job (long-poll).** This call blocks up to ~25s, then returns. |
| 66 | |
| 67 | ```bash |
| 68 | curl -s http://localhost:7331/jobs/next |
| 69 | ``` |
| 70 | |
| 71 | - HTTP `204` / empty body → no work yet. Poll again, applying the idle |
| 72 | backoff above (immediate at first, then ~5s pauses, then stop after ~10 min). |
| 73 | - HTTP `200` with `{"stop": true}` → **the loop must end.** Stop polling, tell |
| 74 | the user the LLM tab is now unavailable and that `/refine live` resumes it, |
| 75 | and end your turn. Do not treat it as a job. |
| 76 | - HTTP `200` with a job JSON → work to do. Shape: |
| 77 | |
| 78 | ```json |
| 79 | { |
| 80 | "id": "uuid", |
| 81 | "request": { |
| 82 | "label": "Resize + Color", |
| 83 | "selector": ".box-resize", |
| 84 | "mode": "llm", |
| 85 | "refineType": "small", |
| 86 | "timings": [ |
| 87 | { "property": "width", "durationMs": 400, "delayMs": 0, "easing": "ease-out" }, |
| 88 | { "property": "background", "durationMs": 400, "delayMs": 0, "easing": "ease-out" } |
| 89 | ] |
| 90 | } |
| 91 | } |
| 92 | ``` |
| 93 | |
| 94 | - **If `request.kind === "scan"`** this is not a suggestion job — the panel is |
| 95 | asking you to group the page's transitions by reading the source. Jump to |
| 96 | [`## Scan jobs`](#scan-jobs-group-from-source |