Skip to content

feat(server): goal mode for Scient Agent - #924

Merged
4 commits merged into
mainfrom
claude/goal-mode-20261113
Nov 14, 2026
Merged

4 commits merged into
mainfrom
claude/goal-mode-20261113

Conversation

@yaacovcorcos

@yaacovcorcos yaacovcorcos commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Platforms: the same server code on macOS, Windows and Linux; no platform-specific parts. Tested live on macOS only.

What

/goal now works with Scient Agent as it does with Codex and Claude.

  • Desktop sends /goal to the agent's goal RPC command instead of refusing it (provider/omp/OmpGoal.ts). An objective sets the goal, replacing one the agent holds; pause, resume, clear and show map to the agent's ops.
  • The agent's goal_updated events fill the thread's goal row, so the existing goal UI shows status, tokens and time, with Resume and Clear.
  • The agent works on an active goal in turns it starts itself. Desktop turns on goal.continuationModes: [interactive, rpc] in the scient-host.yml it writes, and those turns arrive through the existing path for agent-started turns.
  • Fix found live: Desktop ended an agent-started turn as soon as its buffered events were replayed, so each goal turn showed "Worked for 40ms" and the reply was split across turns. The turn now stays open until the agent's own end event (nativeTurnOpen in NativeSessionAdapterV2.ts; only the OMP adapter sends continuation-started, so other providers are unaffected).
  • effect-omp-rpc event schemas keep the new goal field; before this they dropped it.
  • A refused goal command (goal mode off, plan mode active) is answered in the conversation, not as a failed turn.

Agents: needs no agent change. Today's published agent (0.1.10) has the goal command.

T3 files change only inside SCIENT-FORK seams.

Merge order: #923 → #924 → #925 → #926, all based on main and queued in that order; each branch sits on the one before it, so its diff shrinks to its own change as they merge.

Tests

  • OmpGoal.test.ts: a new objective replaces the held goal (get, drop, create) and ends as a local-command turn; refusals and show/clear answers land in the conversation; goal_updated maps to the thread's goal.
  • NativeSessionAdapterV2.test.ts "keeps a turn the agent started open until the agent ends it": fails without the fix ("Created notes" instead of "Created notes.txt").
  • Locally: 9 server test files on the stack top (277 pass), root pnpm run typecheck, vp fmt --check, vp lint, seam check and provenance.
  • Live (dev app, macOS): /goal Create a file named goal-check.txt ... ran as one turn ("Worked for 9.5s"), the reply in one piece, and the goal row read "Goal complete · 49k tokens". Record and screenshots: reviews/scient-agent-next-20261111/build-all-20261113/agentmodes-RECORD.md in the ScientFactory workspace.
  • Known: the goal turn still opens with Desktop's generic "Background activity updated" row, the label for any agent-started turn. Not changed here.

🤖 Generated with Claude Code

yaacovcorcos and others added 2 commits November 14, 2026 18:58
Scient Agent now reports the prompt-cache entry each reply confirmed
(tier, touch time, lifetime) on its message_end. Desktop turns a one-hour
entry into promptCacheExpiresAt on the turn's token usage, the field the
Claude path already fills. Idle compaction then works for Scient Agent
as it does for Claude: "Before the cache expires" sends /compact two
minutes before the cache lapses on a thread over 200,000 tokens, and
"When you return" offers the Compact chip once the cache has expired.

A five-minute entry carries no expiry, so a short pause never triggers a
compaction, and a cache that never expires reports none. Scient Agent
instances get the same "Compact idle threads" override as Claude ones,
and the setting text names both. Agents that do not report the entry
keep today's behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The event schemas dropped promptCache, so idle compaction never saw the
cache expiry in the live app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 22.3 KiB 22.3 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 22.7 KiB 22.7 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 12.0 KiB 12.0 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 45.1 KiB 45.1 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 45.1 KiB 45.1 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 12.2 KiB 12.2 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.1 KiB 384.1 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 45.6 KiB 45.6 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 45.6 KiB 45.6 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: f4bef58 · PR result: 6f588b9 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Bounded compact HTTP snapshot with live cursor.

  • Codex decoded thread snapshot: 88.2 KiB
  • Claude decoded thread snapshot: 88.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

yaacovcorcos and others added 2 commits November 14, 2026 20:33
/goal now works with Scient Agent as it does with Codex and Claude.
Desktop sends it to the agent's goal command instead of refusing it:
an objective sets the goal (replacing one the agent holds), and
pause, resume, clear and show map to the agent's ops. The agent's
goal_updated events fill the thread's goal row, so the existing goal
UI shows status, tokens and time, with its Resume and Clear buttons.

The agent works on an active goal in turns it starts itself. Desktop
turns on goal continuation over RPC in the settings file it writes
for the agent, and those turns arrive through the existing path for
turns the agent began. A refused goal command (goal mode off, plan
mode active) is answered in the conversation, not a failed turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A goal continuation is a turn the agent starts by itself. Desktop ended it
as soon as the buffered wake events were replayed, so each goal turn
showed "Worked for 40ms" and its reply was split across turns. The turn
now stays open until the agent's own end event. The event schemas also
kept dropping the goal, so the goal row never showed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaacovcorcos
yaacovcorcos force-pushed the claude/goal-mode-20261113 branch from afc527c to 6f588b9 Compare November 14, 2026 18:34
@yaacovcorcos
yaacovcorcos added this pull request to the merge queue Nov 14, 2026
@github-merge-queue github-merge-queue Bot closed this pull request by merging all changes into main in 92a8b80 Nov 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to it being already merged Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant