Skip to content

gooseworks-ai/goose-skills / skills/video/ugc-fixloop

ugc-fixloop

Verified

the UGC fix-loop toolkit — surgically re-render a bad window/beat of a single-take UGC master (stitch_replacement.py, pure FFmpeg) and GPT cross-model review a Seedance prompt before render (vet_seedance_prompt.py, routed through the openai-proxy). Fetch it into a one-shot UGC recipe so both scripts resolve on any machine and the vet call charged to your GooseWorks credits.

FileKindSize
SKILL.mdskill md3.4 KB
scripts/stitch_replacement.pyscript6.4 KB
scripts/vet_seedance_prompt.pyscript5.9 KB
skill.meta.jsonconfig221 B
tests/smoke-test.mdmarkdown1.7 KB

scripts/vet_seedance_prompt.py

View on GitHub
#!/usr/bin/env python3
"""Cross-model review of a Seedance 2.0 reference-to-video prompt by GPT — a
deliberately NON-Claude second opinion before you spend the render.

Portable: routes through the GooseWorks **openai-proxy** (charged to your GooseWorks credits, real
key never touches this machine) — never a direct api.openai.com call. Creds: the cloud
sandbox's GW_MEDIA_PROXY_TOKEN + GW_API_BASE env when set, else
~/.gooseworks/credentials.json (the CLI writes it). Takes the prompt to review
as an ARGUMENT (nothing baked in).

  vet_seedance_prompt.py --prompt-file working/seedance-prompt.txt \
      [--brief "one-line intent"] [--refs "@Image1=avatar; @Image2=product; @Image3=env"] \
      [--words 28] [--model gpt-5.5] [--out working/seedance-review.md]

Exit 0 + prints/saves the review. Exit 3 if the proxy/creds are unavailable (so the
recipe can fall back to an inline self-review — the review is advisory, not a gate).
"""
import argparse
import json
import os
import pathlib
import sys
import urllib.request
import urllib.error
from urllib.parse import urlencode

SYSTEM_PROMPT = """\
You are a senior AI-video prompt engineer who has shipped hundreds of short-form UGC
ads on ByteDance Seedance 2.0, Kling, and Veo. You know Seedance 2.0 reference-to-video
intimately: how it binds reference images addressed as @Image1/@Image2/@Image3, native
lip-synced dialogue (generate_audio=true), where it drifts (identity, product geometry,
small text, multi-cut consistency over a single ~15s render), and how spoken-word budget
maps to clip duration. You have strong opinions and you don't hedge — when you spot a
problem you name it and give the specific rewrite, not vague encouragement."""

USER_TEMPLATE = """\
Review this Seedance 2.0 reference-to-video prompt for a single vertical (9:16) UGC ad
before we render it. {brief}{refs}Native lip-sync means a tight spoken-word budget —
our rule of thumb is ~{words} words for a ~15s clip; push back if you disagree.

# The Seedance prompt to review
---
{prompt}
---

# What I want (be concrete; don't soft-pedal — if it will produce mush, say why)
1. **Verdict** — ship-as-is / ship-with-tweaks / needs-rewrite, one sentence.
2. **Specific line edits** — quote the phrase, give the replacement, why in <=15 words. Focus on
   what changes Seedance's output: @Image ref binding, camera-switch language, how hard cuts are
   signalled, consistency anchors, wording that invites drift. 0-8 edits.
3. **Word/duration budget** — will every spoken line land at ~15s with the cuts, or cut a line? which?
4. **Consistency risk** — rank the top 3 things most likely to drift across cuts (face, colors,
   product geometry, small text, camera switch) + the single best prompt-side mitigation for each.
5. **Reusability note** — 1-2 rules to bake into the general prompt recipe so the next brief inherits them."""


def _cfg():
    # Cloud sandbox (coworker chat): a per-session proxy token that already binds the
    # billing agent — no agent_id needed. Same resolution as media_proxy.py.
    env_tok = os.environ.get("GW_MEDIA_PROXY_TOKEN")
    if env_tok:
        base = os.environ.get("GW_API_BASE")
        if not base:
            fal = (os.environ.get("GW_FAL_PROXY_URL") or "").rstrip("/")
            i = fal.find("/api/internal/")
            base = fal[:i] if i > 0 else None
        if base:
            return base.rstrip("/"), env_tok, None
    p = pathlib.Path(os.path.expanduser("~/.gooseworks/credentials.json"))
    if not p.exists():
        sys.exit(3)  # no creds → recipe falls back to inline self-review
    c = json.loads(p.read_text())
    return c["api_base"].rstrip("/"), c["api_key"], c.get("agent_id")


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--prompt-file", help="path to the Seedance prompt to review")
    ap.add_argument("--prompt", help="the Seedance prompt inline (alternative to --prompt-file)")
    ap.add_argument("--brief", default="")
    ap.add_argument("--refs", default="")
    ap.add_argument("--words", type=int, default=28)
    ap.add_argument("--model", default="gpt-5.5")
    ap.add_argument("--out", default="working/seedance-review.md")
    a = ap.parse_args()

    prompt = a.prompt or (pathlib.Path(a.prompt_file).read_text() if a.prompt_file else "")
    if not prompt.strip():
        sys.exit("give the prompt via --prompt-file or --prompt")

    api_base, tok, agent = _cfg()
    user = USER_TEMPLATE.format(
        prompt=prompt.strip(), words=a.words,
        brief=(a.brief.strip() + " ") if a.brief else "",
        refs=("Reference slots: " + a.refs.strip() + ". ") if a.refs else "",
    )
    body = {"model": a.model, "messages": [
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": user},
    ]}
    pid = os.environ.get("GW_PROJECT_ID")
    q = urlencode({"token": tok, **({"agent_id": agent} if agent else {}),
                   **({"project_id": pid} if pid else {})})
    url = f"{api_base}/api/internal/openai-proxy/v1/chat/completions?{q}"
    req = urllib.request.Request(url, data=json.dumps(body).encode(),
                                 headers={"Content-Type": "application/json"}, method="POST")
    try:
        with urllib.request.urlopen(req, timeout=180) as resp:
            out = json.loads(resp.read().decode())
    except urllib.error.HTTPError as e:
        print(f"HTTP {e.code} {e.reason}\n{e.read().decode(errors='replace')}", file=sys.stderr)
        sys.exit(3)  # proxy error → advisory step, let the recipe self-review inline
    except Exception as e:
        print(f"openai-proxy unreachable: {e}", file=sys.stderr)
        sys.exit(3)

    review = out["choices"][0]["message"]["content"]
    outp = pathlib.Path(a.out)
    outp.parent.mkdir(parents=True, exist_ok=True)
    outp.write_text(review)
    print(f"[vet] model={out.get('model')} usage={out.get('usage', {})} saved={outp}\n")
    print(review)


if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall