# amanshakya-code/bitslogicreelautomation architecture

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

- Interactive diagram: https://gitdiagram.com/amanshakya-code/bitslogicreelautomation
- Repository: https://github.com/amanshakya-code/bitslogicreelautomation

## Overview

Bitsnlogic Content Agent automates a YouTube Shorts workflow: discover outliers, develop and verify a script, create and inspect a video, request creator approval, publish, and learn from comments and analytics. `agent.mjs` dispatches workflow stages; `agents.mjs` implements them and uses shared JSON state, Claude Code, YouTube, and Telegram integrations. The README documents the overall stage flow; sampled excerpts show orchestration and selected integration calls, but not every stage implementation, so documented stage links cite the README.

Main entry points: [`agent.mjs`](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agent.mjs) (CLI Runner), [`agents.mjs`](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs) (Video Build), [`lib/llm.mjs`](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/llm.mjs) (Claude Adapter), [`lib/youtube.mjs`](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/youtube.mjs) (YouTube API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Content Workflow"]
  node_cli["CLI Runner<br/>[agent.mjs]"]
  node_research["Outlier Research<br/>[agents.mjs]"]
  node_hooks["Hook Extraction<br/>[agents.mjs]"]
  node_strategy["Topic Strategy<br/>[agents.mjs]"]
  node_script["Script Writing<br/>[agents.mjs]"]
  node_factcheck["Fact Check<br/>[agents.mjs]"]
  node_style["Style Selection<br/>[agents.mjs]"]
  node_video["Video Build<br/>[agents.mjs]"]
  node_framecheck["Frame Review<br/>[agents.mjs]"]
  node_cover["Cover &amp; Caption<br/>[agents.mjs]"]
  node_approval["Approval Gate<br/>[agents.mjs]"]
  node_publish["YouTube Publish<br/>[agents.mjs]"]
  node_replies["Comment Replies<br/>[agents.mjs]"]
  node_analytics["Performance Review<br/>[agents.mjs]"]
  node_learning["Remix &amp; Lessons<br/>[agents.mjs]"]
end

subgraph group_runtime["Runtime Services"]
  node_llm["Claude Adapter<br/>[llm.mjs]"]
  node_store[("JSON State Store<br/>[store.mjs]")]
end

subgraph group_integrations["External Integrations"]
  node_youtube["YouTube API Client<br/>[youtube.mjs]"]
  node_telegram["Telegram Adapter<br/>[telegram.mjs]"]
end

subgraph group_interface["Operations Interface"]
  node_dashboard["Live Dashboard<br/>[dashboard.mjs]"]
end

node_creator(("Creator"))
node_claude{{"Claude Code CLI"}}
node_videoengine{{"tech-shorts Engine"}}
node_youtube_service{{"YouTube"}}
node_telegram_service{{"Telegram"}}

node_cli -->|"dispatches"| node_research
node_cli -->|"dispatches"| node_hooks
node_cli -->|"dispatches"| node_strategy
node_cli -->|"dispatches"| node_script
node_cli -->|"dispatches"| node_factcheck
node_cli -->|"dispatches"| node_style
node_cli -->|"dispatches"| node_video
node_cli -->|"dispatches"| node_framecheck
node_cli -->|"dispatches"| node_cover
node_cli -->|"dispatches"| node_approval
node_cli -->|"dispatches"| node_publish
node_cli -->|"dispatches"| node_replies
node_cli -->|"dispatches"| node_analytics
node_research -->|"extracts hooks"| node_hooks
node_hooks -->|"informs topic"| node_strategy
node_strategy -->|"selects topic"| node_script
node_script -->|"checks claims"| node_factcheck
node_factcheck -->|"requests rewrites"| node_script
node_factcheck -->|"passes script"| node_style
node_style -->|"sets style"| node_video
node_video -->|"builds scenes"| node_framecheck
node_framecheck -->|"provides video"| node_cover
node_cover -->|"submits package"| node_approval
node_creator -->|"reviews video"| node_approval
node_approval -->|"approves upload"| node_publish
node_publish -->|"enables replies"| node_replies
node_publish -->|"provides performance"| node_analytics
node_analytics -->|"classifies result"| node_learning
node_learning -->|"feeds lessons"| node_strategy
node_research -->|"requests analysis"| node_llm
node_script -->|"generates draft"| node_llm
node_video -->|"runs build task"| node_llm
node_cli -->|"loads run state"| node_store
node_llm -->|"loads model config"| node_store
node_publish -->|"uploads video"| node_youtube
node_replies -->|"reads and replies"| node_youtube
node_analytics -->|"fetches metrics"| node_youtube
node_approval -->|"requests approval"| node_telegram
node_cli -->|"sends failure notice"| node_telegram
node_llm -->|"spawns process"| node_claude
node_video -->|"builds episode"| node_videoengine
node_youtube -->|"calls API"| node_youtube_service
node_telegram -->|"calls bot API"| node_telegram_service
node_dashboard -->|"reads state"| node_store
node_dashboard -->|"checks connection"| node_youtube
node_dashboard -->|"checks connection"| node_telegram
node_dashboard -->|"starts commands"| node_cli

click node_cli "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agent.mjs"
click node_research "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_hooks "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_strategy "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_script "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_factcheck "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_style "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_video "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_framecheck "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_cover "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_approval "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_publish "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_replies "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_analytics "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_learning "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs"
click node_llm "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/llm.mjs"
click node_store "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/store.mjs"
click node_youtube "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/youtube.mjs"
click node_telegram "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/telegram.mjs"
click node_dashboard "https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/dashboard.mjs"

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_research,node_hooks,node_strategy,node_script,node_factcheck,node_style,node_video,node_framecheck,node_cover,node_approval,node_publish,node_replies,node_analytics,node_learning toneBlue
class node_llm,node_store toneAmber
class node_youtube,node_telegram toneMint
class node_dashboard toneRose
class node_creator,node_claude,node_videoengine,node_youtube_service,node_telegram_service toneIndigo
```

## Components

### Content Workflow

- [CLI Runner](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agent.mjs): `agent.mjs`
- [Outlier Research](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Hook Extraction](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Topic Strategy](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Script Writing](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Fact Check](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Style Selection](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Video Build](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Frame Review](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Cover & Caption](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Approval Gate](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [YouTube Publish](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Comment Replies](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Performance Review](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`
- [Remix & Lessons](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/agents.mjs): `agents.mjs`

### Runtime Services

- [Claude Adapter](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/llm.mjs): `lib/llm.mjs`
- [JSON State Store](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/store.mjs): `lib/store.mjs`

### External Integrations

- [YouTube API Client](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/youtube.mjs): `lib/youtube.mjs`
- [Telegram Adapter](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/telegram.mjs): `lib/telegram.mjs`

### Operations Interface

- [Live Dashboard](https://github.com/amanshakya-code/bitslogicreelautomation/blob/main/lib/dashboard.mjs): `lib/dashboard.mjs`

### Other components

- **Creator**
- **Claude Code CLI**
- **tech-shorts Engine**
- **YouTube**
- **Telegram**

## Connections

- CLI Runner → Outlier Research: dispatches (evidence: `agent.mjs`)
- CLI Runner → Hook Extraction: dispatches (evidence: `agent.mjs`)
- CLI Runner → Topic Strategy: dispatches (evidence: `agent.mjs`)
- CLI Runner → Script Writing: dispatches (evidence: `agent.mjs`)
- CLI Runner → Fact Check: dispatches (evidence: `agent.mjs`)
- CLI Runner → Style Selection: dispatches (evidence: `agent.mjs`)
- CLI Runner → Video Build: dispatches (evidence: `agent.mjs`)
- CLI Runner → Frame Review: dispatches (evidence: `agent.mjs`)
- CLI Runner → Cover & Caption: dispatches (evidence: `agent.mjs`)
- CLI Runner → Approval Gate: dispatches (evidence: `agent.mjs`)
- CLI Runner → YouTube Publish: dispatches (evidence: `agent.mjs`)
- CLI Runner → Comment Replies: dispatches (evidence: `agent.mjs`)
- CLI Runner → Performance Review: dispatches (evidence: `agent.mjs`)
- Outlier Research → Hook Extraction: extracts hooks (evidence: `README.md`)
- Hook Extraction → Topic Strategy: informs topic (evidence: `README.md`)
- Topic Strategy → Script Writing: selects topic (evidence: `README.md`)
- Script Writing → Fact Check: checks claims (evidence: `README.md`)
- Fact Check → Script Writing: requests rewrites (evidence: `README.md`)
- Fact Check → Style Selection: passes script (evidence: `README.md`)
- Style Selection → Video Build: sets style (evidence: `README.md`)
- Video Build → Frame Review: builds scenes (evidence: `README.md`)
- Frame Review → Cover & Caption: provides video (evidence: `README.md`)
- Cover & Caption → Approval Gate: submits package (evidence: `README.md`)
- Creator → Approval Gate: reviews video (evidence: `README.md`)
- Approval Gate → YouTube Publish: approves upload (evidence: `README.md`)
- YouTube Publish → Comment Replies: enables replies (evidence: `README.md`)
- YouTube Publish → Performance Review: provides performance (evidence: `README.md`)
- Performance Review → Remix & Lessons: classifies result (evidence: `README.md`)
- Remix & Lessons → Topic Strategy: feeds lessons (evidence: `README.md`)
- Outlier Research → Claude Adapter: requests analysis (evidence: `agents.mjs`)
- Script Writing → Claude Adapter: generates draft (evidence: `agents.mjs`)
- Video Build → Claude Adapter: runs build task (evidence: `agents.mjs`)
- CLI Runner → JSON State Store: loads run state (evidence: `agent.mjs`)
- Claude Adapter → JSON State Store: loads model config (evidence: `lib/llm.mjs`)
- YouTube Publish → YouTube API Client: uploads video (evidence: `agents.mjs`)
- Comment Replies → YouTube API Client: reads and replies (evidence: `agents.mjs`)
- Performance Review → YouTube API Client: fetches metrics (evidence: `README.md`)
- Approval Gate → Telegram Adapter: requests approval (evidence: `README.md`)
- CLI Runner → Telegram Adapter: sends failure notice (evidence: `agent.mjs`)
- Claude Adapter → Claude Code CLI: spawns process (evidence: `lib/llm.mjs`)
- Video Build → tech-shorts Engine: builds episode (evidence: `README.md`)
- YouTube API Client → YouTube: calls API (evidence: `lib/youtube.mjs`)
- Telegram Adapter → Telegram: calls bot API (evidence: `lib/telegram.mjs`)
- Live Dashboard → JSON State Store: reads state (evidence: `lib/dashboard.mjs`)
- Live Dashboard → YouTube API Client: checks connection (evidence: `lib/dashboard.mjs`)
- Live Dashboard → Telegram Adapter: checks connection (evidence: `lib/dashboard.mjs`)
- Live Dashboard → CLI Runner: starts commands (evidence: `lib/dashboard.mjs`)
