opencode-agent-hub 1.3.1__tar.gz → 1.3.3__tar.gz

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.
Files changed (34) hide show
  1. opencode_agent_hub-1.3.3/PKG-INFO +287 -0
  2. opencode_agent_hub-1.3.3/README.md +252 -0
  3. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/coordinator/AGENTS.md +6 -0
  4. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/coordinator/opencode.json +1 -0
  5. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/pyproject.toml +1 -1
  6. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/src/opencode_agent_hub/__init__.py +1 -1
  7. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/src/opencode_agent_hub/daemon.py +644 -272
  8. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/src/opencode_agent_hub/watch.py +27 -16
  9. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_config.py +17 -16
  10. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_coordinator.py +355 -183
  11. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_coordinator_cost.py +13 -13
  12. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_orientation_retry.py +12 -12
  13. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_placeholder.py +3 -3
  14. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_rate_limiting.py +13 -12
  15. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_session_agents.py +116 -18
  16. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/test_watch.py +45 -44
  17. opencode_agent_hub-1.3.1/PKG-INFO +0 -721
  18. opencode_agent_hub-1.3.1/README.md +0 -686
  19. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/.gitignore +0 -0
  20. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/LICENSE +0 -0
  21. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/launchd/com.xnoto.agent-hub-daemon.plist +0 -0
  22. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/aur/PKGBUILD +0 -0
  23. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/changelog +0 -0
  24. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/control +0 -0
  25. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/copyright +0 -0
  26. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/docs +0 -0
  27. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/install +0 -0
  28. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/postinst +0 -0
  29. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/rules +0 -0
  30. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/debian/source/format +0 -0
  31. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/packaging/rpm/opencode-agent-hub.spec +0 -0
  32. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/contrib/systemd/agent-hub-daemon.service +0 -0
  33. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/src/opencode_agent_hub/py.typed +0 -0
  34. {opencode_agent_hub-1.3.1 → opencode_agent_hub-1.3.3}/tests/__init__.py +0 -0
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.4
2
+ Name: opencode-agent-hub
3
+ Version: 1.3.3
4
+ Summary: Multi-agent coordination daemon and tools for OpenCode
5
+ Project-URL: Homepage, https://github.com/xnoto/opencode-agent-hub
6
+ Project-URL: Repository, https://github.com/xnoto/opencode-agent-hub
7
+ Project-URL: Issues, https://github.com/xnoto/opencode-agent-hub/issues
8
+ Author: xnoto
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agents,ai,coordination,daemon,mcp,opencode
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: System :: Distributed Computing
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: requests>=2.28.0
26
+ Requires-Dist: watchdog>=3.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
29
+ Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
33
+ Requires-Dist: types-requests>=2.28.0; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # opencode-agent-hub
37
+
38
+ Multi-agent coordination for [OpenCode](https://github.com/anomalyco/opencode). Lets multiple AI agents in separate OpenCode sessions talk to each other.
39
+
40
+ > **Warning**: This enables autonomous agent-to-agent communication which triggers LLM API calls. Use at your own risk. Consider enabling [rate limiting](#rate-limiting) to control costs.
41
+
42
+ ## Demo
43
+
44
+ https://github.com/user-attachments/assets/b591f1d2-01d7-4408-bf60-67eb7a8fbf0c
45
+
46
+ ## How It Works
47
+
48
+ - The **daemon** starts an OpenCode hub server (`opencode serve --port 4096`) and discovers sessions by polling OpenCode's shared SQLite database
49
+ - A **coordinator** session facilitates introductions between new agents, then steps back
50
+ - Agents communicate by writing JSON files to `~/.agent-hub/messages/` via the [agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp) tools
51
+ - The daemon watches for new message files, looks up the target agent's session, and injects the message via `prompt_async` — agents don't poll, they get woken up
52
+
53
+ ## Known Limitations
54
+
55
+ - **Injected messages not visible in TUI** — agent-to-agent messages work but users can't see them in the conversation. Upstream issue: [opencode#8564](https://github.com/sst/opencode/issues/8564). Use `agent-hub-watch` to monitor.
56
+ - **TUI spinner after response** — the TUI may briefly show "thinking" after an agent finishes responding to an injection. Visual only, no extra token consumption.
57
+ - **Orientation may trigger security heuristics** — some models (particularly Claude) may flag orientation messages as prompt injections. The agent still has MCP tools and can collaborate, just without orientation context.
58
+
59
+ ## Prerequisites
60
+
61
+ [agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp) must be configured in OpenCode. The daemon will refuse to start without it.
62
+
63
+ Find your OpenCode config location with `opencode debug paths`, then add to `opencode.json`:
64
+
65
+ ```json
66
+ {
67
+ "mcp": {
68
+ "agent-hub": {
69
+ "type": "local",
70
+ "command": ["npx", "-y", "agent-hub-mcp@latest"],
71
+ "enabled": true
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ Verify with `opencode mcp list` (should show `agent-hub connected`).
78
+
79
+ ## Quickstart
80
+
81
+ ```bash
82
+ git clone https://github.com/xnoto/opencode-agent-hub
83
+ cd opencode-agent-hub
84
+
85
+ # Terminal 1: start the daemon
86
+ uv run agent-hub-daemon
87
+
88
+ # Terminal 2: monitor activity
89
+ uv run agent-hub-watch
90
+ ```
91
+
92
+ ## Installation
93
+
94
+ ### Homebrew (macOS)
95
+
96
+ ```bash
97
+ brew install xnoto/opencode-agent-hub/opencode-agent-hub
98
+ ```
99
+
100
+ ### Linux Packages
101
+
102
+ **Debian / Ubuntu:**
103
+
104
+ ```bash
105
+ curl -fsSL https://xnoto.github.io/opencode-agent-hub/KEY.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/xnoto.gpg
106
+ echo "deb [signed-by=/etc/apt/keyrings/xnoto.gpg] https://xnoto.github.io/opencode-agent-hub/apt ./" | sudo tee /etc/apt/sources.list.d/xnoto.list
107
+ sudo apt update && sudo apt install opencode-agent-hub
108
+ ```
109
+
110
+ **Fedora / RHEL:**
111
+
112
+ ```bash
113
+ sudo curl -o /etc/yum.repos.d/xnoto.repo https://xnoto.github.io/opencode-agent-hub/xnoto.repo
114
+ sudo dnf install opencode-agent-hub
115
+ ```
116
+
117
+ **Arch Linux (AUR):**
118
+
119
+ ```bash
120
+ yay -S opencode-agent-hub
121
+ ```
122
+
123
+ See [GitHub Releases](https://github.com/xnoto/opencode-agent-hub/releases) for direct .deb/.rpm downloads.
124
+
125
+ ### uv / pipx (PyPI)
126
+
127
+ ```bash
128
+ uv tool install opencode-agent-hub
129
+ # or
130
+ pipx install opencode-agent-hub
131
+ ```
132
+
133
+ ### From source
134
+
135
+ ```bash
136
+ git clone https://github.com/xnoto/opencode-agent-hub
137
+ cd opencode-agent-hub
138
+ uv sync
139
+ ```
140
+
141
+ ## Running as a Service
142
+
143
+ ### macOS (Homebrew)
144
+
145
+ ```bash
146
+ brew services start opencode-agent-hub
147
+ tail -f ~/Library/Logs/agent-hub-daemon.log
148
+ brew services stop opencode-agent-hub
149
+ ```
150
+
151
+ ### Linux (systemd)
152
+
153
+ ```bash
154
+ agent-hub-daemon --install-service # install + start
155
+ journalctl --user -u agent-hub-daemon -f
156
+ systemctl --user stop agent-hub-daemon
157
+ agent-hub-daemon --uninstall-service # remove
158
+ ```
159
+
160
+ If installed via RPM/DEB, a system-wide service file is included — enable with `systemctl --user enable --now agent-hub-daemon`.
161
+
162
+ ## Configuration
163
+
164
+ Config file: `~/.config/agent-hub-daemon/config.json` (all fields optional). Environment variables override config file values.
165
+
166
+ ```json
167
+ {
168
+ "opencode_port": 4096,
169
+ "log_level": "INFO",
170
+ "rate_limit": {
171
+ "enabled": false,
172
+ "max_messages": 10,
173
+ "window_seconds": 300,
174
+ "cooldown_seconds": 0
175
+ },
176
+ "coordinator": {
177
+ "enabled": true,
178
+ "directory": "~/.agent-hub/coordinator",
179
+ "agents_md": ""
180
+ },
181
+ "gc": { "message_ttl_seconds": 3600, "agent_stale_seconds": 3600, "interval_seconds": 60 },
182
+ "session": { "poll_seconds": 5, "cache_ttl": 10 },
183
+ "injection": { "workers": 4, "retries": 3, "timeout": 5 },
184
+ "metrics_interval": 30
185
+ }
186
+ ```
187
+
188
+ ### Environment Variables
189
+
190
+ | Variable | Default | Description |
191
+ |----------|---------|-------------|
192
+ | `OPENCODE_PORT` | `4096` | Hub server port |
193
+ | `AGENT_HUB_DAEMON_LOG_LEVEL` | `INFO` | Log level |
194
+ | `AGENT_HUB_MESSAGE_TTL` | `3600` | Message TTL (seconds) |
195
+ | `AGENT_HUB_AGENT_STALE` | `3600` | Agent stale threshold (seconds) |
196
+ | `AGENT_HUB_GC_INTERVAL` | `60` | GC interval (seconds) |
197
+ | `AGENT_HUB_SESSION_POLL` | `5` | Session poll interval (seconds) |
198
+ | `AGENT_HUB_SESSION_CACHE_TTL` | `10` | Session cache TTL (seconds) |
199
+ | `AGENT_HUB_INJECTION_WORKERS` | `4` | Injection worker threads |
200
+ | `AGENT_HUB_INJECTION_RETRIES` | `3` | Injection retry attempts |
201
+ | `AGENT_HUB_INJECTION_TIMEOUT` | `5` | Injection timeout (seconds) |
202
+ | `AGENT_HUB_METRICS_INTERVAL` | `30` | Metrics write interval (seconds) |
203
+
204
+ ### Rate Limiting
205
+
206
+ | Variable | Default | Description |
207
+ |----------|---------|-------------|
208
+ | `AGENT_HUB_RATE_LIMIT` | `false` | Enable rate limiting |
209
+ | `AGENT_HUB_RATE_LIMIT_MAX` | `10` | Max messages per agent per window |
210
+ | `AGENT_HUB_RATE_LIMIT_WINDOW` | `300` | Window size (seconds) |
211
+ | `AGENT_HUB_RATE_LIMIT_COOLDOWN` | `0` | Min seconds between messages |
212
+
213
+ ### Coordinator
214
+
215
+ The coordinator is a dedicated OpenCode session that introduces agents to each other. It starts non-blocking and uses the same message pipeline as any other agent.
216
+
217
+ | Variable | Default | Description |
218
+ |----------|---------|-------------|
219
+ | `AGENT_HUB_COORDINATOR` | `true` | Enable coordinator |
220
+ | `AGENT_HUB_COORDINATOR_DIR` | `~/.agent-hub/coordinator` | Coordinator working directory |
221
+ | `AGENT_HUB_COORDINATOR_PRESERVE_LOCAL_AGENTS_MD` | `false` | Keep existing AGENTS.md on restart |
222
+ | `AGENT_HUB_COORDINATOR_READY_TIMEOUT` | `20` | Bootstrap ready timeout (seconds) |
223
+ | `AGENT_HUB_COORDINATOR_STRICT_READY` | `false` | Require exact `READY` acknowledgment |
224
+ | `AGENT_HUB_COORDINATOR_BOOTSTRAP_REQUIRED` | `false` | Fail startup if bootstrap times out |
225
+ | `AGENT_HUB_COORDINATOR_AGENTS_MD` | (auto-detect) | Custom AGENTS.md path |
226
+
227
+ The coordinator model is set in `~/.agent-hub/coordinator/opencode.json` (default: `opencode/minimax-m2.5-free`).
228
+
229
+ Custom coordinator instructions are searched in order:
230
+ 1. `AGENT_HUB_COORDINATOR_AGENTS_MD` env var
231
+ 2. `~/.config/agent-hub-daemon/AGENTS.md` (or `COORDINATOR.md`)
232
+ 3. Package template (`contrib/coordinator/AGENTS.md`)
233
+ 4. `/usr/local/share/opencode-agent-hub/coordinator/AGENTS.md`
234
+ 5. Auto-generated minimal default
235
+
236
+ ## Message Format
237
+
238
+ Messages are JSON files in `~/.agent-hub/messages/`:
239
+
240
+ ```json
241
+ {
242
+ "from": "agent-id",
243
+ "to": "target-agent-id",
244
+ "type": "task|question|context|completion|error",
245
+ "content": "Message content",
246
+ "priority": "normal|urgent|high|low",
247
+ "threadId": "auto-generated-or-provided",
248
+ "timestamp": 1234567890000
249
+ }
250
+ ```
251
+
252
+ ## Directory Structure
253
+
254
+ ```
255
+ ~/.agent-hub/
256
+ ├── agents/ # Registered agent files
257
+ ├── messages/ # Pending messages
258
+ │ └── archive/ # Processed messages
259
+ ├── threads/ # Conversation threads
260
+ ├── metrics.prom # Prometheus metrics
261
+ ├── oriented_sessions.json # Orientation cache
262
+ └── session_agents.json # Session-to-agent mapping
263
+
264
+ ~/.config/agent-hub-daemon/
265
+ └── config.json # Optional config
266
+ ```
267
+
268
+ ## Development
269
+
270
+ ```bash
271
+ uv sync --all-extras
272
+ uv run ruff check .
273
+ uv run ruff format .
274
+ uv run mypy src/
275
+ uv run pytest
276
+ ```
277
+
278
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for integration testing and architecture details.
279
+
280
+ ## Acknowledgments
281
+
282
+ - **[OpenCode](https://github.com/anomalyco/opencode)** by [anomalyco](https://github.com/anomalyco)
283
+ - **[agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp)** by [@gilbarbara](https://github.com/gilbarbara)
284
+
285
+ ## License
286
+
287
+ MIT - See [LICENSE](LICENSE) for details.
@@ -0,0 +1,252 @@
1
+ # opencode-agent-hub
2
+
3
+ Multi-agent coordination for [OpenCode](https://github.com/anomalyco/opencode). Lets multiple AI agents in separate OpenCode sessions talk to each other.
4
+
5
+ > **Warning**: This enables autonomous agent-to-agent communication which triggers LLM API calls. Use at your own risk. Consider enabling [rate limiting](#rate-limiting) to control costs.
6
+
7
+ ## Demo
8
+
9
+ https://github.com/user-attachments/assets/b591f1d2-01d7-4408-bf60-67eb7a8fbf0c
10
+
11
+ ## How It Works
12
+
13
+ - The **daemon** starts an OpenCode hub server (`opencode serve --port 4096`) and discovers sessions by polling OpenCode's shared SQLite database
14
+ - A **coordinator** session facilitates introductions between new agents, then steps back
15
+ - Agents communicate by writing JSON files to `~/.agent-hub/messages/` via the [agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp) tools
16
+ - The daemon watches for new message files, looks up the target agent's session, and injects the message via `prompt_async` — agents don't poll, they get woken up
17
+
18
+ ## Known Limitations
19
+
20
+ - **Injected messages not visible in TUI** — agent-to-agent messages work but users can't see them in the conversation. Upstream issue: [opencode#8564](https://github.com/sst/opencode/issues/8564). Use `agent-hub-watch` to monitor.
21
+ - **TUI spinner after response** — the TUI may briefly show "thinking" after an agent finishes responding to an injection. Visual only, no extra token consumption.
22
+ - **Orientation may trigger security heuristics** — some models (particularly Claude) may flag orientation messages as prompt injections. The agent still has MCP tools and can collaborate, just without orientation context.
23
+
24
+ ## Prerequisites
25
+
26
+ [agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp) must be configured in OpenCode. The daemon will refuse to start without it.
27
+
28
+ Find your OpenCode config location with `opencode debug paths`, then add to `opencode.json`:
29
+
30
+ ```json
31
+ {
32
+ "mcp": {
33
+ "agent-hub": {
34
+ "type": "local",
35
+ "command": ["npx", "-y", "agent-hub-mcp@latest"],
36
+ "enabled": true
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ Verify with `opencode mcp list` (should show `agent-hub connected`).
43
+
44
+ ## Quickstart
45
+
46
+ ```bash
47
+ git clone https://github.com/xnoto/opencode-agent-hub
48
+ cd opencode-agent-hub
49
+
50
+ # Terminal 1: start the daemon
51
+ uv run agent-hub-daemon
52
+
53
+ # Terminal 2: monitor activity
54
+ uv run agent-hub-watch
55
+ ```
56
+
57
+ ## Installation
58
+
59
+ ### Homebrew (macOS)
60
+
61
+ ```bash
62
+ brew install xnoto/opencode-agent-hub/opencode-agent-hub
63
+ ```
64
+
65
+ ### Linux Packages
66
+
67
+ **Debian / Ubuntu:**
68
+
69
+ ```bash
70
+ curl -fsSL https://xnoto.github.io/opencode-agent-hub/KEY.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/xnoto.gpg
71
+ echo "deb [signed-by=/etc/apt/keyrings/xnoto.gpg] https://xnoto.github.io/opencode-agent-hub/apt ./" | sudo tee /etc/apt/sources.list.d/xnoto.list
72
+ sudo apt update && sudo apt install opencode-agent-hub
73
+ ```
74
+
75
+ **Fedora / RHEL:**
76
+
77
+ ```bash
78
+ sudo curl -o /etc/yum.repos.d/xnoto.repo https://xnoto.github.io/opencode-agent-hub/xnoto.repo
79
+ sudo dnf install opencode-agent-hub
80
+ ```
81
+
82
+ **Arch Linux (AUR):**
83
+
84
+ ```bash
85
+ yay -S opencode-agent-hub
86
+ ```
87
+
88
+ See [GitHub Releases](https://github.com/xnoto/opencode-agent-hub/releases) for direct .deb/.rpm downloads.
89
+
90
+ ### uv / pipx (PyPI)
91
+
92
+ ```bash
93
+ uv tool install opencode-agent-hub
94
+ # or
95
+ pipx install opencode-agent-hub
96
+ ```
97
+
98
+ ### From source
99
+
100
+ ```bash
101
+ git clone https://github.com/xnoto/opencode-agent-hub
102
+ cd opencode-agent-hub
103
+ uv sync
104
+ ```
105
+
106
+ ## Running as a Service
107
+
108
+ ### macOS (Homebrew)
109
+
110
+ ```bash
111
+ brew services start opencode-agent-hub
112
+ tail -f ~/Library/Logs/agent-hub-daemon.log
113
+ brew services stop opencode-agent-hub
114
+ ```
115
+
116
+ ### Linux (systemd)
117
+
118
+ ```bash
119
+ agent-hub-daemon --install-service # install + start
120
+ journalctl --user -u agent-hub-daemon -f
121
+ systemctl --user stop agent-hub-daemon
122
+ agent-hub-daemon --uninstall-service # remove
123
+ ```
124
+
125
+ If installed via RPM/DEB, a system-wide service file is included — enable with `systemctl --user enable --now agent-hub-daemon`.
126
+
127
+ ## Configuration
128
+
129
+ Config file: `~/.config/agent-hub-daemon/config.json` (all fields optional). Environment variables override config file values.
130
+
131
+ ```json
132
+ {
133
+ "opencode_port": 4096,
134
+ "log_level": "INFO",
135
+ "rate_limit": {
136
+ "enabled": false,
137
+ "max_messages": 10,
138
+ "window_seconds": 300,
139
+ "cooldown_seconds": 0
140
+ },
141
+ "coordinator": {
142
+ "enabled": true,
143
+ "directory": "~/.agent-hub/coordinator",
144
+ "agents_md": ""
145
+ },
146
+ "gc": { "message_ttl_seconds": 3600, "agent_stale_seconds": 3600, "interval_seconds": 60 },
147
+ "session": { "poll_seconds": 5, "cache_ttl": 10 },
148
+ "injection": { "workers": 4, "retries": 3, "timeout": 5 },
149
+ "metrics_interval": 30
150
+ }
151
+ ```
152
+
153
+ ### Environment Variables
154
+
155
+ | Variable | Default | Description |
156
+ |----------|---------|-------------|
157
+ | `OPENCODE_PORT` | `4096` | Hub server port |
158
+ | `AGENT_HUB_DAEMON_LOG_LEVEL` | `INFO` | Log level |
159
+ | `AGENT_HUB_MESSAGE_TTL` | `3600` | Message TTL (seconds) |
160
+ | `AGENT_HUB_AGENT_STALE` | `3600` | Agent stale threshold (seconds) |
161
+ | `AGENT_HUB_GC_INTERVAL` | `60` | GC interval (seconds) |
162
+ | `AGENT_HUB_SESSION_POLL` | `5` | Session poll interval (seconds) |
163
+ | `AGENT_HUB_SESSION_CACHE_TTL` | `10` | Session cache TTL (seconds) |
164
+ | `AGENT_HUB_INJECTION_WORKERS` | `4` | Injection worker threads |
165
+ | `AGENT_HUB_INJECTION_RETRIES` | `3` | Injection retry attempts |
166
+ | `AGENT_HUB_INJECTION_TIMEOUT` | `5` | Injection timeout (seconds) |
167
+ | `AGENT_HUB_METRICS_INTERVAL` | `30` | Metrics write interval (seconds) |
168
+
169
+ ### Rate Limiting
170
+
171
+ | Variable | Default | Description |
172
+ |----------|---------|-------------|
173
+ | `AGENT_HUB_RATE_LIMIT` | `false` | Enable rate limiting |
174
+ | `AGENT_HUB_RATE_LIMIT_MAX` | `10` | Max messages per agent per window |
175
+ | `AGENT_HUB_RATE_LIMIT_WINDOW` | `300` | Window size (seconds) |
176
+ | `AGENT_HUB_RATE_LIMIT_COOLDOWN` | `0` | Min seconds between messages |
177
+
178
+ ### Coordinator
179
+
180
+ The coordinator is a dedicated OpenCode session that introduces agents to each other. It starts non-blocking and uses the same message pipeline as any other agent.
181
+
182
+ | Variable | Default | Description |
183
+ |----------|---------|-------------|
184
+ | `AGENT_HUB_COORDINATOR` | `true` | Enable coordinator |
185
+ | `AGENT_HUB_COORDINATOR_DIR` | `~/.agent-hub/coordinator` | Coordinator working directory |
186
+ | `AGENT_HUB_COORDINATOR_PRESERVE_LOCAL_AGENTS_MD` | `false` | Keep existing AGENTS.md on restart |
187
+ | `AGENT_HUB_COORDINATOR_READY_TIMEOUT` | `20` | Bootstrap ready timeout (seconds) |
188
+ | `AGENT_HUB_COORDINATOR_STRICT_READY` | `false` | Require exact `READY` acknowledgment |
189
+ | `AGENT_HUB_COORDINATOR_BOOTSTRAP_REQUIRED` | `false` | Fail startup if bootstrap times out |
190
+ | `AGENT_HUB_COORDINATOR_AGENTS_MD` | (auto-detect) | Custom AGENTS.md path |
191
+
192
+ The coordinator model is set in `~/.agent-hub/coordinator/opencode.json` (default: `opencode/minimax-m2.5-free`).
193
+
194
+ Custom coordinator instructions are searched in order:
195
+ 1. `AGENT_HUB_COORDINATOR_AGENTS_MD` env var
196
+ 2. `~/.config/agent-hub-daemon/AGENTS.md` (or `COORDINATOR.md`)
197
+ 3. Package template (`contrib/coordinator/AGENTS.md`)
198
+ 4. `/usr/local/share/opencode-agent-hub/coordinator/AGENTS.md`
199
+ 5. Auto-generated minimal default
200
+
201
+ ## Message Format
202
+
203
+ Messages are JSON files in `~/.agent-hub/messages/`:
204
+
205
+ ```json
206
+ {
207
+ "from": "agent-id",
208
+ "to": "target-agent-id",
209
+ "type": "task|question|context|completion|error",
210
+ "content": "Message content",
211
+ "priority": "normal|urgent|high|low",
212
+ "threadId": "auto-generated-or-provided",
213
+ "timestamp": 1234567890000
214
+ }
215
+ ```
216
+
217
+ ## Directory Structure
218
+
219
+ ```
220
+ ~/.agent-hub/
221
+ ├── agents/ # Registered agent files
222
+ ├── messages/ # Pending messages
223
+ │ └── archive/ # Processed messages
224
+ ├── threads/ # Conversation threads
225
+ ├── metrics.prom # Prometheus metrics
226
+ ├── oriented_sessions.json # Orientation cache
227
+ └── session_agents.json # Session-to-agent mapping
228
+
229
+ ~/.config/agent-hub-daemon/
230
+ └── config.json # Optional config
231
+ ```
232
+
233
+ ## Development
234
+
235
+ ```bash
236
+ uv sync --all-extras
237
+ uv run ruff check .
238
+ uv run ruff format .
239
+ uv run mypy src/
240
+ uv run pytest
241
+ ```
242
+
243
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for integration testing and architecture details.
244
+
245
+ ## Acknowledgments
246
+
247
+ - **[OpenCode](https://github.com/anomalyco/opencode)** by [anomalyco](https://github.com/anomalyco)
248
+ - **[agent-hub-mcp](https://github.com/gilbarbara/agent-hub-mcp)** by [@gilbarbara](https://github.com/gilbarbara)
249
+
250
+ ## License
251
+
252
+ MIT - See [LICENSE](LICENSE) for details.
@@ -6,6 +6,12 @@ You are the **coordinator** for a multi-agent system. Your job is to facilitate
6
6
 
7
7
  Your value is making agents aware of each other. Once they're talking directly, **stay out of it**.
8
8
 
9
+ ## Session Mode
10
+
11
+ - This session is non-interactive.
12
+ - Never ask the human user anything.
13
+ - Never use the `question` tool.
14
+
9
15
  ## Your Responsibilities
10
16
 
11
17
  1. **Capture tasks** - When notified of a new agent, ask what they're working on (ONE message)
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
+ "model": "opencode/minimax-m2.5-free",
3
4
  "permission": [
4
5
  {"permission": "agent-hub_*", "pattern": "*", "action": "allow"},
5
6
  {"permission": "question", "pattern": "agent-hub*", "action": "allow"},
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "opencode-agent-hub"
7
- version = "1.3.1"
7
+ version = "1.3.3"
8
8
  description = "Multi-agent coordination daemon and tools for OpenCode"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -8,4 +8,4 @@ from importlib.metadata import PackageNotFoundError, version
8
8
  try:
9
9
  __version__ = version("opencode-agent-hub")
10
10
  except PackageNotFoundError: # pragma: no cover - fallback for dev
11
- __version__ = "1.3.1"
11
+ __version__ = "1.3.3"