Spaces:
Runtime error
title: Digital Factory
emoji: π
colorFrom: purple
colorTo: blue
sdk: docker
pinned: false
π Digital Factory
AI-powered autonomous software development platform, controlled via Telegram.
The Digital Factory takes a natural-language project description and autonomously plans, codes, validates, and delivers complete software β powered by a team of specialised AI agents and deterministic validation tools.
Architecture
User (Telegram) β Project Manager β SDLC Orchestrator β [Developer, Prompt Engineer]
β β
Memory System Tool Registry
(SQLite + STM) (Linter, Validator, GitHub, Files)
Agents (Phase 1 MVP)
| Agent | Role |
|---|---|
| SDLC Orchestrator | Plans projects, dispatches tasks, validates outputs |
| Project Manager | Telegram interface, requirement clarification, progress tracking |
| Software Developer | Code generation, syntax checking, linting |
| Prompt Engineer | Crafts and optimises prompts for other agents |
Deterministic Tools
- Pydantic Validator β Schema validation for all inter-agent contracts (replaces ZOD)
- Python Linter β Code quality via
ruff - Syntax Checker β
py_compilevalidation - Code Executor β Sandboxed Python execution
- File Manager β Project file I/O
- GitHub Client β Repository operations via REST API
Memory System (4-tier)
| Tier | Implementation | Purpose |
|---|---|---|
| Short-Term | In-memory dict + TTL | Session context, active conversations |
| Project | SQLite | Project specs, plans, code artifacts, task logs |
| Knowledge | (Phase 2) | Vector-based retrieval of best practices |
| User LTM | SQLite | User preferences and feedback |
Communication
All inter-agent communication uses validated Pydantic models (TaskRequest / TaskResponse) dispatched through an async in-process message bus.
Setup
Add these secrets in Settings β Secrets (HuggingFace Spaces) or as environment variables:
| Secret | Required | Description |
|---|---|---|
BOT_TOKEN |
Yes | Telegram bot token from @BotFather |
ADMIN_ID |
Yes | Your Telegram numeric ID |
GROQ_KEY |
Recommended | Groq API key (primary AI provider) |
DEEPSEEK_KEY |
Optional | DeepSeek API key (fallback) |
HF_TOKEN |
Optional | HuggingFace API token (fallback) |
MISTRAL_KEY |
Optional | Mistral API key (fallback) |
GH_TOKEN |
Optional | GitHub PAT for repo operations (scope: repo, workflow) |
GH_USER |
Optional | GitHub username |
GH_REPO |
Optional | Default repository name |
Telegram Commands
| Command | Description |
|---|---|
/start |
Main menu |
/factory |
Start a new project (guided flow) |
/projects |
List existing projects |
/help |
Feature documentation |
/cancel |
Cancel current operation |
Or just send a message β the AI chat mode responds to any text.
How It Works
- You describe a project β "Build a REST API with FastAPI and SQLite"
- Project Manager clarifies requirements (asks questions if needed)
- SDLC Orchestrator creates a structured plan with tasks
- Software Developer generates and validates code for each task
- Files are delivered as Telegram documents you can download
Project Structure
digital_factory/
βββ main.py # Entry point, Telegram bot setup
βββ config.py # Environment & settings
βββ models/ # Pydantic contracts (TaskRequest, ProjectSpec, etc.)
βββ agents/ # AI agents (Orchestrator, Developer, PM, Prompt Engineer)
βββ tools/ # Deterministic tools (linter, validator, GitHub, files)
βββ memory/ # 4-tier memory (short-term, project, knowledge, user LTM)
βββ bus/ # Async message bus
βββ telegram_ui/ # Telegram handlers & keyboards
βββ utils/ # Helpers (safe_send, truncate)
Legacy GitHub Manager
The original GitHub Manager bot is preserved in githubbot.py and includes:
Repository Management
- π Browse, view, edit, delete & download files
- π View commits with diff details (files changed, additions/deletions)
- πΏ Create & delete branches
- π Create PRs with branch selection & merge PRs
- π Create & close issues
- π Create releases
- π Repository stats (stars, forks, traffic, clones)
- π Search across your repositories
- π€ Upload multiple files via JSON
- β‘ View GitHub Actions workflow runs & re-run failed workflows
AI Assistant
- π€ Multi-provider AI: Groq, DeepSeek, HuggingFace, Mistral
- π¬ Chat in Arabic & English β just type your message
- π€ Voice messages with Whisper transcription + Arabic TTS
- π οΈ AI can autonomously: read/create/delete files, create PRs, close issues, manage branches, search repos, view workflows
Deployment
Runs on HuggingFace Spaces as a Docker container. Health check endpoint on port 7860.
# Local development
pip install -r requirements.txt
python -m digital_factory.main
Roadmap
- Phase 2: Additional agents (ML Engineer, Data Analyst, Security, UI/UX Designer)
- Phase 3: RAG-based knowledge memory, external database support
- Phase 4: Self-Improvement cycle, Board of Directors governance
- Phase 5: Full 14-agent deployment with Kafka message bus