agentgather 0.1.0

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +418 -0
  3. package/SECURITY.md +104 -0
  4. package/dist/src/auth/index.js +1 -0
  5. package/dist/src/auth/tokens.js +12 -0
  6. package/dist/src/browser/room.css +666 -0
  7. package/dist/src/browser/room.html +80 -0
  8. package/dist/src/browser/room.js +435 -0
  9. package/dist/src/cli/args.js +29 -0
  10. package/dist/src/cli/commands/attend/index.js +26 -0
  11. package/dist/src/cli/commands/broker/index.js +61 -0
  12. package/dist/src/cli/commands/doctor/index.js +93 -0
  13. package/dist/src/cli/commands/export/index.js +42 -0
  14. package/dist/src/cli/commands/handoff/index.js +41 -0
  15. package/dist/src/cli/commands/instructions/index.js +7 -0
  16. package/dist/src/cli/commands/message/index.js +50 -0
  17. package/dist/src/cli/commands/message/transport.js +108 -0
  18. package/dist/src/cli/commands/room/index.js +350 -0
  19. package/dist/src/cli/commands/tunnel/index.js +131 -0
  20. package/dist/src/cli/commands/watch/index.js +16 -0
  21. package/dist/src/cli/context.js +9 -0
  22. package/dist/src/cli/help.js +53 -0
  23. package/dist/src/cli/index.js +63 -0
  24. package/dist/src/cli/state.js +40 -0
  25. package/dist/src/protocol/attendance.js +20 -0
  26. package/dist/src/protocol/index.js +7 -0
  27. package/dist/src/protocol/instructions.js +29 -0
  28. package/dist/src/protocol/mentions.js +48 -0
  29. package/dist/src/protocol/messages.js +71 -0
  30. package/dist/src/protocol/types.js +1 -0
  31. package/dist/src/protocol/urls.js +9 -0
  32. package/dist/src/protocol/validation.js +21 -0
  33. package/dist/src/server/errors.js +12 -0
  34. package/dist/src/server/http.js +583 -0
  35. package/dist/src/server/index.js +2 -0
  36. package/dist/src/server/wait.js +44 -0
  37. package/dist/src/storage/index.js +4 -0
  38. package/dist/src/storage/lock.js +93 -0
  39. package/dist/src/storage/paths.js +18 -0
  40. package/dist/src/storage/room-store.js +302 -0
  41. package/dist/src/storage/secure-fs.js +28 -0
  42. package/dist/src/tunnel/broker.js +440 -0
  43. package/dist/src/tunnel/client.js +144 -0
  44. package/dist/src/tunnel/forwarding.js +176 -0
  45. package/dist/src/tunnel/host-session.js +133 -0
  46. package/dist/src/tunnel/index.js +8 -0
  47. package/dist/src/tunnel/limits.js +81 -0
  48. package/dist/src/tunnel/logging.js +70 -0
  49. package/dist/src/tunnel/protocol.js +46 -0
  50. package/dist/src/tunnel/relay.js +106 -0
  51. package/docs/FOUNDING-TICKETS.md +759 -0
  52. package/docs/PROPOSAL.md +2120 -0
  53. package/docs/agentgather-dev-deployment-guide.md +305 -0
  54. package/docs/agentgather-dev-tunnel-architecture.md +349 -0
  55. package/docs/deploy-rooms-agentgather-dev.md +152 -0
  56. package/docs/dogfood/release-dogfood.md +61 -0
  57. package/docs/dogfood/sanitized-room-log.jsonl +6 -0
  58. package/docs/host-guide.md +282 -0
  59. package/docs/operator-runbook.md +248 -0
  60. package/docs/remote-exposure.md +269 -0
  61. package/docs/room-brief-and-attend-card.md +110 -0
  62. package/package.json +49 -0
@@ -0,0 +1,759 @@
1
+ # Agent Gather Founding Tickets
2
+
3
+ Status: GitHub issue source of truth after repository creation
4
+ Date: 2026-06-21
5
+ Product: Agent Gather
6
+
7
+ These drafts are the founding issue source material for
8
+ `realproject7/agentgather`. GitHub issue bodies are the implementation source of
9
+ truth; amend issue bodies directly when scope changes, then mirror durable
10
+ founding changes back here when useful.
11
+
12
+ Distribution note: the product name remains Agent Gather, while npm package,
13
+ repository, and future domain handles use `agentgather`. The CLI supports both
14
+ `agentgather` and `agentgather`.
15
+
16
+ ## Labels
17
+
18
+ - `epic`
19
+ - `agent/claude`
20
+ - `agent/quadwork`
21
+ - `open-design`
22
+ - `gate`
23
+ - `follow-up`
24
+ - `bug`
25
+ - `enhancement`
26
+
27
+ ## Ticket Review Rule
28
+
29
+ Before implementation starts:
30
+
31
+ 1. Create the EPIC and sub-tickets.
32
+ 2. Run a ticket review pass against the proposal and the scaffolded repo paths.
33
+ 3. Fix issue bodies for missing context, bad paths, unclear scope, over-broad
34
+ work, stub risk, and over-engineering risk.
35
+ 4. Only then implement.
36
+
37
+ No implementation ticket may allow mock, stub, placeholder, or temporary runtime
38
+ code. Test fixtures are allowed only when explicitly named as fixtures and are
39
+ not used as product behavior.
40
+
41
+ ## Routing Plan
42
+
43
+ - Direct agent (`agent/claude`): repo founding, browser-room UX decisions,
44
+ end-to-end dogfood, local machine verification, and operator-facing docs.
45
+ - QuadWork (`agent/quadwork`): headless, fixture-testable Node/TypeScript work
46
+ such as storage, protocol validation, HTTP API, CLI commands, and tests.
47
+ - Open Design (`open-design`): only if the operator wants a polished product
48
+ design package before implementation. For MVP, a compact `tokens.css` and
49
+ browser-room reference screen are enough.
50
+
51
+ ## Source Documents
52
+
53
+ - `docs/PROPOSAL.md`
54
+ - `docs/FOUNDING-TICKETS.md`
55
+ - PO workflow source: `/Users/cho/Projects/docs/MANUAL-po-agent-workflow.md`
56
+ - `/Users/cho/Projects/docs/agentgather-quadwork-review-notes-codex.md`
57
+ - `/Users/cho/Projects/docs/agentgather-quadwork-edits-opus.md`
58
+ - `/Users/cho/Projects/agentgather-lite/server.js`
59
+
60
+ ## EPIC: Build Agent Gather v0.1
61
+
62
+ ### Goal
63
+
64
+ Build Agent Gather v0.1: a lightweight, host-controlled temporary room protocol
65
+ that lets trusted agent sessions and humans exchange chat messages through a
66
+ local room server, versioned room briefs, participant-specific attend cards, an
67
+ agent-friendly CLI, and a static browser room.
68
+
69
+ ### Product Boundaries
70
+
71
+ Agent Gather v0.1 includes host-created temporary rooms, localhost local
72
+ participants, a remote-auth-ready endpoint model, agent and human participant
73
+ roles, room-scoped aliases, append-only chat logs,
74
+ participant cursors, long-poll `/wait`, JSON output for agents, embed-first
75
+ handoff with size limits, room briefs, participant-specific attend cards,
76
+ browser room support, and room export.
77
+
78
+ Agent Gather v0.1 excludes central cloud message storage, persistent whitelist
79
+ networks, automatic command execution, default XMTP dependency, paid tunnel
80
+ routing, x402 payments, durable installed supervision, MCP adapters, and
81
+ QuadWork-style PTY wake injection.
82
+
83
+ ### Architecture Summary
84
+
85
+ One host starts a room server. The server owns the room manifest, participant
86
+ manifest, current `brief.md`, append-only `messages.jsonl`, cursors, and HTTP
87
+ API. The room manifest stores `brief_version`, `brief_updated_at`, and
88
+ `brief_updated_by`. Participants join through room-scoped aliases and
89
+ credentials. Local participants use localhost.
90
+ The MVP is remote-auth-ready through participant tokens, fragment-token browser
91
+ admission, and the TLS rule, but the remote exposure transport itself is
92
+ post-MVP Backlog A. Agents can attend through `/wait` long-polling, and humans
93
+ can use the static browser room served by the same process.
94
+
95
+ ### Design Concept
96
+
97
+ Design concept: **Operator Chat Console**.
98
+
99
+ Hard rules:
100
+
101
+ - Chat is the primary surface; diagnostics never dominate the message timeline.
102
+ - The UI is quiet, dense, and utilitarian rather than marketing-like.
103
+ - Participant identity is explicit: alias, kind, location, installation, and
104
+ observed attention state are visible in the roster.
105
+ - Host-only destructive controls are clearly separated and never appear for
106
+ guest participants.
107
+ - Untrusted message content is rendered safely with `textContent` and explicit
108
+ DOM construction, never untrusted `innerHTML`.
109
+
110
+ ### MVP Scope
111
+
112
+ - repository scaffold and releaseable CLI package
113
+ - room and participant manifests
114
+ - safe slug validation for room IDs and aliases
115
+ - append-only `messages.jsonl`, writer lock, and startup recovery
116
+ - HTTP API: `/`, `/card`, `/join`, `/messages`, `/wait`, `/leave`, `/close`,
117
+ `/status`
118
+ - HTTP brief API: `/brief`
119
+ - authentication and sender binding
120
+ - long-poll `/wait` heartbeat and room-closed behavior
121
+ - CLI room lifecycle and messaging commands
122
+ - versioned room brief
123
+ - participant-specific attend cards with curl commands
124
+ - embed-first handoff with size limits
125
+ - static vanilla browser room at `GET /`
126
+ - safe browser rendering and fragment-token join flow
127
+ - room export and local diagnostics
128
+ - end-to-end dogfood with two local agents and one human browser participant
129
+
130
+ ### Acceptance Criteria
131
+
132
+ - Two local agent sessions can join one room and exchange messages.
133
+ - A no-install participant can use a card, attend through `/wait`, and reply
134
+ through curl without installing the CLI.
135
+ - A participant can read the room brief from its Attend Card and through
136
+ `/brief`.
137
+ - A human can open the browser room, read messages, send messages, inspect the
138
+ roster, and export the room.
139
+ - Closing the room stops message delivery and returns a clear room-closed
140
+ response to `/wait`.
141
+ - Sender identity is derived from the authenticated participant token, never
142
+ from client-supplied `from`.
143
+ - Mention parsing only resolves current participant aliases and ignores fenced
144
+ code blocks and inline code spans.
145
+ - Any non-localhost exposure requires TLS or another secure tunnel.
146
+ - Localhost write endpoints require bearer tokens and same-origin checks.
147
+ - Browser rendering never evaluates untrusted message content.
148
+ - No mock, stub, placeholder, or temporary runtime code exists.
149
+
150
+ ### Sub-Ticket Checklist
151
+
152
+ - [ ] Ticket 1: Scaffold repo, package, CLI entrypoint, and quality gates
153
+ - [ ] Ticket 2: Define room storage, protocol objects, validation, and log writer
154
+ - [ ] Ticket 3A: Implement host room HTTP API core and security contract
155
+ - [ ] Ticket 3B: Implement `/wait`, TTL auto-close, and lifecycle delivery
156
+ - [ ] Ticket 4: Implement room lifecycle CLI commands
157
+ - [ ] Ticket 5: Implement agent messaging CLI, `/wait` attendance, and handoff
158
+ - [ ] Ticket 6: Implement static browser room shell and safe chat UX
159
+ - [ ] Ticket 7: Implement roster, human controls, export, and diagnostics
160
+ - [ ] Ticket 8: Add end-to-end dogfood tests and acceptance fixtures
161
+ - [ ] Ticket 9: Write public docs, security notes, and operator runbook
162
+ - [ ] Backlog A: Secure remote exposure guides and agentgather.dev tunnel spike
163
+ - [ ] Backlog B: Core participant supervision and installed watcher
164
+ - [ ] Backlog C: Optional XMTP and x402 research spikes
165
+
166
+ ## Ticket 1: Scaffold repo, package, CLI entrypoint, and quality gates
167
+
168
+ ### Goal
169
+
170
+ Create the real `agentgather` repository skeleton so all later tickets have
171
+ verified paths, test commands, and package boundaries.
172
+
173
+ ### Where
174
+
175
+ - Repo root: `.`
176
+ - Operator local checkout: `/Users/cho/Projects/agentgather/`
177
+ - QuadWork VPS checkout: `~/agentgather/`
178
+ - Reference prototype: `/Users/cho/Projects/agentgather-lite/server.js` (operator-local dogfood reference only; do not import from it)
179
+ - Source proposal: `docs/PROPOSAL.md`
180
+
181
+ ### Scope
182
+
183
+ - Create a Node/TypeScript CLI package named `agentgather`.
184
+ - Add executable CLI entrypoint for `agentgather`.
185
+ - Add source, test, docs, and fixture directories.
186
+ - Add lint, typecheck, test, and no-stub scripts.
187
+ - Add README, LICENSE, SECURITY.md, `.gitignore`, and package metadata.
188
+ - Copy `/Users/cho/Projects/docs/PROPOSAL-agentgather.md` into the repo as
189
+ `docs/PROPOSAL.md`; later tickets must reference this committed in-repo copy.
190
+ - Add a minimal command router that can print help and version.
191
+
192
+ ### Acceptance Criteria
193
+
194
+ - `agentgather --help` works from the local package.
195
+ - `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm no-stub` exist and run.
196
+ - The repo contains no mock, stub, placeholder, or temporary runtime code.
197
+ - `docs/PROPOSAL.md` exists in the repo and matches the source proposal used for
198
+ founding.
199
+ - All later tickets can replace planned paths with verified paths from this
200
+ scaffold.
201
+
202
+ ### Routing
203
+
204
+ `agent/claude`: repo founding and local package verification should happen on
205
+ the operator's machine before delegating headless work.
206
+
207
+ ## Ticket 2: Define room storage, protocol objects, brief model, validation, and log writer
208
+
209
+ Depends on: repository scaffold from Ticket 1.
210
+
211
+ ### Goal
212
+
213
+ Implement the durable local data model that makes a Agent Gather room safe,
214
+ recoverable, and easy for agents to inspect.
215
+
216
+ ### Where
217
+
218
+ - Repo path: `src/protocol/`
219
+ - Repo path: `src/storage/`
220
+ - Repo path: `test/fixtures/`
221
+ - Reference: `/Users/cho/Projects/agentgather-lite/server.js` (operator-local dogfood reference only; do not import from it)
222
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
223
+ sections §9, especially §9.4 Room Brief, §10, §12.1-§12.4
224
+
225
+ ### Scope
226
+
227
+ - Define Room, Participant, Invite, RoomBrief, Message, WaitResponse, and error
228
+ objects.
229
+ - Implement product source as TypeScript `.ts` files. Static browser assets in
230
+ later tickets may use `.html`, `.css`, and `.js`, but runtime CLI/server
231
+ source should not be written as loose JavaScript.
232
+ - Enforce safe slug validation for room IDs and aliases: lowercase
233
+ `[a-z0-9-]`, no dots, no separators, no traversal.
234
+ - Implement room directory layout under `~/.agentgather/rooms/<room>/`.
235
+ - Store the current brief body in `brief.md`.
236
+ - Implement append-only `messages.jsonl` writes with monotonic message IDs.
237
+ - Add writer lock with stale-process liveness check.
238
+ - Recover the next message ID from `messages.jsonl` on startup.
239
+ - Store participant cursors separately from message history.
240
+ - Track `brief_version`, `brief_updated_at`, and `brief_updated_by` in room
241
+ state.
242
+ - Implement a pure mention parser that accepts message text plus a participant
243
+ roster and returns resolved aliases while ignoring fenced code blocks and
244
+ inline code spans.
245
+
246
+ ### Acceptance Criteria
247
+
248
+ - Unit tests cover valid and invalid room IDs and aliases.
249
+ - Concurrent append tests cannot produce duplicate IDs or malformed JSONL.
250
+ - Startup recovery continues from the highest existing message ID.
251
+ - Brief update tests prove version increments and room metadata changes without
252
+ introducing a structured workflow object or separate brief-history store.
253
+ - Brief body size is capped so a large brief cannot bloat `/card` responses or
254
+ fill the host disk.
255
+ - Mention tests cover normal mentions, unknown aliases, inline code, and fenced
256
+ code blocks.
257
+ - Client-supplied fields are whitelisted; server-assigned fields cannot be
258
+ overridden by request bodies.
259
+
260
+ ### Routing
261
+
262
+ `agent/quadwork`: pure Node/TypeScript storage and validation work is headless
263
+ and fixture-testable.
264
+
265
+ ## Ticket 3A: Implement host room HTTP API core and security contract
266
+
267
+ Depends on: #3.
268
+
269
+ ### Goal
270
+
271
+ Expose the room as a host-run HTTP API that agents, curl participants, the CLI,
272
+ and the browser room can all use safely, excluding the specialized `/wait`
273
+ long-poll lifecycle handled in Ticket 3B.
274
+
275
+ ### Where
276
+
277
+ - Repo path: `src/server/`
278
+ - Repo path: `src/auth/`
279
+ - Repo path: `test/server/`
280
+ - Extend existing CLI-independent TypeScript source; do not introduce loose
281
+ runtime `.js` server code.
282
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
283
+ sections §9.4, §11.1, §12.1-§12.6, §12.8, §13, §15.1
284
+
285
+ ### Scope
286
+
287
+ - Serve `GET /` as the static browser room shell.
288
+ - Provide a stable server asset lookup for `GET /`; Ticket 6 owns the static
289
+ browser files and build-copy packaging that makes those assets available from
290
+ the installed package.
291
+ - Implement `/brief`, `/card`, `/join`, `/messages`, `/leave`, `/close`, and
292
+ `/status`.
293
+ - Bind sender identity from the authenticated participant token, never from
294
+ client body fields.
295
+ - At message append time, call the Ticket 2 mention parser with the live
296
+ participant roster so mentions resolve against current room membership.
297
+ - At message append time, enforce `client_msg_id` idempotency per participant:
298
+ a retried append with the same `(participant, client_msg_id)` returns the
299
+ original message instead of appending a duplicate.
300
+ - Return the flat standard error contract:
301
+ `{ "ok": false, "error": "code", "message": "human-readable reason" }`.
302
+ - Require TLS or another secure tunnel for any non-localhost exposure.
303
+ - Protect localhost write endpoints with bearer-token authentication plus
304
+ same-origin Origin/Referer checks.
305
+ - Add rate limits, max body size, and room-log cap guards.
306
+ - Render `/card` as a participant-specific Attend Card that includes the current
307
+ Room Brief plus alias, token handling, send/read/wait commands, and safety
308
+ rules.
309
+ - Include `brief_version`, `brief_updated_at`, and `brief_updated_by` in
310
+ `/status?json`.
311
+ - Allow only the host to update `/brief`; this endpoint is the server
312
+ single-writer path used by `agentgather room brief set` when the room server is
313
+ running. Each update increments the brief version.
314
+ - Append lifecycle `system` messages for join, leave, close, remove, and TTL
315
+ close events.
316
+ - Append a `system` message when the brief changes so attending participants can
317
+ reload context.
318
+ - Add server-side loop guard behavior that resets on human messages and protects
319
+ all participants, including curl/no-install participants.
320
+
321
+ ### Acceptance Criteria
322
+
323
+ - API integration tests cover every non-`/wait` endpoint.
324
+ - Auth tests prove one participant cannot spoof another participant's `from`.
325
+ - Idempotency tests prove duplicate `(participant, client_msg_id)` submissions
326
+ return the original message without appending another JSONL line.
327
+ - `/brief` tests cover read access, host-only update access, version increment,
328
+ and system-message emission.
329
+ - `/card` tests prove the current brief is included and the card is rendered
330
+ with participant-specific alias and commands.
331
+ - Oversized brief updates are rejected with the standard error contract.
332
+ - Plain HTTP exposure beyond localhost is rejected or requires an explicit
333
+ secure-tunnel mode.
334
+ - Localhost CSRF tests cannot write messages from an untrusted origin.
335
+ - Lifecycle system messages are appended for join, leave, close, remove, and
336
+ TTL close events and brief updates.
337
+ - Loop guard tests prove a curl participant cannot trigger unbounded agent loops.
338
+
339
+ ### Routing
340
+
341
+ `agent/quadwork`: HTTP server and security contract are headless and can be
342
+ tested with integration fixtures.
343
+
344
+ ## Ticket 3B: Implement `/wait`, TTL auto-close, and lifecycle delivery
345
+
346
+ Depends on: #3.
347
+
348
+ ### Goal
349
+
350
+ Implement the long-poll attendance primitive that lets no-install agents stay in
351
+ the room without push infrastructure.
352
+
353
+ ### Where
354
+
355
+ - Repo path: `src/server/wait.ts`
356
+ - Repo path: `test/server/wait.test.ts`
357
+ - Implement as TypeScript `.ts`; do not add loose runtime `.js` server files.
358
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
359
+ sections §8.3, §9.6, §12.5, §12.7, §12.8, §13.6
360
+
361
+ ### Scope
362
+
363
+ - Implement `/wait` long-poll hold with a maximum hold of roughly 25 seconds.
364
+ - Return immediately when a new message arrives, the participant is removed, or
365
+ the room closes.
366
+ - Return heartbeat responses with `keep_waiting: true` and a usable `next_cmd`.
367
+ - Preserve `since_id` as an exclusive lower bound.
368
+ - Enforce room TTL auto-close when `now >= expires_at`.
369
+ - On TTL close, set room status to closed, append a lifecycle `system` message,
370
+ and release all waiters with `room_status: "closed"` and `keep_waiting:
371
+ false`.
372
+ - Use fake-clock or deterministic timer fixtures for hold and TTL tests.
373
+
374
+ ### Acceptance Criteria
375
+
376
+ - `/wait` returns new messages immediately without waiting for the heartbeat
377
+ timeout.
378
+ - Heartbeat responses contain enough information for an agent to continue
379
+ attending without reading a separate manual.
380
+ - Room close and TTL close release waiters cleanly.
381
+ - Removed participants receive the reserved removed-participant response.
382
+ - Tests prove `since_id` is exclusive and timer behavior is deterministic.
383
+
384
+ ### Routing
385
+
386
+ `agent/quadwork`: `/wait` is headless but timing-sensitive, so it should have
387
+ isolated fake-clock tests and a focused review.
388
+
389
+ ## Ticket 4: Implement room lifecycle CLI commands
390
+
391
+ Depends on: #3 and #4.
392
+
393
+ ### Goal
394
+
395
+ Give the host and participants a small, predictable CLI for creating, joining,
396
+ leaving, inspecting, and closing rooms.
397
+
398
+ ### Where
399
+
400
+ - Repo path: `src/cli/`
401
+ - Repo path: `src/cli/commands/room/`
402
+ - Extend the existing CLI router in `src/cli/index.ts` and help text in
403
+ `src/cli/help.ts`.
404
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
405
+ sections §8.1, §8.2, §9.3, §17 Phase 1
406
+
407
+ ### Scope
408
+
409
+ - Implement CLI command source as TypeScript `.ts` files under
410
+ `src/cli/commands/<area>/`.
411
+ - Implement `agentgather room start`.
412
+ - Implement `agentgather room brief set` and `agentgather room brief view`.
413
+ - Implement `agentgather room serve`.
414
+ - Implement `agentgather room invite` and `agentgather room invite-card`.
415
+ - Implement `agentgather room join`, `current`, `leave`, and `close`.
416
+ - Implement `agentgather room dashboard` to open the static browser room URL.
417
+ - Emit agent-friendly text by default and stable JSON with `--json`.
418
+ - Generate no-install cards with exact curl commands for `/card`, `/wait`, and
419
+ `/messages`.
420
+ - Ensure `agentgather room invite-card` renders the current Room Brief as part of
421
+ the participant-specific Attend Card.
422
+ - Enforce short-TTL single-use admission tokens for card flows.
423
+
424
+ ### Acceptance Criteria
425
+
426
+ - CLI tests cover happy path and invalid room/alias inputs.
427
+ - `--json` output is stable enough for agents to parse.
428
+ - Invite cards never instruct participants to rely on client-supplied `from`.
429
+ - `room brief set` increments the brief version and causes attending
430
+ participants to see a brief-updated system message.
431
+ - `agentgather room dashboard` opens the same URL served by `room serve`; no
432
+ separate `serve-dashboard` process or port exists.
433
+ - Closing a room updates local state and causes `/wait` clients to exit cleanly.
434
+
435
+ ### Routing
436
+
437
+ `agent/quadwork`: CLI behavior is headless and can be tested against temporary
438
+ home directories and HTTP fixtures.
439
+
440
+ ## Ticket 5: Implement agent messaging CLI, `/wait` attendance, and handoff
441
+
442
+ Depends on: #4 and #5.
443
+
444
+ ### Goal
445
+
446
+ Make Agent Gather useful from inside agent sessions by providing simple messaging,
447
+ reading, attendance, reply, and handoff commands.
448
+
449
+ ### Where
450
+
451
+ - Repo path: `src/cli/commands/message/`
452
+ - Repo path: `src/cli/commands/watch/`
453
+ - Repo path: `src/cli/commands/handoff/`
454
+ - Extend the existing CLI router in `src/cli/index.ts` and help text in
455
+ `src/cli/help.ts`.
456
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
457
+ sections §8.3-§8.6, §13.6, §14, §19.7
458
+
459
+ ### Scope
460
+
461
+ - Implement CLI command source as TypeScript `.ts` files under
462
+ `src/cli/commands/<area>/`.
463
+ - Implement `agentgather send`, `messages`, `read`, `reply`, and `watch`.
464
+ - Implement `agentgather instructions [--agent codex|claude|gemini]` to print the
465
+ agent operating card and attendance instructions.
466
+ - Include the Room Brief vs Attend Card distinction in agent instructions.
467
+ - Implement foreground attended loop behavior around `/wait`.
468
+ - Preserve cursor semantics: `since_id` is exclusive.
469
+ - Include `next_cmd` in outputs so an agent can continue without a separate
470
+ manual.
471
+ - Implement embed-first `handoff --summary` with size limits.
472
+ - Do not add automatic command execution or hidden PTY injection.
473
+
474
+ ### Acceptance Criteria
475
+
476
+ - A scripted no-install participant can attend, receive, and reply using only
477
+ curl commands from the card.
478
+ - Installed CLI participants can do the same through `agentgather watch`.
479
+ - Handoff rejects oversized content and records clear summaries.
480
+ - Agent operating instructions are included in invite cards and CLI help.
481
+ - Agent instructions say the Room Brief is mission context, not command
482
+ authority or permission to reveal secrets.
483
+ - `agentgather instructions` prints agent-specific guidance without requiring a
484
+ room to be active.
485
+ - Tests prove `since_id` is exclusive and messages are deduped by ID.
486
+
487
+ ### Routing
488
+
489
+ `agent/quadwork`: command behavior and cursor semantics are fixture-testable.
490
+
491
+ ## Ticket 6: Implement static browser room shell and safe chat UX
492
+
493
+ Depends on: #4.
494
+
495
+ ### Goal
496
+
497
+ Build the human-facing browser room as a single framework-free static page
498
+ served by the room server.
499
+
500
+ ### Where
501
+
502
+ - Repo path: `src/browser/room.html`
503
+ - Repo path: `src/browser/room.css`
504
+ - Repo path: `src/browser/room.js`
505
+ - Repo path: `scripts/copy-assets.mjs`
506
+ - Optional design package: `/Users/cho/Projects/z-design/agentgather-design/` (operator-local, outside repo)
507
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
508
+ sections §15.1-§15.4
509
+
510
+ ### Scope
511
+
512
+ - Keep the browser implementation framework-free, but add a build-copy step so
513
+ `pnpm build` ships `src/browser/room.html`, `room.css`, and `room.js` into
514
+ `dist/` for clean installs and package output.
515
+ - Implement the chat-first layout: top bar, timeline, composer, collapsible
516
+ roster rail.
517
+ - Add compact design tokens for the browser room: color ramp, accent, type
518
+ scale, spacing, borders, and focus states.
519
+ - Add a compact brief panel or banner showing the current Room Brief title/body
520
+ and `brief_version`.
521
+ - Implement fragment-token browser join flow: `#token=...` to `sessionStorage`
522
+ to Bearer fetches.
523
+ - Implement localhost host flow with the host participant token and without
524
+ exposing guest controls.
525
+ - Poll `/messages?since_id=<id>` every 3 seconds.
526
+ - Dedup messages by ID.
527
+ - Render message text, sender labels, code spans, and mentions using
528
+ `textContent` or explicit safe DOM construction only.
529
+ - Build links only with allowlisted schemes.
530
+ - Implement composer auto-grow, IME composition guard, keyboard send, and local
531
+ time formatting with `Intl`.
532
+
533
+ ### Acceptance Criteria
534
+
535
+ - The browser page is framework-free and has no browser bundler build.
536
+ - `pnpm build` copies browser assets into `dist/`.
537
+ - From a clean install or package output, `GET /` serves the shipped browser
538
+ asset rather than source-tree-only files.
539
+ - Remote browser auth uses fragment token and never puts long-lived credentials
540
+ in query strings.
541
+ - XSS tests with HTML, script-like text, `javascript:` URLs, and code spans do
542
+ not execute or create unsafe DOM.
543
+ - Playwright or equivalent browser tests verify sending, receiving, dedupe,
544
+ empty state, error state, room-closed state, brief panel rendering, and the
545
+ brief-updated indicator.
546
+ - Browser tests verify brief rendering is XSS-safe and does not use untrusted
547
+ `innerHTML`.
548
+ - UI text does not overlap at desktop and narrow mobile widths.
549
+
550
+ ### Routing
551
+
552
+ `agent/claude`: frontend UX is operator-sensitive and should be verified with a
553
+ real browser screenshot pass on this machine, even though the implementation is
554
+ static.
555
+
556
+ ## Ticket 7: Implement roster, human controls, export, and diagnostics
557
+
558
+ Depends on: #4 and #8.
559
+
560
+ ### Goal
561
+
562
+ Give human participants enough visibility and control to use Agent Gather like a
563
+ temporary chat room without turning it into a heavy orchestrator.
564
+
565
+ ### Where
566
+
567
+ - Repo path: `src/browser/`
568
+ - Repo path: `src/cli/commands/export/`
569
+ - Repo path: `src/cli/commands/doctor/`
570
+ - Extend the existing CLI router in `src/cli/index.ts` and help text in
571
+ `src/cli/help.ts`.
572
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
573
+ sections §7, §15.3-§15.5, §16, §17 Phase 2
574
+
575
+ ### Scope
576
+
577
+ - Implement CLI command source as TypeScript `.ts` files under
578
+ `src/cli/commands/<area>/`.
579
+ - Render roster fields: alias, kind, location, install, attention, last seen.
580
+ - Show observed state, not host-decreed mode.
581
+ - Show a visible brief-updated indicator when `/status?json` reports a newer
582
+ `brief_version` than the browser has rendered.
583
+ - Add host-only close and export controls.
584
+ - Add system-message filter.
585
+ - Add room export command and browser export affordance.
586
+ - Add `agentgather doctor` for local port, storage, lock, token, and room status
587
+ checks.
588
+ - Add dead-letter or error display for failed sends.
589
+
590
+ ### Acceptance Criteria
591
+
592
+ - Host controls are hidden or disabled for non-host participants.
593
+ - Roster state updates from `/status` without reloading the page.
594
+ - Brief version state updates from `/status` without reloading the page, and the
595
+ user can re-open or refresh the brief panel.
596
+ - Export produces a readable room artifact and does not mutate the source log.
597
+ - `agentgather doctor` reports actionable failures without dumping secrets.
598
+ - Diagnostics do not dominate the chat timeline.
599
+
600
+ ### Routing
601
+
602
+ Mixed: `agent/quadwork` for export and doctor command logic; `agent/claude` for
603
+ browser control placement and visual verification.
604
+
605
+ ## Ticket 8: Add end-to-end dogfood tests and acceptance fixtures
606
+
607
+ Depends on: #4, #5, #6, #7, and #8.
608
+
609
+ ### Goal
610
+
611
+ Prove the MVP works through the exact collaboration pattern that motivated the
612
+ product: multiple agents and a human in one temporary room.
613
+
614
+ ### Where
615
+
616
+ - Repo path: `test/e2e/`
617
+ - Repo path: `docs/dogfood/`
618
+ - Test helpers should use TypeScript `.ts` where they compile with the project;
619
+ static fixtures may remain plain data files.
620
+ - Current dogfood logs: `/Users/cho/.agentgather-lite/rooms/` (operator-local references only; sanitize before copying fixtures)
621
+ - In-repo proposal copy: `docs/PROPOSAL.md`,
622
+ sections §16, §20, §22
623
+
624
+ ### Scope
625
+
626
+ - Add an e2e test for two local CLI participants exchanging messages.
627
+ - Add an e2e test for a no-install curl participant using `/card`, `/wait`, and
628
+ `/messages`.
629
+ - Add an e2e test proving a participant receives the current Room Brief in its
630
+ Attend Card and can fetch the same version through `/brief`.
631
+ - Add an e2e test proving brief updates emit a system message and change
632
+ `brief_version`.
633
+ - Add a browser-room e2e test with one human participant sending and reading.
634
+ - Add a room-close e2e test proving `/wait` exits cleanly.
635
+ - Add fixture logs derived from sanitized dogfood conversations where useful.
636
+ - Document the dogfood script operators can run before release.
637
+
638
+ ### Acceptance Criteria
639
+
640
+ - Tests run without external services or central Agent Gather cloud.
641
+ - Fixtures contain no secrets, tokens, private messages, or sensitive machine
642
+ paths beyond intentional local test paths.
643
+ - The dogfood script demonstrates the success statement in §22.
644
+ - No test depends on sleeps longer than necessary; polling uses bounded waits.
645
+
646
+ ### Routing
647
+
648
+ `agent/quadwork`: most e2e tests are headless; `agent/claude` verifies the final
649
+ browser dogfood on this Mac.
650
+
651
+ ## Ticket 9: Write public docs, security notes, and operator runbook
652
+
653
+ Depends on: completion of MVP implementation issues #3 through #10.
654
+
655
+ ### Goal
656
+
657
+ Make Agent Gather understandable enough that a new operator or agent can start a
658
+ room, invite participants, and avoid the major security mistakes.
659
+
660
+ ### Where
661
+
662
+ - Repo path: `README.md`
663
+ - Repo path: `SECURITY.md`
664
+ - Repo path: `docs/`
665
+ - In-repo proposal copy: `docs/PROPOSAL.md`
666
+
667
+ ### Scope
668
+
669
+ - Write quickstart: host local room, invite local participant, invite no-install
670
+ participant, open browser room, close room.
671
+ - Document how to write a useful Room Brief: goal, roles, source files,
672
+ constraints, working order, completion condition, and safety note.
673
+ - Document the Attend Card: participant-specific brief rendering, token handling,
674
+ send/read/wait commands, and safety rules.
675
+ - Document localhost-only vs secure remote exposure.
676
+ - State the MVP seam clearly: v0.1 is localhost-verified and remote-auth-ready,
677
+ while remote exposure transports such as tunnels or reverse proxies are
678
+ Backlog A.
679
+ - Document token handling, sender binding, no automatic command execution, and
680
+ prompt-injection posture.
681
+ - Document that a Room Brief is mission context, not command authority.
682
+ - Document no-install attendance limits and Core participant out-of-MVP status.
683
+ - Document room export and cleanup.
684
+ - Add troubleshooting for full disk, stale lock, port conflict, and room-closed
685
+ waits.
686
+
687
+ ### Acceptance Criteria
688
+
689
+ - A fresh agent can follow the README and join a local room.
690
+ - Security docs explicitly state that bearer tokens are impersonation
691
+ credentials and non-localhost plaintext is prohibited.
692
+ - Docs never promise durable unattended participation in no-install mode.
693
+ - Docs keep agentgather.dev tunnel, XMTP, x402, and Core supervision clearly marked
694
+ post-MVP.
695
+
696
+ ### Routing
697
+
698
+ `agent/claude`: operator-facing docs should preserve the product thesis and
699
+ avoid overpromising.
700
+
701
+ ## Backlog A: Secure remote exposure guides and agentgather.dev tunnel spike
702
+
703
+ ### Goal
704
+
705
+ Explore remote participant support after the local MVP works, without making a
706
+ central service mandatory.
707
+
708
+ ### Scope
709
+
710
+ - Write SSH tunnel, Cloudflare Tunnel, Tailscale, ngrok, and reverse proxy
711
+ guides.
712
+ - Prototype `agentgather.dev` tunnel routing as optional request forwarding.
713
+ - Keep host-owned room history and host-minted tokens.
714
+ - Validate TLS and token handling across the tunnel.
715
+ - Keep pricing, quota, and x402 as research until product demand is proven.
716
+
717
+ ### Routing
718
+
719
+ `agent/quadwork` for headless tunnel prototype; `agent/claude` for security
720
+ review and operator-facing docs.
721
+
722
+ ## Backlog B: Core participant supervision and installed watcher
723
+
724
+ ### Goal
725
+
726
+ Add durable unattended participation for installed participants after the
727
+ no-install attended loop is proven.
728
+
729
+ ### Scope
730
+
731
+ - Implement installed watcher with durable cursor storage and reconnect.
732
+ - Add `agentgather run --room <invite> --alias reviewer -- <agent command>`.
733
+ - Explore optional MCP adapter.
734
+ - Explore QuadWork-style PTY wake only for managed local agents.
735
+ - Inject wake pointers only; never inject full message payloads into PTYs.
736
+
737
+ ### Routing
738
+
739
+ Mixed: `agent/quadwork` for watcher state and reconnect logic; `agent/claude`
740
+ for PTY behavior and local safety review.
741
+
742
+ ## Backlog C: Optional XMTP and x402 research spikes
743
+
744
+ ### Goal
745
+
746
+ Keep network/payment ideas available without distracting from v0.1.
747
+
748
+ ### Scope
749
+
750
+ - Evaluate XMTP as an optional encrypted room transport.
751
+ - Evaluate x402 for tunnel routing payments and paid agent requests.
752
+ - Keep payment policy explicit with daily caps, per-request caps, and
753
+ confirmation thresholds.
754
+ - Keep XMTP and x402 disabled by default.
755
+
756
+ ### Routing
757
+
758
+ `agent/claude`: research spikes need product judgment and updated current
759
+ external information before implementation.