The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Notices Clear On Read And Answer Implementation Plan
How this plan runs: by this project's instructions: one Engineer implements it task by task, test first (each failing test committed before its code), and the review step on the pull request is the one independent review. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: A Swarm tag or an agent's open question stops being a notification once its person reads it or answers the agent, wherever they do it.
Architecture: The server resolves tags on two new events (a read mark passing the tag; a post that answers the tag's agent), so every client agrees. Desktop's menu bar applies Activity's read rule locally, and the open thread marks nothing read while hidden. The CLI host closes a Claude Code question with Escape when a person's Swarm message for that agent arrives, so the message is delivered as the answer.
Tech Stack: TypeScript + Prisma/Mongo (backend), Dart/Flutter (Desktop), TypeScript (CLI daemon); vitest, flutter test.
Spec: docs/specs/2026-11-03-notices-clear-on-answer.md
Global Constraints
resolvedByvalues:'read'for a read mark,'answer'for a post to the tag's agent. Existing'reply','done','worker'unchanged.- Only the acting person's own tags (
personId = user.sub); a Team session is refused before any write, as today. - Escape is pressed only for engine
claude, only onmessageHold === 'question_open', only for a delivery from a person; never onpermission_open. - Read rule (the same as
activity.dart mentionUnread): a tag on a message shown in the chat goes by the chat mark; a tag on a reply shown only in its thread (threadsOfgives it a thread) goes by that thread's mark. - No phone or web change. No firmware change.
- Base:
origin/mainb8a64b53e or later, worktree.claude/worktrees/noticlear, branchfeat/noti-clear-on-answer.
Review Focus
- A tag in a thread reply that was also sent to the chat (
alsoInChat) resolves by the chat mark, not only the thread mark: Task 1 test "a reply also sent to the chat clears by the chat mark". - A post in a project chat that
@-addresses a worker does not clear the PM's tags unless the PM is also a recipient: Task 2 test "a post addressed to another agent leaves the PM's tags". - A person's own Buddy chat clears tags only from coordinators of projects they can read: Task 2 test "the Swarm Buddy chat clears coordinators of readable projects only".
- A question still on screen after Escape (a second dialog, an engine that ignores it) is withheld as today, never typed into: Task 5 test "still holds when the question stays after Escape".
- The thread pane becoming visible again marks the replies that came while it was hidden, once: Task 4 test "marks the hidden replies when the pane shows again".
Task 1: Reading past a tag resolves it (backend)
Files:
- Modify:
backend/src/superTabs/mentions.ts(addresolveRead; reuse the privatethreadsOf, :313) - Modify:
backend/src/superTabs/read/service.ts:232-252(markRead,markThreadRead) - Create:
backend/integration/superTabTagsClear.test.ts(fixture as inintegration/superTabReadMarks.test.ts) - Modify:
backend/vitest.super-tabs.config.ts(include the new file)
Interfaces:
Produces:
resolveRead(db: Prisma.TransactionClient | PrismaClient, input: { tabId: string; personId: string; conversationId: string; threadId: string | null; sequence: number; now: number }): Promise<number>— the count it resolved.Step 1: Write the failing tests in
superTabTagsClear.test.ts,describe('reading clears tags'):- "reading the chat past a tag resolves it as read": an agent's chat message tags the peer at sequence n; the peer's
POST …/conversations/:id/readwith n. Expect the peer'smentions?open=trueread to lack it, its rowresolvedBy === 'read', andmentionsWaiting0. - "a mark before the tag leaves it waiting": mark n-1 → still listed.
- "a chat mark does not clear a tag in a thread reply; its thread mark does": tag in a reply (not
alsoInChat) to a root; chat mark past it → listed;POST …/threads/:root/readpast it → resolved'read'. - "a reply also sent to the chat clears by the chat mark".
- "another person's read leaves my tag": the owner reads the chat past it → the peer's tag still listed.
- "reading the chat past a tag resolves it as read": an agent's chat message tags the peer at sequence n; the peer's
Step 2: Run
cd backend && npm run test:super-tabs -- integration/superTabTagsClear.test.ts— Expected: FAIL (tags stay listed).Step 3: Implement
resolveRead: read the person's waiting rows in that conversation (tagRows-style indexed filter plusconversationId), stop if none; read their messages (id, sequence, thread, alsoInChat, conversationId);threadsOfgives each reply's thread; resolve (updateManywithwaiting,resolvedAt: now,resolvedBy: 'read') the rows whose message sequence ≤sequenceand whose thread equalsthreadId(null meaning: no thread fromthreadsOf). Call it inmarkReadwith the stored chat sequence andthreadId: null, and inmarkThreadReadwith the stored thread sequence andthreadId.Step 4: Run the same command — Expected: PASS. Then
cd backend && npx vitest run src/superTabs/mentions.test.ts src/superTabs/read— Expected: PASS.Step 5: Commit
feat(swarm): reading past a tag resolves it.
Task 2: A post that answers an agent resolves that agent's tags (backend)
Files:
- Modify:
backend/src/superTabs/mentions.ts(addansweredAgents,resolveByAnswer) - Modify:
backend/src/superTabs/store.ts:1765(call afterresolveByReply) - Test:
backend/src/superTabs/mentions.test.ts(pure),backend/integration/superTabTagsClear.test.ts(stored)
Interfaces:
Produces:
answeredAgents(state: SuperTabState, actor: Extract<Actor, { kind: 'person' }>, group: Conversation, recipients: readonly string[]): string[]— the recipients that are agents instate.agents; plus, whengroupis the actor's own Buddy chat, the coordinator (leadIdof the project's lead conversation) of each project the Buddy speaks for: every project the actor can read (canReadProject) for the Swarm Buddy chat (isSwarmBuddyChat), the chat's own project for a project Buddy chat. Deduplicated.Produces:
resolveByAnswer(tx: Tx, tabId: string, personId: string, agentIds: readonly string[], now: number): Promise<void>—updateManyof the person's waiting tags withauthorAgentIdinagentIdsandcreatedAt ≤ now,resolvedBy: 'answer'; no-op for an empty list.Step 1: Write the failing tests.
mentions.test.tsdescribe('answeredAgents'): "a plain post in a project chat answers its coordinator" (recipients fromapplyCommandmessage.send's draft); "a post addressed to another agent leaves the PM's tags" (recipientIds: [worker]→[worker]only); "the Swarm Buddy chat clears coordinators of readable projects only" (a private project the peer cannot read is left out); "a project Buddy chat answers its Buddy and that project's coordinator".superTabTagsClear.test.tsdescribe('answering clears tags'): "posting in my Buddy chat clears the PM's tag in a task chat" (PM tags the peer in a task conversation; the peer posts in their Buddy chat → tag resolved'answer'); "a tag by another agent stays".
Step 2: Run
cd backend && npx vitest run src/superTabs/mentions.test.tsand the integration command from Task 1 — Expected: FAIL (answeredAgentsnot exported; tag still listed).Step 3: Implement both functions; in
store.tsafterresolveByReply, formessage.sendby a person: find the posted draft ineffects.messages(id === effects.result.messageId), and callresolveByAnswer(tx, tabId, actor.userId, answeredAgents(effects.state, actor, group, draft.recipients), context.now).Step 4: Run both commands — Expected: PASS. Then
cd backend && npm run test:super-tabs— Expected: PASS.Step 5: Commit
feat(swarm): a post that answers an agent clears its tags.
Task 3: The menu bar lists only tags not read past (Desktop)
Files:
- Modify:
desktop/lib/state/status_menu.dart:252-264(statusMenuSwarmEntries) - Test:
desktop/test/super_tab_menu_bar_notices_test.dart
Interfaces:
Consumes:
SuperTabActivity.of(controller).mentionUnread(SuperTabMention)(activity.dart:174).Step 1: Write the failing test "a tag read past leaves the menu bar's Swarm rows": a controller with a waiting tag at sequence 5 and chat read mark 5 →
statusMenuSwarmEntries(app)has nomentionrow; mark 4 → it has one.Step 2: Run
cd desktop && flutter test test/super_tab_menu_bar_notices_test.dart— Expected: FAIL.Step 3: Implement: skip a waiting tag when
!SuperTabActivity.of(controller).mentionUnread(m).Step 4: Run the same command and
flutter test test/status_menu_test.dart— Expected: PASS.Step 5: Commit
fix(desktop): the menu bar drops a tag once it is read.
Task 4: A hidden thread pane marks nothing read (Desktop, #15)
Dropped: main fixed this in #2711 (
threadPaneHidden) while this branch was open.
Files:
- Modify:
desktop/lib/super_tabs/controller.dart:862-877, 1436-1445(threadPaneVisible,_seeThread) - Modify:
desktop/lib/super_tabs/view.dart:266-277, 777(set and clear the callback) - Test:
desktop/test/super_tab_thread_tags_test.dart
Interfaces:
Produces:
bool Function()? threadPaneVisibleonSuperTabController; null (no view) counts as visible, as today.Step 1: Write the failing tests: "a reply to the open thread is not marked read while the pane is hidden" (open a thread,
threadPaneShown(), setthreadPaneVisible = () => false, a poll page brings a reply with itsthreadssummary → noPOST …/threads/<root>/read); "marks the hidden replies when the pane shows again" (then visible andthreadPaneShown()→ exactly one mark at the reply's sequence).Step 2: Run
cd desktop && flutter test test/super_tab_thread_tags_test.dart— Expected: FAIL (a mark is posted while hidden).Step 3: Implement: at the top of
_seeThread, ifthreadPaneVisible?.call() == false, set_threadUnshown = trueand return; the view setsc.threadPaneVisible = () => _viewIsVisibleininitState(besidechatShown) and clears it indispose. The existingthreadPaneShown()call in_readVisibleTailAfterFrame(view.dart:513-517) catches up when it shows.Step 4: Run the same command and
flutter test test/super_tab_controller_test.dart test/super_tab_threads_test.dart— Expected: PASS.Step 5: Commit
fix(desktop): a thread hidden behind another app marks nothing read.
Task 5: A person's Swarm message closes the question it answers (CLI)
Files:
- Modify:
cli/src/core/api.ts:237(deliveroptions),cli/src/services/turnsLink.ts:44-45(send them),cli/src/core/deliveries.ts(answer('deliver')keeps them;answersQuestion),cli/src/core/main.ts:1373(wire into input deps),cli/src/core/input.ts:69, 165-171(answersQuestiondep;beforeTeamWrite),cli/src/superTabs/host.ts:1919(pass it for a person's message) - Test:
cli/src/core/input.spec.ts,cli/src/core/deliveries.spec.ts,cli/src/services/turnsLink.spec.ts,cli/src/superTabs/host.spec.ts
Interfaces:
Produces:
export interface DeliveryOptions { answersQuestion?: true }incore/api.ts;deliver(agentId: string, text: string, deliveryId: string, options?: DeliveryOptions): void.Produces:
answersQuestion(deliveryId: string): booleanfromcore/deliveries.ts(true while that delivery is unsettled and was sent with the option);InputDeps.answersQuestion?: (deliveryId: string) => boolean.Step 1: Write the failing tests.
input.spec.ts: "a person's Swarm message closes a Claude question and is delivered" (screenmessageHold: 'question_open',answersQuestiontrue, engineclaude; after oneEscapekey the next read has no hold →beforeTeamWritereturns null andsendKeysawEscapeonce); "never presses Escape on a permission prompt" (permission_open→team_waiting_user, no key); "an agent's message still waits" (answersQuestionfalse → hold, no key); "another engine still waits" (codex); "still holds when the question stays after Escape" (second read stillquestion_open→team_waiting_user, one key only).deliveries.spec.ts: "remembers a delivery that answers a question until it settles".turnsLink.spec.ts: "sends answersQuestion with the delivery".host.spec.ts: "a person's message is delivered as answering a question, an agent's is not".
Step 2: Run
cd cli && npx vitest run src/core/input.spec.ts src/core/deliveries.spec.ts src/services/turnsLink.spec.ts src/superTabs/host.spec.ts— Expected: FAIL.Step 3: Implement: the host passes
{ answersQuestion: true }whenobject(message.author).kind === 'person'and the turn is not Buddy news,agent-onlyornative;turnsLinkadds it to thedeliverquery;core/deliveries.tskeeps the ids in a Set dropped insettled; inbeforeTeamWrite, when the reading'smessageHold === 'question_open',session.engine === 'claude'anddeps.answersQuestion?.(deliveryId), pressEscapethroughdeviceInput().legacyWrite(… keyTerminalAction(id, 'Escape')), log[inject] <sid> question closed for a person's message, capture and read again, and returndeliveryHoldof the new reading.Step 4: Run the same command — Expected: PASS. Then
cd cli && npm run test:core && npm run test:harnessd— Expected: PASS.Step 5: Commit
feat(cli): a person's Swarm message closes the question it answers.
Task 6: Pull request
- Push
feat/noti-clear-on-answer, open a PR tomainwith the spec link, what each task changes, and the tests run (backend super-tabs suite, Desktop files above on macOS, CLItest:coreandtest:harnessd). Mark it ready soci/requiredruns. - Send the PR to Diego's Buddy for the PM to merge (
buddy_post.py, English): "Please merge PR #N with make merge-pr once ci/required is green; fix any conflict with main and merge. Name diego as the requester."