feat(save): connect the session that had nothing to what it just saved - #85
Merged
Merged
Conversation
Saving is the one command that makes a context out of the conversation in front of it, so it is the one place a connection can be inferred rather than asked for. A session with nothing connected has no grounding to lose and has just written the context that describes it, so the save connects it and says so — no `use` on the thing you just wrote. A session that already has a context keeps it, whatever the save wrote to. Saving under another name is Save As: filing this work somewhere else must not re-ground a conversation the user is still having. The rule lives in one shared helper so every host applies it identically, and each host reports which of the two cases it took. A second nameless save is now Save rather than Save As, because the first one connected the session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
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.
What changes
Saving a conversation now decides the connection, instead of always leaving it alone:
/neatcontext:useon the thing you just wrote is needed.Why
A save is the one command that makes a context out of the conversation in front of it, so it is the one place a connection can be inferred rather than asked for. A session with nothing connected has no grounding to lose and has just written the context that describes it.
The other half matters just as much: Save As is filing this work somewhere else, and moving the session onto that copy would re-ground a conversation the user is still having, without them asking for it.
How
One shared helper,
connectAfterSave()inshared/core/selection.mjs, holds the rule; the packaged cores are synced from it so every host applies it identically. Each host's save path reports which of the two cases it took:printSaveConnection(). On Claude and Codex it also re-runs the bridge-drift warning, the same exposureusehas.saveConnectionLines().Docs that said the opposite are corrected:
save.mdfor Claude Code and Copilot,SKILL.mdfor Kimi, Codex, and pi, and the save walkthrough in the root and Codex READMEs.Behavior change worth knowing
After a first
/neatcontext:save, a second nameless/neatcontext:saveis now Save, not Save As: it previews a merged update to the context the session is now connected to, instead of creating a second one.save-targetsemantics are pinned by test.Verification
npm run check— cleannode --test— 455/455 passnpm run coverage— all 171 changed lines coveredNew tests cover both halves of the rule (connect-when-empty, stay-put-when-connected, and update-the-connected-context) for Claude Code, Copilot, Kimi, Codex, and pi. The Copilot and Kimi save paths had no test coverage before this.
🤖 Generated with Claude Code