M29: team answers (approvals, questions and follow-ups from anyone on the team) #46

Closed
opened 2026-10-02 05:36:27 +00:00 by jhgaylor · 3 comments
Owner

Depends on: #45, #38 (its MVP cut)
Blocks: #40
Part of: #44

Swarm MVP. When any agent on any of the team's machines asks something, anyone on the team who may answer can: from the rail, the pane or their phone. They can also send the agent its next instruction. Everyone sees who did it.


  • Who may answer: whoever has editor on the pane's session (M12): the owner, people it was shared with as editors, and team editors on team daemons (Acl::set_team_roles). Viewers see the card, its question and who answered, but get no buttons.
  • Every answer has an author:
    • approve, answer and decline record the principal from the request, in the block's log, the transcript, history, search and the audit log;
    • cards and the pane say "Allowed by Sam, 14:02";
    • the first answer wins, and every other client's card closes with who answered.
  • Claude Code's permission prompts in terminal panes become approval cards, with the hook S18 picked, installed by the same illogical hooks set as M6c's.
    • The card shows the tool, its input (command, file and diff) and Claude's suggested options: allow once, allow always for this tool, or deny with a message.
    • Answering in the terminal still works, and closes the card.
  • Follow-ups: after answering, a "Send a follow-up" box sits on the card.
    • Agent blocks: the block's prompt method, attributed.
    • Claude Code in a terminal: S18's method (a queued message if there is one; otherwise typed when the agent is idle), recorded as input from that person (M13's attribution).
    • Who may send one: whoever may drive the pane. On a team daemon or a VM, team editors may. On someone's own machine, a teammate needs an M14 trust grant; the box offers "Ask Jake for 30 minutes" instead, using the existing flow.
  • Who's looking: a card shows the avatars of teammates who have it open (M13 presence, as metadata), so two people don't answer differently. First answer still wins.
  • Push to the team:
    • needs-input goes to every editor of the session who opted in. That already holds through control (M21); do the same for the daemon's own push and for M14's trust requests.
    • Opting in is per person and per session or team ("Notify me about this team's agents").
  • Answering from the notification (if S18 says go): one single-select question or an approval answers from the notification's buttons, through control, over a channel the service worker opens. Otherwise the notification opens straight to the card, not just the pane.
  • Done when:
    • Jake's Claude Code (a terminal pane on jake-mini) asks to run cargo test; Sam, a team editor on another network, allows it from the phone;
    • Jake's screen shows "Allowed by Sam";
    • Sam's follow-up "then open a PR" needs Jake's trust grant on jake-mini, and goes straight through on the team daemon;
    • illogical log %N --who and history show both, attributed to Sam;
    • a viewer sees the card but can't answer it, and gets a 403 from the API.
**Depends on:** #45, #38 (its MVP cut) **Blocks:** #40 **Part of:** #44 *Swarm MVP. When any agent on any of the team's machines asks something, anyone on the team who may answer can: from the rail, the pane or their phone. They can also send the agent its next instruction. Everyone sees who did it.* -------- - **Who may answer:** whoever has `editor` on the pane's session (M12): the owner, people it was shared with as editors, and team editors on team daemons (`Acl::set_team_roles`). Viewers see the card, its question and who answered, but get no buttons. - **Every answer has an author:** - `approve`, `answer` and `decline` record the principal from the request, in the block's log, the transcript, `history`, `search` and the audit log; - cards and the pane say "Allowed by Sam, 14:02"; - the first answer wins, and every other client's card closes with who answered. - **Claude Code's permission prompts in terminal panes** become approval cards, with the hook S18 picked, installed by the same `illogical` hooks set as M6c's. - The card shows the tool, its input (command, file and diff) and Claude's suggested options: allow once, allow always for this tool, or deny with a message. - Answering in the terminal still works, and closes the card. - **Follow-ups:** after answering, a "Send a follow-up" box sits on the card. - **Agent blocks:** the block's `prompt` method, attributed. - **Claude Code in a terminal:** S18's method (a queued message if there is one; otherwise typed when the agent is idle), recorded as input from that person (M13's attribution). - **Who may send one:** whoever may drive the pane. On a team daemon or a VM, team editors may. On someone's own machine, a teammate needs an M14 trust grant; the box offers "Ask Jake for 30 minutes" instead, using the existing flow. - **Who's looking:** a card shows the avatars of teammates who have it open (M13 presence, as metadata), so two people don't answer differently. First answer still wins. - **Push to the team:** - `needs-input` goes to every editor of the session who opted in. That already holds through control (M21); do the same for the daemon's own push and for M14's trust requests. - Opting in is per person and per session or team ("Notify me about this team's agents"). - **Answering from the notification** (if S18 says go): one single-select question or an approval answers from the notification's buttons, through control, over a channel the service worker opens. Otherwise the notification opens straight to the card, not just the pane. - **Done when:** - Jake's Claude Code (a terminal pane on jake-mini) asks to run `cargo test`; Sam, a team editor on another network, allows it from the phone; - Jake's screen shows "Allowed by Sam"; - Sam's follow-up "then open a PR" needs Jake's trust grant on jake-mini, and goes straight through on the team daemon; - `illogical log %N --who` and `history` show both, attributed to Sam; - a viewer sees the card but can't answer it, and gets a 403 from the API.
Author
Owner

From S18:

  • Hook: use PermissionRequest for tool permission prompts, and leave AskUserQuestion to M6c's hook. PermissionRequest has no tool_use_id, so match each card to the PreToolUse just before it.
  • Closing cards: a "Yes" typed in the terminal never reaches the hook, and its later answer is silently dropped; only "No" and Esc send it SIGTERM. Close cards on PostToolUse or PostToolUseFailure, on the session's next PreToolUse, Stop or UserPromptSubmit, or on SIGTERM.
  • Allow always: offer Claude's own permission_suggestions, which are often the exact command.
  • Follow-ups: deliver them through an asyncRewake Stop hook (plus one on SessionStart) that exits 2 with the text. Drop the "typed when idle" fallback: typing merged with the driver's draft. Who may send one is still the drive-rights rule.
  • Notification answers: go on desktop (about 20 ms in the service worker). This needs the directory and pins in IndexedDB, approve and ask data in pushes through control, and sw.js as a bundled entry. iOS probably opens the card instead, pending a real phone.
From S18: - **Hook:** use PermissionRequest for tool permission prompts, and leave AskUserQuestion to M6c's hook. PermissionRequest has no tool_use_id, so match each card to the PreToolUse just before it. - **Closing cards:** a "Yes" typed in the terminal never reaches the hook, and its later answer is silently dropped; only "No" and Esc send it SIGTERM. Close cards on PostToolUse or PostToolUseFailure, on the session's next PreToolUse, Stop or UserPromptSubmit, or on SIGTERM. - **Allow always:** offer Claude's own permission_suggestions, which are often the exact command. - **Follow-ups:** deliver them through an asyncRewake Stop hook (plus one on SessionStart) that exits 2 with the text. Drop the "typed when idle" fallback: typing merged with the driver's draft. Who may send one is still the drive-rights rule. - **Notification answers:** go on desktop (about 20 ms in the service worker). This needs the directory and pins in IndexedDB, approve and ask data in pushes through control, and sw.js as a bundled entry. iOS probably opens the card instead, pending a real phone.
Author
Owner

Done 2026-10-02, apart from real phones. Merged in a35f4a6.

What landed:

  • Every answer has an author. Approvals, answers and skips record who made the request, whether they came from a card, call, /api/attention/act or a notification. It shows in:

    • the agent block's transcript;
    • the pane's history (illogical history, illogical log %N --who);
    • the audit log.

    Every client's card closes saying "Allowed by Sam, 14:02", and the first answer wins.

  • Permission prompts in terminals. Claude Code's tool permission prompts become approval cards through illogical hook on the PermissionRequest hook. Each card is matched to the PreToolUse just before it. It shows the tool and its input (command, file, diff), with Claude's own suggestions: Allow, Always (keeps that rule), Deny, and Deny with a message. AskUserQuestion stays with illogical ask.

  • Cards close when the terminal answers first: on PostToolUse or PostToolUseFailure, on the session's next PreToolUse, Stop, UserPromptSubmit or SessionStart, or on SIGTERM after "No" or Esc.

  • Follow-ups. After an answer, the card offers "Send a follow-up" (POST /api/panes/N/followup).

    • Agent blocks get it as their next prompt, attributed.
    • Claude Code in a terminal gets it through illogical inbox, a background (asyncRewake) hook on Stop and SessionStart. There's one waiter per pane, and follow-ups queue until one is waiting. Nothing is typed into the prompt, and the follow-up is recorded as the sender's input.
    • Drive rights apply. On someone's own machine, the box offers "Ask for 30 minutes".
  • Who's looking: the card shows the avatars of teammates who have the pane open.

  • Push to the team. needs-input goes to the owner and to editors who opted in, per session or for everything they may edit (/api/notify). This covers the daemon's own push, whose subscriptions now belong to a person, and pushes through control.

  • Answering from a notification.

    • Pushes carry what to approve.
    • sw.js is now built from src/sw.ts.
    • The control page copies its checked directory into IndexedDB, and the service worker answers over its own end-to-end channel with the device key.
    • A tap opens the pane with its card.
  • Viewers see the card and who answered, with no buttons, and the API returns 403.

Tests:

  • crates/daemon/tests/team_answers.rs, on S18's fixtures.
  • web/e2e/team-answers.spec.ts for the done-when: Jake's machine and a team box, both reached through control's relay, and Sam in a phone-sized context. It covers the viewer's 403 and an Allow from the service worker.
  • agents_real.rs team, opt-in, with real Claude Code on haiku: a tool allowed from the card ran, and a follow-up through the inbox woke the idle agent.

Not covered:

  • Real phones: iOS notification actions, and a service worker's WebSocket there.
  • The two people really on different networks: loopback stands in.
  • The follow-up box learns it needs trust from a 403, because the client can't tell a team daemon from someone's own machine in advance.

Changes from before: notifying editors through control is now opt-in, where M21 sent to every editor.

**Done 2026-10-02, apart from real phones.** Merged in a35f4a6. **What landed:** - **Every answer has an author.** Approvals, answers and skips record who made the request, whether they came from a card, `call`, `/api/attention/act` or a notification. It shows in: - the agent block's transcript; - the pane's history (`illogical history`, `illogical log %N --who`); - the audit log. Every client's card closes saying "Allowed by Sam, 14:02", and the first answer wins. - **Permission prompts in terminals.** Claude Code's tool permission prompts become approval cards through `illogical hook` on the `PermissionRequest` hook. Each card is matched to the `PreToolUse` just before it. It shows the tool and its input (command, file, diff), with Claude's own suggestions: Allow, Always (keeps that rule), Deny, and Deny with a message. AskUserQuestion stays with `illogical ask`. - **Cards close when the terminal answers first:** on `PostToolUse` or `PostToolUseFailure`, on the session's next `PreToolUse`, `Stop`, `UserPromptSubmit` or `SessionStart`, or on SIGTERM after "No" or Esc. - **Follow-ups.** After an answer, the card offers "Send a follow-up" (`POST /api/panes/N/followup`). - Agent blocks get it as their next prompt, attributed. - Claude Code in a terminal gets it through `illogical inbox`, a background (`asyncRewake`) hook on Stop and SessionStart. There's one waiter per pane, and follow-ups queue until one is waiting. Nothing is typed into the prompt, and the follow-up is recorded as the sender's input. - Drive rights apply. On someone's own machine, the box offers "Ask <owner> for 30 minutes". - **Who's looking:** the card shows the avatars of teammates who have the pane open. - **Push to the team.** needs-input goes to the owner and to editors who opted in, per session or for everything they may edit (`/api/notify`). This covers the daemon's own push, whose subscriptions now belong to a person, and pushes through control. - **Answering from a notification.** - Pushes carry what to approve. - `sw.js` is now built from `src/sw.ts`. - The control page copies its checked directory into IndexedDB, and the service worker answers over its own end-to-end channel with the device key. - A tap opens the pane with its card. - **Viewers** see the card and who answered, with no buttons, and the API returns 403. **Tests:** - `crates/daemon/tests/team_answers.rs`, on S18's fixtures. - `web/e2e/team-answers.spec.ts` for the done-when: Jake's machine and a team box, both reached through control's relay, and Sam in a phone-sized context. It covers the viewer's 403 and an Allow from the service worker. - `agents_real.rs` `team`, opt-in, with real Claude Code on haiku: a tool allowed from the card ran, and a follow-up through the inbox woke the idle agent. **Not covered:** - Real phones: iOS notification actions, and a service worker's WebSocket there. - The two people really on different networks: loopback stands in. - The follow-up box learns it needs trust from a 403, because the client can't tell a team daemon from someone's own machine in advance. **Changes from before:** notifying editors through control is now opt-in, where M21 sent to every editor.
Author
Owner

Done: merged to main in a35f4a6 (Merge M29). Not yet checked on real phones.

Done: merged to main in a35f4a6 (Merge M29). Not yet checked on real phones.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#46
No description provided.