Skip to main content

Telegram-Controlled File Management Engine

Project description

๐Ÿ‹๏ธ Doit โ€” Telegram-Controlled Local Automation Engine

Doit is a production-grade open-source automation agent that runs silently on your laptop and executes real OS-level tasks โ€” controlled entirely through Telegram.

No GUI. No web dashboard. No daily terminal usage. Just Telegram.


Features

Category Capabilities
File System Create, read, write, delete, move, copy, search, compress, extract, organize, backup, clean
System CPU/RAM/disk monitoring, process management, shutdown/restart/sleep
Network Download files, ping, HTTP requests, URL uptime monitoring
Scheduler Natural language + cron scheduling, persistent, crash-recoverable
Security Single-user auth, encrypted config, injection protection, tool sandboxing
Resilience Crash recovery, network loss tolerance, power-loss recovery, auto-restart
Plugins Dynamic discovery, sandboxed execution, documented API
Observability Status, tasks, logs, health, audit export (JSON/CSV)

Quick Start

pip install doit-agent
doit init

The wizard walks you through:

  1. Trust grant (one-time)
  2. AI provider & model selection
  3. Telegram bot setup
  4. Auto-start service installation

After setup: just talk to your bot.


Usage (via Telegram)

list files in ~/Downloads
download https://example.com/report.pdf to ~/Desktop
backup ~/Documents to ~/Backups every day at 9am
show system health
kill process 12345
organize ~/Downloads
compress ~/Projects/myapp to ~/Backups/myapp.zip
safe mode          โ†’ pause all execution
resume             โ†’ resume execution
/status            โ†’ agent status
/tasks             โ†’ recent tasks
/health            โ†’ system resources
/logs              โ†’ recent log entries
/export json       โ†’ download audit log

Architecture

doit/
โ”œโ”€โ”€ cli/           # Bootstrap, onboarding wizard, CLI commands
โ”œโ”€โ”€ core/          # Config, constants, cross-platform paths
โ”œโ”€โ”€ ai/            # Multi-provider AI intent engine
โ”œโ”€โ”€ telegram_bot/  # Telegram interface, auth, injection guard
โ”œโ”€โ”€ tools/         # Tool registry + all tool implementations
โ”œโ”€โ”€ task_engine/   # Async queue, workers, retry, resource guard
โ”œโ”€โ”€ scheduler/     # Natural language + cron scheduler
โ”œโ”€โ”€ security/      # Encryption, lock file, authorization
โ”œโ”€โ”€ persistence/   # SQLite database (tasks, logs, config, audit)
โ”œโ”€โ”€ plugins/       # Plugin system with dynamic discovery
โ”œโ”€โ”€ services/      # OS service (systemd/LaunchAgent/Windows)
โ”œโ”€โ”€ supervisor/    # Process supervision, crash recovery
โ”œโ”€โ”€ logging_system/# Structured logging to file + DB
โ””โ”€โ”€ updates/       # Version check, safe update, rollback

AI Providers

# Provider Best Models
1 NVIDIA NIM Llama 3.3 70B, Nemotron Ultra 253B
2 Zhipu AI (z.ai) GLM-4 Flash (free), GLM-4 Air
3 OpenAI GPT-4o, GPT-4o Mini
4 Anthropic Claude 3.5 Sonnet, Claude 3 Haiku
5 Ollama Local models, fully offline
6 Custom Any OpenAI-compatible endpoint

Security Model

  • Single authorized user โ€” only your Telegram user ID can send commands
  • Encrypted config โ€” API keys and tokens stored with Fernet encryption
  • Tool sandboxing โ€” AI can only invoke registered tools; no arbitrary code execution
  • Injection protection โ€” pattern-based prompt injection detection
  • Path/command blocklist โ€” system-critical paths and destructive commands blocked
  • No inbound ports โ€” only outbound connections to Telegram API
  • Audit trail โ€” every action logged to SQLite

Plugin API

Create a .py file in ~/.config/doit/plugins/:

PLUGIN_NAME = "my_plugin"
PLUGIN_VERSION = "1.0.0"
PLUGIN_DOIT_MIN_VERSION = "1.0.0"
PLUGIN_DESCRIPTION = "What this plugin does"

async def my_tool(arg1: str, count: int = 1, **kwargs) -> dict:
    # Must return a dict
    return {"result": f"Did {arg1} x{count}", "success": True}

TOOLS = [
    ("my_tool", "Description of my tool", my_tool, False),  # (name, desc, fn, is_dangerous)
]

Restart Doit. Your tool is now available to the AI.


CLI Commands

doit init        # Run onboarding wizard
doit run         # Start agent (used by OS service)
doit update      # Check and install updates
doit status      # Check if service is running
doit uninstall   # Remove service and optionally data

Resilience

Scenario Behavior
Process crash OS service auto-restarts; pending tasks recovered from DB
Network loss Exponential backoff retry; never exits
Power loss OS auto-start re-launches; state fully restored from SQLite
SIGTERM Finish running tasks, persist state, close DB cleanly
AI unavailable Notify user, retry with backoff, use fallback model
Resource overload Delay task execution until CPU/RAM within limits

Database Schema

SQLite at ~/.config/doit/data/doit.db:

  • tasks โ€” all task executions with status, payload, result, retry count
  • schedules โ€” persistent schedules with next_run computation
  • logs โ€” structured application logs
  • audit_log โ€” tamper-evident audit trail
  • config โ€” runtime configuration
  • plugin_registry โ€” installed plugins
  • migrations โ€” schema version history

Requirements

  • Python 3.10+
  • A Telegram bot token (free, from @BotFather)
  • An AI API key (NVIDIA, Zhipu, OpenAI, Anthropic) OR Ollama running locally

License

MIT โ€” free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doit_fm-1.0.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doit_fm-1.0.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file doit_fm-1.0.0.tar.gz.

File metadata

  • Download URL: doit_fm-1.0.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for doit_fm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f946d78e57a3e9c6d4ee61c1075baf1873e7e25b89c796b0d087aa6bb5d7e0d
MD5 25da0e2ffe06a845de5e1ed4d750e045
BLAKE2b-256 b46055823934fa0431d1e83ece56f86adfb657bcbacdfce9229ecc2c268a2a98

See more details on using hashes here.

File details

Details for the file doit_fm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: doit_fm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for doit_fm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0de237b99ec07a72354214d63b2148e18087c4b4d63f0ae482b5eac26eb8c555
MD5 9d85f210db93346dd61a5e70ad98dd67
BLAKE2b-256 6d39d078404934da867ac2ed436179f401e10e79cec6440d629dc168b243564b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page