paseo-follow-up 1.4.0-beta.23 → 1.4.0-beta.25

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  What changed in each version of Follow-up, newest first. Follow-up shows these in "What's new" after an update, and in full from Home's last line.
4
4
 
5
+ ## 1.4.0-beta.25 (2026-11-10)
6
+
7
+ - A question an agent asks again no longer shows up twice in Needs you. Agents get the open question back, and existing duplicates close on update.
8
+
9
+ ## 1.4.0-beta.24 (2026-11-10)
10
+
11
+ - Claude agents now keep working while a long command runs, checking on it at least once a minute instead of ending their turn to wait. Turn it off in Settings → Agents → Wait for background jobs.
12
+ - This replaces the separate Wait plugin. While that plugin is installed, Follow-up's own Wait stays off and Settings says so.
13
+
5
14
  ## 1.4.0-beta.23 (2026-11-10)
6
15
 
7
16
  - After an update, "What's new" shows the notes for every version since you last looked, once on each device.
package/OVERVIEW.md CHANGED
@@ -28,7 +28,7 @@ Auto-send ("Send repairs automatically") is on by default for every followed wor
28
28
 
29
29
  ### What agents can do for you
30
30
 
31
- Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags`, `set_priorities` and the read-only `workspace_about` (a workspace's overview and linked items) and `release_notes` (the installed version and its notes) (external priorities for Home's Priority sort, kept in `plugin-data/follow-through/priorities.json`). Each runs the server path its button runs, with the same guards (tracked workspace, hold, PR eligibility, merge blockers), across every tracked workspace, so an orchestrating agent can act "on all" when you ask it to. Tools that act on a list, and merge, return a dry run and run only with `confirm: true` and that plan's id; merge is marked destructive and the list tools read-only. Inbox tools act on other agents only: an agent can't sign itself off. Recovery agents, contributors and subagents never get them, and the daemon re-checks the caller on each call. Each agent action is kept in the inbox's delivery ledger as `by: "agent:<id>"`; it never counts as you writing to an agent. A sign-off is still a sign-off made on your behalf, so it clears the flag. There is no tool to untrack or archive a workspace, or to put one on hold, because Follow-up has no button for those either.
31
+ Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags`, `set_priorities`, `set_wait_for_jobs` and the read-only `workspace_about` (a workspace's overview and linked items) and `release_notes` (the installed version and its notes) (external priorities for Home's Priority sort, kept in `plugin-data/follow-through/priorities.json`). Each runs the server path its button runs, with the same guards (tracked workspace, hold, PR eligibility, merge blockers), across every tracked workspace, so an orchestrating agent can act "on all" when you ask it to. Tools that act on a list, and merge, return a dry run and run only with `confirm: true` and that plan's id; merge is marked destructive and the list tools read-only. Inbox tools act on other agents only: an agent can't sign itself off. Recovery agents, contributors and subagents never get them, and the daemon re-checks the caller on each call. Each agent action is kept in the inbox's delivery ledger as `by: "agent:<id>"`; it never counts as you writing to an agent. A sign-off is still a sign-off made on your behalf, so it clears the flag. There is no tool to untrack or archive a workspace, or to put one on hold, because Follow-up has no button for those either.
32
32
 
33
33
  ## Data and access
34
34
 
@@ -51,4 +51,6 @@ Settings → Agents (`plugin-data/follow-through/agents.json`, its own file) cho
51
51
 
52
52
  The ranker behind AI priority (beta) runs inside Follow-up's worker as bounded one-shot jobs (Claude or Codex, per the ranker role) through the shared job runner (`server/ai-jobs.ts`), one at a time and only while the resource governor allows background work. It reads Follow-up's own state, `mcpproxy call tool-read` for `linear:list_issues` (assigned to you) and `slack-user:slack_search_public_and_private` (DMs and mentions, last 48 hours), `gh search prs --review-requested=@me`, and the planning artifact through one Claude turn limited to the Artifact tool. It hashes those inputs and calls the model only when they changed. It writes only `plugin-data/follow-through/priorities.json` (its ranking, which replaces its previous one) and `ranker.json` (input hash, run count, source health, the day's plan summary, and Linear issues no workspace covers). It never stores raw artifact HTML or share keys. The provider, model, cadence and daily cap come from the ranker role in Settings → Agents; the plan reader always uses Claude, the only provider with the Artifact tool.
53
53
 
54
+ Wait for background jobs (1.4.0-beta.24, folded in from the standalone paseo-wait plugin) attaches `wait_prepare_job`, `wait_for_job` and `wait_get_job` to every interactive Claude session as native plugin tools, with `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0` in that session's environment (Claude Code then never backgrounds a long MCP call, Wait's or another's) and `FOLLOW_THROUGH_WAIT=1`, which makes the provider hook add Wait's guidance once at SessionStart. It keeps job records in `plugin-data/follow-through/wait/jobs/<agentId>/<jobId>/` (`job.json`, a `started` marker and the exit receipt `result.json`) and a shell runner, `wait/run-job.sh`, that the agent's own Bash tool runs; the worker never runs the command. A job is readable only by the agent id and working directory the daemon reports for the caller. A wait holds two timers and refreshes that one agent at most once a second to notice a new message, and only while it waits. It is off when Settings → Agents says so (`enable_wait: false` in `agents.json`), when Paseo's `config.json` lists the standalone `paseo-wait` plugin as installed and not disabled, when the host doesn't serve plugin tools, and for agents labelled `follow-up-wait/enabled=false`, `paseo-wait/enabled=false` or `plugin-tools/enabled=false`. Records are never deleted automatically.
55
+
54
56
  Getting started keeps only its own progress in `plugin-data/follow-through/onboarding.json`: whether this host was a fresh or existing install when this version first started (existing if `state.json`, `inbox.json`, `reviewers.json`, `agents.json` or `brief.json` was already there), the current step, and whether the existing-install offer was shown or dismissed. An unreadable file counts as finished, so setup is never forced. Its choices are written through the same RPCs and display settings the Settings screen uses. The readiness checks run only when setup asks for them, at most once a minute unless you press Check again: `gh api user` on the daemon host, Paseo's provider snapshot (the same cached read Settings → Agents uses), Paseo's `config.json`, and the count of `hook-state/native-*.json` files. They never read an agent's timeline.
package/README.md CHANGED
@@ -204,12 +204,24 @@ Settings → **Agents** has one card for each agent Follow-up runs for you. Each
204
204
 
205
205
  The choices live in `agents.json` in Follow-up's data folder. Anything missing or invalid there falls back to the default. Agents can read the choices with the read-only `agent_settings` tool. The About footer names the model that wrote each overview ("Summarized by Haiku · 2h ago").
206
206
 
207
+ ### Wait for background jobs (1.4.0-beta.24)
208
+
209
+ Claude agents often start a long command in the background (tests, a build, a deploy check) and then end their turn "waiting for a notification", which leaves the workspace looking idle while it isn't done. With **Wait for background jobs** (Settings → Agents, on by default), every Claude agent Paseo starts gets three small tools:
210
+
211
+ 1. `wait_prepare_job({description, command})` records the job and returns a `bashCommand`. It runs nothing.
212
+ 2. The agent runs that exact command with Bash in the background, as it would anyway.
213
+ 3. `wait_for_job({jobId})` keeps the agent Running for up to 60 seconds (30 by default) and returns **completed** or **failed** with the exit code, **still_pending** (the agent checks the output with `wait_get_job` and waits again) or **new_message** (you wrote to it).
214
+
215
+ Only the command's exit receipt counts as done. Stop ends the wait without killing the command, and a new message ends it too. Each agent sees only its own jobs, and the records survive Follow-up updates. Nothing runs while no agent is waiting: no extra process, no port, no polling.
216
+
217
+ This replaces the separate **Wait** plugin (`paseo-wait`). While that plugin is installed and enabled, Follow-up's Wait stays off and Settings says so. Disable or remove it to switch: `paseo plugin disable paseo-wait`. Agents opened afterwards get Follow-up's Wait; already-open sessions switch on their next prompt. Wait needs Paseo 0.15+ with its agent tools on (the default). To leave one agent without it, give the agent the label `follow-up-wait/enabled=false` (the older `paseo-wait/enabled=false` and `plugin-tools/enabled=false` also work).
218
+
207
219
  ![Home with the Overseer selected: the pinned row asks which agent should take a broken export, and the pane shows the conversation, the routed task and the decision with two candidates plus New workspace](docs/media/overseer/overseer-dark.png)
208
220
 
209
221
  Install the beta:
210
222
 
211
223
  ```sh
212
- paseo plugin update follow-through --version 1.4.0-beta.23
224
+ paseo plugin update follow-through --version 1.4.0-beta.25
213
225
  # or, for a fresh install:
214
226
  paseo plugin install npm:paseo-follow-up@beta
215
227
  ```
@@ -243,6 +255,7 @@ Tell an agent "the PRs look good, assign reviewers on all" and it can do it. Eve
243
255
  | `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track` | **Send**, the **Auto-send** switch, **Resume**, **Retry**, following a workspace again after an opt-out. |
244
256
  | `set_priorities` | Stores external priorities for Home's Priority sort: per workspace a score 0–100, a one-line reason and sources (Linear, Slack, planning, GitHub, Paseo). Plans first; `confirm: true` with the plan id stores them. Used for 6 hours. |
245
257
  | `inbox_list`, `sign_off`, `snooze`, `set_finish_flags` | The Needs-you list, **Sign off**, **Later** and **Don't flag finishes**, for other agents only. |
258
+ | `agent_settings`, `set_wait_for_jobs` | Reads Settings → Agents; turns **Wait for background jobs** on or off (plans first). |
246
259
 
247
260
  Tools that act on a list, and merge, return a dry run first and act only when called again with `confirm: true` and that plan's id. Their descriptions tell the agent to use them only when you asked. An agent can't sign itself off. Recovery agents, contributors and subagents don't get these tools, and the daemon checks the caller again on every call.
248
261
 
package/client/agents.tsx CHANGED
@@ -2,9 +2,10 @@ import type { ReactNode } from "react";
2
2
  import { ActivityIndicator, Text, View } from "react-native";
3
3
  import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
4
4
  import { useRpc } from "@getpaseo/plugin/client";
5
- import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, SettingsSwitch, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
- import { agentSettingsRpc, setAgentSettingRpc } from "../shared/contracts";
7
+ import { agentSettingsRpc, setAgentSettingRpc, setWaitRpc } from "../shared/contracts";
8
+ import { WAIT_HINT, WAIT_NOT_ATTACHED, WAIT_TITLE, waitNote } from "../shared/wait";
8
9
  import { AGENT_ROLES, JOB_PROVIDERS, ROLE_DEFAULTS, ROLE_INFO, isJobRole, modelName, providerName, type AgentRole, type AgentSettingsView, type CatalogProvider, type SavedRole } from "../shared/agent-settings";
9
10
  import { Button, errorText, text, type Theme } from "./kit";
10
11
 
@@ -54,6 +55,33 @@ export function AgentSettings({ theme, compact, toggles = {} }: Pick<PluginSurfa
54
55
  </SettingsSection>;
55
56
  }
56
57
 
58
+ /**
59
+ * Settings → Agents → Wait for background jobs: one switch, on by default. Shares the Agents screen's query, so it
60
+ * costs no extra read. When the switch is on but Wait isn't attached (the standalone plugin is installed, or the host
61
+ * doesn't serve plugin tools), an amber alert under it says so and what to do; the hint stays.
62
+ */
63
+ export function WaitSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
64
+ const c = theme.colors; const t = text(c);
65
+ const read = useRpc(agentSettingsRpc); const write = useRpc(setWaitRpc); const cache = useQueryClient(); const toast = useToast();
66
+ const query = useQuery({ queryKey: key, queryFn: () => read({ catalog: true }), staleTime: 5 * 60_000 });
67
+ const change = useMutation({
68
+ mutationFn: (enable_wait: boolean) => write({ enable_wait }),
69
+ onSuccess: value => { cache.setQueryData(key, value); toast.show(`${WAIT_TITLE}: ${value.wait?.enable_wait ? "on" : "off"}`, { variant: "success" }); },
70
+ onError: error => toast.error(errorText(error)),
71
+ });
72
+ const wait = query.data?.wait;
73
+ const note = wait ? waitNote(wait) : null;
74
+ return <SettingsSection title="Background jobs">
75
+ {/* The card's place is kept while loading, so the Models section below doesn't jump. */}
76
+ {query.isPending && <SettingsCard><View style={{ minHeight: 72, justifyContent: "center", paddingHorizontal: 16 }}><ActivityIndicator accessibilityLabel="Loading the Wait setting" color={c.foregroundMuted} style={{ alignSelf: "flex-start" }} /></View></SettingsCard>}
77
+ {query.error && <SettingsCard><SettingsAction label="Couldn't load the Wait setting" hint={errorText(query.error)} actionLabel="Retry" onPress={() => void query.refetch()} /></SettingsCard>}
78
+ {wait && <SettingsCard>
79
+ <SettingsSwitch label={WAIT_TITLE} hint={WAIT_HINT} value={wait.enable_wait} disabled={change.isPending} onValueChange={value => change.mutate(value)} />
80
+ {note && wait.enable_wait && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning, paddingHorizontal: 16, paddingBottom: 12 }]}>{`${WAIT_NOT_ATTACHED} ${note}`}</Text>}
81
+ </SettingsCard>}
82
+ </SettingsSection>;
83
+ }
84
+
57
85
  function RoleCard({ r, invalid, catalog, busy, save, theme, compact, toggle }: { r: Role; invalid: boolean; catalog: CatalogProvider[]; busy: boolean; save: (entry: SavedRole | null) => void; theme: Theme; compact: boolean; toggle?: ReactNode }) {
58
86
  const c = theme.colors; const t = text(c);
59
87
  const role = r.role;
@@ -9,7 +9,7 @@ import { followSettingsRpc, projectSettingsRpc, setFollowSettingsRpc, setProject
9
9
  import { Switch, bottomInset, errorText, space, text, type Theme } from "./kit";
10
10
  import { DisplaySections, PermissionsSection, PreferenceSwitch } from "./display";
11
11
  import { ReviewerSettings, reviewerSettingsKey } from "./reviewers";
12
- import { AgentSettings, agentSettingsKey } from "./agents";
12
+ import { AgentSettings, WaitSettings, agentSettingsKey } from "./agents";
13
13
  import { ShippingSettings } from "./shipping";
14
14
  import { BackHeader, CategoryList, CategoryTabs, Disclosure } from "./settings-shell";
15
15
  import {
@@ -161,10 +161,11 @@ function WorkspacesFold({ theme, compact, all, autoDefault, busy, set }: { theme
161
161
  </Disclosure>;
162
162
  }
163
163
 
164
- /** Agents: Questions, then the four agent cards. The Overseer and AI priority switches lead their own cards. */
164
+ /** Agents: Questions, Wait for background jobs, then the four agent cards. The Overseer and AI priority switches lead their own cards. */
165
165
  function AgentsCategory({ theme, compact }: { theme: Theme; compact: boolean }) {
166
166
  return <>
167
167
  <QuestionSettings theme={theme} />
168
+ <WaitSettings theme={theme} />
168
169
  <AgentSettings theme={theme} compact={compact} toggles={{ overseer: <PreferenceSwitch field="enable_overseer" theme={theme} />, ranker: <PreferenceSwitch field="enable_ranker" theme={theme} /> }} />
169
170
  </>;
170
171
  }
package/index.server.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { displayPreferences } from "./shared/display";
2
- import { DEFAULT_QUESTION_MODE, questionPreferences, type QuestionMode } from "./shared/questions";
3
- import { askQuestion, recordAnswer, syncTaskQuestions, withdrawQuestion } from "./server/questions";
2
+ import { DEFAULT_QUESTION_MODE, QUESTION_DEDUPE_MIGRATION, collapseDuplicateQuestions, questionPreferences, type QuestionMode } from "./shared/questions";
3
+ import { askQuestion, needsYouQuestions, recordAnswer, syncTaskQuestions, withdrawQuestion } from "./server/questions";
4
4
  import { agentSetSpec, developerSetSpec } from "./server/spec";
5
- import type { PluginServerContext, PluginHandlerContext } from "@getpaseo/plugin/server";
5
+ import type { PluginServerContext, PluginHandlerContext, PluginHookContext, PluginSessionOpenRequest } from "@getpaseo/plugin/server";
6
6
  import { mkdir, writeFile } from "node:fs/promises";
7
7
  import { existsSync, mkdirSync, renameSync, writeFileSync } from "node:fs";
8
8
  import { join } from "node:path";
@@ -31,6 +31,7 @@ import { Deployments } from "./server/deployments";
31
31
  import { AgentHooks } from "./server/agent-hooks";
32
32
  import { withSessionMcp } from "./server/session-mcp";
33
33
  import { nativeTools, nativeToolsAvailable, type Invoke, type Live } from "./server/native-tools";
34
+ import { Wait, waitStatus, type WaitPaseoConfig } from "./server/wait";
34
35
  import { removeGlobalRegistrations } from "./server/mcp-registrations";
35
36
  import { TrustBypass } from "./server/trust-bypass";
36
37
  import { scopes } from "./server/scopes";
@@ -180,13 +181,18 @@ export default function contribute(server: PluginServerContext) {
180
181
  // moved past closes its still-open questions so the panel doesn't keep stale ones.
181
182
  async settled(agentId, brief) {
182
183
  if (brief.state !== "answered" && brief.state !== "superseded") return;
184
+ const latest = await readFile(needsYouPath(agentId), "utf8").then(t => JSON.parse(t) as NeedsYouRecord).catch(() => null);
183
185
  await store.mutate(state => {
184
186
  const w = state.workspaces.find(w => w.enable_tracking && w.mainAgentId === agentId);
185
187
  if (!w) return;
186
188
  const at = brief.outcomeAt ?? new Date().toISOString();
189
+ // A question this agent still points at (its newest needs_you), or one it asked with ask_question, outlives
190
+ // an old brief: only the brief's own decisions close with it.
191
+ const current = new Set(latest?.questionIds ?? []);
187
192
  for (const d of brief.decisions) {
188
193
  const q = w.questions.find(q => q.id === d.id && brief.questionIds.includes(q.id));
189
194
  if (!q || q.answer || q.closed) continue;
195
+ if (brief.state === "superseded" && (current.has(q.id) || q.via === "ask")) continue;
190
196
  if (brief.state === "answered" && d.chosen) q.answer = { choice: d.chosen, at, by: "developer", delivery: { state: "sent", to: agentId, messageId: null, at, reason: null } };
191
197
  else if (brief.state === "superseded") q.closed = { at, reason: "The agent kept going past this brief.", by: null };
192
198
  }
@@ -253,6 +259,20 @@ export default function contribute(server: PluginServerContext) {
253
259
  for (const w of preview.workspaces) await archive(w.id, pruneUnsent(w));
254
260
  await store.mutate(state => { for (const w of state.workspaces) pruneUnsent(w); state.migrations = [...state.migrations ?? [], PRUNE_MIGRATION]; });
255
261
  };
262
+ /**
263
+ * 1.4.0-beta.25: once, collapse open questions that were asked twice or more (see collapseDuplicateQuestions). The
264
+ * oldest stays open; answered ones are never touched. Backed up first, like the other migrations.
265
+ */
266
+ const dedupeQuestions = async () => {
267
+ if ((await store.snapshot()).migrations?.includes(QUESTION_DEDUPE_MIGRATION)) return;
268
+ await copyFile(join(directory, "state.json"), join(directory, "state.before-question-dedupe.json.bak"), 1).catch(error => { if (!["ENOENT", "EEXIST"].includes((error as NodeJS.ErrnoException).code ?? "")) throw error; });
269
+ await store.mutate(state => {
270
+ const now = Date.now();
271
+ // Not changed(w): closing a duplicate must not reopen a declared completion.
272
+ for (const w of state.workspaces) if (collapseDuplicateQuestions(w.questions, now).length) w.updatedAt = new Date(now).toISOString();
273
+ state.migrations = [...state.migrations ?? [], QUESTION_DEDUPE_MIGRATION];
274
+ });
275
+ };
256
276
  /** 1.3.0-beta.3: back up once before the active-scope migration (applied by the engine after its first discovery). */
257
277
  const backupActiveScope = async () => {
258
278
  if ((await store.snapshot()).migrations?.includes(ACTIVE_SCOPE_MIGRATION)) return;
@@ -269,6 +289,7 @@ export default function contribute(server: PluginServerContext) {
269
289
  governor.start();
270
290
  await engine.recover();
271
291
  await migrateTracking();
292
+ await dedupeQuestions();
272
293
  await backupActiveScope();
273
294
  // Reviewers: the one-time seed from earlier requests, before history is pruned. An unreadable reviewers.json only affects Add reviewers.
274
295
  await reviewerStore.migrate(await store.snapshot()).catch(() => undefined);
@@ -289,6 +310,9 @@ export default function contribute(server: PluginServerContext) {
289
310
  const paseoConfig = async () => {
290
311
  try { const path = join(paseoHome, "config.json"); const { mtimeMs } = await stat(path); if (configCache?.mtimeMs !== mtimeMs) configCache = { mtimeMs, value: JSON.parse(await readFile(path, "utf8")) }; return configCache.value as Parameters<typeof nativeToolsAvailable>[1]; } catch { return null; }
291
312
  };
313
+ // Wait for background jobs (folded in from paseo-wait): native tools for interactive Claude sessions.
314
+ const wait = new Wait(join(directory, "wait"), { enabled: () => agentSettings.waitEnabled(), config: async () => await paseoConfig() as WaitPaseoConfig | null });
315
+ const currentWait = async () => waitStatus(await agentSettings.waitEnabled(), await paseoConfig() as WaitPaseoConfig | null);
292
316
  const live = async (agentId: string): Promise<Live> => ({ role: scopes(await store.snapshot())[agentId]?.role ?? null, inbox: (await inboxSettings()).enable_inbox });
293
317
  const invoke: Invoke = async (method, input, context) => {
294
318
  const handler = handlers.get(method); if (!handler) throw new Error(`Unknown Follow-up method ${method}.`);
@@ -486,9 +510,10 @@ export default function contribute(server: PluginServerContext) {
486
510
  const mode = await questionMode();
487
511
  return store.mutate(state => {
488
512
  const w = agentWorkspace(state, agentId, "write", workspaceId);
489
- const { question, instruction } = askQuestion(w, agentId, input, mode, Date.now());
490
- changed(w);
491
- return { workspaceId: w.id, question, mode, instruction };
513
+ const { supersedes, ...ask } = input;
514
+ const { question, instruction, outcome, of } = askQuestion(w, agentId, ask, mode, Date.now(), { via: "ask", ...(supersedes ? { supersedes } : {}) });
515
+ if (outcome !== "duplicate") changed(w);
516
+ return { workspaceId: w.id, question, mode, instruction, outcome, of };
492
517
  });
493
518
  });
494
519
  handle(rpc.recordAnswerRpc, async ({ agentId, id, choice, words }, { paseo }) => {
@@ -686,7 +711,7 @@ export default function contribute(server: PluginServerContext) {
686
711
  const agentSettingsView = async (catalog: boolean, fresh = false): Promise<AgentSettingsView> => {
687
712
  const [{ invalid }, roles] = await Promise.all([agentSettings.load(), agentSettings.all()]);
688
713
  const cat = catalog ? await providerCatalog.read(fresh) : null;
689
- return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r, labelsFor(r, cat)) })), invalid, catalog: cat };
714
+ return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r, labelsFor(r, cat)) })), invalid, catalog: cat, wait: await currentWait() };
690
715
  };
691
716
  // What's new. Follow-up's own install comes from Paseo's plugin list, read once per worker.
692
717
  const versions = new VersionsStore(directory);
@@ -710,6 +735,7 @@ export default function contribute(server: PluginServerContext) {
710
735
  handle(rpc.whatsNewSeenRpc, async ({ version }) => { await versions.seen(version); return releaseNotesView(); });
711
736
  handle(rpc.agentSettingsRpc, async ({ catalog, fresh }, { paseo }) => { await requireReady(); seen(paseo); return agentSettingsView(!!catalog, !!fresh); });
712
737
  handle(rpc.setAgentSettingRpc, async ({ role, entry }, { paseo }) => { await requireReady(); seen(paseo); await agentSettings.save(role, entry); return agentSettingsView(true); });
738
+ handle(rpc.setWaitRpc, async ({ enable_wait }, { paseo }) => { await requireReady(); seen(paseo); await agentSettings.setWait(enable_wait); return agentSettingsView(true); });
713
739
  handle(rpc.overseerActRpc, async ({ agentId, tool, args }, { paseo }) => {
714
740
  await requireReady(); seen(paseo);
715
741
  if (!(OVERSEER_TOOLS as readonly string[]).includes(tool)) throw new Error(`Unknown Overseer tool ${tool}.`);
@@ -801,7 +827,7 @@ export default function contribute(server: PluginServerContext) {
801
827
  return result;
802
828
  },
803
829
  };
804
- const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings, prWorkflows: () => prWorkflowView(), rpc: rpcBridge, display: displayBridge,
830
+ const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings, wait: { status: currentWait }, prWorkflows: () => prWorkflowView(), rpc: rpcBridge, display: displayBridge,
805
831
  // The directory's agent list (metadata only): a claim never loads or refreshes the main agent.
806
832
  agentInfo: async agentId => { const row = gateway.directory.cached(agentId) ?? (await gateway.directory.read()).agents.find(r => r.agent.id === agentId)?.agent; return row ? { status: row.status, activeTurn: row.activeTurn, pendingPermissions: row.pendingPermissions, archivedAt: row.archivedAt } : null; } });
807
833
  handle(rpc.prioritiesRpc, async () => ({ items: await priorityStore.read() }));
@@ -837,7 +863,7 @@ export default function contribute(server: PluginServerContext) {
837
863
  // F2: root agents only. Contributors and recovery sessions report to the main agent; subagents to their parent.
838
864
  if (agent.labels["follow-through.recovery"] || tracked && tracked.mainAgentId !== agentId) throw new Error("needs_you is for the workspace's main agent. Report to the main agent instead.");
839
865
  if (!await isWorkspaceRoot(agent, async id => (await paseo.agents.ref(id).refresh())?.agent)) throw new Error("needs_you is for root agents. Report to your parent agent instead.");
840
- const call = validateNeedsYou(input, ref => {
866
+ let call = validateNeedsYou(input, ref => {
841
867
  const key = ref.trim().replace(/^#/, "");
842
868
  const match = tracked?.prs.find(p => p.key.toLowerCase() === key.toLowerCase()) ?? (tracked?.prs.filter(p => String(p.number) === key).length === 1 ? tracked.prs.find(p => String(p.number) === key) : undefined);
843
869
  if (!match) throw new Error(`No registered PR matches ${ref}. Register it with register_pr first, or give the link as url.`);
@@ -846,20 +872,22 @@ export default function contribute(server: PluginServerContext) {
846
872
  const turn = inbox.currentTurn(agentId);
847
873
  const previous = await readFile(needsYouPath(agentId), "utf8").then(t => JSON.parse(t) as NeedsYouRecord).catch(() => null);
848
874
  const sameTurn = !!previous && (turn?.turnId ? previous.turnId === turn.turnId : !!turn && previous.at >= turn.at);
849
- let questionIds: string[] = [];
875
+ let questionIds: string[] = []; let createdIds: string[] = [];
850
876
  if (tracked) {
851
877
  const mode = await questionMode();
852
- questionIds = await store.mutate(state => {
878
+ const linked = await store.mutate(state => {
853
879
  const w = findWorkspace(state, tracked.id);
854
- const now = Date.now();
855
- // Called twice in one turn: the last call wins, so the first call's questions close.
856
- if (sameTurn) for (const q of w.questions) if (previous!.questionIds?.includes(q.id) && !q.answer && !q.closed) q.closed = { at: new Date(now).toISOString(), reason: "Replaced by a newer needs_you call.", by: agentId };
857
- const ids = (call.decisions ?? []).map(d => askQuestion(w, agentId, { title: d.question.slice(0, 120), question: d.question, options: (d.options ?? []).map((o, i) => ({ letter: String.fromCharCode(65 + i), label: o.label, ...(o.consequence ? { consequence: o.consequence } : {}) })), ...(d.options?.length ? { recommend: String.fromCharCode(65 + d.recommend!) } : {}) }, mode, now).question.id);
858
- if (ids.length) changed(w);
859
- return ids;
880
+ const result = needsYouQuestions(w, agentId, call, mode, Date.now(), sameTurn ? previous : null);
881
+ if (result.questionIds.length || sameTurn) changed(w);
882
+ return result;
860
883
  });
861
- }
862
- const record: NeedsYouRecord = { at: Date.now(), turnId: turn?.turnId ?? null, call, questionIds };
884
+ questionIds = linked.questionIds; createdIds = linked.createdIds;
885
+ // The brief maps decisions to questions by position, so the record keeps them aligned (a linked question shows as itself).
886
+ const { questions: _refs, ...rest } = call;
887
+ call = { ...rest, ...(linked.decisions.length ? { decisions: linked.decisions } : {}) };
888
+ if (!linked.decisions.length) delete call.decisions;
889
+ } else if (call.questions?.length) throw new Error("questions point at a tracked workspace's open questions, and this workspace isn't tracked.");
890
+ const record: NeedsYouRecord = { at: Date.now(), turnId: turn?.turnId ?? null, call, questionIds, createdIds };
863
891
  await mkdir(join(directory, "hook-state"), { recursive: true, mode: 0o700 });
864
892
  const temporary = `${needsYouPath(agentId)}.${randomUUID()}`;
865
893
  await writeFile(temporary, JSON.stringify(record), { mode: 0o600 });
@@ -919,6 +947,8 @@ export default function contribute(server: PluginServerContext) {
919
947
  });
920
948
  handle(rpc.onboardingChecksRpc, async ({ fresh }, { paseo }) => { await requireReady(); seen(paseo); return readiness.run(!!fresh); });
921
949
 
950
+ type SessionOpen = (input: { request: PluginSessionOpenRequest }, context: PluginHookContext) => Promise<PluginSessionOpenRequest | void>;
951
+ const withWait = (handler: SessionOpen): SessionOpen => async (input, context) => wait.open((await handler(input, context)) ?? input.request);
922
952
  const removers = [
923
953
  server.on("agent.permission_requested", async (event, { paseo }) => { trustApi = paseo; await trust.handle(event.agent, event.request as never).catch(() => undefined); }),
924
954
  displaySettings.subscribe(() => void writeBriefState().catch(() => undefined)),
@@ -958,7 +988,8 @@ export default function contribute(server: PluginServerContext) {
958
988
  });
959
989
  if (waking) void engine.tick();
960
990
  }),
961
- server.before("agent.session_open", async ({ request }, { paseo }) => {
991
+ // Follow-up's own tools first, then Wait's on top (every interactive Claude session, tracked or not).
992
+ server.before("agent.session_open", withWait(async ({ request }, { paseo }) => {
962
993
  await ready;
963
994
  if (loadError || stopped || request.purpose !== "interactive") return request;
964
995
  // The Overseer: needs_you (no Stop-hook nudge), the action tools and its routing tools. Never tracked.
@@ -997,7 +1028,7 @@ export default function contribute(server: PluginServerContext) {
997
1028
  const recovery = w.mainAgentId !== request.agentId && !w.contributorAgentIds?.includes(request.agentId);
998
1029
  const main = !recovery && w.mainAgentId === request.agentId ? brief : null;
999
1030
  return withTools({ ...request, env: { ...request.env, FOLLOW_THROUGH_CLI: bridge, FOLLOW_THROUGH_CLIENT_ENTRY: clientEntry(), ...(recovery ? { FOLLOW_THROUGH_RECOVERY: "1" } : {}), ...(main ? { FOLLOW_THROUGH_BRIEF: main } : {}) } }, recovery, main, root && !recovery);
1000
- }),
1031
+ })),
1001
1032
  server.on("agent.turn_ended", async (event, { paseo, signal }) => {
1002
1033
  await ready;
1003
1034
  if (stopped || loadError) return;
@@ -1031,7 +1062,7 @@ export default function contribute(server: PluginServerContext) {
1031
1062
  server.on("workspace.archived", async event => { await ready; if (!loadError && !stopped) await store.mutate(state => { const w = state.workspaces.find(w => w.id === event.workspace.id); if (w) w.archived = true; }); }),
1032
1063
  ];
1033
1064
  return async () => {
1034
- stopped = true; governor.stop(); if (timer) clearTimeout(timer); if (aboutTimer) clearTimeout(aboutTimer); aiJobs.stop(); ranker = null; if (inboxTimer) clearTimeout(inboxTimer); inbox.stop(); if (hookTimer) clearInterval(hookTimer); removers.forEach(remove => remove());
1065
+ stopped = true; wait.close(); governor.stop(); if (timer) clearTimeout(timer); if (aboutTimer) clearTimeout(aboutTimer); aiJobs.stop(); ranker = null; if (inboxTimer) clearTimeout(inboxTimer); inbox.stop(); if (hookTimer) clearInterval(hookTimer); removers.forEach(remove => remove());
1035
1066
  await ready; if (hooksStarted) await agentHooks.stop().catch(() => {});
1036
1067
  await actions.close(); await closeConnections(); await engine.stop(); await ready; await store.flush().catch(() => undefined); await unlock?.();
1037
1068
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "1.4.0-beta.23",
4
+ "version": "1.4.0-beta.25",
5
5
  "description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
6
6
  "type": "module",
7
7
  "files": [
@@ -24,17 +24,19 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "typecheck": "tsc --noEmit",
27
- "test": "tsx --test tests/*.test.ts",
27
+ "test": "tsx --test --import ./tests/hermetic-env.mjs tests/*.test.ts",
28
28
  "verify": "npm run typecheck && npm run check:notes && npm test && node --test button-visibility.test.mjs && npm run test:scale && npm run test:native && npm run test:trust",
29
29
  "test:trust": "node scripts/check-trust-bypass.mjs",
30
30
  "preview": "node scripts/check-install.mjs --keep",
31
- "test:install": "node scripts/check-install.mjs",
31
+ "test:install": "node scripts/check-install.mjs && node scripts/check-wait.mjs",
32
32
  "test:github-mode": "node scripts/check-github-mode.mjs",
33
33
  "test:native": "node scripts/check-native-tools.mjs --agents 10",
34
34
  "prepare": "node scripts/build.mjs",
35
35
  "test:scale": "node scripts/scale-check.mjs --workspaces 120 --awake 5 --churn 35 --idle 60 --rss-budget 240 --cpu-budget 3 --request-budget 2",
36
36
  "check:notes": "node scripts/release-notes.mjs --check",
37
- "release:notes": "node scripts/release-notes.mjs"
37
+ "release:notes": "node scripts/release-notes.mjs",
38
+ "test:wait": "node scripts/check-wait.mjs",
39
+ "test:wait-live": "node scripts/check-wait.mjs --live"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@getpaseo/client": "0.14.0",
package/scripts/build.mjs CHANGED
@@ -5,3 +5,5 @@ const hook = await readFile(new URL("../server/agent-hook.mjs", import.meta.url)
5
5
  await writeFile(new URL("../server/hook-source.ts", import.meta.url), `// Generated by scripts/build.mjs.\nexport const hookSource = ${JSON.stringify(hook)};\n`);
6
6
  const overseer = await readFile(new URL("../server/overseer-prompt.md", import.meta.url), "utf8");
7
7
  await writeFile(new URL("../server/overseer-prompt-source.ts", import.meta.url), `// Generated by scripts/build.mjs from server/overseer-prompt.md.\nexport const overseerPrompt = ${JSON.stringify(overseer)};\n`);
8
+ const runner = await readFile(new URL("../server/wait-runner.sh", import.meta.url), "utf8");
9
+ await writeFile(new URL("../server/wait-runner-source.ts", import.meta.url), `// Generated by scripts/build.mjs from server/wait-runner.sh.\nexport const runnerSource = ${JSON.stringify(runner)};\n`);
@@ -14,6 +14,7 @@ import { priorityInputSchema, type Priority } from "../shared/priorities";
14
14
  import type { AboutView } from "../shared/about";
15
15
  import { ROLE_INFO, roleSummary, type RoleConfig } from "../shared/agent-settings";
16
16
  import { DISPLAY_TOOLS, RPC_TOOLS, type RpcTool } from "./agent-parity";
17
+ import { waitNote, type WaitStatus } from "../shared/wait";
17
18
 
18
19
  /**
19
20
  * Agent parity: every action the developer can click in Follow-up has a tool that runs the same server path.
@@ -23,7 +24,7 @@ import { DISPLAY_TOOLS, RPC_TOOLS, type RpcTool } from "./agent-parity";
23
24
  * return a dry-run plan first; `confirm: true` with that plan's id runs it. Every agent write is recorded in
24
25
  * the inbox ledger as `by: "agent:<id>"`, which never counts as the developer writing to the agent.
25
26
  */
26
- export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "inbox_act", "answer_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "display_settings", "set_display"] as const;
27
+ export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "inbox_act", "answer_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "display_settings", "set_display"] as const;
27
28
  export type AgentTool = typeof AGENT_TOOLS[number];
28
29
  /** Tools that only read. */
29
30
  export const READ_ONLY_TOOLS: readonly AgentTool[] = ["list_prs", "inbox_list", "workspace_about", "agent_settings", "display_settings", ...RPC_TOOLS.filter(t => t.kind === "read").map(t => t.name as AgentTool)];
@@ -77,6 +78,8 @@ export type AgentActionDeps = {
77
78
  about?: { view(workspaceId: string, opts: { open?: boolean; wait?: boolean }): Promise<AboutView> };
78
79
  /** Settings → Agents, read-only: which agent each special role uses. No write tool. */
79
80
  agentSettings?: { all(): Promise<Record<string, RoleConfig>> };
81
+ /** Settings → Agents → Wait for background jobs, for agent_settings (set_wait_for_jobs is an RPC tool). */
82
+ wait?: { status(): Promise<WaitStatus> };
80
83
  /** Each known repository's PR workflow (Settings → Following → Shipping PRs). */
81
84
  prWorkflows?: () => Promise<{ default: string; repos: { repo: string; effective: string; setting: string; reason: string; reviewFix: unknown }[]; reviewFix: unknown }>;
82
85
  /** Runs a developer RPC's own handler (the button's path), and checks an input against its contract. */
@@ -161,7 +164,8 @@ export class AgentActions {
161
164
  if (!this.d.agentSettings) throw new Error("agent_settings isn't available in this Follow-up.");
162
165
  const roles = await this.d.agentSettings.all();
163
166
  const workflows = await this.d.prWorkflows?.().catch(() => null);
164
- return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r), does: ROLE_INFO[r.role].does })), change: "Tom changes these in Follow-up settings → Agents.",
167
+ const wait = await this.d.wait?.status().catch(() => null);
168
+ return { ...(wait ? { waitForBackgroundJobs: { ...wait, note: waitNote(wait), change: "set_wait_for_jobs, only when the developer asks." } } : {}), roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r), does: ROLE_INFO[r.role].does })), change: "Tom changes these in Follow-up settings → Agents.",
165
169
  ...(workflows ? { prWorkflow: { default: workflows.default, reviewFix: workflows.reviewFix, repos: workflows.repos.map(r => ({ repo: r.repo, workflow: r.effective, setting: r.setting, why: r.reason, reviewFix: r.reviewFix ?? workflows.reviewFix })), change: "Tom changes these in Follow-up settings → Following → Shipping PRs." } } : {}) };
166
170
  }
167
171
  case "add_reviewers": return this.planReviewers(caller, args);
@@ -8,7 +8,7 @@ const directory = dirname(fileURLToPath(import.meta.url));
8
8
  /** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-through bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */
9
9
  let native = process.env.FOLLOW_THROUGH_TOOLS === "native";
10
10
  // Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).
11
- export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "onboarding_status", "onboarding_checks", "set_onboarding", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "inbox_act", "answer_question", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "make_main_agent"];
11
+ export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "inbox_act", "answer_question", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "make_main_agent"];
12
12
  const toolPattern = new RegExp(`(?<![\\w])(${TOOL_NAMES.join("|")})(?![\\w])`, "g");
13
13
  /** Names Follow-up's tools the way this agent has them. */
14
14
  export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, "follow_$1") : text; }
@@ -27,7 +27,7 @@ const quietRevision = 1;
27
27
  const quietInstruction = "Do routine bookkeeping silently. Do not announce tracker calls, say you updated/synced the sidebar, recap panel state, or add plugin-status commentary/final paragraphs. Put receipts and evidence in the tools. User-facing messages should cover the actual work outcome, or a decision/blocker requiring the developer; answer sidebar status only when explicitly asked. If this continuation is bookkeeping only, use the tools and finish without another recap or repeating your previous answer.";
28
28
  const stopReason = "Silently complete this workspace's sidebar bookkeeping before finishing.";
29
29
  // Kept identical to NEEDS_YOU_NUDGE in shared/brief.ts (a test checks it).
30
- const nudgeReason = "Before you stop, call needs_you once with what the developer has to do next: a decision with options, an action only they can take, or kind=done (\"Nothing needed\" plus what you finished), which means nothing for the developer and won't flag you. Then stop; don't repeat your reply.";
30
+ const nudgeReason = "Before you stop, call needs_you once with what the developer has to do next: a decision with options (or questions=[\"Q18\"] for one that is already an open question), an action only they can take, or kind=done (\"Nothing needed\" plus what you finished), which means nothing for the developer and won't flag you. Then stop; don't repeat your reply.";
31
31
 
32
32
  /**
33
33
  * R2: whether to nudge a Claude Code root agent that ended its turn without needs_you. Pure, so every skip is testable.
@@ -112,7 +112,7 @@ function paragraphs(lease, contributor, workflow) {
112
112
  "Maintain this tracked workspace's Follow-through sidebar as part of your normal work; do not wait for a developer reminder.",
113
113
  quietInstruction,
114
114
  "Read workspace_status now and after compaction. Refine the goal with enroll_workspace when scope changes. Register every PR you produce after submitting it, parents before children, and update stack/parent relationships after restacking. Historical mentions and external dependencies are not owned PRs; preserve exclusions and existing records.",
115
- "When a decision needs the developer, call ask_question with a short title, the question, lettered options with what each means, and your recommendation; mark it big only when building ahead would leave this computer, set something others rely on, or most remaining work depends on it. Follow the question mode in its reply. Answers arrive as messages starting \"Follow-up answer Q<n>\" and are already recorded; several decisions from one card arrive together in one message, one line per decision, with skipped ones marked \"skipped\" and still open; if the developer answers in chat, call record_answer. Withdraw questions that stop mattering.",
115
+ "When a decision needs the developer, call ask_question with a short title, the question, lettered options with what each means, and your recommendation; mark it big only when building ahead would leave this computer, set something others rely on, or most remaining work depends on it. Follow the question mode in its reply. Ask each decision once: asking it again returns the open question, and at a turn's end you point at it (needs_you questions=[\"Q<n>\"]) instead of restating it. Answers arrive as messages starting \"Follow-up answer Q<n>\" and are already recorded; several decisions from one card arrive together in one message, one line per decision, with skipped ones marked \"skipped\" and still open; if the developer answers in chat, call record_answer. Withdraw questions that stop mattering.",
116
116
  "If you keep a Claude artifact (or doc) summarizing this workspace's goal, decisions and status, register its link once with set_spec after the first publish. Republish to the same URL; call set_spec again only if the link changes.",
117
117
  "Keep actual follow-through tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions.",
118
118
  "Stakeholder replies are follow-through too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.",
@@ -141,6 +141,12 @@ async function nativeExtras(brief) {
141
141
  process.env.FOLLOW_THROUGH_OVERSEER === "1" ? bridge.overseerInstruction : null,
142
142
  ].filter(Boolean).map(text => named(text));
143
143
  }
144
+ /** Wait's guidance (server/wait.ts attaches its tools natively, so there is no MCP initialize text to carry it). */
145
+ async function waitExtras() {
146
+ if (process.env.FOLLOW_THROUGH_WAIT !== "1") return [];
147
+ const bridge = await import(pathToFileURL(join(directory, "mcp.mjs")).href).catch(() => null);
148
+ return bridge?.waitInstruction ? [bridge.waitInstruction] : [];
149
+ }
144
150
  /**
145
151
  * Claude Code keeps hook context for the whole session and re-runs SessionStart after compaction, so the same text
146
152
  * on every prompt only costs tokens (~1.3k per turn for a tracked main agent): send it once per session and again
@@ -164,7 +170,7 @@ async function main() {
164
170
  // The Overseer: a fresh digest at the start of every turn; no sidebar bookkeeping and no Stop-hook nudge.
165
171
  if (process.env.FOLLOW_THROUGH_OVERSEER === "1") {
166
172
  if (event.hook_event_name === "SessionStart") {
167
- const extras = await nativeExtras(await json(join(directory, "brief.json")).catch(() => null));
173
+ const extras = [...await nativeExtras(await json(join(directory, "brief.json")).catch(() => null)), ...await waitExtras()];
168
174
  if (extras.length) process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: extras.join("\n\n") } }) + "\n");
169
175
  return;
170
176
  }
@@ -189,9 +195,13 @@ async function main() {
189
195
  // The brief nudge applies to root agents launched with FOLLOW_THROUGH_BRIEF, tracked or not.
190
196
  const provider = process.env.FOLLOW_THROUGH_BRIEF || null;
191
197
  const brief = provider ? await json(join(directory, "brief.json")).catch(() => null) : null;
192
- if (!workspace && !(brief?.enable_inbox && brief?.enable_brief_nudge) && !(native && process.env.FOLLOW_THROUGH_ROOT === "1")) return;
198
+ if (!workspace && !(brief?.enable_inbox && brief?.enable_brief_nudge) && !(native && process.env.FOLLOW_THROUGH_ROOT === "1")) {
199
+ // Every other Claude session with Wait (subagents, untracked agents) still gets Wait's guidance, once per session.
200
+ if (event.hook_event_name === "SessionStart") { const extras = await waitExtras(); if (extras.length) process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: extras.join("\n\n") } }) + "\n"); }
201
+ return;
202
+ }
193
203
  const context = () => instructions(lease, contributor, workflow);
194
- const sessionText = async () => [workspace ? context() : null, ...await nativeExtras(brief)].filter(Boolean).join("\n\n");
204
+ const sessionText = async () => [workspace ? context() : null, ...await nativeExtras(brief), ...await waitExtras()].filter(Boolean).join("\n\n");
195
205
  const name = event.hook_event_name;
196
206
  if (!["SessionStart", "UserPromptSubmit", "PostToolUse", "Stop"].includes(name)) return;
197
207
  const session = createHash("sha256").update(String(event.session_id ?? agentId)).digest("hex").slice(0, 24);
@@ -51,6 +51,8 @@ export const RPC_TOOLS: readonly RpcTool[] = [
51
51
  // Settings → Agents
52
52
  { name: "set_agent_setting", rpc: "follow.set-agent-setting", kind: "planned", before: { rpc: "follow.agent-settings", input: () => ({}) },
53
53
  input: z.strictObject({ role: z.enum(AGENT_ROLES).optional(), entry: savedRoleSchema.nullable().optional(), ...confirm }) },
54
+ { name: "set_wait_for_jobs", rpc: "follow.set-wait", kind: "planned", before: { rpc: "follow.agent-settings", input: () => ({}) },
55
+ input: z.strictObject({ enable_wait: z.boolean().optional(), ...confirm }) },
54
56
  // Onboarding
55
57
  { name: "onboarding_status", rpc: "follow.onboarding", kind: "read", input: none },
56
58
  { name: "onboarding_checks", rpc: "follow.onboarding-checks", kind: "read", input: z.strictObject({ fresh: z.boolean().optional() }) },
@@ -126,6 +128,7 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
126
128
  "follow.save-reviewers": { tools: ["save_reviewers"] },
127
129
  "follow.agent-settings": { tools: ["agent_settings"] },
128
130
  "follow.set-agent-setting": { tools: ["set_agent_setting"] },
131
+ "follow.set-wait": { tools: ["set_wait_for_jobs"] },
129
132
  "follow.onboarding": { tools: ["onboarding_status"] },
130
133
  "follow.onboarding-checks": { tools: ["onboarding_checks"] },
131
134
  "follow.set-onboarding": { tools: ["set_onboarding"] },
@@ -46,6 +46,21 @@ export class AgentSettingsStore {
46
46
  return next;
47
47
  }
48
48
 
49
+ /** Wait for background jobs: on unless the developer turned it off. */
50
+ async waitEnabled(): Promise<boolean> { return (await this.load()).file.enable_wait !== false; }
51
+ setWait(enabled: boolean): Promise<AgentSettingsFile> {
52
+ const next = this.tail.then(async () => {
53
+ const { file, invalid } = await this.load();
54
+ const copy: AgentSettingsFile = { ...structuredClone(file), enable_wait: enabled };
55
+ if (enabled) delete copy.enable_wait;
56
+ await this.write(copy);
57
+ this.cached = { file: copy, invalid };
58
+ return copy;
59
+ });
60
+ this.tail = next.catch(() => undefined);
61
+ return next;
62
+ }
63
+
49
64
  private async write(file: AgentSettingsFile): Promise<void> {
50
65
  await mkdir(this.directory, { recursive: true, mode: 0o700 });
51
66
  const temporary = join(this.directory, `agents.${randomUUID()}.tmp`);