Feature request: add chat:redo action (counterpart to chat:undo)

Status Closed — not planned
Maintainer reply None cached
Activity 6 comments · opened Mar 1, 2026 · closed Apr 6, 2026

Feature request

chat:undo exists and works (bound to Ctrl+_ by default), but there is no chat:redo action. This means undo is a one-way operation — if you undo too far, there's no way to recover without retyping.

Use case

When writing prompts in iTerm2, it's easy to accidentally hit ⌘⌫ (delete line). With undo mapped via iTerm2's "Send Hex Code" (0x1f), you can recover. But if you undo one step too many, there's no redo to go forward again.

Expected behavior

A chat:redo action should exist alongside chat:undo, bindable via ~/.claude/keybindings.json. A sensible default might be Ctrl+X Ctrl+_ (matching Zsh's convention) or left unbound by default.

Current workaround

Use Ctrl+G to open an external editor for complex prompts, which has its own undo/redo. But this adds friction for quick edits.

Additional context

  • chat:undo works but operates on inconsistent chunk sizes (sometimes single characters, sometimes word groups)
  • Sending a redo key sequence (e.g. 0x18 0x1f) results in literal control characters being inserted rather than triggering any action, confirming no redo handler exists
  • These literal control characters bypass the empty-message guard but are stripped before delivery to the model

View original on GitHub ↗

6 Comments

Tanngrisnirr · 7 months ago

Immediate workaround: Add backup automation to your CLAUDE.md

While waiting for chat:redo, protect yourself with automated backups. This is going to happen a lot with AI-assisted coding.

Note: I am on Linux (Fedora 42, Bash). These examples work there. Portability to macOS/Windows is not assured.

Add this to your project's CLAUDE.md:

## Backup Rules

**Claude has automatic permission to create backups without asking.**

Before any significant modification, create a timestamped backup.
Keep 6-10 recent versions with automatic rotation.

### Backup command (add to CLAUDE.md):
TS=$(date +%Y%m%d_%H%M%S) && mkdir -p "backups/backup_$TS" && \
rsync -a --exclude='backups' --exclude='node_modules' --exclude='*.log' ./ "backups/backup_$TS/"

### Cleanup (keep only 6 latest):
ls -dt backups/backup_*/ | tail -n +7 | xargs rm -rf 2>/dev/null

Full scripts/backup.sh example:

#!/bin/bash
TS=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="backups/backup_$TS"

mkdir -p "$BACKUP_DIR"
rsync -a --exclude='backups' --exclude='node_modules' --exclude='.git' \
  --exclude='*.log' --exclude='*.aux' --exclude='*.tmp' \
  ./ "$BACKUP_DIR/" 2>/dev/null

echo "✓ Backup created: $BACKUP_DIR"

# Keep only 6 latest backups (automatic rotation)
ls -dt backups/backup_*/ 2>/dev/null | tail -n +7 | xargs rm -rf 2>/dev/null
echo "✓ Old backups cleaned"

# List available backups
echo "Available backups:"
ls -dt backups/backup_*/ 2>/dev/null

Session tracking file (optional but recommended):

Keep a session_tracking.csv to track your work history:

start_timestamp,end_timestamp,duration_min,action_type,description
2026-03-01 14:30:00,2026-03-01 15:45:00,75,SESSION,Refactored auth module - END OF SESSION
2026-03-01 16:00:00,2026-03-01 17:30:00,90,SESSION,Added unit tests - END OF SESSION

Add to CLAUDE.md:

## Session Tracking

At session start, log entry to session_tracking.csv:
echo "$(date '+%Y-%m-%d %H:%M:%S'),,0,SESSION_START,Beginning work" >> session_tracking.csv

At session end, update the last line with end timestamp and description.

This gives you a history of what was done and when, useful for recovering context after undo mishaps.

Pro tips:

  1. Auto-permission: Add "Claude has automatic permission to create backups without asking" to your CLAUDE.md so it backs up before risky operations without prompting
  1. BASE backups: For critical milestones, create permanent backups excluded from rotation:

``bash
cp -r backups/backup_XXXXXX backups/BASE_backup_XXXXXX
`
Modify cleanup to only rotate non-BASE:
ls -dt backups/backup_*/ | tail -n +7`

  1. Exclusions: Customize rsync exclusions for your project (node_modules, .git, build artifacts, etc.)

Why this works:

  • Claude reads CLAUDE.md at session start and follows backup rules
  • Automatic rotation keeps disk usage manageable
  • BASE backups preserve critical milestones permanently
  • Session tracking provides work history for context recovery
  • Manual recovery is always possible even when undo fails

This does not solve the redo issue, but it prevents data loss until proper redo is implemented.

jacobcxdev · 7 months ago

@Tanngrisnirr I'm not talking about rewind. How does backing up the project have anything to do with undo/redo in Claude Code's text field?

Begone AI slop.

ZeterMordio · 7 months ago

+1. The undo infrastructure is already there, redo feels like an easy patch.

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

jacobcxdev · 6 months ago

Y'all really need a better ticketing system. This needs reopening.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.