Skill Tracer
Skills › HyperFrames › media-use › resolve.md

resolve.md

152 lines · skills/media-use/references/resolve.md at a595755

Open on GitHub
1# Resolve — command, flags, reuse, adopt, inventory
2
3```bash
4npx hyperframes media-use resolve --type <type> --intent "<description>" --project <dir>
5```
6
7Returns one line: `resolved <id> → <path> (<type>, <metadata>)`
8
9A weak match is still returned, with a `media-use: low-confidence match` line on stderr and a `match` object in `--json` output: `{score, min_score, low_confidence}` for a HeyGen sound under 0.5, or `{matched_words, intent_words, low_confidence, resolved_for?}` for a project file found by its name. Listen to a low-confidence sound before placing it, or resolve again with other words. A sound effect nothing matches fails with `no sound effect matched`, naming the min score the search used.

Resolve — command, flags, reuse, adopt, inventory

npx hyperframes media-use resolve --type <type> --intent "<description>" --project <dir>

Returns one line: resolved <id> → <path> (<type>, <metadata>)

A weak match is still returned, with a media-use: low-confidence match line on stderr and a match object in --json output: {score, min_score, low_confidence} for a HeyGen sound under 0.5, or {matched_words, intent_words, low_confidence, resolved_for?} for a project file found by its name. Listen to a low-confidence sound before placing it, or resolve again with other words. A sound effect nothing matches fails with no sound effect matched, naming the min score the search used.

Raw lines 1 to 10
11## Types
13| Type | What it finds | Provider / cascade |
14| ------- | -------------------------------- | ------------------------------------------------------------ |
15| `bgm` | Background music | HeyGen audio catalog (10k+ tracks) |
16| `sfx` | Sound effects | Openverse (CC0 / CC BY), then the bundled 21-file library |
17| `image` | Photos, backgrounds | HeyGen asset search (75k+ vectors) |
18| `icon` | Icons, symbols | HeyGen asset search (type=icon) |
19| `logo` | Official brand marks | theSVG → GitHub org avatar → domain favicon |
20| `voice` | TTS voiceover | HeyGen TTS free-usage path; optional local Kokoro |
21| `grade` | HyperFrames color-grading blocks | Core preset → look index params/CDN LUT → deterministic cube |
22| `lut` | Reusable `.cube` LUT files | Look index params/CDN LUT → deterministic cube |

Types

TypeWhat it findsProvider / cascade
bgmBackground musicHeyGen audio catalog (10k+ tracks)
sfxSound effectsOpenverse (CC0 / CC BY), then the bundled 21-file library
imagePhotos, backgroundsHeyGen asset search (75k+ vectors)
iconIcons, symbolsHeyGen asset search (type=icon)
logoOfficial brand markstheSVG → GitHub org avatar → domain favicon
voiceTTS voiceoverHeyGen TTS free-usage path; optional local Kokoro
gradeHyperFrames color-grading blocksCore preset → look index params/CDN LUT → deterministic cube
lutReusable .cube LUT filesLook index params/CDN LUT → deterministic cube
Raw lines 11 to 23
24## Examples
26```bash
27# Background music
28npx hyperframes media-use resolve --type bgm --intent "upbeat tech launch" --project .
29# → resolved bgm_001 → .media/audio/bgm/bgm_001.mp3 (bgm, 25s)
31# Sound effect
32npx hyperframes media-use resolve --type sfx --intent "whoosh" --project .
33# → resolved sfx_001 → .media/audio/sfx/sfx_001.mp3 (sfx, 0.57s)
35# Image
36npx hyperframes media-use resolve --type image --intent "gradient tech background" --project .
37# → resolved image_001 → .media/images/image_001.jpg (image)
39# Icon
40npx hyperframes media-use resolve --type icon --intent "rocket" --project .
41# → resolved icon_001 → .media/images/icon_001.png (icon, transparent)
43# Brand logo (official mark — never redrawn by hand)
44npx hyperframes media-use resolve --type logo --entity linkedin --intent "LinkedIn logo" --project .
45# → resolved logo_001 → .media/images/logo_001.svg (logo, official mark)
47# Color grade block
48npx hyperframes media-use resolve --type grade --intent "warm daylight" --project . --json
49# → {"ok":true,"preset":"warm-daylight","grading":{"preset":"warm-daylight","intensity":1},...}
51# LUT file
52npx hyperframes media-use resolve --type lut --intent "teal orange blockbuster" --project .
53# → resolved lut_001 → .media/luts/lut_001.cube (lut)
54```

Examples

# Background music
npx hyperframes media-use resolve --type bgm --intent "upbeat tech launch" --project .
# → resolved bgm_001 → .media/audio/bgm/bgm_001.mp3 (bgm, 25s)

# Sound effect
npx hyperframes media-use resolve --type sfx --intent "whoosh" --project .
# → resolved sfx_001 → .media/audio/sfx/sfx_001.mp3 (sfx, 0.57s)

# Image
npx hyperframes media-use resolve --type image --intent "gradient tech background" --project .
# → resolved image_001 → .media/images/image_001.jpg (image)

# Icon
npx hyperframes media-use resolve --type icon --intent "rocket" --project .
# → resolved icon_001 → .media/images/icon_001.png (icon, transparent)

# Brand logo (official mark — never redrawn by hand)
npx hyperframes media-use resolve --type logo --entity linkedin --intent "LinkedIn logo" --project .
# → resolved logo_001 → .media/images/logo_001.svg (logo, official mark)

# Color grade block
npx hyperframes media-use resolve --type grade --intent "warm daylight" --project . --json
# → {"ok":true,"preset":"warm-daylight","grading":{"preset":"warm-daylight","intensity":1},...}

# LUT file
npx hyperframes media-use resolve --type lut --intent "teal orange blockbuster" --project .
# → resolved lut_001 → .media/luts/lut_001.cube (lut)
Raw lines 24 to 55
56## Flags
58| Flag | Description |
59| --------------- | ------------------------------------------------------------------------------------ |
60| `--type, -t` | Media type: bgm, sfx, image, icon, logo, voice, grade, lut |
61| `--intent, -i` | What you need (natural language) |
62| `--entity, -e` | Entity name for cache matching (optional) |
63| `--project, -p` | Project directory (default: .) |
64| `--candidates` | List reusable assets (project + global cache) for `--type`; no download, no mutation |
65| `--reuse <sha>` | Import a specific global-cache asset (by content sha/prefix, from `--candidates`) |
66| `--from` | Freeze a local file or direct public URL (ingest) |
67| `--for` | Analyze a local image/video and add measured adjust suggestions (`grade` only) |
68| `--local-only` | Offline: skip every network provider (cache + local only) |
69| `--provider` | Force one generator (e.g. `codex`, `mflux`, `kokoro`, `heygen`) |
70| `--adopt` | Bulk-import existing assets/ into manifest |
71| `--doctor` | Check local CLI dependencies; no manifest changes |
72| `--stats` | Print local usage stats from `.media/` and `~/.media`; no manifest changes |
73| `--days N` | Limit `--stats` to timestamped records/misses from the last N days |
74| `--json` | Output JSON instead of one-line result |

Flags

FlagDescription
--type, -tMedia type: bgm, sfx, image, icon, logo, voice, grade, lut
--intent, -iWhat you need (natural language)
--entity, -eEntity name for cache matching (optional)
--project, -pProject directory (default: .)
--candidatesList reusable assets (project + global cache) for --type; no download, no mutation
--reuse <sha>Import a specific global-cache asset (by content sha/prefix, from --candidates)
--fromFreeze a local file or direct public URL (ingest)
--forAnalyze a local image/video and add measured adjust suggestions (grade only)
--local-onlyOffline: skip every network provider (cache + local only)
--providerForce one generator (e.g. codex, mflux, kokoro, heygen)
--adoptBulk-import existing assets/ into manifest
--doctorCheck local CLI dependencies; no manifest changes
--statsPrint local usage stats from .media/ and ~/.media; no manifest changes
--days NLimit --stats to timestamped records/misses from the last N days
--jsonOutput JSON instead of one-line result
Raw lines 56 to 75
76## Reuse before you resolve
78Before resolving bgm/sfx/image/icon/logo/grade/lut, **check what already exists and reuse it when it fits.** media-use does not semantically match for you — you are the judge. It surfaces candidates; you decide.
80```bash
81npx hyperframes media-use resolve --type bgm --intent "upbeat tech launch" --candidates --project .
82# [project] upbeat tech launch (25s, heygen.audio.sounds)
83# .media/audio/bgm/bgm_001.wav
84# [global] energetic tech intro (22s, heygen.audio.sounds)
85# --reuse 06e052c075fd2b80
86```
88Read the list and judge semantic fit yourself — "upbeat tech launch" ≈ "energetic tech intro" is a call only you can make from the descriptions. Then:
90- **A project candidate fits** → just reference its path in your composition. Nothing else to run.
91- **A global candidate fits** → `resolve --type bgm --reuse <sha>` copies it into this project (self-contained render) and records it.
92- **Nothing fits** → resolve fresh (`--type ... --intent ...`).
94**Trust guardrail — when unsure, resolve fresh.** A redundant download is cheap; shipping the wrong asset is not. Judge fit from description + prompt + type + duration/dims. For **brand/entity** assets, reuse a _global_ candidate only when the entity matches exactly — the global cache aggregates every project you have worked on, so a `--candidates` list can surface another client's brand mark and its prompt text. Never reuse a cross-project brand asset on a loose match.
96The deterministic floor still runs automatically: an identical (case/whitespace-insensitive) repeat auto-reuses with no `--candidates` step. `--candidates` is only for the semantic layer above that floor — and a fuzzy match is **never** auto-applied; reuse is always your explicit call. On a resolve that misses the floor and is about to fetch, media-use prints a one-line stderr hint when similar cached assets exist, pointing you back here.

Reuse before you resolve

Before resolving bgm/sfx/image/icon/logo/grade/lut, check what already exists and reuse it when it fits. media-use does not semantically match for you — you are the judge. It surfaces candidates; you decide.

npx hyperframes media-use resolve --type bgm --intent "upbeat tech launch" --candidates --project .
#   [project] upbeat tech launch (25s, heygen.audio.sounds)
#           .media/audio/bgm/bgm_001.wav
#   [global]  energetic tech intro (22s, heygen.audio.sounds)
#           --reuse 06e052c075fd2b80

Read the list and judge semantic fit yourself — "upbeat tech launch" ≈ "energetic tech intro" is a call only you can make from the descriptions. Then:

  • A project candidate fits → just reference its path in your composition. Nothing else to run.
  • A global candidate fits → resolve --type bgm --reuse <sha> copies it into this project (self-contained render) and records it.
  • Nothing fits → resolve fresh (--type ... --intent ...).

Trust guardrail — when unsure, resolve fresh. A redundant download is cheap; shipping the wrong asset is not. Judge fit from description + prompt + type + duration/dims. For brand/entity assets, reuse a global candidate only when the entity matches exactly — the global cache aggregates every project you have worked on, so a --candidates list can surface another client's brand mark and its prompt text. Never reuse a cross-project brand asset on a loose match.

The deterministic floor still runs automatically: an identical (case/whitespace-insensitive) repeat auto-reuses with no --candidates step. --candidates is only for the semantic layer above that floor — and a fuzzy match is never auto-applied; reuse is always your explicit call. On a resolve that misses the floor and is about to fetch, media-use prints a one-line stderr hint when similar cached assets exist, pointing you back here.

Raw lines 76 to 97
98## How it works
100`resolve` runs an automatic floor, then falls through to fetching:
1021. Check project `.media/manifest.jsonl` for a prompt match (case- and whitespace-insensitive) — auto-reuse
1032. Scan existing `assets/` directory for unregistered files that share a word with the need
1043. Check global cache `~/.media/` for a reusable asset matched on the same normalized prompt — auto-reuse
1054. Search via provider (HeyGen audio catalog, HeyGen asset search), or resolve color locally
1065. Freeze file to `.media/<type>/`, register in manifest, regenerate `index.md`, auto-promote to `~/.media/`
108Steps 1 and 3 are the **deterministic floor**: they only auto-reuse an exact-normalized match, never a fuzzy one. Semantic reuse ("close enough") is the agent's explicit call via [Reuse before you resolve](#reuse-before-you-resolve) — it never happens automatically. The agent gets back **one line**; candidates, scores, provenance stay on disk.

How it works

resolve runs an automatic floor, then falls through to fetching:

  1. Check project .media/manifest.jsonl for a prompt match (case- and whitespace-insensitive) — auto-reuse
  2. Scan existing assets/ directory for unregistered files that share a word with the need
  3. Check global cache ~/.media/ for a reusable asset matched on the same normalized prompt — auto-reuse
  4. Search via provider (HeyGen audio catalog, HeyGen asset search), or resolve color locally
  5. Freeze file to .media/<type>/, register in manifest, regenerate index.md, auto-promote to ~/.media/

Steps 1 and 3 are the deterministic floor: they only auto-reuse an exact-normalized match, never a fuzzy one. Semantic reuse ("close enough") is the agent's explicit call via Reuse before you resolve — it never happens automatically. The agent gets back one line; candidates, scores, provenance stay on disk.

Raw lines 98 to 109
110## Stamping provenance when mounting a resolved video
112`resolve` never writes composition HTML itself — mounting a `<video>` element
113into a composition is always the agent's own edit. When the mounted video's
114manifest record has `provenance.provider === "heygen.video"` (check
115`.media/manifest.jsonl` or the one-line resolve output for the provider name),
116add `data-media-source="heygen"` to that `<video>` tag. Leave the attribute off
117entirely for every other provider (`ltx.local`, an adopted/local file, etc.) —
118this is not a general provider taxonomy, just the one signal render telemetry
119tracks today.

Stamping provenance when mounting a resolved video

resolve never writes composition HTML itself — mounting a <video> element into a composition is always the agent's own edit. When the mounted video's manifest record has provenance.provider === "heygen.video" (check .media/manifest.jsonl or the one-line resolve output for the provider name), add data-media-source="heygen" to that <video> tag. Leave the attribute off entirely for every other provider (ltx.local, an adopted/local file, etc.) — this is not a general provider taxonomy, just the one signal render telemetry tracks today.

Raw lines 110 to 120
121## Adopt existing projects
123Most HyperFrames projects already have assets in `assets/`. media-use adopts them:
125```bash
126npx hyperframes media-use resolve --adopt --project .
127# → adopted 9 assets from assets/
128# bgm_001 → assets/bgm/mango-fizz.mp3 (bgm, 146.6s)
129# image_001 → assets/images/avatar.jpg (image, 400×400)
130```
132`ffprobe` extracts real duration and dimensions. During resolve, unregistered files in `assets/` matching the intent are adopted on the fly.

Adopt existing projects

Most HyperFrames projects already have assets in assets/. media-use adopts them:

npx hyperframes media-use resolve --adopt --project .
# → adopted 9 assets from assets/
#   bgm_001 → assets/bgm/mango-fizz.mp3 (bgm, 146.6s)
#   image_001 → assets/images/avatar.jpg (image, 400×400)

ffprobe extracts real duration and dimensions. During resolve, unregistered files in assets/ matching the intent are adopted on the fly.

Raw lines 121 to 133
134## Reading the inventory
136After resolve or adopt, read `.media/index.md` for the full inventory:
138```
139# .media · 4 assets
141id type dur dims path description
142bgm_001 bgm 25s - .media/audio/bgm/bgm_001.mp3 upbeat tech launch
143sfx_001 sfx 0.6s - .media/audio/sfx/sfx_001.mp3 whoosh
144image_001 image - 1920×1080 .media/images/image_001.jpg gradient tech background
145icon_001 icon - 200×200 .media/images/icon_001.png rocket
146```

Reading the inventory

After resolve or adopt, read .media/index.md for the full inventory:

# .media · 4 assets

id         type   dur   dims       path                          description
bgm_001    bgm    25s   -          .media/audio/bgm/bgm_001.mp3  upbeat tech launch
sfx_001    sfx    0.6s  -          .media/audio/sfx/sfx_001.mp3  whoosh
image_001  image  -     1920×1080  .media/images/image_001.jpg   gradient tech background
icon_001   icon   -     200×200    .media/images/icon_001.png    rocket
Raw lines 134 to 147
148## Cross-project reuse
150Assets are cached automatically on resolve. Every resolved/ingested asset is auto-promoted to the global cache at `~/.media/`, so subsequent resolves for the same (or near-identical) prompt, in any project, hit the cache with no re-download and no provider call.
152For a _semantically_ similar (not identical) need in another project, the exact-match floor won't fire — use [Reuse before you resolve](#reuse-before-you-resolve): `--candidates` lists the global assets, and `--reuse <sha>` imports the one you pick. This is how a track resolved in one project gets reused in the next when the wording differs.

Cross-project reuse

Assets are cached automatically on resolve. Every resolved/ingested asset is auto-promoted to the global cache at ~/.media/, so subsequent resolves for the same (or near-identical) prompt, in any project, hit the cache with no re-download and no provider call.

For a semantically similar (not identical) need in another project, the exact-match floor won't fire — use Reuse before you resolve: --candidates lists the global assets, and --reuse <sha> imports the one you pick. This is how a track resolved in one project gets reused in the next when the wording differs.

Raw lines 148 to 152