Datasets:
Download SPEC.md from CutWire-Studios/drift-command-calls: direct link, hf CLI and curl.
- Browser
- Download file 20.8 kB
-
https://huggingface.co/datasets/CutWire-Studios/drift-command-calls/resolve/main/SPEC.md
- Command line
-
hf download hf://datasets/CutWire-Studios/drift-command-calls/SPEC.md
-
curl -L -o SPEC.md https://huggingface.co/datasets/CutWire-Studios/drift-command-calls/resolve/main/SPEC.md
Training record spec (F1)
The contract between batch authors, validate.py and build.py. One JSON object per line, UTF-8, no trailing commas.
{"id": "b3-0042",
"query": "give it that old vhs tape look",
"context": {"canvas": [1920, 1080], "fps": 30, "playhead": 7.25, "project_duration": 30.0,
"selected": {"clip": "c3f1a2b4-6d7e-4a8b-9c0d-1e2f3a4b5c6d", "kind": "video", "track": 1, "index": 0,
"start": 0.0, "duration": 12.0, "src_in": 0.0, "src_out": 12.0},
"tracks": ["0 text", "1 video", "2 audio"]},
"answers": [{"name": "add_effect", "arguments": {"track": 1, "index": 0, "effect": "stylize.vhs"}}],
"source": "b3-effects"}
Fields
| field | type | notes |
|---|---|---|
id |
string | unique across all batches, no spaces. b<batch>-<4 digits>; the seed batch uses seedNNN |
query |
string | 2 to 300 chars, what the user typed or said |
context |
object | exactly the shape below; unknown keys are errors |
answers |
list of {name, arguments} |
0 to 3 calls, in execution order. [] = the model must call nothing |
source |
string | batch name, e.g. b3-effects |
alt_ops |
optional list of op names | other ops that would also be a correct answer (as in eval.jsonl). Only used to keep them out of the distractor tool list. Use it when two ops are near-synonyms for this query |
needs_rich |
optional bool | true when the answer depends on context that the default prompt line does not show (see "What the model sees"). Required for effect-stack ops |
note |
optional string | free text for humans, ignored |
context (same shape as data/eval.jsonl, plus two optional extras)
| field | type | rule |
|---|---|---|
canvas |
[w, h] ints |
project canvas in pixels. Origin is the top-left corner |
fps |
number | project frame rate |
playhead |
number | seconds, within [0, project_duration] |
project_duration |
number | seconds. 0.0 and tracks: [] for an empty project |
selected |
object or null |
the selected clip, see below. null = nothing selected |
tracks |
list of strings | "<index> <kind>", index 0 is the top track: ["0 text", "1 video", "2 audio"] |
transitions |
optional list | {"id": "t_<hex>", "track": int, "kind": <transition id>, "duration": seconds} |
others |
optional list | other clips, same shape as selected (required keys only). Gives uuids for ops that take several clips or before/after |
selected required keys: clip (lowercase uuid v4 string), kind (video, audio, text, subtitle, image, ...), track (int), index (int, position of the clip on its track, 0-based), start (seconds on the timeline), duration (seconds). Optional: src_in, src_out (source seconds; video/audio), effects (list of video effect ids on the clip in stack order), audio_effects (same, audio effect ids). kind should match the track's kind. The selected clip must fit in project_duration.
contexts.json holds 13 ready-made contexts (video_mid, video_with_neighbours, audio_clip, text_clip, vertical_video, long_4k, fx_stack, nothing_selected, empty_project, ...). Use them or make new ones in the same shape with fresh uuids. Vary the playhead and the selection from record to record: the values copied into answers (playhead for "here", uuid for clip refs) must differ across the set, otherwise the model memorises one uuid.
What the model sees (important)
build.py turns context into one line, byte-identical to what the eval scripts send (eval_needle.ctx_line('S'), with the old id artifact removed):
Selected clip: <uuid>, track 1, index 0. Playhead: 7.25 seconds. (or: No clip is selected. Playhead: 0.0 seconds.)
HF/llama.cpp chat variants prefix the instruction sentence (SYS_PROMPT, same as eval_llamacpp.py); the Needle variant uses the line only (as eval_needle.py).
So under the default (--ctx S) the model sees ONLY: selected uuid, track, index, playhead. It does not see kind, start, duration, src range, project duration, canvas, fps, tracks, transitions, effects. An answer must therefore be derivable from the query plus those four values. Examples that need anything else (half-way through the clip, the last 2 seconds, "to the end", "the transition between these", "remove the contrast effect", pixel positions from canvas size) must set "needs_rich": true. build.py --ctx S drops those records; --ctx R keeps them and renders a richer line (kind, start, duration, source range, project size, tracks, transitions, others, effect stack). Keep needs_rich records to at most 10% of a batch, and still write them: they are the data for the R variant, which needs the eval prompt changed as well before it can be scored. Decision for the owner: S is what the baselines were scored with, R is what a real command bar can supply.
seek-to-end style queries ("go to the end") are the only exception that stays in S: use project_duration from the context if you must, but then mark needs_rich.
Argument conventions (these are what the model must learn)
Clip references.
- Default: the selected clip is referenced as
trackandindexcopied fromcontext.selected. Never also passclip. This is the eval convention (145 of 147 gold clip refs). - Ops whose schema requires
clip(the effect-stack ops:remove_effect,set_effect_param,remove_audio_effect,set_audio_effect_param,set_effect_enabled,set_effect_color_param,set_audio_effect_enabled,set_effect_string_param): passclip= the uuid. On those opsindexis the position in the effect stack, taken fromselected.effects/selected.audio_effects(0-based, in the order listed). All of them needneeds_rich: true. - Ops taking uuid lists or targets (
select_clips,delete_clips,clips,before,after,transition): uuids/ids must come fromselected/others/transitions. Never invent an id; validate.py rejects any uuid-looking value, anyt_...id, and anyclip/clips/before/after/transitionvalue that is not present in the context. - A track the user names explicitly ("track 2", "the audio track") is
track: <int>using the order ofcontext.tracks. - Query says "this/it/the clip" and nothing is selected: if the op needs a clip, the answer is
[](the model must not guess). Use this for at most 2% of a batch; vary the wording. Query names a track/index explicitly: answer normally even if nothing is selected. - Default arguments that are not about clips (
at,track) are not copied when the user did not imply them (see below).
Times and numbers (all JSON numbers, never strings).
- Time unit is seconds (timeline seconds unless the arg description says source seconds). Never milliseconds.
"1:30"is 90,"two and a half minutes"is 150,"a second and a half"is 1.5, frames convert withcontext.fps(needs_richif you use fps). - "here", "now", "at the playhead", "this point", "where I am": put
context.playheadintoat. If the user states no time and the schema saysatdefaults to the playhead, leaveatout unless the query points at the playhead ("here"). Eval gold writes the playhead explicitly for "split here", so do the same. - Whole numbers are written as integers (
2, not2.0); fractions as decimals (0.5). - Percent: opacity and volume are factors. 50% opacity = 0.5. Volume: 1 = 100%, range 0 to 2, so "150%" = 1.5 and "mute" = 0 (or
set_trackmuted for a whole track). Scale: factor, 1 = fit size, "150%" = 1.5, "half size" = 0.5. Speed: rate, "half speed" = 0.5, "2x" = 2 (range 0.25 to 4). - Degrees are clockwise. Pixel positions are canvas pixels from the top-left. Anything needing the canvas size needs the canvas in context (
needs_rich). - dB:
reduce_dbis <= 0 ("duck by 12 dB" = -12). LUFS targets are negative numbers (-14). Fade lengths and durations are seconds. - Fuzzy words, pick one value from the range and vary within it: "a bit louder" 1.2 to 1.35, "much louder" 1.6 to 1.9, "a bit quieter" 0.7 to 0.85, "a lot quieter" 0.3 to 0.45, "slow motion" 0.25 to 0.5, "a bit faster" 1.25 to 1.5, "fade it in" with no length 1.
- Booleans are JSON
true/false. "mute track 2" is{"track": 2, "muted": true}; "unmute" ismuted: false.
Colours: #rrggbb lowercase hex for text/shape/effect colours; #aarrggbb for set_background.color (opaque black = #ff000000). Named colours map to the CSS value (red = #ff0000).
Strings: copy text content verbatim from the query, preserving case and punctuation, without the surrounding quotes. Paths are only written if the user stated them; never expand ~.
Ids from catalogs. Effects (effect_ids.json, 125), transitions (transition_ids.json, 151), audio effects, text looks, shapes, stickers, effect templates, text presets, text animations, easing presets, export presets, Whisper languages, animation kinds: use the exact id string from the dump (case, dots and underscores exact; aliases such as adjust_contrast are NOT allowed, use adjust.contrast). The user never says the id: they say "old tv", "make it pop", "wipe left". set_effect_param.key must be a key from that effect's params in effect_ids.json when the effect is in selected.effects. add_effect takes one effect per call (two effects = two calls). One caveat: export_video.video lists hevc in its description but Drift's export options use h265; follow export_options.json (validate.py warns, does not fail, on codec ids).
Canonical arg names. Never use aliases (export_video has videoCodecId, audioOnly, exportWorkAreaOnly, ...; their schema description starts with "Alias of"). validate.py rejects them.
Only fill what is stated or implied. Required args always. Optional args only when the query states or clearly implies them; do not add defaults the user did not ask for (ripple, linked_audio, crf, ...), and do not include an optional arg that equals its schema default unless the user said it. Across the examples of one op, vary which optional args appear (some with none, some with one, some with several). The mean fraction of optional args used per record is printed by validate.py; aim for roughly 0.25 to 0.5. Never invent ids that are not in the context; never invent a file path.
Compact-schema visibility. The tool block is the compact schema (descriptions cut, nested objects limited to depth 2 and 14 properties, enums capped at 16). Args or enum values that are not visible in it are rejected (validate.py --allow-hidden turns this off for experiments). Known consequence: set_text.style shows only 14 keys (accent..fontWeight in alphabetical order), so pixelSize, letterSpacing, lineHeight cannot be taught; set_shape_style/set_text_layer nested layers are mostly invisible. ft/show_op.py <op> prints exactly what is visible.
Generation brief for batch authors
Per op: about the target in ft/plan.json / BATCHES.md (default 20). For each op write queries that a real person would type or say into a command bar over an editor.
Phrasing mix (per batch, roughly):
- 40% terse imperative:
split here,speed 2x,add vignette,mute,fade out 3s. Mostly 1 to 4 words. Include shorthand (2x,-6db,1:30,ctrl z,ccfor captions). - 30% chatty/conversational:
could you slow this one down a little, like half speed,ok now let's put a title at the start that says Summer Trip. - 15% indirect/descriptive: describe the goal, not the op:
it's too dark,this is sideways,the music drowns out the talking,I want that old film feel,the first 3 seconds are boring. - about 10% typos, scattered over every group: dropped/swapped/doubled letters, missing spaces, no capitalisation (
spliit it at the playhed,volme to 80%,unod). The typo must not make the intended op ambiguous. - about 10% question form, from batch 5 on (earlier batches have none):
can you speed this up?,could you add a fade?,is it possible to play this backwards?. Same answer as the imperative; no?needed in the answer logic. - A few queries with numbers in words (
two and a half seconds,fifty percent,half a second), several with digits, some with no number at all. - Do not reuse a sentence template. Vary the verb, the noun for the clip (
this,it,the clip,that shot,the footage), politeness, punctuation (many with none), and register (some voice-dictation style: lowercase, no punctuation, filler words). - Do not copy the op name or the arg name into the query more than about 30% of the time (
set volume to 0.5is fine as one of many;volume 50%,half volume,turn it down by half,make it quieter, like 50%are the others). - Queries are not copied from, or near-duplicates of, anything in
data/eval.jsonl(validate.py checks; use a different sentence, not just a different number).
Other record types (per batch):
- about 5% two-call records (
answershas 2 calls, rarely 3): "slow it down and add grain", "mute track 2 and lock track 1", "add a title and fade it in". Calls are in execution order; each call must be valid on its own. Two calls of the same op are fine (twoadd_text). Both ops should come from the batch's own op list where possible. - about 5% refusals (
answers: []): out-of-scope requests (make me a coffee,book a flight,what's the weather,write me a poem), requests for things Drift has no op for (upload this to YouTube,email it to my boss,change my wallpaper,post to TikTok), and near-misses that sound editor-like but are not possible with the tool list (make it 8K,AI generate a new ending,use the colour picker tool). Do not refuse things that map to an op, even awkwardly. Check the ops list (data/ops.json,ft/BATCHES.md) before calling something impossible. Mix in the "nothing selected" no-guess refusals (2%) described above. - at most 10%
needs_richrecords. - Argument diversity: for ops with enums or ranges, cover the whole range (min, max, typical, edge), different tracks (0 to 3), different clips in different contexts, different playheads, different sign/size of numbers.
Quality bar: every answer must be what a careful human would expect Drift to do. If you are unsure what an arg means, read the schema description via show_op.py; if the op's behaviour is still unclear, write fewer examples for it rather than guessing, and say so in your report. One query, one correct answer: avoid queries whose answer could reasonably be two different ops (add the other to alt_ops if you keep it).
Validation
~/.venvs/ft-tok/bin/python ft/validate.py ft/batches/*.jsonl (exit 1 on any error). It checks: record and context shape; every call against the FULL op schema (jsonschema: types, required, ranges, enums) and unknown args; alias args; args hidden in the compact schema; catalog ids against the dumps (with "did you mean"); id-like values and clip/before/after/transition values present in the context; effect-stack params; exact and near duplicate queries (normalised; character 5-gram Jaccard > 0.6) within the set and against data/eval.jsonl (leakage). It prints per-op counts against the plan targets and a summary (refusal and two-call rates, query length, digit rate, optional-arg usage).
Files in ft/
| file | purpose |
|---|---|
effect_ids.json, transition_ids.json, audio_effect_ids.json, text_look_ids.json, shape_ids.json, sticker_ids.json, effect_template_ids.json, text_preset_ids.json, text_animation_ids.json, easing_preset_ids.json, export_preset_ids.json, whisper_language_ids.json, animation_pack_ids.json, gradient_preset_ids.json, text_fill_effect_ids.json, font_families.json, procedural_ids.json, export_options.json, emoji_groups.json |
enumerations dumped from the running build/drift --headless through mcp-probe.py: {id, name, description} (effects and transitions also have category and params with key,type,min,max,default). Machine-local user/test effects (user.*, test.*, forge_*) are excluded. dump_enums.py rebuilds them from raw/ and raw2/ |
plan.json, BATCHES.md, plan_batches.py |
per-op tier, target and batch assignment; the work plan |
contexts.json, gen_util.py, show_op.py |
author helpers |
validate.py, build.py, common.py, retriever.py |
tooling (retriever is a copy of the BM25 + synonym code in scripts/retrieval.py) |
parity_test.py, render_check.py |
checks against the eval scripts / cactus / the real chat templates |
make_seed.py, batches/seed.jsonl |
the 30-record seed batch |
out/ |
build output (regenerate, do not edit) |
Build and output formats
~/.venvs/ft-tok/bin/python ft/build.py [files...] [--k 10] [--ctx S|R] [--shuffles 1] [--val-frac 0.05] [--variants full,short] (default files: ft/batches/*.jsonl; aborts on any validation error). Val is 5% per primary op (rounded, groups of one stay in train, so every op has train data; refusals are their own group). Each record gets the tool list as in the eval prompt: gold ops plus BM25+synonym distractors up to k = 10, shuffled with a per-record seed (--shuffles N writes N differently shuffled copies of every TRAIN record; ids get ~s). The retriever is the same one as in the eval (parity_test.py proves identical rankings), so train-time distractors look like eval-time ones. A record's alt_ops are kept out of the distractors.
- Variant
full: compact v2 schemas (compact_schema.tool_entry, the fixed version with property descriptions). Variantshort:{name, description: "name(arg*:type, ...)", parameters: names and types only}, for the schema-size ablation. out/hf_chat_<variant>.{train,val}.jsonl:{"id", "messages": [system, user, assistant], "tools": [{"type":"function","function":{name,description,parameters}}]}. The assistant message hascontent: ""andtool_calls: [{"type":"function","function":{"name", "arguments": {dict}}}]; a refusal hascontent: "No tool fits this request."and no tool_calls. Verified:apply_chat_template(messages, tools=tools)accepts this for Qwen3-0.6B (withenable_thinking=False) and Granite-4.0-H-350M, and the generation prompt is a strict prefix of the full render (render_check.py).argumentsis a dict, not a JSON string, because both templates calltojsonon it. Do not load these withdatasets.load_dataset("json"): Arrow merges the heterogeneousargumentsandparametersdicts into one giant struct and null-fills it. Read withjson.loadsper line and call the tokenizer yourself, or use the next format.out/hf_text_{qwen3,granite}_<variant>.{train,val}.jsonl:{"id", "prompt", "completion"}, already rendered with the model's own chat template (Qwen3 with the empty<think></think>block thatenable_thinking=Falseproduces, which is what the eval used). Plain strings, sodatasetsloads it safely. Use TRL prompt/completion format (completion-only loss). The completion ends with the model's end token (<|im_end|>/<|end_of_text|>); TRL does not add a second one. Unsloth:train_on_responses_onlyis not needed with this format.out/needle_<variant>.{train,val}.jsonl: cactus finetune format{"id", "query", "tools": [{name,description,parameters}], "answers": [{name,arguments}], "system": <context line only>}, noreasoning.needle_renderin build.py reproducescactus.model.finetune.render_examplebyte for byte (parity_test.py). Pass the train file tocactus finetune out/needle_full.train.jsonl --val-split 0 --max-len 4096 ..., and keep the val file for your own scoring.--max-lendefault is 1024 and silently truncates the target off the end of an ~1.8k-token sequence;build.pyprints the max length needed (2.8k tokens for thefullvariant on the seed batch). Amax_lenof 4096 is safe.out/split.json(ids per split),out/stats.json(token lengths with Needle, Qwen3 and Granite tokenizers).
Full-variant sequence lengths on the seed batch: Needle mean 1.8k, max 2.8k tokens; Qwen3 mean 2.1k, max 3.2k; short variant about half. Use a 4096 context for training.
Known limits of this setup
eval.jsonlgold sometimes needs context the S line hides (e.g. "chop it in half" = clip start + duration/2). Those eval items cap what any S-trained model can score; a few areneeds_rich-style by nature.- Clip refs: the model is trained to copy
track/indexfrom the line. A deterministic injector in the product can do this better, in which case clip refs could be dropped from the targets; not done here. - Typos and fuzzy values have one gold answer; scoring should stay lenient on fuzzy numbers (eval note).