Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

perf: read the roles rather than the package, and defer what is not needed yet

rponed5195d819f48
diff --git a/.agents/skills/hypit/references/local-author-package.md b/.agents/skills/hypit/references/local-author-package.md
index dfdb27ab..f6456d7c 100644
--- a/.agents/skills/hypit/references/local-author-package.md
+++ b/.agents/skills/hypit/references/local-author-package.md
@@ -24,27 +24,23 @@ linked. Add `--no-visual` when the component draws nothing.
## Required reading
-Read all of these completely before editing what the scaffold produced. Reading them after
-generating means reading about files that exist.
+Read these before editing what the scaffold produced. Reading them after generating means reading
+about files that exist.
-1. `docs/guide/author-packages.md`
-2. `docs/guide/packages.md`
-3. `docs/guide/conventions.md`
+1. `docs/guide/component-anatomy.md` — the roles every component package fills, and how to find each
+ one in an existing package. Read this first; it is what the rest is measured against.
+2. `docs/guide/author-packages.md`
+3. `docs/guide/packages.md` and `docs/guide/conventions.md`
4. `packages/component-kit/README.md`
-5. The closest existing package's README, `manifest.ts`, `surface.ts`, `component.ts`, and
- `activation.ts`
-6. `docs/guide/component-anatomy.md`, which names the roles every component package fills and where
- each one lives. The implementation section below requires a renderer, a Fragment and the lowering
- between them, and none of those are in the five files above — reading only those five means
- discovering the shapes by failing.
-7. In the closest existing package, the files filling the roles that anatomy names. Their filenames
- differ per package — `ranking` calls them `schedule.ts` and `render.ts`, `media-track` calls them
- `program.ts` and `lower.ts`, `comment-sticker` calls them `program.ts` and `author.ts` — so find
- them by what they export, not by name.
-
-Read item 5's files in full. Read item 7's for their shapes: how a Program becomes elements, where
-timing is resolved, what the Fragment declares. They are long, and copying one package's specifics is
-a worse outcome than understanding its structure.
+
+Then open the closest existing package and read **the roles you are about to write**, not the package
+end to end. Anatomy names them; find them by what they export, since the filenames differ — `ranking`
+calls two of them `schedule.ts` and `render.ts`, `media-track` calls them `program.ts` and `lower.ts`,
+`comment-sticker` calls them `program.ts` and `author.ts`.
+
+Read for shape: how a Program becomes elements, where timing is resolved, what the Fragment declares.
+Those files run to a couple of thousand lines between them, and copying one package's specifics is a
+worse outcome than understanding its structure — which is what anatomy is for.
## Package boundary
diff --git a/.agents/skills/hypit/references/reference-video/index.md b/.agents/skills/hypit/references/reference-video/index.md
index b22fd2c7..34a3c398 100644
--- a/.agents/skills/hypit/references/reference-video/index.md
+++ b/.agents/skills/hypit/references/reference-video/index.md
@@ -42,8 +42,12 @@ Before acting, read these files completely in order:
the split shot, the voice, the first frame, and the stretch too short to be a take.
5. `vocabulary.md` — existing-package selection, appearance-property resolution, and the route for a
real vocabulary gap.
-6. `reconstruction-loop.md` — rendering what was built and comparing it against the reference.
-7. `final-sources.md` — complete source authoring and check loop.
+
+Two more are required, at the point where they apply rather than now. Reading them here means
+reading them half an hour before they matter, with a dozen other files in between:
+
+- `final-sources.md` when the components exist and the sources are about to be written.
+- `reconstruction-loop.md` when something has been built and is about to be compared.
Paths above are relative to this file's directory. Do not skip a file because the task looks like a
familiar video format.
diff --git a/.agents/skills/hypit/references/reference-video/vocabulary.md b/.agents/skills/hypit/references/reference-video/vocabulary.md
index 287e26c5..baa9c151 100644
--- a/.agents/skills/hypit/references/reference-video/vocabulary.md
+++ b/.agents/skills/hypit/references/reference-video/vocabulary.md
@@ -64,8 +64,9 @@ from the graph. Only pictures that differ between videos are edges the source su
`../playbooks/craft/graphic-compositions.md` draws that line; a component that cannot draw itself
without a project document is on the wrong side of it.
-Installing the package is not the end of the gap route. Continue into `reconstruction-loop.md`: a
-component that loads is not yet a component that looks like the reference.
+Installing the package is not the end of the gap route. Read `final-sources.md` and write the three
+sources, then continue into `reconstruction-loop.md`: a component that loads is not yet a component
+that looks like the reference.
The reference-video CLI remains limited to observation, vocabulary inspection and blind image
comparison; it does not generate components. Gemini does not write the package.
diff --git a/.agents/skills/hypit/references/reference-video/workflow.md b/.agents/skills/hypit/references/reference-video/workflow.md
index df52ddc5..1f8d91af 100644
--- a/.agents/skills/hypit/references/reference-video/workflow.md
+++ b/.agents/skills/hypit/references/reference-video/workflow.md
@@ -19,9 +19,9 @@ list_svml_packages
→ narrow observe_reference questions for unresolved appearance and conflicts
→ inspect_svml_vocabulary for candidate packages
→ develop a project-local package only for a proven vocabulary gap
-→ author complete main.svml, studio.svs, build.svrun
+→ read final-sources.md, then author complete main.svml, studio.svs, build.svrun
→ use existing checks and repair until legal
-→ render each authored element and close the loop with compare_reconstruction
+→ read reconstruction-loop.md, then render each authored element and compare it
```
## list_svml_packages
diff --git a/packages/reference-video-tools/README.md b/packages/reference-video-tools/README.md
index d3e6b0c1..6402a0e4 100644
--- a/packages/reference-video-tools/README.md
+++ b/packages/reference-video-tools/README.md
@@ -55,9 +55,10 @@ completed one again.
Shots are never shorter than one second: a fragment below that is merged into the shot before it,
because clips that short carry no evidence and the model rejects them outright.
-`HYPIT_REFERENCE_CONCURRENCY` and `HYPIT_REFERENCE_LAUNCH_GAP_MS` set how fast requests are issued.
-They describe the quota behind the credentials rather than anything about the video, so they are
-environment settings and not flags.
+`HYPIT_REFERENCE_CONCURRENCY` and `HYPIT_REFERENCE_LAUNCH_GAP_MS` set how fast requests are issued,
+defaulting to four at a time with a 1.5 second gap. They describe the quota behind the credentials
+rather than anything about the video, so they are environment settings and not flags. Lower them if a
+quota objects; the failure to expect is rate limiting, which backs off on its own before giving up.
`--question` is a separate narrow path: it requires one to three `--shot-id` values, answers only
that question from those shots' clips and frames in a single request, and neither reads nor writes
diff --git a/packages/reference-video-tools/src/tools.ts b/packages/reference-video-tools/src/tools.ts
index b847aff5..5259a451 100644
--- a/packages/reference-video-tools/src/tools.ts
+++ b/packages/reference-video-tools/src/tools.ts
@@ -252,8 +252,11 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceV
// Pacing is deployment policy, not author intent: it depends on the quota behind the credentials,
// which the calling agent has no way to know. It is settable here and through the environment, and
// deliberately not through a CLI flag.
- const concurrency = options.concurrency ?? positiveEnv("HYPIT_REFERENCE_CONCURRENCY") ?? 2;
- const gapMs = options.launchGapMs ?? positiveEnv("HYPIT_REFERENCE_LAUNCH_GAP_MS") ?? 6_000;
+ // Four at a time with a short gap completed a whole reference twice with no rate limiting, and the
+ // binding constraint is per-request latency rather than the launch gap: nine requests at four took
+ // about as long as three waves, not nine. A quota that dislikes it lowers these.
+ const concurrency = options.concurrency ?? positiveEnv("HYPIT_REFERENCE_CONCURRENCY") ?? 4;
+ const gapMs = options.launchGapMs ?? positiveEnv("HYPIT_REFERENCE_LAUNCH_GAP_MS") ?? 1_500;
const retryDelayMs = options.retryDelayMs ?? 2_000;
let generatorPromise: Promise<GenerateText> | undefined;
const generator = async (): Promise<GenerateText> => generatorPromise ??= options.generate === undefined ? defaultGenerate(model) : Promise.resolve(options.generate);