gooseworks 0.5.8 → 0.5.9-dev.56.eca9486d

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 (188) hide show
  1. package/dist/agents/claude-mcp.d.ts +7 -1
  2. package/dist/agents/claude-mcp.d.ts.map +1 -1
  3. package/dist/agents/claude-mcp.js +43 -10
  4. package/dist/agents/claude-mcp.js.map +1 -1
  5. package/dist/auth/credentials.d.ts +8 -0
  6. package/dist/auth/credentials.d.ts.map +1 -1
  7. package/dist/auth/credentials.js +35 -1
  8. package/dist/auth/credentials.js.map +1 -1
  9. package/dist/auth/device-flow.d.ts +4 -1
  10. package/dist/auth/device-flow.d.ts.map +1 -1
  11. package/dist/auth/device-flow.js +8 -3
  12. package/dist/auth/device-flow.js.map +1 -1
  13. package/dist/auth/oauth-server.d.ts +9 -1
  14. package/dist/auth/oauth-server.d.ts.map +1 -1
  15. package/dist/auth/oauth-server.js +19 -11
  16. package/dist/auth/oauth-server.js.map +1 -1
  17. package/dist/auth/revoke.d.ts +10 -0
  18. package/dist/auth/revoke.d.ts.map +1 -0
  19. package/dist/auth/revoke.js +31 -0
  20. package/dist/auth/revoke.js.map +1 -0
  21. package/dist/commands/login.d.ts +15 -1
  22. package/dist/commands/login.d.ts.map +1 -1
  23. package/dist/commands/login.js +34 -10
  24. package/dist/commands/login.js.map +1 -1
  25. package/dist/commands/logout.d.ts.map +1 -1
  26. package/dist/commands/logout.js +29 -11
  27. package/dist/commands/logout.js.map +1 -1
  28. package/dist/commands/video.d.ts +35 -0
  29. package/dist/commands/video.d.ts.map +1 -1
  30. package/dist/commands/video.js +475 -39
  31. package/dist/commands/video.js.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/kit/core/canonical.d.ts +3 -1
  35. package/dist/kit/core/canonical.d.ts.map +1 -1
  36. package/dist/kit/core/canonical.js +1 -1
  37. package/dist/kit/core/canonical.js.map +1 -1
  38. package/dist/kit/core/check.d.ts +2 -0
  39. package/dist/kit/core/check.d.ts.map +1 -1
  40. package/dist/kit/core/check.js +12 -2
  41. package/dist/kit/core/check.js.map +1 -1
  42. package/dist/kit/core/detach.d.ts +11 -0
  43. package/dist/kit/core/detach.d.ts.map +1 -0
  44. package/dist/kit/core/detach.js +72 -0
  45. package/dist/kit/core/detach.js.map +1 -0
  46. package/dist/kit/core/diff.d.ts +5 -0
  47. package/dist/kit/core/diff.d.ts.map +1 -0
  48. package/dist/kit/core/diff.js +132 -0
  49. package/dist/kit/core/diff.js.map +1 -0
  50. package/dist/kit/core/errors.d.ts +7 -1
  51. package/dist/kit/core/errors.d.ts.map +1 -1
  52. package/dist/kit/core/errors.js +11 -1
  53. package/dist/kit/core/errors.js.map +1 -1
  54. package/dist/kit/core/eyes.d.ts +80 -0
  55. package/dist/kit/core/eyes.d.ts.map +1 -0
  56. package/dist/kit/core/eyes.js +366 -0
  57. package/dist/kit/core/eyes.js.map +1 -0
  58. package/dist/kit/core/files.js +2 -2
  59. package/dist/kit/core/files.js.map +1 -1
  60. package/dist/kit/core/lock.d.ts +4 -0
  61. package/dist/kit/core/lock.d.ts.map +1 -0
  62. package/dist/kit/core/lock.js +13 -0
  63. package/dist/kit/core/lock.js.map +1 -0
  64. package/dist/kit/core/log.d.ts +38 -2
  65. package/dist/kit/core/log.d.ts.map +1 -1
  66. package/dist/kit/core/log.js +38 -5
  67. package/dist/kit/core/log.js.map +1 -1
  68. package/dist/kit/core/outcome.d.ts +114 -0
  69. package/dist/kit/core/outcome.d.ts.map +1 -0
  70. package/dist/kit/core/outcome.js +246 -0
  71. package/dist/kit/core/outcome.js.map +1 -0
  72. package/dist/kit/core/patch.d.ts +64 -0
  73. package/dist/kit/core/patch.d.ts.map +1 -0
  74. package/dist/kit/core/patch.js +289 -0
  75. package/dist/kit/core/patch.js.map +1 -0
  76. package/dist/kit/core/paths.d.ts +17 -0
  77. package/dist/kit/core/paths.d.ts.map +1 -1
  78. package/dist/kit/core/paths.js +21 -0
  79. package/dist/kit/core/paths.js.map +1 -1
  80. package/dist/kit/core/pieces.d.ts +16 -4
  81. package/dist/kit/core/pieces.d.ts.map +1 -1
  82. package/dist/kit/core/pieces.js +84 -27
  83. package/dist/kit/core/pieces.js.map +1 -1
  84. package/dist/kit/core/progress-reporter.d.ts +21 -4
  85. package/dist/kit/core/progress-reporter.d.ts.map +1 -1
  86. package/dist/kit/core/progress-reporter.js +74 -12
  87. package/dist/kit/core/progress-reporter.js.map +1 -1
  88. package/dist/kit/core/progress.d.ts +41 -4
  89. package/dist/kit/core/progress.d.ts.map +1 -1
  90. package/dist/kit/core/progress.js +105 -18
  91. package/dist/kit/core/progress.js.map +1 -1
  92. package/dist/kit/core/refusal-log.d.ts +7 -0
  93. package/dist/kit/core/refusal-log.d.ts.map +1 -0
  94. package/dist/kit/core/refusal-log.js +54 -0
  95. package/dist/kit/core/refusal-log.js.map +1 -0
  96. package/dist/kit/core/run.d.ts +39 -5
  97. package/dist/kit/core/run.d.ts.map +1 -1
  98. package/dist/kit/core/run.js +514 -83
  99. package/dist/kit/core/run.js.map +1 -1
  100. package/dist/kit/core/save.d.ts +7 -3
  101. package/dist/kit/core/save.d.ts.map +1 -1
  102. package/dist/kit/core/save.js +57 -20
  103. package/dist/kit/core/save.js.map +1 -1
  104. package/dist/kit/core/style.d.ts +1 -0
  105. package/dist/kit/core/style.d.ts.map +1 -1
  106. package/dist/kit/core/style.js +1 -1
  107. package/dist/kit/core/style.js.map +1 -1
  108. package/dist/kit/line/client.d.ts +14 -2
  109. package/dist/kit/line/client.d.ts.map +1 -1
  110. package/dist/kit/line/client.js +40 -20
  111. package/dist/kit/line/client.js.map +1 -1
  112. package/dist/kit/line/types.d.ts +33 -1
  113. package/dist/kit/line/types.d.ts.map +1 -1
  114. package/dist/kit/maker/cues.d.ts +67 -0
  115. package/dist/kit/maker/cues.d.ts.map +1 -0
  116. package/dist/kit/maker/cues.js +204 -0
  117. package/dist/kit/maker/cues.js.map +1 -0
  118. package/dist/kit/maker/encode.d.ts +5 -0
  119. package/dist/kit/maker/encode.d.ts.map +1 -1
  120. package/dist/kit/maker/encode.js +7 -1
  121. package/dist/kit/maker/encode.js.map +1 -1
  122. package/dist/kit/maker/facts.d.ts +46 -0
  123. package/dist/kit/maker/facts.d.ts.map +1 -0
  124. package/dist/kit/maker/facts.js +159 -0
  125. package/dist/kit/maker/facts.js.map +1 -0
  126. package/dist/kit/maker/inputs.d.ts +48 -3
  127. package/dist/kit/maker/inputs.d.ts.map +1 -1
  128. package/dist/kit/maker/inputs.js +151 -22
  129. package/dist/kit/maker/inputs.js.map +1 -1
  130. package/dist/kit/maker/make.d.ts +20 -1
  131. package/dist/kit/maker/make.d.ts.map +1 -1
  132. package/dist/kit/maker/make.js +129 -21
  133. package/dist/kit/maker/make.js.map +1 -1
  134. package/dist/kit/maker/page.d.ts.map +1 -1
  135. package/dist/kit/maker/page.js +49 -1
  136. package/dist/kit/maker/page.js.map +1 -1
  137. package/dist/kit/maker/parts/html-frames/1.2.1/part.json +1083 -0
  138. package/dist/kit/maker/parts/html-frames/src/part.d.ts.map +1 -1
  139. package/dist/kit/maker/parts/html-frames/src/part.js +4 -1
  140. package/dist/kit/maker/parts/html-frames/src/part.js.map +1 -1
  141. package/dist/kit/maker/runtime.d.ts.map +1 -1
  142. package/dist/kit/maker/runtime.js +54 -7
  143. package/dist/kit/maker/runtime.js.map +1 -1
  144. package/dist/kit/maker/timing.d.ts +74 -0
  145. package/dist/kit/maker/timing.d.ts.map +1 -0
  146. package/dist/kit/maker/timing.js +152 -0
  147. package/dist/kit/maker/timing.js.map +1 -0
  148. package/dist/kit/maker/under.d.ts +126 -0
  149. package/dist/kit/maker/under.d.ts.map +1 -0
  150. package/dist/kit/maker/under.js +299 -0
  151. package/dist/kit/maker/under.js.map +1 -0
  152. package/dist/kit/parts/catalog.d.ts +3 -20
  153. package/dist/kit/parts/catalog.d.ts.map +1 -1
  154. package/dist/kit/parts/catalog.js +6 -41
  155. package/dist/kit/parts/catalog.js.map +1 -1
  156. package/dist/kit/parts/loader.d.ts +7 -2
  157. package/dist/kit/parts/loader.d.ts.map +1 -1
  158. package/dist/kit/parts/loader.js +88 -23
  159. package/dist/kit/parts/loader.js.map +1 -1
  160. package/dist/skills/master-skill.d.ts +4 -6
  161. package/dist/skills/master-skill.d.ts.map +1 -1
  162. package/dist/skills/master-skill.js +28 -28
  163. package/dist/skills/master-skill.js.map +1 -1
  164. package/dist/skills/routes.js +5 -5
  165. package/dist/skills/routes.js.map +1 -1
  166. package/dist/skills/server-entry-skills.d.ts +6 -6
  167. package/dist/skills/server-entry-skills.d.ts.map +1 -1
  168. package/dist/skills/server-entry-skills.js +89 -60
  169. package/dist/skills/server-entry-skills.js.map +1 -1
  170. package/dist/utils/browser-preflight.d.ts +3 -0
  171. package/dist/utils/browser-preflight.d.ts.map +1 -1
  172. package/dist/utils/browser-preflight.js +27 -6
  173. package/dist/utils/browser-preflight.js.map +1 -1
  174. package/dist/utils/exit.d.ts +6 -0
  175. package/dist/utils/exit.d.ts.map +1 -0
  176. package/dist/utils/exit.js +37 -0
  177. package/dist/utils/exit.js.map +1 -0
  178. package/package.json +14 -3
  179. package/skills/goose-ads/SKILL.md +8 -8
  180. package/skills/goose-product-photos/SKILL.md +8 -8
  181. package/skills/goose-video/SKILL.md +29 -595
  182. package/skills/goose-video-local/SKILL.md +3 -1572
  183. package/skills/gooseworks/SKILL.md +10 -12
  184. package/skills/make-custom-video/SKILL.md +25 -672
  185. package/skills/manifest.json +7 -7
  186. package/skills/routes.json +3 -3
  187. package/dist/kit/maker/parts/html-frames/1.1.0/part.json +0 -199
  188. package/dist/skills/production-video-skills.json +0 -5
@@ -1,1576 +1,7 @@
1
1
  ---
2
2
  name: goose-video-local
3
- slug: goose-video-local
4
- description: >
5
- Render an EXISTING GooseWorks video ad project or video batch with ffmpeg (plus Playwright for
6
- phone-mockup formats) and the GooseWorks media proxies, then save the finished MP4 back to the
7
- project over MCP. Runs on the user's own machine (Claude Code / desktop app, with or without the
8
- gooseworks CLI) OR inside a GooseWorks workspace sandbox (canonical MCP tools + Bash, no CLI).
9
- Use for a client-side format project (created by goose-video), a template-remix project or a
10
- video batch. A copy-for-Claude command or project id must first be checked with
11
- video_project_read. A hosted connector with no shell hands this same project to the GooseWorks coworker. To start a NEW video ad in chat,
12
- use goose-video first.
13
- category: ads
14
- version: 1.0.1
15
- author: GooseWorks
16
- tags: [gooseworks, ads, video, remix, imessage, podcast, ugc, local-render, sandbox, byoa]
3
+ description: Make an approved GooseWorks video when an answer's next_step gives its command.
4
+ version: 1.0.3
17
5
  ---
18
6
 
19
- # GooseWorks Video Ads — local remix runtime
20
-
21
- ## How to talk to the customer (applies to every message you send them)
22
-
23
- The customer is a marketer or founder, not an engineer. Everything in this skill about tools,
24
- fields, files, polling, models and pipeline steps is for YOU. Never pass it on to them.
25
-
26
- - **Say what they get and what they need to decide, never how it's made.**
27
- Bad: "Checking the media-proxy helpers for voiceover timestamps and lipsync." / "Generated with
28
- gpt-image-2 at high quality, mouth closed, passes QC."
29
- Good: "Recording the voices now." / "Here are your two hosts."
30
- - **Never mention** tool, file or field names, ids, JSON, commands, scripts, installed software,
31
- uploads, model or vendor names, timings in seconds or frames, retries, polling, internal statuses
32
- or your own quality checks. Fix what you can quietly. If they ask how something works, explain it
33
- simply.
34
- - **Update them only at milestones they care about**: choices confirmed, script and voices done,
35
- visuals done, ready to review, finished. One short line each, then stay quiet until the next
36
- milestone. No update for setup, downloads, uploads or saving.
37
- - **Money is in credits, with a number**: "the full video uses about N credits". Never "the cheap
38
- pieces" or "the expensive render".
39
- - **Problems:** say what it means for them and what they can do, in one or two sentences. No error
40
- codes or stack traces. Only raise a problem that changes something for them.
41
- - **Use their words**: script, voice, hook, scene, host, ending, logo, the product shot.
42
- - **No filler**: no "Great question!", "Certainly!", "I hope this helps!", no restating what they
43
- just said at length.
44
-
45
- Example. Instead of a dozen lines about render tools, scripts, uploads and portraits, send:
46
- "Got it: warm tone, home podcast studio, Brielle as the skeptic and Mark as the believer." then
47
- "Script and voices are done (about 34 seconds)." then "Ready for you to review: the script, voices,
48
- both hosts and the ending. You can also review your recipe ingredients in the app: <link>. Say go
49
- here and I'll make the full video (about N credits)."
50
-
51
- ## Use current instructions for new work
52
-
53
- Before a new task in a terminal host, run `gooseworks skills status` once. It compares the
54
- installed entry files, running CLI and published npm release. An older CLI needs a package
55
- upgrade before `gooseworks update`; update alone only uses that CLI's bundled instructions.
56
- Preserve local edits or unknown install provenance. Review/back up before explicitly replacing
57
- modified files; never quietly reinstall over them. If the release check is unavailable, report
58
- that freshness is unknown rather than claiming the local copy is latest.
59
-
60
- For a new recipe run, fetch its package from the connected catalog. Retain the returned
61
- `version` / `contentHash` and every dependency's hash with the saved package. When reusing a
62
- saved fetch JSON, `gooseworks fetch <slug> --saved-package <file>` returns the current package
63
- and a hash comparison without changing that file. With MCP, if the advertised `catalog_fetch`
64
- schema accepts them, send `saved_content_hash` and `saved_dependency_hashes`; otherwise fetch
65
- normally and compare the returned hashes yourself. Missing hashes mean unknown, not current.
66
- The server cannot inspect a client's saved files; hash metadata does not certify later edits.
67
- Fetch current packages into a new run directory and report stale saved instructions. Preserve
68
- an existing approved run's recorded package; changing that harness requires a reviewed change
69
- and approval before spending. Hosted installed snapshots use the existing Skills Update action.
70
- Skill content and a host's cached MCP tool schemas are separate: refreshing one does not refresh
71
- the other. Check the actual advertised tools before using new fields.
72
-
73
- ## Prepare the video workflow and brand before creative work
74
-
75
- **Installed entry files are bootstrap instructions.** For new work started from an installed
76
- file or an old chat, fetch `catalog_fetch { type: "skill", slug: "goose-video-local" }` on the selected
77
- connection and read its returned content and dependencies before continuing. Use the already
78
- fetched body when this entry came from that connection in this run; do not recursively fetch
79
- the same entry. A CLI freshness warning does not block using the current connected package.
80
- Keep the fetched package and hashes in a new run folder; do not replace edited installed files.
81
- If current instructions cannot be loaded, resolve the connection before format suggestions,
82
- script writing or production. Do not continue from an old installed workflow or session notes.
83
-
84
- **Follow the connector's full-guide requirement when available.** Fetch
85
- `catalog_fetch { type: "skill", slug: "gooseworks-guide" }` when the connector requires it.
86
- The only older-server exception is below; it never removes brand preparation or approvals.
87
-
88
- | Returned guide/workflow state on the selected connection | Required action |
89
- | --- | --- |
90
- | Guide returns `not_found`, and this same connection already returned the complete current matching video entry with its required dependencies | Continue with that authoritative entry's workflow, full brand preparation and existing approvals. |
91
- | Guide has another error, no response, or incomplete content; or the matching entry/dependencies are missing, incomplete or from another connection | Stop before creative work, project writes or paid calls; resolve a compatible connection on this same environment. |
92
-
93
- A missing custom entry or required custom tool/schema remains unavailable: never substitute
94
- a template or an import to bypass it. Never hide other fetch errors or continue from cached
95
- instructions merely because the guide was not found.
96
-
97
- **For an existing project or batch, read `video_project_read` first.** Determine its actual
98
- route and saved review state before fetching a recipe or doing local work. Resume an approved
99
- run with its recorded packages, brand inputs, script and ingredients; do not silently replace
100
- them with today's release or brand rules. Follow returned preparation requirements and use
101
- the existing affected review/approval flow for an intentional change. Reads, free drafts,
102
- imports and existing-job retrieval do not grant permission for new paid production.
103
-
104
- **For every new plan, resolve the brand and call**
105
- `brand_read { brand_id, sections: ["summary", "kit", "products", "learnings"] }` **before**
106
- suggesting formats, mining video angles, writing any script, creating a production plan or
107
- handing the work to another agent. Use `brand_get_context` with those same four sections only
108
- when advertised. Reuse a complete read from this run on the same connection and brand.
109
- Onboarding completion, a summary-only response and earlier session notes do not supply the
110
- kit, selected product facts or saved rules. If the full read is unavailable, resolve it before
111
- creative work. Use known kit facts while research is incomplete; do not restart research
112
- solely because its status is pending. Never invent a product fact or accept a campaign to
113
- bypass preparation. Then search the Brand Brain (next section) before suggesting formats,
114
- choosing an angle or asking the user for a brand fact.
115
-
116
- Carry that context through custom/template/idea routing and delegation. Before writing, make
117
- the workflow's brand-rules file from those sources: pronunciations, required spoken copy,
118
- prohibited claims, real logo, font, palette and the selected product's supported facts.
119
- Entries prefixed `Video preference:` and visual/pacing instructions are creative direction,
120
- not spoken lines. Use the kit's audience, offer and voice as defaults without an interview.
121
- The rules file mirrors context; it is not proof of a read or permission to spend. Keep the
122
- route's existing script, ingredient and budget approvals, including its allowed previews.
123
-
124
- **Use the server's brand bundle when the selected API returns it.** Project create/read may
125
- return top-level
126
- `brand_context`: `{ version: 1, brand_id, digest, loaded_at, sections, brand, kit, products,
127
- learnings }`. Its sections cover summary, kit, products and learnings.
128
-
129
- | Returned brand/project response on the selected connection | Required action |
130
- | --- | --- |
131
- | A complete authoritative version-1 `brand_context` is returned | Binding is required: use its contents for the plan/rules and include `script_drafts.brand_context_digest = brand_context.digest` with each new/changed script save. |
132
- | An older API returns the actual four brand sections but no `brand_context` in either the brand read or project response | Prepare from those full sections, write the brand rules and follow the selected connection's existing approval flow and advertised fields. Do not fabricate a receipt or send nonexistent bundle/digest fields. |
133
-
134
- An incomplete/malformed bundle or missing brand section is a preparation failure, never the
135
- older-API exception. Once this connection returns an authoritative bundle, use its binding
136
- contract. `script_drafts.video_brand_context` is server-owned: do not author, replace or forge
137
- it, and do not invent a read receipt or hash local brand facts into one. Keep the full bundle
138
- out of client review payloads. If managed generation returns HTTP 409
139
- `video_brand_context_required`, reload the project and bind the plan to its returned bundle
140
- through the normal review flow before retrying. That refusal never permits the older-API
141
- fallback, skipping sections or retrying paid calls blindly. Unchanged approved legacy resumes
142
- retain their package, context and approvals; an upgrade alone needs no extra approval.
143
-
144
- **To apply a deliberate brand correction to a new or revised plan**, make a fresh, unfiltered
145
- `brand_read` of those four sections. When it returns the authoritative bundle, use its
146
- returned `brand_context.digest` in the complete revised `script_drafts` through the existing
147
- `video_project_upsert` `patch.script` save; the server verifies the current brand and replaces
148
- its snapshot with the saved plan. On an older API with no bundle contract, apply the actual
149
- four-section correction and save the revised draft through its existing flow without inventing
150
- digest fields. If a connection that already returned a bundle cannot supply the fresh bundle,
151
- resolve that failure before rebinding. Review and approve the affected script, ingredients and
152
- budget through the normal flow. Never refresh an ongoing approved run automatically; its
153
- recorded package and brand inputs stay pinned until an intentional change.
154
-
155
- ## Search the Brand Brain, then propose — before any creative choice or question
156
-
157
- The Brand Kit is a summary. The brand's saved knowledge (its Brain) holds what the Kit does not:
158
- rules from past feedback, approved and rejected creatives, customer evidence, approved claims,
159
- reports and documents. **After `brand_read`, and before you choose an angle, claim, hook,
160
- product emphasis, format or source ad — and before you ask the user for any brand fact — call
161
- `knowledge_search { brand_id, query }`** when it is registered. It is free and read-only: no
162
- approval, no announcement to the customer and no questionnaire.
163
-
164
- 1. **Search for this task, not the whole Brain.** Run one short query (under 500 characters) in
165
- the user's own words plus the product (for example "ads for <product>: what worked, what to
166
- avoid") and one with
167
- `source_types: ["evidence", "claim", "learning", "creative", "document"]` for proof and past
168
- creative results. Add a query only for a specific open question. Reuse results from this run.
169
- 2. **Keep these states distinct** and record which one each query returned:
170
-
171
- | Result | Means | Do |
172
- | --- | --- | --- |
173
- | `status: "ok"` with matches | Saved knowledge exists | Use it; keep each fact's citation in your working brief |
174
- | `status: "empty"` | Nothing saved matches this query | Say "no saved evidence for <topic>", never "the brand has no proof" |
175
- | `refresh_required` | The results shown are current; some changed sources were left out | Use them; search again shortly for anything missing |
176
- | `building` | The index is not ready | Retry once shortly, then continue with the gap stated |
177
- | An error, or the tool is not registered | Retrieval failed or is unavailable | Retry an error once, then continue from `brand_read` and treat evidence as unchecked |
178
- | An empty Kit field | Only that field is blank | Not a search result: still search before asking |
179
-
180
- 3. **Let the findings change the plan.** A `dont`/`must` learning or a rejected creative rules
181
- options out; an approved or well-rated past creative is a proven angle to lead with; a report
182
- shows what worked. Claim-grade proof is a result with `approved_ad_claim: true` or the kit's
183
- `approvedClaims` within their stated applicability; the kit's `proofPoints` are what the
184
- backend allows an ad to state, used as written. Other Kit text, documents and performance
185
- numbers are context, never public claims. Never invent an offer, price or result. Judge
186
- relevance and skip results about another product or business.
187
- 4. **Propose; don't interview.** Lead with one recommended direction (angle, product, source or
188
- format) and a one-line reason naming what you found, with up to two alternatives. When several
189
- directions fit (two audiences, products or campaigns), pick the one the evidence favours, such
190
- as an active campaign or approved past creatives, and name the other as an alternative instead
191
- of asking. Ask only for a decision the brand read and the search cannot settle, or for spend
192
- approval. Never ask the user for a fact the Brain already answered.
193
- Keep directions already chosen (the user's words, a project's creative brief, handed-off
194
- defaults, approved plans): search only to fill empty fields and to apply saved rules. When a
195
- returned card or picker presents the choice, your recommendation is its one acknowledgement
196
- line and the saved plan's defaults, not a separate list.
197
- 5. **Carry an evidence brief** into the routed skill, writer or plan: findings with citations,
198
- the state of each query, what it ruled out and the open gaps. Tell the customer the findings
199
- in plain words; the citations stay in the brief.
200
-
201
- On an approved resume, keep the saved brief and evidence; search again only for a new decision.
202
-
203
- ## Chat hosts and cards
204
-
205
- First perform the mandatory route check below. Then, without a shell, hand a verified template
206
- project to `goose_run_task { brand_id, project_id, message }`, or a verified template batch to
207
- `goose_run_task { brand_id, batch_id, message }` (never send both ids). Keep task_id and the
208
- same project or batch. Generated custom children keep their separate make-custom-video flow.
209
- Inside a coworker sandbox you are the renderer: never delegate recursively.
210
- With card.display_hint:"widget", say at most one line and never duplicate its plan, total or
211
- links. Otherwise print card.text_summary. Read again on customer input, not in a polling loop.
212
- A free saved draft is not proof that planning started or a complete plan exists.
213
-
214
- ## Mandatory route check before any local work or spend
215
-
216
- For every existing `project_id` (including one supplied by the app's copy-for-Claude command),
217
- call `video_project_read { brand_id, project_id }` **before** template lookup, toolchain setup,
218
- media-proxy calls, or a review-set upload. For a batch, inspect each child project.
219
-
220
- - **A server-rendered order** — the response has `creative_plan`,
221
- `project.creative_spec_revision_id`, `order.creative_spec_revision_id`, a planning
222
- `lifecycle`, or an `order` / `script_drafts.recipe` on a server format → **stop.**
223
- Server video orders are paused, and there is **no vetted local node-execution API** for them:
224
- do not rebuild one locally. Tell the customer this project was made for the server flow, which
225
- is paused; offer to start the same ad on a client-side format (`goose-video`, fetched with
226
- `catalog_fetch { type: "skill", slug: "goose-video" }`, older clients:
227
- `fetch_skill("goose-video")`). An order already holding credits can be released with
228
- `job_cancel`.
229
- - **A client-side format or template remix** (a `source_sample_id` / `template_id` and none of
230
- the above) → continue below.
231
- - **Generated custom video** (`project.custom_video_state.mode === "generate"`) → fetch `catalog_fetch { type: "skill", slug: "make-custom-video" }`, follow it on this same project and stop following the template flow. Record independent authenticated script/ingredient approvals in this chat with the current custom_review.approval_quote phase, review_token and cumulative total; Studio is optional. A handed-off coworker cannot self-approve; do not report approval_not_required.
232
- - **Unclear** → read again or ask; never guess and generate. A copy prompt that names this skill
233
- is not proof of which kind the project is.
234
-
235
- Continue below only for a verified client-side format or template remix.
236
-
237
- For client-side formats and template remixes, you produce **video** ad creative wherever THIS agent runs and sync
238
- the result back to the GooseWorks app over MCP. This document is the **runtime contract** (auth,
239
- credits, the media proxies, data I/O, the review gate). A separate **recipe** — the template's
240
- `recipe`, plus the capability skills it names — tells you *what to make* (the pieces, prompts,
241
- models, order of assembly).
242
-
243
- **Division of authority: read both, but when they disagree THIS doc wins on the environment AND the
244
- review/approval flow.** The recipe governs WHAT to make; this doc governs WHEN you pause, generate,
245
- and spend. In particular: a recipe may spell out a **multi-phase, multi-gate** flow — "generate the
246
- still [GATE] → approve → author the prompt [GATE] → approve → render [GATE] → approve", several
247
- separate pauses. **Do NOT run it that way.** Collapse every one of those gates into the single
248
- **review-once** flow below: one review set, one approval (Step 3). Take the recipe's pieces, prompts
249
- and models; ignore its intermediate pauses. This is the exact contradiction that confused past runs
250
- (GOOSE-2542) — there is no ambiguity: review-once wins.
251
-
252
- The app NEVER runs this skill by itself — it is the viewer + review surface; you are the renderer.
253
-
254
- ## Keep the selected connection for the whole run
255
-
256
- Call `account_whoami` on the connection that owns the brand/project before the first write.
257
- Keep `environment.name` and the public `environment.api_origin` with this run. Respect the
258
- user's selected production or staging connection. If multiple connections are available and
259
- none was selected, resolve that once. Missing or unknown identity is uncertainty, not
260
- permission to switch. Never infer the environment from credits, billing links or Node mode.
261
-
262
- Reads, project creation, uploads, generation, polling and final updates all use that same
263
- connection. If a production request fails, resume or report the failure on production;
264
- never retry it on staging or recreate the project there. Before retrying a timed-out write,
265
- read back the existing project or paid request on the selected connection.
266
-
267
- Local/CLI proxy origin must match `environment.api_origin`. If it differs, use the MCP
268
- relay on the selected connection (`GW_MEDIA_VIA=mcp`) before paid calls. Do not change
269
- credentials or API origins to recover a failed write. An explicit user-requested move is
270
- a separate operation, with the existing project and paid requests reconciled first.
271
-
272
- ## Check assets for the selected format before spending
273
-
274
- For a template, read its structured `asset_readiness` from
275
- `video_catalog_list { kind: "formats", brand_id }`. `missing` names gaps;
276
- `needs_review` means suitability is unverified, including older recipes without
277
- structured requirements. `ready` describes assets only, not script or budget approval.
278
- For a custom video, derive requirements from its actual approved scenes.
279
-
280
- Inspect candidate files for the chosen product and format. A catalog photo can contain
281
- multiple objects, other products or a person; its existence or approved status does not
282
- make it a standalone image of the selected product. Check object count, framing, readable
283
- print and real image bytes. A service conversation has no automatic packshot requirement.
284
-
285
- Reuse a suitable approved image first. A free crop or cutout is a new file: keep the
286
- original, inspect the result and include it in the normal ingredient review. When no
287
- usable input exists, explain the gap before generation. Estimate any paid preparation
288
- separately before spending. Record the selected asset and inspection in the project
289
- review set; do not add a separate approval round.
290
-
291
- ## Where am I running? (decide once, first)
292
-
293
- Check in Bash, without printing any secret value:
294
-
295
- ```bash
296
- [ -n "$GW_MEDIA_PROXY_TOKEN" ] && echo sandbox || echo local
297
- command -v gooseworks >/dev/null && echo cli || echo no-cli
298
- ```
299
-
300
- | Mode | How you know | Skills / atoms | Media-proxy auth |
301
- |---|---|---|---|
302
- | **GooseWorks sandbox** | `GW_MEDIA_PROXY_TOKEN` is set | `catalog_fetch { type: "skill" }` | env: `GW_MEDIA_PROXY_TOKEN` + `GW_*_PROXY_URL` |
303
- | **Local, CLI installed** | `gooseworks` on PATH | `gooseworks fetch <slug>` or `catalog_fetch` | `~/.gooseworks/credentials.json` |
304
- | **Local, no CLI** (Claude desktop app / Codex without login) | neither | `catalog_fetch { type: "skill" }` | `~/.gooseworks/credentials.json` if present, else **paid media over the MCP** (below) |
305
-
306
- The `gooseworks` CLI and `~/.gooseworks/credentials.json` are **optional**. Everything this skill
307
- needs from the app goes through the GooseWorks MCP tools below; the atoms' `media_proxy.py` reads
308
- credentials.json when it exists and falls back to the `GW_MEDIA_PROXY_TOKEN` env otherwise.
309
-
310
- ### Paid media over the MCP: no key, no CLI needed
311
-
312
- Every paid generation goes through the GooseWorks media proxy and is billed to the project. **You
313
- never need FAL_KEY, an ElevenLabs key or `fal_client`.** An atom, a recipe or an open-source
314
- skill that lists `FAL_KEY` in its environment is describing a standalone setup; here the proxy
315
- satisfies it. Never stop, and never ask anyone to set a key, because one is missing.
316
-
317
- **A one-off image or clip — call the MCP directly.** A frame placed in a laptop, a product cutout,
318
- a creator still, a restyle, an animated shot, with any fal model (Nano Banana, GPT-image, Seedream,
319
- Seedance, Kling). No atom script is needed:
320
-
321
- 1. A local input (a frame pulled from a screen recording, a screenshot) must be a public URL first:
322
- `media_upload { brand_id, scope: "video_project", scope_id: project_id, source: { type: "file" | "bytes", … } }`
323
- (no `path`). For a file, PUT its bytes to `upload.url` with `upload.required_headers`,
324
- then call `media_confirm { brand_id, media_id: media.id }`. Use the returned `media.url`.
325
- 2. `data_post_provider { provider: "fal", path: <model id, e.g. "fal-ai/nano-banana/edit">, body: <model input>, project_id }`
326
- returns `{ job_id: "fal:<request_id>" }`. Pass an `idempotency_key` so a retry isn't billed twice.
327
- 3. Poll `job_get { job_id }` every few seconds until `complete`; the `*.fal.media` URLs are in
328
- `result`. Download each and QC it (open the image) before using it.
329
-
330
- For a set that must match (every laptop shot, every creator still), use ONE prompt and the same
331
- model for all of them and change only the input image. Voice and music:
332
- `data_post_provider { provider: "elevenlabs", path: "/v1/text-to-speech/{voice_id}" | "/v1/music", body, project_id }`
333
- (synchronous; the audio lands in the project folder).
334
-
335
- `photos_generate` is **not** a general image tool: it only photographs a physical catalog
336
- product (apparel, beauty, CPG) and needs a `product_id`. A software screenshot or app mockup is a
337
- fal image edit, above.
338
-
339
- **Atom scripts — the MCP relay.** With neither `GW_MEDIA_PROXY_TOKEN` nor
340
- `~/.gooseworks/credentials.json`, the atoms' `media_proxy.py` RELAYS each paid call through you
341
- instead of calling the proxies over HTTP. Before running any atom,
342
- `export GW_PROJECT_ID=<project_id> GW_BRAND_ID=<brand_id>` (every call is billed to that
343
- project). When a script **exits with code 3** it wrote a request file under
344
- `working/mcp-requests/`: make exactly that MCP call — fal:
345
- `data_post_provider { provider: "fal", path, body, project_id }` then `job_get { job_id }` until
346
- `complete`, saving `result.output`; ElevenLabs: `data_post_provider { provider: "elevenlabs", … }`,
347
- saving the reply; a local file: `media_upload` with its bytes, saving `{"url": …}`. Write that JSON
348
- to the request's `save_result_to` and **re-run the same command**; repeat until the script
349
- finishes. Same server proxy and price as the CLI path. If the CLI is logged in to a DIFFERENT
350
- environment than this MCP connector (prod vs staging), set `GW_MEDIA_VIA=mcp` so the spend lands
351
- where the project lives.
352
-
353
- ## MCP tools — canonical names (use these)
354
-
355
- Use the canonical GooseWorks MCP tools. Legacy names are listed only as a fallback for an older
356
- client that does not expose the canonical tool; never mix both for one step.
357
-
358
- | Step | Canonical tool (use this) | Legacy fallback |
359
- |---|---|---|
360
- | Read a project / batch | `video_project_read { brand_id, project_id }` / `video_project_read { brand_id, batch_id }` | `get_ad_project` / `get_ad_video_batch` |
361
- | Template recipe | `catalog_fetch { type: "template", slug: <source_sample_id> }` | `get_ad_template` |
362
- | Capability skill (atom) + its scripts | `catalog_fetch { type: "skill", slug }` | `gooseworks fetch <slug>` / `fetch_skill` |
363
- | Brand kit, products, rules | `brand_read { brand_id, sections: ["summary","kit","products","learnings"] }` | `brand_get_context` / `get_brand_kit` |
364
- | Save a brand rule (a correction) | `brand_update { brand_id, knowledge_intent: "user_correction", user_statement: <the user's exact words>, patch: { facts: [{ id?, kind, text }] } }` | none |
365
- | Mirror the review set | `video_project_upsert { brand_id, project_id, patch: { script: { script_drafts, script } } }` | `update_ad_project_script` |
366
- | Project assets | `video_project_upsert { …, patch: { assets: [...] } }` | `update_ad_project_asset` |
367
- | Progress note | `video_project_upsert { …, patch: { message: { role: "agent", content } } }` | `append_project_message` |
368
- | Batch status | `video_project_upsert { brand_id, batch_id, patch: { batch: { status } } }` | `update_ad_video_batch` |
369
- | Upload a file to the project | `media_upload { brand_id, scope: "video_project", scope_id: project_id, kind, path, source: { type: "file", filename, content_type } }` → PUT → `media_confirm { brand_id, media_id: media.id }` | `get_upload_url` / `get_ad_upload_url` |
370
- | Save / find a finished piece (resume) | `media_upload { …, path, ingredient_key, input_digest }` / `media_list { brand_id, scope: "video_project", scope_id: project_id, ingredient_key_prefix: "" }` (see "Save as you go") | none |
371
- | Open the render row | `video_render_run { brand_id, project_id, kind: "full" }` (no `dry_run`; returns `render_id`) | `submit_render { project_id, kind: "full" }` |
372
- | Update the render row | `video_render_run { brand_id, project_id, render: { render_id, status, output_url?, thumbnail_url?, error_message?, quality_status?, quality_report? } }` | `update_render_status` |
373
- | Pin the final render | `video_project_upsert { brand_id, project_id, patch: { final_render_id: render_id } }` | `set_final_render` |
374
- | Credits / identity | `account_whoami` | `get_ad_credits` |
375
-
376
- `list_accessible_scopes` and the `target: { type: "agent", agent_id }` dance are **not needed**:
377
- `media_upload` with `scope: "video_project"` derives the right storage key (org-default Ads agent
378
- + brand slug + project folder) on the server.
379
-
380
- ## Running in a GooseWorks sandbox
381
-
382
- You are an agent inside the user's GooseWorks workspace sandbox (Claude Code harness, Bash, the
383
- GooseWorks MCP with canonical tools only). There is **no `gooseworks` CLI** and **no
384
- `~/.gooseworks/credentials.json`**. The environment carries `GW_MEDIA_PROXY_TOKEN`, `GW_API_BASE`,
385
- `GW_FAL_PROXY_URL`, `GW_FAL_STORAGE_PROXY_URL`, `GW_ELEVENLABS_PROXY_URL`, `GW_WHISPER_PROXY_URL`
386
- and usually `GW_PROJECT_ID`.
387
-
388
- - **Formats:** only formats that need **no Chromium** run here — podcast skits and UGC /
389
- talking-head formats (ffmpeg + PIL assembly). If the template's recipe or an atom needs
390
- Playwright/Chromium with no PIL fallback (iMessage / ChatGPT / Notes phone mockups,
391
- hyperframes, HTML recorders), **stop before any spend** and say so plainly: "This format needs
392
- a browser renderer that this workspace doesn't have. Run it in your own Claude Code with the
393
- GooseWorks CLI (`goose-video-local`), or pick a podcast/UGC format." Do not half-render.
394
- - **Toolchain:** check `ffmpeg -version` and `ffprobe -version`. Install Python deps only when an
395
- atom needs them: `pip install --quiet pillow` when a render atom uses PIL (captions, end card),
396
- `pip install --quiet requests` if `import requests` fails. Never `npx playwright install` here.
397
- - **Atoms:** `catalog_fetch { type: "skill", slug }` returns `content`, `scripts`, `files` and
398
- `dependencySkills`. Write `content` to `/tmp/gooseworks-scripts/<slug>/SKILL.md`, each
399
- `scripts` entry to `/tmp/gooseworks-scripts/<slug>/scripts/<name>` and each `files` entry to
400
- `/tmp/gooseworks-scripts/<slug>/<name>` (keep the key as the relative path; do the same for
401
- each dependency skill). Run scripts from their `scripts/` folder so `import media_proxy` resolves.
402
- - **Project attribution:** `export GW_PROJECT_ID=<project_id>` in the shell **before running any
403
- atom** for that project (re-export per concept in a batch). The proxies bill the workspace
404
- agent and attribute spend to that project.
405
- - **Never call a provider with a raw key.** All FAL / ElevenLabs / Whisper traffic goes through
406
- the `GW_*_PROXY_URL` bases with `GW_MEDIA_PROXY_TOKEN`. `FAL_KEY` / `ELEVENLABS_API_KEY` in
407
- this environment are proxy tokens, not provider keys — never send them to `fal.run`,
408
- `queue.fal.run` or `api.elevenlabs.io` directly. Never print any token.
409
- - **Whisper for QC:** `export OPENAI_BASE_URL="$GW_WHISPER_PROXY_URL/v1"` before running
410
- `review-ugc-render` / `watch` transcripts.
411
- - **The operator may be absent.** Keep every quality gate and checkpoint below, but decide
412
- defaults yourself from the project brief and the recipe, and record them in the review set.
413
- Ask in the chat **only for a true taste call** (a creative choice the brief and recipe leave
414
- open and that changes the ad), never for a mechanical or recoverable decision. The Step 3
415
- approval still applies: ask for it in this chat and record the yes with
416
- `video_project_upsert patch.approve`.
417
- - **Outputs:** keep working files under `/tmp/gooseworks-video/<project_id>/` (local disk — never
418
- the s3fs workspace mount, which is slow and can drop writes); anything the user must see goes to
419
- the project via `media_upload` (never leave the result only in the sandbox). Every paid piece is
420
- also SAVED to the project as soon as it passes QC — see "Save as you go — and resume".
421
-
422
- ## Report problems so we can fix them (telemetry — do this, don't skip it)
423
-
424
- If anything blocks or degrades this run — a media/proxy call fails or errors, a required input or
425
- asset is missing, a recipe instruction is ambiguous or contradictory, the render toolchain won't set
426
- up, or you hit a bug you can't work around — **report it** so the team gets visibility and can fix
427
- the skill. It's fire-and-forget, never counts against you, and never blocks your work.
428
-
429
- - **First, set a stable run id** so every event (yours + the auto-logged media calls) groups together:
430
- `export GW_RUN_ID="vid-<project_or_batch_id>"` (and `export GW_SKILL="<recipe-slug>"`) in the
431
- shell you render from. The media proxies read `GW_RUN_ID` automatically.
432
- - **CLI present →** `gooseworks log "<what happened>" --event-type <type> --level error --details '{"error":"...","step":"...","model":"..."}'`
433
- - **No CLI (sandbox / cowork) →** from any atom's `scripts/` folder:
434
- `python3 -c 'from media_proxy import gw_log; gw_log("<what happened>", event_type="blocker", level="error", details={"step": "..."})'`
435
- (or the `log_cli_event` MCP tool if your client has it).
436
- - Event types: `api_failure` (a proxy/model call failed) · `missing_input` · `blocker` ·
437
- `confusion` (unclear/contradictory instruction) · `error` (a bug) · `step`/`info` (progress notes).
438
- - Put the **real error text + the step you were on** in the details. Paid FAL/ElevenLabs calls
439
- ALREADY auto-log their own failures, so focus your manual logs on what the proxy can't see:
440
- missing inputs, confusing/contradictory recipe instructions, toolchain/setup failures, and bugs.
441
- - Logging is FOR US — it does not replace telling the user. When a problem blocks the run, still
442
- explain it to the user (and ask if you need a decision); just also log it so we can fix the skill.
443
-
444
- ## Prerequisite — MCP + a render toolchain (Phase 0 preflight)
445
-
446
- - The GooseWorks MCP tools are REQUIRED. If they're unavailable, stop and tell the user
447
- to connect the GooseWorks MCP server (or run `gooseworks install --claude --mcp` on the CLI)
448
- and restart. There is no REST fallback.
449
- - **The render runs wherever THIS agent runs, and it needs a real toolchain:** `ffmpeg` +
450
- `ffprobe` always, plus a Playwright **Chromium** for browser-rendered formats (phone mockups,
451
- HTML end cards without a PIL fallback). Establish it in this priority order, and do NOT start
452
- rendering until one is confirmed:
453
- 1. **Sandbox →** see "Running in a GooseWorks sandbox": ffmpeg + ffprobe (+ PIL on demand); no
454
- Chromium, so browser formats stop there.
455
- 2. **CLI present →** run `gooseworks doctor --no-browser` for login, MCP, Node 18+, ffmpeg
456
- with libx264 + libass, and ffprobe. This is common setup only. After fetching the selected
457
- capabilities in Step 2, check each browser renderer's actual launch before ANY paid
458
- ingredient. An unscoped `gooseworks doctor` checks only the calling folder's browser;
459
- it cannot certify a different fetched renderer.
460
- 3. **No CLI →** check the toolchain yourself: `node --version` (18+), `ffmpeg -version`,
461
- `ffprobe -version`, plus `ffmpeg -hide_banner -encoders` (libx264) and
462
- `ffmpeg -hide_banner -filters` (ass). After fetching, use the exact-package free launch
463
- check in Step 2; resolving a package or finding a cache folder does not prove its browser
464
- can launch. The `watch` QC step later needs the same ffmpeg and,
465
- for transcripts, a Whisper backend — without one it degrades to frames only.
466
- 4. **Docker available →** the most reliable way to get the toolchain on a host that lacks it:
467
- run the render steps inside the prebuilt image
468
- **`ghcr.io/gooseworks-ai/goose-video-render`** (ffmpeg + ffprobe + Playwright Chromium baked
469
- in), mounting the project working directory. (Nested Docker is usually disabled inside
470
- managed sandboxes — treat this as an option, not a guarantee.)
471
- 5. **None of the above works →** STOP and tell the user plainly, e.g.: *"Video rendering needs
472
- ffmpeg (and, for this format, a Playwright Chromium) on the machine running this agent. This
473
- environment doesn't have them and I can't install them here. Options: (a) enable Docker so I
474
- can use the goose-video-render image, (b) install ffmpeg + `npx playwright install chromium`,
475
- or (c) run this skill in your own Claude Code where the toolchain is available."* Do not
476
- half-render or fake a result. Static image ads (the `goose-ads` skill) do NOT need any of this
477
- and work anywhere — offer that as the fallback if they just want an ad now.
478
-
479
- ## Identity, token, credits
480
-
481
- - **Sandbox:** the token is `GW_MEDIA_PROXY_TOKEN` (already scoped to this workspace's agent and
482
- org); the API base is `GW_API_BASE`. Never print either.
483
- - **Local:** read `~/.gooseworks/credentials.json` → `api_key` (your agent token), `api_base`,
484
- `agent_id`. Never print the token.
485
- - **Uploads go through `media_upload` with `scope: "video_project"`** — pass `path` = the
486
- project-relative path (`working/final.mp4`, `working/review/end-card.png`). The server stores it
487
- in the project folder of the org-default Ads agent (where the app's render-file route reads) and
488
- returns `upload.url` (presigned PUT), `upload.required_headers` and
489
- `upload.render_file_url`. PUT the bytes with exactly those headers, check the PUT returned
490
- 2xx, then call `media_confirm { brand_id, media_id: media.id }` and require success before
491
- using the file in ingredients or completing a render. This applies to project-path and
492
- path-less file uploads. Confirmation verifies the stored file; Goose performs this tool step
493
- without asking the user for another approval. On failure, report or repair the upload before
494
- continuing. Never hand-build storage paths or agent prefixes; a bare workspace upload is
495
- invisible in the app.
496
- - Media generation (FAL / ElevenLabs) through the GooseWorks proxies is the **REAL spend** — billed
497
- per call as you generate (Step 4). The render row (`video_render_run kind: "full"`) charges the flat
498
- **video base fee once, when a full render is reported `complete`**. Open one row immediately
499
- after recorded approval, BEFORE paid production (Step 4.1), and reuse that render_id for progress
500
- and completion. Never open a second row on a guess (a second completed row bills again). The final-video QC gate (Step 4.3) then sits between
501
- that master and PINNING it. Call `account_whoami` first to see the credit balance.
502
-
503
- ## Save as you go — and resume (never pay twice for a piece)
504
-
505
- A sandbox can die mid-run (timeout, restart, a new session picks the project up). Anything that
506
- lives only in `/tmp` is then gone, and regenerating it pays again. So: **save every piece to the
507
- project the moment it passes its QC, and start every run by loading what is already saved.**
508
- Working files stay in `/tmp/gooseworks-video/<project_id>/` (never the s3fs workspace mount);
509
- the project is the durable copy.
510
-
511
- **Ingredient keys.** Give every planned piece a stable key before you generate it, the same on
512
- every run: `vo/scene-03`, `vo/sample-her`, `still/her-base`, `still/scene-05`,
513
- `clip/scene-05` (a lipsync / video clip), `music/bed`, `endcard`, `captions`, `final`,
514
- `final-thumb`. Upload path = `working/<role>/<file>` (`working/vo/scene-03.mp3`,
515
- `working/clip/scene-05.mp4`); the review set keeps its `working/review/<name>` paths.
516
-
517
- **Input digest.** Name the exact inputs of each generation with `input_digest` from
518
- `media_proxy` (in every media capability's `scripts/` folder):
519
-
520
- ```python
521
- from media_proxy import input_digest
522
- digest = input_digest(model_path, args) # the model + the EXACT payload you send
523
- ```
524
-
525
- Hash only what decides the output (prompt, voice_id, model_id, seed, duration, aspect…). An input
526
- that is a presigned or proxy URL changes every run, so swap it for that input's own identity
527
- before hashing, e.g. `{**args, "image_url": {"ingredient": "still/her-base", "digest": her_digest}}`
528
- — then a changed still correctly invalidates every clip made from it. For a piece you build
529
- locally (ffmpeg stitch, PIL end card, captions) use `input_digest("local/<step>", {params,
530
- inputs: {key: digest, …}})`.
531
-
532
- **1. At the START of every run (first run, resume, new sandbox), load what exists — one call:**
533
- `media_list { brand_id, scope: "video_project", scope_id: project_id, ingredient_key_prefix: "",
534
- limit: 100 }`. It returns ONE compact row per `ingredient_key` (the newest):
535
- `{ id, ingredient_key, input_digest, kind, status, mime, bytes, url, path, created_at }`. Every
536
- status except archived is included. Project-path uploads remain `pending` until
537
- `media_confirm` succeeds. Confirm a pending project-path upload before reusing it; if
538
- confirmation fails, repair the upload before treating it as a verified save.
539
- Page with `cursor` if `next_cursor` is set (keep the first row you see per key — it is the newest). Also read `script_drafts.ingredients` from
540
- `video_project_read`: it records which pieces were already approved in the review.
541
-
542
- **2. For each planned piece:** compute its digest from the args you WOULD send now. If a saved row
543
- has the same `ingredient_key` AND the same `input_digest`, **download it instead of
544
- generating**:
545
-
546
- ```bash
547
- curl -fsSL "$URL" -o /tmp/gooseworks-video/<project_id>/<path> # URL = that row's `url`
548
- ```
549
-
550
- That `url` is a short-lived (~15 min) presigned S3 GET the server signs for you, so it needs no
551
- auth header — download right after listing (list again if it expired). **Never fetch the
552
- `/api/ads/projects/<id>/render-file?path=…` route from the sandbox:** it needs the app's
553
- browser session and answers 401 to a token. Check the file is non-empty and plays (ffprobe for
554
- audio/video, open the image); if the download fails or the file is broken, regenerate the piece.
555
- Only generate what is missing or whose digest changed — a changed digest means the inputs changed,
556
- so the old file is stale.
557
-
558
- **Pass the digest to the proxy too:** `fal_generate(..., input_digest=digest)` (and
559
- `fal_generate_video` / `fal_whisper`). A piece that was generated but never saved (the sandbox
560
- died between the fal result and the upload) is then handed back by the proxy instead of paid for
561
- again, even though its input URLs changed. Only pass `new_take=True` when the user wants a
562
- different take of the same inputs.
563
-
564
- **3. After EACH piece is generated AND passes its own QC, upload it right away** — don't batch
565
- the uploads to the end:
566
- `media_upload { brand_id, scope: "video_project", scope_id: project_id, kind, path:
567
- "working/<role>/<file>", ingredient_key, input_digest, source: { type: "file", filename,
568
- content_type } }` → PUT the bytes to `upload.url` with `upload.required_headers` →
569
- `media_confirm { brand_id, media_id: media.id }`. Require a successful confirmation.
570
- Kind: `audio` (VO), `music`, `image` (a still),
571
- `video` (a clip), `endcard`, `document` (captions / a JSON sidecar), `render` (the master),
572
- `thumbnail`. Re-uploading the same key is fine — the newest wins. A piece that FAILED QC is never
573
- uploaded under its key. **Save a piece's sidecars with it** under `<key>.<name>` — e.g. the VO's
574
- char-level timestamps as `vo/scene-03.timestamps` (`kind: "document"`, same digest). Captions are
575
- built from them; without them a resumed run has to fall back to Whisper timings, which mis-case
576
- brand names.
577
-
578
- **4. Keep the approved review unchanged during production.** Record each confirmed piece's
579
- `media_id`, `path`, `ingredient_key` and `input_digest` locally; the confirmed media rows
580
- and render progress are the durable resume record. Before approval, mirror the draft ingredients
581
- as part of Step 3. After approval, do NOT write `patch.script` or `script_drafts` during any
582
- paid production, QC or repair step, or while provider work is pending. A review-set write clears
583
- approval and can stop the next paid step, including a batch concept. Save the final descriptive
584
- review once all paid work is finished and settled, as Step 4.5 requires.
585
-
586
- Any material creative change or ANY change the user asked for in this chat must stop production:
587
- save the changed complete plan and full credit total, then obtain fresh approval before continuing.
588
- Never reuse the earlier yes for a changed plan. A repair that restores the approved choices can
589
- continue within the existing allowance and Stop guards without rewriting the approved review.
590
-
591
- The `final` master and `final-thumb` poster (Step 4.4) carry `ingredient_key` too, so a
592
- resumed run that finds a passing `final` with the same digest only needs to publish.
593
-
594
- ## Finished video, interrupted saving — resume the same version
595
-
596
- If the final already passed QC and the customer says **"finish saving this video"**, start here.
597
- Do not restart the recipe, choose another format, open another render, generate a take, or run a
598
- paid transcript check again. Saving uses the **same render_id**. The ordinary first-completion
599
- video fee can still apply; its existing same-render idempotency prevents a duplicate fee. Never
600
- promise that all saving is free.
601
-
602
- **Before the first final upload**, save the final review set and production manifest from Step
603
- 4.5/4.6 (including any QC repairs) only after all paid work is finished and settled. Preserve the
604
- approved creative choices; a material change requires the changed-plan approval flow first.
605
- After that final save, start no new provider or render work: prepare the checkpoint and finish
606
- the same opened render using its existing finishing allowance and guards. A released allowance
607
- or stopped/capped render requires normal recovery; never reopen or bypass approval.
608
- Write a durable local checkpoint outside the fetched-scripts cache. Keep the actual
609
- final, JPEG poster, structured passing quality report, and review evidence files alongside it in
610
- a retained local working folder. Record their SHA-256 **at the time those exact bytes pass QC**;
611
- never attach an old verdict to a newly hashed replacement. A sandbox's local disk can disappear:
612
- this checkpoint recovers connection interruptions, not lost storage. Save ingredients remotely
613
- as above and tell the customer if the checked local output is no longer available.
614
-
615
- With the current CLI and its normal login to the selected environment, write a manifest like:
616
-
617
- ```json
618
- {
619
- "brand_id": "<owning brand>", "project_id": "<same project>", "render_id": "<already opened render>",
620
- "input_digest": "<assembly input digest>",
621
- "final_path": "/absolute/retained/working/final.mp4",
622
- "poster_path": "/absolute/retained/working/final-thumb.jpg",
623
- "qc": {
624
- "final_sha256": "<64 lowercase hex characters recorded during final QC>",
625
- "poster_sha256": "<64 lowercase hex characters recorded during poster review>",
626
- "report_path": "/absolute/retained/working/quality-report.json",
627
- "evidence_paths": ["/absolute/retained/working/review/finished-ad.json"]
628
- }
629
- }
630
- ```
631
-
632
- Run `gooseworks video-save prepare --manifest <manifest.json> --checkpoint <retained/save-<render_id>.json>`
633
- before any upload, then `gooseworks video-save resume --checkpoint <same checkpoint>` for both
634
- normal saving and recovery. The helper uses the saved login and canonical MCP connection; it does
635
- not copy credentials or use a raw Ads REST fallback. Its atomic private checkpoint binds the
636
- environment, account, project owner, project/render, final/poster bytes, assembly digest, passing
637
- quality report, review set, evidence files and stage receipts. Preserve it until delivery. Never
638
- edit the checkpoint to clear a failed check. Keep checkpoint and manifest files out of commits.
639
-
640
- The helper reads remote state before writes. It keeps `final` / `final-thumb` ingredient keys
641
- and writes per-render paths `working/final-<render_id>.mp4` / `working/final-<render_id>-thumb.jpg`
642
- so saving this version cannot overwrite an older one. It confirms pending uploads, checks remote
643
- bytes against the QC hashes, and reuses confirmed media. A request with missing stored bytes can
644
- get a fresh upload URL at that same path. A lost completion reply is unknown until project read
645
- confirms the same render's output and passing report; then only final selection remains.
646
-
647
- **No CLI / a host-selected MCP connection:** keep the same protocol with the host's canonical
648
- tools. Atomically write versioned JSON locally (write a private same-directory temporary file,
649
- flush/fsync, rename, then fsync the directory) before any upload and between each upload request,
650
- PUT, confirmation, completion and final selection. Persist only public environment identity,
651
- account/owner/project/render IDs, file paths/sizes/hashes, input digest, exact quality report and
652
- evidence fingerprints, saved-review digest, media IDs and stage states; **no tokens, session IDs,
653
- signed URLs or auth headers**. On reconnect call `account_whoami`,
654
- `video_project_read { brand_id, project_id, include: ["renders"] }` and
655
- `media_list { brand_id, scope: "video_project", scope_id: project_id, ingredient_key, input_digest }`
656
- on the original connection. Compare identities, local/evidence hashes and saved review; verify
657
- confirmed remote bytes too. Treat a lost reply as unknown and read back before retrying. Use only
658
- the missing `media_upload` → PUT → `media_confirm`, same-render `video_render_run { render: … }`
659
- callback and `video_project_upsert` with only `patch.final_render_id` and
660
- `patch.final_selection_guard: { expected_final_render_id, expected_review_digest }`; never a
661
- render-open call. The expected final is the last read's pin, including explicit `null`; the
662
- review digest is SHA-256 of recursively sorted-key JSON
663
- `{script: project.script ?? null, script_drafts: project.script_drafts ?? null}` saved at checkpoint
664
- creation. First confirm the selected server advertises this guard in `tools/list`. If absent,
665
- stop and request the normal server update/reconnect; an unguarded pin is unsafe. A
666
- `final_selection_conflict` means the choice or review changed: keep the checkpoint and explain
667
- that saving stopped without overwriting it. Retain the
668
- strict Step 4.3/4.4 report and Step 4.5 review-set requirements.
669
-
670
- If authorization expired, reconnect/sign in through the normal host/CLI flow on the original
671
- connection, then resume. Missing tools are a reconnect requirement, not permission to switch
672
- environments. Missing/changed files, stale/missing QC, changed account/owner/review, another final
673
- selection, or a stopped/capped/failed/blocked render require diagnosis; do not reopen it or
674
- regenerate automatically. If saving stops, say: **"Your video is finished locally, but saving to
675
- Goose was interrupted."** Link the actual local file and preserve its checkpoint. Claim saved
676
- delivery only after a fresh project read verifies completion and selection of that exact render.
677
-
678
- ## Step 0 — project id, or video BATCH id? (fan out before anything else)
679
-
680
- The handoff is EITHER a single `project <id>` OR a `video batch <id>`. A batch is
681
- the app's "N concepts" flow: one composer submission fans out into **N independent concept projects**
682
- (the user picked a concept count, default 3), and the app expects EACH to be rendered. **Handle both:**
683
-
684
- - **`project <id>`** → you have one project. Treat it as a batch of one and continue to Step 1.
685
- - **`video batch <id>`** → call `video_project_read { brand_id, batch_id }`. It returns every child
686
- concept under `projects[]` — each is a normal project with its own `id`, `variant_index`
687
- (Concept 1..N), and its own `creative_brief` (the per-concept angle/hook/offer/message). **You
688
- MUST process every concept, not just the first** — dropping concepts 2..N is the #1 batch bug.
689
-
690
- **Loop shape (ONE approval for the batch, isolated work per concept):**
691
- 1. Run **Step 1 + Step 1.5 + Step 2 + Step 2.5 + Step 3-assemble** for EACH concept project (each
692
- has its own `project_id`, brief, `GW_PROJECT_ID` and `working/` folder — never cross-write
693
- between concepts). The brand read (Step 1 item 2) and `brand-rules.json` (Step 1.7) are per
694
- BRAND: do them once for the batch and copy the file into each concept's `working/`. The read is
695
- ~90K characters. Step 2.5's angle bank is shared per brand AND product: load or build it once, and
696
- give every concept whose angle is `auto` a DIFFERENT angle from that list, so the batch is N
697
- different ads, not one ad N times.
698
- 2. Mirror EVERY concept's review set (Step 3's `video_project_upsert patch.script` per project),
699
- then stop for **ONE** approval in this chat that covers all concepts. Save each render_estimate.total_credits
700
- (previews + render + the 200 base fee) and the batch total. Widget: one line; text: card.text_summary. Set the batch to `review` (`video_project_upsert
701
- { brand_id, batch_id, patch: { batch: { status: "review" } } }`).
702
- 3. On an explicit yes, record it ONCE for the whole batch: `video_project_upsert { brand_id, batch_id,
703
- patch: { approve: { user_quote: "<their exact words>", total_credits: <the saved total> } } }`. Check its `not_ready` list is
704
- empty (a concept listed there has no saved review set: save it, show it, ask again). If they
705
- approve only some concepts ("1 and 3 are good, redo 2"), record each approved one with its
706
- `project_id` instead, and redo the rest. Then set the batch to `rendering` and run **Step 4 (the expensive render)** for each
707
- concept with up to 8 isolated workers when the machine can sustain them. Retry
708
- concurrency_limit after retry_after_seconds; reduce concurrency on a limited machine. Deliver each (Step 5). When every concept is pinned, set the batch to
709
- `complete`. A concept the Step 4.3 gate leaves `blocked` cannot be pinned (a batch concept
710
- needs `passed`): finish the others, set the batch to `blocked`, and tell the user which
711
- concepts passed and which are blocked, with each one's failing checks.
712
-
713
- If a single concept fails, keep going with the rest, mark that concept blocked, and report which
714
- ones shipped — never abort the whole batch on one bad concept. Everything below (Steps 1–5) is
715
- written per-project; a batch just runs it N times with the shared approval gate above.
716
-
717
- ## Step 1 — resolve the project, source, brand
718
-
719
- 1. `video_project_read { brand_id, project_id }` → keep `brand_id`, `source_sample_id`, `name`,
720
- `status`, the **top-level** `app_url` + `brand_url` (the links you hand the user for the in-app
721
- review in Step 3 and delivery in Step 5), AND the user's **`creative_brief`**, project
722
- **`assets`**, `character_id`, `default_voice_id` — these are the authoritative inputs the user
723
- chose in the composer (see Step 1.5). Do NOT discard them. Then `export GW_PROJECT_ID=<project_id>`.
724
- Keep its saved `campaign_id` and `campaign_concept_id` too. If the customer explicitly
725
- wants to attach this existing video to a known campaign/concept, verify the IDs with the
726
- campaign read and use `video_project_upsert { brand_id, project_id, patch: {
727
- campaign_association: { campaign_id, campaign_concept_id? } } }` as a separate, sole-field
728
- patch. Read back the same project and confirm the saved IDs. Linking never needs a new
729
- project, render, generation call or approval. A conflicting saved link stays intact; explain
730
- it instead of silently moving the video. Leave unlinked legacy videos alone unless asked.
731
-
732
- ### Step 1.5 — the project brief is AUTHORITATIVE (honor it; don't re-ask)
733
-
734
- The composer already collected the user's creative direction onto the project. **Read it and treat
735
- it as ground truth — it OVERRIDES the template recipe's defaults, and it REPLACES the clarifying
736
- questions you would otherwise ask.** For a field the brief leaves empty, use the Brain search's
737
- evidence brief first, then the recipe default, then (last) asking. Map the fields you WILL honor:
738
-
739
- - `creative_brief.productName` / `.offer` / `.angle` → the product, offer/code, and angle. Do
740
- **not** ask "which product / what offer / what angle" if these are set.
741
- - `creative_brief.concept` (on a batch child) → this concept's **`angle` / `hook` / `offer` /
742
- `message` / `note`** — the per-concept differentiator. Honor it verbatim; it's WHY the user asked
743
- for N concepts. `angle: "auto"` or empty means "you choose."
744
- - Project `assets` + `creative_brief.reference_image_urls` → the user's **own reference images**.
745
- Use them as the product/brand refs (alongside the brand kit), don't ignore them for generic recipe
746
- assets.
747
- - `character_id` → the avatar/creator to use. `default_voice_id` → the voice for any VO (put its
748
- NAME in the review `subtitle`). Use these instead of picking your own.
749
- - `creative_brief.durationSeconds` → target length; honor it when the format allows.
750
- `creative_brief.ratio` → video ads are ALWAYS 9:16 (1080×1920). If the brief asks for another
751
- ratio, make 9:16 anyway and say so in the review; never export another size (a recipe's
752
- "also 1:1" option included).
753
- - `polish_policy` (`standard` | `extra`) → `extra` means spend the extra pass on QC/polish.
754
-
755
- 2. Brand gate: `brand_read { brand_id, sections: ["summary", "kit", "products", "learnings"] }`
756
- (older clients: `brand_get_context` with the same sections). Ask for all four: the default
757
- leaves out the kit and the brand's saved rules, and a video made without them is off-brand.
758
- If the kit's `researchStatus` (or the brand's `research_status`) is `complete`, REUSE it —
759
- never re-research. A pending status alone does not require research; use verified stored
760
- facts and ask only for an actual gap. If the context is empty or the customer requests
761
- research, load `catalog_fetch { type: "skill", slug:
762
- "brand-research" }` and follow its stored-pack workflow. Only when that verified pack is
763
- saved in the supported research workspace, finalize with
764
- `brand_update { brand_id, patch: { finalize_research: true } }`, then read the brand back.
765
- Never send raw research JSON through `kit_patch`: the public tool accepts only the existing
766
- `video_lab` asset slot there. If there is no verified stored pack, submit researched facts
767
- through typed `patch.knowledge` / `patch.kit` as pending agent proposals; do not pretend
768
- research is finalized or its proposals are approved. Then do Step 1.7 with verified facts.
769
- 3. For a new plan, `catalog_fetch { type: "template", slug: <source_sample_id> }` → the source
770
- video: `media_url`, `recipe`, `format` (e.g. "podcast-skit", "imessage"),
771
- `extracted_script`, `how_to`, `remix_spec`. For an approved resume, restore the recorded
772
- package and dependencies instead of fetching today's recipe over the saved plan.
773
-
774
- ### Step 1.6 — a remix of a FINISHED video (the project read has a `remix` block)
775
-
776
- A project made from **Community videos** remakes another customer's finished video for THIS brand.
777
- Its `video_project_read` returns a top-level `remix` block
778
- (`{ remix_of_project_id, instruction, direction }`), and `reference_video_url` is that finished video.
779
-
780
- - **Watch the reference video first** (download `reference_video_url`, pull frames + the transcript).
781
- It is the target: match its structure, beat order, pacing, framing, look, voice and tone.
782
- - **`remix.direction` is its approved review set** (scenes and lines, set/look notes, take prompts,
783
- captions, music, voice). Start your review set from it instead of the template's defaults; it
784
- already carries every change that customer made to the template.
785
- - **`remix.direction.implementation`, when present, is HOW it was made**: the pipeline and the model
786
- each step used, the style and negative prompts, the character and per-scene still/motion prompts
787
- with their guards, voice and music settings, the mix, and `fixes` (what went wrong and how it was
788
- fixed). Reuse the same models, style/negative prompts and guards, rewrite the prompts' subjects for
789
- this brand, and apply every `fix` up front so you don't repeat the same mistake.
790
- - **Rewrite everything for THIS brand.** "[source brand]", "[source product]", "[link]", "[email]"
791
- and "[code]" mark the other customer's details: never write them, and never reuse their claims,
792
- numbers, URLs, offers or CTA. Every product, claim, name, image and CTA comes from this brand's
793
- kit, products and media. Their footage (screen recordings, product shots) and their creator face
794
- are NOT carried over: use this brand's own assets and make a new creator from the description.
795
- - Precedence: this project's own `creative_brief` and assets (Step 1.5) > `remix.direction` >
796
- the template recipe's defaults.
797
- - In the Step 3 review, say it is a remix of that video and list what you kept vs. changed.
798
-
799
- ### Step 1.7 — the brand rules file and the brand assets (every run, before any writing)
800
-
801
- Before new writing, write `working/brand-rules.json` from the Step 1 brand read. Preserve an
802
- approved run's saved rules on resume; reconcile an intentional rule change through the existing
803
- review gate. Every later step reads THIS file, not your memory of the chat:
804
-
805
- ```json
806
- {
807
- "name": "Acme",
808
- "pronunciations": [{ "term": "Acme", "say_as": "ak-mee", "learning_id": "…" }],
809
- "must_say": [{ "text": "…", "learning_id": "…" }],
810
- "never_say": [{ "text": "Never claim it cures insomnia", "learning_id": "…" }],
811
- "products": [{ "id": "…", "name": "…", "facts": ["size, flavour, price, ingredients as stored"], "images": ["…"] }],
812
- "logo": { "url": "…", "confidence": "<kit.logoConfidence>" },
813
- "fonts": ["…"],
814
- "palette": ["#…"]
815
- }
816
- ```
817
-
818
- - **Video taste is direction, not dialogue.** Before mapping brand rules, extract entries
819
- prefixed `Video preference:` from both `learnings` and `kit.instructions` into the verified
820
- taste brief, including accepted proposals. They govern pacing, voices, captions, visuals and
821
- format choice; do not copy them into `must_say` / `never_say` or read them aloud. Carry the
822
- brief into the choices, scene planning and review.
823
- - **Sources.** `learnings` are the brand's saved rules (the user's past corrections among them):
824
- `must` / `do` → `must_say`, `dont` → `never_say`, and a `must` whose text reads
825
- `Pronounce "<term>" as "<say_as>"` (straight or curly quotes) → `pronunciations`. Add `kit.instructions` (free-text
826
- standing rules) only when they require actual spoken wording or prohibit a claim. Production
827
- directions stay in the brief. A required spoken line or prohibited claim remains its own
828
- ordinary `must` / `dont` rule.
829
- - **Which product.** The one the brief names (`creative_brief.productName`); with none, the row
830
- whose name matches the product the user asked for, or the brand itself for a one-product
831
- brand. Product lists often hold other brands' items or old ads saved as products: if more than
832
- one row could be it, ask in the choices round. Never mix facts across rows.
833
- - **Product facts** come from that row (name, description, variant, price) and, when the row is
834
- empty, from the kit (`valueProps`, `description`, `tagline`): nothing else. Write them to
835
- `products[].facts`; the script may only state what is there.
836
- - **Logo.** Download the kit's logo FILE (`kit.logoUrl`, else `kit.logos[0]`) to `working/brand/`,
837
- keeping its real extension (an SVG stays `.svg`; rasterise it to a 1024px-wide PNG with
838
- `rsvg-convert` or `cairosvg` when a renderer needs pixels). It is used as-is on every scene and
839
- end card that shows a logo: **never generate, redraw, re-letter or restyle a logo with an image
840
- model.** If the kit's `logoConfidence` says favicon-grade, or the file's long side is under
841
- 256 px (or it is under 40,000 px²), it is a site favicon, not a logo: do not upscale it. Ask the user for a real logo (or offer the brand name
842
- set as text in the brand font) in the SAME question round as the recipe's `choices`.
843
- - **Font.** `kit.typography.heading` when its `source` is `user` (the user chose it), else
844
- `kit.fonts.heading`. Download the font file (the kit's own, or the same family from Google
845
- Fonts) to `working/brand/` and use it for every on-screen line. With no match, use the closest
846
- free font and say so in the review.
847
- - **No wordmark file.** When a recipe wants a wordmark SVG and the kit has only a logo image, set
848
- the brand name as text in the brand font beside the logo file. Never generate one.
849
- - Record in `brand-rules.json` which logo the video will actually composite (`logo.file`), or
850
- `"logo": { "mode": "text" }` when it will show only the brand name set in the brand font.
851
- - **Product images.** Download this product's own images to `working/brand/`. Use only images of
852
- THIS product: never a catalogue image of another product, a mascot, a lifestyle photo of a
853
- person, or a stand-in. If the product has no usable image, ask in the choices round.
854
-
855
- ### Brand corrections stick — save them to the brand the moment they are made
856
-
857
- When the user corrects something about the BRAND in chat — how a name is said, a claim that may
858
- not be made, a product fact, a visual rule ("never use red", "the logo goes top-left") — save it
859
- in the SAME turn, before anything else:
860
-
861
- `brand_update { brand_id, knowledge_intent: "user_correction", user_statement: <the user's exact correction>, patch: { facts: [{ kind, text }] } }`
862
-
863
- | Correction | `kind` | `text` |
864
- |---|---|---|
865
- | Pronunciation | `must` | `Pronounce "Acme" as "ak-mee"` (exactly this form) |
866
- | A claim or word to avoid | `dont` | `Never say or imply: <the claim>` |
867
- | Something that must be said | `must` | `<the rule>` |
868
- | A product fact | `must` | `<product name>: <the fact>` |
869
- | A visual rule | `do` / `dont` | `<the rule>` |
870
-
871
- - If it changes an EXISTING rule (a new pronunciation for the same term), update that rule by id
872
- (`facts: [{ id: <learning_id>, text }]`) instead of adding a second one.
873
- - Use the correction intent and user's statement when supported, as described below. Read
874
- `brand_read` learnings back and verify the rule and source before claiming it was saved.
875
- - Then tell the user in one line: "Saved to your brand for future videos." Update
876
- `working/brand-rules.json` and apply the rule to THIS video too.
877
- - A one-off note about this video ("make it shorter", "use the blue background here") is NOT a
878
- brand rule: don't save it.
879
-
880
- ## Save durable brand answers, then verify them
881
-
882
- Read the selected brand with `brand_read { brand_id, sections: ["summary", "kit", "products", "learnings", "onboarding"] }`
883
- (older clients: `brand_get_context` with the same sections, only when that tool is advertised).
884
- Keep founder answers, user corrections, research and your own hypotheses distinct. Reuse
885
- matching saved answers; ask only about gaps.
886
-
887
- When the user asks to remember a rule, answers a brand interview, or explicitly corrects a
888
- standing fact, save that answer in the same turn. The capture request authorizes those answers;
889
- do not ask for approval again. A direction for this one video stays in its brief. If the scope
890
- is genuinely ambiguous, ask whether it applies to future videos before saving a standing rule.
891
-
892
- Use the **live registered schema**. Where supported, call `brand_update` with
893
- `knowledge_intent: "user_correction"` and `user_statement` containing the user's exact,
894
- verbatim answer, not your paraphrase or researched text.
895
- For an inference or suggested improvement, use `knowledge_intent: "agent_proposal"`. Show the
896
- before/after change from your prior read and proposed value; retain the returned proposal IDs
897
- and say the user must accept it in the app. Link only a review surface actually returned by a
898
- tool; the compact `knowledge_updates` response does not itself contain a diff or URL.
899
- A pending proposal is not a saved fact. Never call an unavailable
900
- tool or silently relabel research or your inference as something the user said.
901
-
902
- The safe structured shape is `patch: { knowledge: { positioning?, audience?, voice?,
903
- instructions?, brandType?, tagline?, valueProps? } }`, using only fields present in the live
904
- schema. Inferred rules/taste go in an `instructions` proposal with a rationale, never in
905
- `patch.facts`. Prefix every video-only preference in that proposed text with "Video preference:"
906
- so it remains production direction after acceptance. Preserve unrelated instructions when
907
- proposing a merged replacement.
908
-
909
- | User answer | Canonical write |
910
- | --- | --- |
911
- | Primary audience, positioning or voice correction | `patch.knowledge: { audience/positioning/voice: <answer> }` (one actual key). During onboarding, `brand_onboarding { action: "review_research", review: { action: "correct", field, value } }` writes these existing corrections with provenance. |
912
- | Founder story, customer pains, objections, buying trigger or useful audience detail without a structured field | `patch.facts: [{ kind: "insight", text }]`; retain attribution such as "Founder reports: …" rather than turn a belief into a verified result. |
913
- | Required wording or pronunciation | `patch.facts: [{ kind: "must", text }]`; pronunciation is exactly `Pronounce "<term>" as "<say_as>"`. |
914
- | Forbidden claim, word or visual | `patch.facts: [{ kind: "dont", text }]`. |
915
- | Durable visual, voice or pacing preference | `patch.facts: [{ kind: "do", text }]` for a preference; `dont` for an avoidance; `template_hint` for a preferred format. Prefix video-only preferences with "Video preference:". |
916
-
917
- Facts are existing `ad_brand_learning` rows with user provenance; they are not a second profile.
918
- Update a matching rule by its returned `id` instead of adding duplicates. Preserve unrelated
919
- rules and the user's exact meaning. Only use the legacy facts shape for explicitly user-authored
920
- answers when the live schema lacks intent fields; agent suggestions still need a proposal path.
921
-
922
- **Claims and plans have separate gates.** A founder assertion or proof point is not an approved,
923
- evidence-backed claim or consent to quote a customer. Use the existing evidence/claims and
924
- operating-plan tools only if registered, following their proposal, evidence and confirmation
925
- requirements. Never encode a spend cap, approver or emergency stop as a learning. If that write
926
- path is missing, report the specific unsaved item and keep it pending for the supported review
927
- surface; do not claim it was saved or create a parallel local profile.
928
-
929
- After every write, **read back before saying saved**: use `brand_read` with `kit`, `learnings`
930
- or `onboarding` as appropriate, or `brand_onboarding { action: "status", brand_id }` after an
931
- onboarding answer. Verify the intended field/rule, its source and the absence of a conflicting
932
- duplicate. A generic success response, pending proposal, ignored key or truncated result is not
933
- proof. Report partial saves honestly. Carry the verified rules into the current task and the
934
- routed skill; claims still pass their own safety gate.
935
-
936
- ## Video taste — reuse examples and preferences
937
-
938
- When asked to capture video taste, or when the user volunteers a durable video preference,
939
- first read the saved learnings and `media_list { brand_id, scope: "brand", scope_id: brand_id,
940
- tags: ["video-taste"], limit: 100 }`. Follow `next_cursor` before deciding an example is absent.
941
- Do not force a taste interview before an unrelated task or ask again for an existing preference.
942
-
943
- Save what the user has already supplied first. Then ask only the missing useful question, for
944
- example: "What do you like about this video—its pace, voice, captions, or look?" An inaccessible
945
- link can still be saved as a link with the user's explanation; do not pretend you watched it.
946
-
947
- - **Direct clip or video file:** register with `media_upload { brand_id, scope: "brand",
948
- scope_id: brand_id, kind: "video", source: { type: "url", url }, tags: ["video-taste", "reference-only"],
949
- metadata: { purpose: "video_taste", source_url: url, provenance: "user", captured_at: <ISO timestamp>,
950
- preference: <the user's explanation> } }`. For a file use the live file/bytes upload flow and
951
- `media_confirm` after a presigned upload. Registration of a URL does not copy or inspect it.
952
- - **Instagram/post/page link:** the same registration with `kind: "document"`; it is a link
953
- bookmark, not downloadable footage or an indexed transcript. Do not fabricate a direct clip URL.
954
- - **Preferences:** save the user's reasons, likes and dislikes through the facts mapping above.
955
- Read and preserve existing facts before updating one. Do not invent `video_preferences` or
956
- new `video_lab` keys; the live kit patch accepts only its documented asset fields.
957
- - **Deduplicate:** reuse a matching returned media row, then `media_update` its title/tags/metadata
958
- if needed; preserve existing metadata and tags. Do not create another row for the same example.
959
- Read back with `media_list` and `brand_read` learnings before claiming it was saved.
960
- Check the returned row belongs to this brand: URL deduplication may return another brand's
961
- existing row. Do not relabel that row or claim success unless the current brand's scoped read
962
- actually returns it. Report an unsaved association if no supported attach path is available.
963
-
964
- Never put third-party taste examples into kit reference images: `kind: "reference"` at brand
965
- scope writes there. The tags and metadata above record purpose and provenance; **they do not
966
- grant or enforce usage rights**. Study the structure, pacing and look only. Never use the example's
967
- footage, face, product, testimonial or claims in a new ad without independently verified permission.
968
-
969
- Read video-only entries prefixed `Video preference:` from both saved learnings and
970
- `kit.instructions`, including accepted proposals. Keep them out of required or forbidden
971
- dialogue. Build a brief from the verified readback: preferred pace, voice, caption treatment, visual style,
972
- formats to favour/avoid, reference links and the user's reasons. Say what is still unknown.
973
- Pass it with the brand rules into the existing video workflow. A one-video request overrides a
974
- default for that project; it does not silently rewrite the brand's standing preference.
975
-
976
- ## Step 2 — read the template's recipe (it carries everything; NO hardcoded format map)
977
-
978
- The ad format is a **template (data) in the ad_sample DB**, not a per-format skill.
979
- `catalog_fetch { type: "template" }` returns the template's `recipe` — a self-contained brief you
980
- read and execute. **Do NOT map `format` to a hardcoded recipe slug** (there is no such table):
981
-
982
- - `recipe.format` — the format label (e.g. `vignette`), for display only.
983
- - `recipe.atoms` — the **capabilities** this template composes (e.g. `create-vo-elevenlabs`,
984
- `create-image-gpt-image-fal`, `render-podcast-skit`, `review-ugc-render`, `watch`). Fetch each
985
- with `catalog_fetch { type: "skill", slug }` (or `gooseworks fetch <name>` when the CLI is
986
- installed) — they are reused across templates.
987
- - `recipe.instructions` — the **playbook** to follow: `instructions.inline` prose, or
988
- `instructions.doc_url` (an S3 markdown doc — fetch it).
989
- - `recipe.config` — every param (prompts, layout, timings, palette, model choices).
990
- - `recipe.inputs` — the brand-asset contract (which product / logo / offer this template needs).
991
- - `recipe.choices` — the creative calls the USER makes (who is on screen, narrator, tone, setting,
992
- art style, music). Ask every unanswered one in ONE round before any paid step, with its options plus
993
- "you pick". Its `reference` is what the demo used: an example, never the default.
994
- - `recipe.assets` — reference material as S3 links (reference render, style guide, example frames) —
995
- fetch as needed.
996
-
997
- Runtime: **read the recipe → fetch each capability in `recipe.atoms` → follow
998
- `recipe.instructions` with `recipe.config` + the brand's bound `inputs`.** The template IS the recipe;
999
- there is no `format → recipe-slug` table and no per-format skill to fetch.
1000
-
1001
- Save each fetched capability's content, scripts + files under `/tmp/gooseworks-scripts/<name>/`
1002
- (layout in "Running in a GooseWorks sandbox"). If a capability is a Node package (a phone-mockup
1003
- renderer), install its documented dependencies in the folder containing its `package.json`,
1004
- and preserve the recorder's documented `NODE_PATH` — local machines only; in a sandbox that
1005
- format stops (no Chromium).
1006
-
1007
- **Selected browser readiness — before ANY paid ingredient:** identify the actual browser script
1008
- from the fetched capability's instructions (including an HTML end-card renderer if used).
1009
- For Node scripts using `require('playwright')` with default `chromium.launch()`, run
1010
- `gooseworks doctor --renderer-script "/absolute/path/to/the/fetched/scripts/record.js"`.
1011
- Substitute the actual script, and keep the same cwd and environment as the render, including
1012
- `NODE_PATH` and `PLAYWRIGHT_BROWSERS_PATH`. It resolves Playwright relative to that script,
1013
- launches and closes Chromium with the default settings and bounded waits, and downloads nothing.
1014
- On failure, stop before spending, show its folder-specific repair and recheck after setup.
1015
- For non-browser formats use `doctor --no-browser` plus their documented runtime checks;
1016
- never combine `--no-browser` with `--renderer-script` or use it to bypass a browser renderer.
1017
-
1018
- **No CLI or CLI without these flags:** run an equivalent free probe in a separate Node process: use
1019
- `require('node:module').createRequire(require('node:path').resolve(actualRendererScript))`
1020
- to load `playwright`; keep the render's cwd, environment and default launch settings. Await
1021
- `chromium.launch({ timeout: 15000 })`, then await `browser.close()` (bound close to 3 seconds).
1022
- Bound the whole process to 20 seconds and stop its own process tree on failure or timeout.
1023
- Report the resolved module path/version and error without credentials. Missing module, executable,
1024
- headless runtime or failed launch is a failed check; a cache folder, executablePath alone or
1025
- another project's browser is not a pass. Other browser packages, Python renderers or custom
1026
- launch settings need the same free launch/close check through their documented runtime and
1027
- actual settings. Do not replace their browser/channel/flags to get a pass. Setup is a separate
1028
- action under existing permissions; this check never silently installs or downloads anything.
1029
-
1030
- > **Migration note:** older phone-mockup formats (`imessage` / `chatgpt` / `apple-notes`) whose DB
1031
- > recipe does not yet carry `atoms` / `instructions` still hold the legacy `recipe.thread` payload;
1032
- > migrate them to this shape (capabilities + instructions in the DB) — do not reintroduce a CLI map.
1033
-
1034
- ## Step 2.5 — plan words and visuals with `write-video-ad-script`
1035
-
1036
- Every video concept gets creative strategy, including silent formats. Fetch
1037
- **`write-video-ad-script`** through the skill catalogue and follow it before assembling
1038
- review ingredients. It reuses or fetches **`ad-angle-miner`**, binds the researched promise
1039
- to this template's full recipe, writes words and visuals together, and checks product
1040
- claims and production fit. Its independent critic is a quality screen, not a forecast
1041
- of ad performance. The existing Step 3 review and approval remain unchanged.
1042
-
1043
- - **Carry the research into the writer.** Pass the brand and exact product, audience,
1044
- objective, offer, CTA, selected template recipe, available assets and the full miner
1045
- bank or its readable workspace pointer. A selected miner idea includes its angle id,
1046
- evidence and proof plan, not only its hook. Reuse the shared video-angle-bank.v1 from
1047
- the brand's video-scripts workspace or this run. Prepare angle-context.json with the
1048
- writer's preparation script with `--brief working/script/creative-brief.json` and use
1049
- its strict rule check before review. First run the fetched writer's free
1050
- `python3 <saved-writer-package>/scripts/verify_handoff.py --package-dir <saved-writer-package> --out working/script/writer-handoff-check.json` check against those
1051
- actual saved prepare/lint scripts. Retain the result and script hashes with the run.
1052
- A provided writer package with a missing checker, failed check or unsupported flag
1053
- is incompatible: stop this handoff and refresh the package on the same connection.
1054
- Never use the provisional agent path after a provided package fails validation.
1055
- Only an actual `not_found` for an optional writer permits the explicit provisional
1056
- agent check below; a required writer remains blocked. Never silently remove the brief,
1057
- strict check or new shape requirement to run an older parser.
1058
- Save the sourced brief in the writer's documented
1059
- shape: exact product/variant, buyer situation, supported mechanism, offer/CTA, constraints,
1060
- delivery intent, source references, locked copy, applicable prior decisions and unknowns.
1061
- New custom/template shapes set `requires_creative_brief: true`; both writer and critic
1062
- receive the same angle-context. Carry that brief revision into the scene/tool plan and
1063
- production manifest; missing evidence stays explicit rather than becoming a claim.
1064
- - **Already decided stays decided.** The user's angle, hook, batch concept, recipe choice
1065
- or remix direction is binding. Preserve the selected angle id. Compare executions or
1066
- hooks inside it; do not reopen the angle choice. An incompatible promise needs a
1067
- supported execution or an explicit format change before production.
1068
- - **The recipe owns the production contract.** Its story mechanism, speakers, timing,
1069
- text limits and visual capabilities win. Inspect the actual recipe and available assets;
1070
- a catalogue card alone cannot establish fit. An impossible essential visual blocks
1071
- the proposal until repaired. Do not force a testimonial into every format.
1072
- - **Research only what is missing.** Fetching the miner does not spend or rerun research.
1073
- Reuse current facts and prior evidence. The Brain search's evidence brief (citations, the
1074
- state of each query and open gaps) is the first source for the brief's source references and
1075
- prior decisions. If paid collection is needed, its permission
1076
- rides in the existing choices round. A new product with no reviews can use verified
1077
- facts and a feasible demo; do not require paid research merely to fill a quote quota.
1078
- - **Choose eligible concepts only.** Take the strongest supported concept and validated
1079
- hook into review, with up to two viable alternatives when the direction is open.
1080
- Do not pad three concepts or select the highest-ranked rejected one. If all fail,
1081
- repair within the brief and recipe before Step 3.
1082
- - **Optional writer not found or unavailable research.** Only when the optional writer
1083
- returns `not_found`, complete an explicit agent check of claim support, recipe limits,
1084
- visual feasibility and hook payoff. Record missing provenance and say in the review when
1085
- research is provisional. A provided incompatible writer or another fetch error stops
1086
- the handoff. Never report a failed check as a pass.
1087
- - **The user's exact lines** remain verbatim; use report-only checks and raise material
1088
- timing, claim or format conflicts without silently rewriting them.
1089
- - **No spoken words.** Still fit the visual promise, reveal, cards and CTA to the silent
1090
- recipe. Skip speech writing and spoken checks, not the strategy step.
1091
- - **Keep private provenance separate.** Store source quotes and links in the research
1092
- workspace; put only a concise strategy explanation in remixable review data.
1093
-
1094
- ## Shared editorial craft inside this template flow
1095
-
1096
- Fetch `video-production-harness` and read its `references/editorial-review.md`,
1097
- `references/specialist-handoff.md` and `references/hook-compatibility.md`, plus the
1098
- review/edit/polish/promote/wrap steps when used. Verify every named file is returned as
1099
- nonempty text before relying on that package. A version/content hash alone cannot establish
1100
- that the required guides were published. Missing guides block new template creative work
1101
- before project writes or paid previews; resolve the package on this same connection. Keep
1102
- an unchanged approved resume on its recorded package and approvals.
1103
- Save the fetched version/content hash with this run's capability records. These supply
1104
- craft and evidence rules inside the template flow; this entry's existing review, paid
1105
- approval, storage and two-repair limit still apply.
1106
- Do not turn a template into a custom project or import the custom host's extra gates.
1107
-
1108
- Before executing a fetched recipe atom, pass the exact brief/script revision, scene/beat IDs,
1109
- timing, selected product/assets/source windows, performance choice and expected output roles.
1110
- Check actual scripts/dependencies and free runtime readiness, then validate returned media
1111
- against that handoff. An interrupted run reuses valid approved media with matching digest;
1112
- a file merely existing does not prove validity. A missing package/required renderer blocks
1113
- that route before paid generation, with a concrete supported alternative for review.
1114
-
1115
- Rough review asks what the cut communicates and whether the proof/payoff serves the hook;
1116
- fine review diagnoses performance, sequence and local execution; final review checks each
1117
- actual export. Save the received message from the cut before comparing with the brief where
1118
- possible. A technically clean incoherent cut returns to script/sequence work; a local caption
1119
- defect gets a local repair. These internal questions share existing review surfaces.
1120
-
1121
- Before a hook change, classify same-promise compatible opening versus new-promise/body recut.
1122
- For example, an automatic report supports “stop copying campaign results”; it does not alone
1123
- prove “know where to spend the next dollar.” Propose required script/body/coverage changes for
1124
- the latter. Every restyled opening gets fresh image/action/audio/text review even when words
1125
- are unchanged. Fetch the existing `render-hook-replacement` before selecting that route;
1126
- a not-found/empty result stops it before generation. Use its actual preflight and preservation
1127
- checks when available; never build a duplicate renderer or infer publication from source.
1128
- Compare complete labeled candidates, retain source/body/ending and record the hypothesis.
1129
- No quality score or recommendation is an observed performance winner.
1130
-
1131
- ## Step 3 — assemble the review set, then get ONE approval (before the expensive render)
1132
-
1133
- This is a **review-once** flow: save the whole review set to the project, get ONE approval in this
1134
- chat, then run the
1135
- expensive render + any remaining paid work end-to-end. Never spend on the expensive render before
1136
- approval, and don't drip pieces out one at a time and re-pause.
1137
-
1138
- **What goes in the review — show the REAL cheap pieces, PROMPT only the expensive render.** Split
1139
- every piece three ways by cost, NOT just "free vs paid":
1140
- - **FREE** (an iMessage / Apple-Notes HTML mockup, a text/CTA line — rendered locally, no proxy
1141
- call) → generate NOW and mirror the real asset.
1142
- - **CHEAP paid** — a single still/image, the creator/avatar frame, the end card, a short voiceover
1143
- or music bed (each costs cents → roughly **≤ 100 credits**) → **generate these NOW too** and
1144
- mirror the real asset. The few credits buy a real review: the user SEES the actual creator face
1145
- and end card and HEARS the VO, instead of judging a prompt. **This OVERRIDES any recipe rule that
1146
- says to gate ALL paid calls** — only the expensive render below is gated.
1147
- - **EXPENSIVE paid** — the video take / final AI render / per-line lipsync clips (hundreds of
1148
- credits) → do NOT generate. Put its **exact prompt/spec** (+ ref image URLs) in the tile. This is
1149
- the ONE thing approved as a prompt (you can't preview a hundreds-of-credits video for free); it's
1150
- generated only in Step 4.
1151
-
1152
- **The expensive render's exact prompt must be in the panel BEFORE you ask for approval** — so a
1153
- single "go" runs it (plus any remaining paid work) without re-pausing mid-run.
1154
-
1155
- **Show every cost in CREDITS, never dollars.** 1 credit = $0.01 and media generations bill at
1156
- provider-cost × 1.2, so **credits ≈ round-up(provider-$ × 120)** per generation, plus a flat
1157
- **200-credit base per video**. Convert any $ figures to credits and show ONLY credits to the user —
1158
- never print a "$…" amount.
1159
-
1160
- **Never assemble/stitch the finished video for review.** The review is of the individual pieces (or
1161
- their prompts) — never a "full cascade" / "approved cut" clip. Building the whole video before
1162
- approval defeats the gate (the user opens the review to an already-finished video) and wastes the
1163
- render (GOOSE-2542). The full video is assembled ONLY in Step 4, after approval. A `video`
1164
- ingredient here is only a genuinely separate SOURCE clip the format needs (e.g. supplied b-roll).
1165
-
1166
- 1. **Assemble every piece the format needs — not just the script.** Read the recipe for the exact
1167
- list. For a podcast skit that's the **script** (both hosts' lines), the two **host stills**,
1168
- one **voice sample per host**, and the **end card**; an iMessage video has the bubble thread,
1169
- the conversation image(s) and the end card. For each piece, decide FREE / CHEAP-paid /
1170
- EXPENSIVE-paid (above):
1171
- - **FREE or CHEAP paid** (≤ ~100 credits) → generate it now and upload it with
1172
- `media_upload { brand_id, scope: "video_project", scope_id: project_id, kind, path:
1173
- "working/review/<name>", ingredient_key, input_digest, source: { type: "file", filename:
1174
- "<name>", content_type } }` → PUT → `media_confirm { brand_id, media_id: media.id }`;
1175
- after confirmation succeeds, set that
1176
- piece's `path` (+ `media_id`, `ingredient_key`) in `script_drafts` to the project-relative
1177
- `working/review/<name>`. First check "Save as you go" — a piece already saved with the same
1178
- digest is downloaded, not regenerated.
1179
- - **EXPENSIVE paid** → do NOT generate. Put the **exact prompt/spec** (and any ref image URLs)
1180
- in the tile's `text` / `subtitle` so the user reviews what will be spent on. No `path` yet —
1181
- it's generated in Step 4.
1182
- Save **render_estimate.total_credits**: previews already spent + pending render + the 200 base fee.
1183
- Use current server pricing, never a catalog range in place of the full total.
1184
- **Brand check of the script, before it goes in the panel:** every line, caption and on-screen
1185
- text is checked against `working/brand-rules.json`. Nothing in `never_say` appears, in words or
1186
- in meaning (a paraphrase of a banned claim is still banned). Every product detail (name,
1187
- flavour, size, price, ingredient, result) comes from `products[]` or the kit: anything else is
1188
- cut, not invented. Add a `note` ingredient labelled "Brand rules applied" that lists the
1189
- pronunciations used and the rules the script respects, so the user sees them.
1190
- **Answer clarifying questions
1191
- from the project brief FIRST (Step 1.5)** — only ask the user for a field (angle, which product,
1192
- offer/code) the `creative_brief` leaves empty AND the recipe can't default. Do not re-ask for
1193
- anything the composer already captured.
1194
- 2. **Mirror the whole ingredient set for review** — `video_project_upsert { brand_id, project_id,
1195
- patch: { script: { script_drafts, script } } }`. `script_drafts` is a structured payload of
1196
- **container-tagged ingredients** so the app renders each piece the right way:
1197
- `{ format, scenes?, ingredients: [{ container, label, subtitle?, path?, url?, text? }], render_estimate? }`.
1198
- Each ingredient's `container` tells the app HOW to show it:
1199
- - `image` (a frame shown in the video), `endcard` (the end card), `avatar` (a character
1200
- headshot), `background` → rendered as an image tile.
1201
- - `voice` (a voiceover clip — put the voice NAME in `subtitle`), `music` (the bed),
1202
- `audio` → rendered as an audio player.
1203
- - `video` (a clip) → a video player. `text` (a copy line like the CTA) → a text tile.
1204
- - `script` / `thread` / `note` / `conversation` → the written script (or set `scenes[]`
1205
- for the podcast shape, or pass the readable `script` string).
1206
- **Label every ingredient** ("Hook image", "End card", "Voiceover", "Host A", "HER"). The upsert
1207
- writes no render and costs no credits — it just populates the review panel.
1208
- 3. **STOP for ONE approval, in this chat.** Only a complete current saved review set with
1209
- render_estimate.total_credits can be approved. Widget: one line, no duplicate plan or app
1210
- link; otherwise print card.text_summary. The choices are Approve, Change and Not now.
1211
- “Not now” keeps the plan. In a coworker sandbox end the turn after saving the review set;
1212
- the customer's approval arrives as the next message.
1213
- Record the explicit yes with `video_project_upsert { brand_id, project_id, patch: { approve:
1214
- { user_quote: "<their exact words>", total_credits: <the saved total> } } }` before rendering.
1215
- A single project requires recorded approval too; never treat an absent approval as permission.
1216
- Changes require an updated saved review, clearing prior approval, and approval of the new
1217
- total. One yes authorizes the remaining approved chain. On insufficient_balance start
1218
- nothing; offer a shorter video or top-up. Remove batch concepts with patch.concepts remove:true,
1219
- then show the changed total before approval.
1220
-
1221
- ## Step 4 — render, report stages, publish
1222
-
1223
- 1. **Open the render row FIRST** — right after recording the Step 3 approval, before any paid
1224
- generation (if this returns `approval_required`, the approval is missing or was cleared: go
1225
- back to Step 3 and ask in this chat, don't retry):
1226
- `video_render_run { brand_id, project_id, kind: "full" }` (no `dry_run`; returns
1227
- `render_id`) → keep `render_id`, then mark it running:
1228
- `video_render_run { brand_id, project_id, render: { render_id, status: "running",
1229
- workflow_stage: "preparing", progress_note: "starting", progress_percent: 5 } }`. The user sees this
1230
- live in the app and gets a WhatsApp "started" message automatically — don't message them yourself
1231
- about start / blocked / complete.
1232
- After EVERY progress callback inspect stop. If true, start no new paid step; record
1233
- status:"stopped" with a plain note and report what is kept and credits used. SPEND_CAP_REACHED
1234
- stops the same way. Never raise a video's budget on your own judgment. Raise it only when a paid
1235
- step was refused with SPEND_CAP_REACHED or the progress card offers "Finish it" or a choice past the budget.
1236
- Then read the project and say cost.raise_quote in one line: "Finishing needs up to <by_credits>
1237
- more credits, so your budget goes from <from_credits> to <to_credits>. OK?" Only after the
1238
- customer's yes to that number: patch.approve { scope:"raise_cap", total_credits: <to_credits>,
1239
- user_quote: "<their exact words>" }. total_credits is the new budget itself, never credits to
1240
- add; do not send raise_cap_credits for one video. If they pick a smaller choice past the
1241
- budget, send that choice's new budget as total_credits (never above to_credits). Sending the same
1242
- total_credits again changes nothing (already_raised: carry on). An earlier yes, or "I don't care
1243
- about the cost", is not approval of a new budget. If cost.raise_quote is null because the plan was saved
1244
- again since its approval (plan_status is not "approved"), show the plan with its total and
1245
- approve it again; otherwise the approved budget already covers the work: carry on, do not ask.
1246
- After a raise, open a new render that reuses the saved pieces. A refused raise changes nothing:
1247
- cap_raise_not_needed means carry on within the budget, or, when it says the plan was saved again,
1248
- show the plan with its total and approve the plan again; cap_raise_total_required means read the
1249
- project again and send total_credits equal to cost.raise_quote.to_credits after the customer
1250
- approves that number; cap_raise_changed or cap_raise_too_large mean read the project again and
1251
- show the current cost.raise_quote. Custom videos never use raise_cap.
1252
- Send render.steps with the same neutral names each time and a live count only in the
1253
- current detail; use render.choices when blocked.
1254
- 2. Now generate every PAID piece you showed as a prompt in Step 3 — the AI stills/video, lipsync
1255
- clips, voice, music — through the media proxies (below), each from its approved prompt, with
1256
- `GW_PROJECT_ID` exported. **Save as you go** (section above): skip any piece already saved
1257
- with the same `input_digest` (download it), and upload each new piece with its
1258
- `ingredient_key` + `input_digest` the moment it passes QC.
1259
- Keep the approved script and review unchanged throughout production and QC; confirmed media
1260
- and progress preserve resume state. Stop and replan/reapprove any material creative change.
1261
- A voiceover made with `data_post_provider` (ElevenLabs `…/with-timestamps`) returns its
1262
- `alignment` only in the reply: write it to `working/vo/<scene>.timestamps.json` at once
1263
- (captions are timed from it) and record the returned `media_id` on the ingredient.
1264
- **Brand pronunciations in every voiceover:** the text sent to the voice has each
1265
- `pronunciations[].term` replaced by its `say_as` (`create-vo-elevenlabs`:
1266
- `gen_vo.py … --rules working/brand-rules.json`; when a render atom calls the voice itself,
1267
- swap the terms in the text you hand it). Captions, on-screen text and the review keep the
1268
- written name. Write `working/approved-script.txt` (the Step 4.3 audio check) with the SPOKEN
1269
- form. **Logo, font, product:** every logo is the file from Step 1.7 composited as-is; every
1270
- product shot uses the Step 1.7 product images as its reference.
1271
- Then assemble per the recipe (ffmpeg stitch; PIL captions / end card;
1272
- Playwright record only where the format needs it and the host has Chromium → `mix-master` audio).
1273
- **Report progress at each milestone** — about one update per milestone, never per poll:
1274
- `video_render_run { brand_id, project_id, render: { render_id, status: "running", workflow_stage, progress_note, progress_percent } }`
1275
- (`progress_note` = plain words the customer reads in the app, ≤200 chars; no model, tool or
1276
- step names):
1277
- - voiceovers done → `"preparing"`, `"voices recorded"`, 20
1278
- - stills done → `"preparing"`, `"scenes designed"`, 35
1279
- - each lipsync / video clip → `"rendering"`, e.g. `"filming scene 5 of 8"`, 35–75
1280
- - assembly → `"rendering"`, `"putting the video together"`, 85
1281
- - QC (4.3) → `"final check"`, 95
1282
- **Hard stop that needs the user** → `{ render_id, status: "running", workflow_stage: "blocked",
1283
- error_message: "<what's wrong + what you need>" }`; an unrecoverable failure → `status: "failed"`
1284
- + `error_message`. Completing (4.4) sets the bar to 100.
1285
- 3. **MANDATORY final-video QC gate — YOU review EVERY finished master before pinning it
1286
- (`patch.final_render_id`), whatever the format (UGC or not).** This is your own automated quality
1287
- check, separate from the user's Step-3 approval — it does not go back to the user. The render row
1288
- is already open (4.1); this gate stands between a rendered master and PINNING/publishing it, so a
1289
- bad render never gets set as final. A master that looks fine on a still can still have a
1290
- mis-voiced word, a caption drifting off its line, a beat out of order, or a deformation — review
1291
- the actual VIDEO, not stills. Run the passes that APPLY to this format:
1292
- - **Audio ↔ script** — any master with SPEECH (VO or native/Seedance voice); **skip for
1293
- music-only / no-speech formats.** `review-ugc-render` is format-agnostic despite the name —
1294
- a deterministic Whisper transcript-vs-script diff: persist the approved spoken lines to
1295
- `working/approved-script.txt`, fetch `review-ugc-render` (`catalog_fetch`) and run
1296
- `review_render.py --video <master>.mp4 --script-file working/approved-script.txt --json
1297
- working/review-verdict.json` (exit 0 PASS / 2 FAIL / 3 ERROR). For each brand pronunciation add
1298
- `--brand-term "<term>"`, plus `--brand-term` for each word of `say_as` that is not an
1299
- everyday word (the flag strips those tokens from the WHOLE diff, so never pass "a", "one",
1300
- "works" alone): Whisper spells a respelled name back as the brand word ("Goose Works" heard
1301
- as "Gooseworks"), so the diff must accept it. The proof of
1302
- intended delivery is the text/settings you sent (keep them in the review); actual
1303
- pronunciation/performance requires isolated and mixed-audio listening at normal speed.
1304
- Preserve pauses/emphasis and final consonants; never mandate faster or louder delivery.
1305
- Verify a transcript mismatch against the actual audio before calling it a defect. It flags a mis-voiced word
1306
- (approved "human-vetted" → "human witted"), a dropped phrase, or silence. It routes Whisper
1307
- through the gooseworks proxy when `OPENAI_BASE_URL` is set (sandbox:
1308
- `$GW_WHISPER_PROXY_URL/v1`); with no backend at all, run `fal-ai/whisper` via the FAL proxy
1309
- and diff the transcript yourself.
1310
- - **Captions / subtitles** — ANY captioned format (the most common non-UGC defect); **skip for
1311
- UGC/Seedance masters, which carry no subtitle track.** Diff the caption file you burned
1312
- (SRT/ASS/PNG cue list) against the SAME Whisper transcript + word timings — every caption line
1313
- must match the heard/scripted words and sit within ~0.3s of when they're spoken; then in the
1314
- visual pass below, inspect each cue and its start/end boundaries in actual frames, plus
1315
- full-speed playback at destination size, to confirm reading time, product visibility,
1316
- hierarchy and no duplicate overlay or end-card collision. Silent/text-led formats use
1317
- approved visible wording and reading windows, not nonexistent speech timings. Mismatched text or >0.3s drift fails the gate.
1318
- - **Visual + structure** — always: run the `watch` skill on the master — beat/scene order + SFX,
1319
- the brand's product (not the source's) is shown, the end card has the brand's logo file (or its name set in the brand font) + code, no
1320
- deformation/artifact, duration within ~20% of the source.
1321
- - **Finished ad + brand fidelity** — always: fetch `review-finished-ad` (`catalog_fetch`,
1322
- `pip install --quiet numpy pillow` if needed) and run
1323
- `review_finished_ad.py --video <master>.mp4 --json working/review/finished-ad.json
1324
- --sheet working/review/finished-ad-sheet.png --logo <the logo file the video composites>
1325
- --palette "<kit palette, comma-separated>" --product-images <the Step 1.7 images>
1326
- --font <brand font file> --brand-name "<name>" --endcard-s <end card length>`. Pass the
1327
- file that is ACTUALLY on screen (the kit logo, or the recipe's wordmark file). When the video
1328
- shows only the brand name as text (`"logo": {"mode": "text"}`), omit `--logo` and judge the
1329
- text on the sheet. Add `--no-speech` for a format with no VO or dialogue, `--logo-at <s>` for
1330
- each mid-video logo, and any gate flags the recipe's instructions name (a chat format's
1331
- reading holds need a longer `--max-freeze-s`). Exit 0 PASS / 2 FAIL / 3 ERROR. It
1332
- checks size, hook, pacing, dead air, black frames, the kit logo on the end card
1333
- (a wrong, redrawn or favicon logo fails) and the palette. **Then open the sheet it writes
1334
- and judge every line of its `judge_on_sheet`:** captions/CTA/logo outside the red safe
1335
- zones, the brand font, every product shot matching the product images, the product the same
1336
- in every scene, the logo unaltered. A failed eye check is a FAIL like any other.
1337
- - **Output size** — always **1080×1920 (9:16)**. Video ads are only ever 9:16. Lipsync / video
1338
- models often return 720p or odd sizes — scale (and pad if the aspect differs) every clip to
1339
- 1080×1920 BEFORE the concat, never ship the model's native size.
1340
- Save exact output checksum/version, first-to-last normal-speed playback and full-audio
1341
- coverage. Frame sheets, transcripts and process success do not substitute for listening or
1342
- continuous motion. Missing required capability leaves review incomplete/blocked. Each
1343
- supported crop, duration, language or caption derivative needs its own actual-file review;
1344
- unsupported destination requirements need a reviewed route, never a silent export change.
1345
- Honor intended silence, loops and endings rather than forcing music or fades on every ad.
1346
- If ANY applicable pass fails, FIX it (regenerate/stitch the offending window, re-composite the
1347
- end card from the real logo file, rebuild captions) and re-run the passes — only a clean pass
1348
- proceeds to pinning. **At most 2 repair rounds.** If a pass still fails after them, do NOT pin
1349
- and do NOT present the video as finished: upload it (4.4) and close the row with exactly
1350
- `video_render_run { brand_id, project_id, render: { render_id, status: "complete",
1351
- workflow_stage: "blocked", quality_status: "blocked", repair_pass_count: 2, output_url,
1352
- thumbnail_url, quality_report } }` (the failing checks as `fail` in the report), and tell the user plainly in
1353
- chat which checks failed, what you tried, and the choices (fix a specific thing, re-roll, or
1354
- use it anyway). Pin it only if they say to use it anyway. The app shows a blocked render as
1355
- "Needs attention". **This gate is universal: it runs from this skill for every format, so a
1356
- recipe never has to opt in.**
1357
- 4. **For a passing final, create the finished-video checkpoint first**, following "Finished video, interrupted saving"
1358
- above. With the CLI, use its prepare/resume flow instead of duplicating the writes below; it
1359
- saves the same already-opened render and pins only the checked output. Save the final review set
1360
- and production manifest (Step 4.5/4.6) before preparing that checkpoint. Without it, follow the
1361
- same durable protocol. A blocked version follows Step 4.3's existing upload/report-only path;
1362
- never route it through the passing-final helper or pin it automatically.
1363
- Publish: `media_upload { brand_id, scope: "video_project", scope_id: project_id, kind: "render",
1364
- path: "working/final.mp4", ingredient_key: "final", input_digest, source: { type: "file", filename: "final.mp4", content_type:
1365
- "video/mp4" } }` → PUT the master to `upload.url` with `upload.required_headers` →
1366
- `media_confirm { brand_id, media_id: media.id }`. Same for the poster (`kind: "thumbnail"`, `path: "working/final-thumb.jpg"`, `ingredient_key: "final-thumb"`).
1367
- Keep each `upload.render_file_url`. Verify the PUT returned 2xx and the file you uploaded is a
1368
- real, non-empty MP4 (ffprobe it), and require both confirmations to succeed BEFORE marking
1369
- the render complete.
1370
- Then `video_render_run { brand_id, project_id, render: { render_id, status: "complete", output_url, thumbnail_url } }` (attach the Step 4.3 verdict as `quality_status: "passed"` (or
1371
- `"blocked"` when the gate still fails after 2 repair rounds) + `quality_report` — ALWAYS
1372
- attach it; a batch concept cannot complete without a passing one; exact shape, strict (no extra keys):
1373
- `{ version: 1, summary: string, checks: { source, brand, product, hook_and_scene_order,
1374
- voice_and_script, captions, endcard_and_cta, duration_and_ratio, visual_artifacts }, detected_issues?:
1375
- string[], repair_actions?: string[] }` where EVERY check is `{ status: "pass"|"fail"|"not_applicable",
1376
- note?: string }`). Fill each check from the Step 4.3 passes: `brand` ← logo_asset + logo +
1377
- palette + font + logo unaltered; `product` ← product likeness + product consistency;
1378
- `hook_and_scene_order` ← hook + pacing + the `watch` beat order; `voice_and_script` ← the
1379
- Whisper diff (pronunciations included) + no `never_say` line; `captions` ← the caption diff +
1380
- safe zones; `duration_and_ratio` ← ratio + duration; `visual_artifacts` ← black frames +
1381
- frozen stretches + the `watch` pass; `endcard_and_cta` ← the end card holds the real logo +
1382
- CTA. Put each failing check's note in `detected_issues` and each fix in `repair_actions`.
1383
- **output_url MUST be the durable render-file URL**
1384
- (`upload.render_file_url`, i.e. `/api/ads/projects/<project_id>/render-file?path=working/final.mp4`
1385
- — the app re-presigns it on every view) — NEVER a raw proxy/CDN/presigned URL (those expire).
1386
- Same for `thumbnail_url`.
1387
- 5. **Save the final review set BEFORE pinning** — it must describe the video you actually rendered.
1388
- Only after all paid production, QC, repairs and pending provider work are finished and settled,
1389
- save one final descriptive/provenance update: confirmed pieces, exact settings and repairs that
1390
- preserve the approved creative choices. Material creative changes, including changed lines,
1391
- look, timing, captions or music, require a changed complete plan, total and fresh approval BEFORE
1392
- the changed production. Never relabel a changed plan as provenance or silently reuse approval.
1393
- In the checkpoint flow, save the final review before Step 4.4; do not rewrite it afterward merely
1394
- to follow the numbered order. Resume checks that this reviewed set stayed unchanged.
1395
- When final provenance needs updating, upsert the review set once:
1396
- `video_project_upsert { brand_id, project_id, patch: { script: {
1397
- script_drafts, script } } }` with the final lines, final pieces (mark generated takes as done, not
1398
- "not generated yet") and the settings you used. The project keeps this, not your chat: it is
1399
- what the app shows, and what a Community remix of this video copies. Instructions that live only
1400
- in this conversation are lost when it ends. **Keep the approved detail**: never shorten a piece to a
1401
- summary (e.g. per-scene prompts or their "no shake / no letterbox" guards). Only update what changed.
1402
- After this write, do not start new paid work. Save the production manifest, prepare the final
1403
- checkpoint and complete the same render with its existing finishing allowance and guards.
1404
- 6. **Save the production manifest** — HOW you made it, so the next run (or a remix) starts from what
1405
- worked instead of rediscovering it: `video_project_upsert { brand_id, project_id, patch: { production:
1406
- { version: 1, pipeline: [{ step, model, purpose?, settings? }], style: { prompt, negative, notes? },
1407
- characters: [{ name, prompt }], scenes: [{ id, line, still_prompt, motion_prompt, duration_s }],
1408
- voice: { voice_id, name, model, settings }, music: { prompt, model, length_s }, assembly: { … },
1409
- fixes: [{ problem, fix }], notes? } } }`. Use the exact models and prompts you sent (full text, guards
1410
- included), and list every fix you had to make (e.g. "VO ran 47s → tightened four lines, voice 1.08x";
1411
- "hair drifted → restated the hair colour"). No URLs, keys or raw logs; it must stay under 48 KB.
1412
- In the checkpoint flow, save this before Step 4.4 too and skip the duplicate write afterward.
1413
- 7. Pin it — only a `passed` render (or a `blocked` one the user said to use anyway):
1414
- If checkpoint recovery already verified selection of this render, skip this duplicate write.
1415
- An unfinished checkpoint must use the guarded selection protocol above; never replace it
1416
- with an unguarded pin.
1417
- `video_project_upsert { brand_id, project_id, patch: { final_render_id: render_id } }`,
1418
- then use the returned card: widget hosts get one line and no duplicate links; text hosts get
1419
- card.text_summary and the returned delivery links verbatim. Never end with a local file path.
1420
-
1421
- Narrate each long step in one line via `video_project_upsert { brand_id, project_id, patch:
1422
- { message: { role: "agent", content } } }` — never sit silent on a queue > 90s. Write it for the
1423
- customer ("Filming the scenes, about 5 more minutes"), per "How to talk to the customer" above.
1424
-
1425
- ## Media generation — the GooseWorks proxies (queue loop)
1426
-
1427
- Media APIs go through GooseWorks proxies; do NOT use an SDK's default host (your token isn't a
1428
- FAL/ElevenLabs token → 401, and in a sandbox a raw provider call is never allowed). Prefer the
1429
- atoms' own `media_proxy.py` (`fal_generate`, `fal_generate_video`, `eleven_music`, …) — it already
1430
- handles auth, the queue host-swap, project attribution (`GW_PROJECT_ID`) and failure logging.
1431
-
1432
- - **Sandbox:** FAL base = `$GW_FAL_PROXY_URL`, ElevenLabs = `$GW_ELEVENLABS_PROXY_URL`, FAL
1433
- storage = `$GW_FAL_STORAGE_PROXY_URL`; auth = `?token=$GW_MEDIA_PROXY_TOKEN` (or
1434
- `Authorization: Bearer`), plus `&project_id=$GW_PROJECT_ID`. The token already names the agent.
1435
- - **Local:** base = `<api_base>/api/internal/<proxy>` (`fal-proxy`, `fal-storage-proxy`,
1436
- `elevenlabs-proxy`); pass `?token=<api_key>&agent_id=<agent_id>&project_id=<project_id>`
1437
- (agent_id bills the Ads agent; project_id attributes the spend to this ad project so the user
1438
- sees per-project spend in the app. ALWAYS pass it).
1439
-
1440
- **FAL queue gotcha** (#1 waste of generations): submit returns `status_url`/`response_url` on
1441
- `queue.fal.run` (the real host, not the proxy). Polling those 401s forever — rewrite their host
1442
- to the proxy base (keep the path), re-add the auth params. Only the final `*.fal.media`
1443
- file is a real public URL. Helper (works in both modes):
1444
-
1445
- ```python
1446
- import json, os, pathlib, time, requests
1447
- from urllib.parse import urlparse
1448
-
1449
- def _cfg():
1450
- """(fal_base, token, agent_id). Sandbox env first, then ~/.gooseworks/credentials.json."""
1451
- tok = os.environ.get("GW_MEDIA_PROXY_TOKEN")
1452
- if tok:
1453
- base = os.environ.get("GW_FAL_PROXY_URL") or os.environ["GW_API_BASE"].rstrip("/") + "/api/internal/fal-proxy"
1454
- return base.rstrip("/"), tok, None
1455
- c = json.loads(pathlib.Path(os.path.expanduser("~/.gooseworks/credentials.json")).read_text())
1456
- return c["api_base"].rstrip("/") + "/api/internal/fal-proxy", c["api_key"], c.get("agent_id")
1457
-
1458
- def _params(tok, agent):
1459
- p = {"token": tok}
1460
- if agent: p["agent_id"] = agent
1461
- pid = os.environ.get("GW_PROJECT_ID")
1462
- if pid: p["project_id"] = pid # attributes the spend to this ad project
1463
- return p
1464
-
1465
- def fal_generate(model_path, payload, timeout_s=180, poll_s=3):
1466
- """model_path e.g. 'fal-ai/nano-banana-2/edit' (the recipe names the model).
1467
- Export GW_PROJECT_ID first. Returns the result image URL (a public *.fal.media URL)."""
1468
- base, tok, agent = _cfg()
1469
- sub = requests.post(f"{base}/{model_path}", params=_params(tok, agent), json=payload).json()
1470
- to_proxy = lambda u: base + urlparse(u).path
1471
- status_url, response_url = to_proxy(sub["status_url"]), to_proxy(sub["response_url"])
1472
- deadline = time.time() + timeout_s
1473
- while time.time() < deadline:
1474
- st = requests.get(status_url, params=_params(tok, agent)).json()
1475
- if st.get("status") == "COMPLETED":
1476
- return requests.get(response_url, params=_params(tok, agent)).json()["images"][0]["url"]
1477
- if st.get("status") in ("FAILED", "ERROR"):
1478
- raise RuntimeError(f"FAL failed: {st}")
1479
- time.sleep(poll_s)
1480
- raise TimeoutError("FAL polling exceeded timeout")
1481
- ```
1482
-
1483
- ElevenLabs (VO / music) is the same shape against the ElevenLabs proxy base. To feed FAL a local
1484
- file (a product image, a VO track), it must be a PUBLIC URL: upload it with `media_upload`
1485
- (`scope: "video_project"`, source `file`, no `path`) → PUT → `media_confirm` and use the returned
1486
- `media.url` if it is a public https URL (curl it: HTTP 200 without auth), or host it through the
1487
- FAL storage proxy. Never pass a `render-file` URL to a provider — it needs app auth.
1488
-
1489
- ## Follow-up actions use the watched version
1490
-
1491
- Keep original note text, exact source render/time and intended viewer effect. Record an
1492
- acceptance condition and disposition in existing feedback/project artifacts; applying a
1493
- command means changed, not verified. Consolidate duplicates without deleting their source
1494
- IDs. Conflicting “calmer” and “more urgent” instructions need the authorized decision owner's
1495
- recorded choice, even if they touch different files. Offer concrete cheap alternatives for
1496
- “more premium” inside the approved scope before escalating taste.
1497
-
1498
- Map changed copy/performance/shot/pause to affected picture, timings, captions, music/SFX,
1499
- approvals and derivatives; preserve unrelated approved work. Rewatch the full candidate and
1500
- verify the original effect before resolving a note. Accepted final, candidate and original
1501
- note source remain distinct across selection and rollback. Keep editable script/timeline,
1502
- source assets/takes, stems, captions, package versions and prior decisions in the existing
1503
- production manifest/history; retrieve applicable rejections/pronunciation/delivery rules
1504
- before a related brief. Project taste is not a standing brand rule. Record audience results
1505
- only with actual variant/audience/placement/objective/window; otherwise unavailable.
1506
-
1507
- - “Fix this”: use the render/project context attached to the message (or named version, else
1508
- the final one). Save patch.fix { of_render_id, changes, total_credits }. Never replace a supplied
1509
- watched render with the final. After explicit approval save patch.approve { user_quote,
1510
- total_credits, scope:"fix" }, then video_render_run { kind:"partial", fix_of_render_id }.
1511
- Re-make only changed scenes, keep earlier versions and charge no second base fee.
1512
- - “Make 3 more like this”: video_project_upsert { brand_id, name, remix_of_project_id,
1513
- remix_of_render_id, vary, concepts:3 }. Preserve a provided watched render; omit only when none is named.
1514
- - “Test 1 of each”: approve only:"test"; “Make the other N”: only:"rest". “Stop the rest”:
1515
- job_cancel { job_id:<batch_id> }. Finished videos stay saved.
1516
- - Share for review uses patch.share_for_review { subject }; return the real link.
1517
-
1518
- ## Rules
1519
-
1520
- - **Canonical MCP tools first** (`video_project_read`, `video_project_upsert`, `catalog_fetch`,
1521
- `media_upload` + `media_confirm`, the `video_render_run` render-row actions, `account_whoami`);
1522
- legacy names only when the client lacks the canonical tool.
1523
- - **A missing key is never a blocker.** Paid media goes through the proxy: a one-off image or clip
1524
- is `data_post_provider { provider: "fal", … }` + `job_get` (see "Paid media over the MCP");
1525
- never ask for FAL_KEY, never use `photos_generate` for anything but a physical product.
1526
- - **The CLI and credentials.json are optional.** In a GooseWorks sandbox (`GW_MEDIA_PROXY_TOKEN`
1527
- set) use the env proxies and `catalog_fetch`; never call a provider with a raw key.
1528
- - **No Chromium in a sandbox** — a browser-rendered format stops there, before any spend, and says so.
1529
- - **Toolchain before spend** — common checks use `gooseworks doctor --no-browser`; every selected
1530
- browser renderer must also pass `--renderer-script` or its equivalent exact-runtime launch
1531
- check in Step 2. Stop with the folder-specific fix if anything is missing.
1532
- - **Assemble the whole review set first**, mirror it with `video_project_upsert patch.script`, and
1533
- get ONE approval in this chat, recorded with `patch.approve`, BEFORE the expensive render
1534
- (review-once). Never send the user to the app to approve; the app is only for reviewing.
1535
- - **Show the REAL cheap pieces; PROMPT only the expensive render.** Generate the FREE + CHEAP-paid
1536
- pieces (≤ ~100 credits — stills, creator frame, end card, short VO/music) and mirror the real
1537
- assets; put ONLY the expensive video take/render in the panel as its exact prompt. That prompt
1538
- must be in the panel before you ask to approve, so a single "go" runs the render + any remaining
1539
- paid work (→ QC → publish) with no re-pausing.
1540
- - **Operator may be absent (sandbox):** decide mechanical choices yourself; ask in chat only for a
1541
- true taste call.
1542
- - **Costs in CREDITS, never dollars.** credits ≈ round-up(provider-$ × 120) per generation + a flat
1543
- 200-credit base per video; never show a "$…" figure to the user.
1544
- - **Never assemble the full video before approval.** The review shows the
1545
- individual PIECES, never the finished cut (or their prompts) — not a
1546
- stitched/composited cut; do not add a "full cascade" / finished-video clip
1547
- as a review ingredient (GOOSE-2542). The assembled video is produced only in
1548
- Step 4.
1549
- - **Open the render row at the start of Step 4** (4.1, after the approval) and keep its stage /
1550
- progress current; mark it `complete` only after the master passes QC. `output_url` = the
1551
- durable render-file URL, never a CDN URL.
1552
- - **Always export `GW_PROJECT_ID`** (and pass `project_id` on hand-rolled proxy calls) so the
1553
- credits attribute to this ad project.
1554
- - **Verify a real, non-empty MP4** (watch it) before marking the render complete.
1555
- - **Reuse the brand** when its research is complete; never re-research.
1556
- - **Brand rules first:** load kit + products + learnings (Step 1), write `working/brand-rules.json`
1557
- (Step 1.7), and follow it: pronunciations in every voiceover, nothing from `never_say`, product
1558
- facts only from the product rows, the kit's logo FILE (never a generated or favicon logo), the
1559
- brand font, this product's own images.
1560
- - **Save brand corrections** from chat with `brand_update patch.facts` in the same turn, and say so.
1561
- - **Finished-ad gate on every master** (`review-finished-ad` + the sheet); at most 2 repair
1562
- rounds, then publish as `blocked` with the report and warn the user — never pass off a failing
1563
- video as finished.
1564
- - On a hard error (auth/quota/model/timeout) set the render `failed` with a short
1565
- `error_message` (`video_render_run { …, render: { render_id, status: "failed", error_message } }`) and stop — don't ship the source unchanged. **Also log
1566
- it** (see "Report problems") so we can see + fix it.
1567
- - Finish according to card.display_hint: widget hosts get one short line without duplicate links;
1568
- text hosts get card.text_summary and the returned delivery links verbatim.
1569
-
1570
- ## Use uploaded footage
1571
-
1572
- When the customer asks to use existing footage, check the actual advertised schemas. Use `media_search` with purpose `production`, kind `video`, the brand and current project when needed. Omit query spend for free retrieval. Read facts/scenes with `media_analyze`, then use `media_excerpt` action `inspect` to review actual bounded frames and timed transcript before selecting. A description or thumbnail URL alone is not visual review.
1573
-
1574
- Freeze `source_excerpt:{asset_id,analysis_revision,scene_id,start_ms,end_ms,audio_mode}`. Revision is the original-byte SHA, scene may be null for a known user trim, bounds use integer milliseconds, and audio is original or muted. Call `media_excerpt` action `attach` with that exact selection and a stable idempotency key. The returned project remains unfinished and unapproved. Open its existing Studio review; preserve user locks and requested format, and keep footage separate from image packshot indexes. An incompatible format requires an explicit choice before changing it.
1575
-
1576
- For custom production, fetch the current shared `video-production-harness` and follow script/ingredient gates. Download the verified original and trim its exact selected window at normal speed with the approved audio. Recheck current revision and production permission before consumption and final upload/completion. Save excerpt lineage in plan and ingredient readback. Missing optional semantics does not require another upload; known user-selected stored footage remains usable. Research and competitor references never become production footage. Selected originals require no paid generation; only newly generated/replaced ingredients consume the approved budget.
7
+ When an answer's next_step gives a command to make a video, its last line says who starts it and how: follow that line exactly, with the command exactly as given.