# osk97/wowclip architecture

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

- Interactive diagram: https://gitdiagram.com/osk97/wowclip
- Repository: https://github.com/osk97/wowclip

## Overview

WowClip is a YouTube-to-short-clips product: a user submits a video, the app validates it, runs an ingestion and feasibility gate, then finds and refines clips for review. The repository also contains a standalone wowClip CLI/reporting engine alongside the documented web pipeline. The graph preserves both branches and the principal transcript, audience-signal, model, and refinement stages. Some wiring is based on README architecture statements or SOURCE INDEX references; unsampled relationships are omitted where those sources do not establish them.

Main entry points: [`pipeline/run.py`](https://github.com/osk97/wowclip/blob/main/pipeline/run.py) (Stage one runner), [`wowClip/wowclip/cli.py`](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/cli.py) (Standalone CLI), [`app/page.tsx`](https://github.com/osk97/wowclip/blob/main/app/page.tsx) (Workflow UI), [`pipeline/clips.py`](https://github.com/osk97/wowclip/blob/main/pipeline/clips.py) (Stage two runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_page["Workflow UI<br/>[page.tsx]"]
  node_validate["URL validation<br/>[route.ts]"]
  node_process["Ingestion endpoint<br/>[route.ts]"]
  node_cliproute["Clip endpoint<br/>[route.ts]"]
  node_results["Clip results<br/>[ClipResults.tsx]"]
end

subgraph group_ingest["Ingestion and gate"]
  node_run["Stage one runner<br/>[run.py]"]
  node_transcript["Transcript retrieval<br/>[transcript.py]"]
  node_fetch["Video fetching<br/>[ytdlp_fetch.py]"]
  node_comments["Comment signals<br/>[comments.py]"]
  node_heatmap["Replay heatmap<br/>[heatmap.py]"]
  node_analytics["Audience analytics<br/>[analytics.py]"]
  node_bouncer["Feasibility gate<br/>[bouncer.py]"]
end

subgraph group_clips["Clip discovery"]
  node_cliprun["Stage two runner<br/>[clips.py]"]
  node_bridge["Engine bridge<br/>[bridge.py]"]
  node_payload["Prompt payload<br/>[build_payload.py]"]
  node_finder["Category finders<br/>[find_clips.py]"]
  node_refine["Clip refinement<br/>[refine_clips.py]"]
end

subgraph group_standalone["Standalone engine"]
  node_cli["Standalone CLI<br/>[cli.py]"]
  node_standalonefetch["Source fetch<br/>[fetch.py]"]
  node_wordtiming["Word timing<br/>[words.py]"]
  node_standalonefinder["Clip finder<br/>[finder.py]"]
  node_standalonepayload["Prompt assembly<br/>[payload.py]"]
  node_report["HTML report<br/>[report_html.py]"]
end

subgraph group_shared["Shared services"]
  node_youtube["YouTube helpers<br/>[youtube.ts]"]
  node_events["Pipeline events<br/>[events.py]"]
  node_store[("Run storage<br/>[store.py]")]
  node_llm["Model client<br/>[llm.py]"]
end

node_user(("Video creator"))
node_youtubeext["YouTube services"]
node_openrouter["OpenRouter"]

node_user -->|"submits video"| node_page
node_page -->|"validates URL"| node_validate
node_validate -->|"checks format"| node_youtube
node_validate -->|"looks up metadata"| node_youtubeext
node_page -->|"starts gate"| node_process
node_process -->|"runs stage one"| node_run
node_page -->|"requests clips"| node_cliproute
node_cliproute -->|"runs stage two"| node_cliprun
node_cliproute -->|"streams results"| node_results
node_run -->|"loads transcript"| node_transcript
node_run -->|"fetches source"| node_fetch
node_run -->|"collects comments"| node_comments
node_run -->|"loads replay data"| node_heatmap
node_run -->|"uses analytics"| node_analytics
node_run -->|"evaluates feasibility"| node_bouncer
node_run -->|"emits progress"| node_events
node_run -->|"persists run data"| node_store
node_bouncer -->|"publishes events"| node_events
node_bouncer -.->|"requests verdict"| node_openrouter
node_cliprun -->|"invokes engine"| node_bridge
node_cliprun -->|"emits progress"| node_events
node_cliprun -->|"uses run storage"| node_store
node_bridge -.->|"builds input"| node_payload
node_payload -.->|"supplies prompt"| node_finder
node_finder -.->|"requests selection"| node_llm
node_finder -.->|"refines candidates"| node_refine
node_cli -->|"fetches source"| node_standalonefetch
node_cli -->|"runs finder"| node_standalonefinder
node_cli -->|"assembles prompt"| node_standalonepayload
node_cli -->|"renders report"| node_report
node_standalonefetch -->|"uses word timing"| node_wordtiming
node_standalonefinder -.->|"calls model"| node_openrouter

click node_page "https://github.com/osk97/wowclip/blob/main/app/page.tsx"
click node_validate "https://github.com/osk97/wowclip/blob/main/app/api/validate/route.ts"
click node_youtube "https://github.com/osk97/wowclip/blob/main/app/lib/youtube.ts"
click node_process "https://github.com/osk97/wowclip/blob/main/app/api/process/route.ts"
click node_cliproute "https://github.com/osk97/wowclip/blob/main/app/api/clips/route.ts"
click node_results "https://github.com/osk97/wowclip/blob/main/app/components/ClipResults.tsx"
click node_run "https://github.com/osk97/wowclip/blob/main/pipeline/run.py"
click node_transcript "https://github.com/osk97/wowclip/blob/main/pipeline/transcript.py"
click node_fetch "https://github.com/osk97/wowclip/blob/main/pipeline/ytdlp_fetch.py"
click node_comments "https://github.com/osk97/wowclip/blob/main/pipeline/comments.py"
click node_heatmap "https://github.com/osk97/wowclip/blob/main/pipeline/heatmap.py"
click node_analytics "https://github.com/osk97/wowclip/blob/main/pipeline/analytics.py"
click node_bouncer "https://github.com/osk97/wowclip/blob/main/pipeline/bouncer.py"
click node_events "https://github.com/osk97/wowclip/blob/main/pipeline/events.py"
click node_store "https://github.com/osk97/wowclip/blob/main/pipeline/store.py"
click node_cliprun "https://github.com/osk97/wowclip/blob/main/pipeline/clips.py"
click node_bridge "https://github.com/osk97/wowclip/blob/main/pipeline/bridge.py"
click node_payload "https://github.com/osk97/wowclip/blob/main/final_transcript/build_payload.py"
click node_finder "https://github.com/osk97/wowclip/blob/main/final_transcript/find_clips.py"
click node_llm "https://github.com/osk97/wowclip/blob/main/final_transcript/llm.py"
click node_refine "https://github.com/osk97/wowclip/blob/main/final_transcript/refine_clips.py"
click node_cli "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/cli.py"
click node_standalonefetch "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/fetch.py"
click node_wordtiming "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/words.py"
click node_standalonefinder "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/finder.py"
click node_standalonepayload "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/payload.py"
click node_report "https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/report_html.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_page,node_validate,node_process,node_cliproute,node_results toneBlue
class node_run,node_transcript,node_fetch,node_comments,node_heatmap,node_analytics,node_bouncer toneAmber
class node_cliprun,node_bridge,node_payload,node_finder,node_refine,node_openrouter toneMint
class node_cli,node_standalonefetch,node_wordtiming,node_standalonefinder,node_standalonepayload,node_report toneRose
class node_youtube,node_events,node_store,node_llm,node_user,node_youtubeext toneIndigo
```

## Components

### Web experience

- [Workflow UI](https://github.com/osk97/wowclip/blob/main/app/page.tsx): `app/page.tsx`
- [URL validation](https://github.com/osk97/wowclip/blob/main/app/api/validate/route.ts): `app/api/validate/route.ts`
- [Ingestion endpoint](https://github.com/osk97/wowclip/blob/main/app/api/process/route.ts): `app/api/process/route.ts`
- [Clip endpoint](https://github.com/osk97/wowclip/blob/main/app/api/clips/route.ts): `app/api/clips/route.ts`
- [Clip results](https://github.com/osk97/wowclip/blob/main/app/components/ClipResults.tsx): `app/components/ClipResults.tsx`

### Ingestion and gate

- [Stage one runner](https://github.com/osk97/wowclip/blob/main/pipeline/run.py): `pipeline/run.py`
- [Transcript retrieval](https://github.com/osk97/wowclip/blob/main/pipeline/transcript.py): `pipeline/transcript.py`
- [Video fetching](https://github.com/osk97/wowclip/blob/main/pipeline/ytdlp_fetch.py): `pipeline/ytdlp_fetch.py`
- [Comment signals](https://github.com/osk97/wowclip/blob/main/pipeline/comments.py): `pipeline/comments.py`
- [Replay heatmap](https://github.com/osk97/wowclip/blob/main/pipeline/heatmap.py): `pipeline/heatmap.py`
- [Audience analytics](https://github.com/osk97/wowclip/blob/main/pipeline/analytics.py): `pipeline/analytics.py`
- [Feasibility gate](https://github.com/osk97/wowclip/blob/main/pipeline/bouncer.py): `pipeline/bouncer.py`

### Clip discovery

- [Stage two runner](https://github.com/osk97/wowclip/blob/main/pipeline/clips.py): `pipeline/clips.py`
- [Engine bridge](https://github.com/osk97/wowclip/blob/main/pipeline/bridge.py): `pipeline/bridge.py`
- [Prompt payload](https://github.com/osk97/wowclip/blob/main/final_transcript/build_payload.py): `final_transcript/build_payload.py`
- [Category finders](https://github.com/osk97/wowclip/blob/main/final_transcript/find_clips.py): `final_transcript/find_clips.py`
- [Clip refinement](https://github.com/osk97/wowclip/blob/main/final_transcript/refine_clips.py): `final_transcript/refine_clips.py`

### Standalone engine

- [Standalone CLI](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/cli.py): `wowClip/wowclip/cli.py`
- [Source fetch](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/fetch.py): `wowClip/wowclip/fetch.py`
- [Word timing](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/words.py): `wowClip/wowclip/words.py`
- [Clip finder](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/finder.py): `wowClip/wowclip/finder.py`
- [Prompt assembly](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/payload.py): `wowClip/wowclip/payload.py`
- [HTML report](https://github.com/osk97/wowclip/blob/main/wowClip/wowclip/report_html.py): `wowClip/wowclip/report_html.py`

### Shared services

- [YouTube helpers](https://github.com/osk97/wowclip/blob/main/app/lib/youtube.ts): `app/lib/youtube.ts`
- [Pipeline events](https://github.com/osk97/wowclip/blob/main/pipeline/events.py): `pipeline/events.py`
- [Run storage](https://github.com/osk97/wowclip/blob/main/pipeline/store.py): `pipeline/store.py`
- [Model client](https://github.com/osk97/wowclip/blob/main/final_transcript/llm.py): `final_transcript/llm.py`

### Other components

- **Video creator**
- **YouTube services**
- **OpenRouter**

## Connections

- Video creator → Workflow UI: submits video
- Workflow UI → URL validation: validates URL
- URL validation → YouTube helpers: checks format (evidence: `app/api/validate/route.ts`)
- URL validation → YouTube services: looks up metadata
- Workflow UI → Ingestion endpoint: starts gate
- Ingestion endpoint → Stage one runner: runs stage one
- Workflow UI → Clip endpoint: requests clips
- Clip endpoint → Stage two runner: runs stage two
- Clip endpoint → Clip results: streams results
- Stage one runner → Transcript retrieval: loads transcript (evidence: `pipeline/run.py`)
- Stage one runner → Video fetching: fetches source (evidence: `pipeline/run.py`)
- Stage one runner → Comment signals: collects comments (evidence: `pipeline/run.py`)
- Stage one runner → Replay heatmap: loads replay data (evidence: `pipeline/run.py`)
- Stage one runner → Audience analytics: uses analytics (evidence: `pipeline/run.py`)
- Stage one runner → Feasibility gate: evaluates feasibility (evidence: `pipeline/run.py`)
- Stage one runner → Pipeline events: emits progress (evidence: `pipeline/run.py`)
- Stage one runner → Run storage: persists run data (evidence: `pipeline/run.py`)
- Feasibility gate → Pipeline events: publishes events (evidence: `pipeline/bouncer.py`)
- Feasibility gate → OpenRouter: requests verdict
- Stage two runner → Engine bridge: invokes engine (evidence: `pipeline/clips.py`)
- Stage two runner → Pipeline events: emits progress (evidence: `pipeline/clips.py`)
- Stage two runner → Run storage: uses run storage (evidence: `pipeline/clips.py`)
- Engine bridge → Prompt payload: builds input
- Prompt payload → Category finders: supplies prompt
- Category finders → Model client: requests selection
- Category finders → Clip refinement: refines candidates
- Standalone CLI → Source fetch: fetches source (evidence: `wowClip/wowclip/cli.py`)
- Standalone CLI → Clip finder: runs finder (evidence: `wowClip/wowclip/cli.py`)
- Standalone CLI → Prompt assembly: assembles prompt (evidence: `wowClip/wowclip/cli.py`)
- Standalone CLI → HTML report: renders report (evidence: `wowClip/wowclip/cli.py`)
- Source fetch → Word timing: uses word timing (evidence: `wowClip/wowclip/fetch.py`)
- Clip finder → OpenRouter: calls model
