Repository navigation
feat: native Cursor conversations, /model and /effort for Cursor - #13
Merged
Merged
Conversation
- Reuse one Claude CLI client per chat instead of spawning one per turn - Resume conversations after restart (sessions.json), fresh session on failure - Replace the rolling history window with native sessions; /new resets - Static system prompt; time and memory context move into the user message - Load no ~/.claude settings/plugins/MCP servers, no built-in tools, dontAsk - Telegram /model and /effort, persisted to ~/.memclaw/.env - Background consolidation after the reply - Default to claude-sonnet-5-5 at medium effort; bump claude-agent-sdk
emanuilo
force-pushed
the
feat/cursor-sessions
branch
from
October 7, 2026 20:03
cae5aa1 to
8f28843
Compare
- /new forgets the session before awaiting the backend reset, so a message sent right after it can't resume the old session - /model refuses to switch when the model list can't be loaded, instead of saving an unchecked (possibly mistyped) id that breaks every turn - the fallback cost estimate includes cache-write tokens - long-id model buttons carry a hash of the id instead of a list position, so they can't pick a different model if the list changed
- drain the bridge's stderr in chunks: readline() raised on a line over 64 KiB, ending the drain, after which a full pipe would block the bridge - a timeout no longer counts as a dead bridge, so one slow run doesn't drop the shared bridge and abort other chats' runs - relaunch a bridge that exited between calls instead of failing the next message (or /model) first - shutdown iterates over a copy of the sessions, so a message arriving mid-shutdown can't skip closing the bridge and MCP server
- one builder for the locked-down CLI options, shared by chat sessions and one-shots, so the lockdown can't drift between them - turn cost computed in _turn_cost, out of run_turn's connection handling - agent.handle's logging, pending-note acknowledgement and session saving pulled into named helpers - clear the repo's ruff findings (unused imports, ambiguous names)
- model/effort state, model-list lookups, the strict model check and saving to ~/.memclaw/.env move into ModelSelectionMixin, used by both the Claude and Cursor backends. Cursor's /model now also refuses an id it can't check when the model list doesn't load. - Cursor run_turn: _ensure_agent says whether the agent was already open, resumed or created (replacing two flags), and _send does the send
emanuilo
changed the base branch from
feat/claude-persistent-sessions
to
main
October 18, 2026 17:08
The Cursor backend is written and checked against the 0.1.x SDK; CI installed 1.0.38 (>=0.1.0 allowed it), which no longer exports UnknownAgentError. Pin to <0.2 so a major SDK upgrade is a deliberate change.
0.1.4 calls it UnknownAgentError, 0.1.9 AgentNotFoundError (both CursorAgentError subclasses, which is what the backend catches). The suite passes on both versions.
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.
Stacked on #12; merge that first. This PR's base then switches to
main.Summary
The Cursor backend gets native, persistent conversations like Claude's in #12: one bridge process, one open agent per chat, resumed after a restart.
Evidence
pyteston feat: persistent Claude sessions, /new, /model, /effort #12 → 317 passedAfter:
pytest→ 341 passed, ruff clean. Cursor tests cover:Merge Danger
Door: two-way
Revert returns Cursor to per-turn bridges and the in-memory transcript. Saved Cursor session ids are then ignored.
Blast Radius: cursor-backend
~/.cursor, tied to the memory dir path. Moving the memory dir starts fresh conversations.docs/memory-architecture.mdonly (the session bullets): keep fix: memory system bugs + end-to-end validation suite #14's Claude line and add this PR's Cursor line after it.🤖 Generated with Claude Code