Skip to content

feat(content): re-cut a video that lost people early, and pick topics strangers win on - #653

Merged
5hirish merged 9 commits into
mainfrom
feat/content-topic-proof-recut
Dec 5, 2026
Merged

5hirish merged 9 commits into
mainfrom
feat/content-topic-proof-recut

Conversation

@5hirish

@5hirish 5hirish commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

What and why

A video that lost people in its first three seconds gets a second try with a new opening, and a TikTok search now says whether strangers win on a topic. Together they close the loop from picking a topic to re-cutting it.

Step Before Now
Picking a topic discover_tiktok returned the top posts by plays, mostly large accounts It also returns a proof: how many small accounts (under 10,000 followers) passed 50,000 plays. The plan prefers topics where they do
A video under 60% at 3 s The next plan saw a weak post and moved on The plan lists it with the two openings its review wrote and never used, and gives it a re-cut day (recut_of, opening) before a new topic on that pillar

Why re-cut instead of moving on: if almost nobody reached second 3, the topic was never tested. The spare openings already exist, because every review writes three.

submit_plan refuses a re-cut of a post the project never published, or one with no opening. The draft brief tells the writer to keep the post and change only its first three seconds.

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 plan proposes, not a screen.

Verification

ruff check (all passed); pytest -m "not live" tests → 3327 passed, 1 skipped
make dump-prompts → agent-prompts.md updated (plan and draft system prompts, ~190 tokens)
  • 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

  • A prompt change to the plan and draft agents, and the agent eval has not run (a draft skips it). It needs the run-evals label before merge.
  • The search is still by hashtag. A search by the question in people's words would be the better test of a topic; that needs a keyword actor in Discover's policy, which is not in this PR.
  • The plan UI shows a re-cut day by its topic ("Re-cut: …") only; recut_of is not shown on the card.

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 3 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>
@github-actions github-actions Bot added documentation Improvements or additions to documentation backend FastAPI service, models and migrations labels Dec 1, 2026
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
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: cc8575e
Status: ✅  Deploy successful!
Preview URL: https://17173025.duct.pages.dev
Branch Preview URL: https://feat-content-topic-proof-rec.duct.pages.dev

View logs

5hirish pushed a commit that referenced this pull request Dec 3, 2026
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
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
@5hirish
5hirish changed the base branch from feat/content-video-hold to main December 5, 2026 12:53
#652 was squash-merged, and main's tree is exactly the #652 head this
branch already merged, so every conflict resolves to this branch's side
(the merged tree equals HEAD's).

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 12:54
@5hirish
5hirish merged commit 5ac52ca into main Dec 5, 2026
12 checks passed
5hirish pushed a commit that referenced this pull request Dec 5, 2026
#653 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 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

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