Montaj Skill
Montaj is a video editing toolkit with agent-first tools. Built-in steps cover common operations. Workflows provide suggested operations. But you (the agent) decide what to run, in what order, and with what parameters based on user input.
Core Loop
This root skill is the dispatcher. It detects which interface Montaj is reached through, loads the matching interface skill, then loads the domain skills the workflow needs. It owns orchestration — the project state machine and workflow loading — not transport mechanics. The interface skill (native or mcp) owns how each _contract verb is actually performed.
Detecting which interface to use (three-way; if you were already told the context, honor it):
- MCP client (e.g. Claude Desktop) → load skill
mcp. - Else, local server up —
GET http://localhost:3000/api/projects?status=pendingresponds → HTTP mode. - Else → CLI mode.
For HTTP and CLI, load skill native — it defines how every _contract verb (run step, read/save the project, write/read a file, log) is performed in each mode. Then load the domain skills you need for the workflow (see Sub-skills below). Do not perform transport directly from this skill; native owns it.
The loop, once your interface is loaded:
1. The location of the clips, the prompt, and preferred workflow should have been given to you by your human. If not provided, ask. Don't guess.
(HTTP: pick the first pending project via `read the project`. MCP: skill `mcp` says how to find the project and run steps.)
2. Read the workflow from workflows/{name}.json
3. Apply editorial judgment (select/order/trim clips via probe + transcribe)
4. Execute workflow steps following the dependency graph; log before each step
5. Save the project (delta) as you go — GET fresh, merge your delta, save (see Project JSON)
6. Probe the final output → set inPoint: 0, outPoint: <duration>
7. Mark project as draft (status: "draft") when complete
8. Notify your human or ask questions if you run into issues.
Check for a style profile:
- HTTP / CLI / MCP — read
profilefield from project JSON. If set, theprofileSnapshotfield in the same project.json gives you everything you need (see below). - CLI mode, no project yet — run
montaj profile list. If profiles exist, ask the user if they wish to apply one. - Profile snapshot in project.json — when
profileis set, project.json also containsprofileSnapshotwith three fields: styleProfilePath— absolute path to the profile'sstyle_profile.md. Load it live for editorial direction analyzed from the creator's content (pacing, palette, tone). Field is omitted when the file did not exist at project init.- If
style_profile.mdholds a block between<!-- montaj:adopted:start -->and<!-- montaj:adopted:end -->, the creator chose those rules from other creators. Follow them as direction for pacing, captions, music and openings, in the same way as the rest of the profile; the snapshotsummarystill wins on a conflict. summary— hand-written guidance about how to use this asset library, frozen at init. Asset-library-specific rules ("always end with bumper.mov", "logo bottom-right at 60% opacity"). Distinct fromstyle_profile.md: that's analysis-derived; this is hand-curated.availableAssets— list of{filename, description, tags}entries the user has curated. Frozen at init.- Selection is human-driven. The user picks specific assets via the editor side panel; included assets land in
project.assets[]with the same shape as any other asset. Never call the include-asset endpoint on the user's behalf without explicit instruction. - Conflict rule. When
style_profile.mdandsummarydisagree,summarywins — it's the explicit user-authored rule.
Never invent a step sequence from scratch. Follow the assigned workflow; deviate only where the prompt explicitly requires it or the workflow fails (see Deviation Rules).
Multiple clips or workflow has foreach steps: Load skill parallel.
Running Steps
Running a step is a _contract verb — "run step <name> with <args>". The native skill (loaded by the dispatcher) defines how that resolves: POST /api/steps/:name in HTTP mode, montaj <step> … in CLI mode. Fire long-running steps in the background to stay available for conversation. The catalog of steps and their params is below.
Available Steps
Inspect
| Step | What it does | Key params |
|------|-------------|------------|
| probe | Duration, resolution, fps, codec | — |
| snapshot | Contact sheet grid image. Several clips in ONE sheet: pass them as inputs; 12 a sheet, more make several sheets | --cols 3 --rows 3; --at 1.5 --at 9 for a sheet of moments |
| virtual_to_original | Map virtual-timeline timestamps → original file timestamps | --input spec.json; positional timestamps; --inverse; --verbose |
Clean
| Step | What it does | Key params |
|------|-------------|------------|
| cut | The one way to clean talk (silences, fillers, false starts, repeats). Two calls: plan (writes cut-plan.md), then apply. Between them, skill select-takes edits the plan. Never rebuild a cut from other steps. | project; apply with plan cut-plan.md; --language <code> |
| crop_spec | Crop trim spec to virtual-timeline windows → refined trim spec, no encode | --keep 8.5:14.8 (repeatable; end sentinel ok) |
Edit
| Step | What it does | Key params |
|------|-------------|------------|
| materialize_cut | Encode a trim spec or raw segment to H.264 — required before steps that need an actual video file (e.g. remove_bg) | spec.json or clip.mp4 --inpoint 2.0 --outpoint 8.0 |
| resize | Reframe to aspect ratio | --ratio 9:16 or 1:1 or 16:9 |
| extract_audio | Extract audio track | --format wav |
Enrich
| Step | What it does | Key params |
|------|-------------|------------|
| transcribe | Word-level transcript (whisper.cpp) → SRT + JSON | --language en |
| caption | Transcript → animated caption track (data, not pixels) | --style word-by-word (or karaoke, pop, subtitle, highlight-box, outline, clean, accent, plate, phrase) |
| normalize | Audio loudness to a LUFS target. Not colour. | --target youtube (or podcast, broadcast) |
Never convert a clip's colour yourself (montaj normalize or POST /api/normalize; the normalize step above is audio only). Put the original file in src; Montaj converts it for each output and keeps the original for the SDR export. If you point src at a different file, delete normalizedSrc and normalizedInPoint in the same edit: they are a conversion of the old file, and render and preview prefer them.
caption produces a data track, not pixels. Rendered at review/final render time by the UI and render engine.
Language — non-English footage. transcribe and cut default to the multilingual large-v3-turbo-q5_0 model, which handles every language; omit --model. A model that is not installed falls back to one that is. Always pass --language <code> to transcribe and cut (e.g. --language es), taken from project.settings.language: whisper transcribes in the language it is told, and a wrong one emits sparse/garbage word timestamps that cut then deletes as "silence". If you do pass an English-only *.en model, a non-English code auto-upgrades it to its multilingual sibling. Set the project language at init with --language es (stored in settings.language); if a project predates this field and the audio clearly isn't English, pass --language explicitly anyway. cut also switches to that language's hesitation-filler set.
Transcribing a long source (e.g. a multi-minute source you will split into clips)? whisper can fall into a repetition-loop hallucination — one phrase repeated to EOF after a hard-to-decode stretch (music, a goal replay). Pass --max-context 0 to transcribe to disable cross-window context, which reliably prevents the loop. Recommended for any multi-minute and/or non-English source transcription.
VFX
| Step | What it does | Key params |
|------|-------------|------------|
| materialize_cut | Encode trim spec or raw segment to H.264. Use --inputs for multiple clips — caps at 2 concurrent encodes by default. Never fan out more than 2–3 instances in parallel; each is a full libx264 encode and will exhaust memory at 4K if over-parallelised. | --inputs clip0.json clip1.json, --workers 2 |
| remove_bg | Remove video background via RVM → ProRes 4444 .mov with alpha channel plus a VP9 WebM preview proxy. Store the ProRes path in nobg_src (used by render) and the WebM path in nobg_preview_src (used by browser preview — ProRes can't decode in <video>); keep the original in src. Set remove_bg: true on the item. Long-running (minutes per clip) — always run in the background with --progress so you can monitor status. Use --inputs for multiple clips. | --inputs clip0.mp4 clip1.mp4, --progress, --downsample 0.5, --max-height 720 (matte at display size; faster) |
Preview caches
These produce artifacts the editor reads. Render never reads either one.
| Step | What it does | Key params |
|------|-------------|------------|
| proxy | Full-source, all-intra 720p editing proxy → the proxySrc field. One proxy covers a whole source file, never a window, so the same path is correct for every clip cut from it. | --out <path> (required) · --tonemap for an HDR source |
| normalize_window | Conform just [inpoint, outpoint) of a source to the project's colour space → the normalizedSrc field. Used for clip fan-out projects under settings.normalize: "lazy". | --inpoint · --outpoint · --color-space · --out |
You almost never run proxy by hand. project/init.py encodes one per source at import and records it on both project.sources and tracks[0].items. Where you do need one — an item you built yourself, or a source that moved — ask the server for it instead of computing the path: POST /api/projects/{id}/proxies backfills every video item in the project that has no current proxy, encodes in the background, and writes proxySrc back over SSE.
Select Takes (`montaj/select_takes`)
REQUIRED SUB-SKILL: Load skill select-takes before executing this step.
Overlays (`montaj/overlay`)
REQUIRED SUB-SKILL: Load skill overlay before executing. Also load skill write-overlay before writing JSX.
Trim Spec Architecture
Editing steps do not encode video. Where one outputs a trim spec, it is JSON describing which ranges of the original file to keep:
{"input": "/path/to/original.MOV", "keeps": [[0.0, 5.3], [6.1, 12.4]]}
Rules:
- Pass original source files to editing steps — never pre-encode them
crop_spectakes a trim spec asinputand outputs a refined spec — never pass a video file to it- One encode per clip, then one render pass
- A trim spec is data: nothing writes it to disk for you, so write it to a file (
write a file, per_contract) before a step takes it as--input. Cleaning talk does not go through trim specs:cutedits the project's timeline itself.
CRITICAL — video clip
srcfield:
Any video clip item (in any track) MUST have
srcpointing to a real video file (.MOV,.mp4, etc.) — never a spec JSON file.
For clips derived from trim specs: read
spec["input"]forsrc, andspec["keeps"]to deriveinPoint/outPoint.
The UI preview player seeks into the source file using
inPoint/outPoint. It cannot play a JSON spec.
Multi-keep specs expand into multiple clip items, each with their own
inPoint/outPoint.
Use a materialized (encoded) file as
srcONLY if the workflow explicitly includes amaterialize_cutstep — otherwise always use the original source file.
Workflows
Read the assigned workflow with the get_workflow tool when you have it (the Montaj app serves its templates through it, recipe included); otherwise read workflows/{name}.json from the filesystem.
Built-in workflows:
overlays(the default):cutplan, select takes,cutapply, captions, punch-ins, overlaysblank— empty project, no steps; edit directly per the user's instructionscarousel— N still slides at one fixed aspect ratio, rendered to PNGs; no time axis, no audioai_video— director agent writes a storyboard from your prompt and references, you approve, scenes are generated via Kling
A project can also name a project-local (./workflows/) or user-global (~/.montaj/workflows/) workflow; resolve it the same way.
Deviation Rules
You should deviate only under one conditions:
When the prompt or user intent deviates from the selected workflow:**
- "no captions" → skip caption
- "keep it raw" → skip
cut - "YouTube format" → resize 16:9
If in doubt, ask your human.
Project JSON
States: pending → draft (agent done) → final (human approved)
Structure:
{
"version": "0.2", "id": "<uuid>", "status": "pending",
"workflow": "overlays", "editingPrompt": "...",
"settings": {"resolution": [1080, 1920], "fps": 30},
"tracks": [{"id": "trk-0", "items": [{"id": "clip-0", "type": "video", "src": "/abs/path/clip.mp4", "start": 0.0, "end": 0.0, "proxySrc": "/abs/path/clip_proxy_vivid1.mp4", "sourceDuration": 42.5}]}],
"assets": [], "audio": {}
}
proxySrc is written for you at import — your job is not to lose it. project/init.py encodes one editing proxy per source and records it on project.sources; a new project's timeline is empty (cut builds the talking head from the sources). Whenever you lay or replace tracks[0].items yourself, look each new item's src up in project.sources and copy that entry's proxySrc across verbatim. One proxy covers the whole source file and is never windowed, so the same value is correct for every clip you cut from that source, whatever its inPoint/outPoint.
Dropping it is silent. The project still validates, the render is still correct, and the only symptoms are downstream: preview falls back to decoding the full-resolution master on every seek (roughly 700ms instead of ~50ms on 4K HDR), the WebCodecs engine refuses the project outright because montaj_assets/editor/src/engine/eligibility.ts:69 requires proxySrc on every track-0 item, and the header shows a chip telling the operator their clips have no previews. Nothing repairs it on its own — the project-open look migration only re-points a proxySrc that is present and stale, and skips an item that has none.
Assets — image files (logos, watermarks). Each has id, absolute src, type: "image", optional name. Pass at creation: --assets logo.png (CLI) or "assets": ["/path/logo.png"] (HTTP /api/run).
Update as you work:
- After trim/clean: update
tracks[0].itemsclipsrc; setinPoint/outPointandstart/end(seconds) - After transcribe + caption: set top-level
captions: { "style": "word-by-word", "segments": [...] }— do NOT store a file pointer - A still photo is a
type: "image"clip, not a JSX overlay: overlays are animated graphics, and only image and video clips can be cropped. - Animate a zoom or push with
scaleandoffsetX/offsetYkeyframes on ONE clip (video and image clips take the samekeyframesas overlays: one entry per animated property,{"prop": "scale", "points": [{"t": 0, "value": 1}, {"t": 2, "value": 1.2, "easing": "ease-out"}]}, wheretis seconds from the item's ownstart,propis one ofoffsetX,offsetY,scale,rotation,opacity, andeasingshapes the segment leaving that point:linearby default,ease,ease-in,ease-out,ease-in-outorhold). Never slice a clip into frame-length pieces to fake the move: a run of 2-frame clips steps instead of easing, and every piece is its own encode in the export. - After overlays/images/video: populate
tracks[1+]— each track is an object ({id, items, ...}); itsitemsarray holdstype: "overlay"(JSX),type: "image"(static image), ortype: "video"(video clip with optionalremove_bg: true) - After adding music or any other audio: append to
audio.tracks[]. Give every track anid(mus-a,vo-01) — the editor addresses tracks by id, and several id-less tracks cannot be edited independently. Tracks with nolaneare packed into rows by kind (type): clips of one kind that do not overlap share a row (back to back counts as not overlapping), clips that overlap get separate rows, and music, sfx and voice never share one. Overlapping tracks with nolaneget no automatic fade. To crossfade two clips (a music bed handing off to a second clip), give both the samelaneand overlap them by the crossfade length; the editor then setsfadeIn/fadeOutfrom the overlap, overwriting hand-authored values on that pair. - After all steps: set
status: "draft" - Saving is always GET-fresh → merge your delta → save — the user can edit the project from the UI while the server is running, and a stale save silently overwrites their work (Montaj only auto-commits to git on status transitions, so mid-status edits have no recovery path). The
nativeskill defines how the save resolves per mode (PUT in HTTP, file write in CLI) and carries the full discipline.
HEVC clips: the editing steps read HEVC directly and the render engine conforms it at assembly time. Never manually re-encode before an editing step.
One cut only. Apply cut once; an already-cut project answers already-cut. Fix a seam with speech_text / speech_edit.
File Conventions
- Project directory:
{workspaceDir}/<date>-<name>/(workspaceDirdefaults to~/Montaj, override in~/.montaj/config.json) - Step outputs go next to their inputs
- Trim spec outputs:
<original>_spec.json| concat output:<original>_concat.mp4 - Final render:
output.mp4in project directory - Transcripts:
<clip>_transcript.jsonand<clip>.srt
Sub-skills
Refer to sub-skills by name; the reader resolves the name to a path.
| Skill | When to load |
|-------|-------------|
| native | HTTP or CLI mode — the native interface; load before any step / project interaction |
| mcp | Running as MCP client |
| parallel | Multiple clips, or workflow has foreach steps |
| edit-session | The draft is done and the user wants interactive refinements — cuts, re-timing, new overlays |
| speech-edit | Cutting speech by editing its transcript as text (speech_text, speech_edit), on a project that already has a timeline |
| select-takes | Editing cut-plan.md between cut's plan and its apply |
| overlay | Executing montaj/overlay in a workflow |
| write-overlay | Writing custom JSX overlay components |
| image-search | Sourcing outside imagery (search_images + fetch_image) when the prompt asks for photos / logos / B-roll stills |
| carousel | Executing montaj/carousel in a workflow |
| ai-video-plan | Working on an ai_video project (Phases 0-2: story clarification, storyboard planning) |
| ai-video-generate | Working on an ai_video project (Phases 6-7: scene generation, audio assembly, regenQueue) |
Dependencies
ffmpeg+ffprobe— strongly recommended:zscalefilter (requires libzimg) for accurate HDR→SDR tonemap. Without it, a fallback tonemap runs but with degraded colors. The Montaj app ships with everything here; never ask its user to install anything. On the command line only:montaj doctorchecks (exit 0 = OK, exit 1 = issues) andmontaj install ffmpegfixes it.whisper.cpp(with models in standard location)Python 3.xNode.js(render engine only)