How sibycr18/roast-bob works
Project Type and Purpose
• This is a backend “bot” service written in Python that automates interactions on the Bluesky social network. It monitors trends, responds to mentions, generates content on a schedule, and persists memory via ChromaDB.
• Key use cases: trend analysis, mention handling, AI-driven content generation, memory storage, scheduled posting.
File‐Structure Analysis
• Top‐level:
• main.py: entry point and orchestrator
• mentions_service.py: script or helper for mention processing
• docker-compose.yml: container orchestration (Bluesky‐bot, ChromaDB)
• Directories:
• config/: application settings and constants (settings.py)
• clients/: adapters for external APIs (bluesky_client.py, openai_client.py)
• services/: core business logic broken out by responsibility
– trend_analyzer.py
– content_generator.py
– memory_service.py
– scheduler.py
• utils/: cross‐cutting concerns (logging)
• Persistence:
• chroma_db/chroma.sqlite3: ChromaDB backing store
• Dependencies in requirements.txt, environment variables in .env.
Architectural Patterns and Design Principles
• Modular service layer: each responsibility (trend analysis, content gen, memory) is isolated in its own module.
• Dependency injection via clients/ (so services call clients rather than embed HTTP logic).
• Single orchestrator (main.py) controls scheduling and event loops.
• External integrations: Bluesky API, OpenAI API, ChromaDB as a local datastore.
Main Components
• Orchestrator (main.py)
• Scheduler Service
• Mention Handler Service (mentions_service.py or services/mention_handler.py)
• Trend Analyzer Service
• Content Generator Service
• Memory Service (ChromaDB)
• API Clients
• BlueskyClient
• OpenAIClient
• External Dependencies
• Bluesky Platform
• OpenAI API
• Persistence Layer
• ChromaDB (SQLite file)
• Utility Layer
• Logging subsystem
Relationships and Data Flow
• Scheduler triggers:
• Trend Analyzer → fetch feed via BlueskyClient → analyze trends → Memory Service
• Content Generator → fetch trends from Memory → generate post via OpenAIClient → post via BlueskyClient
• Mention Handler (event‐driven):
• Listens for mention events via BlueskyClient → generates response via OpenAIClient → logs to Memory → replies via BlueskyClient
• Memory Service:
• CRUD operations on ChromaDB
• Shared by all services that need historical context
• Logging calls: all components write to logger via utils/logger.py
Architectural Patterns and Design Principles to Highlight
• Separation of concerns: service layer vs. client layer vs. orchestrator vs. utilities.
• Adapter pattern: clients/ folder abstracts Bluesky/OpenAI API details.
• Scheduler pattern: services/scheduler.py handles timing for automated posts.
• Repository pattern: memory_service.py encapsulates direct database interactions.