---
name: ai-news-digest
description: "Daily AI News Digest Bot that aggregates RSS feeds from 20 AI news sources, uses AI to filter for relevance and importance, compiles top stories into digestible formats, and delivers via Discord/Telegram. Use when: (1) building automated AI news monitoring systems, (2) setting up daily/periodic AI news digests for teams or communities, (3) creating production-ready RSS aggregation with AI filtering, (4) delivering curated AI news content to Discord or Telegram channels. Targets 5 top stories daily from comprehensive source monitoring."
---

# AI News Digest Bot

A production-ready system that automatically aggregates AI news from 20 high-quality sources, filters articles using AI for relevance and importance, and delivers polished daily digests to Discord and Telegram channels.

## Overview

This skill implements a complete AI news pipeline:

1. **RSS Aggregation**: Monitors 20 carefully selected AI news sources
2. **AI Filtering**: Uses LLM to score articles for relevance, importance, novelty, and quality  
3. **Digest Compilation**: Formats top stories for optimal platform delivery
4. **Automated Delivery**: Sends to Discord/Telegram with proper formatting and chunking

Perfect for AI teams, communities, and professionals who need consistent, high-quality AI news curation.

## Quick Start

### Basic Usage

```bash
# Run complete pipeline with default settings
python3 scripts/run_digest.py run

# Generate Discord and Telegram formats
python3 scripts/run_digest.py run --formats discord telegram

# Test individual components
python3 scripts/run_digest.py test rss
python3 scripts/run_digest.py status
```

### Configuration

Set environment variables:

```bash
export OPENAI_API_KEY="your-openai-key"
export DISCORD_WEBHOOK="https://discord.com/api/webhooks/your-webhook"
export TELEGRAM_BOT_TOKEN="your-bot-token"
export TELEGRAM_CHAT_ID="your-chat-id"
```

### Daily Automation

Add to crontab for daily 9 AM UTC delivery:

```bash
0 9 * * * cd /path/to/skill && python3 scripts/run_digest.py run >> logs/digest.log 2>&1
```

## Core Components

### 1. RSS Aggregation (`scripts/rss_aggregator.py`)

Monitors 20 premium AI news sources including:
- **Research**: OpenAI, Anthropic, Google AI, DeepMind, MIT Tech Review
- **Industry**: TechCrunch AI, VentureBeat AI, The Information
- **Technical**: Ars Technica, IEEE Spectrum, Papers With Code
- **Ethics & Safety**: AI Ethics Lab, AI Safety News

**Features:**
- Parallel feed processing with respectful rate limiting
- Automatic deduplication by content hash
- Configurable age filtering (default: 24 hours)
- Error handling with graceful degradation
- Caching for reliability and debugging

**Usage:**
```bash
# Fetch all sources
python3 scripts/rss_aggregator.py --sources references/sources.json --max-age 24

# Custom output
python3 scripts/rss_aggregator.py --output today_articles.json
```

### 2. AI Filtering (`scripts/ai_filter.py`)

Uses OpenAI GPT models to score each article on:
- **Relevance** (0-10): How relevant to AI developments
- **Importance** (0-10): Significance for the AI field  
- **Novelty** (0-10): How new or unique the information is
- **Quality** (0-10): Writing quality and informativeness

**Features:**
- Intelligent fallback scoring when AI unavailable
- Category classification (research/product/funding/partnership/etc.)
- Rate limiting and error handling
- Batch processing with progress tracking

**Usage:**
```bash
# Filter articles with minimum score threshold
python3 scripts/ai_filter.py articles.json --min-score 6.0 --max-articles 50

# Get top 5 stories only
python3 scripts/ai_filter.py articles.json --top-stories 5

# Use different model
python3 scripts/ai_filter.py articles.json --model gpt-4
```

### 3. Digest Compilation (`scripts/digest_compiler.py`)

Transforms filtered articles into platform-optimized formats:

**Discord Format:**
- Markdown formatting with embeds
- Category grouping with emojis
- 2000-character chunking
- Rich metadata display

**Telegram Format:**  
- Simplified markdown
- 4096-character limits
- Inline links and formatting
- Mobile-optimized layout

**Additional Formats:**
- Email (HTML with styling)
- Markdown (clean, shareable)
- Plain text (universal compatibility)

**Usage:**
```bash
# Compile for Discord
python3 scripts/digest_compiler.py filtered.json --format discord

# Multiple formats
python3 scripts/digest_compiler.py filtered.json --format email --output digest.html
```

### 4. Complete Pipeline (`scripts/run_digest.py`)

Orchestrates the entire process with:
- **Configuration management** via environment variables
- **Error handling** and recovery
- **Automatic delivery** to configured platforms
- **Logging** and monitoring
- **Flexible scheduling** support

**Usage:**
```bash
# Full pipeline
python3 scripts/run_digest.py run

# Skip delivery (generate files only)
python3 scripts/run_digest.py run --no-delivery

# Deliver existing digest
python3 scripts/run_digest.py deliver discord --file output/digest_discord_latest.txt

# System status
python3 scripts/run_digest.py status
```

## Configuration

### Environment Variables

```bash
# AI Filtering (required for quality scoring)
OPENAI_API_KEY=sk-your-key-here
OPENAI_MODEL=gpt-3.5-turbo  # or gpt-4 for higher quality

# Digest Settings
DIGEST_MAX_AGE_HOURS=24      # How far back to look for articles
DIGEST_MIN_SCORE=6.0         # Minimum AI score threshold
DIGEST_MAX_ARTICLES=50       # Maximum articles to process
DIGEST_TOP_STORIES=5         # Number of top stories in final digest
DIGEST_FORMATS=discord,telegram  # Output formats

# Discord Delivery (optional)
DISCORD_WEBHOOK=https://discord.com/api/webhooks/...

# Telegram Delivery (optional)
TELEGRAM_BOT_TOKEN=your-bot-token
TELEGRAM_CHAT_ID=your-chat-id
```

### Custom Configuration File

Create `config.json` for advanced settings:

```json
{
  "max_age_hours": 24,
  "min_score": 6.5,
  "max_articles": 30,
  "top_stories_count": 5,
  "openai_model": "gpt-3.5-turbo",
  "output_formats": ["discord", "telegram", "markdown"],
  "discord_webhook": "https://...",
  "telegram_bot_token": "...",
  "telegram_chat_id": "..."
}
```

Use with: `python3 scripts/run_digest.py run --config config.json`

## Production Deployment

### Dependencies

```bash
pip install -r requirements.txt
```

Required packages:
- `feedparser` - RSS/Atom feed parsing
- `requests` - HTTP client for APIs and webhooks  
- `python-dateutil` - Date/time handling

### Automated Scheduling

**Cron (Linux/macOS):**
```bash
# Daily at 9 AM UTC
0 9 * * * cd /path/to/ai-news-digest && python3 scripts/run_digest.py run

# Every 6 hours
0 */6 * * * cd /path/to/ai-news-digest && python3 scripts/run_digest.py run
```

**Systemd (Linux):**
```bash
# Create service and timer files
sudo systemctl enable ai-news-digest.timer
sudo systemctl start ai-news-digest.timer
```

**Docker:**
```bash
docker-compose up --build  # For one-time run
# Or configure with cron for scheduled execution
```

See [references/deployment.md](references/deployment.md) for complete deployment guide.

### Monitoring

**Health Checks:**
```bash
# System status
python3 scripts/run_digest.py status

# Test components
python3 scripts/run_digest.py test rss
python3 scripts/run_digest.py test compile
```

**Log Monitoring:**
```bash
tail -f logs/digest.log
grep ERROR logs/digest.log
```

**File Management:**
```bash
# Clean old cache files (7+ days)
find cache/ -name "*.json" -mtime +7 -delete

# Archive old digests
tar -czf archive_$(date +%Y%m).tar.gz output/
```

## Output Examples

### Discord Output
```
## 🤖 AI News Digest - March 6, 2026

📊 **5 top stories** • Average quality: 7.8/10

### 🔬 Research
⚡ **OpenAI Announces GPT-5 with Reasoning Capabilities**
📈 Score: 9.2/10 | 📰 OpenAI Blog
*Revolutionary breakthrough in AI reasoning shows 40% improvement in complex problem-solving tasks...*
🔗 [Read more](https://...)

### 🚀 Product
💰 **Anthropic Raises $4B Series D Led by Google**
📈 Score: 8.1/10 | 📰 TechCrunch
*Major funding round values company at $60B as AI safety becomes...*

---
*Generated at 09:15 UTC • Powered by AI News Digest Bot*
```

### Telegram Output  
```
*🤖 AI News Digest - March 6, 2026*

📊 5 top AI stories today

⚡ *1. OpenAI Announces GPT-5 with Reasoning*
📈 Score: 9.2/10 | 📰 OpenAI Blog
Revolutionary breakthrough in AI reasoning...
🔗 [Read more](https://...)

💰 *2. Anthropic Raises $4B Series D*  
📈 Score: 8.1/10 | 📰 TechCrunch
Major funding round values company...
🔗 [Read more](https://...)

_Generated at 09:15 UTC_
```

## Customization

### Adding News Sources

Edit `references/sources.json`:

```json
{
  "name": "Your AI Blog",
  "url": "https://yourblog.com",
  "rss": "https://yourblog.com/feed.xml",
  "category": "industry", 
  "weight": 0.8,
  "description": "Industry insights and analysis"
}
```

### Custom Filtering Logic

Modify `ai_filter.py` to adjust:
- Scoring criteria and prompts
- Fallback heuristics 
- Category classifications
- Quality thresholds

### Platform Integration

Add new delivery platforms by:
1. Creating delivery method in `run_digest.py`
2. Adding platform-specific formatting in `digest_compiler.py`
3. Handling platform limits and requirements

### Content Customization

Adjust digest content by:
- Modifying article selection in filtering phase
- Customizing formatting templates
- Adding/removing metadata fields
- Changing emoji and styling

## Revenue Potential

This skill targets $200-$2,000 monthly revenue through:

1. **SaaS for Teams**: AI news monitoring for companies
2. **Discord Bot Premium**: Advanced features for AI communities  
3. **API Access**: Curated AI news data for developers
4. **Custom Implementations**: Branded solutions for organizations
5. **Newsletter Service**: Email delivery with premium tiers

The system is production-ready for scaling and monetization with minimal additional development.

## Troubleshooting

### Common Issues

**No articles found:**
- Check RSS source availability
- Verify network connectivity  
- Review source configurations

**AI filtering fails:**
- Confirm OpenAI API key and credits
- Check rate limits and quotas
- Review error logs for details

**Delivery failures:**
- Validate webhook URLs and tokens
- Check message size limits
- Test manual delivery commands

**Performance issues:**
- Monitor API usage and costs
- Optimize source selection
- Implement caching strategies

See [references/deployment.md](references/deployment.md) for detailed troubleshooting and optimization guides.