AWS Logo
Menu
Managing conversations: Resume, load and save context in Amazon Q Developer CLI

Managing conversations: Resume, load and save context in Amazon Q Developer CLI

Amazon Q Developer CLI has evolved significantly in recent releases, introducing powerful features for managing chat conversations. In this post, I will explore how to effectively use the /save, /load, /compact, /usage commands and the --resume flag to make your CLI chat experience more productive and seamless.

Published May 19, 2025

TLDR: Amazon Q Developer CLI now offers robust conversation management tools

  • --resume maintains persistent chat histories per directory
  • /save & /load archive/restore specific conversations
  • /compact optimizes context by summarizing chat history
  • /usage monitors token consumption
    These features help developers avoid restarting conversations, preserve troubleshooting context across sessions, and maintain optimal CLI performance during extended workflows.

Introduction: The Problem of Lost Context

Before diving into commands, let's understand a common scenario many developers face. You're in the middle of an important debugging session with Amazon Q, with valuable context built up over multiple interactions. Then one of these happens:
  • You need to switch to another project directory
  • Your terminal session crashes unexpectedly
  • You want to continue the conversation tomorrow
  • The context window is getting full, making responses slow
Until recently, this meant starting over completely. With the latest Amazon Q CLI features, you now have powerful tools to preserve and manage conversation state.

Conversation Management Commands are here!

Persistent Conversations with --resume

The --resume flag, introduced in version 1.9.1, allows Amazon Q to maintain separate conversation histories for each directory.
bash# Navigate to your project
cd ~/projects/my-backend-service
# Start Amazon Q with persistent history for this directory
q chat --resume
In the below screenshot Q developer identifies the project I have been working on and loads context from previous conversations from the no-interactive-test project.
resume flag
When you next run q chat --resume in that same directory, your conversation history will be automatically restored. This is particularly useful when working on multiple projects simultaneously.

Saving and Loading Specific Conversations

For more control over conversation state, use the /save and /load commands with a path to a .json file where you would like to store your conversation history.
> /save backend-debugging.json
✓ Conversation saved as 'backend-debugging'
Later, you can restore this exact conversation:
> /load backend-debugging.json
✓ Loaded conversation 'backend-debugging'
This feature is incredibly useful when you want to:
  • Archive a particularly insightful troubleshooting session
  • Share a conversation with teammates (by sending them the saved file)
  • Maintain different conversation threads for different aspects of a project

Optimizing Context with /compact

As conversations grow, they consume the model's context window, potentially affecting response quality and speed. The /compact command, updated in version 1.9.0, solves this:
> /compact
✓ Creating a summary...
"<summarised context here>"
The command intelligently summarizes previous exchanges into a concise context, freeing up space for new interactions while retaining critical information.

Monitoring Context Usage with /usage

To understand how your conversation is utilizing the available context window:
> /usage
Current context window (30140 of 200k tokens used)
████████████████████████████████████████████████████████████████████████████████ 15.07%
█ Context files: ~1400 tokens (0.70%)
█ Q responses: ~17760 tokens (8.88%)
█ Your prompts: ~10990 tokens (5.49%)
This helps you preemptively manage context before hitting limits.

A Day in the Life: Practical Workflow

Let me walk you through how these commands might fit into your daily workflow:

Morning: Resume Yesterday's Work

Start the day by resuming where you left off
cd ~/projects/api-service
q chat --resume
# Check context usage
> /usage
Current context window (30140 of 200k tokens used)
████████████████████████████████████████████████████████████████████████████████ 15.07%
█ Context files: ~1400 tokens (0.70%)
█ Q responses: ~17760 tokens (8.88%)
█ Your prompts: ~10990 tokens (5.49%)
# Compact to free up space before starting new work
> /compact

Midday: Context Switching Between Projects

bash# Before switching projects, save your conversation
> /save api-auth-debugging
# Switch to another project
cd ~/projects/frontend-app
q chat --resume
# Work on frontend issues...
# Later, switch back and restore specific conversation
cd ~/projects/api-service
q chat
> /load api-auth-debugging

Evening: Archiving Important Solutions

bash# After solving a complex issue, save the conversation with a descriptive name
> /save jwt-token-fix-workflow.json
# You can even tell Amazon Q to create a summary document from your conversation
> Please create a markdown document summarizing our troubleshooting steps and solution
# Amazon Q will generate the document, which you can then save for team documentation

Tips for Effective Conversation Management

  1. Use descriptive names when saving conversations to make them easier to find later
  2. Run /usage periodically during long sessions to monitor context utilization
  3. Use /compact proactively rather than waiting until you hit context limits
  4. Combine --resume with project-specific directories for seamless workflow management
  5. Archive important conversations with /save before using /clear to start fresh

Conclusion

The evolution of Amazon Q Developer CLI's conversation management features represents a significant step forward for developer productivity. By intelligently managing conversation context, you can maintain flow across sessions, preserve valuable troubleshooting knowledge, and make the most of Amazon Q's capabilities.
These commands might seem like small additions, but they fundamentally change how developers interact with AI assistants on the command line. Instead of one-off interactions, you can now maintain ongoing, persistent conversations that evolve with your projects.
Have you tried these commands in your workflow? What other Amazon Q Developer CLI features would you like to learn more about? Share your experiences and questions in the comments!
 

1 Comment