|
| 1 | +--- |
| 2 | +name: media-use |
| 3 | +description: Agent Media OS — resolve any media need (BGM, SFX, image, icon) into a frozen local file + ledger record. One verb (`resolve`) handles the full cascade: project cache, global cache, HeyGen catalog search, freeze, register. Keeps search noise on disk, hands the agent a path. Use when a composition needs background music, sound effects, images, or icons. |
| 4 | +--- |
| 5 | + |
| 6 | +# media-use |
| 7 | + |
| 8 | +Resolve media needs into frozen local files. One verb, four types, zero context noise. |
| 9 | + |
| 10 | +## When to use |
| 11 | + |
| 12 | +Call `resolve` whenever a composition needs media — background music, sound effects, images, or icons. media-use searches the HeyGen catalog, downloads the best match, freezes it locally, and registers it in a manifest. The agent gets back one line; all search noise stays on disk. |
| 13 | + |
| 14 | +## Resolve |
| 15 | + |
| 16 | +```bash |
| 17 | +node <SKILL_DIR>/scripts/resolve.mjs --type <type> --intent "<description>" --project <dir> |
| 18 | +``` |
| 19 | + |
| 20 | +Returns one line: `resolved <id> → <path> (<type>, <metadata>)` |
| 21 | + |
| 22 | +### Types |
| 23 | + |
| 24 | +| Type | What it finds | Provider | |
| 25 | +| ------- | ------------------- | ---------------------------------------- | |
| 26 | +| `bgm` | Background music | HeyGen audio catalog (10k+ tracks) | |
| 27 | +| `sfx` | Sound effects | Bundled 19-file library + HeyGen catalog | |
| 28 | +| `image` | Photos, backgrounds | HeyGen asset search (75k+ vectors) | |
| 29 | +| `icon` | Icons, logos | HeyGen asset search (type=icon) | |
| 30 | + |
| 31 | +### Examples |
| 32 | + |
| 33 | +```bash |
| 34 | +# Background music |
| 35 | +node <SKILL_DIR>/scripts/resolve.mjs --type bgm --intent "upbeat tech launch" --project . |
| 36 | +# → resolved bgm_001 → .media/audio/bgm/bgm_001.mp3 (bgm, 25s) |
| 37 | + |
| 38 | +# Sound effect |
| 39 | +node <SKILL_DIR>/scripts/resolve.mjs --type sfx --intent "whoosh" --project . |
| 40 | +# → resolved sfx_001 → .media/audio/sfx/sfx_001.mp3 (sfx, 0.57s) |
| 41 | + |
| 42 | +# Image |
| 43 | +node <SKILL_DIR>/scripts/resolve.mjs --type image --intent "gradient tech background" --project . |
| 44 | +# → resolved image_001 → .media/images/image_001.jpg (image) |
| 45 | + |
| 46 | +# Icon |
| 47 | +node <SKILL_DIR>/scripts/resolve.mjs --type icon --intent "rocket" --project . |
| 48 | +# → resolved icon_001 → .media/images/icon_001.svg (icon, transparent) |
| 49 | +``` |
| 50 | + |
| 51 | +### Flags |
| 52 | + |
| 53 | +| Flag | Description | |
| 54 | +| --------------- | ------------------------------------------ | |
| 55 | +| `--type, -t` | Media type: bgm, sfx, image, icon | |
| 56 | +| `--intent, -i` | What you need (natural language) | |
| 57 | +| `--entity, -e` | Entity name for cache matching (optional) | |
| 58 | +| `--project, -p` | Project directory (default: .) | |
| 59 | +| `--adopt` | Bulk-import existing assets/ into manifest | |
| 60 | +| `--json` | Output JSON instead of one-line result | |
| 61 | + |
| 62 | +## How it works |
| 63 | + |
| 64 | +1. Check project `.media/manifest.jsonl` for exact-prompt match |
| 65 | +2. Scan existing `assets/` directory for unregistered files matching the need |
| 66 | +3. Check global cache `~/.media/` for reusable asset |
| 67 | +4. Search via provider (HeyGen audio catalog, HeyGen asset search) |
| 68 | +5. Freeze file to `.media/<type>/`, register in manifest, regenerate `index.md` |
| 69 | + |
| 70 | +The agent gets back **one line**. Candidates, scores, provenance stay on disk. |
| 71 | + |
| 72 | +## Adopt existing projects |
| 73 | + |
| 74 | +Most HyperFrames projects already have assets in `assets/`. media-use adopts them: |
| 75 | + |
| 76 | +```bash |
| 77 | +node <SKILL_DIR>/scripts/resolve.mjs --adopt --project . |
| 78 | +# → adopted 9 assets from assets/ |
| 79 | +# bgm_001 → assets/bgm/mango-fizz.mp3 (bgm, 146.6s) |
| 80 | +# image_001 → assets/images/avatar.jpg (image, 400×400) |
| 81 | +``` |
| 82 | + |
| 83 | +`ffprobe` extracts real duration and dimensions. During resolve, unregistered files in `assets/` matching the intent are adopted on the fly. |
| 84 | + |
| 85 | +## Reading the inventory |
| 86 | + |
| 87 | +After resolve or adopt, read `.media/index.md` for the full inventory: |
| 88 | + |
| 89 | +``` |
| 90 | +# .media · 4 assets |
| 91 | +
|
| 92 | +id type dur dims path description |
| 93 | +bgm_001 bgm 25s — .media/audio/bgm/bgm_001.mp3 upbeat tech launch |
| 94 | +sfx_001 sfx 0.6s — .media/audio/sfx/sfx_001.mp3 whoosh |
| 95 | +image_001 image — 1920×1080 .media/images/image_001.jpg gradient tech background |
| 96 | +icon_001 icon — svg .media/images/icon_001.svg rocket |
| 97 | +``` |
| 98 | + |
| 99 | +## Cross-project reuse |
| 100 | + |
| 101 | +Assets are cached automatically on resolve. Subsequent resolves for the same prompt hit the global cache at `~/.media/` — no re-download, no provider call. Promote an asset explicitly with `organize --promote <id>` to make it reusable across all projects. |
| 102 | + |
| 103 | +## Files |
| 104 | + |
| 105 | +- `.media/manifest.jsonl` — machine SSOT, one JSON record per line |
| 106 | +- `.media/index.md` — agent-readable table (id, type, dur, dims, path, description) |
| 107 | +- `~/.media/` — global cross-project reuse cache (content-addressed, SHA-256) |
| 108 | + |
| 109 | +## CLI tools used |
| 110 | + |
| 111 | +| Tool | Purpose | Required? | |
| 112 | +| --------- | ------------------------------------------ | ------------- | |
| 113 | +| `ffprobe` | Probe duration, dimensions, codec on adopt | Yes | |
| 114 | +| `heygen` | Audio catalog, asset search | For providers | |
0 commit comments