paseo-follow-up 2.5.0 → 2.6.0-beta.2

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 (87) hide show
  1. package/OVERVIEW.md +1 -1
  2. package/README.md +0 -1
  3. package/client/brief-since.tsx +4 -3
  4. package/client/catch-up.tsx +56 -15
  5. package/client/header.tsx +5 -3
  6. package/client/home-data.ts +3 -1
  7. package/client/home-list.tsx +19 -11
  8. package/client/home-view.ts +8 -1
  9. package/client/home.tsx +29 -10
  10. package/client/keys.ts +2 -0
  11. package/client/kit.tsx +5 -2
  12. package/client/large.tsx +5 -3
  13. package/client/live.tsx +4 -3
  14. package/client/merge-button.tsx +3 -2
  15. package/client/messages.tsx +5 -1
  16. package/client/more-context.tsx +17 -4
  17. package/client/morning-brief-settings.tsx +5 -4
  18. package/client/needs-you.tsx +5 -4
  19. package/client/new-settings.tsx +8 -7
  20. package/client/now-lines.tsx +60 -0
  21. package/client/onboarding.tsx +55 -123
  22. package/client/paged-list.tsx +115 -0
  23. package/client/panel.tsx +24 -8
  24. package/client/pr-stats-settings.tsx +3 -2
  25. package/client/pr-stats.tsx +10 -10
  26. package/client/questions.tsx +63 -40
  27. package/client/release-notes.tsx +10 -9
  28. package/client/reviewers.tsx +8 -3
  29. package/client/row-open.ts +28 -0
  30. package/client/section-search.tsx +5 -3
  31. package/client/settings.tsx +11 -8
  32. package/client/setup-dialog.tsx +168 -0
  33. package/client/setup-gate.tsx +69 -0
  34. package/client/setup-ui.ts +27 -0
  35. package/client/shipping.tsx +5 -4
  36. package/client/stacks.tsx +11 -3
  37. package/client/tasks.tsx +5 -1
  38. package/client/your-questions.tsx +375 -0
  39. package/index.client.tsx +11 -3
  40. package/index.server.ts +162 -32
  41. package/package.json +1 -1
  42. package/server/agent-actions.ts +23 -14
  43. package/server/agent-hook.mjs +7 -5
  44. package/server/agent-parity.ts +21 -6
  45. package/server/ai-jobs.ts +26 -5
  46. package/server/brief-timeline.ts +47 -0
  47. package/server/context-requests.ts +90 -21
  48. package/server/directory.ts +6 -0
  49. package/server/discovery.ts +2 -0
  50. package/server/engine.ts +3 -0
  51. package/server/hook-source.ts +7 -5
  52. package/server/inbox-classifier.ts +17 -0
  53. package/server/inbox.ts +9 -3
  54. package/server/job-agent.ts +13 -2
  55. package/server/mcp-source.ts +23 -15
  56. package/server/mcp.mjs +23 -15
  57. package/server/obligations.ts +4 -1
  58. package/server/session-prompt.ts +30 -3
  59. package/server/turn-end.ts +133 -0
  60. package/server/wait-jobs.ts +18 -2
  61. package/server/wait.ts +17 -12
  62. package/shared/activity.ts +2 -1
  63. package/shared/agent-settings.ts +9 -8
  64. package/shared/catch-up.ts +65 -20
  65. package/shared/chat.ts +2 -2
  66. package/shared/compass.ts +5 -4
  67. package/shared/contracts.ts +52 -8
  68. package/shared/history.ts +160 -0
  69. package/shared/home-keys.ts +1 -0
  70. package/shared/home.ts +54 -8
  71. package/shared/job-rows.ts +2 -2
  72. package/shared/list.ts +4 -1
  73. package/shared/message-sender.ts +2 -0
  74. package/shared/model.ts +8 -0
  75. package/shared/new-name.ts +4 -1
  76. package/shared/now.ts +228 -0
  77. package/shared/onboarding.ts +17 -13
  78. package/shared/paged.ts +96 -0
  79. package/shared/provider-support.ts +83 -34
  80. package/shared/recommend.ts +1 -1
  81. package/shared/settings-nav.ts +3 -1
  82. package/shared/setup-popup.ts +28 -0
  83. package/shared/sort.ts +8 -1
  84. package/shared/status.ts +3 -1
  85. package/shared/wait.ts +2 -2
  86. package/shared/your-questions.ts +133 -0
  87. package/skills/follow-up/SKILL.md +1 -1
@@ -18,11 +18,16 @@ export const mcpSource: string = [
18
18
  "const boolean = { type: \"boolean\" };",
19
19
  "const integer = { type: \"integer\", minimum: 1 };",
20
20
  "const array = { type: \"array\", items: string };",
21
+ "// Paged reads (shared/paged.ts pageInput): finished items past the newest few come a page at a time.",
22
+ "const paging = { offset: { type: \"integer\", minimum: 0, maximum: 1000000 }, limit: { type: \"integer\", minimum: 1, maximum: 100 } };",
21
23
  "const communication = { type: \"object\", properties: { threadUrl: string, recipient: string, purpose: { type: \"string\", enum: [\"progress\", \"verified\"] }, authorization: string, replyUrl: { type: [\"string\", \"null\"] } }, required: [\"threadUrl\", \"recipient\"], additionalProperties: false };",
22
24
  "const trigger = { type: [\"object\", \"null\"], properties: { event: { type: \"string\", enum: [\"now\", \"merge\", \"deploy\", \"at\"] }, delayDays: { type: \"integer\", minimum: 0, maximum: 3650 }, at: { type: \"string\", description: \"event at: an ISO time with its offset, like 2026-11-26T12:15:00+02:00\" }, inMinutes: { type: \"integer\", minimum: 1, maximum: 43200, description: \"event at: this many minutes from now, instead of at\" } }, required: [\"event\"], additionalProperties: false };",
25
+ "const milestoneText = { type: \"string\", minLength: 1, maxLength: 80 };",
26
+ "const milestone = { type: [\"object\", \"null\"], description: \"The milestone toward the workspace goal you are on now, in a few words ('Releasing the beta'), not the current step. done/next: the milestones before and after it. Pass it when it changes, even mid-turn; omitted keeps the last; null clears it.\", properties: { now: milestoneText, done: { type: \"array\", items: milestoneText, maxItems: 8 }, next: { type: \"array\", items: milestoneText, maxItems: 8 } }, required: [\"now\"], additionalProperties: false };",
23
27
  "const tools = [",
24
- " [\"workspace_status\", \"Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence/history. Normal follow-up does not require recovery.\", \"follow.agent-status\", { detail: { type: \"string\", enum: [\"summary\", \"full\"] } }, []],",
25
- " [\"sync_workspace\", \"Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.\", \"follow.sync\", { summary: { ...string, minLength: 1, maxLength: 1000 } }, [\"summary\"]],",
28
+ " [\"workspace_status\", \"Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence. Finished PRs, tasks, questions and batches come as a count plus the newest few; history=<kind> with offset/limit pages the rest. Normal follow-up does not require recovery.\", \"follow.agent-status\", { detail: { type: \"string\", enum: [\"summary\", \"full\"] }, history: { type: \"string\", enum: [\"prs\", \"tasks\", \"questions\", \"batches\", \"prActions\"] }, ...paging }, []],",
29
+ " [\"sync_workspace\", \"Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.\", \"follow.sync\", { summary: { ...string, minLength: 1, maxLength: 1000 }, milestone }, [\"summary\"]],",
30
+ " [\"workspace_now\", \"What each agent in this workspace is working on now and its state (working, a permission, an ask, CI, idle), as the developer sees it. Read-only.\", \"follow.workspace-now\", {}, []],",
26
31
  " [\"enroll_workspace\", \"Refine this developer-activated workspace's goal. Ownership is initialized by Track this workspace or the project’s default-tracking setting. This tool cannot activate another workspace. Never ask the developer to enter this. Keep the goal concise; new scope reopens completion.\", \"follow.enroll\", { goal: string }, [\"goal\"]],",
27
32
  " [\"register_pr\", \"Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \\\"none\\\") every PR counts as agentMerges unless you set it false.\", \"follow.register-pr\", { repo: string, number: integer, stack: string, parentNumber: { type: [\"integer\", \"null\"], minimum: 1 }, disposition: string, agentMerges: boolean }, [\"repo\", \"number\", \"stack\"]],",
28
33
  " [\"exclude_stack\", \"Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.\", \"follow.exclude-stack\", { stack: string, reason: string, obligationIds: array }, [\"stack\", \"reason\"]],",
@@ -30,7 +35,7 @@ export const mcpSource: string = [
30
35
  " [\"acknowledge_batch\", \"Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. in_progress when you or your own subagent are already working on these tasks (say where it stands): not a failure, and Follow-up won't send the same tasks again until that work ends or they change on GitHub. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. When only part of it waits on a person (one thread needs the reviewer's call), name that part in waitingOn with any outcome and carry on with the rest: the developer gets it as a person item, and later messages tell you to leave it. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\", \"in_progress\"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: \"boolean\" }, waitingOn: { ...string, maxLength: 500 } }, [\"batchId\", \"outcome\", \"result\"]],",
31
36
  " [\"ask_question\", \"Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. When a task waits on this decision, set task, then mark it blocked with update_obligation question=\\\"Q<n>\\\" (not ask): one decision, one card. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\\\"Already open as Q18\\\") instead of a second one; to change an open question's options, ask again with supersedes=\\\"Q18\\\". At the end of the turn point at it with needs_you questions=[\\\"Q18\\\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \\\"Something else\\\" choice where the developer writes their own answer; don't add an \\\"Other\\\" option yourself.\", \"follow.ask-question\", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: \"array\", maxItems: 26, items: { type: \"object\", properties: { letter: { type: \"string\", pattern: \"^[A-Z]$\" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: [\"letter\", \"label\"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: \"array\", maxItems: 10, items: { type: \"object\", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: \"string\", pattern: \"^Q\\\\d+$\" } }, [\"title\", \"question\"]],",
32
37
  " [\"record_answer\", \"Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \\\"other\\\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.\", \"follow.record-answer\", { id: string, choice: string, words: string }, [\"id\", \"choice\"]],",
33
- " [\"context_reply\", \"Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.\", \"follow.context-reply\", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, [\"requestId\", \"text\"]],",
38
+ " [\"context_reply\", \"Answer the developer's question (Your questions, More context) with the requestId it gave: { requestId, text }. Plain words, short (under 4000 characters). A question is not a task: don't change anything unless it asks you to. Then end your turn. Only when asked.\", \"follow.context-reply\", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, [\"requestId\", \"text\"]],",
34
39
  " [\"withdraw_question\", \"Withdraw a question that no longer matters, with a short reason.\", \"follow.withdraw-question\", { id: string, reason: string }, [\"id\", \"reason\"]],",
35
40
  " [\"set_spec\", \"Register the link to this workspace's spec: the Claude artifact (or doc) you keep summarizing the goal, decisions and status. Call it once after the first publish, with the URL from the publish result, and again only if the link changes. Follow-up shows it in the workspace header.\", \"follow.set-spec\", { url: { ...string, maxLength: 2000 }, title: { ...string, maxLength: 120 } }, [\"url\"]],",
36
41
  " [\"link_item\", \"Link what this workspace's work is about: the Linear issue, Slack thread, doc or artifact you started from or opened for it. ref is its URL or Linear key; why is one short line. Don't link things you only mention. A PR isn't a linked item: register it with register_pr. An unknown Linear key is refused.\", \"follow.link-item\", { ref: { ...string, maxLength: 2000 }, why: { ...string, maxLength: 140 }, title: { ...string, maxLength: 200 } }, [\"ref\"]],",
@@ -49,7 +54,7 @@ export const mcpSource: string = [
49
54
  "const ask = \" Only when the developer asked for it. Returns a dry-run plan first; run it with confirm=true and the planId.\";",
50
55
  "const read = \" Read-only.\";",
51
56
  "const actionTools = [",
52
- " [\"list_prs\", \"List tracked PRs across all workspaces with state, draft, checks, open threads, requested reviewers and merge blockers. Filters: needs_reviewers, ready_to_merge, workspace (id or title). This is how you act \\\"on all\\\".\", \"follow.agent-act\", { workspace: string, needs_reviewers: boolean, ready_to_merge: boolean, include_closed: boolean }, []],",
57
+ " [\"list_prs\", \"List tracked PRs across all workspaces with state, draft, checks, open threads, requested reviewers and merge blockers. Filters: needs_reviewers, ready_to_merge, workspace (id or title). This is how you act \\\"on all\\\". include_closed adds the newest few merged or closed PRs and a count; offset/limit pages the rest.\", \"follow.agent-act\", { workspace: string, needs_reviewers: boolean, ready_to_merge: boolean, include_closed: boolean, ...paging }, []],",
53
58
  " [\"add_reviewers\", \"Request reviewers on one or many PRs, the same as the Add reviewers button. Without reviewers, asks the developer's saved reviewers for that repository (each PR row in list_prs shows them as configuredReviewers, with source repo, default or none); otherwise the GitHub logins or org/team slugs you give.\" + ask, \"follow.agent-act\", { prs: { type: \"array\", items: prKey }, reviewers: array, ...planned }, []],",
54
59
  " [\"merge\", \"Merge a PR (and its downstack with scope=downstack) through Graphite, using Follow-up's merge plan and blockers. Can't be undone.\" + ask, \"follow.agent-act\", { pr: prKey, scope: { type: \"string\", enum: [\"target\", \"downstack\"] }, ...planned }, []],",
55
60
  " [\"enable_merge_when_ready\", \"Turn on Graphite merge-when-ready for a PR, as the PR sheet does.\" + ask, \"follow.agent-act\", { pr: prKey, scope: { type: \"string\", enum: [\"target\", \"downstack\"] }, ...planned }, []],",
@@ -91,7 +96,7 @@ export const mcpSource: string = [
91
96
  " [\"brief_chat_search\", \"Alias of compass_find (goes in the next minor): people or channels by name (kind people|channels, query).\" + read, \"follow.agent-act\", { kind: { type: \"string\", enum: [\"people\", \"channels\"] }, query: string }, [\"kind\", \"query\"]],",
92
97
  " [\"set_linked_items\", \"Change a workspace's linked items for the developer, like the Linked items list: action add (ref: URL or Linear key), remove (ref) or undo (ref, a removal).\" + ask, \"follow.agent-act\", { workspaceId: string, action: { type: \"string\", enum: [\"add\", \"remove\", \"undo\"] }, ref: string, title: string, ...planned }, []],",
93
98
  " [\"agent_settings\", \"Read which agent each of Follow-up's special roles uses (Summaries, Overseer, Recovery, AI priority): provider, model, effort, mode and limits, and whether Wait for background jobs is on. Read-only; the developer changes them in Follow-up settings → Agents.\", \"follow.agent-act\", {}, []],",
94
- " [\"inbox_list\", \"Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens.\", \"follow.agent-act\", { flagged_only: boolean }, []],",
99
+ " [\"inbox_list\", \"Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens. Quiet rows (not flagged, running or signed off today) come as a count plus the newest few; offset/limit pages them.\", \"follow.agent-act\", { flagged_only: boolean, ...paging }, []],",
95
100
  " [\"sign_off\", \"Sign off other agents' Needs-you flags on the developer's behalf, like Sign off. Never your own.\" + ask, \"follow.agent-act\", { agentIds: array, ...planned }, []],",
96
101
  " [\"snooze\", \"Snooze other agents' flags (until: next-event, 1h, tomorrow or an ISO time), like Later.\" + ask, \"follow.agent-act\", { agentIds: array, until: string, ...planned }, []],",
97
102
  " [\"snooze_workspace\", \"Put off a workspace's own Needs-you items (a hold, repairs to send) that carry no agent flag, like Later on its Home row (until: next-event, 1h, tonight, tomorrow or an ISO time); bring_back=true ends it early. A new item brings it back by itself.\" + ask, \"follow.agent-act\", { workspace: string, until: string, bring_back: boolean, ...planned }, [\"workspace\"]],",
@@ -127,8 +132,9 @@ export const mcpSource: string = [
127
132
  " [\"overseer_restart\", \"Restart the Overseer (with the model Settings → Agents names now).\" + ask, \"follow.agent-act\", { ...planned }, []],",
128
133
  " [\"overseer_ask\", \"Send the developer's words to the Overseer, as its box on Home does: { text }.\" + ask, \"follow.agent-act\", { text: string, images, ...planned }, []],",
129
134
  " [\"catch_up_deck\", \"Read Catch up's deck: everything that needs the developer, one card per ask in Home's order, with any More context ask on it.\" + read, \"follow.agent-act\", {}, []],",
130
- " [\"context_requests\", \"Read Catch up's More context asks: what the developer asked about a card, who answers, the state and the answer.\" + read, \"follow.agent-act\", { workspaceId: string }, []],",
131
- " [\"ask_context\", \"Ask the Overseer or a card's agent to explain a card for the developer, like Catch up's More context: { workspaceId, agentId, cardKey, card, target: overseer | agent, ask } (cardKey and card from catch_up_deck).\" + ask, \"follow.agent-act\", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: \"string\", enum: [\"overseer\", \"agent\"] }, ask: string, images, ...planned }, []],",
135
+ " [\"context_requests\", \"Read the developer's questions to agents (Your questions, and Catch up's More context about a card): who was asked, the state, the answer and what came of it (done, a task). { workspaceId?, state?: all | open | tasks, query? } searches questions and answers. Ones still asking come in full; settled ones as a count plus the newest few, and offset/limit pages them.\" + read, \"follow.agent-act\", { workspaceId: string, state: { type: \"string\", enum: [\"all\", \"open\", \"tasks\"] }, query: string, ...paging }, []],",
136
+ " [\"ask_context\", \"Ask an agent a question for the developer; the answer lands in their Your questions: { workspaceId, ask } asks that workspace's main agent, { agentId, ask } asks that agent (main or contributor of a tracked workspace), and { workspaceId, agentId, cardKey, card, ask } is More context about a Catch up card (cardKey and card from catch_up_deck).\" + ask, \"follow.agent-act\", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: \"string\", enum: [\"overseer\", \"agent\"] }, ask: string, images, ...planned }, []],",
137
+ " [\"question_action\", \"Act on one of the developer's questions (ids from context_requests): { id, action: done | reply | task | withdraw, text? }. done closes it (the developer still sees it as unread), reply asks a follow-up in the same thread (text), task makes it a task for the agent that answered, withdraw takes back one still asking.\" + ask, \"follow.agent-act\", { id: string, action: { type: \"string\", enum: [\"done\", \"reply\", \"task\", \"withdraw\"] }, text: string, images, ...planned }, []],",
132
138
  " [\"queue_list\", \"Read Follow-up's message queue: answers, repairs and forwards waiting to reach agents, with each one's state (queued, sending, retrying, failed), why it waits and when it tries next, plus the newest sent: { workspaceId?, agentId? }.\" + read, \"follow.agent-act\", { workspaceId: string, agentId: string }, []],",
133
139
  " [\"queue_action\", \"Retry a queued or failed message now, or cancel it so it never goes: { itemId, action: retry | cancel } (ids from queue_list).\" + ask, \"follow.agent-act\", { itemId: string, action: { type: \"string\", enum: [\"retry\", \"cancel\"] }, ...planned }, []],",
134
140
  " [\"inbox_brief\", \"Read another agent's full Needs-you brief (decisions, options, links): { agentId }.\" + read, \"follow.agent-act\", { agentId: string }, [\"agentId\"]],",
@@ -143,7 +149,7 @@ export const mcpSource: string = [
143
149
  " [\"set_task_trigger\", \"Schedule a task to run now, on merge, on deploy or at a time (trigger { event, delayDays } or { event: \\\"at\\\", at | inMinutes } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }.\" + ask, \"follow.agent-act\", { workspaceId: string, obligationId: string, expectedRevision: { type: \"integer\", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],",
144
150
  " [\"pr_controls\", \"Read a PR's merge controls as the PR sheet shows them (Send to Paseo pairing, Graphite in Chrome): { workspaceId, prKey }.\" + read, \"follow.agent-act\", { workspaceId: string, prKey }, [\"workspaceId\", \"prKey\"]],",
145
151
  " [\"browser_status\", \"Read whether Send to Paseo is paired and which repositories it may control.\" + read, \"follow.agent-act\", {}, []],",
146
- " [\"release_notes\", \"Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes, newest first. What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates).\" + read, \"follow.agent-act\", {}, []],",
152
+ " [\"release_notes\", \"Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes since previous, newest first (older ones: the newest few and a count; offset/limit pages them). What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates).\" + read, \"follow.agent-act\", { ...paging }, []],",
147
153
  " [\"updates_status\", \"Read Settings → General: installed version and install kind, mode (auto|notify|off), channel (stable|beta), enable_whats_new, newest version per channel, last and next check, phase (current, available, waiting, installing, settling, updated, rolled-back, install-failed, untrusted), notes for the pending version, install history, and move (2.0's one-time move to its new plugin id: phase none|waiting|moving|moved|rolled-back|failed|manual, with the reason).\" + read, \"follow.agent-act\", {}, []],",
148
154
  " [\"check_updates\", \"Ask the registry for a newer Follow-up now, like Check now. Works when updates are Off. Calls a few seconds apart share one request; call it only when asked. Returns updates_status.\", \"follow.agent-act\", {}, []],",
149
155
  " [\"set_updates\", \"Change how Follow-up updates, like Settings → General: { mode: auto|notify|off, channel: stable|beta, enable_whats_new: show What's new once after an update that brings new release notes (betas never; off records each update as seen) }.\" + ask, \"follow.agent-act\", { mode: { type: \"string\", enum: [\"auto\", \"notify\", \"off\"] }, channel: { type: \"string\", enum: [\"stable\", \"beta\"] }, enable_whats_new: boolean, ...planned }, []],",
@@ -169,7 +175,7 @@ export const mcpSource: string = [
169
175
  "const overseerNames = new Set(overseerTools.map(t => t[0]));",
170
176
  "const overseerInstruction = \"You are Follow-up's Overseer. Route the developer's asks with route_candidates and send_to_agent; ask with needs_you kind=decision when unsure; start_workspace only when the developer asked or approved, passing the keys, never your summary of an issue (the new agent reads it itself). Never merge, post to people or archive.\";",
171
177
  "const actionNames = new Set(actionTools.map(t => t[0]));",
172
- "const readOnlyTools = new Set([\"linear_queue\", \"compass\", \"compass_find\", \"why_suggested\", \"brief_settings\", \"brief_plan\", \"brief_chat_search\", \"brief_sources\", \"dispatch_sources\", \"dispatch_records\", \"dispatch_actions\", \"dispatch_settings\", \"catch_up_deck\", \"context_requests\", \"queue_list\", \"workspace_status\", \"list_prs\", \"inbox_list\", \"workstreams\", \"agent_digest\", \"route_candidates\", \"workspace_about\", \"link_items\", \"agent_settings\", \"display_settings\", \"follow_settings\", \"project_settings\", \"pr_workflow\", \"pr_stats\", \"pr_stats_settings\", \"reviewer_settings\", \"reviewer_suggestions\", \"onboarding_status\", \"onboarding_checks\", \"priorities\", \"rank_status\", \"usage\", \"overseer_status\", \"inbox_brief\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\"]);",
178
+ "const readOnlyTools = new Set([\"linear_queue\", \"compass\", \"compass_find\", \"why_suggested\", \"brief_settings\", \"brief_plan\", \"brief_chat_search\", \"brief_sources\", \"dispatch_sources\", \"dispatch_records\", \"dispatch_actions\", \"dispatch_settings\", \"catch_up_deck\", \"context_requests\", \"queue_list\", \"workspace_status\", \"workspace_now\", \"list_prs\", \"inbox_list\", \"workstreams\", \"agent_digest\", \"route_candidates\", \"workspace_about\", \"link_items\", \"agent_settings\", \"display_settings\", \"follow_settings\", \"project_settings\", \"pr_workflow\", \"pr_stats\", \"pr_stats_settings\", \"reviewer_settings\", \"reviewer_suggestions\", \"onboarding_status\", \"onboarding_checks\", \"priorities\", \"rank_status\", \"usage\", \"overseer_status\", \"inbox_brief\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\"]);",
173
179
  "const destructiveTools = new Set([\"merge\"]);",
174
180
  "const actionInstruction = \"Follow-up's action tools let you do anything the developer can click, across every tracked workspace and every Settings tab. Read freely: list_prs, inbox_list, inbox_brief, workspace_about, agent_settings, display_settings, follow_settings, project_settings, pr_workflow, pr_stats, pr_stats_settings, reviewer_settings, onboarding_status, priorities, rank_status, usage, overseer_status, pr_controls. Hand the main role on, or claim it, with make_main_agent. Act only when the developer asks (\\\"the PRs look good, assign reviewers on all\\\": list_prs needs_reviewers=true, add_reviewers with those keys, then confirm the plan): add_reviewers, merge, enable/disable_merge_when_ready, send_repairs, set_auto_send, clear_hold, retry_batch, track, run_recovery, set_priorities, rerank_priorities; settings with set_display (trust bypass too), set_follow_settings, set_project_tracking, set_pr_workflow, set_pr_stats, save_reviewers, set_agent_setting, set_wait_for_jobs, set_onboarding; snooze_workspace; ai_rename; dispatch (New: start work from a Linear issue, GitHub link or words); and sign_off/snooze/set_finish_flags/inbox_act/brief_action/answer_question for other agents. Planned tools return a dry run showing what changes; run it with confirm=true and its planId. Never sign yourself off or answer your own brief.\";",
175
181
  "",
@@ -178,7 +184,7 @@ export const mcpSource: string = [
178
184
  "// Paseo 0.16+ (features.agentBackgroundWork) tracks background shell jobs and wakes the agent when one finishes, so",
179
185
  "// Wait's tools aren't attached there; the agent hook adds this instead when FOLLOW_UP_BACKGROUND_WORK=1.",
180
186
  "const backgroundWorkInstruction = \"When a finite shell command may take a while (tests, builds, installs, deploy checks), run it with native Bash run_in_background=true. Continue useful independent work first if available. When only waiting remains, end your turn and say what you're waiting for: Paseo keeps the job running, shows it with Stop, and wakes you when it finishes. Don't sleep or poll in a loop to keep the turn open. When you're woken, confirm the actual exit code before reporting completion.\";",
181
- "const waitInstruction = \"When a finite shell command may take a while and you need its result to finish the user's task, use Wait: wait_prepare_job({description, command}), run the returned exact bashCommand through native Bash with run_in_background=true, then call wait_for_job({jobId}). Continue useful independent work first if available. When only waiting remains, keep waiting through wait_for_job instead of ending your turn with \\\"waiting for a notification\\\". Each call wakes you after at most 60 seconds (default 30): on still_pending, inspect wait_get_job and the native Bash output, then wait again if appropriate. Confirm the actual exit code before reporting completion. New messages and Stop release observation without killing the job. Already-started ordinary background tasks cannot be adopted: do not rerun a command just to wrap it.\";",
187
+ "const waitInstruction = \"When a finite shell command may take a while and you need its result to finish the user's task, use Wait: wait_prepare_job({description, command}), run the returned exact bashCommand the way the reply's instruction says (on Claude Code through native Bash with run_in_background=true; elsewhere it starts itself in the background), then call wait_for_job({jobId}). Continue useful independent work first if available. When only waiting remains, keep waiting through wait_for_job instead of ending your turn with \\\"waiting for a notification\\\". Each call wakes you after at most 60 seconds (default 30): on still_pending, inspect wait_get_job and the job's output (the native Bash output, or outputPath), then wait again if appropriate. Confirm the actual exit code before reporting completion. New messages and Stop release observation without killing the job. Already-started ordinary background tasks cannot be adopted: do not rerun a command just to wrap it.\";",
182
188
  "",
183
189
  "// The brief's tool: every root agent while the Needs-you inbox is on; never contributors, recovery or subagents.",
184
190
  "// Kept identical to NEEDS_YOU_INSTRUCTION in shared/brief.ts (a test checks it).",
@@ -190,7 +196,7 @@ export const mcpSource: string = [
190
196
  " // wait_for_checks: every root agent, tracked or not (an untracked one learns where else to wait); never recovery.",
191
197
  " const waiting = actions && !recovery ? tools.filter(t => t[0] === \"wait_for_checks\") : [];",
192
198
  " if (briefOnly) return [...(brief ? tools.filter(t => t[0] === \"needs_you\") : []), ...waiting, ...acting];",
193
- " return [...tools.filter(t => t[0] === \"needs_you\" ? brief && !recovery && !contributor : t[0] === \"wait_for_checks\" ? !recovery : contributor ? [\"workspace_status\", \"register_pr\", \"sync_workspace\", \"link_item\", \"unlink_item\"].includes(t[0]) : !recovery || ![\"declare_done\", \"sync_workspace\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"context_reply\"].includes(t[0])), ...acting];",
199
+ " return [...tools.filter(t => t[0] === \"needs_you\" ? brief && !recovery && !contributor : t[0] === \"wait_for_checks\" ? !recovery : contributor ? [\"workspace_status\", \"workspace_now\", \"register_pr\", \"sync_workspace\", \"link_item\", \"unlink_item\", \"context_reply\"].includes(t[0]) : !recovery || ![\"declare_done\", \"sync_workspace\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"context_reply\"].includes(t[0])), ...acting];",
194
200
  "}",
195
201
  "/** Whether this session may call needs_you: launched as a root agent (FOLLOW_UP_BRIEF) and the inbox is on. */",
196
202
  "async function briefEnabled() {",
@@ -296,8 +302,8 @@ export const mcpSource: string = [
296
302
  "}",
297
303
  "function currentWork(w) {",
298
304
  " return { id: w.id, title: w.title, goal: w.goal, mainAgentId: w.mainAgentId, enable_tracking: w.enable_tracking, enable_auto_sends: w.enable_auto_sends, hold: w.hold, archived: w.archived, runtimeBusy: w.runtimeBusy, runtimeReason: w.runtimeReason, backgroundBusy: w.backgroundBusy, mainBusy: w.mainBusy ?? null, completion: w.completion,",
299
- " prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),",
300
- " obligations: w.obligations.filter(o => ![\"done\", \"waived\"].includes(o.status)), completedObligations: w.obligations.filter(o => [\"done\", \"waived\"].includes(o.status)).length,",
305
+ " prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads?.length ?? 0, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),",
306
+ " obligations: w.obligations.filter(o => ![\"done\", \"waived\"].includes(o.status)), completedObligations: w.history?.tasks.total ?? w.obligations.filter(o => [\"done\", \"waived\"].includes(o.status)).length,",
301
307
  " openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),",
302
308
  " // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.",
303
309
  " dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),",
@@ -313,7 +319,9 @@ export const mcpSource: string = [
313
319
  " githubWait: w.githubWait ?? null,",
314
320
  " // GitHub off on this host (missing: no gh; signed-out): PR status, repairs, merge and wait_for_checks are off until gh is set up.",
315
321
  " ...(w.githubOff ? { githubOff: w.githubOff } : {}),",
316
- " excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}), detail: \"summary\" };",
322
+ " excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}),",
323
+ " // Finished items left out of prs, obligations, questions and batches: how many, and how to page them.",
324
+ " ...(w.history ? { history: w.history } : {}), detail: \"summary\" };",
317
325
  "}",
318
326
  "function compact(tool, input, result) {",
319
327
  " if (actionNames.has(tool)) return result;",
@@ -402,7 +410,7 @@ export const mcpSource: string = [
402
410
  "async function runMain() {",
403
411
  "const command = process.argv[2];",
404
412
  "if (command === \"list\" || command === \"--help\" || command === \"help\") {",
405
- " process.stdout.write(command === \"list\" ? JSON.stringify({ tools: schemas([...toolList(undefined, false, true, false, true), ...overseerTools]) }, null, 2) + \"\\n\" : \"Usage: node mcp.mjs list | call <tool> '<json>' [--compact]\\nNative MCP returns compact receipts; workspace_status({detail:full}) requests complete history. CLI calls retain full replies unless --compact is supplied.\\n\");",
413
+ " process.stdout.write(command === \"list\" ? JSON.stringify({ tools: schemas([...toolList(undefined, false, true, false, true), ...overseerTools]) }, null, 2) + \"\\n\" : \"Usage: node mcp.mjs list | call <tool> '<json>' [--compact]\\nNative MCP returns compact receipts; workspace_status({detail:full}) requests complete evidence; history=<kind> pages finished items. CLI calls retain full replies unless --compact is supplied.\\n\");",
406
414
  "} else if (command === \"call\") {",
407
415
  " try {",
408
416
  " const tool = [...toolList(undefined, false, await briefEnabled(), false, await actionsEnabled()), ...(await overseerEnabled() ? overseerTools : [])].find(t => t[0] === process.argv[3]);",
package/server/mcp.mjs CHANGED
@@ -16,11 +16,16 @@ const string = { type: "string" };
16
16
  const boolean = { type: "boolean" };
17
17
  const integer = { type: "integer", minimum: 1 };
18
18
  const array = { type: "array", items: string };
19
+ // Paged reads (shared/paged.ts pageInput): finished items past the newest few come a page at a time.
20
+ const paging = { offset: { type: "integer", minimum: 0, maximum: 1000000 }, limit: { type: "integer", minimum: 1, maximum: 100 } };
19
21
  const communication = { type: "object", properties: { threadUrl: string, recipient: string, purpose: { type: "string", enum: ["progress", "verified"] }, authorization: string, replyUrl: { type: ["string", "null"] } }, required: ["threadUrl", "recipient"], additionalProperties: false };
20
22
  const trigger = { type: ["object", "null"], properties: { event: { type: "string", enum: ["now", "merge", "deploy", "at"] }, delayDays: { type: "integer", minimum: 0, maximum: 3650 }, at: { type: "string", description: "event at: an ISO time with its offset, like 2026-11-26T12:15:00+02:00" }, inMinutes: { type: "integer", minimum: 1, maximum: 43200, description: "event at: this many minutes from now, instead of at" } }, required: ["event"], additionalProperties: false };
23
+ const milestoneText = { type: "string", minLength: 1, maxLength: 80 };
24
+ const milestone = { type: ["object", "null"], description: "The milestone toward the workspace goal you are on now, in a few words ('Releasing the beta'), not the current step. done/next: the milestones before and after it. Pass it when it changes, even mid-turn; omitted keeps the last; null clears it.", properties: { now: milestoneText, done: { type: "array", items: milestoneText, maxItems: 8 }, next: { type: "array", items: milestoneText, maxItems: 8 } }, required: ["now"], additionalProperties: false };
21
25
  const tools = [
22
- ["workspace_status", "Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence/history. Normal follow-up does not require recovery.", "follow.agent-status", { detail: { type: "string", enum: ["summary", "full"] } }, []],
23
- ["sync_workspace", "Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.", "follow.sync", { summary: { ...string, minLength: 1, maxLength: 1000 } }, ["summary"]],
26
+ ["workspace_status", "Read the tracked workspace's durable goal, PRs, tasks, work queue and optional recovery history. Read after compaction. Returns current work by default; detail=full includes complete evidence. Finished PRs, tasks, questions and batches come as a count plus the newest few; history=<kind> with offset/limit pages the rest. Normal follow-up does not require recovery.", "follow.agent-status", { detail: { type: "string", enum: ["summary", "full"] }, history: { type: "string", enum: ["prs", "tasks", "questions", "batches", "prActions"] }, ...paging }, []],
27
+ ["sync_workspace", "Silently confirm the sidebar matches your work before finishing, after registering owned PRs and substantive tasks. Call even when no changes are needed. Keep the summary in this tool; never announce sync or recap sidebar/plugin status to the developer. Does not declare Done, run recovery, or start repairs. Tracked root agents only.", "follow.sync", { summary: { ...string, minLength: 1, maxLength: 1000 }, milestone }, ["summary"]],
28
+ ["workspace_now", "What each agent in this workspace is working on now and its state (working, a permission, an ask, CI, idle), as the developer sees it. Read-only.", "follow.workspace-now", {}, []],
24
29
  ["enroll_workspace", "Refine this developer-activated workspace's goal. Ownership is initialized by Track this workspace or the project’s default-tracking setting. This tool cannot activate another workspace. Never ask the developer to enter this. Keep the goal concise; new scope reopens completion.", "follow.enroll", { goal: string }, ["goal"]],
25
30
  ["register_pr", "Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \"none\") every PR counts as agentMerges unless you set it false.", "follow.register-pr", { repo: string, number: integer, stack: string, parentNumber: { type: ["integer", "null"], minimum: 1 }, disposition: string, agentMerges: boolean }, ["repo", "number", "stack"]],
26
31
  ["exclude_stack", "Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.", "follow.exclude-stack", { stack: string, reason: string, obligationIds: array }, ["stack", "reason"]],
@@ -28,7 +33,7 @@ const tools = [
28
33
  ["acknowledge_batch", "Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. in_progress when you or your own subagent are already working on these tasks (say where it stands): not a failure, and Follow-up won't send the same tasks again until that work ends or they change on GitHub. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. When only part of it waits on a person (one thread needs the reviewer's call), name that part in waitingOn with any outcome and carry on with the rest: the developer gets it as a person item, and later messages tell you to leave it. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked", "in_progress"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: "boolean" }, waitingOn: { ...string, maxLength: 500 } }, ["batchId", "outcome", "result"]],
29
34
  ["ask_question", "Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. When a task waits on this decision, set task, then mark it blocked with update_obligation question=\"Q<n>\" (not ask): one decision, one card. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\"Already open as Q18\") instead of a second one; to change an open question's options, ask again with supersedes=\"Q18\". At the end of the turn point at it with needs_you questions=[\"Q18\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \"Something else\" choice where the developer writes their own answer; don't add an \"Other\" option yourself.", "follow.ask-question", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: "array", maxItems: 26, items: { type: "object", properties: { letter: { type: "string", pattern: "^[A-Z]$" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: ["letter", "label"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: "array", maxItems: 10, items: { type: "object", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: "string", pattern: "^Q\\d+$" } }, ["title", "question"]],
30
35
  ["record_answer", "Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \"other\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.", "follow.record-answer", { id: string, choice: string, words: string }, ["id", "choice"]],
31
- ["context_reply", "Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.", "follow.context-reply", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, ["requestId", "text"]],
36
+ ["context_reply", "Answer the developer's question (Your questions, More context) with the requestId it gave: { requestId, text }. Plain words, short (under 4000 characters). A question is not a task: don't change anything unless it asks you to. Then end your turn. Only when asked.", "follow.context-reply", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, ["requestId", "text"]],
32
37
  ["withdraw_question", "Withdraw a question that no longer matters, with a short reason.", "follow.withdraw-question", { id: string, reason: string }, ["id", "reason"]],
33
38
  ["set_spec", "Register the link to this workspace's spec: the Claude artifact (or doc) you keep summarizing the goal, decisions and status. Call it once after the first publish, with the URL from the publish result, and again only if the link changes. Follow-up shows it in the workspace header.", "follow.set-spec", { url: { ...string, maxLength: 2000 }, title: { ...string, maxLength: 120 } }, ["url"]],
34
39
  ["link_item", "Link what this workspace's work is about: the Linear issue, Slack thread, doc or artifact you started from or opened for it. ref is its URL or Linear key; why is one short line. Don't link things you only mention. A PR isn't a linked item: register it with register_pr. An unknown Linear key is refused.", "follow.link-item", { ref: { ...string, maxLength: 2000 }, why: { ...string, maxLength: 140 }, title: { ...string, maxLength: 200 } }, ["ref"]],
@@ -47,7 +52,7 @@ const prKey = { ...string, description: "owner/repo#number, from list_prs" };
47
52
  const ask = " Only when the developer asked for it. Returns a dry-run plan first; run it with confirm=true and the planId.";
48
53
  const read = " Read-only.";
49
54
  const actionTools = [
50
- ["list_prs", "List tracked PRs across all workspaces with state, draft, checks, open threads, requested reviewers and merge blockers. Filters: needs_reviewers, ready_to_merge, workspace (id or title). This is how you act \"on all\".", "follow.agent-act", { workspace: string, needs_reviewers: boolean, ready_to_merge: boolean, include_closed: boolean }, []],
55
+ ["list_prs", "List tracked PRs across all workspaces with state, draft, checks, open threads, requested reviewers and merge blockers. Filters: needs_reviewers, ready_to_merge, workspace (id or title). This is how you act \"on all\". include_closed adds the newest few merged or closed PRs and a count; offset/limit pages the rest.", "follow.agent-act", { workspace: string, needs_reviewers: boolean, ready_to_merge: boolean, include_closed: boolean, ...paging }, []],
51
56
  ["add_reviewers", "Request reviewers on one or many PRs, the same as the Add reviewers button. Without reviewers, asks the developer's saved reviewers for that repository (each PR row in list_prs shows them as configuredReviewers, with source repo, default or none); otherwise the GitHub logins or org/team slugs you give." + ask, "follow.agent-act", { prs: { type: "array", items: prKey }, reviewers: array, ...planned }, []],
52
57
  ["merge", "Merge a PR (and its downstack with scope=downstack) through Graphite, using Follow-up's merge plan and blockers. Can't be undone." + ask, "follow.agent-act", { pr: prKey, scope: { type: "string", enum: ["target", "downstack"] }, ...planned }, []],
53
58
  ["enable_merge_when_ready", "Turn on Graphite merge-when-ready for a PR, as the PR sheet does." + ask, "follow.agent-act", { pr: prKey, scope: { type: "string", enum: ["target", "downstack"] }, ...planned }, []],
@@ -89,7 +94,7 @@ const actionTools = [
89
94
  ["brief_chat_search", "Alias of compass_find (goes in the next minor): people or channels by name (kind people|channels, query)." + read, "follow.agent-act", { kind: { type: "string", enum: ["people", "channels"] }, query: string }, ["kind", "query"]],
90
95
  ["set_linked_items", "Change a workspace's linked items for the developer, like the Linked items list: action add (ref: URL or Linear key), remove (ref) or undo (ref, a removal)." + ask, "follow.agent-act", { workspaceId: string, action: { type: "string", enum: ["add", "remove", "undo"] }, ref: string, title: string, ...planned }, []],
91
96
  ["agent_settings", "Read which agent each of Follow-up's special roles uses (Summaries, Overseer, Recovery, AI priority): provider, model, effort, mode and limits, and whether Wait for background jobs is on. Read-only; the developer changes them in Follow-up settings → Agents.", "follow.agent-act", {}, []],
92
- ["inbox_list", "Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens.", "follow.agent-act", { flagged_only: boolean }, []],
97
+ ["inbox_list", "Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens. Quiet rows (not flagged, running or signed off today) come as a count plus the newest few; offset/limit pages them.", "follow.agent-act", { flagged_only: boolean, ...paging }, []],
93
98
  ["sign_off", "Sign off other agents' Needs-you flags on the developer's behalf, like Sign off. Never your own." + ask, "follow.agent-act", { agentIds: array, ...planned }, []],
94
99
  ["snooze", "Snooze other agents' flags (until: next-event, 1h, tomorrow or an ISO time), like Later." + ask, "follow.agent-act", { agentIds: array, until: string, ...planned }, []],
95
100
  ["snooze_workspace", "Put off a workspace's own Needs-you items (a hold, repairs to send) that carry no agent flag, like Later on its Home row (until: next-event, 1h, tonight, tomorrow or an ISO time); bring_back=true ends it early. A new item brings it back by itself." + ask, "follow.agent-act", { workspace: string, until: string, bring_back: boolean, ...planned }, ["workspace"]],
@@ -125,8 +130,9 @@ const actionTools = [
125
130
  ["overseer_restart", "Restart the Overseer (with the model Settings → Agents names now)." + ask, "follow.agent-act", { ...planned }, []],
126
131
  ["overseer_ask", "Send the developer's words to the Overseer, as its box on Home does: { text }." + ask, "follow.agent-act", { text: string, images, ...planned }, []],
127
132
  ["catch_up_deck", "Read Catch up's deck: everything that needs the developer, one card per ask in Home's order, with any More context ask on it." + read, "follow.agent-act", {}, []],
128
- ["context_requests", "Read Catch up's More context asks: what the developer asked about a card, who answers, the state and the answer." + read, "follow.agent-act", { workspaceId: string }, []],
129
- ["ask_context", "Ask the Overseer or a card's agent to explain a card for the developer, like Catch up's More context: { workspaceId, agentId, cardKey, card, target: overseer | agent, ask } (cardKey and card from catch_up_deck)." + ask, "follow.agent-act", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: "string", enum: ["overseer", "agent"] }, ask: string, images, ...planned }, []],
133
+ ["context_requests", "Read the developer's questions to agents (Your questions, and Catch up's More context about a card): who was asked, the state, the answer and what came of it (done, a task). { workspaceId?, state?: all | open | tasks, query? } searches questions and answers. Ones still asking come in full; settled ones as a count plus the newest few, and offset/limit pages them." + read, "follow.agent-act", { workspaceId: string, state: { type: "string", enum: ["all", "open", "tasks"] }, query: string, ...paging }, []],
134
+ ["ask_context", "Ask an agent a question for the developer; the answer lands in their Your questions: { workspaceId, ask } asks that workspace's main agent, { agentId, ask } asks that agent (main or contributor of a tracked workspace), and { workspaceId, agentId, cardKey, card, ask } is More context about a Catch up card (cardKey and card from catch_up_deck)." + ask, "follow.agent-act", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: "string", enum: ["overseer", "agent"] }, ask: string, images, ...planned }, []],
135
+ ["question_action", "Act on one of the developer's questions (ids from context_requests): { id, action: done | reply | task | withdraw, text? }. done closes it (the developer still sees it as unread), reply asks a follow-up in the same thread (text), task makes it a task for the agent that answered, withdraw takes back one still asking." + ask, "follow.agent-act", { id: string, action: { type: "string", enum: ["done", "reply", "task", "withdraw"] }, text: string, images, ...planned }, []],
130
136
  ["queue_list", "Read Follow-up's message queue: answers, repairs and forwards waiting to reach agents, with each one's state (queued, sending, retrying, failed), why it waits and when it tries next, plus the newest sent: { workspaceId?, agentId? }." + read, "follow.agent-act", { workspaceId: string, agentId: string }, []],
131
137
  ["queue_action", "Retry a queued or failed message now, or cancel it so it never goes: { itemId, action: retry | cancel } (ids from queue_list)." + ask, "follow.agent-act", { itemId: string, action: { type: "string", enum: ["retry", "cancel"] }, ...planned }, []],
132
138
  ["inbox_brief", "Read another agent's full Needs-you brief (decisions, options, links): { agentId }." + read, "follow.agent-act", { agentId: string }, ["agentId"]],
@@ -141,7 +147,7 @@ const actionTools = [
141
147
  ["set_task_trigger", "Schedule a task to run now, on merge, on deploy or at a time (trigger { event, delayDays } or { event: \"at\", at | inMinutes } or null), with afterPrs: { workspaceId, obligationId, expectedRevision, trigger, afterPrs }." + ask, "follow.agent-act", { workspaceId: string, obligationId: string, expectedRevision: { type: "integer", minimum: 0 }, trigger, afterPrs: array, ...planned }, []],
142
148
  ["pr_controls", "Read a PR's merge controls as the PR sheet shows them (Send to Paseo pairing, Graphite in Chrome): { workspaceId, prKey }." + read, "follow.agent-act", { workspaceId: string, prKey }, ["workspaceId", "prKey"]],
143
149
  ["browser_status", "Read whether Send to Paseo is paired and which repositories it may control." + read, "follow.agent-act", {}, []],
144
- ["release_notes", "Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes, newest first. What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates)." + read, "follow.agent-act", {}, []],
150
+ ["release_notes", "Read Follow-up's release notes: the installed version, the version it updated from (previous) and when (updatedAt, ms), and every shipped version's notes since previous, newest first (older ones: the newest few and a count; offset/limit pages them). What's new shows the notes after previous, once per device, unless enable_whats_new is off (set_updates)." + read, "follow.agent-act", { ...paging }, []],
145
151
  ["updates_status", "Read Settings → General: installed version and install kind, mode (auto|notify|off), channel (stable|beta), enable_whats_new, newest version per channel, last and next check, phase (current, available, waiting, installing, settling, updated, rolled-back, install-failed, untrusted), notes for the pending version, install history, and move (2.0's one-time move to its new plugin id: phase none|waiting|moving|moved|rolled-back|failed|manual, with the reason)." + read, "follow.agent-act", {}, []],
146
152
  ["check_updates", "Ask the registry for a newer Follow-up now, like Check now. Works when updates are Off. Calls a few seconds apart share one request; call it only when asked. Returns updates_status.", "follow.agent-act", {}, []],
147
153
  ["set_updates", "Change how Follow-up updates, like Settings → General: { mode: auto|notify|off, channel: stable|beta, enable_whats_new: show What's new once after an update that brings new release notes (betas never; off records each update as seen) }." + ask, "follow.agent-act", { mode: { type: "string", enum: ["auto", "notify", "off"] }, channel: { type: "string", enum: ["stable", "beta"] }, enable_whats_new: boolean, ...planned }, []],
@@ -167,7 +173,7 @@ const overseerTools = [
167
173
  const overseerNames = new Set(overseerTools.map(t => t[0]));
168
174
  const overseerInstruction = "You are Follow-up's Overseer. Route the developer's asks with route_candidates and send_to_agent; ask with needs_you kind=decision when unsure; start_workspace only when the developer asked or approved, passing the keys, never your summary of an issue (the new agent reads it itself). Never merge, post to people or archive.";
169
175
  const actionNames = new Set(actionTools.map(t => t[0]));
170
- const readOnlyTools = new Set(["linear_queue", "compass", "compass_find", "why_suggested", "brief_settings", "brief_plan", "brief_chat_search", "brief_sources", "dispatch_sources", "dispatch_records", "dispatch_actions", "dispatch_settings", "catch_up_deck", "context_requests", "queue_list", "workspace_status", "list_prs", "inbox_list", "workstreams", "agent_digest", "route_candidates", "workspace_about", "link_items", "agent_settings", "display_settings", "follow_settings", "project_settings", "pr_workflow", "pr_stats", "pr_stats_settings", "reviewer_settings", "reviewer_suggestions", "onboarding_status", "onboarding_checks", "priorities", "rank_status", "usage", "overseer_status", "inbox_brief", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status"]);
176
+ const readOnlyTools = new Set(["linear_queue", "compass", "compass_find", "why_suggested", "brief_settings", "brief_plan", "brief_chat_search", "brief_sources", "dispatch_sources", "dispatch_records", "dispatch_actions", "dispatch_settings", "catch_up_deck", "context_requests", "queue_list", "workspace_status", "workspace_now", "list_prs", "inbox_list", "workstreams", "agent_digest", "route_candidates", "workspace_about", "link_items", "agent_settings", "display_settings", "follow_settings", "project_settings", "pr_workflow", "pr_stats", "pr_stats_settings", "reviewer_settings", "reviewer_suggestions", "onboarding_status", "onboarding_checks", "priorities", "rank_status", "usage", "overseer_status", "inbox_brief", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status"]);
171
177
  const destructiveTools = new Set(["merge"]);
172
178
  const actionInstruction = "Follow-up's action tools let you do anything the developer can click, across every tracked workspace and every Settings tab. Read freely: list_prs, inbox_list, inbox_brief, workspace_about, agent_settings, display_settings, follow_settings, project_settings, pr_workflow, pr_stats, pr_stats_settings, reviewer_settings, onboarding_status, priorities, rank_status, usage, overseer_status, pr_controls. Hand the main role on, or claim it, with make_main_agent. Act only when the developer asks (\"the PRs look good, assign reviewers on all\": list_prs needs_reviewers=true, add_reviewers with those keys, then confirm the plan): add_reviewers, merge, enable/disable_merge_when_ready, send_repairs, set_auto_send, clear_hold, retry_batch, track, run_recovery, set_priorities, rerank_priorities; settings with set_display (trust bypass too), set_follow_settings, set_project_tracking, set_pr_workflow, set_pr_stats, save_reviewers, set_agent_setting, set_wait_for_jobs, set_onboarding; snooze_workspace; ai_rename; dispatch (New: start work from a Linear issue, GitHub link or words); and sign_off/snooze/set_finish_flags/inbox_act/brief_action/answer_question for other agents. Planned tools return a dry run showing what changes; run it with confirm=true and its planId. Never sign yourself off or answer your own brief.";
173
179
 
@@ -176,7 +182,7 @@ const actionInstruction = "Follow-up's action tools let you do anything the deve
176
182
  // Paseo 0.16+ (features.agentBackgroundWork) tracks background shell jobs and wakes the agent when one finishes, so
177
183
  // Wait's tools aren't attached there; the agent hook adds this instead when FOLLOW_UP_BACKGROUND_WORK=1.
178
184
  const backgroundWorkInstruction = "When a finite shell command may take a while (tests, builds, installs, deploy checks), run it with native Bash run_in_background=true. Continue useful independent work first if available. When only waiting remains, end your turn and say what you're waiting for: Paseo keeps the job running, shows it with Stop, and wakes you when it finishes. Don't sleep or poll in a loop to keep the turn open. When you're woken, confirm the actual exit code before reporting completion.";
179
- const waitInstruction = "When a finite shell command may take a while and you need its result to finish the user's task, use Wait: wait_prepare_job({description, command}), run the returned exact bashCommand through native Bash with run_in_background=true, then call wait_for_job({jobId}). Continue useful independent work first if available. When only waiting remains, keep waiting through wait_for_job instead of ending your turn with \"waiting for a notification\". Each call wakes you after at most 60 seconds (default 30): on still_pending, inspect wait_get_job and the native Bash output, then wait again if appropriate. Confirm the actual exit code before reporting completion. New messages and Stop release observation without killing the job. Already-started ordinary background tasks cannot be adopted: do not rerun a command just to wrap it.";
185
+ const waitInstruction = "When a finite shell command may take a while and you need its result to finish the user's task, use Wait: wait_prepare_job({description, command}), run the returned exact bashCommand the way the reply's instruction says (on Claude Code through native Bash with run_in_background=true; elsewhere it starts itself in the background), then call wait_for_job({jobId}). Continue useful independent work first if available. When only waiting remains, keep waiting through wait_for_job instead of ending your turn with \"waiting for a notification\". Each call wakes you after at most 60 seconds (default 30): on still_pending, inspect wait_get_job and the job's output (the native Bash output, or outputPath), then wait again if appropriate. Confirm the actual exit code before reporting completion. New messages and Stop release observation without killing the job. Already-started ordinary background tasks cannot be adopted: do not rerun a command just to wrap it.";
180
186
 
181
187
  // The brief's tool: every root agent while the Needs-you inbox is on; never contributors, recovery or subagents.
182
188
  // Kept identical to NEEDS_YOU_INSTRUCTION in shared/brief.ts (a test checks it).
@@ -188,7 +194,7 @@ function toolList(recovery = env("RECOVERY") === "1", contributor = false, brief
188
194
  // wait_for_checks: every root agent, tracked or not (an untracked one learns where else to wait); never recovery.
189
195
  const waiting = actions && !recovery ? tools.filter(t => t[0] === "wait_for_checks") : [];
190
196
  if (briefOnly) return [...(brief ? tools.filter(t => t[0] === "needs_you") : []), ...waiting, ...acting];
191
- return [...tools.filter(t => t[0] === "needs_you" ? brief && !recovery && !contributor : t[0] === "wait_for_checks" ? !recovery : contributor ? ["workspace_status", "register_pr", "sync_workspace", "link_item", "unlink_item"].includes(t[0]) : !recovery || !["declare_done", "sync_workspace", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "context_reply"].includes(t[0])), ...acting];
197
+ return [...tools.filter(t => t[0] === "needs_you" ? brief && !recovery && !contributor : t[0] === "wait_for_checks" ? !recovery : contributor ? ["workspace_status", "workspace_now", "register_pr", "sync_workspace", "link_item", "unlink_item", "context_reply"].includes(t[0]) : !recovery || !["declare_done", "sync_workspace", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "context_reply"].includes(t[0])), ...acting];
192
198
  }
193
199
  /** Whether this session may call needs_you: launched as a root agent (FOLLOW_UP_BRIEF) and the inbox is on. */
194
200
  async function briefEnabled() {
@@ -294,8 +300,8 @@ function validate(value, schema, path = "arguments") {
294
300
  }
295
301
  function currentWork(w) {
296
302
  return { id: w.id, title: w.title, goal: w.goal, mainAgentId: w.mainAgentId, enable_tracking: w.enable_tracking, enable_auto_sends: w.enable_auto_sends, hold: w.hold, archived: w.archived, runtimeBusy: w.runtimeBusy, runtimeReason: w.runtimeReason, backgroundBusy: w.backgroundBusy, mainBusy: w.mainBusy ?? null, completion: w.completion,
297
- prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),
298
- obligations: w.obligations.filter(o => !["done", "waived"].includes(o.status)), completedObligations: w.obligations.filter(o => ["done", "waived"].includes(o.status)).length,
303
+ prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads?.length ?? 0, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),
304
+ obligations: w.obligations.filter(o => !["done", "waived"].includes(o.status)), completedObligations: w.history?.tasks.total ?? w.obligations.filter(o => ["done", "waived"].includes(o.status)).length,
299
305
  openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),
300
306
  // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.
301
307
  dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),
@@ -311,7 +317,9 @@ function currentWork(w) {
311
317
  githubWait: w.githubWait ?? null,
312
318
  // GitHub off on this host (missing: no gh; signed-out): PR status, repairs, merge and wait_for_checks are off until gh is set up.
313
319
  ...(w.githubOff ? { githubOff: w.githubOff } : {}),
314
- excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}), detail: "summary" };
320
+ excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}),
321
+ // Finished items left out of prs, obligations, questions and batches: how many, and how to page them.
322
+ ...(w.history ? { history: w.history } : {}), detail: "summary" };
315
323
  }
316
324
  function compact(tool, input, result) {
317
325
  if (actionNames.has(tool)) return result;
@@ -400,7 +408,7 @@ if (isMain()) runMain().catch(error => { console.error(error?.message ?? String(
400
408
  async function runMain() {
401
409
  const command = process.argv[2];
402
410
  if (command === "list" || command === "--help" || command === "help") {
403
- process.stdout.write(command === "list" ? JSON.stringify({ tools: schemas([...toolList(undefined, false, true, false, true), ...overseerTools]) }, null, 2) + "\n" : "Usage: node mcp.mjs list | call <tool> '<json>' [--compact]\nNative MCP returns compact receipts; workspace_status({detail:full}) requests complete history. CLI calls retain full replies unless --compact is supplied.\n");
411
+ process.stdout.write(command === "list" ? JSON.stringify({ tools: schemas([...toolList(undefined, false, true, false, true), ...overseerTools]) }, null, 2) + "\n" : "Usage: node mcp.mjs list | call <tool> '<json>' [--compact]\nNative MCP returns compact receipts; workspace_status({detail:full}) requests complete evidence; history=<kind> pages finished items. CLI calls retain full replies unless --compact is supplied.\n");
404
412
  } else if (command === "call") {
405
413
  try {
406
414
  const tool = [...toolList(undefined, false, await briefEnabled(), false, await actionsEnabled()), ...(await overseerEnabled() ? overseerTools : [])].find(t => t[0] === process.argv[3]);
@@ -15,6 +15,8 @@ type Update = {
15
15
  question?: string;
16
16
  /** While blocked: what the ask wants of the developer, a decision or an action they take and report back. */
17
17
  need?: "decision" | "action";
18
+ /** Background for whoever works it (Make a task: the question and its answer). Kept when an update leaves it out. */
19
+ note?: string;
18
20
  dependencyStage?: "merged" | "deployed"; enable_follow_up?: boolean; communication?: Pick<Communication, "threadUrl" | "recipient"> & Partial<Communication>;
19
21
  trigger?: TaskTriggerInput | TaskTrigger | null;
20
22
  /** due-by-fact: when to look at it again, "YYYY-MM-DD" or an ISO time. An open task with no PRs gets RECHECK_DAYS out by default. */
@@ -101,8 +103,9 @@ export function updateObligation(w: Workspace, input: Update): Obligation {
101
103
  if (recheckAt) existing.recheckAt = recheckAt; else delete existing.recheckAt;
102
104
  if (finishedAt) existing.finishedAt = finishedAt; else delete existing.finishedAt;
103
105
  if (pointed && ask) existing.coveredBy = pointed.id;
106
+ if (input.note) existing.note = input.note;
104
107
  return existing;
105
108
  }
106
- const added = { ...record, ...(recheckAt ? { recheckAt } : {}), ...(finishedAt ? { finishedAt } : {}), ...(ask ? { ask } : {}), ...(need ? { need } : {}), ...(pointed && ask ? { coveredBy: pointed.id } : {}), ...(input.caller ? { createdBy: input.caller } : {}), id: randomUUID(), revision: 0 };
109
+ const added = { ...record, ...(recheckAt ? { recheckAt } : {}), ...(finishedAt ? { finishedAt } : {}), ...(ask ? { ask } : {}), ...(need ? { need } : {}), ...(pointed && ask ? { coveredBy: pointed.id } : {}), ...(input.caller ? { createdBy: input.caller } : {}), ...(input.note ? { note: input.note } : {}), id: randomUUID(), revision: 0 };
107
110
  w.obligations.push(added); return added;
108
111
  }
@@ -1,4 +1,6 @@
1
1
  import { execFile } from "node:child_process";
2
+ import { z } from "zod";
3
+ import type { AgentToolDefinition } from "@getpaseo/plugin/server";
2
4
  import { hookSource } from "./hook-source";
3
5
  import { hasHooks, isAcp } from "../shared/provider-support";
4
6
 
@@ -75,7 +77,23 @@ export function hooklessParts(env: Readonly<Record<string, string | undefined>>,
75
77
  return env.FOLLOW_UP_ROOT === "1" || tracked ? [...parts, "checks"] : parts;
76
78
  }
77
79
 
78
- type OpenRequest = { agentId?: string; provider: string; purpose: string; env: Record<string, string>; appendSystemPrompt?: string[] };
80
+ type OpenRequest = { agentId?: string; provider: string; purpose: string; env: Record<string, string>; appendSystemPrompt?: string[]; tools?: AgentToolDefinition[] };
81
+
82
+ /** The tool an ACP agent reads Follow-up's instructions through (Paseo doesn't pass a plugin's system prompt to ACP). */
83
+ export const INSTRUCTIONS_TOOL = "follow_session_instructions";
84
+ /**
85
+ * Follow-up's instructions as a tool: its description is in the agent's context on every turn (tool lists reach ACP
86
+ * agents through Paseo's MCP), and it tells the agent to read them first. The text is what the system prompt would
87
+ * have carried, fixed at session open like a system prompt.
88
+ */
89
+ export function instructionsTool(text: string): AgentToolDefinition {
90
+ return {
91
+ name: INSTRUCTIONS_TOOL,
92
+ description: "Follow-up's instructions for this session. Call this once at the start of the session and again after compaction, before any other follow_ tool, and follow what it returns.",
93
+ input: z.object({}).strict(),
94
+ execute: () => ({ text }),
95
+ };
96
+ }
79
97
  export type PromptDeps = {
80
98
  /** The host takes `appendSystemPrompt` from a session-open hook (Paseo 0.17+). */
81
99
  hostSupports(): Promise<boolean>;
@@ -102,12 +120,21 @@ export async function withSystemPrompt<R extends OpenRequest>(request: R, deps:
102
120
  if (request.purpose !== "interactive") return request;
103
121
  const native = request.env.FOLLOW_UP_TOOLS === "native";
104
122
  const hooked = hasHooks(request.provider);
105
- // An ACP agent never receives appendSystemPrompt (Paseo 0.17.4), so nothing is claimed as sent: no text, no env.
106
- if (!hooked && await (deps.acp?.(request.provider) ?? Promise.resolve(isAcp(request.provider))).catch(() => isAcp(request.provider))) return request;
123
+ // An ACP agent never receives appendSystemPrompt (Paseo 0.17.4): the same text goes in a tool it is told to read
124
+ // first (instructionsTool), and no env claims a system prompt it never got.
125
+ const acp = !hooked && await (deps.acp?.(request.provider) ?? Promise.resolve(isAcp(request.provider))).catch(() => isAcp(request.provider));
107
126
  // Without a hook, the system prompt is the only way Follow-up's text reaches the agent (an-agent-on-any-provider-gets-follow-up).
108
127
  const workspace = hooked || request.env.FOLLOW_UP_RECOVERY === "1" || !request.agentId || !deps.workspace ? null : await deps.workspace(request.agentId, native).catch(() => null);
109
128
  const wanted = hooked ? promptParts(request.env) : hooklessParts(request.env, !!workspace);
110
129
  if (!wanted.length && !workspace) return request;
130
+ if (acp) {
131
+ if (!Array.isArray(request.tools) || request.tools.some(t => t.name === INSTRUCTIONS_TOOL)) return request;
132
+ const bridge = await deps.bridge().catch(() => null);
133
+ if (!bridge) return request;
134
+ const { parts, text } = promptText(wanted, bridge, native);
135
+ if (!parts.length && !workspace) return request;
136
+ return { ...request, tools: [...request.tools, instructionsTool([...(workspace ? [workspace] : []), ...text].join("\n\n"))] };
137
+ }
111
138
  if (!(await deps.hostSupports().catch(() => false))) return request;
112
139
  if (hooked && !(await deps.providerSupports(request.provider).catch(() => false))) return request;
113
140
  const bridge = await deps.bridge().catch(() => null);
@@ -0,0 +1,133 @@
1
+ import { hookSource } from "./hook-source";
2
+ import { pickNudges, type DueEntry, type NudgeReceipt } from "../shared/task-due";
3
+ import { providerCaps } from "../shared/provider-support";
4
+ import { messageSender } from "../shared/message-sender";
5
+ import { startsTurn } from "./turn-timeline";
6
+ import { compactionOnly } from "./inbox-classifier";
7
+
8
+ /**
9
+ * Turn-end checks for a provider without Follow-up's hook (an-agent-on-any-provider-gets-follow-up). Claude Code and
10
+ * Codex get them from the Stop hook (server/agent-hook.mjs); every other provider gets the same checks from Paseo's
11
+ * turn-end event, with the hook's own words: the sync reminder after a turn that changed something and didn't sync,
12
+ * the needs_you nudge, and the due tasks.
13
+ *
14
+ * The Stop hook blocks the stop; an event can't, so the checks go as one queued message (invariant 36) after the turn,
15
+ * and only when something is due: a quiet turn sends nothing. It never loops: the turn that message starts is never
16
+ * checked (one reply, like the hook's stop_hook_active), told from the turn's own prompt, so a worker restart between
17
+ * the message and its reply can't start a loop. The needs_you nudge, which a hook gives in-turn for free but costs a
18
+ * whole turn here, follows only a turn the developer started (their message, or their answer from a card); never a
19
+ * repair, a recovery, another agent's message, or a turn whose prompt the read didn't reach. It never wakes a dormant agent: it runs only on a turn that
20
+ * just ended, and the queue sends only to that loaded agent. Due tasks share the hook's receipt (at most 3 a turn end,
21
+ * each at most twice and once a day).
22
+ */
23
+
24
+ const literal = (name: string): string => {
25
+ const m = hookSource.match(new RegExp(`export const ${name} = (.+?);\\n`));
26
+ if (!m) throw new Error(`turn-end: the hook no longer exports ${name}`);
27
+ return JSON.parse(m[1]!) as string;
28
+ };
29
+ export const STOP_REASON = literal("stopReason");
30
+ export const NUDGE_REASON = literal("nudgeReason");
31
+ export const DUE_HEADER = literal("dueHeader");
32
+ const TOOL_NAMES = (() => { const m = hookSource.match(/export const TOOL_NAMES = (\[.+?\]);\n/); return m ? JSON.parse(m[1]!) as string[] : []; })();
33
+ const toolPattern = new RegExp(`(?<![\\w])(${TOOL_NAMES.join("|")})(?![\\w])`, "g");
34
+ /** Follow-up's tools under the names a native session has them (the hook's `named`). */
35
+ const named = (text: string) => text.replace(toolPattern, "follow_$1");
36
+ /** The first line of every turn-end message: how the agent, the inbox and the tests tell it apart. */
37
+ export const TURN_END_PREFIX = literal("turnEndPrefix");
38
+
39
+ export type TurnEndEntry = { role: "main" | "contributor" | "recovery"; workspaceId: string; due?: DueEntry[] };
40
+ export type TurnEndInput = {
41
+ provider: string;
42
+ /** scopes.json's entry for this agent, null when it isn't tracked. */
43
+ entry: TurnEndEntry | null;
44
+ /** The ended turn's timeline items (the read the worker already made), null when there was none. */
45
+ items: readonly unknown[] | null;
46
+ /** When this turn started, as the worker saw it; null when it didn't (a worker that started mid-turn). */
47
+ startedAt: number | null;
48
+ /** The workspace's last confirmed sync for this agent (sync_workspace), if any. */
49
+ syncedAt: number | null;
50
+ /** The agent's last needs_you, if any. */
51
+ needsYouAt: number | null;
52
+ /** The inbox and its nudge are on, and this agent has no permission prompt showing. */
53
+ nudge: boolean;
54
+ receipt: NudgeReceipt;
55
+ now: number;
56
+ };
57
+
58
+ /** A tool call that isn't Follow-up's own (a shell, an edit, a write…): the turn changed something worth syncing. */
59
+ function changedSomething(items: readonly unknown[] | null): boolean {
60
+ return (items ?? []).some(i => {
61
+ const item = i as { type?: string; name?: unknown };
62
+ if (item?.type !== "tool_call" || typeof item.name !== "string") return false;
63
+ return !/(^|[._/])follow_[a-z_]+$|^wait_|^(?:mcp__)?follow-up(?:__|[.:/])/.test(item.name);
64
+ });
65
+ }
66
+
67
+ /** Who started the turn, from its prompt (the first item that starts a turn in the read); null when it isn't there. */
68
+ export function turnPrompt(items: readonly unknown[] | null): "developer" | "turn-end" | "other" | null {
69
+ const first = (items ?? []).find(startsTurn) as { type?: string; text?: unknown } | undefined;
70
+ if (!first) return null;
71
+ if (first.type !== "user_message" || typeof first.text !== "string") return "other";
72
+ if (first.text.startsWith(TURN_END_PREFIX)) return "turn-end";
73
+ const sender = messageSender(first.text);
74
+ return sender.kind === "developer" || sender.kind === "follow-up" && sender.what === "answer" ? "developer" : "other";
75
+ }
76
+
77
+ /** What the turn end says, or null for nothing (the common case), and the due-task receipt to keep. Pure. */
78
+ export function turnEndCheck(i: TurnEndInput): { text: string | null; receipt: NudgeReceipt | null } {
79
+ if (providerCaps(i.provider).turnEnd !== "event" || !i.entry || i.entry.role === "recovery") return { text: null, receipt: null };
80
+ const prompt = turnPrompt(i.items);
81
+ // The reply to our own message is never checked (the loop guard that survives a restart).
82
+ if (prompt === "turn-end") return { text: null, receipt: null };
83
+ const since = i.startedAt ?? i.now;
84
+ const sync = changedSomething(i.items) && !(i.syncedAt !== null && i.syncedAt >= since);
85
+ const nudge = i.entry.role === "main" && i.nudge && prompt === "developer" && !(i.needsYouAt !== null && i.needsYouAt >= since);
86
+ const picked = i.entry.due?.length ? pickNudges(i.entry.due, i.receipt, i.now) : { lines: [], receipt: i.receipt };
87
+ if (!sync && !nudge && !picked.lines.length) return { text: null, receipt: null };
88
+ const parts = [
89
+ picked.lines.length ? named(DUE_HEADER) + "\n" + picked.lines.map(l => `- ${l}`).join("\n") : null,
90
+ sync ? `${STOP_REASON} This is metadata bookkeeping only; do not start queued repairs or recovery. Call ${named("sync_workspace")} with a short summary; pass milestone when the milestone you're on changed.` : null,
91
+ nudge ? named(NUDGE_REASON) : null,
92
+ ].filter(Boolean);
93
+ return { text: `${TURN_END_PREFIX} your turn ended with this still open. Handle it, then stop without repeating your reply.\n\n${parts.join("\n\n")}`, receipt: picked.lines.length ? picked.receipt : null };
94
+ }
95
+
96
+ export type TurnEndDeps = {
97
+ input(agentId: string, provider: string, items: readonly unknown[] | null, startedAt: number | null): Promise<Omit<TurnEndInput, "provider" | "items" | "startedAt" | "now"> | null>;
98
+ saveReceipt(workspaceId: string, receipt: NudgeReceipt): Promise<void>;
99
+ /** Queues the message for this agent (message-queue.ts); returns once it is saved. */
100
+ send(agentId: string, workspaceId: string, text: string, turnId: string | null): Promise<void>;
101
+ now?: () => number;
102
+ };
103
+
104
+ /** The worker's side: when turns start, which turn a check's own message started, and the send. */
105
+ export class TurnEnd {
106
+ private started = new Map<string, number>();
107
+ /** Agents whose next turn was started by a turn-end message: that turn is never checked. */
108
+ private answering = new Set<string>();
109
+ constructor(private d: TurnEndDeps) {}
110
+
111
+ turnStarted(agentId: string): void { this.started.set(agentId, (this.d.now ?? Date.now)()); }
112
+
113
+ async turnEnded(agent: { id: string; provider: string; parentAgentId: string | null }, outcome: { kind: string }, turnId: string | null, items: readonly unknown[] | null): Promise<string | null> {
114
+ const startedAt = this.started.get(agent.id) ?? null;
115
+ this.started.delete(agent.id);
116
+ if (providerCaps(agent.provider).turnEnd !== "event" || agent.parentAgentId) return null;
117
+ // The reply to our own message: never checked, so a check can't start a loop.
118
+ if (this.answering.delete(agent.id)) return null;
119
+ if (outcome.kind !== "completed") return null;
120
+ // A turn that only compacted isn't the agent finishing: nothing to check (a-compaction-is-not-a-finish).
121
+ if (items && compactionOnly(items)) return null;
122
+ const base = await this.d.input(agent.id, agent.provider, items, startedAt);
123
+ if (!base?.entry) return null;
124
+ const now = (this.d.now ?? Date.now)();
125
+ const { text, receipt } = turnEndCheck({ ...base, provider: agent.provider, items, startedAt, now });
126
+ if (!text) return null;
127
+ if (receipt) await this.d.saveReceipt(base.entry.workspaceId, receipt).catch(() => undefined);
128
+ this.answering.add(agent.id);
129
+ try { await this.d.send(agent.id, base.entry.workspaceId, text, turnId); }
130
+ catch { this.answering.delete(agent.id); return null; }
131
+ return text;
132
+ }
133
+ }