Summary
A user's stated session goal is not preserved across compaction or resume. When a /goal <text> directive (or a goal: / objective: statement) is submitted, extractIntent captures only a coarse mode — "investigate" or "implement" — and discards the goal text. The resume snapshot then restores only <intent mode="implement"/>. So after /compact or --resume, the model no longer knows what it was working toward; only that it was implementing something.
Repro
- In a session, state a goal, e.g.
/goal migrate the auth module to OAuth2 (PKCE) and keep tests green.
- Search the captured session memory for that text (
ctx_search). The directive text is not found as a retrievable goal.
- Inspect a resume snapshot: it contains
<intent mode="implement"/> but no record of the actual objective.
Root: src/session/extract.ts::extractIntent returns { category: "intent", data: mode } (mode only); src/session/snapshot.ts::buildIntentSection renders only the mode. There is no first-class "goal" event, and the goal text never reaches the snapshot.
Why it matters
The whole value of session continuity is that the resuming model can pick up where it left off. Restoring "mode = implement" without the objective means the model has to ask the user to restate the goal — exactly the re-explaining that context-mode exists to avoid.
Proposed fix (PR against next: #)
- Capture the goal text as a first-class
goal event (priority 1) when the message is a /goal <text> command or an explicit goal: / objective: marker.
- Restore the most recent goal verbatim in a
<session_goal> section placed first in the resume snapshot (right after how_to_search), with an instruction to keep working toward it and not ask the user to restate it.
intent stays unchanged (still the coarse mode); its label is corrected to "Session intent" since it never held the goal text.
End-to-end verification in the PR: a fresh agent given only the restored snapshot correctly identified the goal and derived a sensible next step toward it, with no prompting.
Note
This captures from whatever prompt text reaches the UserPromptSubmit hook. If a host intercepts /goal without firing UserPromptSubmit, the goal: / objective: markers still work; worth confirming hook visibility per host.
Summary
A user's stated session goal is not preserved across compaction or resume. When a
/goal <text>directive (or agoal:/objective:statement) is submitted,extractIntentcaptures only a coarse mode —"investigate"or"implement"— and discards the goal text. The resume snapshot then restores only<intent mode="implement"/>. So after/compactor--resume, the model no longer knows what it was working toward; only that it was implementing something.Repro
/goal migrate the auth module to OAuth2 (PKCE) and keep tests green.ctx_search). The directive text is not found as a retrievable goal.<intent mode="implement"/>but no record of the actual objective.Root:
src/session/extract.ts::extractIntentreturns{ category: "intent", data: mode }(mode only);src/session/snapshot.ts::buildIntentSectionrenders only the mode. There is no first-class "goal" event, and the goal text never reaches the snapshot.Why it matters
The whole value of session continuity is that the resuming model can pick up where it left off. Restoring "mode = implement" without the objective means the model has to ask the user to restate the goal — exactly the re-explaining that context-mode exists to avoid.
Proposed fix (PR against
next: #)goalevent (priority 1) when the message is a/goal <text>command or an explicitgoal:/objective:marker.<session_goal>section placed first in the resume snapshot (right afterhow_to_search), with an instruction to keep working toward it and not ask the user to restate it.intentstays unchanged (still the coarse mode); its label is corrected to "Session intent" since it never held the goal text.End-to-end verification in the PR: a fresh agent given only the restored snapshot correctly identified the goal and derived a sensible next step toward it, with no prompting.
Note
This captures from whatever prompt text reaches the
UserPromptSubmithook. If a host intercepts/goalwithout firingUserPromptSubmit, thegoal:/objective:markers still work; worth confirming hook visibility per host.