# Repository Briefing: spinabot/brigade
> Source: https://repoforai.com/repo/spinabot/brigade (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/spinabot/brigade
- **Official Docs / Website**: https://www.brigade.spinabot.com
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: A (87/100 · Maintenance 35/35 · Adoption 12/25 · Releases 20/20 · License 20/20)
- **Latest Release**: brigade-v1.39.2 (2026-11-04) — https://github.com/spinabot/brigade/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Self-Hosted, Local AI, MCP, CLI
- **Momentum**: 11,391 ★ total (+0 24h / +0 7d) · 82 forks
- **Topics**: `agent-runtime`, `ai`, `ai-crew`, `autonomous-agents`, `brigade`, `brigade-agent`, `chatgpt`, `clawdbot`, `codex`, `crustacean`, `hermes`, `hermes-agent`
- **When to Use**: Best for: Individuals or small teams that want a persistent agent crew across terminal and messaging channels, with control over where the gateway and state run. Skip if: You only need interactive chat, want zero infrastructure maintenance, or need independently verified OS-level isolation before running privileged tools.

## Overview
```text
### Architecture & Core Mechanics
Brigade is a TypeScript application packaged as `@spinabot/brigade`. The `brigade` CLI can run the long-lived WebSocket gateway on port 7777 or attach a thin client. Terminal and messaging inputs share a routing pipeline that resolves each message to an agent and session. The gateway assembles the prompt from persona, skills, and org context, streams model output, checks tool calls against approval and ownership rules, and persists the transcript. Work stays with the gateway when clients disconnect.

The package includes `@earendil-works/pi-agent-core`, `@earendil-works/pi-ai`, and `@earendil-works/pi-tui`, alongside channel libraries such as `grammy`, `discord.js`, and `@whiskeysockets/baileys`. The default filesystem layout keeps configuration, agent workspaces, JSONL sessions, memory, and cron state under `~/.brigade/`; self-hosted Convex is optional. Extensibility comes through `SKILL.md` discovery, a typed channel-adapter contract, and MCP connections. The memory export exposed by `brigade mcp` uses stdio, not the gateway's WebSocket client protocol.

### Key Capabilities & Differentiators
Tideline stores facts in `facts.jsonl` in filesystem mode. It scopes recall by origin, deduplicates writes, applies three tiers of decay, and checks provenance before allowing changes to identity or preferences. Retrieval combines BM25 with a model-free vector lane and a typed link graph; nightly consolidation maintains long-lived memory. Org rules govern agent-to-agent messaging. Parallel delegation has depth and child-count limits, cancellation cascades to children, and the parent is notified when they settle.

Brigade supports hosted providers such as Anthropic, OpenAI, Gemini, and OpenRouter, plus Ollama and OpenAI-compatible endpoints. Carrow keeps the transcript in the same session, strips provider-specific reasoning blocks as needed, and adjusts reasoning settings for the target model. A mid-turn switch aborts the current run and replays the last message; it does not transfer an in-flight generation. The crew is reachable through Slack, Telegram, WhatsApp, Discord, iMessage, and BlueBubbles, with text-only iMessage via `imsg`. Document tools analyze attachments and create or edit Word, Excel, PowerPoint, and PDF files; analysis provider choice matters for data handling.

### Trade-offs & Limitations
Compared with a standalone model CLI, Brigade trades a simpler local process for a crew that can keep running, share persistent memory under origin rules, and accept work from multiple channels. Compared with a hosted workspace, it puts gateway and storage operations under your control, but leaves you responsible for channel credentials, backups, approvals, and access policy. Self-hosting is not the same as keeping all data local: hosted models, media analysis, messaging adapters, and Composio can send workflow data outside the host.

Switching providers makes it easier to choose a model per task, but replay after an interrupted turn should not be treated as a rollback of external tool actions. For workflows that write to third-party apps, confirm how retries are handled before enabling unattended runs. Origin scoping and org rules help contain context and communication, but do not establish OS-level sandboxing. Keep the gateway private by default, restrict shell approvals and connector scopes, and treat public tunneling as a change to the deployment's security boundary.

### Hardware & Deployment Guide
Run it on Node.js 22.12 or newer. Install with `npm i -g @spinabot/brigade`, run `brigade onboard` to choose storage and a model provider, then open `brigade tui`, which starts the gateway if needed. Use `brigade gateway run` for a dedicated foreground process or `brigade gateway install` for launchd, systemd, or Windows Task Scheduler. The filesystem path requires no separate database. If you choose self-hosted Convex, plan for database operation and recovery; in either mode, test restoration of local configuration and workspaces.

For hosted inference, size the gateway for Node.js, enabled channels, document processing, and scheduled work rather than GPU inference. With Ollama, size inference separately for the chosen model and concurrency. To operate offline, pair local inference and storage with workflows that do not use web search, external connectors, or hosted messaging. Version 1.39.0 added durable collaboration mode; 1.39.1 made subscription sign-in failures more specific; 1.39.2 added trust for OS root certificates, relevant on networks that inspect HTTPS.
```

## Key Capabilities
```text
- Gateway: Thin WebSocket clients attach to a long-lived process; turns can continue after the terminal disconnects.
- Memory: Tideline combines origin-scoped facts and a provenance write gate with BM25, model-free vector recall, and nightly consolidation.
- Delegation: Org-chart rules govern agent-to-agent messaging; child runs default to a depth cap of 3 and a child-count cap of 5.
- Model switching: Carrow reuses the session transcript across providers; a mid-turn switch aborts the current run and replays the last message.
- Integration: MCP supports inbound server connections and exports memory over stdio; the owner-only Composio tool uses managed OAuth.
- Operations: The gateway pairs a heartbeat file with an external supervisor, and scheduled jobs persist across restarts.
```

## Quick Start / Clone
```bash
# macOS / Linux — installs Node if needed, then Brigade (no sudo)
curl -fsSL https://brigade.spinabot.com/install.sh | sh
brigade
```
