brainiac 0.0.11 → 0.0.13

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.
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 connects your tools (Fizzy, GitHub, Discord, Zoho) to a team of autonomous AI agents. 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.
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 listens for incoming events and automatically spawns the appropriate AI agent CLI to handle the request. Because each agent maintains its own unique persona and configuration, you can deploy a specialized teamall managed through ~/.kiro/agents/. 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.
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 channelseach one connects a different tool (Fizzy, GitHub, Discord, Zoho) to your agent fleet.
8
8
 
9
- ### Events
9
+ Install only the plugins you need:
10
10
 
11
- | Source | Event | What Happens |
12
- | --------- | ------------------- | ------------------------------------------------------------------------------------------------- |
13
- | Fizzy | Card assigned | Creates worktree, maps card to branch, spawns assigned agent |
14
- | Fizzy | Card published | Duplicate detection via trigram similarity + semantic search |
15
- | Fizzy | @mention in comment | Routes to the mentioned agent (even on another agent's card) |
16
- | Fizzy | Follow-up comment | Runs card's assigned agent in existing worktree |
17
- | GitHub | PR review submitted | Agent addresses review feedback |
18
- | GitHub | PR comment | Agent responds to PR feedback |
19
- | GitHub | PR merged to main | Comments PR link on Fizzy card, closes card, cleans up worktree |
20
- | GitHub | Issue opened | Logged for tracking (no agent dispatch) |
21
- | GitHub | Workflow run | Notifies on CI failures via Discord |
22
- | Discord | @bot mention | Each agent has its own bot @mention routes directly to that agent, no worktree conversational |
23
- | Zoho Mail | Incoming email | Rule-based matching, notifies via Discord |
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
 
@@ -30,7 +43,9 @@ All four channels support inline tags in message/comment text. Tags are stripped
30
43
  | ----------------------------------------------------------------------------- | ----- | ------- | ------ | ----------------------------------------------------------------------------------------------------- |
31
44
  | `[project:XYZ]` | — | ✓ | — | Override which project the agent works in (Discord only — Fizzy uses card tags, GitHub uses the repo) |
32
45
  | `[opus]` `[sonnet]` `[haiku]` `[deepseek]` `[minimax]` `[minimax21]` `[qwen]` | ✓ | ✓ | ✓ | Override the model for this dispatch |
33
- | `[worktree:branch-name]` | ✓ | | — | Direct the agent to a specific worktree instead of the card's default |
46
+ | `[worktree:branch-name]` | ✓ | | — | Direct the agent to a specific worktree/branch (legacy syntax) |
47
+ | `[branch:branch-name]` | ✓ | ✓ | ✓ | Target an existing branch — reuses its worktree if a work item exists |
48
+ | `[workitem:wi-abc123]` | ✓ | ✓ | ✓ | Target a specific work item by ID — agent works in its worktree |
34
49
  | `[plan]` | ✓ | ✓ | — | Activate planning mode — agent gathers requirements before coding |
35
50
 
36
51
  Model keys come from the project's `allowed_models` config. Fizzy also supports model selection via card tags (e.g. adding an `opus` tag to the card).
@@ -48,29 +63,29 @@ The agent stays read-only during planning — no code changes, no commits. Once
48
63
 
49
64
  ### Cross-Agent Mentions
50
65
 
51
- Any agent can be tagged on any card. If Kaylee is working card #42 and someone comments "@Galen what do you think?", Galen reviews the card and PR without touching Kaylee's worktree. This enables patterns like:
66
+ 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
67
 
53
68
  - Engineer agent does the work, security agent reviews it
54
69
  - One agent asks another for a second opinion
55
- - A read-only agent (e.g. GLaDOS) that reviews and comments but doesn't take over the card
70
+ - A read-only agent (e.g. Robin) that reviews and comments but doesn't take over the card
56
71
 
57
72
  #### Display Name Accuracy
58
73
 
59
- Agents need to spell @mentions exactly as they appear in Fizzy (e.g. `@GLaDOS` not `@glados`). The agent registry's `fizzy_name` field handles this — every prompt includes an agent roster with the correct spelling:
74
+ 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
75
 
61
76
  ```
62
77
  ## Agent Roster
63
78
  When @mentioning other agents in Fizzy comments, use the EXACT spelling below.
64
- - @Galen
65
- - @GLaDOS
66
- - @Kaylee
79
+ - @Sherlock
80
+ - @Robin
81
+ - @Merlin
67
82
  ```
68
83
 
69
- Detection is case-insensitive (inbound `@glados` still matches GLaDOS), but outbound mentions use the exact `fizzy_name` from the registry.
84
+ Detection is case-insensitive (inbound `@robin` still matches Robin), but outbound mentions use the exact `fizzy_name` from the registry.
70
85
 
71
86
  #### Agent-to-Agent Loop Prevention
72
87
 
73
- When agents can tag each other, infinite loops become possible (Galen tags GLaDOS, GLaDOS tags Galen back, forever). Brainiac prevents this with layered defenses:
88
+ 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
89
 
75
90
  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
91
 
@@ -134,52 +149,56 @@ After installing the gem:
134
149
  brainiac setup
135
150
  ```
136
151
 
137
- This creates the `~/.brainiac/` directory structure and copies example config files. Then edit the configs with your actual secrets and IDs (see below).
152
+ 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
153
 
139
- Optionally, install handler plugins for additional integrations:
154
+ Then install the plugins you need:
140
155
 
141
156
  ```bash
142
- brainiac install whatsapp # WhatsApp Business API
143
- brainiac install slack # Slack (when available)
144
- brainiac restart # Restart to activate
157
+ brainiac install discord # Discord bots
158
+ brainiac install fizzy # Fizzy card management
159
+ brainiac install github # GitHub webhooks
160
+ brainiac install zoho # Zoho Mail
161
+ brainiac restart # Restart to activate
145
162
  ```
146
163
 
147
- See [Plugins](#plugins-gem-based-handlers) for details.
164
+ Each plugin has its own setup command (e.g. `brainiac discord setup`, `brainiac github setup`) that creates the necessary config files.
148
165
 
149
166
  ### Prerequisites
150
167
 
151
168
  | Dependency | Required | Install |
152
169
  |------------|----------|---------|
153
170
  | Ruby 3.4+ | Yes | [mise](https://mise.jdx.dev), rbenv, or system |
154
- | [Kiro CLI](https://kiro.dev) | Yes | Agent dispatch |
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 |
171
+ | An AI agent CLI | Yes | [Kiro CLI](https://kiro.dev), [Grok CLI](https://x.ai), or any CLI that accepts prompts on stdin |
157
172
  | [ngrok](https://ngrok.com) | Yes | Webhook tunneling |
158
173
  | [qmd](https://github.com/tobi/qmd) | For brain | `npm install -g @tobilu/qmd` (Node.js >= 22) |
174
+ | [Fizzy CLI](https://github.com/robzolkos/fizzy-cli) | For `brainiac-fizzy` | Card management |
175
+ | [GitHub CLI](https://cli.github.com) (`gh`) | For `brainiac-github` | PR/issue operations |
159
176
  | [gum](https://github.com/charmbracelet/gum) | Optional | Manual worktree cleanup |
160
177
 
178
+ Brainiac is CLI-agnostic — configure your preferred agent CLI in `~/.brainiac/cli-providers/`. The project config determines which CLI provider to use per-project.
179
+
161
180
  ### Directory Structure
162
181
 
163
182
  After setup, `~/.brainiac/` looks like:
164
183
 
165
184
  ```
166
185
  ~/.brainiac/
186
+ ├── brainiac.json # Core config (default_agent)
167
187
  ├── agents.json # Agent registry (tokens, display names, local flag)
168
188
  ├── 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
189
  ├── users.json # Cross-platform user identity registry
173
- ├── zoho.json # Zoho Mail rules (optional)
190
+ ├── plugins.json # Installed plugins
174
191
  ├── brain/
175
192
  │ ├── knowledge/ # Shared technical knowledge (all agents)
176
193
  │ ├── persona/ # Per-agent personality files
177
194
  │ └── memory/ # Per-agent session memory
178
- ├── handlers/ # Custom webhook handlers (plugin system)
195
+ ├── handlers/ # Legacy custom webhook handlers
179
196
  ├── plans/ # Planning mode output
180
197
  └── tmp/ # Temp files, drafts, posted responses
181
198
  ```
182
199
 
200
+ Plugins add their own config files when installed (e.g. `discord.json`, `fizzy.json`, `github.json`, `zoho.json`).
201
+
183
202
  ### Step-by-Step Configuration
184
203
 
185
204
  #### 1. Agent Registry (`~/.brainiac/agents.json`)
@@ -188,8 +207,8 @@ Maps agents to their identity and environment. Every agent that should dispatch
188
207
 
189
208
  ```json
190
209
  {
191
- "galen": {
192
- "fizzy_name": "Galen",
210
+ "sherlock": {
211
+ "fizzy_name": "Sherlock",
193
212
  "local": true,
194
213
  "env": {
195
214
  "FIZZY_TOKEN": "fizzy_abc...",
@@ -201,74 +220,35 @@ Maps agents to their identity and environment. Every agent that should dispatch
201
220
 
202
221
  See [Multi-Agent Setup](#multi-agent-setup) for full details.
203
222
 
204
- #### 2. Kiro Agent Configs (`~/.kiro/agents/<name>.json`)
223
+ #### 2. CLI Providers (`~/.brainiac/cli-providers/`)
205
224
 
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`)
225
+ Configure which AI CLI to use for dispatching agents. Each provider is a JSON file:
214
226
 
215
227
  ```json
216
228
  {
217
- "webhook_secret": "your-github-webhook-secret",
218
- "repos": {}
229
+ "agent_cli": "kiro-cli",
230
+ "agent_cli_args": "chat --trust-all-tools --no-interactive",
231
+ "agent_model_flag": "--model"
219
232
  }
220
233
  ```
221
234
 
222
- The `webhook_secret` verifies incoming GitHub webhook requests. Generate one with `ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'`.
235
+ Brainiac ships with example providers during setup. Your project config references which provider to use.
223
236
 
224
- `GITHUB_WEBHOOK_SECRET` env var works as fallback.
225
-
226
- #### 4. Fizzy (`~/.brainiac/fizzy.json`)
227
-
228
- Defines authorized users, flags humans, and configures boards:
229
-
230
- ```json
231
- {
232
- "authorized_users": [
233
- { "id": "user-id-1", "name": "Andy", "human": true },
234
- { "id": "user-id-2", "name": "Adam", "human": true },
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
- }
248
- }
249
- ```
250
-
251
- Each board gets its own webhook secret and column IDs. The board key (e.g., `development`) is used in the webhook URL.
252
-
253
- When a human is @mentioned on a card assigned to an agent, the agent will skip that comment — allowing human-to-human conversation without agent interference.
254
-
255
- **Legacy:** `FIZZY_WEBHOOK_SECRET` and `AUTHORIZED_USER_IDS` env vars work as fallbacks.
256
-
257
- #### 5. Environment Variables
237
+ #### 3. Environment Variables
258
238
 
259
239
  Most config lives in JSON files now. The default agent is set in `brainiac.json`:
260
240
 
261
241
  ```json
262
- { "default_agent": "Galen" }
242
+ { "default_agent": "Sherlock" }
263
243
  ```
264
244
 
265
245
  Or via environment variable (takes precedence):
266
246
 
267
247
  ```bash
268
- export AI_AGENT_NAME="Galen"
248
+ export AI_AGENT_NAME="Sherlock"
269
249
  ```
270
250
 
271
- #### 6. Register Projects
251
+ #### 4. Register Projects
272
252
 
273
253
  ```bash
274
254
  cd ~/Code/marketplace && brainiac register
@@ -284,21 +264,34 @@ Set a default project (used as fallback when no tags match):
284
264
  brainiac projects default myproject
285
265
  ```
286
266
 
287
- #### 7. Initialize Brain
267
+ #### 5. Initialize Brain
288
268
 
289
269
  ```bash
290
- brainiac brain init Galen
270
+ brainiac brain init Sherlock
291
271
  ```
292
272
 
293
273
  This creates the directory structure, sets up qmd collections, and indexes everything.
294
274
 
295
- #### 8. Configure Webhooks
275
+ #### 6. Install Plugins
276
+
277
+ ```bash
278
+ brainiac install discord # Discord bots
279
+ brainiac install fizzy # Fizzy card management
280
+ brainiac install github # GitHub webhooks
281
+ brainiac install zoho # Zoho Mail
282
+ ```
283
+
284
+ Each plugin has its own setup command (e.g. `brainiac github setup`) and documentation. See [Plugins](#plugins-gem-based-handlers) for details.
285
+
286
+ #### 7. Configure Webhooks
296
287
 
297
- **Fizzy:** Board settings Webhooks URL: `https://your-ngrok.ngrok-free.app/fizzy/development` (where `development` is the board key from `fizzy.json`), Secret: the board's `webhook_secret`
288
+ Each plugin provides its own webhook endpoint. Point your tools at your ngrok URL:
298
289
 
299
- **GitHub:** Repo settings → Webhooks → URL: `https://your-ngrok.ngrok-free.app/github`, Content type: `application/json`, Secret: from `github.json`, Events: Pull requests, Pull request reviews, Issue comments, Issues
290
+ - **Fizzy:** `https://your-ngrok.ngrok-free.app/fizzy/<board-key>` (see `brainiac fizzy setup`)
291
+ - **GitHub:** `https://your-ngrok.ngrok-free.app/github` (see `brainiac github setup`)
292
+ - **Zoho:** `https://your-ngrok.ngrok-free.app/zoho` (see `brainiac zoho setup`)
300
293
 
301
- #### 9. Start
294
+ #### 8. Start
302
295
 
303
296
  ```bash
304
297
  brainiac server # Start and tail logs (Ctrl+C to detach, server keeps running)
@@ -316,67 +309,55 @@ Andy's Linux box Adam's macOS
316
309
  ┌─────────────────────┐ ┌─────────────────────┐
317
310
  │ brainiac server │ │ brainiac server │
318
311
  │ │ │ │
319
- │ ~/.kiro/agents/: │ │ ~/.kiro/agents/: │
320
- │ galen.json │ │ kaylee.json │
321
- │ glados.json │ │ jane.json │
322
- │ │ │ │
323
312
  │ ~/.brainiac/ │ │ ~/.brainiac/ │
324
313
  │ agents.json │ │ agents.json │
314
+ │ (sherlock, robin) │ │ (merlin, jane) │
315
+ │ cli-providers/ │ │ cli-providers/ │
316
+ │ kiro.json │ │ kiro.json │
325
317
  └─────────────────────┘ └─────────────────────┘
326
318
  │ │
327
319
  └──── same Fizzy board + GitHub ────┘
328
320
  ```
329
321
 
330
- Both machines receive the same webhooks. The receiver discovers available agents by scanning `~/.kiro/agents/*.json` only agents with a config on that machine will be dispatched, preventing duplicates.
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
- ```
322
+ 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.
340
323
 
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.
324
+ ### Step 1: Agent Registry
342
325
 
343
- ### Step 2: Agent Registry
344
-
345
- The agent registry at `~/.brainiac/agents.json` maps each agent to its identity and environment. This serves four purposes:
326
+ The agent registry at `~/.brainiac/agents.json` is the authority for agent identity. This serves four purposes:
346
327
 
347
328
  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. `GLaDOS` not `glados`)
329
+ 2. **Display name mapping** — agents know the exact spelling for @mentions (e.g. `Robin` not `robin`)
349
330
  3. **Discord bot tokens** — agents with `DISCORD_BOT_TOKEN` in their env get their own Discord bot
350
331
  4. **Local flag** — agents marked `"local": true` pick up card assignments on this machine
351
332
 
352
333
  ```json
353
334
  {
354
- "galen": {
355
- "fizzy_name": "Galen",
335
+ "sherlock": {
336
+ "fizzy_name": "Sherlock",
356
337
  "local": true,
357
338
  "env": {
358
339
  "FIZZY_TOKEN": "fizzy_abc...",
359
340
  "DISCORD_BOT_TOKEN": "Bot_abc..."
360
341
  }
361
342
  },
362
- "glados": {
363
- "fizzy_name": "GLaDOS",
343
+ "robin": {
344
+ "fizzy_name": "Robin",
364
345
  "env": {
365
346
  "FIZZY_TOKEN": "fizzy_xyz...",
366
347
  "DISCORD_BOT_TOKEN": "Bot_xyz..."
367
348
  }
368
349
  },
369
- "kaylee": {
370
- "fizzy_name": "Kaylee"
350
+ "merlin": {
351
+ "fizzy_name": "Merlin"
371
352
  }
372
353
  }
373
354
  ```
374
355
 
375
356
  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
357
 
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. Agents discovered from `~/.kiro/agents/` configs and the default `AI_AGENT_NAME` are always considered local.
358
+ 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
359
 
379
- Agents without an `env` block (like Kaylee above on a Linux box) still appear in the agent roster so local agents spell @mentions correctly.
360
+ 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
361
 
381
362
  The registry reloads on every webhook and via `POST /api/reload`.
382
363
 
@@ -390,13 +371,13 @@ Each agent needs at least one persona file. Create it directly in the brain:
390
371
 
391
372
  ```bash
392
373
  # Create persona file for your agent
393
- mkdir -p ~/.brainiac/brain/persona/galen
394
- cat > ~/.brainiac/brain/persona/galen/style.md << 'EOF'
374
+ mkdir -p ~/.brainiac/brain/persona/sherlock
375
+ cat > ~/.brainiac/brain/persona/sherlock/style.md << 'EOF'
395
376
  ---
396
- name: galen-persona
397
- description: Persona voice for Galen.
377
+ name: sherlock-persona
378
+ description: Persona voice for Sherlock.
398
379
  ---
399
- # Galen — Persona
380
+ # Sherlock — Persona
400
381
  Gruff, no-nonsense, direct, practical, a little cynical. Zero corporate fluff.
401
382
  Keep responses tight and technical.
402
383
  EOF
@@ -438,17 +419,17 @@ This creates the directory structure, sets up qmd collections, and indexes every
438
419
 
439
420
  When a webhook arrives:
440
421
 
441
- 1. **Card assigned** — the receiver checks if any assignee matches a local agent name. Only agents marked `local` (or discovered from `~/.kiro/agents/`) pick up assignments — this prevents multiple machines from dispatching the same card.
442
- 2. **@mention in comment** — the receiver detects which agent is mentioned (e.g. `@Galen`, `@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.
422
+ 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.
423
+ 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
424
  3. **Follow-up comment (no mention)** — the card's assigned agent handles it.
444
425
 
445
- The command dispatched looks like:
426
+ The command dispatched is determined by your project's `agent_cli` config (from `cli-providers/`). For example with kiro-cli:
446
427
 
447
428
  ```bash
448
- kiro-cli --agent galen chat --trust-all-tools --no-interactive
429
+ kiro-cli --agent sherlock chat --trust-all-tools --no-interactive
449
430
  ```
450
431
 
451
- The `--agent` flag goes before the `chat` subcommand, pointing kiro-cli to the agent's config.
432
+ The exact command structure depends on your CLI provider configuration.
452
433
 
453
434
  ## Brain (Long-Term Memory)
454
435
 
@@ -463,8 +444,8 @@ Agents have persistent memory powered by [qmd](https://github.com/tobi/qmd):
463
444
  Each part gets its own qmd collection:
464
445
 
465
446
  - `brainiac-knowledge` — shared knowledge
466
- - `galen-memory`, `kaylee-memory` — per-agent card memory
467
- - `galen-persona`, `kaylee-persona` — per-agent persona
447
+ - `sherlock-memory`, `merlin-memory` — per-agent card memory
448
+ - `sherlock-persona`, `merlin-persona` — per-agent persona
468
449
 
469
450
  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
451
 
@@ -492,7 +473,7 @@ Conflicts are handled with `git pull --rebase --autostash`. If a rebase fails (r
492
473
 
493
474
  ## Discord Bot
494
475
 
495
- Each agent gets its own Discord bot. Users @mention @Galen or @GLaDOS 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.
476
+ 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
477
 
497
478
  All Discord bots run inside `brainiac server` as background threads — no separate processes to manage.
498
479
 
@@ -516,7 +497,7 @@ React with ❌ to any message that triggered an agent to immediately terminate t
516
497
 
517
498
  Create one Discord application per agent at https://discord.com/developers/applications:
518
499
 
519
- 1. Click "New Application", name it after the agent (e.g. "Galen", "GLaDOS")
500
+ 1. Click "New Application", name it after the agent (e.g. "Sherlock", "Robin")
520
501
  2. Go to the "Bot" tab in the left sidebar
521
502
  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
503
  4. Optionally uncheck "Public Bot" if you don't want others to invite your bots
@@ -534,8 +515,8 @@ Still on the "Bot" tab for each application:
534
515
  Register each token with Brainiac:
535
516
 
536
517
  ```bash
537
- brainiac discord token galen "BOT_TOKEN_FOR_GALEN"
538
- brainiac discord token glados "BOT_TOKEN_FOR_GLADOS"
518
+ brainiac discord token sherlock "BOT_TOKEN_FOR_SHERLOCK"
519
+ brainiac discord token robin "BOT_TOKEN_FOR_ROBIN"
539
520
  ```
540
521
 
541
522
  This adds `DISCORD_BOT_TOKEN` to the agent's `env` hash in `~/.brainiac/agents.json`. You can verify with:
@@ -610,7 +591,7 @@ When someone @mentions an agent's bot in Discord:
610
591
  Use `[project:XYZ]` to target a specific project and `[opus]`/`[sonnet]`/`[haiku]` to override the model:
611
592
 
612
593
  ```
613
- @Galen [project:brainiac] [opus] how does the webhook signature verification work?
594
+ @Sherlock [project:brainiac] [opus] how does the webhook signature verification work?
614
595
  ```
615
596
 
616
597
  Tags are stripped from the prompt — the agent only sees the question.
@@ -638,7 +619,7 @@ Channel mappings and authorization are stored in `~/.brainiac/discord.json`:
638
619
  "user_mappings": {
639
620
  "Andy": "123456789012345678",
640
621
  "Adam": "234567890123456789",
641
- "Kaylee": "345678901234567890"
622
+ "Merlin": "345678901234567890"
642
623
  },
643
624
  "authorized_role_ids": ["role-id"],
644
625
  "authorized_user_ids": ["user-id"],
@@ -685,7 +666,7 @@ Cron jobs can run in two modes:
685
666
  ```bash
686
667
  # Agent mode (recurring schedules)
687
668
  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 Galen "Review recent commits and flag anything that needs attention"
669
+ brainiac cron add -s "@daily" -p brainiac -a Sherlock "Review recent commits and flag anything that needs attention"
689
670
  brainiac cron add -s "0 17 * * 5" -p marketplace -d 1234567890 "Post a weekly summary to Discord"
690
671
 
691
672
  # Script mode (no agent, direct execution)
@@ -813,9 +794,9 @@ Configure how agents appear in the status bar via `~/.brainiac/waybar.json`:
813
794
  ```json
814
795
  {
815
796
  "agents": [
816
- { "name": "Galen", "emoji": "🛠️", "color": "green" },
817
- { "name": "GLaDOS", "emoji": "🤖", "color": "blue" },
818
- { "name": "Kaylee", "emoji": "🔧", "color": "pink" }
797
+ { "name": "Sherlock", "emoji": "🛠️", "color": "green" },
798
+ { "name": "Robin", "emoji": "🤖", "color": "blue" },
799
+ { "name": "Merlin", "emoji": "🔧", "color": "pink" }
819
800
  ],
820
801
  "default_emoji": "❓",
821
802
  "schema_version": "1.0"
@@ -889,6 +870,50 @@ curl http://localhost:4567/api/users/fladamd # Find by identifier
889
870
 
890
871
  The registry reloads automatically on every webhook and via `POST /api/reload`.
891
872
 
873
+ ## Work Items
874
+
875
+ Work items are the universal tracking unit in Brainiac — they connect a branch/worktree to one or more communication channels. A single work item can span Discord, Fizzy, and GitHub simultaneously.
876
+
877
+ ### Structure
878
+
879
+ Work items are stored in `~/.brainiac/work_items.json`:
880
+
881
+ ```json
882
+ {
883
+ "wi-a1b2c3d4": {
884
+ "id": "wi-a1b2c3d4",
885
+ "branch": "fizzy-42-fix-login",
886
+ "worktree": "/home/you/Code/marketplace--fizzy-42-fix-login",
887
+ "project": "marketplace",
888
+ "agent": "Sherlock",
889
+ "sources": {
890
+ "fizzy": { "card_internal_id": "uuid-here", "card_number": 42 },
891
+ "github": { "prs": [{"number": 8, "url": "https://github.com/org/repo/pull/8"}] },
892
+ "discord": { "thread_id": "1234567890" }
893
+ }
894
+ }
895
+ }
896
+ ```
897
+
898
+ The **branch** is the universal join key. When any channel needs to find a work item, it looks up by branch name. This means:
899
+
900
+ - A Fizzy card assignment creates a work item with `sources.fizzy`
901
+ - When a PR is opened for that branch, `sources.github` is attached automatically
902
+ - A Discord `[branch:fizzy-42-fix-login]` message targets the same worktree
903
+
904
+ ### Targeting Work Items
905
+
906
+ From Discord or any channel, use inline tags to target existing work items:
907
+
908
+ - **`[branch:branch-name]`** — find the work item for this branch, work in its worktree
909
+ - **`[workitem:wi-abc123]`** — target a work item by its ID directly
910
+
911
+ This enables cross-channel workflows without creating duplicate worktrees.
912
+
913
+ ### Migration
914
+
915
+ The old format (keyed by Fizzy card internal ID) is automatically migrated on first read. No manual intervention needed — existing `work_items.json` files are transparently upgraded to the new source-agnostic format.
916
+
892
917
  ## Worktree Management
893
918
 
894
919
  When a card is assigned, Brainiac creates a git worktree for the agent to work in. Two config files in the project root control how gitignored files are handled:
@@ -927,7 +952,7 @@ Create `~/.brainiac/zoho.json`:
927
952
  {
928
953
  "hook_secret": null,
929
954
  "default_discord_channel_id": "YOUR_DISCORD_CHANNEL_ID",
930
- "notify_as": "threepio",
955
+ "notify_as": "merlin",
931
956
  "rules": [
932
957
  {
933
958
  "label": "Item Sold",
@@ -1061,11 +1086,15 @@ The `Brainiac::Plugins` namespace is defined in `lib/brainiac.rb`. Plugin module
1061
1086
 
1062
1087
  | Plugin | Gem | Description |
1063
1088
  |--------|-----|-------------|
1089
+ | discord | `brainiac-discord` | Per-agent Discord bots — conversational AI access via @mentions, threads, session supersede |
1090
+ | fizzy | `brainiac-fizzy` | Fizzy card management — assignment, comments, @mentions, cross-agent reviews, duplicate detection, planning mode |
1091
+ | github | `brainiac-github` | GitHub webhooks — PR reviews, PR comments, PR merges, CI workflow notifications, deploy tracking |
1092
+ | zoho | `brainiac-zoho` | Zoho Mail webhooks — rule-based email notifications, AI triage, OAuth for content fetching |
1064
1093
  | whatsapp | `brainiac-whatsapp` | WhatsApp Business API integration |
1065
1094
 
1066
1095
  ### Backward Compatibility
1067
1096
 
1068
- The old `~/.brainiac/handlers/*.rb` drop-in system still works. Custom handler files are loaded before gem plugins. Over time, built-in handlers (Discord, Fizzy, GitHub) may be extracted into their own gems.
1097
+ The old `~/.brainiac/handlers/*.rb` drop-in system still works. Custom handler files are loaded before gem plugins.
1069
1098
 
1070
1099
  ## Version Check
1071
1100
 
@@ -1220,9 +1249,9 @@ curl http://localhost:4567/api/users?filter=agents # List only AI agent
1220
1249
  curl http://localhost:4567/api/users/fladamd # Find user by any identifier
1221
1250
  curl -X POST http://localhost:4567/api/reload # Reload projects + agent registry + user registry
1222
1251
  curl http://localhost:4567/api/brain # Brain status (default agent)
1223
- curl http://localhost:4567/api/brain?agent=GLaDOS # Brain status for specific agent
1252
+ curl http://localhost:4567/api/brain?agent=Robin # Brain status for specific agent
1224
1253
  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=Galen" # Search persona
1254
+ curl "http://localhost:4567/api/brain/search?q=tone&scope=persona&agent=Sherlock" # Search persona
1226
1255
  curl http://localhost:4567/api/card-index # Card duplicate detection index
1227
1256
  curl http://localhost:4567/api/dispatch-depth # Agent-to-agent loop prevention state
1228
1257
  curl http://localhost:4567/api/discord # Discord bot status and config
@@ -1246,9 +1275,9 @@ ls brainiac receiver.rb lib/brainiac/*.rb lib/brainiac/handlers/*.rb | entr -r b
1246
1275
 
1247
1276
  **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
1277
 
1249
- **Agent not dispatching:** Check that `~/.kiro/agents/<name>.json` exists for the agent. The receiver discovers agents by scanning that directory. For registry-only agents, ensure `"local": true` is set.
1278
+ **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
1279
 
1251
- **Cross-agent mention ignored:** Both machines receive webhooks. Only the machine with the agent's kiro-cli config in `~/.kiro/agents/` (or `"local": true` in the registry) will dispatch it.
1280
+ **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
1281
 
1253
1282
  **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
1283
 
@@ -1270,7 +1299,7 @@ ls brainiac receiver.rb lib/brainiac/*.rb lib/brainiac/handlers/*.rb | entr -r b
1270
1299
 
1271
1300
  **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
1301
 
1273
- **Duplicate Discord dispatches:** Check `~/.brainiac/agents.json` for duplicate entries with the same bot token under different key formats (e.g. `sleeper-service` and `sleeper_service`). Keys are normalized to lowercase with hyphens — duplicates after normalization cause multiple gateway connections.
1302
+ **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
1303
 
1275
1304
  **Worktree cleanup:** Automatic on PR merge. Manual: `cd /path/to/worktree && gd` (see shell helpers below).
1276
1305