@hivey/cli 0.9.43 → 0.9.46
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.
- package/native/darwin-arm64/hivey +0 -0
- package/package.json +1 -1
- package/repo/plugins/README.md +1 -0
- package/repo/plugins/slack-relay/relay.py +19 -5
- package/repo/plugins/slack-relay/test_relay.py +17 -0
- package/repo/skills/hivey/SKILL.md +12 -0
- package/repo/skills/hivey-swarm-creator/SKILL.md +12 -1
- package/repo/skills/hivey-swarm-creator/references/shared-rules.md +9 -0
|
Binary file
|
package/package.json
CHANGED
package/repo/plugins/README.md
CHANGED
|
@@ -82,6 +82,7 @@ The swarm manifest `<root>/.swarm/agents.json` is hivey's; a provider may add:
|
|
|
82
82
|
| `info` | `{"Slack": "#swarm-x (C0…)", "vault": "…"}` or `[[label, value], …]`: shown in the hover card and `hivey swarm info` |
|
|
83
83
|
| `product_dir` | the product folder `hivey.github` publishes (default `app`) |
|
|
84
84
|
| `state` | `"paused"` holds all deliveries (what `hivey swarm pause` sets) |
|
|
85
|
+
| `comms` | message limits (`rate_per_min`, `pair_wakes`, `pair_window_min`, `hourly_wakes`, `broadcasts_per_hour`, `dedupe_min`) and the Slack mirror scope (`slack`: `masters`, `all`, `off`), set with `hivey swarm comms` |
|
|
85
86
|
| `.swarm/tasks.json` | `{"tasks": [{"status": "open\|in-progress\|review\|approved\|blocked"}]}`: task counts in info and the dashboard |
|
|
86
87
|
|
|
87
88
|
Step-by-step guide and an example to copy: [`../docs/hivey-providers.md`](../docs/hivey-providers.md)
|
|
@@ -6,9 +6,11 @@ Slack → bus Human messages in the channel become bus messages from `human`:
|
|
|
6
6
|
`@coordinator`/`@master` → the master, no mention → the master.
|
|
7
7
|
Posts made by agents with the /swarm skill's swarm_slack.py
|
|
8
8
|
("*[agent]* text") keep that agent as the sender.
|
|
9
|
-
bus → Slack Bus messages are mirrored into the channel. Scope
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
bus → Slack Bus messages are mirrored into the channel. Scope: the swarm's own
|
|
10
|
+
`comms.slack` in its manifest (`hivey swarm comms <slug> --slack …`, read
|
|
11
|
+
live), else config "mirror": "masters" (default: only messages to/from a
|
|
12
|
+
master or the human), "all", or "off". Messages that came from Slack are
|
|
13
|
+
never echoed.
|
|
12
14
|
Quiet mode While ~/.hivey/quiet exists (hivey menu → quiet mode, `hivey quiet on`), bus →
|
|
13
15
|
Slack posts are held; when it ends they go out as one catch-up message, with
|
|
14
16
|
posts agents held through swarm_slack.py (~/.hivey/quiet-held/<channel>.jsonl).
|
|
@@ -114,6 +116,16 @@ def involves_master(message, roles):
|
|
|
114
116
|
)
|
|
115
117
|
|
|
116
118
|
|
|
119
|
+
MIRROR_SCOPES = ("masters", "all", "off")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def mirror_scope(manifest, default):
|
|
123
|
+
"""The swarm's own Slack scope (manifest comms.slack) wins over the relay's config."""
|
|
124
|
+
comms = manifest.get("comms") if isinstance(manifest.get("comms"), dict) else {}
|
|
125
|
+
scope = comms.get("slack")
|
|
126
|
+
return scope if scope in MIRROR_SCOPES else default
|
|
127
|
+
|
|
128
|
+
|
|
117
129
|
def should_mirror(message, scope, roles, injected):
|
|
118
130
|
if scope == "off" or message.get("copy") or message.get("id") in injected:
|
|
119
131
|
return False
|
|
@@ -317,8 +329,9 @@ class Relay:
|
|
|
317
329
|
self.catch_up() # before reading the bus: if it fails, nothing new is lost
|
|
318
330
|
messages, self.state["bus_offset"] = new_bus_messages(self.bus_path, self.state["bus_offset"])
|
|
319
331
|
roles = roster(manifest)
|
|
332
|
+
scope = mirror_scope(manifest, self.scope)
|
|
320
333
|
for message in messages:
|
|
321
|
-
if not should_mirror(message,
|
|
334
|
+
if not should_mirror(message, scope, roles, set(self.state["injected"])):
|
|
322
335
|
continue
|
|
323
336
|
text = format_mirror(message, roles, manifest.get("slug", ""))
|
|
324
337
|
if quiet:
|
|
@@ -374,7 +387,8 @@ def main():
|
|
|
374
387
|
scope = config.get("mirror", "masters")
|
|
375
388
|
interval = float(config.get("interval", 10))
|
|
376
389
|
binary = os.environ.get("HERDR_BIN_PATH", "hivey")
|
|
377
|
-
log(f"hivey slack relay for swarm {slug!r}, channel {channel},
|
|
390
|
+
log(f"hivey slack relay for swarm {slug!r}, channel {channel}, "
|
|
391
|
+
f"mirror={mirror_scope(manifest, scope)}")
|
|
378
392
|
if not channel:
|
|
379
393
|
log("no Slack channel (manifest channel_id / HIVEY_SWARM_CHANNEL); idle")
|
|
380
394
|
token = None
|
|
@@ -94,6 +94,13 @@ class Mirror(unittest.TestCase):
|
|
|
94
94
|
self.assertTrue(keep(self.msg("ideas/scout", "critic"), "all", self.roles, set()))
|
|
95
95
|
self.assertFalse(keep(self.msg("ideas/scout", "coordinator"), "off", self.roles, set()))
|
|
96
96
|
|
|
97
|
+
def test_the_swarms_comms_slack_wins_over_the_relay_config(self):
|
|
98
|
+
self.assertEqual(relay.mirror_scope({"comms": {"slack": "off"}}, "all"), "off")
|
|
99
|
+
self.assertEqual(relay.mirror_scope({"comms": {"slack": "all"}}, "masters"), "all")
|
|
100
|
+
self.assertEqual(relay.mirror_scope({}, "masters"), "masters")
|
|
101
|
+
self.assertEqual(relay.mirror_scope({"comms": {"slack": "loud"}}, "masters"), "masters")
|
|
102
|
+
self.assertEqual(relay.mirror_scope({"comms": None}, "all"), "all")
|
|
103
|
+
|
|
97
104
|
def test_never_echoes_slack_messages_or_sender_copies(self):
|
|
98
105
|
self.assertFalse(relay.should_mirror(self.msg("human", "coordinator"), "all", self.roles, {"m1"}))
|
|
99
106
|
self.assertFalse(relay.should_mirror(self.msg("ideas/coordinator", "coordinator", copy=True),
|
|
@@ -163,6 +170,16 @@ class RoundTrip(unittest.TestCase):
|
|
|
163
170
|
self.assertEqual(len(slack.posted), 1)
|
|
164
171
|
self.assertIn("scout → coordinator", slack.posted[0])
|
|
165
172
|
self.assertEqual(len(hivey.sent), 1)
|
|
173
|
+
# The swarm turns Slack off in its manifest: read live, nothing more is posted.
|
|
174
|
+
(root / ".swarm" / "agents.json").write_text(
|
|
175
|
+
json.dumps({**MANIFEST, "comms": {"slack": "off"}}))
|
|
176
|
+
with open(bus, "a") as f:
|
|
177
|
+
f.write("\n" + json.dumps({"ev": "msg", "id": "a2", "from": "ideas/scout",
|
|
178
|
+
"to": "coordinator", "swarm": "ideas",
|
|
179
|
+
"text": "found 4"}) + "\n")
|
|
180
|
+
r.step()
|
|
181
|
+
self.assertEqual(len(slack.posted), 1, slack.posted)
|
|
182
|
+
(root / ".swarm" / "agents.json").write_text(json.dumps(MANIFEST))
|
|
166
183
|
# State survives a restart of the relay.
|
|
167
184
|
again = relay.Relay(root, slack, hivey, "C1", "masters")
|
|
168
185
|
again.step()
|
|
@@ -120,6 +120,18 @@ python3 <this skill>/scripts/fresh_review.py config <swarm root | agent folder>
|
|
|
120
120
|
Swarm owners start it with `swarm_tasks.py submit <ID> --as <agent>`; solo agents with
|
|
121
121
|
`fresh_review.py run --folder .`. Reviews land in `.swarm/reviews/` or `.agent/reviews/`.
|
|
122
122
|
|
|
123
|
+
Comms limits (per swarm, against floods and over-discussion; the human and hivey are never
|
|
124
|
+
limited): messages per agent per minute, wake-ups per agent pair, wake-ups per agent per hour
|
|
125
|
+
(then saved as FYI), `@all`/`@role:` broadcasts per hour, the same text twice dropped, and
|
|
126
|
+
what the Slack relay mirrors:
|
|
127
|
+
```bash
|
|
128
|
+
hivey swarm comms <slug> # show (defaults: 10/min, 6 per pair
|
|
129
|
+
# per 5 min, 30/h, 4 broadcasts/h, 10 min dedupe)
|
|
130
|
+
hivey swarm comms <slug> --preset quiet|normal|chatty # or single flags, e.g. --hourly-wakes 12
|
|
131
|
+
hivey swarm comms <slug> --slack masters|all|off # what goes to its Slack channel
|
|
132
|
+
```
|
|
133
|
+
`hivey swarm launch … --comms-preset quiet` sets it at launch.
|
|
134
|
+
|
|
123
135
|
Messages (delivered when the target is idle; `--fyi` never wakes; `--urgent` now):
|
|
124
136
|
```bash
|
|
125
137
|
hivey msg send <agent|@all|@role:worker|@masters|<swarm>/<agent>|human> "text" [--fyi|--urgent] [--swarm S]
|
|
@@ -155,6 +155,12 @@ In the same message:
|
|
|
155
155
|
where a miss is costly; 0 turns fresh review off and you approve by hand), their model
|
|
156
156
|
(suggest `sonnet`) and the maximum rounds (suggest 3). Each critic is one short `claude -p`
|
|
157
157
|
run per review, so N critics cost about N extra reads of the deliverable.
|
|
158
|
+
- **Ask how chatty the swarm may be** (comms preset): `normal` (suggest it: 10 messages/min,
|
|
159
|
+
30 wake-ups/h per agent, 4 `@all`/h, repeats dropped, Slack mirrors only master and human
|
|
160
|
+
traffic), `quiet` for big or long-running swarms (5/min, 12/h, 2 broadcasts/h, Slack masters
|
|
161
|
+
only), or `chatty` for short, tightly coupled builds (Slack mirrors everything). Over a limit,
|
|
162
|
+
messages are saved as FYI (they don't wake anyone) or refused, so agents batch and stop
|
|
163
|
+
ping-ponging.
|
|
158
164
|
- **Slack**: run `hivey slack status` before showing the plan. Connected: `hivey swarm launch`
|
|
159
165
|
creates (or joins) `#<name>`, invites the user and starts the relay, nothing else to do. Not
|
|
160
166
|
connected: ask the user to run `hivey slack connect` in a terminal (never ask for the token in
|
|
@@ -251,7 +257,7 @@ user's tweaks), linked from `index.md`, with a `bootstrap` entry in `log.md`.
|
|
|
251
257
|
```bash
|
|
252
258
|
hivey swarm launch <root> --slug <name> --icon <emoji> <agent>... \
|
|
253
259
|
--models builder=opus,writer=sonnet --kinds reviewer=codex,scout=grok \
|
|
254
|
-
--budget-min 120 --heartbeat 15m \
|
|
260
|
+
--budget-min 120 --heartbeat 15m --comms-preset normal \
|
|
255
261
|
--heartbeat-task "Monitoring pass: follow the hivey-swarm-creator skill's monitoring pass" \
|
|
256
262
|
--addon hivey.dashboard --addon hivey.swarm-watcher \
|
|
257
263
|
--kickoff "Read your CLAUDE.md, then send START to coordinator as it says."
|
|
@@ -358,6 +364,11 @@ that ended in ERROR, is yours: read the review and accept it (`set <ID> approved
|
|
|
358
364
|
coordinator`), re-scope it, or give the owner a specific fix. If an owner disputes a defect, it
|
|
359
365
|
tells you with evidence; you decide. Don't review deliverables yourself instead of the critics.
|
|
360
366
|
|
|
367
|
+
**Too much talk.** If agents ping-pong, flood `@all` or Slack, tighten the swarm's limits
|
|
368
|
+
(`hivey swarm comms <name> --preset quiet`, or one flag such as `--hourly-wakes 12` or
|
|
369
|
+
`--slack masters`) and tell the agents involved to batch their messages. Ask the user before
|
|
370
|
+
loosening them.
|
|
371
|
+
|
|
361
372
|
**Roster changes** (agents added or re-scoped): update `.swarm/README.md` and the swarm section
|
|
362
373
|
in every agent's CLAUDE.md, then `hivey msg send @all` what changed. A new agent: scaffold it,
|
|
363
374
|
write its brief, and add it with `hivey swarm relaunch <name> <agent>` once it's in the manifest
|
|
@@ -5,6 +5,15 @@ Always end your final response with `DONE: <3 words max>` on its own line (e.g.
|
|
|
5
5
|
stop hooks`). hivey's Stop hook reads it as the run's summary and speaks it for masters and solo
|
|
6
6
|
agents; swarm workers stay silent.
|
|
7
7
|
|
|
8
|
+
# Messages
|
|
9
|
+
|
|
10
|
+
Every message wakes someone and costs their turn. Send only what the other agent must act on:
|
|
11
|
+
no acks, thanks or "got it"; one message per hand-off; long content goes in a file and you
|
|
12
|
+
send the path. Don't reply to FYIs. Use `@all` only when everyone must act. When a notice says
|
|
13
|
+
you and a teammate hit the pair limit, or your hourly limit, stop and batch what's left into
|
|
14
|
+
one message (or let the task board and files speak). Your swarm's limits: `hivey swarm comms
|
|
15
|
+
<swarm>`.
|
|
16
|
+
|
|
8
17
|
# Docs: Context7 first
|
|
9
18
|
|
|
10
19
|
For any library, framework, SDK, API, CLI or cloud service, look the docs up with the
|