
motionkit
io.github.DoniyorSHAKH/motionkit
Directed, verified 3D vehicle shots from a JSON Scene Spec: validate, preview, verify, render MP4.
Documentation
DFC MotionKit
A cinematic scene engine for AI agents. You describe a short vehicle shot in a JSON Scene Spec. MotionKit directs it in three.js, renders it through HyperFrames, and checks the MP4.
![]()
v0.1.1 (2026-12-04) is the first release on npm, as the @motionkituz/* packages. v0.1.0 was the source-only release. Every number on this page is measured, and the measurements are in BENCHMARKS.md.
What it does
- You write a Spec: the place, the time of day, the weather, the vehicles and their speeds, and the shots. The golden scene is 55 lines of JSON.
- MotionKit validates it. It reports every problem at once, each with its path and a fix, plus a did-you-mean.
- It directs the shot. It compiles the Spec into a scene plan:
- the road path and speed keys become motion;
- each shot becomes a camera rig with lens, framing and moves;
- the time of day sets the sun, sky, street lamps and lit windows.
- It renders the frames. It builds the scene in three.js, and HyperFrames seeks every frame by time. There is no clock and the randomness is seeded, so the same Spec gives the same bytes on the same machine (B4).
- It checks the result:
- on the plan: framing, safe areas, the 180° rule, lead room, focus, wheel spin;
- on the video: format, exposure, and frame-exact determinism;
- on DRAFT stills: pixel checks.
What a Spec saves. In B1, a Spec of 121–277 tokens stood for 20,254–26,232 tokens of MotionKit three.js code that ran for the scene (approximate, offline tokenizer). An agent writes the Spec, not the three.js.
Gallery
Stills from motionkit snapshot of the five example Specs in packages/spec/examples/:
The same scene in the four render profiles (rows: DRAFT, STANDARD, CINEMATIC, ULTRA; columns: 1, 4 and 7 s):

The release files add MP4s of these scenes, made by npm run demos. Each one passed the verifier after it was rendered.
Install
You need:
- Node.js 22.19 or newer;
- FFmpeg and ffprobe on
PATH; - for renders, a machine with a GPU. Tests on software GL work at low resolution.
From npm:
npm install @motionkituz/cli
npx hyperframes browser ensure # the headless Chrome HyperFrames renders with
npx motionkit init scene.json
From source:
git clone https://github.com/DoniyorSHAKH/DFC-MotionKit.git motionkit && cd motionkit
npm ci
npx hyperframes browser ensure # the headless Chrome HyperFrames renders with
npm run build
Catalog assets (HDRI skies, vehicle models, the overlay typeface) download on first use. Each one is checked against its SHA-256 lock.
Quick start
npm run motionkit -- init scene.json # a starting Spec
npm run motionkit -- validate scene.json # every problem, with a fix
npm run motionkit -- snapshot scene.json --profile draft --at 0,2.5,5 # stills and a contact sheet
npm run motionkit -- render scene.json # MP4 through HyperFrames, then the checks
- Search:
npm run motionkit -- find "chase camera at night"searches the 106 components. - Details:
npm run motionkit -- info shot.trackingshows one component, with a complete Spec that uses it. - Reference: the full Spec reference is in
docs/reference/.
The golden scene is a real example:
{
"version": "0.1",
"format": "1920x1080@30",
"duration": 10,
"profile": "standard",
"style": "realistic",
"seed": 42,
"environment": { "type": "city-road", "timeOfDay": 20.0, "weather": "light-rain", "hdri": "auto" },
"actors": [
{
"id": "car1",
"type": "vehicle.sedan",
"material": { "paint": "#C8102E", "finish": "metallic" },
"path": { "type": "road-lane", "lane": 1 },
"speed": [{ "t": 0, "kmh": 0 }, { "t": 3, "kmh": 60 }]
}
],
"camera": [
{ "shot": "establishing", "from": 0, "to": 2.5, "move": "crane-down", "subject": "car1" },
{ "shot": "tracking", "subject": "car1", "from": 2.5, "to": 10, "lens": 35, "side": "left" }
]
}
--formats all renders it as 1920×1080, 1080×1920 and 1080×1080. The vertical and square versions reframe automatically.
What v0.1 can make
| Places | city-road (buildings, street lamps, trees, lit windows) and highway (lanes, guard rails) |
| Weather and light | clear, light rain, rain, snow and fog; any time of day; a procedural sky or four CC0 HDRI skies |
| Vehicles | procedural, rigged sedan, SUV, truck, bus and motorcycle (wheels, steering and suspension follow the motion); six CC0 Kenney models |
| Camera | 8 shot kinds (establishing, tracking, follow, orbit, static, detail, aerial, low-angle); 14 moves; lens, depth of field, rack focus, shake |
| Look | 4 styles; 5 colour looks (teal-orange, warm, cool, bleach-bypass, noir) or none; AgX or ACES tone mapping; exposure |
| Overlays | titles, and labels that follow vehicles, kept inside the safe areas |
| Formats | 16:9, 9:16, 1:1 and 4K, at 24, 30 or 60 fps |
| Profiles | DRAFT, STANDARD, CINEMATIC (post-processing, motion blur), ULTRA |
Not supported, so find answers no: people, animals, interiors, aircraft, rail and water, custom road layouts, collisions, audio, custom assets, time effects, transitions.
For agents
The MCP server has eight tools: find_components, get_component, validate_scene, compile_scene, preview_scene, verify_scene, render_scene, get_render_status. With the repository built, configure it like this:
{ "mcpServers": { "motionkit": { "command": "node", "args": ["<path to MotionKit>/packages/mcp/dist/bin.js"] } } }
- Skill:
skill/SKILL.mdteaches an agent the loop: find, validate, preview, verify with pixels, render. - JSON output: every CLI command takes
--json. - Errors: with
--json, a failed command prints{ error, fix }on stdout, plusproblemswhen the Spec is invalid. The MCP tools return the same shape.
Showcase
npm run showcase serves a local site at http://127.0.0.1:5178/ with:
- a gallery with search and filters;
- a live preview, which is the same page HyperFrames renders;
- an editor generated from the schema;
- the component catalog and the docs.
axe-core finds no WCAG 2.1 A or AA violations on any page in either theme, and the layout fits a 390 px wide phone screen.
![]() | ![]() |
Architecture
Scene Spec (JSON)
→ @motionkituz/spec validate (schema + meaning, fixes) → compile to a ScenePlan
→ @motionkituz/core time, seeded randomness, kinematics, camera and light, evaluated at t
→ @motionkituz/adapter-html the browser runtime: environments, vehicles, materials, post;
drawn only from seek(t)
→ @motionkituz/adapter-hyperframes the plan as a HyperFrames project; preflight, render, chunks, resume
→ @motionkituz/verify plan rules, video checks, pixel QA, determinism
- Packages.
environments,vehicles,materialsandassetshold the scene content.cliandmcpare the two front doors. - Licences. All packages are MIT. GPL code, such as a future Blender bridge, stays in a separate repository.
- Further reading:
- ARCHITECTURE.md: the design and what the spikes measured;
- DECISIONS.md: the decision log and ADRs;
- RESEARCH.md and PRD.md: why MotionKit exists.
Quality
-
Tests:
- 302 unit and integration tests;
- GPU tests for frame hashes, HyperFrames conformance, the MCP session, chunked renders and the showcase;
- a visual regression test on software GL in a container.
The map is in tests/README.md.
-
Coverage:
core97.4 % andspec96.9 % of lines, gated at 85 % (reports/m8/coverage.md). -
Benchmarks: BENCHMARKS.md covers compactness, render time, size and start-up, determinism, diversity and profiles, with the hardware and the scripts.
-
Audits: AUDIT.md and SECURITY.md cover the threat model, licences and asset provenance.
-
CI: lint, typecheck, tests and build, then a DRAFT render on software GL (
.github/workflows/ci.yml).
Limitations
- Platform. Renders are tested on Windows with an integrated GPU. A 2 s clip takes 29 s (DRAFT, 1080p24) to 189 s (CINEMATIC, 4K60) on that laptop.
- Memory. 4K CINEMATIC and ULTRA need about 3.5 GB of free memory. The preflight refuses a render that would not fit.
- No physics, no path tracing. There are no collisions or physics yet. ULTRA is rasterised.
- Assets. The low-poly style looks almost the same as realistic on the shipped scenes. No realistic CC0 vehicle model was found, so the catalog models are stylized.
- Camera placement. The director does not know where the buildings stand. A static shot in 9:16 can end up inside them; the verifier reports it, and a wider lens fixes it.
- Roadmap. Next steps are in ROADMAP.md.
Contributing
See CONTRIBUTING.md and the code of conduct. Report security problems privately (SECURITY.md).
Licence and credits
- Code: MIT (LICENSE).
- Assets: CC0 HDRI skies from Poly Haven and CC0 vehicle models from Kenney. The overlay typeface, Barlow Semi Condensed, is under the SIL Open Font License. Sources, authors and SHA-256 locks are in ASSETS.md.
- Dependencies: MotionKit is built on three.js and renders through HyperFrames. Their licences, and those of every other dependency, are in AUDIT.md.
@motionkituz/mcpnpm install @motionkituz/mcp
