|
1 | | -# iCrab |
| 1 | +# 🦀 iCrab |
2 | 2 |
|
3 | 3 |  |
4 | 4 |
|
5 | | -iCrab is a personal AI assistant that runs on an old iPhone inside iSH. You talk to it over Telegram. It uses your Obsidian vault (or any folder you point it at) as its workspace, so it can read your notes, log stuff, and search your daily logs. **One static binary, no webhooks, no open ports**. The kind of thing you run on a phone that was otherwise sitting in a drawer. |
| 5 | +> **A minimal, 100% private AI assistant running on a repurposed iPhone.** |
6 | 6 |
|
7 | | -It is built to stay small and easy to extend. |
| 7 | +**iCrab** is a stripped down minimal personal AI assistant designed to run exclusively on an old iPhone inside [iSH](https://ish.app/). You interact with it via Telegram. It treats your Obsidian vault (or any local directory) as its workspace—giving it native access to read your notes, logs etc. |
8 | 8 |
|
9 | | -## Why it exists |
| 9 | +It is built to stay small, extremely private, and effortlessly extensible. |
10 | 10 |
|
11 | | -I wanted something that actually runs where I am, uses the notes I already keep, and does not depend on a cloud service. iSH on an iPhone gives you a 32-bit Linux userspace. iCrab is a single binary for that environment: Telegram long-poll in, agent loop with tools, everything stored in your workspace. Add a skill by dropping a `SKILL.md` in a folder. No plugins, no DLLs. |
| 11 | +**Key Highlights:** |
| 12 | +- **Zero Ingress:** No webhooks, no open ports. Uses Telegram long-polling. |
| 13 | +- **Single Static Binary:** Written in Rust, compiled to `i686-unknown-linux-musl`. **Extremely lightweight (~4.9MB).** |
| 14 | +- **Own Your Data:** Everything stays in your workspace. Chat history is stored locally in SQLite. |
| 15 | +- **Skill System:** Teach it new skills by simply dropping a `SKILL.md` file in a folder. No plugins, no code required. |
12 | 16 |
|
13 | | -## Getting started |
| 17 | +--- |
14 | 18 |
|
15 | | -You need an iPhone with iSH and a stripped-down setup so the phone is not busy with iCloud and other services. |
| 19 | +## 💡 Why iCrab? |
16 | 20 |
|
17 | | -**Pre-setup (iPhone wipe).** I won't go into privacy here, but read [the lethal trifecta](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/) from Simon Willison. Wipe anything important off the iPhone first. |
| 21 | +I tried a few options of OpenClaw alternatives. They were either too bloated or wouldn't simply work on 32 bit Alpine Linux. I wanted something that actually runs *where I am*, uses the notes I already keep, and doesn't depend on a cloud data lock-in, and is dead simple. |
18 | 22 |
|
19 | | -- **Sign out of iCloud:** `Settings > [Your Name] > Sign Out`. That removes the device from Find My and disables Activation Lock. |
20 | | -- **Erase All Content and Settings:** On modern iPhones this destroys the encryption keys; the data on the chip becomes unrecoverable. |
21 | | -- **Do not sign in to iCloud again:** When it asks for an Apple ID, choose "Forgot password or don't have an Apple ID" then "Set Up Later in Settings." Keeps the phone light and stops background sync from hogging RAM. |
22 | | -- **Disable everything:** During setup, say No to Face ID, Siri, Screen Time, and Analytics. You want the CPU available for iSH. |
23 | | -- Optional: use a burner Apple account for the App Store only. |
| 23 | +--- |
24 | 24 |
|
25 | | -**Setup.** Download iSH on the iPhone. |
| 25 | +## ✨ Features |
26 | 26 |
|
27 | | -**Build (on a real machine, from this directory `iCrab/`):** |
| 27 | +- **Telegram Interface:** Chat natively. It reads, thinks, uses tools, and replies. |
| 28 | +- **Workspace Integration:** Reads and writes files directly in your Obsidian vault. It knows what you wrote yesterday because it can read your daily notes. |
| 29 | +- **Local Memory & Search:** SQLite-backed persistence with FTS5. The agent can search your entire vault or your chat history blazingly fast. |
| 30 | +- **Background Subagents:** Tell it to "Search the web for X and summarize it." It spawns a background agent, freeing up the main chat, and messages you when it's done. |
| 31 | +- **Cron & Heartbeat:** Schedule recurring tasks or reminders (e.g., "Summarize unread messages every hour"). |
| 32 | +- **Basic Tools:** |
| 33 | + - `read_file`, `write_file`, `edit_file`, `append_file`, `list_dir` |
| 34 | + - `web_search` (Brave API or DuckDuckGo) & `web_fetch` |
| 35 | + - `cron` management |
| 36 | + - Restricted `exec` (e.g., for `git pull` syncing) |
28 | 37 |
|
29 | | -- Install [cross](https://github.com/cross-rs/cross): `cargo install cross` |
30 | | -- `cross build` for debug, `cross build --release` for the binary you deploy. |
| 38 | +--- |
31 | 39 |
|
32 | | -Output: `target/i686-unknown-linux-musl/debug/icrab` or `.../release/icrab`. Put that in iSH, add your config (see below), and run it. |
| 40 | +## 🚀 Getting Started |
33 | 41 |
|
34 | | -**Config:** One file, `~/.icrab/config.toml`. You set the workspace path (your Obsidian vault or a clone), your Telegram bot token, and the LLM (OpenRouter, OpenAI-compatible, etc.). Optional: Brave API key for web search, heartbeat interval, cron. No secrets in the binary; use the config file or env vars. |
| 42 | +To get started, you'll need an old iPhone with the iSH app installed, and a machine to compile the binary. |
35 | 43 |
|
36 | | -## What it can do |
| 44 | +### 1. Prep your iPhone (The "Lethal Trifecta") |
| 45 | +Read Simon Willison's [lethal trifecta](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/) on device privacy. |
37 | 46 |
|
38 | | -- **Chat over Telegram:** Long-poll only. You message the bot; it runs the agent and replies. No webhooks, no open ports. |
39 | | -- **Use your workspace:** Read and write files under the workspace (e.g. daily logs, workouts, notes). File tools are restricted to that tree. |
40 | | -- **Remember and search:** MEMORY.md and daily notes are in context. Persistence (in progress) adds SQLite-backed chat history and FTS5 search over your vault so the agent can find "what did we say about X" quickly. |
41 | | -- **Tools:** File (read, write, list, edit, append), web search and fetch, cron (reminders and one-off tasks), and a `message` tool to send you text. Optional: restricted `exec` for things like `git pull` in the vault. |
42 | | -- **Subagents:** The agent can spawn a background task (e.g. "search the web and summarize"). The subagent runs with the same tools except no spawn; it reports back via `message` so you get the result in Telegram without blocking the main chat. |
43 | | -- **Heartbeat:** A timer can read a file (e.g. `HEARTBEAT.md`) and run the agent on a schedule (e.g. "check my calendar" or "summarize unread"). |
44 | | -- **Skills:** Put a `SKILL.md` in `workspace/skills/<name>/`. The agent sees the list and can open a skill’s doc when it needs it. Extending is "add a folder and a markdown file." |
| 47 | +1. **Sign out of iCloud:** `Settings > [Your Name] > Sign Out`. Disables Activation Lock. |
| 48 | +2. **Erase All Content:** Destroys encryption keys, rendering old data unrecoverable. |
| 49 | +3. **Do not sign in again:** Choose "Set Up Later in Settings." This stops background sync from hogging RAM. |
| 50 | +4. **Disable extras:** Say No to Face ID, Siri, Screen Time, and Analytics. |
45 | 51 |
|
46 | | -So: simple (one binary, one config, one ingress), light (static musl, minimal deps), and expandable (skills as docs, optional tools). If that matches what you want from a phone-bound assistant, the rest is in the design and persistence docs. |
| 52 | +Download **iSH** from the App Store (use a burner account if desired). |
| 53 | + |
| 54 | +### 2. Create your Telegram Bot |
| 55 | +1. Open Telegram and message [@BotFather](https://t.me/botfather). |
| 56 | +2. Send `/newbot` and follow the steps to get your **Bot Token**. |
| 57 | +3. Find your personal Telegram User ID (e.g., by messaging `@userinfobot`). You'll need this to ensure *only you* can talk to your bot. |
| 58 | + |
| 59 | +### 3. Build iCrab (On your computer) |
| 60 | +Because iSH runs a 32-bit x86 environment (`i686`), you must cross-compile. |
| 61 | + |
| 62 | +```bash |
| 63 | +# Clone the repository |
| 64 | +git clone https://github.com/Snehal-Reddy/iCrab.git |
| 65 | +cd iCrab |
| 66 | + |
| 67 | +# Install the cross-compiler tool |
| 68 | +cargo install cross |
| 69 | + |
| 70 | +# Build the release binary |
| 71 | +cross build --release |
| 72 | +``` |
| 73 | +The compiled binary will be at `target/i686-unknown-linux-musl/release/icrab`. Transfer this file to your iPhone (via SSH into iSH, or start a local server and `curl`). |
| 74 | + |
| 75 | +### 4. Configuration |
| 76 | +Create a config file in your iSH environment at `~/.icrab/config.toml`: |
| 77 | + |
| 78 | +```toml |
| 79 | +# ~/.icrab/config.toml |
| 80 | +workspace = "~/.icrab/workspace" # Point this to your Obsidian vault |
| 81 | +restrict-to-workspace = true |
| 82 | + |
| 83 | +[telegram] |
| 84 | +bot-token = "YOUR_TELEGRAM_BOT_TOKEN" |
| 85 | +allowed-user-ids = [123456789] # Your Telegram User ID |
| 86 | + |
| 87 | +[llm] |
| 88 | +provider = "openrouter" |
| 89 | +api-base = "https://openrouter.ai/api/v1" |
| 90 | +api-key = "YOUR_LLM_API_KEY" |
| 91 | +model = "google/gemini-3-flash-preview" # Or your preferred model |
| 92 | + |
| 93 | +[heartbeat] |
| 94 | +interval-minutes = 30 |
| 95 | +timezone = "Europe/London" # Your IANA timezone |
| 96 | +``` |
| 97 | + |
| 98 | +*(Note: You can also set secrets as environment variables like `TELEGRAM_BOT_TOKEN` and `ICRAB_LLM_API_KEY`.)* |
| 99 | + |
| 100 | +### 5. Run it! |
| 101 | +Inside iSH: |
| 102 | +```bash |
| 103 | +# Make it executable |
| 104 | +chmod +x icrab |
| 105 | + |
| 106 | +# Run it |
| 107 | +./icrab |
| 108 | +``` |
| 109 | +Now, open Telegram, find your bot, and say "Hello"! |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## 🧠 Teaching iCrab New Skills |
| 114 | + |
| 115 | +iCrab is designed to be easily extensible without writing code. To add a skill, simply create a folder in `workspace/skills/` and drop a `SKILL.md` file inside it. |
| 116 | + |
| 117 | +```text |
| 118 | +workspace/ |
| 119 | +└── skills/ |
| 120 | + └── workout_logger/ |
| 121 | + └── SKILL.md |
| 122 | +``` |
0 commit comments