Repository navigation
feat: persistent Claude sessions, /new, /model, /effort - #12
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
- /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
- 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)
emanuilo
added a commit
that referenced
this pull request
Oct 18, 2026
emanuilo
added a commit
that referenced
this pull request
Oct 18, 2026
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
Each chat now keeps one Claude Code session, reused across messages and resumed after a restart, instead of a fresh CLI per message with a rolling history window.
Locked-down CLI:
setting_sources=[],strict_mcp_config,tools=[](Memclaw tools only),permission_mode="dontAsk"(wasbypassPermissions). claude-agent-sdk → 0.2.164.Telegram:
Code structure:
Defaults:
claude-sonnet-5-5atmedium.CONVERSATION_HISTORY_*config removed. Per-turn cost is the turn's, not the session's running total.Evidence
pytest→ 252 passedAfter:
pytest→ 317 passed, ruff clean (also clears 11 findings that were already onmain). New coverage includes:/newwere verified end to end there.Merge Danger
Door: two-way
Revert restores per-message CLIs. The new
sessions.jsonis ignored by the old code, and memories are untouched.Blast Radius: conversations
~/.claudesettings, plugins or MCP servers. That's intended, but anyone relying on them inside Memclaw loses them.🤖 Generated with Claude Code