Make "Send to agent" wake the coding agent #7
Problem#
Pressing Send to agent wrote a feedback bundle to .rive-preview/feedback/, but nothing woke an agent whose turn had ended. The bundle stayed unread. The player still said "waiting for the agent to read it", which implied the agent had been told.
What this adds#
rive-video-preview wait-feedback [project-dir | file.riv]. It blocks until there is an unread bundle (or returns at once if one is already waiting) and prints it:feedback.mdwith the notes, timecodes, artboard/animation and audio mix, plus every image path. It then marks the bundle read and exits 0.- Agents run it as a background command. Claude Code re-invokes the agent when that command exits, so the user's Send wakes it, and the session stays free meanwhile.
- Options:
--timeout(exit 124) and--no-mark-read. Ctrl-C exits 130. - It watches the feedback folder, with polling as a backup, and doesn't need the player to be running. Half-written bundles are ignored until
feedback.jsonlands.
- Listening status.
wait-feedbackand MCPwait_for_feedbackkeep a heartbeat file in.rive-preview/listeners/. The server reports it, and the player says either "The agent is listening and will pick it up now" or "the agent isn't listening — paste the prompt on your clipboard into your agent chat". - Exactly-once delivery. Every consumer (CLI waiters, MCP
get_feedback/wait_for_feedback) takes an exclusive per-bundle claim (claimed.json) before delivering.- The claim has an owner token and is renewed while held. It is released in
finally. - A stale claim (dead process, or no renewal for 60 s) is taken over under a short lock. Two Codex reviews checked this; their findings are fixed here.
- The claim has an owner token and is renewed while held. It is released in
- Skill (
skills/rive-video-preview/SKILL.md):- Tells agents to keep the listener running after showing the player and after each round of fixes.
- Says not to promise to pick up feedback unless the listener is running.
- Now covers the audio mix (
get_audio_mix, the mix in bundles,mix.json) and audio timing for a bare.riv. - Its description mentions sound levels, so requests about volume trigger it.
- README and
--helpupdated to match.
Testing#
node --checkpasses on all changed files.- End to end through the server API (
/api/shots+/api/share), with a project and with a bare.riv:- waiter running before the send, and a bundle already waiting at start
- several bundles at once, a half-written bundle
- timeout (124), Ctrl-C (130),
kill -9cleanup
- Races:
- 2 CLI waiters on one bundle, and 3 waiters on a stale claim: exactly one delivered it in every round.
- CLI vs MCP
wait_for_feedback: exactly one delivered it in every round.
- Claims: renewal, release only by the owner, takeover of an empty or old claim and lock, and
get_feedbackapplyinglimitafter skipping claimed bundles. - Player UI (headless browser): both the "listening" and "not listening" states, and the switch to "✓ The agent read".
🤖 Generated with Claude Code
- 1
fuko merged this1e457a7
fuko closed this
Sign in to join this conversation.