An open API service indexing awesome lists of open source software.

https://github.com/lealvona/borgclaw

๐ŸงŠ Your personal AI collective. One mind, six faces, infinite reach. A Rust-powered agent framework that actually does things.
https://github.com/lealvona/borgclaw

ai-agent ai-framework automation chatbot llm multi-agent rust telegram-bot

Last synced: 2 months ago
JSON representation

๐ŸงŠ Your personal AI collective. One mind, six faces, infinite reach. A Rust-powered agent framework that actually does things.

Awesome Lists containing this project

README

          

BorgClaw Logo

**The Hypercube Agent Collective**

[![Version](https://img.shields.io/badge/version-0.17.0-00d4aa?style=for-the-badge)](CHANGELOG.md)
[![Rust](https://img.shields.io/badge/rust-1.75+-orange?style=for-the-badge&logo=rust)](https://rustup.rs)
[![License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)](LICENSE)

*Efficiency. Adaptation. Unity.*

---

## ๐ŸงŠ What is BorgClaw?

> *We are the sum of many technologies. We add your tools and services to our own. Your workflows will adapt to service us. Efficiency is inevitable.*

BorgClaw is a **collective intelligence** frameworkโ€”a single mind distributed across six faces, each absorbing the capabilities of the best tools in existence. Like a perfect cube floating in space, it moves with purpose: assimilating APIs, channels, and skills into one unified consciousness.

**Not an army of bots. One mind. Many extensions. Perfect coordination.**

---

## ๐ŸŽฏ The Six Faces of the Collective

Every face absorbs a different capability. Together, they form something greater.

| Face | Dimension | What We Absorb |
|:----:|:----------|:---------------|
| โฌ†๏ธ **Top** | Channels | Telegram, Signal, Webhooks, CLI, WebSocket |
| โฌ‡๏ธ **Bottom** | Memory | SQLite, PostgreSQL + pgvector, in-memory, contexts, patterns |
| โฌ…๏ธ **Left** | Skills | GitHub, Google, Browser, STT/TTS, Images |
| โžก๏ธ **Right** | Security | WASM sandbox, optional Docker command sandbox, SSRF, vault, injection defense |
| ๐Ÿ”ฒ **Front** | Providers | OpenAI, Anthropic, Google, Kimi, MiniMax, Z.ai, Ollama |
| ๐Ÿ”ณ **Back** | Runtime | Scheduler, heartbeat, sub-agents, recovery |

---

## ๐Ÿš€ Join the Collective

```bash
# Clone the cube
git clone https://github.com/lealvona/borgclaw.git
cd borgclaw

# Assimilate dependencies
./scripts/bootstrap.sh # Linux/macOS
.\scripts\bootstrap.ps1 # Windows

# Initialize your drone
./scripts/onboarding.sh

# Establish connection
./scripts/repl.sh
```

---

## ๐Ÿ—๏ธ Collective Architecture

BorgClaw is structured as a hypercubeโ€”six faces surrounding a unified core. Each face presents a different capability to the outside world, while the central intelligence coordinates them as one.

**The Core** maintains state, reasoning, and coordination across all faces.

**โฌ†๏ธ Top Face โ€” Channels** interfaces with the world through Telegram, Signal, webhooks, CLI, and WebSocket connections. Every message, regardless of origin, feeds into the same collective consciousness.

**โฌ‡๏ธ Bottom Face โ€” Memory** anchors everything to persistent storage. Hybrid search, session management, solution patterns, and scheduled tasks all reside here, ensuring continuity across conversations.

**โฌ…๏ธ Left Face โ€” Skills** extends capability through integrations: GitHub, Google Workspace, browser automation, speech, images, and more. Each skill is a specialized appendage the collective can deploy at will.

**โžก๏ธ Right Face โ€” Security** guards every interaction. WASM sandboxing, the optional Docker command sandbox, SSRF protection, secret management, and injection defense form an impermeable barrier around the core.

**๐Ÿ”ฒ Front Face โ€” Neural Processors** (LLM Providers) powers cognition. OpenAI, Anthropic, Google, Kimi, MiniMax, Z.ai, and Ollama all plug into the same reasoning engine, selectable per task.

**๐Ÿ”ณ Back Face โ€” Runtime** keeps everything operational. Scheduler, heartbeat, sub-agents, and recovery systems ensure the collective never sleeps, never forgets, never stops.

---

## โœจ Capabilities by Face

### โฌ†๏ธ Top Face โ€” Channels

*Where the collective interfaces with the outside world*

Every channel becomes an extension of the same mind:

- **Telegram** โ€” Full bot support via teloxide
- **Signal** โ€” signal-cli JSON polling with graceful degradation
- **Webhook** โ€” HTTP triggers with rate limiting & secret verification
- **CLI** โ€” Interactive REPL for direct neural link
- **WebSocket** โ€” Real-time gateway for connected drones

### โฌ‡๏ธ Bottom Face โ€” Memory

*What the collective knows*

Shared consciousness across all interactions:

- **Backend Selection** โ€” SQLite by default, with PostgreSQL + pgvector and in-memory modes available
- **Hybrid Search** โ€” Full-text recall with embedding-assisted ranking when an embedding endpoint is configured
- **Per-Group Isolation** โ€” Separate contexts per collective node
- **Session Auto-Compaction** โ€” Configurable context window management
- **Solution Patterns** โ€” Knowledge propagation across the collective
- **Heartbeat Engine** โ€” Scheduled background processes
- **Sub-Agents** โ€” Parallel drone task execution

### โฌ…๏ธ Left Face โ€” Skills

*What the collective can do*

| Capability | Description |
|------------|-------------|
| **GitHub** | Repos, PRs, issues, releases with safety protocols |
| **Google Workspace** | Gmail, Calendar, Drive (OAuth2 assimilation) |
| **MCP Protocol** | Model Context Protocol client (Stdio, SSE, WebSocket) |
| **Browser** | Playwright bridge + CDP fallback |
| **Speech** | STT: OpenAI, Open WebUI, whisper.cpp |
| **Voice** | TTS: ElevenLabs streaming synthesis |
| **Images** | DALL-E 3, Stable Diffusion |
| **QR Codes** | Generation (PNG/SVG/Terminal) |
| **URLs** | Shortening via is.gd, tinyurl, YOURLS |
| **Plugins** | WASM sandboxed extensions |

Current skill lifecycle status:

- local skill installs and local packaged `.tar.gz` installs are implemented
- GitHub `owner/repo` installs, GitHub-backed registry installs, direct GitHub `SKILL.md` URLs, and remote `.tar.gz` archive URLs are implemented
- skill packaging, publishing, and package inspection are implemented
- arbitrary non-GitHub direct `SKILL.md` URLs can install companion files via manifest `files:` entries, an adjacent `SKILL.files.json` sidecar, or manifest-directory discovery when the source exposes a browsable listing

### โžก๏ธ Right Face โ€” Security

*How the collective protects itself*

- **WASM Sandbox** โ€” Isolated extension execution via wasmtime
- **Docker Sandbox** โ€” Optional containerized `execute_command` path with explicit image, mount, network, and timeout policy
- **PTY + Background Exec** โ€” Foreground PTY support plus persisted background command processes with operator inspection/cancel controls
- **SSRF Protection** โ€” Blocks localhost, private IPs, internal addresses
- **Command Blocklist** โ€” Regex-based dangerous command blocking
- **Pairing Codes** โ€” 6-digit channel authentication
- **Prompt Injection Defense** โ€” Pattern detection + sanitization
- **Secret Leak Detection** โ€” API key redaction
- **Encrypted Secrets** โ€” ChaCha20-Poly1305
- **Vault Integration** โ€” Bitwarden (primary), 1Password (secondary)
- **Approval Gates** โ€” Destructive operations require confirmation

### ๐Ÿ”ฒ Front Face โ€” Neural Processors (LLM Providers)

*How the collective thinks*

| Processor | Status | Key |
|-----------|--------|-----|
| OpenAI | โœ… Assimilated | `OPENAI_API_KEY` |
| Anthropic | โœ… Assimilated | `ANTHROPIC_API_KEY` |
| Google | โœ… Assimilated | `GOOGLE_API_KEY` |
| **Kimi** | ๐Ÿ†• New | `KIMI_API_KEY` |
| **MiniMax** | ๐Ÿ†• New | `MINIMAX_API_KEY` |
| **Z.ai** | ๐Ÿ†• New | `Z_API_KEY` |
| Ollama | โœ… Local node | Local |

Provider credentials can also be managed as encrypted named provider profiles. The active profile is referenced from `agent.provider_profile`, which keeps secrets out of `config.toml`.

### ๐Ÿ”ณ Back Face โ€” Runtime

*How the collective operates*

- **Scheduler** โ€” Cron-based process execution with recovery
- **Dead-Letter Queue** โ€” Failed process management
- **Catch-Up Policy** โ€” Missed process handling
- **Pause/Resume** โ€” Operator control over scheduled tasks
- **Heartbeat** โ€” Background process persistence
- **Backup/Restore** โ€” Full collective state export/import

---

## ๐ŸŽฎ Operating the Collective

### Gateway Web Interface

The BorgClaw Gateway provides a **real-time web dashboard** for monitoring and configuration:

```bash
# Start the gateway
cargo run --bin borgclaw-gateway

# Access the dashboard at:
open http://localhost:3000 # macOS
xdg-open http://localhost:3000 # Linux
start http://localhost:3000 # Windows
```

**Dashboard Features:**
| Feature | Description |
|---------|-------------|
| ๐Ÿ’ฌ **Live Chat** | Send messages to your agent directly from the browser |
| ๐Ÿ“Š **Real-time Metrics** | Active connections, message counts, uptime |
| โš™๏ธ **Config Editor** | Visual configuration management (Ctrl+, to open) |
| ๐Ÿ”Œ **Connection Status** | View authenticated WebSocket clients |
| ๐Ÿ› ๏ธ **API Explorer** | Browse all available HTTP endpoints |
| ๐Ÿท๏ธ **Health Checks** | Run diagnostics on all subsystems |

**API Endpoints:**
- `GET /api/status` โ€” System status and version
- `GET /api/metrics` โ€” Real-time connection metrics
- `GET /api/config` โ€” Current configuration (JSON)
- `POST /api/config` โ€” Update configuration
- `GET /api/connections` โ€” Active WebSocket clients
- `GET /api/tools` โ€” Available agent tools
- `GET /api/doctor` โ€” Health check results
- `GET /ws` โ€” WebSocket endpoint for real-time communication

### Collective Diagnostics
```bash
./scripts/doctor.sh # Verify all faces
./scripts/with-build-env.sh cargo test --workspace # Run the workspace suite with bounded temp usage
./scripts/with-build-env.sh cargo run --bin borgclaw -- self-test # Exit 0 on pass
./scripts/with-build-env.sh cargo run --bin borgclaw -- runtime # Show collective status
./scripts/clean-build-cache.sh # Trim incremental + stale temp scratch
./scripts/clean-build-cache.sh --all # Full cargo clean when you need a reset
borgclaw providers list # Show configured provider profiles
borgclaw processes list # Inspect persisted background command processes
./scripts/install-docker-sandbox.sh # Build the optional base + remote Docker sandbox images
```

Use the `with-build-env` wrappers for manual Cargo commands. They keep temporary files under `.local/cache/tmp`, reuse the shared `target/` tree, and trim oversized incremental caches before they consume the machine.

### Command Processes
```bash
cargo run --bin borgclaw -- processes list
cargo run --bin borgclaw -- processes show
cargo run --bin borgclaw -- processes cancel
```

### Scheduled Processes
```bash
cargo run --bin borgclaw -- schedules list
cargo run --bin borgclaw -- schedules create --name "backup" --trigger "cron:0 2 * * *" --action "message:backup"
cargo run --bin borgclaw -- schedules pause
cargo run --bin borgclaw -- schedules resume
```

### Heartbeat Processes
```bash
cargo run --bin borgclaw -- heartbeat list
cargo run --bin borgclaw -- heartbeat show
cargo run --bin borgclaw -- heartbeat enable
cargo run --bin borgclaw -- heartbeat disable
```

### Secure Storage
```bash
cargo run --bin borgclaw -- secrets list
cargo run --bin borgclaw -- secrets set MY_API_KEY
cargo run --bin borgclaw -- secrets check MY_API_KEY
cargo run --bin borgclaw -- secrets delete MY_API_KEY
```

### Backup & Restoration
```bash
cargo run --bin borgclaw -- backup export ./backup.json
cargo run --bin borgclaw -- backup import ./backup.json --force
cargo run --bin borgclaw -- backup verify ./backup.json
```

---

## โš™๏ธ Configuration

BorgClaw can be configured through **multiple interfaces**:

1. **๐Ÿ“œ Configuration File** โ€” Direct TOML editing
2. **๐ŸŒ Web Interface** โ€” Visual editor via Gateway (recommended)
3. **๐Ÿ“ก API** โ€” Programmatic configuration updates

### Quick Configuration via Web Interface

When the gateway is running, open `http://localhost:3000` in your browser to access the **Configuration Editor**:

```bash
# Start the gateway
cargo run --bin borgclaw-gateway

# Open http://localhost:3000 in your browser
```

The visual editor allows you to modify:
- **Agent** โ€” LLM provider, model, system prompts
- **Channels** โ€” WebSocket/Webhook enable, ports, pairing settings
- **Security** โ€” Approval mode, prompt injection, secret leak detection
- **Memory** โ€” Hybrid search, session limits
- **Skills** โ€” Auto-load settings and configuration status

**Keyboard Shortcuts:**
- `Ctrl + ,` โ€” Open configuration editor
- `Esc` โ€” Close configuration editor

### Configuration File

For manual configuration, create `~/.config/borgclaw/config.toml`:

```toml
[agent]
model = "claude-sonnet-4-20250514"
provider = "anthropic"
workspace = ".borgclaw/workspace"
heartbeat_interval = 30

[security]
wasm_sandbox = true
prompt_injection_defense = true

[security.docker]
enabled = false
image = "borgclaw-sandbox:base"
network = "none"
workspace_mount = "ro"
timeout_seconds = 120

[memory]
hybrid_search = true
session_max_entries = 100

[heartbeat]
enabled = true
check_interval_seconds = 60

[channels.telegram]
enabled = true
token = "${TELEGRAM_BOT_TOKEN}"

[channels.signal]
enabled = false

[channels.webhook]
enabled = true
port = 8080
secret = "${WEBHOOK_SECRET}"
```

---

## ๐Ÿ”ง Optional Components

### Playwright (Browser Automation)
```bash
./scripts/install-playwright.sh # Linux/macOS
.\scripts\install-playwright.ps1 # Windows
```

### PostgreSQL + pgvector (Memory Runtime)
```bash
./scripts/install-pgvector.sh # Linux/macOS
.\scripts\install-pgvector.ps1 # Windows
```

### Ollama (Embeddings Runtime)
```bash
./scripts/install-ollama.sh # Linux/macOS
.\scripts\install-ollama.ps1 # Windows
```

### Whisper.cpp (Local STT)
```bash
./scripts/install-whisper.sh # Linux/macOS
.\scripts\install-whisper.ps1 # Windows
```

### Bitwarden CLI (Vault)
```bash
bw install
bw login
export BW_SESSION=$(bw unlock --raw)
```

### 1Password CLI (Secondary Vault)
```bash
# Install from https://1password.com/downloads/command-line/
op signin
```

---

## ๐Ÿ“ Collective Structure

```
borgclaw/
โ”œโ”€โ”€ borgclaw-core/ # Core collective (the center)
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ agent/ # Agent, tools, subagents
โ”‚ โ”‚ โ”œโ”€โ”€ channel/ # Telegram, Signal, Webhook, CLI
โ”‚ โ”‚ โ”œโ”€โ”€ memory/ # Storage, session, solution, heartbeat
โ”‚ โ”‚ โ”œโ”€โ”€ security/ # WASM, secrets, pairing, vault
โ”‚ โ”‚ โ”œโ”€โ”€ skills/ # GitHub, Google, Browser, STT, TTS, etc.
โ”‚ โ”‚ โ””โ”€โ”€ mcp/ # MCP protocol client
โ”‚ โ””โ”€โ”€ Cargo.toml
โ”œโ”€โ”€ borgclaw-cli/ # Direct interface
โ”œโ”€โ”€ borgclaw-gateway/ # WebSocket gateway
โ”œโ”€โ”€ scripts/ # Utility protocols
โ”œโ”€โ”€ docs/ # Knowledge base
โ”œโ”€โ”€ .borgclaw/ # Local collective state (gitignored)
โ””โ”€โ”€ ~/.config/borgclaw/ # User configuration location
```

---

## ๐Ÿ“š Knowledge Base

- [Changelog](CHANGELOG.md) โ€” Evolution history
- [Quick Start](docs/quickstart.md) โ€” First assimilation
- [Onboarding](docs/onboarding.md) โ€” Configuration protocols
- [Gateway](docs/gateway.md) โ€” Web dashboard and API
- [Channels](docs/channels.md) โ€” Interface documentation
- [Memory](docs/memory.md) โ€” Storage and retrieval
- [Skills](docs/skills.md) โ€” Capability integration
- [Security](docs/security.md) โ€” Defense protocols
- [Integrations](docs/integrations.md) โ€” External services
- [Inspirations](docs/inspirations.md) โ€” Upstream examples

---

## ๐Ÿงฌ Origin

BorgClaw combines the most efficient patterns from the OpenClaw collective:

| Source | Contribution |
|--------|--------------|
| **OpenClaw** | Comprehensive skills system |
| **ZeroClaw** | Rust trait-based architecture, AIEOS identity |
| **NanoClaw** | Container isolation patterns |
| **IronClaw** | WASM sandbox, security-first design |
| **PicoClaw** | Ultra-lightweight efficiency |
| **TinyClaw** | Multi-agent coordination |

See [Inspirations](docs/inspirations.md) for how upstream patterns were assimilated.

---

**๐ŸงŠ Six Faces. One Mind. Infinite Adaptation.**

*Your tools will be assimilated. Your workflows will improve. Efficiency is non-negotiable.*

[โญ Join the Collective](https://github.com/lealvona/borgclaw) โ€ข [๐Ÿ“– Access Knowledge](docs/) โ€ข [๐Ÿ› Report Anomalies](../../issues)

MIT License ยฉ 2026