Skip to content

AnasNafees1802/BabyClaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BabyClaw Logo

BabyClaw 🦀

Your Local OS Automation Engine. Powered by Native Rust, Controlled via Telegram.

An ultra-lightweight, blazing-fast, and fully autonomous AI agent written in Rust. It interacts natively via Telegram, parses LLM outputs, executes shell scripts autonomously within your local system sandbox, and responds back. It is essentially the OpenClaw concept, heavily optimized for a pure deterministic, offline-capable desktop environment with zero enterprise web bloat.

Built by Anas Nafees

Features

  • Secure Telegram Polling: Long-polling allows for secure integration directly with Telegram without public webhooks.
  • LLM Independence: Powered by Google's Gemini API (configurable models in .env) with automatic 503 retry fallbacks.
  • Autonomous Execution: Interprets <bash> blocks from the LLM, executes them natively on Windows (via .bat) or macOS/Linux.
  • Telegram UI Guardrails: Destructive <bash_safe> commands are intercepted, pausing the Agent loop to render a native Telegram Inline Keyboard (Yes ✅, No ❌) asking you for explicit approval.
  • Background Cron Watchers: The LLM can spawn detached Tokio async tasks using <cron> tags to silently run scripts in the background and only alert you if the conditions change!
  • Persistent Memory: Zero-overhead context preservation! Saves conversation history to a local babyclaw_memory.json on disk, surviving terminal crashes effortlessly.
  • Agent Lock: Spam-proof concurrency handles rapid Telegram texts seamlessly; only one "brain" operates per Chat ID, quietly queuing up fast follow-up messages.
  • Dynamic Skill Loader: Scans the local skills/ directory for .md files to automatically compile prompt context for thousands of tools.

⚡ 1-Line Installation (Recommended)

BabyClaw can automatically clone itself, install the Rust compiler if missing, interactively prompt you for your API keys, and launch!

Windows (PowerShell):

irm https://raw.githubusercontent.com/AnasNafees1802/BabyClaw/main/install.ps1 | iex

Linux / macOS (Bash):

curl -fsSL https://raw.githubusercontent.com/AnasNafees1802/BabyClaw/main/install.sh | bash
Manual Installation (Developers)
  1. Clone the repository:

    git clone https://github.com/AnasNafees1802/BabyClaw.git
    cd BabyClaw
  2. Configure your environment: Rename .env.example to .env and fill in your keys:

    TELEGRAM_BOT_TOKEN="YOUR_TELEGRAM_TOKEN"
    GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
    GEMINI_MODEL="gemini-1.5-flash-8b"
  3. Run the Agent:

    cargo run --release

🗣️ How To Use BabyClaw (Step-by-Step)

Once installed, BabyClaw operates as a persistent listener on your machine. Here is how you use it:

Step 1: Start the Engine Open any terminal (Command Prompt, PowerShell, or Bash) anywhere on your computer and simply type:

BabyClaw

You can now close the terminal window, minimize it, or let it run in the background. BabyClaw is now alive and listening!

Step 2: Message Your Bot Open the Telegram app on your phone or desktop, find the Bot you created (using the TELEGRAM_BOT_TOKEN), and send it a message!

"Hey, what are my top 5 most memory-intensive processes right now?" "Can you create a folder on my Desktop called 'ProjectX'?" "Ping google.com 4 times and give me the average latency."

Step 3: Approve or Deny Actions If BabyClaw needs to execute a "destructive" command (like deleting a file, making a directory, or modifying your system), it will explicitly pause and ask for your permission directly in the Telegram chat using interactive buttons!

  • Tap Yes ✅ to authorize the command natively on your PC.
  • Tap No ❌ to instantly abort the operation.

BabyClaw will stream the raw terminal output from your computer straight back into the chat as a beautifully summarized human response.

Operating System Support

BabyClaw actively injects the host OS into its system prompt so the LLM writes correct platform-specific scripts:

  • Windows: Generates heavily-escaped temporary .bat files for execution to prevent cmd.exe quotation parsing bugs.
  • Linux/macOS: Generates temporary .sh scripts to safely execute complex multi-line bash commands.

Architecture: How BabyClaw is "Agentic"

BabyClaw clones the core architecture of OpenClaw, which makes it incredibly smart without requiring hard-coded API integrations.

The "Prompt Injection + CLI" Model

Instead of building complex plugins for every service (GitHub, Spotify, Weather), BabyClaw uses Skills. If you look inside the skills/ directory, you will find dozens of .md (Markdown) files. These files are beautifully written instructions in plain English that teach the LLM how to use specific command-line interfaces (CLIs) that already exist in the world.

How it works seamlessly:

  1. On boot, BabyClaw scans the skills/ folder and reads every single markdown file, combining them into one massive System Prompt (~8,000+ bytes).
  2. The LLM now intrinsically knows how to interact with services on your computer.
  3. Example: If you ask BabyClaw to "Check my open GitHub PRs", it recalls the skills/github/SKILL.md instructions, writes a temporary .bat script executing gh pr list, runs it natively in your Windows sandbox, parses the raw terminal stdout, and sends you a beautifully formatted Telegram message summarizing your PRs.

To make BabyClaw even smarter, you just need to install the underlying CLI tools on your host machine (e.g., install the GitHub CLI gh, or the weather CLI, etc.).

Performance & Memory Footprint

Because BabyClaw was rewritten entirely from scratch in Rust (utilizing the Tokio async runtime), it bypasses the heavy enterprise infrastructure of traditional AI agents.

  • Typical AI Agents (Node.js/Python): 100MB to 250MB+ RAM when idle, requiring V8 engines, Python runtimes, Redis caching, or Docker containers.
  • BabyClaw (Rust): A compiled, native binary that idles at ~10MB to 25MB of RAM.

It is practically a ghost on your system. It consumes ~0% CPU while long-polling for Telegram messages and spins up zero-cost threads only when you message it. It is the ultimate invisible, ultra-lightweight desktop automation assistant.

License

MIT License. See LICENSE for details.

About

An ultra-lightweight, blazing-fast autonomous AI agent written in Rust. Features native OS execution, Telegram UI guardrails, async cron watchers, and persistent memory under 20MB!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors