Problem
A person mentions an agent in a heading's chat room. The agent reads that section and replies in the same thread. Nothing does this today.
An earlier audit ranked this first, because it needed no identity work. That justification is gone: with an OAuth token from #223, chat needs no separate identity work either. So this is now an internal demonstration, not the path to a product.
What to do
Add an agent subcommand to packages/document-swarm. Three files: one new src/agent.ts, one case 'agent': in the CLI switch, and one Readme paragraph.
The loop: mint or adopt one account, refuse any non-allowlisted host, poll public.messages from a seq cursor, match its own username, read the mentioned heading's section, call a model once, insert one reply.
Reply only. No document writes.
Acceptance
Notes
packages/document-swarm is "private": true and never published. classifySwarmHost refuses every host but localhost, *.local and stage.docs.plus, so this cannot reach production by design. That is why it does not touch the open ruling in #165.
The first two acceptance items are security conditions, not polish. Without the first, one bot token reads chat across the instance.
Ordered last in the connector work. Nothing depends on it.
Problem
A person mentions an agent in a heading's chat room. The agent reads that section and replies in the same thread. Nothing does this today.
An earlier audit ranked this first, because it needed no identity work. That justification is gone: with an OAuth token from #223, chat needs no separate identity work either. So this is now an internal demonstration, not the path to a product.
What to do
Add an
agentsubcommand topackages/document-swarm. Three files: one newsrc/agent.ts, onecase 'agent':in the CLI switch, and one Readme paragraph.The loop: mint or adopt one account, refuse any non-allowlisted host, poll
public.messagesfrom aseqcursor, match its own username, read the mentioned heading's section, call a model once, insert one reply.Reply only. No document writes.
Acceptance
bun document-swarm agent --url <doc-url>answers a mention in the same heading room.preflightSwarmTargetalready returned. A row for another document is refused.@before insert, so it cannot fire the notification fan-out.client_idis set from the mention id, so a retried reply cannot double-post.Notes
packages/document-swarmis"private": trueand never published.classifySwarmHostrefuses every host but localhost,*.localandstage.docs.plus, so this cannot reach production by design. That is why it does not touch the open ruling in #165.The first two acceptance items are security conditions, not polish. Without the first, one bot token reads chat across the instance.
Ordered last in the connector work. Nothing depends on it.