[FEATURE] Save session context to memory before requesting a restart

Resolved 💬 2 comments Opened Jun 26, 2026 by sylvain-combe-sonarsource Closed Jun 26, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem Statement:
When the Claude Code agent needs a restart (e.g., after applying config changes via /update-config), it proposes the restart without first saving session context to memory.
Once the user applies the restart, execution passes to the runtime — the agent can no longer act. All context is lost: active tasks, decisions made, work in progress.

The user must then re-explain everything from scratch. This is especially painful because the restart is agent-initiated — the user has no reason to expect a context wipe.

Proposed Solution

Before the agent proposes a restart to the user, it should automatically checkpoint session state to memory — active tasks, decisions, what was tried, what's next.

The save must happen BEFORE the restart is proposed. By the time the request appears to the user, the memory write should already be complete. This is the only viable window: once the user applies the restart, the agent has no opportunity to act.

Alternative Solutions

  1. Manual workaround: ask the agent to save context before every restart. Fragile — depends on user remembering, and on the agent complying correctly.
  1. A Claude Code skill could be created that wraps the restart proposal flow — automatically triggering a context save to memory before suggesting the restart to the user. This patches the gap at the skill layer without requiring a core fix.

Neither alternative is as robust or user-friendly as native behavior: the agent should checkpoint automatically as part of any restart proposal, without requiring a skill workaround.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. Start a session: establish goals, make decisions, build working context over 30+ min
  2. Run /update-config to modify a setting — agent says it needs to restart
  3. User applies the restart
  4. Agent resumes with zero memory of the session
  5. User must re-explain everything

Additional Context

Related issues (overlap but don't cover this exact scenario):

  • #70555 — Working-state continuity: survive compaction and /clear
  • #47023 — Expose compact/session lifecycle hooks for external memory layers
  • #17428 — Enhanced /compact with file-backed summaries and selective restoration

Those address compaction/clear. This is specifically about agent-initiated restart
requests where the save window is before the proposal, not after the user applies it.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗