Add option to persist session after claude code disconnects #34
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
Add
monet-persist-sessionsoption to keep sessions alive after Claude Codedisconnects, allowing reconnection without restarting the server.
Problem
Closes #33.
When Claude Code disconnects (e.g., exiting the CLI), the monet session is
automatically cleaned up. Users who frequently restart Claude Code sessions while
keeping Emacs running must manually restart the monet server each time before
reconnecting.
Solution
Add a new customizable variable
monet-persist-sessions(defaultnil) that, whenenabled, keeps the websocket server running after Claude disconnects. The session
remains available for a new Claude Code session to reconnect via
/ide.Usage
Test plan
I first set up my Doom Emacs configuration to use this option: link to the exact line.
While multiple monet servers are running on different directories:
monet-start-server/idein Claude Code (using a standalone terminal)Ctrl+C Ctrl+Cmonet-list-sessions:ENABLE_IDE_INTEGRATION=t claudeand check it connected to the right session