arkaos 4.37.0 → 4.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/THE-ARKAOS-GUIDE.md +1 -1
  3. package/VERSION +1 -1
  4. package/arka/SKILL.md +1 -1
  5. package/config/skills-curated.yaml +2 -2
  6. package/config/skills-provenance.yaml +7 -0
  7. package/core/hooks/session_start.py +17 -3
  8. package/core/memory/semantic_store.py +58 -11
  9. package/core/memory/turn_capture.py +56 -11
  10. package/core/runtime/opencode_hooks.py +188 -3
  11. package/departments/dev/skills/animated-website/SKILL.md +4 -2
  12. package/departments/dev/skills/scroll-world/SKILL.md +619 -0
  13. package/departments/dev/skills/scroll-world/references/index-template.html +73 -0
  14. package/departments/dev/skills/scroll-world/references/knockout.py +89 -0
  15. package/departments/dev/skills/scroll-world/references/pipeline.md +213 -0
  16. package/departments/dev/skills/scroll-world/references/prompts.md +149 -0
  17. package/departments/dev/skills/scroll-world/references/scroll-world.LICENSE +21 -0
  18. package/departments/dev/skills/scroll-world/references/scrub-engine.js +448 -0
  19. package/harness/codex/AGENTS.md +1 -1
  20. package/harness/copilot/copilot-instructions.md +1 -1
  21. package/harness/cursor/rules/arkaos.mdc +2 -2
  22. package/harness/gemini/GEMINI.md +1 -1
  23. package/harness/opencode/AGENTS.md +1 -1
  24. package/harness/opencode/agents/arka-architect-gabriel.md +1 -1
  25. package/harness/opencode/agents/arka-brand-director-valentina.md +1 -1
  26. package/harness/opencode/agents/arka-cfo-helena.md +1 -1
  27. package/harness/opencode/agents/arka-chief-of-staff-afonso.md +1 -1
  28. package/harness/opencode/agents/arka-community-strategist-beatriz.md +1 -1
  29. package/harness/opencode/agents/arka-content-strategist-rafael.md +1 -1
  30. package/harness/opencode/agents/arka-conversion-strategist-ines.md +1 -1
  31. package/harness/opencode/agents/arka-coo-sofia.md +1 -1
  32. package/harness/opencode/agents/arka-copy-director-eduardo.md +1 -1
  33. package/harness/opencode/agents/arka-cqo-marta.md +1 -1
  34. package/harness/opencode/agents/arka-cto-marco.md +1 -1
  35. package/harness/opencode/agents/arka-design-ops-lead-iris.md +1 -1
  36. package/harness/opencode/agents/arka-ecom-director-ricardo.md +1 -1
  37. package/harness/opencode/agents/arka-knowledge-director-clara.md +1 -1
  38. package/harness/opencode/agents/arka-leadership-director-rodrigo.md +1 -1
  39. package/harness/opencode/agents/arka-marketing-director-luna.md +1 -1
  40. package/harness/opencode/agents/arka-ops-lead-daniel.md +1 -1
  41. package/harness/opencode/agents/arka-pm-director-carolina.md +1 -1
  42. package/harness/opencode/agents/arka-revops-lead-vicente.md +1 -1
  43. package/harness/opencode/agents/arka-saas-strategist-tiago.md +1 -1
  44. package/harness/opencode/agents/arka-sales-director-miguel.md +1 -1
  45. package/harness/opencode/agents/arka-strategy-director-tomas.md +1 -1
  46. package/harness/opencode/agents/arka-tech-director-francisca.md +1 -1
  47. package/harness/opencode/agents/arka-tech-lead-paulo.md +1 -1
  48. package/harness/opencode/agents/arka-video-producer-simao.md +1 -1
  49. package/harness/opencode/plugins/arka.ts +15 -0
  50. package/harness/zed/.rules +1 -1
  51. package/installer/assets/opencode/arka.ts +15 -0
  52. package/knowledge/skills-manifest.json +14 -1
  53. package/package.json +1 -1
  54. package/pyproject.toml +1 -1
@@ -0,0 +1,619 @@
1
+ ---
2
+ name: dev/scroll-world
3
+ description: >
4
+ Build an immersive scroll-scrubbed "fly through the world" landing page for any
5
+ industry or brand using Higgsfield. As the visitor scrolls, a pre-rendered camera
6
+ flies from outside each scene into its interior, then on to the next scene with
7
+ NO cuts — one continuous connected flight (Emons-style isometric diorama, or any
8
+ art direction). The skill interviews for topic, story beats and brand kit, then
9
+ generates cohesive scenes + seamless camera clips and wires a portable,
10
+ framework-agnostic scroll-scrub engine.
11
+ TRIGGER: "scroll world", "mundo 3D", "fly through the world", "scroll cinematic",
12
+ "diorama landing", "scrollable world", "browse-through-the-industry",
13
+ "transforma o negócio num mundo navegável", "/dev scroll-world". SKIP: an EXISTING
14
+ MP4/video turned into a scroll site (assets rendered, no world generation)
15
+ -> dev/animated-website; video production/editing without the landing page ->
16
+ content/video-produce; a regular animated landing without a 3D world ->
17
+ frontend-design skill.
18
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch]
19
+ metadata:
20
+ origin: community
21
+ source: https://github.com/oso95/scroll-world
22
+ license: MIT
23
+ ---
24
+
25
+ <!-- arka:kb-first-prefix begin -->
26
+ > **KB-first:** query `mcp__obsidian__search_notes` (and
27
+ > `mcp__graphify__query_graph` when configured) and cite `[[wikilinks]]`
28
+ > or graph nodes — or declare the gap — BEFORE any external research.
29
+ > Full doctrine: `arka/SKILL.md` (KB-First Research).
30
+ <!-- arka:kb-first-prefix end -->
31
+
32
+ # scroll-world
33
+
34
+ Produces a landing page where **scroll drives a camera**: it dives from outside a scene
35
+ into its interior, then flies out and into the next scene, continuously, with no visible
36
+ cuts. The visuals are AI-generated (Higgsfield); the page just scrubs pre-rendered video
37
+ by scroll position. This is the same technique behind Apple's scroll-through product
38
+ pages — the camera genuinely moves, scroll only drives time.
39
+
40
+ **What you generate:** N scene stills → N "dive-in" camera clips → N-1 "connector" clips
41
+ that join consecutive scenes seamlessly → a portable scrub engine that plays the whole
42
+ chain as one flight.
43
+
44
+ **The one rule that makes or breaks it:** seams must be *frame-identical*. Read
45
+ [The seamless chain](#step-5--the-seamless-chain-the-critical-part) before generating any
46
+ connector. Getting this wrong is the single most common failure and produces a visible
47
+ "pop" between scenes.
48
+
49
+ Do not assume a frontend framework. The scrub engine in `references/scrub-engine.js` is
50
+ self-contained vanilla JS (it builds its own DOM + injects its own CSS into a container
51
+ you give it), so it drops into plain HTML, Next.js, Vue, a Python-served page, anything.
52
+ The value of this skill is the Higgsfield pipeline, the prompts, and the seam method —
53
+ not the framework.
54
+
55
+ ---
56
+
57
+ ## Step 0 — Bootstrap
58
+
59
+ 1. **Higgsfield CLI.** If `higgsfield` is not on `$PATH`, install per the
60
+ `higgsfield-generate` skill. If `higgsfield workspace list` fails auth, ask the user
61
+ to run `higgsfield auth login` (interactive OAuth — you cannot run it) and, if needed,
62
+ `higgsfield workspace set <id>`. Confirm there are enough credits: a full run is
63
+ roughly `N` image gens + `(2N-1)` video gens.
64
+ 2. **ffmpeg / ffprobe** on `$PATH` (frame extraction + encoding).
65
+ 3. **An image tool** for background knockout if you want floating scenes: PIL
66
+ (`python3 -c "import PIL"`), or `cwebp`/`sips`. Optional — see Step 3.
67
+ 4. **(Optional) Codex CLI** — if `codex` is on `$PATH` (≥ 0.125) and
68
+ `codex login status` reports a ChatGPT login, the scene stills can be generated
69
+ through Codex's built-in `image_gen` (the same gpt-image-2 model) billed to the
70
+ user's ChatGPT subscription instead of Higgsfield credits — offer it at
71
+ Step 1.6, command in Step 2. Absence just removes the option.
72
+ 5. Caveats: macOS ships **bash 3.2** (no `declare -A`); don't use associative arrays in
73
+ scripts. Higgsfield generations take **3–8 min each** — always run them detached
74
+ (background) and poll, never a foreground blocking call. Reference-by-job-UUID is
75
+ rejected by media flags — pass **local file paths** to `--image/--start-image/--end-image`.
76
+ Video models differ in accepted params (e.g. Kling has no `--resolution`) and in whether
77
+ they support start/end-image conditioning at all — before batching, confirm the chosen
78
+ model's schema with `higgsfield model get <job_type>` and see the Step 4 model table.
79
+
80
+ ---
81
+
82
+ ## Step 1 — Interview the user
83
+
84
+ The **subject is the user's to state — ask it as an open question in plain prose**, never a
85
+ fabricated multiple-choice. A made-up list of industries biases them and reads as you
86
+ deciding their business for them; let them answer in their own words (their real business,
87
+ a client's, or any idea). Reserve structured multiple-choice (`AskUserQuestion` in Claude
88
+ Code; a plain either/or question elsewhere) for the genuinely
89
+ enumerable, lower-stakes choices below — art direction and brand-kit approach — and even
90
+ there, signal they can go their own way ("Other"). Ask only what you can't sensibly
91
+ default. Cover:
92
+
93
+ 1. **Subject** (ask openly, not multiple-choice) — "What should this world be about? Your
94
+ business, a client's, or any idea — a word or a sentence is fine." Capture the
95
+ industry/product + a one-line pitch (e.g. "a bubble tea company, from leaf to last
96
+ sip"), and a brand name if they have one; otherwise you'll propose one below.
97
+ 2. **Brand kit** — offer three paths, pick one:
98
+ - Import from a URL: `higgsfield marketing-studio brand-kits fetch --url <site> --wait`
99
+ (pulls name, colours, tone). Then read it back with `brand-kits list --json`.
100
+ - The user hands you palette + name + tone directly.
101
+ - You propose a palette + name and let them approve.
102
+ Capture **4–6 named hex values**, a display name, and a tone word or two.
103
+ 3. **Art direction** — default is "soft matte low-poly **clay diorama**, isometric,
104
+ tilt-shift miniature, warm light." Offer alternatives (flat papercraft, glossy toy,
105
+ claymation, neon night). Whatever is chosen becomes the shared **style preamble**
106
+ reused verbatim in every scene prompt (this is what makes the world cohesive).
107
+ 4. **The journey (sections)** — the ordered scenes the camera flies through. Propose a
108
+ set derived from the subject's own value chain and let the user edit. 5–7 works well.
109
+ Boba example: farms → pearl kitchen → flagship shop → delivery → community plaza →
110
+ the hero product. Each section needs: a short subject description (what's IN the
111
+ diorama), an eyebrow, a headline, one line of body, and 0–3 tag pills. The last
112
+ section is usually the hero product + the CTA.
113
+ 5. **Mobile version — ALWAYS ask this; never silently generate both.** Ask as a
114
+ two-option choice (`AskUserQuestion` in Claude Code; a plain question elsewhere):
115
+ *"Want a mobile-optimized version too? The mobile version is a second camera chain
116
+ rendered natively in **9:16 portrait** — composed for phones, not a crop of the
117
+ landscape film — which roughly doubles the Higgsfield credit spend (state the
118
+ estimated number)."*
119
+ Options: "Desktop only" / "Desktop + mobile (native 9:16 — ~2× credits)". The
120
+ credit cost must be stated to the user, not just implied.
121
+ What the answer gates:
122
+ - **Yes** → render the parallel 9:16 portrait chain and ship it as the mobile variants
123
+ (Step 6 / pipeline.md §6b): portrait start canvases → 9:16 dives + connectors
124
+ frame-locked against their own renders → 720-wide `-m.mp4` encodes → `stillMobile`
125
+ portrait posters. Wire `clipMobile`/`connectorsMobile`/`stillMobile` (Step 7); run
126
+ the full mobile QA (Step 8). Budget ~2N-1 extra video gens + NSFW re-rolls.
127
+ **Never ship the centre-crop as the mobile version by default** — if credits can't
128
+ cover the portrait chain, say so and offer the crop encodes (pipeline.md §6) as an
129
+ explicitly-labelled stopgap the user must approve.
130
+ - **No** → skip the mobile encodes and wiring entirely. The engine's phone hardening
131
+ (seek-coalescing, iOS priming, safe-area CSS) is always on regardless — that's not
132
+ a "mobile version," it's just the page not breaking when a phone visits — so a
133
+ desktop-only build still degrades gracefully.
134
+
135
+ 6. **Budget — engines shown by cost, decided before anything renders.** Present the
136
+ render tiers (`AskUserQuestion`), then compute and state the estimated total for
137
+ the user's N scenes — `N stills + (2N−1) videos [videos ×2 if mobile] + ~15%
138
+ re-roll headroom` — and get a go before generating.
139
+ - **Video tier** (roster only — every option frame-locks seams, Step 4):
140
+
141
+ | Tier | Model | Rough cost |
142
+ |---|---|---|
143
+ | Draft / previz | `seedance_2_0_mini` (720p) | ~¼ of Standard |
144
+ | Standard (default) | `seedance_2_0` (1080p) | baseline |
145
+ | Alternate | `kling3_0` (720p native) | ≈ Standard; different look + content filter |
146
+
147
+ Draft doubles as the previz path: run the whole chain cheap, approve the
148
+ journey, re-render final legs on Standard (pipeline.md Notes) — suggest it
149
+ unprompted when the balance reads tight.
150
+ - **Stills source** (only offer if the Codex CLI is present, Step 0.4):
151
+ Higgsfield `gpt_image_2` (spends credits) vs **Codex `image_gen`** — the same
152
+ gpt-image-2 model billed to the ChatGPT subscription (zero credits; counts
153
+ toward Codex usage limits; 1536×1024 output — exactly 3:2, slightly under
154
+ Higgsfield's 2k). Stills are plain PNGs handed to `--start-image`, so the
155
+ video chain is indifferent to their source. Command in Step 2. **One source
156
+ for all N stills of a build** — the two render with slightly different
157
+ character (verified: Codex runs warmer/lighter), and mixing sources across
158
+ scenes reads as style drift, same reason the video chain uses one model.
159
+ - **Calibrate costs, don't guess.** The CLI exposes no pricing and plans differ.
160
+ Run ONE still and ONE video first, diff `higgsfield workspace list` before/
161
+ after, extrapolate to the full run, and warn the user whenever the estimate
162
+ exceeds ~70% of the balance. (Observed on a plus plan, 2026-07: Standard
163
+ video ≈ 40–55 credits, still ≈ 15.) A real `not_enough_credits` mid-run is
164
+ recoverable (finished clips survive; resume after top-up) but ugly — the
165
+ whole point of this step is that the user decides *before* the spend.
166
+
167
+ If the user names a video model outside the roster, honor it **only if it can
168
+ frame-lock seams** (Step 4). This skill only ships seamless output, so a model that
169
+ can't frame-lock is declined with a one-line why, not substituted in — use a roster
170
+ model instead.
171
+
172
+ Keep the scroll mechanic fixed (continuous fly-through) — that's the point of the skill.
173
+ See `references/prompts.md` for the intake checklist and copy structure.
174
+
175
+ ---
176
+
177
+ ## Step 2 — Generate the scene stills
178
+
179
+ One image per section, **all sharing the same style preamble** for cohesion. Default
180
+ model **`gpt_image_2`** (crisp, great at isometric illustration; returns a solid/white
181
+ background which is perfect for floating diorama "islands"). Use `nano_banana_2` only if
182
+ the brief is character/cartoon-heavy (note: `nano_banana_2` is a CLI alias — it resolves
183
+ to `nano_banana_pro`; it won't appear under that name in `higgsfield model list`).
184
+
185
+ Prompt shape (full templates in `references/prompts.md`):
186
+
187
+ ```
188
+ <STYLE PREAMBLE, identical every time>. On a plain solid <bg> background with a soft
189
+ contact shadow. <PALETTE hexes>. No text, no letters, no logos, centered, 3:2.
190
+ Subject: <what is in THIS diorama>.
191
+ ```
192
+
193
+ - Run all N concurrently, detached. Command per scene:
194
+ `higgsfield generate create gpt_image_2 --prompt "$(cat scene_i.txt)" --aspect_ratio 3:2 --resolution 2k --quality high --wait --wait-timeout 15m --json > scene_i.json 2>scene_i.err`
195
+ - Result URL is `.[]0.result_url` in the `--wait --json` output. `curl` it down.
196
+ - **Codex stills variant** (if chosen at Step 1.6 — subscription-billed, zero
197
+ credits): same prompt files, same byte-identical preamble, generated by Codex's
198
+ built-in `image_gen`:
199
+
200
+ ```bash
201
+ codex exec -C "$WORK" -s workspace-write --skip-git-repo-check \
202
+ 'Use the image generation tool ($imagegen) to generate: '"$(cat "$WORK/still_i.txt")"' Wide 3:2 landscape, high resolution. Save it as ./still_i.png. Do not do anything else.'
203
+ ```
204
+
205
+ Single-quote the `$imagegen` segment (the shell must not expand it); if editing
206
+ with reference images, the prompt goes BEFORE any `-i` flag (it's variadic).
207
+ ~1–3 min per image; run a few in parallel, not all N at once. Output lands at
208
+ 1536×1024 (3:2) — fine for `--start-image` and posters. Everything downstream
209
+ (cohesion review, knockout, dives) is unchanged.
210
+ - A generation may fail transiently (HTTP 503) — re-roll that one individually; don't
211
+ restart the batch.
212
+ - **Review the stills before continuing.** They must read as one cohesive world (same
213
+ angle, palette, light). If one is off-style, regenerate it, optionally passing an
214
+ approved scene as `--image` to lock style.
215
+
216
+ See `references/pipeline.md` for the exact batch script.
217
+
218
+ ---
219
+
220
+ ## Step 3 — (Optional) Float the scenes
221
+
222
+ If you want the dioramas to float over an atmospheric background instead of sitting in a
223
+ solid box, knock out the flat background to transparency with
224
+ `references/knockout.py` (border-connected flood fill — preserves interior colour that
225
+ matches the bg, e.g. cream walls). Then encode to webp. If you'd rather keep it simple,
226
+ just make the page background the same colour as the scene background and skip this.
227
+
228
+ These stills double as **video posters and lazy-load fallbacks**, so keep them.
229
+
230
+ ---
231
+
232
+ ## Step 4 — Camera architecture (pick one — this makes or breaks the feel)
233
+
234
+ How the camera moves *between* scenes is the single biggest quality lever. Two shapes;
235
+ pick by aesthetic.
236
+
237
+ ### Video model — pick ONE for the whole chain
238
+
239
+ **This skill only ships seamless output**, so the only usable models are ones that can
240
+ frame-lock a seam: every chained clip must accept `--start-image`, and connectors also
241
+ need `--end-image`. That capability — not preference — is the selection rule. Check any
242
+ model with `higgsfield model get <job_type>` and **skip anything whose media inputs are
243
+ reference-only** (no start/end image): it can only *condition* a generation, not
244
+ *continue* a shot, so it physically can't hold a seam. Schemas below were confirmed
245
+ against the CLI:
246
+
247
+ | Model | start/end image | Notes |
248
+ |---|---|---|
249
+ | `seedance_2_0` (default) | ✓ / ✓ | Full chain (legs + connectors). `--mode std --resolution 1080p`. Its NSFW filter is the touchy one (see Gotchas). |
250
+ | `kling3_0` | ✓ / ✓ | Full chain — tested: `--mode std --sound off --duration 5` with start+end images accepted, seams frame-lock cleanly. **No `--resolution` param** (don't pass one; `--mode std` returns **720p native** — encode what ffprobe reports, never upscale). Sound defaults **on** → `--sound off`. `--duration` default 5, try 10 for legs. Different content filter than Seedance — the sanctioned NSFW fallback. |
251
+ | `seedance_2_0_mini` | ✓ / ✓ | Cheap draft tier that keeps frame-locking (720p). The previz tier: run the whole chain here first, then re-render final legs on the full model — still seamless, so it translates directly. |
252
+
253
+ Those three are the roster — all do both architectures. (`kling3_0_turbo` also frame-locks
254
+ via `--start-image`, but has no `--end-image`, so it's architecture-A-only and can't make
255
+ connectors; it also takes a different flag set — no `--mode`, has `--resolution` — so it
256
+ doesn't drop into the pipeline as-is. It's not in the default roster; only reach for it, and
257
+ wire it by hand, if architecture A's sequential render time is a proven bottleneck and you've
258
+ benchmarked it as actually faster.)
259
+
260
+ Rules:
261
+ - **One model for all chained clips.** Each renderer has its own motion/color/grain
262
+ character; mixing models mid-chain keeps *position* continuity (frames still hand off)
263
+ but the render-character shift reads as a subtle pop. The one sanctioned exception is
264
+ the NSFW fallback for a single stubborn clip (Gotchas) — a slight character shift on
265
+ one 5s connector beats a missing connector.
266
+ - Default to `seedance_2_0`; honor a user's stated preference **only if the model
267
+ qualifies** (frame-locking). If it doesn't, say so and use a supported model — never
268
+ ship a non-seamless build to satisfy a model request.
269
+ - The pipeline scripts take the model as `$VMODEL` with per-model flags already cased
270
+ out (`references/pipeline.md`).
271
+
272
+ ### A) Continuous forward take — RECOMMENDED for grounded / realistic / walkthrough
273
+ One camera that only ever glides **forward**, first scene through last, as a single take.
274
+ Generate the legs **sequentially**: leg 0 from scene-0's still (glide forward into it);
275
+ then each leg's `--start-image` = the **previous leg's ACTUAL last frame** (extract with
276
+ ffmpeg), prompt *"continue gliding smoothly FORWARD into [scene i], never pulling back"*
277
+ (or an expressive mid-leg move under the motion-handoff contract — see **Camera grammar**
278
+ below), and **no `--end-image`** — an end-image of a wide establishing shot forces the
279
+ camera to pull back, which is the #1 cause of stutter. Extract each leg's last frame to feed the
280
+ next. Result: every seam is frame-identical **and** the camera never reverses. There are
281
+ **no connectors** (skip Step 5) — the legs ARE the journey. Wire each leg as a section
282
+ clip with `connectors: []` and a small `crossfade` (~0.08). Even without an `--end-image`
283
+ the legs still arrive at distinct rooms (the prompt steers the content). Cost: strictly
284
+ **sequential** (can't parallelize) and slower; interiors trip the NSFW filter, so build in
285
+ re-rolls (3 attempts/leg).
286
+
287
+ ### B) Dive-in + aerial connector — only for diorama / miniature / god's-eye worlds
288
+ A "dive into each scene" clip + a connector that pulls **up and out** and flies over to the
289
+ next scene (Step 5). The pull-out **reverses camera direction at every seam** (forward dive
290
+ → backward pull-out). In a miniature/diorama world that reads as an intentional "zoom out
291
+ to the map, fly to the next island"; in a grounded first-person walkthrough it reads as a
292
+ jarring **rewind/stutter**. Use B only for the map-like aesthetic. When in doubt, use A.
293
+
294
+ ### Camera grammar — the move should fit the concept (A is NOT "forward only")
295
+
296
+ "Forward only" is the *seam* rule, not the *leg* rule. The physics of the chain:
297
+
298
+ - **Position continuity** at a seam comes from the frame handoff (next leg starts from the
299
+ previous leg's actual last frame).
300
+ - **Velocity continuity** at a seam means the camera must never *reverse across a seam* —
301
+ that's the rewind stutter.
302
+ - **Inside a single leg the camera is free.** One leg is one continuous render — there is
303
+ no seam to break mid-leg, so orbits, crane-ups, lateral tracking, even a push-in that
304
+ eases back out are all safe *within* the clip. Reversals are only fatal *across* seams.
305
+
306
+ So give each leg an expressive move chosen from the scene's own logic, under a **motion
307
+ handoff contract**: every leg **ends by settling into a slow, steady forward drift** toward
308
+ the next destination (final ~1 s), and every leg **begins by continuing that same drift**.
309
+ Keep both clauses in the prompts verbatim (templates in `references/prompts.md`).
310
+
311
+ Pick the grammar from the concept:
312
+
313
+ | Concept / tone | Mid-leg move |
314
+ |---|---|
315
+ | Product / luxury retail | slow half-orbit around the hero object, then continue past it |
316
+ | Real estate / hospitality | steadicam glide through doorways; gentle crane-up in atria |
317
+ | Industrial / process / logistics | low lateral track alongside the line, foreground parallax |
318
+ | Travel / outdoors / campus | drone-style rise-and-reveal, then a descending swoop |
319
+ | Food / craft / detail-driven | push in close to the craft moment, ease back, carry on |
320
+ | Playful miniature (arch. B) | dives + aerial hops — the connector IS the grammar |
321
+
322
+ Honest costs: expressive mid-leg moves raise re-roll odds — the model can end a fancy move
323
+ in a state that isn't a clean forward drift. Mitigations: keep the final-second settle
324
+ clause verbatim; **eyeball each leg's last frame before chaining the next** (it should look
325
+ like a frame from a gentle forward glide — if not, re-roll before wasting the next leg);
326
+ budget ~1 extra re-roll per expressive leg. A plain forward glide stays the zero-risk
327
+ default — use it for legs where the scene itself is the show.
328
+
329
+ Two related pacing knobs live in the engine (Step 7): per-section `scroll` (more scroll
330
+ distance = longer dwell in that scene) and `linger` (the camera settles mid-scene exactly
331
+ while the copy peaks, then picks up speed toward the seam). Prefer expressive motion in the
332
+ *clip* and restraint in the *scrub mapping* — they compound.
333
+
334
+ And remember scroll is a scrubber: visitors can scroll **up**, so every move also plays in
335
+ reverse. That's free and expected — no extra work — but it's another reason seam velocity
336
+ must be consistent in both directions (a seam that reads fine forward reads as a stutter
337
+ backward too if velocity flips).
338
+
339
+ **For B**, one camera flight per scene: starts high/outside, descends into the interior,
340
+ structure opens. Model: the chain model you picked above (default **`seedance_2_0`**),
341
+ `--start-image = the scene still`.
342
+
343
+ - Use the **solid-background still** (not the knocked-out transparent one) as the
344
+ start image, so the video has a full frame.
345
+ - Prompt: "Single continuous cinematic camera move, no cuts. Begin high and far looking
346
+ at the whole <scene> from outside … descend and fly inside toward <focal point> … the
347
+ roof/walls gently open to reveal the interior. <style>, smooth graceful slow motion.
348
+ No text." (Template in `references/prompts.md`.)
349
+ - Params (seedance): `--mode std --resolution 1080p --aspect_ratio 16:9 --duration 8`.
350
+ For Kling: drop `--resolution` (no such param), add `--sound off`, `--duration 10`.
351
+ Do **not** pass `--generate-audio` (it errors on seedance; audio is wasted anyway —
352
+ you'll mute).
353
+ - Run concurrently, detached, then download each `.result_url`. Re-roll individual
354
+ failures. Keep the raw 1080p sources — you need their frames next.
355
+
356
+ ---
357
+
358
+ ## Step 5 — Connectors (architecture B only)
359
+
360
+ Skip this whole step for architecture **A** — the forward take has no connectors; its legs
361
+ already chain seamlessly. This step applies to **B** (diorama/miniature), and note the
362
+ reversal caveat from Step 4.
363
+
364
+ The connector clips are what make the world feel *connected* instead of cut. A connector
365
+ flies from the end of scene i out and into the start of scene i+1. **Both of its
366
+ endpoints must be the ACTUAL RENDERED FRAMES of the neighbouring clips — never the
367
+ original diorama still.**
368
+
369
+ Why: every Higgsfield generation renders slightly differently. If a connector *ends* on
370
+ a fresh render of "the kitchen diorama," but the next dive clip *starts* on its own
371
+ different render of that same diorama, the two won't match and you get a pop at the seam.
372
+ The fix is to hand off the exact pixels:
373
+
374
+ ```
375
+ For each connector between dive_i and dive_{i+1}:
376
+ start-image = the LAST frame extracted from dive_i's rendered video
377
+ end-image = the FIRST frame extracted from dive_{i+1}'s rendered video
378
+ ```
379
+
380
+ Now every seam is frame-identical on *both* sides:
381
+ `dive_i.end == connector.start` and `connector.end == dive_{i+1}.start`.
382
+
383
+ Extract the boundary frames from the rendered dives (not the stills):
384
+
385
+ ```bash
386
+ ffmpeg -sseof -0.15 -i dive_i.mp4 -frames:v 1 -q:v 2 dive_i_last.png # interior of i
387
+ ffmpeg -ss 0 -i dive_{i+1}.mp4 -frames:v 1 -q:v 2 dive_next_first.png # establishing of i+1
388
+ ```
389
+
390
+ Generate the connector (`--duration 5` is plenty). Connectors need `--end-image`, so the
391
+ model must accept it — any roster model does (`seedance_2_0`, `seedance_2_0_mini`,
392
+ `kling3_0`):
393
+
394
+ ```bash
395
+ higgsfield generate create "$VMODEL" \
396
+ --prompt "$(cat connector_i.txt)" \
397
+ --start-image dive_i_last.png --end-image dive_next_first.png \
398
+ $VOPTS --aspect_ratio 16:9 --duration 5 --wait --json
399
+ # seedance: VOPTS="--mode std --resolution 1080p"; kling3_0: VOPTS="--mode std --sound off"
400
+ ```
401
+
402
+ Connector prompt: "Single continuous camera move, no cuts. Pull up and back out of
403
+ <scene i>, rise into the sky, glide across the connected miniature world, and arrive
404
+ above <scene i+1>, beginning to descend toward it. Seamless flowing aerial transition.
405
+ <style>. No text." (Template in `references/prompts.md`.)
406
+
407
+ Insurance: Seedance lands *close* to the end-image but not always pixel-perfect, so the
408
+ engine still applies a **short crossfade** (a few frames) at each seam. Frame-matched
409
+ endpoints + a small crossfade = no visible cut. Never skip the actual-frame handoff and
410
+ rely on the crossfade alone; a big content jump can't be hidden by a crossfade.
411
+
412
+ ---
413
+
414
+ ## Step 6 — Encode for smooth scrubbing
415
+
416
+ Scrubbing = setting `video.currentTime` from scroll. Two things matter, and they are
417
+ often gotten wrong:
418
+
419
+ 1. **Seekability, not keyframe density, is what makes scrubbing work.** Many static
420
+ hosts (and `python -m http.server`) don't serve HTTP byte-range requests, which pins
421
+ `video.seekable` to `[0,0]` and clamps *every* seek to frame 0 — the video looks
422
+ frozen. The robust fix is to **fetch each clip as a `Blob` and play it from an
423
+ in-memory object URL** (blobs are always fully seekable). The engine does this.
424
+ Because of it, you do **not** need all-intra video.
425
+ 2. **Don't shrink quality to get smooth seeks.** Encode at the **native resolution**
426
+ (1080p from Seedance — don't downscale), `crf ~20`, a **small GOP** (`-g 8`) rather
427
+ than all-intra (all-intra bloats an 8s clip to ~25 MB; GOP 8 is ~8 MB and scrubs
428
+ fine via blob). Strip audio, add faststart, and a light `unsharp` counters video
429
+ softness:
430
+
431
+ ```bash
432
+ ffmpeg -i src.mp4 -an -vf "unsharp=5:5:0.8:5:5:0.0" \
433
+ -c:v libx264 -preset slow -crf 20 -pix_fmt yuv420p \
434
+ -g 8 -keyint_min 8 -sc_threshold 0 -movflags +faststart out.mp4
435
+ ```
436
+
437
+ Encode all 2N-1 clips (dives + connectors) with the same settings for uniform quality.
438
+
439
+ **Mobile encodes (only if the user opted in at Step 1.5).** The mobile version is
440
+ the **native 9:16 portrait chain** (pipeline.md §6b): portrait renders of every dive and
441
+ connector, encoded **720 wide (`scale=720:-2`), `-g 4`** (more keyframes = cheaper seeks —
442
+ phone decoders' seek cost scales with GOP length), crf 23 — wired as `clipMobile` /
443
+ `connectorsMobile`, with each portrait dive's first frame extracted as the section's
444
+ `stillMobile` poster (Step 7). The engine serves them automatically on phones and falls
445
+ back to the desktop clip when absent. The 16:9 centre-crop `encm()` encodes
446
+ (pipeline.md §6) are a **fallback only** — for when credits can't cover the portrait
447
+ chain — and shipping them must be called out to the user, never silent. If the user chose
448
+ desktop-only, skip this — the engine still hardens phone scrubbing regardless
449
+ (seek-coalescing, iOS priming), so the page degrades gracefully rather than breaking.
450
+
451
+ ---
452
+
453
+ ## Step 7 — Assemble the page
454
+
455
+ Copy `references/scrub-engine.js` (and, if you want a fully standalone page, the tiny
456
+ `references/index-template.html`) into the user's project — or adapt into their
457
+ framework. It's config-driven and self-contained:
458
+
459
+ ```js
460
+ mountScrollWorld(document.getElementById('world'), {
461
+ brand: { name: 'Pearl & Co.' },
462
+ diveScroll: 1.3, connScroll: 0.9, // viewport-heights of scroll per clip
463
+ sections: [
464
+ { id:'farm', label:'The Farms', still:'assets/farm.webp',
465
+ clip:'assets/vid/farm.mp4',
466
+ clipMobile:'assets/vid/farm-m.mp4', // mobile opt-in only: native 9:16 render
467
+ stillMobile:'assets/farm-m.webp', // its first frame as the portrait poster
468
+ scroll: 1.6, linger: 0.45, // optional pacing: longer dwell + camera settles mid-scene
469
+ accent:'#8FB98A', eyebrow:'From leaf to last sip', title:'It starts in the hills.',
470
+ body:'…', tags:['Single-origin','Hand-picked'] },
471
+ // …one per section; last may carry a `cta`
472
+ ],
473
+ connectors: ['assets/vid/conn1.mp4','assets/vid/conn2.mp4', /* … length = sections-1 */],
474
+ connectorsMobile: ['assets/vid/conn1-m.mp4','assets/vid/conn2-m.mp4' /* … same length; mobile opt-in only */],
475
+ });
476
+ ```
477
+
478
+ The engine handles: the ordered dive/connector chain, scroll→currentTime with rAF
479
+ smoothing, blob loading, lazy prefetch of nearby clips, frame-matched crossfades, pinned
480
+ per-section copy (first section greets on landing, last holds its CTA), a route rail,
481
+ `prefers-reduced-motion`, and mobile. **Pacing per section:** `scroll` overrides
482
+ `diveScroll` for that scene (more scroll = longer dwell) and `linger` (0–1, keep ≤ 0.6)
483
+ remaps time so the camera settles mid-scene — exactly while the copy peaks — then speeds
484
+ up toward the seam; seam frames are untouched (f(0)=0, f(1)=1). Give the hero and finale
485
+ scenes a higher `scroll` + some `linger`; keep transit scenes brisk. Theme it with CSS variables (`--accent`,
486
+ `--sw-bg`, `--sw-ink`, …) — the visual identity comes from the generated clips, so the
487
+ chrome stays quiet. See the header of `scrub-engine.js` for the full config + CSS vars.
488
+
489
+ **On phones the engine adapts automatically** (coarse pointer or ≤860px): it serves
490
+ `clipMobile` / `connectorsMobile` when present, **coalesces seeks** (never queues a new
491
+ `currentTime` while the decoder is still seeking — this is what stops a fast flick from
492
+ freezing the clip), **keeps the still as a poster until the clip paints its first frame**
493
+ and **primes each video on first touch** (fixes iOS's blank-until-played video), drops the
494
+ drifting particles, ignores URL-bar-only resizes (no scroll jump), and uses safe-area
495
+ insets so copy clears the notch/home indicator. All of this hardening is on by default —
496
+ no config needed. The `clipMobile`/`connectorsMobile` encodes are the opt-in part
497
+ (Step 1.5): only wire them when the user asked for the mobile version.
498
+
499
+ For non-JS backends (Python/Rails/etc.): serve the assets and drop the engine `<script>`
500
+ into the rendered HTML; nothing about it is framework-specific.
501
+
502
+ ---
503
+
504
+ ## Step 8 — QA the seams (don't skip)
505
+
506
+ Drive the page in a headless browser and **verify frame continuity at the seams**, which
507
+ is the thing most likely to be wrong:
508
+
509
+ - Screenshot at scroll positions just before and just after each seam. The two frames
510
+ must be near-identical (the dive's last frame == the connector's first frame). If they
511
+ pop, you used the diorama still instead of the actual rendered frame (redo Step 5), or
512
+ the crossfade band is too short.
513
+ - Check the console for errors, confirm `video.seekable.end(0) > 0` (blob working), and
514
+ that `currentTime` tracks scroll across each clip's band.
515
+ - **Mobile — full checklist only if the user opted into the mobile version (Step 1.5).**
516
+ For a desktop-only build, just sanity-check a phone viewport once: page loads, still
517
+ posters show, nothing overlaps — the engine's hardening covers graceful degradation.
518
+ For the mobile build (do this on a real phone or an emulated one, portrait + landscape):
519
+ - Emulate a phone viewport **with CPU throttled 4–6×** and scroll fast — the clip should
520
+ track without freezing (the seek-coalescing + `-m.mp4` encodes are what make this hold).
521
+ - Confirm the first scene shows immediately (its still is the poster) and the video takes
522
+ over the instant you scroll — no blank/black scene (the iOS priming fix). Test iOS Safari
523
+ specifically; it's the one that goes blank if this regresses.
524
+ - Verify the `-m.mp4` variant is actually served on mobile (Network panel), and the
525
+ heavy 1080p master on desktop. The mobile clips must be **natively portrait**
526
+ (`videoWidth < videoHeight` — not a downscaled 16:9 file), and the `stillMobile`
527
+ posters must be served and match each portrait clip's first frame (no
528
+ landscape→portrait flash when the video paints).
529
+ - Slowly scroll so the URL bar collapses — the page must **not jump** (height-only resizes
530
+ are ignored on touch). Rotate the device — layout should recompose cleanly.
531
+ - Only if the crop **fallback** shipped (no credits for the portrait chain): portrait
532
+ crops a 16:9 clip to its centre — confirm the focal subject still reads, and remind
533
+ the user this is the stopgap, not the mobile version.
534
+ - Check reduced-motion (should fall back to the stills, no video, no particles).
535
+
536
+ ---
537
+
538
+ ## Gotchas (hard-won)
539
+
540
+ - **Seam pop** → connector endpoints were the diorama stills, not the neighbouring
541
+ clips' actual frames. Always extract real frames (Step 5).
542
+ - **Seam stutter / camera "jumps backward"** → even with frame-matched seams, if the
543
+ camera *velocity reverses* (forward dive, then a connector that pulls back out) it
544
+ reads as a rewind. This is inherent to architecture B. For any grounded walkthrough use
545
+ architecture A (one continuous forward take — legs chained from actual last frames, no
546
+ pull-back, no `--end-image`); see Step 4.
547
+ - **Frozen video / stuck at frame 0** → `seekable=[0,0]`; the host isn't serving byte
548
+ ranges. Use blob URLs (engine does).
549
+ - **Huge files** → you used all-intra. Use `-g 8` + blob instead.
550
+ - **Soft / low quality** → you downscaled or over-compressed. Encode native 1080p,
551
+ crf ≤ 20, add `unsharp`. Video is inherently softer than the stills — keep the stills
552
+ as the lite fallback for max fidelity.
553
+ - **Concurrent gens 503 / "not_enough_credits" race** → transient when many launch at
554
+ once; re-roll the individual failure, it's not really out of credits (verify with
555
+ `higgsfield workspace list`).
556
+ - **NSFW false-positives (Seedance `status "nsfw"`)** → the video content filter flags
557
+ perfectly innocuous clips, especially **bedroom, pool, spa/wellness** contexts and
558
+ trigger words like "bed", "pool", "waterfall", "wine", "swim". It's partly the prompt
559
+ wording and partly the reference frames. Fixes, in order: (1) re-roll — it's often
560
+ non-deterministic and passes on the 2nd–3rd try; (2) strip trigger words and add
561
+ "empty, unoccupied, no people, no figures, architectural, tasteful"; (3) regenerate
562
+ just that clip on **`kling3_0`** with the same start/end frames — a different
563
+ provider's filter often passes what Seedance blocks. Expect a slight render-character
564
+ shift on that one clip (each model has its own grain/motion feel); for a 5s connector
565
+ behind a crossfade that usually beats option (4): set the connector slot to `null` —
566
+ the engine crossfades that seam directly (optional connectors), so the page still
567
+ completes. Budget extra credits/time for these re-rolls on interiors/real-estate content.
568
+ - **Dark / custom theme** → the engine wraps its default tokens in `@layer sw`, so a
569
+ page-level `:root` / `.sw-root { --sw-bg; --sw-ink; --sw-accent; --sw-font-* }` block
570
+ wins cleanly (no specificity hacks). `--sw-ink` is your primary **text/heading** colour;
571
+ the **accent** fills the primary button and active nav. For a dark theme, set `--sw-bg`
572
+ dark and `--sw-ink` light — the copy scrim and title shadow follow `--sw-bg` automatically.
573
+ - **Phone scrub stutters / freezes on a fast flick** → the 1080p master is too heavy for a
574
+ phone decoder and seeks pile up. Ship the `-m.mp4` mobile encodes (720p, `-g 4`) and wire
575
+ `clipMobile`/`connectorsMobile` (Step 6/7). The engine already coalesces seeks; the lighter
576
+ encode is the other half. Still choppy on a low-end device? Tighten GOP (`-g 2` / all-intra).
577
+ - **Blank / black scene on iOS (desktop was fine)** → an iOS Safari quirk: a muted video that
578
+ was never played won't paint a seeked frame. The engine fixes this by keeping the still as a
579
+ poster until the clip paints and priming each video on first touch — so **don't** hide the
580
+ still on `loadedmetadata` or strip the `playsinline`/`muted` attributes if you adapt the
581
+ engine into a framework.
582
+ - **Page jumps while scrolling on mobile** → something is re-running layout on the URL-bar
583
+ show/hide `resize`. The engine ignores height-only resizes on touch; if you ported it, gate
584
+ your resize handler on a width change (keep the `orientationchange` path for rotation).
585
+ - **Copy hidden behind the URL bar / notch on mobile** → use the engine's safe-area-aware
586
+ bottom offset (`env(safe-area-inset-bottom)` + `dvh`); make sure the page's
587
+ `<meta viewport>` includes `viewport-fit=cover` (the template does).
588
+ - **Portrait crops the scene** → a 16:9 clip on a tall phone shows only its centre — which
589
+ is why the mobile version is the native 9:16 chain (§6b), never the crop. If you're seeing
590
+ this on a mobile build, either the crop fallback shipped (call it out to the user) or the
591
+ 9:16 encodes aren't actually being served (check `videoWidth < videoHeight`). Keeping each
592
+ scene's focal subject centred (prompts.md) still matters for the desktop film itself.
593
+ - **`--generate-audio` errors on seedance** → omit it; mute in HTML and `-an` on encode.
594
+ - **Kling rejects your flags** → `kling3_0` has **no `--resolution` param** (don't pass
595
+ one; encode at whatever native res ffprobe reports) and **sound defaults on** — pass
596
+ `--sound off`. Duration default is 5; legs/dives want 10.
597
+ - **Seam pop only where you "saved credits"** → you swapped models mid-chain, or used a
598
+ start-image-only model where a connector needs an `--end-image`. One model for the whole
599
+ chain; the only cheap tier is `seedance_2_0_mini`, which keeps frame-locking so it stays
600
+ seamless. (Any model with reference-only inputs can't hold a seam at all — Step 4.)
601
+ - **White-box scenes** → `gpt_image_2` returns a solid bg; either match the page bg to it
602
+ or knock it out (Step 3).
603
+ - **bash 3.2** on macOS → no associative arrays in scripts.
604
+ - **Connector grabs the wrong scene's frames** (or errors on a frame that doesn't exist
605
+ yet) → the array loop ran in **zsh** (macOS default interactive shell), where arrays are
606
+ 1-indexed, not bash's 0-indexed. Keep every array-driven chain step in a `#!/bin/bash`
607
+ script run via `bash script.sh` — never inline array loops in the interactive shell.
608
+
609
+ ## References
610
+
611
+ - `references/prompts.md` — the intake checklist, style-preamble pattern, and every
612
+ prompt template (scene still, dive, connector) with fill-in slots.
613
+ - `references/pipeline.md` — copy-paste batch scripts for the whole run (generate →
614
+ extract frames → connectors → encode → mobile encode), bash-3.2-safe.
615
+ - `references/scrub-engine.js` — the portable, config-driven scrub engine (builds DOM +
616
+ injects CSS; blob-seek, lazy load, seam crossfade, copy, route rail, reduced-motion, and
617
+ phone hardening: mobile encodes, seek-coalescing, iOS priming, safe-area, no-jump resize).
618
+ - `references/index-template.html` — a minimal standalone page that mounts the engine.
619
+ - `references/knockout.py` — border-connected background knockout for floating scenes.