Skip to content

feat(content): the review sees a video's first two seconds - #656

Merged
5hirish merged 21 commits into
mainfrom
feat/content-video-opening-stills
Dec 5, 2026
Merged

5hirish merged 21 commits into
mainfrom
feat/content-video-opening-stills

Conversation

@5hirish

@5hirish 5hirish commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

What and why

The review now sees a video's first two seconds instead of guessing from its prompt and one cover frame. That's where most viewers leave a short video, and a cover frame can't show whether anything fills the frame at once or changes before the thumb moves.

sequenceDiagram
  participant R as review_post / writer
  participant T as see_opening
  participant B as Browser (app or desktop)
  participant A as API
  R->>T: see_opening()
  T->>B: opening_stills_requested (post, render_id, seconds)
  B->>A: GET /content/clip/{session}?post_id
  A-->>B: the chosen take's bytes (blob, same origin)
  B->>B: seek 0, 0.3, 0.6, 1, 1.5, 2 s, draw each to canvas
  B->>A: POST /content/opening-stills/{session}
  A-->>T: six JPEGs
  T-->>R: six stills, in order
Loading
  • Same bridge as render_slide: an event out, a POST back, a future in between. No video library on the server or in the desktop shell.
  • Why the clip goes through the API: the page reads it as a blob it owns, so the canvas is never CORS-tainted, wherever the file is stored.
  • The tool saves nothing, so the review sub-agent can hold it. The assembly test keeps writers off sub-agents.
  • With no browser connected (scheduled runs) or a clip the browser can't decode, the tool says the opening went unseen. The review then says it judged from the prompt.

Area

  • backend/ — FastAPI / Python
  • app/ — Next.js
  • desktop/ — Tauri shell / sidecar
  • site/ — static marketing site
  • CI / tooling / docs

Launch

Launch: changelog only, because it changes what the review sees, not a screen.

Verification

backend: ruff (passed); pytest -m "not live" tests → 3336 passed, 1 skipped
  new: the tool's success, unseen and no-clip paths; the clip route (member 200, stranger 404); the stills route resolves once
app: typecheck, vitest (595 passed, incl. clipCapture's cover-fit and empty case)
by hand: captureClipStills on a 3 s 720×1280 H.264 clip → six distinct stills in WebKit and in Chrome (playwright-core)
make dump-prompts → agent-prompts.md updated
  • I ran the checks for the areas I touched (see CONTRIBUTING.md)
  • I added or updated tests covering the behaviour that changed
  • I read the AGENTS.md for each directory I edited
  • I read my own diff back looking for the reason to reject it, and read it
    against the code around it (STYLE.md)

Things that need a second look

AI assistance

  • An AI coding agent wrote or substantially shaped this change
  • I have read every line of this diff and can explain why each part is there

Generated by Claude Code

5hirish and others added 5 commits December 1, 2026 18:16
A project's banned list matched each entry only as written, so banning
"unlock" let "unlocking" and "unlocked" through, and "game-changer" let
"game-changers" through. Each plain word now also matches its regular
English forms (s, es, ed, ing, with the dropped e, the y to ies and the
doubled consonant). Whole words only, so "just" still never trips
"justice" and "dive in" still leaves "dive into" alone. Anything that is
not plain ASCII letters, and any irregular form, is matched as written.

The project's voice line tells the writer the rule covers every form, so
it does not spend a retry finding out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four things a brand's first TikTok videos taught, each a gap in how
Content Studio judged or handed off a video.

The hold. Zernio returns each video's retention curve, second by second,
and Duct kept only average watch and completion. The share still watching
at 3 seconds is now a metric (hold_3s, a percent, typed in where the
scheduler does not report it), and the plan reads it on its own ruler:
the median, how many videos fell under 60%, and each hook type's record.
75% or more is an opening to repeat, under 60% a first three seconds to
re-cut. A posted day in the plan review leads with it.

The completion scale. read_metric scaled completion only above 1, so a
0.85% completion, a usual reading on TikTok, was read as 85% and could
crown the format almost nobody finished. Every writer stores a percent;
it is now always one. The test fixtures move to percents with it.

The draft. TikTok ignores every post setting on a draft (Zernio's API
reference), so a post saved as one lands with no caption and no AI label.
The approval card, the agent's tool result and the publish dialog now say
what is left to do in the app, and the dialog copies the caption in one
tap. A generated video posted straight through Zernio sends TikTok's
AI-generated label (videoMadeWithAi), kept on later edits; PostBridge
cannot send it, so its card says to save a draft and label it there.

What to expect. TikTok's channel guide gains what a small account should
expect (a few hundred views is the median, one post proves nothing) and
the claims repeated everywhere that nothing backs, so the plan reads a
220-view post as normal and never passes on folklore as a rule. Sources
are beside the entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… strangers win on

Two steps that close the loop from a topic to its second try.

Re-cuts. A video under 60% still watching at 3 seconds tells nothing
about its topic: almost nobody stayed long enough to hear it. The review
already writes two other openings for every post and they were never
used. The plan now lists each such video with those unused openings
(performance.recuts, newest first, at most three) and is told to give it a
day before a new topic on its pillar. A plan day carries `recut_of` and
the `opening` to use; submit_plan refuses a re-cut of a post the project
never published or one with no opening, and the draft brief tells the
writer to keep the post and change only its first three seconds.

Topic proof. discover_tiktok returned the top posts by plays, which are
mostly large accounts, so it said what is popular, not whether a topic
reaches strangers. It now returns a `proof` over every post found: the
median plays and how many small accounts (under 10,000 followers) passed
50,000. When a brand ranked its topics by hand, that count separated a
broad problem from an insider's one. Followers 0 is an unreported author,
never counted as small. The plan and draft prompts say to prefer a topic
where small accounts break out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The audience panel asked each persona whether they would stop, comment,
save, share or click, and which opening stopped them. Nothing asked what
the post told them. A model playing a person is kinder than the person,
so a post could earn saves from the panel and teach nothing: the failure
a cold read catches, and the one a real feed punishes in two seconds.

Each reader (the personas and Anyone scrolling) now writes `took_away`,
what the post told them in their own words, "nothing I can use" allowed.
Only after that does the reviewer write `meant`, the one sentence the post
sets out to leave, read off the post rather than any brief, and grade each
take-away as `heard`: match, drift or lost. Words, not warmth: a reader who
loved it and cannot say what it said is lost.

draft_verdict adds `unclear` when more than half of the graded readers
missed the point, with what they heard instead; it sends a new draft back
for its one revision, and the orchestrator is told to make the payoff say
the point plainly and earlier rather than explain more. Reviews stored
before this have no grades and never read as unclear. The Review panel
shows how many got the point, what the post meant, and each reader's
take-away. It stays advice beside the score and is labelled role-play.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review judged a video's opening from its prompt and one cover frame,
and the writer never looked at the clip it made. Most viewers who leave a
short video leave in its first two seconds, and a cover frame cannot show
whether anything fills the frame at once or changes before the thumb
moves: the two things a held opening needs.

see_opening asks the browser for six stills of the chosen take, at 0,
0.3, 0.6, 1, 1.5 and 2 s, over the same bridge render_slide uses (an
event out, a POST back, a future in between). The browser reads the clip
through a new API route rather than from its storage URL, so the video
plays from a blob the page owns and the canvas is never CORS-tainted,
wherever the file lives; no video library is added on the server or the
desktop shell. The tool saves nothing, so the review sub-agent holds it,
and its prompt judges hook_strength and visual_quality on the stills.
The writer is told to look after making a clip and offer another take
when the opening holds still.

With no browser connected (a scheduled run), or a clip the browser cannot
decode, the tool says the opening went unseen and the review says so in
its reasons. Checked by hand: a 3 s H.264 clip gave six distinct stills in
WebKit (the desktop shell's engine) and in Chrome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation backend FastAPI service, models and migrations app Next.js app on Cloudflare Workers labels Dec 1, 2026
5hirish and others added 6 commits December 3, 2026 23:58
# Conflicts:
#	CHANGELOG.md
#	backend/agents/content/publishing.py
#	backend/agents/content/video.py
#	backend/service/publishers/base.py
#	backend/tests/test_content_publishers.py
…recut

# Conflicts:
#	CHANGELOG.md
#	docs/engineering/agent-prompts.md
Brings in the carousel template and the captioned short (#657). The
conflicts were additive: Outgoing carries both made_with_ai and
media_by_size, a cut reports both generated and words_on_screen, and the
changelog keeps both sets of entries under one Fixed heading.

One interaction needed a change, not just both sides. A take saved with
its words on screen has source="export", so "source != upload" would
label a person's own uploaded clip as AI-generated on TikTok once they
added text to it. made_by_model() now answers that once for publishing
and the cut: an export is a model's only when the clip under the words
was, which the export records by copying the source take's model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
…w-playback

# Conflicts:
#	CHANGELOG.md
#	docs/engineering/agent-prompts.md
…pening-stills

# Conflicts:
#	CHANGELOG.md
#	app/src/lib/contentApi.js
#	backend/routes/content.py
#	docs/engineering/agent-prompts.md
Picks up #652's merge of origin/main. The only conflict was the
generated prompt dump, rendered again from this branch's code with
scripts/dump_prompts.py rather than merged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Deploying duct with  Cloudflare Pages  Cloudflare Pages

Latest commit: 56f7a90
Status: ✅  Deploy successful!
Preview URL: https://dd07c7b2.duct.pages.dev
Branch Preview URL: https://feat-content-video-opening-s.duct.pages.dev

View logs

Picks up #652's merge of origin/main through #653. The only conflict
was the generated prompt dump, rendered again from this branch's code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
The same merge of origin/main was made twice down this stack at about
the same time (3b2304a and its descendants). Both resolutions agree
except in three places, where this keeps the side that is already on
feat/content-video-hold:

- made_by_model(): a person's own clip saved with its words on screen
  is not labelled AI-generated on TikTok;
- one "Fixed" heading in the unreleased changelog, not two;
- the message catalogues in lingui's extract order, which check:i18n
  requires.

The resulting tree is the one already tested on this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
…ills

Picks up the catch-up of the stack with origin/main, including the
made_by_model() fix for TikTok's AI label. The changelog conflict was
the stack's entries listed twice; this keeps one of each, with this
branch's own entry beside them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
no-hex-in-jsx failed on clipCapture.js's black ground. It fills the
letterbox behind each frame drawn for the model, on a canvas that is
never shown, so no theme can reach it and a token would mean nothing.
It joins slideCapture.js, the same kind of surface, in the rule's list
of exceptions with that reason.

Refs #656

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
CHANGELOG.md: both sides added Unreleased entries; kept both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
app/src/locales/*/messages.po: both sides added one string; kept both
and re-extracted (check:i18n passes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
Brings in main via #652's branch. docs/engineering/agent-prompts.md is
generated: re-rendered with dump_prompts.py (--check passes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
Brings in main via the stack. docs/engineering/agent-prompts.md is
generated: re-rendered with dump_prompts.py (--check passes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
…ills

Brings in main via the stack. docs/engineering/agent-prompts.md is
generated: re-rendered with dump_prompts.py (--check passes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
@5hirish
5hirish changed the base branch from feat/content-review-playback to main December 5, 2026 13:10
#655 was squash-merged and main's tree is this branch's merged base
plus #678's spike doc, so the conflicts resolve to this branch's side
and the doc comes in unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem
@5hirish
5hirish marked this pull request as ready for review December 5, 2026 13:10
@5hirish
5hirish merged commit 50ee3ef into main Dec 5, 2026
17 checks passed
5hirish added a commit that referenced this pull request Dec 5, 2026
A review of #652, #653, #655 and #656 found nine bugs in how videos are
judged, re-cut and published. Each would make the agent give the person
a wrong instruction or plan from a wrong number.

- A re-cut skips the opening that aired. The draft check moves the
  panel's winner onto slide 1, so the review's first opening is often
  not the one that went out; the post's own slide 1 and first line now
  say what aired.
- A video is re-cut once. A drafted day re-cutting it, or being a re-cut
  itself, takes it off the list; before, a video under 60% was offered
  in every plan from then on.
- Sub-agents handle pictures as the loop does. review_post's see_opening
  left stills in a tool message, which OpenAI's chat API refuses, and
  re-sent them on every call.
- TikTok's to-dos only reach a TikTok post. The guard lived in one of
  two callers; it is now inside left_for_tiktok.
- A banned word no longer blocks a different word that looks like its
  form ("even" and "evening", "new" and "news").
- A 3-second hold is stored only when it is a reading: above 0, at most
  100%, on 100 or more views. Zernio sends 0 for a point it lacks.
- Opening stills are capped at 400 KB each and must be JPEGs.
- Topic proof counts small accounts, not their posts, and reads every
  hashtag's results: the actor returns `resultsPerPage` per hashtag and
  only the first tag's were read.
- A blank recut_of means no re-cut instead of failing the plan.

And see_opening does less: nothing on a blind model, stills cached per
take, and no second 45 s wait within five minutes of an unanswered one.
The channel mix reads only the columns it uses, and the two clip routes
share one responder (the session one stays uncached, as its URL names
the post and the chosen take can change).


Claude-Session: https://claude.ai/code/session_016C6UbipzM9LzsqoXb6jEem

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Next.js app on Cloudflare Workers backend FastAPI service, models and migrations documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants