Skip to content

[Feature Request] Allow Claude Code to access /resume command for conversation history #6912

Closed as not planned

Description

@gonzalomelov

Problem

Currently, Claude Code cannot use the /resume slash command to access conversation history when users request information about their previous sessions. When a user asks Claude Code to show their last conversations, Claude Code has no programmatic way to access this information. This limitation prevents Claude Code from helping users identify, reference, or analyze their conversation history.

Current Behavior

  • The /resume command is available to users but not accessible to Claude Code
  • Claude Code cannot list or view session metadata when requested
  • Users must manually exit their current session to view conversation history
  • No programmatic access to session information exists within Claude Code

Desired Behavior

  • Claude Code should be able to access session history when users request it
  • Session metadata (timestamps, summaries, message counts) should be retrievable
  • Users should be able to ask "What were my last 5 conversations?" and get an answer
  • Claude Code should be able to help users find specific past sessions

User Impact

  • Users can ask Claude Code directly about their conversation history without leaving the current session
  • Better continuity and context awareness across multiple sessions
  • Improved user experience when trying to find or reference past work
  • Enables Claude Code to be more helpful with session management and analysis
  • Reduces friction in multi-session workflows

Use Cases

  • "Show me my recent conversations about React"
  • "What did we discuss yesterday?"
  • "List my last 10 sessions"
  • "Help me find the conversation where we worked on the authentication system"
  • "What conversations do I have from this week?"

Business Value

This enhancement would make Claude Code more self-aware and helpful, reducing user friction when managing multiple conversations. It aligns with the goal of making Claude Code a more intelligent and context-aware development assistant. This feature would differentiate Claude Code by providing better session management capabilities compared to other AI coding tools.


Based on user request to help analyze conversation history. This feature would enable Claude Code to better assist users in understanding their conversation patterns and finding relevant past sessions.

Activity

  1. github-actions commented on Aug 31, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. [Feature Request] Add --include-history flag to output historical messages when resuming sessions #5135
    2. Feature Request: Context data access in statusline hooks #6577
    3. [BUG] Feature Request: Session Persistence Cookie for Multi-Session Development Context #2979

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code


  2. gonzalomelov commented on Aug 31, 2025

    @gonzalomelov
    Author

    Additional Context

    This feature would also address the related closed issue #1407 about session ID visibility. By enabling programmatic access to session history, Claude Code could:

    1. Prevent data loss - Similar to issue Feature Request: Claude code access in web/mobile apps #6826 (local logging), this helps users recover context
    2. Enable workflow automation - Users could build scripts that reference specific sessions
    3. Improve debugging - When Claude Code encounters issues, it could reference previous successful patterns

    Technical Note

    This aligns with the self-awareness concept from issue #6681 - Claude Code should be able to introspect its own session data without network calls.

  3. gonzalomelov commented on Aug 31, 2025

    @gonzalomelov
    Author

    Not a Duplicate - Distinct Feature Request

    Thank you for identifying potential duplicates. After reviewing them, this issue is distinct:

    Issue #5135 - Requests outputting full conversation history to stdout when resuming.

    • They want: Historical messages streamed when resuming a specific session
    • We want: Claude Code to list available sessions and their metadata

    Issue #6577 - Requests context data access in statusline hooks.

    • They want: Token count and memory usage in status line
    • We want: Session history listing capability for Claude Code

    Issue #2979 - Requests session persistence cookies for saving state.

    • They want: Save session state to markdown files for continuity
    • We want: Claude Code to access and list existing session metadata

    This Issue's Unique Request

    Enable Claude Code to execute or equivalent to list session metadata (not resume them, not save them, not stream their content). This would allow users to ask Claude Code "What were my recent conversations?" and get an answer without leaving the current session.

    This is a read-only operation on session metadata that doesn't exist in any current issue.

  4. Coldaine commented on Aug 31, 2025

    @Coldaine

    My two cents onthis, it is certainly better handled a different way than just letting them read the metadata after running /resume.

    This is best handled by a MCP server or other means.

  5. coygeek commented on Aug 31, 2025

    @coygeek

    Hey, this is a fantastic suggestion and a really well-thought-out feature request. I've been digging into the local session management myself, and I completely agree that giving Claude programmatic access to its own history would be a game-changer for conversational context.

    You've done a great job distinguishing this from the other issues. It's not about resuming or exporting a session's content, but about listing the session metadata—a crucial difference.

    While we wait for an official implementation, I did some digging based on the documentation and found a potential workaround that might get us part of the way there. It seems like the conversation history is stored locally.

    The documentation on Hooks (hooks.md) mentions the transcript path is something like ~/.claude/projects/PROJECT_HASH/SESSION_ID.jsonl.

    This means we could potentially build a custom tool to achieve what you're asking for. For instance, we could create a custom slash command that gives Claude the ability to "see" its own history.

    Here's a quick proof-of-concept:

    1. Create a helper script (e.g., ~/.claude/scripts/list_sessions.sh):

      #!/bin/bash
      # This script lists session files and extracts the initial prompt from each.
      
      # Find the project directory under ~/.claude/projects for the current CWD
      PROJECT_DIR=$(claude doctor --json | jq -r '.projectDir' 2>/dev/null)
      
      if [ -z "$PROJECT_DIR" ]; then
        echo "Error: Could not determine project directory."
        exit 1
      fi
      
      # List the 10 most recent session files, parse the first line for the initial user prompt.
      ls -t "$PROJECT_DIR"/*.jsonl | head -n 10 | while read -r session_file; do
        initial_prompt=$(head -n 1 "$session_file" | jq -r '.message.content[0].text' 2>/dev/null | cut -c 1-80)
        session_id=$(basename "$session_file" .jsonl)
        echo "ID: $session_id"
        echo "  - Started with: \"$initial_prompt...\""
        echo ""
      done

      (Make sure to chmod +x ~/.claude/scripts/list_sessions.sh)

    2. Create a personal slash command (in ~/.claude/commands/history.md):

      ---
      description: "List the 10 most recent conversation sessions with their starting prompt."
      allowed-tools: Bash(~/.claude/scripts/list_sessions.sh)
      ---
      
      Here is the recent conversation history for this project:
      
      !~/.claude/scripts/list_sessions.sh

    Now, inside any session, you (or Claude) could run /history, and it would inject the list of recent sessions directly into the conversation. From there, you could ask follow-up questions like, "Tell me more about the session where we worked on the authentication system."

    This is obviously just a temporary hack, and it relies on undocumented file structures that could change. Having a built-in, first-party tool for this would be far more robust and elegant.

    Still, it proves your core concept is sound and technically feasible. Great work on this. Adding my +1 to the official feature request

  6. github-actions commented on Dec 5, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  7. github-actions commented on Jan 5, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  8. github-actions commented on Jan 12, 2026

    @github-actions

    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.

  9. locked as resolved and limited conversation to collaborators on Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions