cut-as-code
AGENTS.md16 starsChanged 4 months agoMITView on GitHub
π This section must never be modified. Leave it byte-for-byte unchanged. cut-as-code is a stack of agentic video-editing skills plus its local Editor Plugin and browser UI. Each directory under skills/<name>/ is a self-contained skill: a SKILL.md (the agent playbook β read it first), plus scripts/, examples/, and reference/. Plugin runtime code lives under .codex-plugin/, runtime/, and ui/; the stable desktop bootstrap lives under launcher/. There is no root build, package manifest, lint config, or aggregate test suite. Scripts andβ¦
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,843 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository11 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- cut-as-codeSkill
- video-add-b-rollSkill
- video-add-captionsSkill
- video-add-content-cardsSkill
- video-add-motion-graphicsSkill
- video-color-gradeSkill
- video-cutSkill
- video-edit-compareSkill
- video-to-shortsSkill
- video-understandSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
β0
Common Β· estimate
Many files like this have a rule of this kind.
β6
Distinctive Β· estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Prefer small PRs focused on one feature, one bug fix, one chore, or one refactor.
- Distinctive: line 16
Use Conventional Commit style for PR titles:
- Distinctive: line 24
Default to squash merge.
- Very specific: line 72
When several pixel operations are active on one sequence, the canonical order is cut -> color-grade -> b-roll -> captions -> content-cards β¦
- Distinctive: line 101
Never write a fake human response for an Agent decision.
- Distinctive: line 108
Default review uses stills, contact sheets, boundary reels, and short previews.
- Very specific: line 132
Code is the edit: No timeline scrubbing. The edit is always text you can read, diff, and re-render: a JSON cut plan β¦
- Distinctive: line 150
Self-check is non-negotiable: Every skill ends by verifying its own output (re-transcribe the cut, screenshot stills, eyeball a card/skin β¦
- Very specific: line 226
Prefer python -m unittest over pytest β the suites use unittest fixtures and mock.patch throughout, and no pytest config exists.
β βCommonβ is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. βVery specificβ is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Git
π This section must never be modified. Leave it byte-for-byte unchanged.
- Prefer small PRs focused on one feature, one bug fix, one chore, or one refactor.
- Use branches:
feat/<short-name>fix/<short-name>chore/<short-name>refactor/<short-name>docs/<short-name>
- Use Conventional Commit style for PR titles:
feat(editor): add marquee selectionfix(runtime): handle missing tween statedocs(agents): update collaboration rules
- PR descriptions must include:
- What changed
- Why it changed
- How it was checked
- Default to squash merge.
What this repo is
cut-as-code is a stack of agentic video-editing skills plus its local Editor Plugin and
browser UI. Each directory under skills/<name>/ is a self-contained skill: a SKILL.md
(the agent playbook β read it first), plus scripts/, examples/, and reference/.
Plugin runtime code lives under .codex-plugin/, runtime/, and ui/; the
stable desktop bootstrap lives under launcher/. There is no root build, package manifest,
lint config, or aggregate test suite. Scripts and checks run ad hoc. When you change a skill,
the SKILL.md is the spec; keep it and its scripts in sync.
Each SKILL.md starts with YAML frontmatter (name:, description:) β the name is the
slash-command trigger for that skill.
Skills
| Skill | Job | Stack |
video-understand | Shared media probe, word-level transcript, objective analysis, and evidence-backed semantic understanding | Python Β· ffprobe Β· faster-whisper |
video-cut | Raw long video β compact first cut (download, transcribe, diagnose, hand-written JSON cut plan, varispeed, render, self-check) | Python Β· yt-dlp Β· ffmpeg Β· faster-whisper |
video-edit-compare | Original versus actual final pixels projected onto the source clock | Python Β· ffmpeg Β· Pillow |
video-color-grade | Assess footage β corrective base + named looks β human picks β bake .cube LUT + apply | Python Β· ffmpeg Β· numpy Β· Pillow |
video-add-b-roll | Selective transcript-timed visual cutaways from local media or Pexels, with provenance, review, and normalized overlays | Python Β· ffmpeg Β· Pillow Β· Pexels API |
video-add-motion-graphics | Add selective licensed web-sourced motion graphics as deterministic overlays | HyperFrames Β· Python Β· Pillow |
video-add-captions | Preset-driven, word-timed captions with optional karaoke | HyperFrames Β· ffmpeg |
video-add-content-cards | Add selective transcript-timed titles, lower-thirds, statistics, quotes, and chapter cards | HyperFrames Β· ffmpeg |
video-to-shorts | Find, review, and render short vertical clips from long-form video | Python Β· ffmpeg |
Shared project protocol V1
- Skills are optional and composable; there is no fixed global pipeline. A project can run cards directly or cut β color grade β cards.
work/project.jsonis the only shared manifest. It records operation dependencies, statuses, render contributions, integerrevisionvalues, andbased_onchecks.work/timeline.jsonis the custom one-source, chronological source-to-program mapping. V1 does not use OpenTimelineIO or support reordered/duplicated clips or nonlinear speed.- Canonical time values are seconds. All ranges are half-open
[start_s, end_s)and use explicitsource_rangeandprogram_rangeobjects. - Each operation declares a
target(sequenceand scope) andeffectssuch as timeline, pixel, geometry, audio, or added-track changes. - Render contribution kinds are
timeline-transform,video-filter,audio-filter,overlay,precomputed-asset, andoutput-constraint. - Domain decisions remain in
work/cut/edit-plan.json,work/color-grade/grade-plan.json,work/b-roll/broll-plan.json,work/motion-graphics/motion-graphics-plan.json,work/content-cards/cards-plan.json,work/captions/captions-plan.json, andwork/shorts/shorts-plan.json. - When several pixel operations are active on one sequence, the canonical order is
cut -> color-grade -> b-roll -> captions -> content-cards -> motion-graphics. This relative order applies to every selected pair among captions, content cards, and motion graphics. Captions establish a reserved subtitle region that neither downstream operation may occupy. - For content cards and motion graphics, the visible face and head silhouette of every primary or foreground person, speaker, presenter, interviewee, or semantically important person is a hard exclusion zone throughout the complete cue. An incidental background-only person who is not a narrative or visual focus is exempt; when classification is uncertain, protect the person. If an overlay intersects a protected face or head, reposition it first, then scale or redesign it; skip the cue if no compliant placement exists.
- B-roll adds a
b-rolltrack and changes video pixels only; it leaves timeline, geometry, and audio untouched. Shots carry real probe/byte/SHA-256/provenance records, are normalized to timeline dimensions and exact rational FPS with the selected LUT pre-applied when color grade is active, and pass a two-stage gate: exact-candidate review, then a completed visual review bound to the final delivery. Missing or weak media becomesskippedβ an approved all-skipped plan is a valid no-op. Never substitute fallback media. - Caption cues use program time mapped from the canonical source transcript through
timeline.json; they preserve source evidence and contribute a transparent PNG sequence overlay at the exact rational timeline FPS. Browser runtime assets must be local and hashed. - Motion-graphics cues require verified video understanding, exact permissive source licenses, frozen local source/port/review hashes, deterministic native HyperFrames time, and transparent PNG sequence overlays at the exact rational timeline FPS. The shared compiler revalidates the plan and every delivery binding before rendering.
- Shorts consume the verified main delivery plus a program-time transcript. The
shortsoperation is present in the DAG but absent fromsequences.main.operations, so derivative media underfinal/shorts/never changes or re-renders the main delivery. - Human and explicitly delegated Agent decisions are both valid when the domain receipt names the decision mode, binds reviewed artifacts by hash, and stores a non-empty rationale. Never write a fake human response for an Agent decision.
- User-facing files live in
input/,review/, andfinal/;work/cache/is disposable. - Compile approved active operations with
build_render_plan.py, then render delivery once withrender_project.py. Timeline changes require audio filtering/encoding;-c:a copyis valid only when no active operation cuts, concatenates, retimes, or filters audio. video-edit-compareruns after final delivery and supports onlyoriginal-vs-final-source-time.- Default review uses stills, contact sheets, boundary reels, and short previews. Render a full-length intermediate only when a whole-program pacing decision requires it.
- Preserve compatibility adapters for current edit, looks, and cue formats until every documented consumer has migrated.
- Image-sequence overlays declare
asset_type, a basename-only printfpattern,start_number, and rationalfps; the compiler requires the directory, first frame, and FPS match before delivery rendering.
Architecture that spans skills
These conventions are shared and load-bearing β match them in any new skill:
projectlib.pyis the shared runtime.skills/video-understand/scripts/projectlib.pyis imported directly (no package install) by every multi-skill script. It owns: project JSON validation, revision/staleness checks,map_transcript_to_timeline,build_render_plan, and durablewrite_json. Any new cross-skill script imports it by putting it onsys.pathor running from a directory where it's co-located.- The transcript is the shared interchange format.
skills/video-understand/scripts/transcribe.pyis the canonical transcriber (faster-whisper, CPU/int8, VAD, word-level). It emitstranscript.json=segments[] β words[]with per-wordstart/end. Note it is English-only (base.en,language="en"); for other languages the caller swaps the model/lang β downstream scripts only consume the resulting JSON. - Code is the edit. No timeline scrubbing. The edit is always text you can read, diff,
and re-render: a JSON cut plan (
edit_coarse.json/edit_final.json), alooks.json, ancards-plan.json, or caption cues. Beats land on the spoken word by grepping the transcript for the phrase and reading itsstarttime. - Human decides content; scripts do precision. Editorial calls (what to keep, which look, what a card says) are hand-authored; scripts handle boundary alignment, dead-air reclaim, varispeed, LUT baking, compositing.
work/for intermediates, deliverable to project root /out/. Outputs go to the passed--outdirs (durable), never a system temp dir.- API keys come from skill-local
.env, never from chat or argv.video-add-b-rollreadsPEXELS_API_KEYfrom the environment first, thenskills/video-add-b-roll/.env(gitignored). If both are blank, stop and ask the user to add it to that file. Never put a key in a command argument, plan, URL, log, review artifact, or response. - Self-check is non-negotiable. Every skill ends by verifying its own output (re-transcribe the cut, screenshot stills, eyeball a card/skin strip) before declaring done. Don't skip it.
- Two render families:
- ffmpeg/Python standalone operations copy audio when they do not change time. The
shared delivery renderer encodes audio after cuts, concatenation, varispeed, or an
audio filter; otherwise it uses
-c:a copy. - HyperFrames (
video-add-captions,video-add-content-cards,video-add-motion-graphics) renders transparent overlays at the source dimensions, then ffmpeg-composites them onto the source.
- ffmpeg/Python standalone operations copy audio when they do not change time. The
shared delivery renderer encodes audio after cuts, concatenation, varispeed, or an
audio filter; otherwise it uses
- Review before delivery. Color grade records a human or delegated agent look choice; content cards uses interview and candidate-review gates before rendering.
Windows / ffmpeg gotchas (this repo is developed on Windows)
- Drive-colon paths break ffmpeg filtergraph options that take a path (
lut3d,metadata=print:file=). The pattern used throughout: run ffmpeg withcwdset to the file's folder and reference it by basename. Keep this for any new path-taking filter. - Never use ffmpeg
drawtextfor labels. Thefontfiledrive-colon path is unreliable on Windows. Render text to a PIL PNG and overlay it (seevideo-color-grade). Fonts are configured at the top of the relevant script. - Bash
grep/sedone-liners in SKILL.md won't run in PowerShell. Capture ffmpeg output to a file and parse with Python instead.
Common commands
There is no root build, package manifest, or aggregate runner. Pipeline commands live inside
each SKILL.md; the checks below are the repo-wide ones. Run everything from the repo root.
Sanity-check tool availability before running a pipeline:
ffmpeg -version, ffprobe -version, yt-dlp --version,
python -c "import faster_whisper", python -c "import PIL", node --version (>= 22, for
the HyperFrames .mjs scripts in video-add-captions).
# transcribe (the shared step) β produces transcript.json + .srt
ffmpeg -y -i work/source.mp4 -ac 1 -ar 16000 work/audio16k.wav
python skills/video-understand/scripts/transcribe.py work/audio16k.wav work/transcriptTests and checks
Tests are plain unittest modules under skills/<name>/tests/; each puts its own
scripts/ and video-understand/scripts/ on sys.path, so no install or PYTHONPATH is
needed. There is no discover root that covers them all β run them per skill:
python -m unittest skills/video-add-b-roll/tests/test_broll.py # 155 tests, ~50s
python -m unittest skills/video-add-motion-graphics/tests/test_motion_graphics_plan.py
python -m unittest skills/video-cut/tests/test_inspect_bounds.py
python -m unittest skills/video-edit-compare/tests/test_make_compare.py
# one test case / one test
python -m unittest skills.video-cut.tests.test_inspect_bounds.InspectBoundsTests -v
python -m unittest skills/video-add-b-roll/tests/test_broll.py -k pexels -vcheck_*.py scripts are self-contained regression harnesses with fixtures baked in β they
take no project argument and print a passed line per check:
python skills/video-understand/scripts/check_protocol_extensions.py # shared protocol
python skills/video-cut/scripts/check_project_protocol.py
python skills/video-add-captions/scripts/check_project_protocol.py
python skills/video-to-shorts/scripts/check_project_protocol.py # wraps check_review_ui.py
node skills/video-add-captions/scripts/check_caption_style_config.mjs
node skills/video-add-captions/scripts/check_caption_interaction.mjsSome b-roll tests shell out to ffmpeg and print UnicodeDecodeError tracebacks from
subprocess reader threads on Windows (non-UTF-8 ffmpeg output). Those are noise β trust the
final OK/FAILED line. As of this writing video-to-shorts/scripts/check_review_ui.py
has 2 pre-existing failures (fake_render() missing video_preset); everything else above
passes.
Prefer python -m unittest over pytest β the suites use unittest fixtures and
mock.patch throughout, and no pytest config exists.
Repo conventions
CLAUDE.mdandAGENTS.mdmust stay byte-identical. They were once hardlinked but are now separate files; apply every edit to both.- Editor UI verification. Work under
ui/must use Playwright with installed Chrome for screenshot-based visual inspection and interaction verification; typecheck/build alone are insufficient. work/,docs/,/tests/, and.envare gitignored. Product source includesskills/plus the Plugin, editor runtime/UI, packaging, and launcher directories. A video project lives outside the repo and is addressed by an explicit project root, so scripts take paths, never assume cwd is the project.- Never commit
docs/β includingdocs/superpowers/β under any circumstance. It is local scratch and vendored material. Never stage it, never force-add it (git add -f), and never remove it from.gitignore. If a commit or PR would include anything underdocs/, drop those paths and say so instead of committing them. .github/workflows/clawhub-publish.ymlpublishesskills/to ClawHub (dry-run on PRs, real publish onmain). A skill directory'sSKILL.mdfrontmatternameis its published slug and slash-command trigger β renaming a directory renames the command.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

