brainiac 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +134 -151
- data/bin/brainiac +89 -110
- data/brainiac.gemspec +4 -3
- data/docs/waybar-config.md +7 -27
- data/lib/brainiac/agents.rb +5 -5
- data/lib/brainiac/config.rb +0 -36
- data/lib/brainiac/cron.rb +15 -17
- data/lib/brainiac/helpers.rb +58 -31
- data/lib/brainiac/hooks.rb +1 -1
- data/lib/brainiac/notifications.rb +2 -2
- data/lib/brainiac/prompts.rb +11 -133
- data/lib/brainiac/restart.rb +0 -3
- data/lib/brainiac/routes/api.rb +6 -32
- data/lib/brainiac/sessions.rb +1 -2
- data/lib/brainiac/version.rb +1 -1
- data/monitor/shared.rb +1 -1
- data/receiver.rb +2 -227
- data/templates/agents.json.example +2 -2
- data/templates/brainiac.json.example +1 -6
- data/templates/testflight.json.example +1 -1
- data/templates/users.json.example +20 -82
- metadata +5 -9
- data/lib/brainiac/handlers/github.rb +0 -390
- data/lib/brainiac/handlers/zoho.rb +0 -429
- data/lib/brainiac/zoho_mail_api.rb +0 -110
- data/templates/github.json.example +0 -4
- data/templates/zoho.json.example +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7890616cf0466e9c991c0e1209ff482eae548c205d151746c3f3065d2c239033
|
|
4
|
+
data.tar.gz: 76f04a3697a1070932a9754281828fb6d49869c3efe1b0efc9a89c98f3ee9bba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 975a3cff959457bd2bf6f622010d3f016643f36aea981874e9424fb278666eda22441fd9f0e5938806849eaa4165f62c2f1c5fd1be10ad32b501afcecfacfb1a
|
|
7
|
+
data.tar.gz: 2c94aeefd3190ad1c8f074665486988d1b0440b4cb104a5dae39d670bb5559db0d5abeb64a4d4da132c6ff8e2d385e004ee26d11568a6eaf7313a822f854065d
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
brainiac (0.0.
|
|
4
|
+
brainiac (0.0.12)
|
|
5
5
|
puma (~> 7.2)
|
|
6
6
|
rackup (~> 2.3)
|
|
7
7
|
sinatra (~> 4.1)
|
|
@@ -84,7 +84,7 @@ DEPENDENCIES
|
|
|
84
84
|
CHECKSUMS
|
|
85
85
|
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
86
86
|
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
87
|
-
brainiac (0.0.
|
|
87
|
+
brainiac (0.0.12)
|
|
88
88
|
json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
|
|
89
89
|
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
90
90
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
data/README.md
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
# Brainiac
|
|
2
2
|
|
|
3
|
-
Brainiac is a multi-agent orchestration layer for developer workflows. It
|
|
3
|
+
Brainiac is a multi-agent orchestration layer for developer workflows. It manages agent identity, long-term memory, and prompt construction — then delegates communication channels to plugins. By managing personas, shared knowledge, and collaborative workflows via @mentions, Brainiac allows you to deploy and manage a unified fleet of AI experts directly from your CLI.
|
|
4
4
|
|
|
5
5
|
## How It Works
|
|
6
6
|
|
|
7
|
-
Brainiac
|
|
7
|
+
Brainiac is a core engine plus plugins. The core handles agent identity, brain (long-term memory), prompt construction, and dispatch. Plugins provide the communication channels — each one connects a different tool (Fizzy, GitHub, Discord, Zoho) to your agent fleet.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install only the plugins you need:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
```bash
|
|
12
|
+
brainiac install fizzy # Card management
|
|
13
|
+
brainiac install discord # Conversational bots
|
|
14
|
+
brainiac install github # PR reviews, CI notifications
|
|
15
|
+
brainiac install zoho # Email notifications and triage
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Because each agent maintains its own unique persona and configuration, you can deploy a specialized team—all managed through `~/.brainiac/agents.json`. Project tracking is handled via `~/.brainiac/projects.json`, and because the system reloads configurations dynamically, you can iterate on your agent workflows in real-time without ever needing a restart.
|
|
19
|
+
|
|
20
|
+
### Events (via plugins)
|
|
21
|
+
|
|
22
|
+
Each plugin adds its own webhook routes and event handling. Here's what's available when plugins are installed:
|
|
23
|
+
|
|
24
|
+
| Source | Event | Plugin Required | What Happens |
|
|
25
|
+
| --------- | ------------------- | --------------- | ------------------------------------------------------------------------- |
|
|
26
|
+
| Fizzy | Card assigned | `brainiac-fizzy` | Creates worktree, maps card to branch, spawns assigned agent |
|
|
27
|
+
| Fizzy | Card published | `brainiac-fizzy` | Duplicate detection via trigram similarity + semantic search |
|
|
28
|
+
| Fizzy | @mention in comment | `brainiac-fizzy` | Routes to the mentioned agent (even on another agent's card) |
|
|
29
|
+
| Fizzy | Follow-up comment | `brainiac-fizzy` | Runs card's assigned agent in existing worktree |
|
|
30
|
+
| GitHub | PR review submitted | `brainiac-github` | Agent addresses review feedback |
|
|
31
|
+
| GitHub | PR comment | `brainiac-github` | Agent responds to PR feedback |
|
|
32
|
+
| GitHub | PR merged to main | `brainiac-github` | Cleans up worktree, emits hooks for card plugins |
|
|
33
|
+
| GitHub | Issue opened | `brainiac-github` | Logged for tracking (no agent dispatch) |
|
|
34
|
+
| GitHub | Workflow run | `brainiac-github` | Notifies on CI failures and deploys |
|
|
35
|
+
| Discord | @bot mention | `brainiac-discord` | Each agent has its own bot — @mention routes directly, conversational |
|
|
36
|
+
| Zoho Mail | Incoming email | `brainiac-zoho` | Rule-based matching, notifies via Discord or triages to card |
|
|
24
37
|
|
|
25
38
|
### Inline Tags
|
|
26
39
|
|
|
@@ -48,29 +61,29 @@ The agent stays read-only during planning — no code changes, no commits. Once
|
|
|
48
61
|
|
|
49
62
|
### Cross-Agent Mentions
|
|
50
63
|
|
|
51
|
-
Any agent can be tagged on any card. If
|
|
64
|
+
Any agent can be tagged on any card. If Merlin is working card #42 and someone comments "@Sherlock what do you think?", Sherlock reviews the card and PR without touching Merlin's worktree. This enables patterns like:
|
|
52
65
|
|
|
53
66
|
- Engineer agent does the work, security agent reviews it
|
|
54
67
|
- One agent asks another for a second opinion
|
|
55
|
-
- A read-only agent (e.g.
|
|
68
|
+
- A read-only agent (e.g. Robin) that reviews and comments but doesn't take over the card
|
|
56
69
|
|
|
57
70
|
#### Display Name Accuracy
|
|
58
71
|
|
|
59
|
-
Agents need to spell @mentions exactly as they appear in Fizzy (e.g. `@
|
|
72
|
+
Agents need to spell @mentions exactly as they appear in Fizzy (e.g. `@Robin` not `@robin`). The agent registry's `fizzy_name` field handles this — every prompt includes an agent roster with the correct spelling:
|
|
60
73
|
|
|
61
74
|
```
|
|
62
75
|
## Agent Roster
|
|
63
76
|
When @mentioning other agents in Fizzy comments, use the EXACT spelling below.
|
|
64
|
-
- @
|
|
65
|
-
- @
|
|
66
|
-
- @
|
|
77
|
+
- @Sherlock
|
|
78
|
+
- @Robin
|
|
79
|
+
- @Merlin
|
|
67
80
|
```
|
|
68
81
|
|
|
69
|
-
Detection is case-insensitive (inbound `@
|
|
82
|
+
Detection is case-insensitive (inbound `@robin` still matches Robin), but outbound mentions use the exact `fizzy_name` from the registry.
|
|
70
83
|
|
|
71
84
|
#### Agent-to-Agent Loop Prevention
|
|
72
85
|
|
|
73
|
-
When agents can tag each other, infinite loops become possible (
|
|
86
|
+
When agents can tag each other, infinite loops become possible (Sherlock tags Robin, Robin tags Sherlock back, forever). Brainiac prevents this with layered defenses:
|
|
74
87
|
|
|
75
88
|
1. **Dispatch depth limit** — a per-card counter tracks agent-to-agent hops since the last human comment. Default max depth is 10: Human → Agent A → Agent B → ... is allowed up to the limit. The counter resets when a human comments on the card, and expires after 1 hour of no human activity.
|
|
76
89
|
|
|
@@ -134,52 +147,56 @@ After installing the gem:
|
|
|
134
147
|
brainiac setup
|
|
135
148
|
```
|
|
136
149
|
|
|
137
|
-
This creates the `~/.brainiac/` directory structure and
|
|
150
|
+
This creates the `~/.brainiac/` directory structure, detects existing agents in `~/.brainiac/agents.json`, and sets your default agent. If no agents exist, it offers to create your first one.
|
|
138
151
|
|
|
139
|
-
|
|
152
|
+
Then install the plugins you need:
|
|
140
153
|
|
|
141
154
|
```bash
|
|
142
|
-
brainiac install
|
|
143
|
-
brainiac install
|
|
144
|
-
brainiac
|
|
155
|
+
brainiac install discord # Discord bots
|
|
156
|
+
brainiac install fizzy # Fizzy card management
|
|
157
|
+
brainiac install github # GitHub webhooks
|
|
158
|
+
brainiac install zoho # Zoho Mail
|
|
159
|
+
brainiac restart # Restart to activate
|
|
145
160
|
```
|
|
146
161
|
|
|
147
|
-
|
|
162
|
+
Each plugin has its own setup command (e.g. `brainiac discord setup`, `brainiac github setup`) that creates the necessary config files.
|
|
148
163
|
|
|
149
164
|
### Prerequisites
|
|
150
165
|
|
|
151
166
|
| Dependency | Required | Install |
|
|
152
167
|
|------------|----------|---------|
|
|
153
168
|
| Ruby 3.4+ | Yes | [mise](https://mise.jdx.dev), rbenv, or system |
|
|
154
|
-
| [Kiro CLI](https://kiro.dev)
|
|
155
|
-
| [Fizzy CLI](https://github.com/robzolkos/fizzy-cli) | For Fizzy | Card management |
|
|
156
|
-
| [GitHub CLI](https://cli.github.com) (`gh`) | For GitHub | PR/issue operations |
|
|
169
|
+
| An AI agent CLI | Yes | [Kiro CLI](https://kiro.dev), [Grok CLI](https://x.ai), or any CLI that accepts prompts on stdin |
|
|
157
170
|
| [ngrok](https://ngrok.com) | Yes | Webhook tunneling |
|
|
158
171
|
| [qmd](https://github.com/tobi/qmd) | For brain | `npm install -g @tobilu/qmd` (Node.js >= 22) |
|
|
172
|
+
| [Fizzy CLI](https://github.com/robzolkos/fizzy-cli) | For `brainiac-fizzy` | Card management |
|
|
173
|
+
| [GitHub CLI](https://cli.github.com) (`gh`) | For `brainiac-github` | PR/issue operations |
|
|
159
174
|
| [gum](https://github.com/charmbracelet/gum) | Optional | Manual worktree cleanup |
|
|
160
175
|
|
|
176
|
+
Brainiac is CLI-agnostic — configure your preferred agent CLI in `~/.brainiac/cli-providers/`. The project config determines which CLI provider to use per-project.
|
|
177
|
+
|
|
161
178
|
### Directory Structure
|
|
162
179
|
|
|
163
180
|
After setup, `~/.brainiac/` looks like:
|
|
164
181
|
|
|
165
182
|
```
|
|
166
183
|
~/.brainiac/
|
|
184
|
+
├── brainiac.json # Core config (default_agent)
|
|
167
185
|
├── agents.json # Agent registry (tokens, display names, local flag)
|
|
168
186
|
├── projects.json # Registered projects
|
|
169
|
-
├── github.json # GitHub webhook secret
|
|
170
|
-
├── fizzy.json # Fizzy board config, authorized users
|
|
171
|
-
├── discord.json # Discord channel mappings, auth
|
|
172
187
|
├── users.json # Cross-platform user identity registry
|
|
173
|
-
├──
|
|
188
|
+
├── plugins.json # Installed plugins
|
|
174
189
|
├── brain/
|
|
175
190
|
│ ├── knowledge/ # Shared technical knowledge (all agents)
|
|
176
191
|
│ ├── persona/ # Per-agent personality files
|
|
177
192
|
│ └── memory/ # Per-agent session memory
|
|
178
|
-
├── handlers/ #
|
|
193
|
+
├── handlers/ # Legacy custom webhook handlers
|
|
179
194
|
├── plans/ # Planning mode output
|
|
180
195
|
└── tmp/ # Temp files, drafts, posted responses
|
|
181
196
|
```
|
|
182
197
|
|
|
198
|
+
Plugins add their own config files when installed (e.g. `discord.json`, `fizzy.json`, `github.json`, `zoho.json`).
|
|
199
|
+
|
|
183
200
|
### Step-by-Step Configuration
|
|
184
201
|
|
|
185
202
|
#### 1. Agent Registry (`~/.brainiac/agents.json`)
|
|
@@ -188,8 +205,8 @@ Maps agents to their identity and environment. Every agent that should dispatch
|
|
|
188
205
|
|
|
189
206
|
```json
|
|
190
207
|
{
|
|
191
|
-
"
|
|
192
|
-
"fizzy_name": "
|
|
208
|
+
"sherlock": {
|
|
209
|
+
"fizzy_name": "Sherlock",
|
|
193
210
|
"local": true,
|
|
194
211
|
"env": {
|
|
195
212
|
"FIZZY_TOKEN": "fizzy_abc...",
|
|
@@ -201,74 +218,35 @@ Maps agents to their identity and environment. Every agent that should dispatch
|
|
|
201
218
|
|
|
202
219
|
See [Multi-Agent Setup](#multi-agent-setup) for full details.
|
|
203
220
|
|
|
204
|
-
#### 2.
|
|
205
|
-
|
|
206
|
-
Each agent also needs a kiro-cli config. The filename becomes the agent name:
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
kiro-cli agent create # Interactive
|
|
210
|
-
# Or manually create ~/.kiro/agents/galen.json
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
#### 3. GitHub (`~/.brainiac/github.json`)
|
|
214
|
-
|
|
215
|
-
```json
|
|
216
|
-
{
|
|
217
|
-
"webhook_secret": "your-github-webhook-secret",
|
|
218
|
-
"repos": {}
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
The `webhook_secret` verifies incoming GitHub webhook requests. Generate one with `ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'`.
|
|
221
|
+
#### 2. CLI Providers (`~/.brainiac/cli-providers/`)
|
|
223
222
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
#### 4. Fizzy (`~/.brainiac/fizzy.json`)
|
|
227
|
-
|
|
228
|
-
Defines authorized users, flags humans, and configures boards:
|
|
223
|
+
Configure which AI CLI to use for dispatching agents. Each provider is a JSON file:
|
|
229
224
|
|
|
230
225
|
```json
|
|
231
226
|
{
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
{ "id": "agent-id-1", "name": "Galen", "human": false }
|
|
236
|
-
],
|
|
237
|
-
"boards": {
|
|
238
|
-
"development": {
|
|
239
|
-
"board_id": "your-board-id",
|
|
240
|
-
"webhook_secret": "secret-for-this-board",
|
|
241
|
-
"columns": {
|
|
242
|
-
"right_now": "column-id",
|
|
243
|
-
"needs_review": "column-id",
|
|
244
|
-
"uat": "column-id"
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
227
|
+
"agent_cli": "kiro-cli",
|
|
228
|
+
"agent_cli_args": "chat --trust-all-tools --no-interactive",
|
|
229
|
+
"agent_model_flag": "--model"
|
|
248
230
|
}
|
|
249
231
|
```
|
|
250
232
|
|
|
251
|
-
|
|
233
|
+
Brainiac ships with example providers during setup. Your project config references which provider to use.
|
|
252
234
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
**Legacy:** `FIZZY_WEBHOOK_SECRET` and `AUTHORIZED_USER_IDS` env vars work as fallbacks.
|
|
256
|
-
|
|
257
|
-
#### 5. Environment Variables
|
|
235
|
+
#### 3. Environment Variables
|
|
258
236
|
|
|
259
237
|
Most config lives in JSON files now. The default agent is set in `brainiac.json`:
|
|
260
238
|
|
|
261
239
|
```json
|
|
262
|
-
{ "default_agent": "
|
|
240
|
+
{ "default_agent": "Sherlock" }
|
|
263
241
|
```
|
|
264
242
|
|
|
265
243
|
Or via environment variable (takes precedence):
|
|
266
244
|
|
|
267
245
|
```bash
|
|
268
|
-
export AI_AGENT_NAME="
|
|
246
|
+
export AI_AGENT_NAME="Sherlock"
|
|
269
247
|
```
|
|
270
248
|
|
|
271
|
-
####
|
|
249
|
+
#### 4. Register Projects
|
|
272
250
|
|
|
273
251
|
```bash
|
|
274
252
|
cd ~/Code/marketplace && brainiac register
|
|
@@ -284,21 +262,34 @@ Set a default project (used as fallback when no tags match):
|
|
|
284
262
|
brainiac projects default myproject
|
|
285
263
|
```
|
|
286
264
|
|
|
287
|
-
####
|
|
265
|
+
#### 5. Initialize Brain
|
|
288
266
|
|
|
289
267
|
```bash
|
|
290
|
-
brainiac brain init
|
|
268
|
+
brainiac brain init Sherlock
|
|
291
269
|
```
|
|
292
270
|
|
|
293
271
|
This creates the directory structure, sets up qmd collections, and indexes everything.
|
|
294
272
|
|
|
295
|
-
####
|
|
273
|
+
#### 6. Install Plugins
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
brainiac install discord # Discord bots
|
|
277
|
+
brainiac install fizzy # Fizzy card management
|
|
278
|
+
brainiac install github # GitHub webhooks
|
|
279
|
+
brainiac install zoho # Zoho Mail
|
|
280
|
+
```
|
|
296
281
|
|
|
297
|
-
|
|
282
|
+
Each plugin has its own setup command (e.g. `brainiac github setup`) and documentation. See [Plugins](#plugins-gem-based-handlers) for details.
|
|
298
283
|
|
|
299
|
-
|
|
284
|
+
#### 7. Configure Webhooks
|
|
300
285
|
|
|
301
|
-
|
|
286
|
+
Each plugin provides its own webhook endpoint. Point your tools at your ngrok URL:
|
|
287
|
+
|
|
288
|
+
- **Fizzy:** `https://your-ngrok.ngrok-free.app/fizzy/<board-key>` (see `brainiac fizzy setup`)
|
|
289
|
+
- **GitHub:** `https://your-ngrok.ngrok-free.app/github` (see `brainiac github setup`)
|
|
290
|
+
- **Zoho:** `https://your-ngrok.ngrok-free.app/zoho` (see `brainiac zoho setup`)
|
|
291
|
+
|
|
292
|
+
#### 8. Start
|
|
302
293
|
|
|
303
294
|
```bash
|
|
304
295
|
brainiac server # Start and tail logs (Ctrl+C to detach, server keeps running)
|
|
@@ -316,67 +307,55 @@ Andy's Linux box Adam's macOS
|
|
|
316
307
|
┌─────────────────────┐ ┌─────────────────────┐
|
|
317
308
|
│ brainiac server │ │ brainiac server │
|
|
318
309
|
│ │ │ │
|
|
319
|
-
│ ~/.kiro/agents/: │ │ ~/.kiro/agents/: │
|
|
320
|
-
│ galen.json │ │ kaylee.json │
|
|
321
|
-
│ glados.json │ │ jane.json │
|
|
322
|
-
│ │ │ │
|
|
323
310
|
│ ~/.brainiac/ │ │ ~/.brainiac/ │
|
|
324
311
|
│ agents.json │ │ agents.json │
|
|
312
|
+
│ (sherlock, robin) │ │ (merlin, jane) │
|
|
313
|
+
│ cli-providers/ │ │ cli-providers/ │
|
|
314
|
+
│ kiro.json │ │ kiro.json │
|
|
325
315
|
└─────────────────────┘ └─────────────────────┘
|
|
326
316
|
│ │
|
|
327
317
|
└──── same Fizzy board + GitHub ────┘
|
|
328
318
|
```
|
|
329
319
|
|
|
330
|
-
Both machines receive the same webhooks. The
|
|
331
|
-
|
|
332
|
-
### Step 1: Create Kiro CLI Agent Configs
|
|
333
|
-
|
|
334
|
-
Each agent needs a kiro-cli config at `~/.kiro/agents/<name>.json`. This is the only registry — no separate config file needed.
|
|
335
|
-
|
|
336
|
-
```bash
|
|
337
|
-
kiro-cli agent create # Interactive
|
|
338
|
-
# Or manually create ~/.kiro/agents/galen.json, ~/.kiro/agents/glados.json
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
The receiver scans this directory to discover which agents it can dispatch. The filename becomes the agent name (e.g. `galen.json` → Galen). Tool permissions, model, and resources are all defined in the kiro-cli config.
|
|
320
|
+
Both machines receive the same webhooks. The agent registry (`~/.brainiac/agents.json`) controls which agents are local — only agents marked `"local": true` will be dispatched on that machine.
|
|
342
321
|
|
|
343
|
-
### Step
|
|
322
|
+
### Step 1: Agent Registry
|
|
344
323
|
|
|
345
|
-
The agent registry at `~/.brainiac/agents.json`
|
|
324
|
+
The agent registry at `~/.brainiac/agents.json` is the authority for agent identity. This serves four purposes:
|
|
346
325
|
|
|
347
326
|
1. **Per-agent environment variables** — any env var can be set per-agent via the `env` hash (e.g. `FIZZY_TOKEN`, `DISCORD_BOT_TOKEN`, custom vars)
|
|
348
|
-
2. **Display name mapping** — agents know the exact spelling for @mentions (e.g. `
|
|
327
|
+
2. **Display name mapping** — agents know the exact spelling for @mentions (e.g. `Robin` not `robin`)
|
|
349
328
|
3. **Discord bot tokens** — agents with `DISCORD_BOT_TOKEN` in their env get their own Discord bot
|
|
350
329
|
4. **Local flag** — agents marked `"local": true` pick up card assignments on this machine
|
|
351
330
|
|
|
352
331
|
```json
|
|
353
332
|
{
|
|
354
|
-
"
|
|
355
|
-
"fizzy_name": "
|
|
333
|
+
"sherlock": {
|
|
334
|
+
"fizzy_name": "Sherlock",
|
|
356
335
|
"local": true,
|
|
357
336
|
"env": {
|
|
358
337
|
"FIZZY_TOKEN": "fizzy_abc...",
|
|
359
338
|
"DISCORD_BOT_TOKEN": "Bot_abc..."
|
|
360
339
|
}
|
|
361
340
|
},
|
|
362
|
-
"
|
|
363
|
-
"fizzy_name": "
|
|
341
|
+
"robin": {
|
|
342
|
+
"fizzy_name": "Robin",
|
|
364
343
|
"env": {
|
|
365
344
|
"FIZZY_TOKEN": "fizzy_xyz...",
|
|
366
345
|
"DISCORD_BOT_TOKEN": "Bot_xyz..."
|
|
367
346
|
}
|
|
368
347
|
},
|
|
369
|
-
"
|
|
370
|
-
"fizzy_name": "
|
|
348
|
+
"merlin": {
|
|
349
|
+
"fizzy_name": "Merlin"
|
|
371
350
|
}
|
|
372
351
|
}
|
|
373
352
|
```
|
|
374
353
|
|
|
375
354
|
Keys are lowercase lookup keys (normalized: non-alphanumeric chars become hyphens). `fizzy_name` is the exact Fizzy account display name. The `env` hash is injected into the spawned agent process — every key/value pair becomes an environment variable.
|
|
376
355
|
|
|
377
|
-
The `local` flag controls which agents pick up card assignments on this machine. Agents without `"local": true` are still known for mention detection, display names, tokens, and cross-agent interactions — they just won't pick up card assignments.
|
|
356
|
+
The `local` flag controls which agents pick up card assignments on this machine. Agents without `"local": true` are still known for mention detection, display names, tokens, and cross-agent interactions — they just won't pick up card assignments. The default agent (from `AI_AGENT_NAME` or `brainiac.json`) is always considered local.
|
|
378
357
|
|
|
379
|
-
Agents without an `env` block (like
|
|
358
|
+
Agents without an `env` block (like Merlin above on a Linux box) still appear in the agent roster so local agents spell @mentions correctly.
|
|
380
359
|
|
|
381
360
|
The registry reloads on every webhook and via `POST /api/reload`.
|
|
382
361
|
|
|
@@ -390,13 +369,13 @@ Each agent needs at least one persona file. Create it directly in the brain:
|
|
|
390
369
|
|
|
391
370
|
```bash
|
|
392
371
|
# Create persona file for your agent
|
|
393
|
-
mkdir -p ~/.brainiac/brain/persona/
|
|
394
|
-
cat > ~/.brainiac/brain/persona/
|
|
372
|
+
mkdir -p ~/.brainiac/brain/persona/sherlock
|
|
373
|
+
cat > ~/.brainiac/brain/persona/sherlock/style.md << 'EOF'
|
|
395
374
|
---
|
|
396
|
-
name:
|
|
397
|
-
description: Persona voice for
|
|
375
|
+
name: sherlock-persona
|
|
376
|
+
description: Persona voice for Sherlock.
|
|
398
377
|
---
|
|
399
|
-
#
|
|
378
|
+
# Sherlock — Persona
|
|
400
379
|
Gruff, no-nonsense, direct, practical, a little cynical. Zero corporate fluff.
|
|
401
380
|
Keep responses tight and technical.
|
|
402
381
|
EOF
|
|
@@ -438,17 +417,17 @@ This creates the directory structure, sets up qmd collections, and indexes every
|
|
|
438
417
|
|
|
439
418
|
When a webhook arrives:
|
|
440
419
|
|
|
441
|
-
1. **Card assigned** — the receiver checks if any assignee matches a local agent name. Only agents marked `local`
|
|
442
|
-
2. **@mention in comment** — the receiver detects which agent is mentioned (e.g. `@
|
|
420
|
+
1. **Card assigned** — the receiver checks if any assignee matches a local agent name. Only agents marked `local` pick up assignments — this prevents multiple machines from dispatching the same card.
|
|
421
|
+
2. **@mention in comment** — the receiver detects which agent is mentioned (e.g. `@Sherlock`, `@SecurityBot`). If the mentioned agent differs from the card's assigned agent, it's a cross-agent review — the mentioned agent reviews without a worktree. Non-local agent mentions are ignored.
|
|
443
422
|
3. **Follow-up comment (no mention)** — the card's assigned agent handles it.
|
|
444
423
|
|
|
445
|
-
The command dispatched
|
|
424
|
+
The command dispatched is determined by your project's `agent_cli` config (from `cli-providers/`). For example with kiro-cli:
|
|
446
425
|
|
|
447
426
|
```bash
|
|
448
|
-
kiro-cli --agent
|
|
427
|
+
kiro-cli --agent sherlock chat --trust-all-tools --no-interactive
|
|
449
428
|
```
|
|
450
429
|
|
|
451
|
-
The
|
|
430
|
+
The exact command structure depends on your CLI provider configuration.
|
|
452
431
|
|
|
453
432
|
## Brain (Long-Term Memory)
|
|
454
433
|
|
|
@@ -463,8 +442,8 @@ Agents have persistent memory powered by [qmd](https://github.com/tobi/qmd):
|
|
|
463
442
|
Each part gets its own qmd collection:
|
|
464
443
|
|
|
465
444
|
- `brainiac-knowledge` — shared knowledge
|
|
466
|
-
- `
|
|
467
|
-
- `
|
|
445
|
+
- `sherlock-memory`, `merlin-memory` — per-agent card memory
|
|
446
|
+
- `sherlock-persona`, `merlin-persona` — per-agent persona
|
|
468
447
|
|
|
469
448
|
Knowledge is automatically queried and injected into every prompt. Memory is read/written at the start/end of each session. Persona stays out of work context — agents only query it during pre-comment reflection.
|
|
470
449
|
|
|
@@ -492,7 +471,7 @@ Conflicts are handled with `git pull --rebase --autostash`. If a rebase fails (r
|
|
|
492
471
|
|
|
493
472
|
## Discord Bot
|
|
494
473
|
|
|
495
|
-
Each agent gets its own Discord bot. Users @mention @
|
|
474
|
+
Each agent gets its own Discord bot. Users @mention @Sherlock or @Robin directly in Discord — no shared bot, no agent name detection needed. No Fizzy card or worktree is created; the agent runs in the project's repo for read-only exploration, brain queries, and knowledge/persona updates.
|
|
496
475
|
|
|
497
476
|
All Discord bots run inside `brainiac server` as background threads — no separate processes to manage.
|
|
498
477
|
|
|
@@ -516,7 +495,7 @@ React with ❌ to any message that triggered an agent to immediately terminate t
|
|
|
516
495
|
|
|
517
496
|
Create one Discord application per agent at https://discord.com/developers/applications:
|
|
518
497
|
|
|
519
|
-
1. Click "New Application", name it after the agent (e.g. "
|
|
498
|
+
1. Click "New Application", name it after the agent (e.g. "Sherlock", "Robin")
|
|
520
499
|
2. Go to the "Bot" tab in the left sidebar
|
|
521
500
|
3. Under "Privileged Gateway Intents", enable **Message Content Intent** — this is required for the bot to read message text. Without it, all message content arrives as empty strings.
|
|
522
501
|
4. Optionally uncheck "Public Bot" if you don't want others to invite your bots
|
|
@@ -534,8 +513,8 @@ Still on the "Bot" tab for each application:
|
|
|
534
513
|
Register each token with Brainiac:
|
|
535
514
|
|
|
536
515
|
```bash
|
|
537
|
-
brainiac discord token
|
|
538
|
-
brainiac discord token
|
|
516
|
+
brainiac discord token sherlock "BOT_TOKEN_FOR_SHERLOCK"
|
|
517
|
+
brainiac discord token robin "BOT_TOKEN_FOR_ROBIN"
|
|
539
518
|
```
|
|
540
519
|
|
|
541
520
|
This adds `DISCORD_BOT_TOKEN` to the agent's `env` hash in `~/.brainiac/agents.json`. You can verify with:
|
|
@@ -610,7 +589,7 @@ When someone @mentions an agent's bot in Discord:
|
|
|
610
589
|
Use `[project:XYZ]` to target a specific project and `[opus]`/`[sonnet]`/`[haiku]` to override the model:
|
|
611
590
|
|
|
612
591
|
```
|
|
613
|
-
@
|
|
592
|
+
@Sherlock [project:brainiac] [opus] how does the webhook signature verification work?
|
|
614
593
|
```
|
|
615
594
|
|
|
616
595
|
Tags are stripped from the prompt — the agent only sees the question.
|
|
@@ -638,7 +617,7 @@ Channel mappings and authorization are stored in `~/.brainiac/discord.json`:
|
|
|
638
617
|
"user_mappings": {
|
|
639
618
|
"Andy": "123456789012345678",
|
|
640
619
|
"Adam": "234567890123456789",
|
|
641
|
-
"
|
|
620
|
+
"Merlin": "345678901234567890"
|
|
642
621
|
},
|
|
643
622
|
"authorized_role_ids": ["role-id"],
|
|
644
623
|
"authorized_user_ids": ["user-id"],
|
|
@@ -685,7 +664,7 @@ Cron jobs can run in two modes:
|
|
|
685
664
|
```bash
|
|
686
665
|
# Agent mode (recurring schedules)
|
|
687
666
|
brainiac cron add -s "0 9 * * 1-5" -p marketplace "Summarize open cards and post a standup update"
|
|
688
|
-
brainiac cron add -s "@daily" -p brainiac -a
|
|
667
|
+
brainiac cron add -s "@daily" -p brainiac -a Sherlock "Review recent commits and flag anything that needs attention"
|
|
689
668
|
brainiac cron add -s "0 17 * * 5" -p marketplace -d 1234567890 "Post a weekly summary to Discord"
|
|
690
669
|
|
|
691
670
|
# Script mode (no agent, direct execution)
|
|
@@ -813,9 +792,9 @@ Configure how agents appear in the status bar via `~/.brainiac/waybar.json`:
|
|
|
813
792
|
```json
|
|
814
793
|
{
|
|
815
794
|
"agents": [
|
|
816
|
-
{ "name": "
|
|
817
|
-
{ "name": "
|
|
818
|
-
{ "name": "
|
|
795
|
+
{ "name": "Sherlock", "emoji": "🛠️", "color": "green" },
|
|
796
|
+
{ "name": "Robin", "emoji": "🤖", "color": "blue" },
|
|
797
|
+
{ "name": "Merlin", "emoji": "🔧", "color": "pink" }
|
|
819
798
|
],
|
|
820
799
|
"default_emoji": "❓",
|
|
821
800
|
"schema_version": "1.0"
|
|
@@ -927,7 +906,7 @@ Create `~/.brainiac/zoho.json`:
|
|
|
927
906
|
{
|
|
928
907
|
"hook_secret": null,
|
|
929
908
|
"default_discord_channel_id": "YOUR_DISCORD_CHANNEL_ID",
|
|
930
|
-
"notify_as": "
|
|
909
|
+
"notify_as": "merlin",
|
|
931
910
|
"rules": [
|
|
932
911
|
{
|
|
933
912
|
"label": "Item Sold",
|
|
@@ -1061,11 +1040,15 @@ The `Brainiac::Plugins` namespace is defined in `lib/brainiac.rb`. Plugin module
|
|
|
1061
1040
|
|
|
1062
1041
|
| Plugin | Gem | Description |
|
|
1063
1042
|
|--------|-----|-------------|
|
|
1043
|
+
| discord | `brainiac-discord` | Per-agent Discord bots — conversational AI access via @mentions, threads, session supersede |
|
|
1044
|
+
| fizzy | `brainiac-fizzy` | Fizzy card management — assignment, comments, @mentions, cross-agent reviews, duplicate detection, planning mode |
|
|
1045
|
+
| github | `brainiac-github` | GitHub webhooks — PR reviews, PR comments, PR merges, CI workflow notifications, deploy tracking |
|
|
1046
|
+
| zoho | `brainiac-zoho` | Zoho Mail webhooks — rule-based email notifications, AI triage, OAuth for content fetching |
|
|
1064
1047
|
| whatsapp | `brainiac-whatsapp` | WhatsApp Business API integration |
|
|
1065
1048
|
|
|
1066
1049
|
### Backward Compatibility
|
|
1067
1050
|
|
|
1068
|
-
The old `~/.brainiac/handlers/*.rb` drop-in system still works. Custom handler files are loaded before gem plugins.
|
|
1051
|
+
The old `~/.brainiac/handlers/*.rb` drop-in system still works. Custom handler files are loaded before gem plugins.
|
|
1069
1052
|
|
|
1070
1053
|
## Version Check
|
|
1071
1054
|
|
|
@@ -1220,9 +1203,9 @@ curl http://localhost:4567/api/users?filter=agents # List only AI agent
|
|
|
1220
1203
|
curl http://localhost:4567/api/users/fladamd # Find user by any identifier
|
|
1221
1204
|
curl -X POST http://localhost:4567/api/reload # Reload projects + agent registry + user registry
|
|
1222
1205
|
curl http://localhost:4567/api/brain # Brain status (default agent)
|
|
1223
|
-
curl http://localhost:4567/api/brain?agent=
|
|
1206
|
+
curl http://localhost:4567/api/brain?agent=Robin # Brain status for specific agent
|
|
1224
1207
|
curl "http://localhost:4567/api/brain/search?q=ruby+style" # Search knowledge
|
|
1225
|
-
curl "http://localhost:4567/api/brain/search?q=tone&scope=persona&agent=
|
|
1208
|
+
curl "http://localhost:4567/api/brain/search?q=tone&scope=persona&agent=Sherlock" # Search persona
|
|
1226
1209
|
curl http://localhost:4567/api/card-index # Card duplicate detection index
|
|
1227
1210
|
curl http://localhost:4567/api/dispatch-depth # Agent-to-agent loop prevention state
|
|
1228
1211
|
curl http://localhost:4567/api/discord # Discord bot status and config
|
|
@@ -1246,9 +1229,9 @@ ls brainiac receiver.rb lib/brainiac/*.rb lib/brainiac/handlers/*.rb | entr -r b
|
|
|
1246
1229
|
|
|
1247
1230
|
**Card not matching a project:** Verify the Fizzy card has a tag matching `fizzy_tags` in the project config. If no tags match, the default project is used (set with `brainiac projects default`).
|
|
1248
1231
|
|
|
1249
|
-
**Agent not dispatching:** Check that `~/.
|
|
1232
|
+
**Agent not dispatching:** Check that the agent is in `~/.brainiac/agents.json` with `"local": true`. The registry determines which agents can be dispatched on this machine.
|
|
1250
1233
|
|
|
1251
|
-
**Cross-agent mention ignored:** Both machines receive webhooks. Only the machine with the agent
|
|
1234
|
+
**Cross-agent mention ignored:** Both machines receive webhooks. Only the machine with the agent marked `"local": true` in `~/.brainiac/agents.json` will dispatch it.
|
|
1252
1235
|
|
|
1253
1236
|
**Agent commenting as wrong user:** Check `~/.brainiac/agents.json` has the correct `FIZZY_TOKEN` in the agent's `env` hash. The env is injected into the spawned agent process — verify with `curl http://localhost:4567/api/agents` to see the roster.
|
|
1254
1237
|
|
|
@@ -1270,7 +1253,7 @@ ls brainiac receiver.rb lib/brainiac/*.rb lib/brainiac/handlers/*.rb | entr -r b
|
|
|
1270
1253
|
|
|
1271
1254
|
**Discord "unauthorized" reaction (🚫):** The user isn't in `authorized_user_ids` or doesn't have a role in `authorized_role_ids` in `~/.brainiac/discord.json`. Leave both arrays empty to allow everyone.
|
|
1272
1255
|
|
|
1273
|
-
**Duplicate Discord dispatches:** Check `~/.brainiac/agents.json` for duplicate entries with the same bot token under different key formats (e.g. `
|
|
1256
|
+
**Duplicate Discord dispatches:** Check `~/.brainiac/agents.json` for duplicate entries with the same bot token under different key formats (e.g. `robin-hood` and `robin_hood`). Keys are normalized to lowercase with hyphens — duplicates after normalization cause multiple gateway connections.
|
|
1274
1257
|
|
|
1275
1258
|
**Worktree cleanup:** Automatic on PR merge. Manual: `cd /path/to/worktree && gd` (see shell helpers below).
|
|
1276
1259
|
|