# m2menqawsh-maker/motion architecture

> Architecture diagram of the GitHub repository m2menqawsh-maker/motion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/m2menqawsh-maker/motion
- Repository: https://github.com/m2menqawsh-maker/motion

## Overview

Clean Video Workspace is an agentic video-production system: users submit projects through an API, which coordinates authoring and production work toward rendered video outputs. The repository also contains AI planning, provider routing, media acquisition and analysis, reusable recipes, template governance, and a Remotion-based rendering surface. Edges are limited to relationships visible in the README or SOURCE INDEX; several product branches are present in the tree but their internal wiring was not sampled, so those links are left out.

Main entry points: [`ai/planning/creative_planner.py`](https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/creative_planner.py) (Creative planning), [`scripts/core/storage/storage_service.py`](https://github.com/m2menqawsh-maker/motion/blob/main/scripts/core/storage/storage_service.py) (Object storage), [`api/main.py`](https://github.com/m2menqawsh-maker/motion/blob/main/api/main.py) (FastAPI application), [`ai/vision/pipeline.py`](https://github.com/m2menqawsh-maker/motion/blob/main/ai/vision/pipeline.py) (Vision analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Project entry"]
  node_api["FastAPI application<br/>[main.py]"]
  node_pipeline["Project pipeline"]
  node_authoring["Authoring service"]
end

subgraph group_creative["Creative planning"]
  node_planning["Creative planning"]
  node_compose["Composition engine<br/>[compose_engine.py]"]
  node_reuse["Plan reuse<br/>[reuse_engine.py]"]
  node_recipes["Recipe selection<br/>[selector.py]"]
end

subgraph group_ai["AI services"]
  node_router["Capability routing<br/>[router.py]"]
  node_provider["Model providers<br/>[openrouter.py]"]
  node_cache[("AI artifact cache<br/>[service.py]")]
  node_mcp["MCP integrations<br/>[server.py]"]
end

subgraph group_media["Media production"]
  node_acquisition["Asset acquisition<br/>[service.py]"]
  node_media["Media intelligence<br/>[service.py]"]
  node_vision["Vision analysis<br/>[pipeline.py]"]
  node_audio["Audio analysis<br/>[pipeline.py]"]
  node_media_processing["Media processing<br/>[service.py]"]
  node_storage[("Object storage<br/>[storage_service.py]")]
end

subgraph group_render["Rendering"]
  node_registry["Template registry"]
  node_planner["Render planner<br/>[render-planner.ts]"]
  node_compositor["Video compositor"]
  node_renderer["Remotion renderer<br/>[CanonicalVideo.tsx]"]
end

node_user(("Project creator"))
node_output["Produced video"]

node_user -.->|"submits project"| node_api
node_api -.->|"routes production"| node_pipeline
node_api -->|"routes authoring"| node_authoring
node_pipeline -.->|"coordinates planning"| node_planning
node_planning -.->|"composes plan"| node_compose
node_planning -.->|"reuses plans"| node_reuse
node_planning -.->|"selects recipes"| node_recipes
node_router -->|"dispatches models"| node_provider
node_acquisition -->|"stores assets"| node_storage
node_media -.->|"analyzes visuals"| node_vision
node_media -.->|"analyzes audio"| node_audio
node_vision -->|"reads and publishes"| node_cache
node_vision -->|"reads and writes"| node_storage
node_audio -->|"reads and publishes"| node_cache
node_audio -->|"reads and writes"| node_storage
node_media_processing -->|"uses storage"| node_storage
node_planner -.->|"plans rendering"| node_compositor
node_registry -.->|"provides templates"| node_renderer
node_compositor -.->|"assembles render"| node_renderer
node_renderer -.->|"renders video"| node_output
node_mcp -.->|"integrates tools"| node_router

click node_api "https://github.com/m2menqawsh-maker/motion/blob/main/api/main.py"
click node_pipeline "https://github.com/m2menqawsh-maker/motion/blob/main/api/services/pipeline_service.py"
click node_authoring "https://github.com/m2menqawsh-maker/motion/blob/main/api/services/authoring_service.py"
click node_planning "https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/creative_planner.py"
click node_compose "https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/compose_engine.py"
click node_reuse "https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/reuse_engine.py"
click node_recipes "https://github.com/m2menqawsh-maker/motion/blob/main/ai/recipes/selector.py"
click node_router "https://github.com/m2menqawsh-maker/motion/blob/main/ai/routing/router.py"
click node_provider "https://github.com/m2menqawsh-maker/motion/blob/main/ai/providers/openrouter.py"
click node_acquisition "https://github.com/m2menqawsh-maker/motion/blob/main/ai/acquisition/service.py"
click node_media "https://github.com/m2menqawsh-maker/motion/blob/main/ai/media/service.py"
click node_vision "https://github.com/m2menqawsh-maker/motion/blob/main/ai/vision/pipeline.py"
click node_audio "https://github.com/m2menqawsh-maker/motion/blob/main/ai/audio/pipeline.py"
click node_media_processing "https://github.com/m2menqawsh-maker/motion/blob/main/ai/media_processing/service.py"
click node_cache "https://github.com/m2menqawsh-maker/motion/blob/main/ai/cache/service.py"
click node_storage "https://github.com/m2menqawsh-maker/motion/blob/main/scripts/core/storage/storage_service.py"
click node_registry "https://github.com/m2menqawsh-maker/motion/blob/main/registry/template-registry.tsx"
click node_planner "https://github.com/m2menqawsh-maker/motion/blob/main/planner/render-planner.ts"
click node_compositor "https://github.com/m2menqawsh-maker/motion/blob/main/compositor/master-compositor.ts"
click node_renderer "https://github.com/m2menqawsh-maker/motion/blob/main/remotion-app/src/CanonicalVideo.tsx"
click node_mcp "https://github.com/m2menqawsh-maker/motion/blob/main/ai/mcp/compatibility/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_pipeline,node_authoring toneBlue
class node_planning,node_compose,node_reuse,node_recipes toneAmber
class node_router,node_provider,node_cache,node_mcp toneMint
class node_acquisition,node_media,node_vision,node_audio,node_media_processing,node_storage toneRose
class node_registry,node_planner,node_compositor,node_renderer,node_user,node_output toneIndigo
```

## Components

### Project entry

- [FastAPI application](https://github.com/m2menqawsh-maker/motion/blob/main/api/main.py): `api/main.py`
- [Project pipeline](https://github.com/m2menqawsh-maker/motion/blob/main/api/services/pipeline_service.py): `api/services/pipeline_service.py`
- [Authoring service](https://github.com/m2menqawsh-maker/motion/blob/main/api/services/authoring_service.py): `api/services/authoring_service.py`

### Creative planning

- [Creative planning](https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/creative_planner.py): `ai/planning/creative_planner.py`
- [Composition engine](https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/compose_engine.py): `ai/planning/compose_engine.py`
- [Plan reuse](https://github.com/m2menqawsh-maker/motion/blob/main/ai/planning/reuse_engine.py): `ai/planning/reuse_engine.py`
- [Recipe selection](https://github.com/m2menqawsh-maker/motion/blob/main/ai/recipes/selector.py): `ai/recipes/selector.py`

### AI services

- [Capability routing](https://github.com/m2menqawsh-maker/motion/blob/main/ai/routing/router.py): `ai/routing/router.py`
- [Model providers](https://github.com/m2menqawsh-maker/motion/blob/main/ai/providers/openrouter.py): `ai/providers/openrouter.py`
- [AI artifact cache](https://github.com/m2menqawsh-maker/motion/blob/main/ai/cache/service.py): `ai/cache/service.py`
- [MCP integrations](https://github.com/m2menqawsh-maker/motion/blob/main/ai/mcp/compatibility/server.py): `ai/mcp/compatibility/server.py`

### Media production

- [Asset acquisition](https://github.com/m2menqawsh-maker/motion/blob/main/ai/acquisition/service.py): `ai/acquisition/service.py`
- [Media intelligence](https://github.com/m2menqawsh-maker/motion/blob/main/ai/media/service.py): `ai/media/service.py`
- [Vision analysis](https://github.com/m2menqawsh-maker/motion/blob/main/ai/vision/pipeline.py): `ai/vision/pipeline.py`
- [Audio analysis](https://github.com/m2menqawsh-maker/motion/blob/main/ai/audio/pipeline.py): `ai/audio/pipeline.py`
- [Media processing](https://github.com/m2menqawsh-maker/motion/blob/main/ai/media_processing/service.py): `ai/media_processing/service.py`
- [Object storage](https://github.com/m2menqawsh-maker/motion/blob/main/scripts/core/storage/storage_service.py): `scripts/core/storage/storage_service.py`

### Rendering

- [Template registry](https://github.com/m2menqawsh-maker/motion/blob/main/registry/template-registry.tsx): `registry/template-registry.tsx`
- [Render planner](https://github.com/m2menqawsh-maker/motion/blob/main/planner/render-planner.ts): `planner/render-planner.ts`
- [Video compositor](https://github.com/m2menqawsh-maker/motion/blob/main/compositor/master-compositor.ts): `compositor/master-compositor.ts`
- [Remotion renderer](https://github.com/m2menqawsh-maker/motion/blob/main/remotion-app/src/CanonicalVideo.tsx): `remotion-app/src/CanonicalVideo.tsx`

### Other components

- **Project creator**
- **Produced video**

## Connections

- Project creator → FastAPI application: submits project (evidence: `README.md`)
- FastAPI application → Project pipeline: routes production (evidence: `api/main.py`)
- FastAPI application → Authoring service: routes authoring (evidence: `api/main.py`)
- Project pipeline → Creative planning: coordinates planning
- Creative planning → Composition engine: composes plan
- Creative planning → Plan reuse: reuses plans
- Creative planning → Recipe selection: selects recipes
- Capability routing → Model providers: dispatches models (evidence: `ai/routing/router.py`)
- Asset acquisition → Object storage: stores assets (evidence: `ai/acquisition/service.py`)
- Media intelligence → Vision analysis: analyzes visuals (evidence: `ai/media/service.py`)
- Media intelligence → Audio analysis: analyzes audio (evidence: `ai/media/service.py`)
- Vision analysis → AI artifact cache: reads and publishes (evidence: `ai/vision/pipeline.py`)
- Vision analysis → Object storage: reads and writes (evidence: `ai/vision/pipeline.py`)
- Audio analysis → AI artifact cache: reads and publishes (evidence: `ai/audio/pipeline.py`)
- Audio analysis → Object storage: reads and writes (evidence: `ai/audio/pipeline.py`)
- Media processing → Object storage: uses storage (evidence: `ai/media_processing/service.py`)
- Render planner → Video compositor: plans rendering
- Template registry → Remotion renderer: provides templates (evidence: `README.md`)
- Video compositor → Remotion renderer: assembles render
- Remotion renderer → Produced video: renders video (evidence: `README.md`)
- MCP integrations → Capability routing: integrates tools (evidence: `README.md`)
