Inspiration

Every AI video clipper works the same way: upload, wait, receive highlights, then fix them somewhere else. The model does the judging and the editing, and you get whichever boundaries it computed.

I wanted the opposite division of labour. An agent is good at reading a transcript and saying which stretches stand on their own. A human is good at watching the footage and feeling where a cut lands. WebMCP made it possible to put both in the same page, editing the same clip, with the browser keeping both honest about who changed what.

A cutlet is a small cut. Small cuts, served fresh.

What it does

Cutlet is a rough-cut editor for spoken video. It is not a clip finder; no model scores your footage. The page holds the video, a transcript broken into sentences with stable ids, and a rail of clips. The agent reaches all of it through ten WebMCP tools registered on the top-level document.

The core loop is anchor and expand:

  1. You click the sentence that must survive.
  2. The agent reads a window around it and proposes a clip as a range of sentence ids, s0009–s0013, never floating timestamps.
  3. The player runs exactly that range and stops.
  4. You drop a line or move an edge. The clip's revision bumps.
  5. The agent's next write carries the revision it last saw. Yours is newer, so the write is refused with the real revision in the error. It calls get_editor_state and revises from your edit, not over it.
cut_clip          c2  keep s0008,s0010,s0011,s0013   → revision 2, 3 pieces, 37s
                  ↓ human drops s0011 in the transcript → revision 5
cut_clip          c2  expectedRevision 4              → REFUSED  "it is now 5"
get_editor_state                                      → sees the real cut

The active clip is coloured by who last touched it: blue while it is the agent's proposal, amber the moment you edit it, in the transcript, the timeline and the card.

Beyond the loop: "find the best clips in this" makes the agent skim the whole transcript and create one clip per moment, each with a title and a reason. "Cut this to forty seconds" turns a clip into several pieces with gaps, and playback jumps the gaps. Every dropped sentence stays visible, struck through, with a control to put it back. When the recogniser missed a full stop, you select the words you want and make them their own sentence with their own id, so a boundary you can point at becomes a boundary the agent can name. The agent can split too.

The agent gets every cut twice: the source transcript, and the sequence as it plays, with each gap marked by what was dropped and how long it ran. That is how it catches a dangling "its conquest" whose antecedent left with the cut.

Export re-encodes each piece in the tab with ffmpeg.wasm, so boundaries are frame-accurate rather than keyframe-snapped, joins them, and writes an .srt rebased across the cut. Your video never leaves the tab. The transcript windows the tools return are shared with the agent; nothing else is.

How I built it

Vite, React, TypeScript, CSS Modules. No backend, no UI library, no state library. 45 Node tests run directly against the TypeScript, covering parsing, sentence splitting, selection, reordering and tool registration.

  • Transcript pipeline. Word-level JSON is primary; Whisper, Deepgram and ElevenLabs Scribe all parse, with SRT and VTT as coarse fallbacks. Sentence splitting handles abbreviations, initials, rhetorical pauses and a clause backoff at the length ceiling.
  • Preview is the native <video> element, with the range boundary enforced on requestAnimationFrame, because timeupdate fires at about 4 Hz and visibly overshoots.
  • Export is the single-thread @ffmpeg/core, lazy-loaded on first use. Single-thread means no SharedArrayBuffer, which means no COOP/COEP headers, which is why it deploys to plain static hosting.
  • Tools register through document.modelContext.registerTool on the top-level document, with an AbortController for teardown. Read tools carry readOnlyHint. The page feature-detects the API and works fully without it; the header pill says whether tools are live, and clicking it lists them from the same table the registration reads, so the two cannot drift.
  • Keyboard. The transcript is a listbox with one tab stop: arrows move the anchor, shift extends it, Enter plays, ⌘-click banks a range.

Two recordings ship, both public domain and credited: Kennedy's "We choose to go to the Moon" at Rice, and the Apollo 11 crew interview. Transcripts were made locally; no keys ship in the client.

Challenges I ran into

WebMCP is one-directional. A page cannot call an agent. There is no "find clips" button because there cannot be one, so the empty state's job is to tell you what to ask. There used to be a lexical "rough pass" fallback for browsers without the API. I removed it: a heuristic dressed as judgement is worse than an empty rail that tells you what to ask.

Ids stop being positional the moment you split. Renumbering after a split would silently repoint every later id at its neighbour, and a stale id that resolves to the wrong sentence is worse than one that fails to resolve. So the new half gets a fresh number and nothing after it moves.

The agent kept overwriting the human's anchor. preview_clip used to set the selection, so an agent auditioning a range destroyed the very mark it was told to build around. Auditions now have their own state and render dashed, in the agent's blue, beside the anchor.

Bugs only testing found. Number(undefined) is NaN, which is not nullish, so search_transcript returned empty context whenever the argument was omitted. A Whisper file's outer segments parsed as "words" and shadowed the real word timings. Deepgram's unpunctuated word beat punctuated_word and broke sentence splitting. Smooth scrollIntoView is silently ignored under reduced motion and in background tabs, so following the playhead just stopped; both now fall back to an instant jump.

ffmpeg.wasm under a bundler. It has to be the ESM core, handed over as blob URLs. Otherwise the module worker cannot import it, and the dev server rewrites the path to a 404.

What I learned

The whole design fell out of one decision: every boundary is a sentence id, because an id means the same thing to both parties and a dragged pixel does not. That is why the sequence timeline is read-only, why sentence splitting exists, and why the revision check works at all. Optimistic concurrency turned out to be the right primitive for a human and an agent sharing one document.

What's next

More WebMCP hosts as they ship. Word-level trims inside a split. A library format other people can add recordings to without touching code.

Built With

Share this project:

Updates