Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

πŸ›°οΈ A modular microservices system for monitoring news, filtering, scoring, generating and publishing differentiated content β€” while keeping a final human-in-the-loop.

Notifications You must be signed in to change notification settings

st00mp/syntinel

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›°οΈ Syntinel Project

A modular microservices system for monitoring news, filtering, scoring, generating and publishing differentiated content β€” while keeping a final human-in-the-loop.

Note: This project is currently in progress. Only the ingestion pipeline is functional at this stage. See the Project Status section for details.


πŸ“‚οΈ Architecture

This project is built on a microservices architecture, orchestrated by a central core (core/syntinel) and extended with specialized services (services/).

Each component follows the Feature-Sliced Design (FSD) principle for clarity and scalability.


πŸ“Œ Project Structure

syntinel/
β”œβ”€β”€ core/                     # Central orchestrator
β”‚   └── syntinel/
β”‚       β”œβ”€β”€ orchestrator.py   # Entry point for executing business pipelines
β”‚       β”œβ”€β”€ db/              # Database module
β”‚       β”‚   β”œβ”€β”€ session.py    # DB connection, engine and session configuration
β”‚       β”‚   β”œβ”€β”€ models/       # Database models
β”‚       β”‚   β”‚   β”œβ”€β”€ article.py
β”‚       β”‚   β”‚   └── draft.py
β”‚       β”‚   └── __init__.py   # Re-exports for easy imports
β”‚       β”œβ”€β”€ modules/          # Business modules (FSD)
β”‚       β”‚   β”œβ”€β”€ ingestion/    # Extraction, deduplication, normalization, Redis
β”‚       β”‚   β”‚   β”œβ”€β”€ pipeline.py
β”‚       β”‚   β”‚   └── collector/
β”‚       β”‚   β”‚       β”œβ”€β”€ base.py
β”‚       β”‚   β”‚       └── cryptopanic_collector.py
β”‚       β”‚   β”œβ”€β”€ scoring/      # Relevance scoring logic
β”‚       β”‚   └── publishing/   # Publishing orchestration
β”‚       └── Dockerfile        # Build for syntinel-core service
β”œβ”€β”€ services/                 # Specialized microservices
β”‚   β”œβ”€β”€ writer-agent/         # Content generation via CrewAI
β”‚   └── telegram-bot/         # Telegram interface for user interaction
β”œβ”€β”€ docker-compose.yml        # Container orchestration
└── .env.example              # Example environment variables

βš™οΈ Components

Component Role
Syntinel-Core Main orchestrator: ingestion, scoring, workflow coordination
Crawl4AI (Optional) Multi-source HTTP extraction service
Writer-Agent Stylized content generator using CrewAI (e.g. sarcastic tone)
Telegram-Bot User-friendly interface to validate, edit and publish content
PostgreSQL Central database for headlines, scores, and logs
Redis Cache + queue system (Redis Streams) for ingestion and scoring
pgAdmin Web interface for PostgreSQL administration

πŸ“Œ Functional Flow

  1. Scheduler / Orchestrator triggers the ingestion pipeline periodically
  2. Collectors fetch headlines from third-party APIs (e.g. Cryptopanic)
  3. Ingestion Pipeline:
    • Deduplicates using the DB
    • Normalizes articles (cleaning, formatting)
    • Inserts into DB if new
    • Pushes event to Redis stream
  4. Scoring Worker consumes Redis stream and applies relevance scoring
  5. Telegram Bot displays top headlines to the user
  6. Writer-Agent generates original content
  7. User Validation: tone selection, editing, final approval
  8. Automatic Publishing: pushes to X (Twitter) API

βœ… Requirements

  • Docker & Docker Compose
  • Python 3.9+ (for local development)
  • OpenAI API Key (for Writer-Agent)
  • Telegram Bot Token (for user interaction)
  • X (Twitter) account + API Key (for automated publishing)

βš™οΈ Configuration

# Copy the environment file
cp .env.example .env

Fill in the .env file with: β€’ OPENAI_API_KEY β€’ TELEGRAM_BOT_TOKEN β€’ POSTGRES_USER, POSTGRES_PASSWORD β€’ X_API_KEY (optional)


πŸš€ Startup

# Build and launch all containers
docker-compose up -d

πŸ”— Service Access

Service URL / Access Info
Syntinel-Core API http://localhost:8000
Writer-Agent API http://localhost:8002
Telegram-Bot Available via your Telegram app
pgAdmin http://localhost:5050 (login: admin@syntinel.com / admin)
PostgreSQL localhost:5432 (default: admin / pswd)
Redis localhost:6379

πŸ›  Development Setup

The project includes an automated setup script to initialize your development environment quickly and easily:

# Run the development setup script from the project root
python scripts/setup_dev.py

This script will:

  • Check for and install required tools (uv, direnv)
  • Set up a Python virtual environment (.venv)
  • Install project dependencies using uv
  • Configure crawl4ai with Playwright
  • Set up direnv for automatic environment activation

Note: If you modify the .envrc file or pull changes that modify it, you'll need to run direnv allow to authorize the changes for security reasons.

Monitoring Tools

To monitor the Redis streams during development:

# Run the Redis monitoring script
python scripts/monitor_redis.py

πŸ›  Development Architecture

  • Syntinel-Core: orchestrator, pipelines, ingestion workers
  • Services: isolated, pluggable APIs
  • Shared: Pydantic models and common utilities

βœ… Best Practices

β€’	βœ… Feature-Sliced Design: api.py, service.py, pipeline.py, collector/
β€’	βœ… Shared interface BaseCollector to trigger fetch() across modules
β€’	βœ… Pre-insert deduplication + ON CONFLICT DO UPDATE fallback
β€’	βœ… Redis Streams for async ingestion
β€’	βœ… run_collector_safely() wrapper with logs + automatic retry
β€’	βœ… Input validation via Pydantic
β€’	βœ… Automated tests with docker-compose.tests.yml
β€’	βœ… Centralized orchestration via orchestrator.py

πŸ“Œ Project Status

This project is a work in progress. Current state:

β€’	βœ… Ingestion pipeline: functional (collector, normalization, deduplication, storage)
β€’	πŸ”„ Scoring module: in progress
β€’	🚧 Writer-Agent + Telegram interface: not yet implemented
β€’	🚧 Publishing module: not yet implemented

I welcome contributions and suggestions β€” feel free to fork, clone, or reach out.

πŸš€ Usage

Running the Orchestrator

The orchestrator is the main entry point to run the ingestion pipeline. It provides several options for customization:

# Standard execution (ingestion only)
python -m core.orchestrator

# With JSON export (auto-generated filename)
python -m core.orchestrator --export-json

# With JSON export and custom filename
python -m core.orchestrator --export-json --export-path custom_export.json

CLI Options

Option Description
--export-json Enable JSON export of collected articles
--export-path PATH Specify a custom path for the JSON export file

The JSON export contains both raw article data from collectors and normalized data used for database storage.


🏷️ License

MIT β€” Open source, feel free to fork and improve 🀝

About

πŸ›°οΈ A modular microservices system for monitoring news, filtering, scoring, generating and publishing differentiated content β€” while keeping a final human-in-the-loop.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.