Feature Request: Add PostRewind hook event for plugins

Resolved 💬 5 comments Opened Jan 17, 2026 by Glucksberg Closed Mar 8, 2026

Summary

Add a new PostRewind (or Rewind) hook event that fires after the user executes /rewind, allowing plugins to react to conversation rollbacks.

Use Case

Plugins like claude-mem track session activity (observations, prompts, tool usage) in a timeline. When users rewind a conversation, the plugin's recorded history becomes inconsistent with the actual conversation state.

Current behavior:

  1. User submits prompt → UserPromptSubmit hook fires → plugin records the prompt
  2. Claude responds with tool calls → PostToolUse hooks fire → plugin records observations
  3. User runs /rewindno hook fires → plugin still shows the now-undone activity

Desired behavior:

  1. User runs /rewind
  2. PostRewind hook fires with context about what was undone
  3. Plugin can soft-delete or mark as "rewound" the corresponding records

Proposed Hook Input

export type PostRewindHookInput = BaseHookInput & {
    hook_event_name: 'PostRewind';
    user_message_id: string;      // The message ID that was rewound to
    rewound_message_ids: string[]; // IDs of messages that were undone
    files_changed?: string[];      // Files affected by the rewind
};

Why This Matters

  • Data consistency: Plugins maintaining state need to know when that state becomes invalid
  • User experience: Timeline/history views showing "ghost" activity that was undone is confusing
  • Ecosystem growth: As more plugins emerge, this becomes increasingly important

Existing Infrastructure

The SDK already has SDKControlRewindFilesRequest internally. This request is asking to expose a corresponding hook event so plugins can observe when rewind happens.

Alternatives Considered

  1. Polling transcript file - Hacky, race-prone, inefficient
  2. Manual API call by user - Poor UX, users won't remember to do it
  3. Detecting via missing tool_result - Unreliable, doesn't capture all rewind scenarios

A proper hook event is the clean solution that aligns with the existing hook architecture.

---

Happy to discuss implementation details or provide more context. Thanks for considering!

View original on GitHub ↗

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