How fedotdev/rewrite-from-skill-bot works
This is a Telegram bot that rewrites mentioned messages using a file-backed style and an OpenAI-compatible LLM. The principal flow filters incoming messages, parses a rewrite request before deduplication and rate limiting, loads the current style, calls the model, and replies in Telegram. The graph includes the documented style-reference and in-memory protection behavior. Runtime wiring is shown in the sampled entry point and handler; unsampled implementation details are not inferred.
Main entry points: service.py Rewrite service · main.py Bot runtime · rewrite.py Rewrite handler · client.py LLM client
Components 17
Telegram workflow
- Bot runtime
src/main.py - Message filters
src/handlers/rewrite.py - Rewrite handler
src/handlers/rewrite.py
Rewrite processing
- Mention and request parser
src/core/message_resolver.py - Rewrite data models
src/core/models.py - Rewrite service
src/core/service.py - Message deduplicator
src/core/deduplication.py - Rate limits and warning throttle
src/core/rate_limiter.py
Style resources
- Style loader and cache
src/core/style_loader.py - Rewrite style
runtime_skills/rewrite/SKILL.md - Linked style references
runtime_skills/rewrite/references/genres.md
Runtime integrations
- LLM client
src/llm/client.py - Runtime settings
src/config.py - Logging configuration
src/logging_config.py
Other components
- Telegram user
- Telegram
- OpenAI-compatible LLM
Connections 23
- Telegram user → Telegram: sends message
README.md - Telegram → Bot runtime: delivers updates
README.md - Bot runtime → Telegram: polls updates
src/main.py - Bot runtime → Message filters: registers router
src/main.py - Message filters → Rewrite service: checks mention and chat
src/handlers/rewrite.py - Message filters → Rewrite handler: routes accepted message
src/handlers/rewrite.py - Rewrite handler → Mention and request parser: builds request
src/handlers/rewrite.py - Rewrite handler → Rewrite service: checks protections
src/handlers/rewrite.py - Rewrite handler → Rewrite service: processes request
src/handlers/rewrite.py - Rewrite handler → Telegram: replies with result
src/handlers/rewrite.py - Mention and request parser → Rewrite data models: creates request
src/core/message_resolver.py - Rewrite service → Message deduplicator: checks duplicate
src/core/service.py - Rewrite service → Rate limits and warning throttle: checks limits and warnings
src/core/service.py - Rewrite service → Style loader and cache: loads style
src/core/service.py - Rewrite service → LLM client: rewrites request
src/core/service.py - Style loader and cache → Rewrite style: reads and watches
src/core/style_loader.py - Style loader and cache → Linked style references: loads linked files
README.md - LLM client → Rewrite data models: uses request and result
src/llm/client.py - LLM client → OpenAI-compatible LLM: sends completion request
src/llm/client.py - Runtime settings → LLM client: configures endpoint
src/llm/client.py - Bot runtime → Runtime settings: loads settings
src/main.py - Bot runtime → Logging configuration: sets up logging
src/main.py - LLM client → Runtime settings: loads model settings
src/llm/client.py