Make recall launches explicit and usable#186
Open
luckeyfaraday wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes the existing project recall feature materially usable from the main Command Room launch flow.
Before this change, Athena could write and display project-local recall, and immersive context bundles could consume it, but the default user path for launching a new agent still ignored recall. That made the recall cache feel like status decoration unless the user happened to use a handoff launch or an explicit MCP immersive path. This PR adds an explicit recall-backed launch path in the app, threads that launch mode through the embedded terminal spawner, and fixes the MCP batch validator so the documented immersive modes actually work.
Concretely, this PR:
Recall launchessection to the Command RoomNewmenu.contextMode="immersive"from the UI throughlaunchEmbedded()intodesktop.spawnEmbeddedTerminal().immersiveandimmersive_curated, matching the documented context modes.Problem
The recall feature had most of the storage and status plumbing, but the common agent launch path did not make that recall useful.
The repo already had:
.context-workspace/hermes/session-recall.mdas a project-local recall cache./hermes/recall/status,/hermes/recall/write,/hermes/recall/refresh, and/hermes/recall/mark-usedbackend APIs.But the normal Command Room flow still launched agents without recall. Starting Codex, OpenCode, Claude, Athena Code, or Grok from the main
Newmenu resulted in a clean/default launch. That is a good default for avoiding hidden context injection, but it also meant that a user could look at a fresh recall cache and still have no obvious way to start an agent that actually used it.The practical result was exactly the failure mode this PR is meant to address: recall could exist, appear in status panels, and even have audit metadata, while still feeling useless because it was not connected to an obvious launch action.
There was also a second, smaller inconsistency in MCP support. The MCP tool documentation described
immersiveandimmersive_curatedcontext modes, and the low-level terminal spawner supported them, but the batch spawn spec validator rejected those modes. That made the documented MCP batch path weaker than the single-terminal path.Design Goals
The fix intentionally does not make recall ambient or automatic for every launch.
That is important because recall is short-lived background context. It may be stale, incomplete, or assembled from historical sessions whose current relevance needs to be verified. Automatically injecting it into every new agent session would create a different class of problem: agents could inherit stale context without the user realizing it.
The design goals here are:
User-Facing Behavior
The Command Room
Newmenu now has two functional groups.The existing
Native terminalsgroup remains the normal launch path:Those entries continue to behave as they did before. They do not automatically attach project recall.
A new
Recall launchesgroup appears underneath:Those entries request
contextMode="immersive". The existing Electron launch path creates an Athena context bundle and passes the spawned agent a startup prompt pointing at the generatedcontext.mdfile.When no recall cache exists for the workspace, the recall launch entries are disabled and show
No recall cache. This avoids presenting recall as available when Athena has nothing project-local to attach.When a recall launch succeeds, the app calls
/hermes/recall/mark-used, which updates the recall metadata with:used_for_launch_atlast_launch_agentThat means the existing audit display can now answer a real question: has this recall cache actually been used to start an agent?
Context Bundle Behavior
This PR does not invent a new recall prompt shape. Recall launches use the existing immersive context bundle machinery.
For recall-backed launches, the path is:
Codex + Recallor another recall launch entry.CommandRoompassescontextMode="immersive"toonLaunch.App.launchEmbedded()forwards that mode todesktop.spawnEmbeddedTerminal().context.md.That bundle can include:
AGENTS.md..context-workspace/hermes/session-recall.md.This is the right existing abstraction for recall-backed launches because the bundle is immutable, bounded, project-local, and already treats recalled material as background data rather than as system authority.
Prompt Behavior Change
The immersive prompt wording is now task-aware.
Before this PR, immersive mode always told the agent:
That was fine when immersive mode was paired with a concrete task, but the new UI recall launch can start an agent with recall context and no specific task. In that case, telling the agent to read context before making decisions is too open-ended: it might infer work that was not requested.
The prompt now branches:
That keeps recall useful without encouraging the agent to run ahead of the user.
MCP Behavior Change
context_workspace_spawn_terminals_batchnow accepts:nonetaskcuratedimmersiveimmersive_curatedPreviously, the docs and terminal control path acknowledged immersive modes, but
_context_mode_or_none()rejected them for batch specs. This PR fixes that validator and adds a regression test so batch MCP callers can request the same immersive context behavior that single terminal spawns already support.The MCP README was also corrected. It previously said Context Workspace includes recall in future run
context.mdfiles. That is stale for the current architecture: legacy backend run artifacts intentionally do not include recall. The correct path is explicit immersive context bundles.Why Not Attach Recall Automatically?
This PR keeps the default launch path clean on purpose.
Automatic recall injection would make the feature feel more active, but it would also make it easier for stale or irrelevant history to leak into new sessions. That would be especially risky in a multi-agent workspace where prior sessions may have explored dead ends, operated on different branches, or summarized state that has since changed.
Explicit recall launch entries are a better tradeoff:
Implementation Details
client/src/rooms/CommandRoom.tsxAgentContextMode.recallAvailableprop from the app state.Recall launchesmenu section beneath the existing launch actions.contextMode="immersive"when one of the recall launch actions is selected.client/src/App.tsxAgentContextMode.isRecallLaunchKind()helper so only coding-agent launches use recall labels/metadata.launchEmbedded()to accept and forwardcontextMode.<Agent> Recallfor a single recall-backed launch.Recallfor recall-backed coding-agent launches.contextModeintodesktop.spawnEmbeddedTerminal().recallAvailable={Boolean(state.recall?.exists)}intoCommandRoom.client/electron/agent-context.tsmcp_server/tools.py_context_mode_or_none()to acceptimmersiveandimmersive_curatedfor batch specs.mcp_server/README.mdcontext.mdfiles.immersiveandimmersive_curatedin the context mode list.Tests
context_mode="immersive".Compatibility
Default launch behavior is preserved.
The existing launch entries still launch clean/default agent sessions. The new behavior is opt-in through the new recall entries or through callers explicitly passing immersive context mode.
Existing handoff launches are also preserved. The handoff flow still uses curated context with the exact preview markdown, which is distinct from this PR's new direct recall launch path.
Legacy backend run artifacts remain unchanged and still do not include recall. That is intentional and now documented more accurately.
Risks And Tradeoffs
Stale recall can still be launched if it exists
The UI enables recall launches when a recall cache exists. It does not require the recall status to be
fresh.That is a deliberate tradeoff for now. A stale handoff may still be useful as orientation, especially when refresh is not configured. The prompt and bundle wording continue to frame recall as background context, and current user instructions remain authoritative.
A future refinement could add stronger stale-state UI, such as showing
Stale recallin the menu item detail or requiring a refresh whenrefresh_configuredis true.The New menu is longer
The Command Room launch menu now has an additional section. This makes recall discoverable but increases menu height.
The new entries are grouped under a section header to keep the distinction clear: normal launches are still normal launches, recall launches are explicit context launches.
Mark-used failures are non-critical
The launch itself is the important operation. If the follow-up
markRecallUsedrequest fails, the agent may still have launched successfully. The app surfaces the error through existing error handling, but the launch path does not rely on the audit metadata write to create the terminal.Validation
Ran the following checks on
fix/recall-launches-use-cacheafter moving the work onto a branch based directly onmain:Result:
43 passedResult: TypeScript, Vite build, and Electron TypeScript build completed successfully. Vite still reports the existing large chunk warning for
index-*.js; this PR does not change that packaging characteristic.Result:
25 passedResult:
164 passedAlso attempted
npm test -- --runInBand, but this package has no generictestscript, so the repo-specific scripts above were used instead.Manual Review Notes
The most important manual review path is:
.context-workspace/hermes/session-recall.md.Newmenu.Recall launchessection appears.Codex + Recallor another recall-backed agent entry..context-workspace/context/ctx_.../.context.md.used_for_launch_atandlast_launch_agent.For a workspace without recall:
Newmenu.No recall cache.Follow-Up Ideas
This PR makes recall usable, but there are still sensible next steps:
Refresh then launch with recallflow when refresh is configured.