# imexlovery/video-report-agent architecture

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

- Interactive diagram: https://gitdiagram.com/imexlovery/video-report-agent
- Repository: https://github.com/imexlovery/video-report-agent

## Overview

Video Report Agent turns a Bilibili video URL into a self-contained HTML reading report, with a standalone Skill workflow as an alternative. The automated path downloads media, extracts audio, transcribes it, optionally fuses subtitle/OCR evidence into a canonical transcript, then uses Pi with the video-report Skill to generate and render a report. Run reuse, tracing, and retention support that workflow. The graph follows documented behavior and shown module references; unsampled implementation details and web-server internals are not inferred.

Main entry points: [`src/video_report_agent/pipeline.py`](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pipeline.py) (Run pipeline), [`src/video_report_agent/pi.py`](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pi.py) (Pi agent adapter), [`src/video_report_agent/asr.py`](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/asr.py) (ASR adapters), [`src/video_report_agent/media_config.py`](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/media_config.py) (Media configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Input and media"]
  node_cli["CLI<br/>[cli.py]"]
  node_pipeline["Run pipeline<br/>[pipeline.py]"]
  node_ingest_media["Video ingest<br/>[ingest.py]"]
  node_audio["Audio extraction<br/>[audio.py]"]
  node_media_config["Media configuration<br/>[media_config.py]"]
end

subgraph group_transcript["Transcript pipeline"]
  node_asr["ASR adapters<br/>[asr.py]"]
  node_paraformer["Paraformer backend<br/>[paraformer.py]"]
  node_transcript_build["Transcript assembly<br/>[transcript.py]"]
  node_foundation["Transcript foundation"]
  node_schemas["Data schemas<br/>[schemas.py]"]
end

subgraph group_report["Report generation"]
  node_skill["Report Skill<br/>[SKILL.md]"]
  node_pi["Pi agent adapter<br/>[pi.py]"]
  node_report_content["Report content checks<br/>[report_content.py]"]
  node_report_image["Report image export<br/>[report_image.py]"]
end

subgraph group_operations["Run support"]
  node_reuse["Artifact reuse<br/>[reuse.py]"]
  node_trace["Run tracing<br/>[trace.py]"]
  node_retention["Run retention<br/>[retention.py]"]
end

node_user(("User / caller"))
node_bilibili["Bilibili"]
node_asr_services["ASR services"]
node_pi_runtime["Pi runtime"]
node_report_file["HTML report"]

node_user -->|"submits URL"| node_cli
node_cli -->|"starts generation"| node_pipeline
node_pipeline -->|"downloads media"| node_ingest_media
node_ingest_media -->|"fetches video"| node_bilibili
node_pipeline -->|"extracts audio"| node_audio
node_pipeline -.->|"resolves settings"| node_media_config
node_media_config -->|"selects backend"| node_asr
node_media_config -->|"configures cloud ASR"| node_paraformer
node_pipeline -->|"transcribes audio"| node_asr
node_asr -->|"dispatches backend"| node_paraformer
node_paraformer -->|"uploads audio"| node_asr_services
node_asr -->|"normalizes segments"| node_schemas
node_pipeline -->|"builds transcript"| node_transcript_build
node_transcript_build -->|"assembles evidence"| node_foundation
node_foundation -->|"probes media"| node_audio
node_pipeline -->|"reuses artifacts"| node_reuse
node_pipeline -->|"generates report"| node_pi
node_pi -->|"runs agent loop"| node_pi_runtime
node_pi -->|"loads instructions"| node_skill
node_pi -->|"checks report"| node_report_content
node_pipeline -->|"exports image"| node_report_image
node_pipeline -->|"writes report"| node_report_file
node_pipeline -->|"records run"| node_trace
node_pipeline -->|"cleans runs"| node_retention

click node_cli "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/cli.py"
click node_pipeline "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pipeline.py"
click node_ingest_media "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/ingest.py"
click node_audio "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/audio.py"
click node_media_config "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/media_config.py"
click node_asr "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/asr.py"
click node_paraformer "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/paraformer.py"
click node_transcript_build "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/transcript.py"
click node_foundation "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/transcript_foundation.py"
click node_schemas "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/schemas.py"
click node_skill "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/skills/video-report/SKILL.md"
click node_pi "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pi.py"
click node_report_content "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/report_content.py"
click node_report_image "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/report_image.py"
click node_reuse "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/reuse.py"
click node_trace "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/trace.py"
click node_retention "https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/retention.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_cli,node_pipeline,node_ingest_media,node_audio,node_media_config,node_user toneBlue
class node_asr,node_paraformer,node_transcript_build,node_foundation,node_schemas toneAmber
class node_skill,node_pi,node_report_content,node_report_image toneMint
class node_reuse,node_trace,node_retention toneRose
class node_bilibili,node_asr_services,node_pi_runtime,node_report_file toneIndigo
```

## Components

### Input and media

- [CLI](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/cli.py): `src/video_report_agent/cli.py`
- [Run pipeline](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pipeline.py): `src/video_report_agent/pipeline.py`
- [Video ingest](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/ingest.py): `src/video_report_agent/ingest.py`
- [Audio extraction](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/audio.py): `src/video_report_agent/audio.py`
- [Media configuration](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/media_config.py): `src/video_report_agent/media_config.py`

### Transcript pipeline

- [ASR adapters](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/asr.py): `src/video_report_agent/asr.py`
- [Paraformer backend](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/paraformer.py): `src/video_report_agent/paraformer.py`
- [Transcript assembly](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/transcript.py): `src/video_report_agent/transcript.py`
- [Transcript foundation](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/transcript_foundation.py): `src/video_report_agent/transcript_foundation.py`
- [Data schemas](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/schemas.py): `src/video_report_agent/schemas.py`

### Report generation

- [Report Skill](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/skills/video-report/SKILL.md): `src/video_report_agent/skills/video-report/SKILL.md`
- [Pi agent adapter](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/pi.py): `src/video_report_agent/pi.py`
- [Report content checks](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/report_content.py): `src/video_report_agent/report_content.py`
- [Report image export](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/report_image.py): `src/video_report_agent/report_image.py`

### Run support

- [Artifact reuse](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/reuse.py): `src/video_report_agent/reuse.py`
- [Run tracing](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/trace.py): `src/video_report_agent/trace.py`
- [Run retention](https://github.com/imexlovery/video-report-agent/blob/main/src/video_report_agent/retention.py): `src/video_report_agent/retention.py`

### Other components

- **User / caller**
- **Bilibili**
- **ASR services**
- **Pi runtime**
- **HTML report**

## Connections

- User / caller → CLI: submits URL (evidence: `README.md`)
- CLI → Run pipeline: starts generation (evidence: `src/video_report_agent/cli.py`)
- Run pipeline → Video ingest: downloads media (evidence: `src/video_report_agent/pipeline.py`)
- Video ingest → Bilibili: fetches video (evidence: `src/video_report_agent/ingest.py`)
- Run pipeline → Audio extraction: extracts audio (evidence: `src/video_report_agent/pipeline.py`)
- Run pipeline → Media configuration: resolves settings (evidence: `src/video_report_agent/pipeline.py`)
- Media configuration → ASR adapters: selects backend (evidence: `src/video_report_agent/media_config.py`)
- Media configuration → Paraformer backend: configures cloud ASR (evidence: `src/video_report_agent/media_config.py`)
- Run pipeline → ASR adapters: transcribes audio (evidence: `src/video_report_agent/pipeline.py`)
- ASR adapters → Paraformer backend: dispatches backend (evidence: `src/video_report_agent/asr.py`)
- Paraformer backend → ASR services: uploads audio (evidence: `src/video_report_agent/paraformer.py`)
- ASR adapters → Data schemas: normalizes segments (evidence: `src/video_report_agent/asr.py`)
- Run pipeline → Transcript assembly: builds transcript (evidence: `src/video_report_agent/pipeline.py`)
- Transcript assembly → Transcript foundation: assembles evidence (evidence: `src/video_report_agent/transcript.py`)
- Transcript foundation → Audio extraction: probes media (evidence: `src/video_report_agent/transcript_foundation.py`)
- Run pipeline → Artifact reuse: reuses artifacts (evidence: `src/video_report_agent/pipeline.py`)
- Run pipeline → Pi agent adapter: generates report (evidence: `src/video_report_agent/pipeline.py`)
- Pi agent adapter → Pi runtime: runs agent loop (evidence: `src/video_report_agent/pi.py`)
- Pi agent adapter → Report Skill: loads instructions (evidence: `README.md`)
- Pi agent adapter → Report content checks: checks report (evidence: `src/video_report_agent/pi.py`)
- Run pipeline → Report image export: exports image (evidence: `src/video_report_agent/pipeline.py`)
- Run pipeline → HTML report: writes report (evidence: `README.md`)
- Run pipeline → Run tracing: records run (evidence: `src/video_report_agent/pipeline.py`)
- Run pipeline → Run retention: cleans runs (evidence: `src/video_report_agent/pipeline.py`)
