[アップデート] Amazon Q Developer CLI の /save と /load コマンドで異なる環境に会話履歴を移行してみた

[アップデート] Amazon Q Developer CLI の /save と /load コマンドで異なる環境に会話履歴を移行してみた

Clock Icon2025.05.21

いわさです。

ここ数日で Amazon Q Developer CLI の v1.10.0 で様々な機能が追加されていますね。
その中の一つの機能が AWS 公式ドキュメントでも追記されていたのですが、ドキュメントとコマンド名が違っていたので実際に使って使用方法などを確かめてみました。

追加されたと言われているのは次の変更履歴に記載されている、/export/importコマンドです。

C474E069-818C-4E37-B814-C357EB2F4499.png
Document history for Amazon Q Developer User Guide - Amazon Q Developer

説明文からすると、会話履歴をファイルにエクスポートし、別の環境でインポートし直すことができるようです。
ただし、本日時点の Q Developer CLI のヘルプを確認してみても、/export/importを確認することは出来ませんでした。

> /help

q (Amazon Q Chat)

Commands:
/clear        Clear the conversation history
/issue        Report an issue or make a feature request
/editor       Open $EDITOR (defaults to vi) to compose a prompt
/help         Show this help dialogue
/quit         Quit the application
/compact      Summarize the conversation to free up context space
  help        Show help for the compact command
  [prompt]    Optional custom prompt to guide summarization
/tools        View and manage tools and permissions
  help        Show an explanation for the trust command
  trust       Trust a specific tool or tools for the session
  untrust     Revert a tool or tools to per-request confirmation
  trustall    Trust all tools (equivalent to deprecated /acceptall)
  reset       Reset all tools to default permission levels
/profile      Manage profiles
  help        Show profile help
  list        List profiles
  set         Set the current profile
  create      Create a new profile
  delete      Delete a profile
  rename      Rename a profile
/prompts      View and retrieve prompts
  help        Show prompts help
  list        List or search available prompts
  get         Retrieve and send a prompt
/context      Manage context files and hooks for the chat session
  help        Show context help
  show        Display current context rules configuration [--expand]
  add         Add file(s) to context [--global] [--force]
  rm          Remove file(s) from context [--global]
  clear       Clear all files from current context [--global]
  hooks       View and manage context hooks
/usage        Show current session's context window usage
/load         Load conversation state from a JSON file
/save         Save conversation state to a JSON file

:

ただし、ここ最近のアップデートで/load/saveが追加されていることを確認しました。これらは 5 月 7 日 に確認した際には存在していなかったコマンドです。
コマンド説明を見る限り、これが正しいコマンドなような気もします。

ということで本日は/load/saveコマンドを試しに使ってみましたのでその様子を紹介します。

会話履歴について聞いてみる

まずは、会話履歴に関わる質問をしてみます。
AWS サービスの情報をいくつか与えて、それらを組み合わせた一般的なアーキテクチャを説明させます。

hoge1 % q chat

    ⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
 ⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆
 ⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿
 ⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿
 ⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃
 ⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧

╭─────────────────────────────── Did you know? ────────────────────────────────╮
│                                                                              │
│     You can resume the last conversation from your current directory by      │
│                        launching with q chat --resume                        │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

/help all commands  •  ctrl + j new lines  •  ctrl + s fuzzy search
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> いくつかのAWSサービスを伝えます。Lambda, API Gateway, EventBeidge, SQS, SNS, DynamoDBです。どういうアーキテクチャが考えられますか
これらのAWSサービスを組み合わせることで、いくつかの一般的なアーキテクチャパターンが考えられます。主なパターンをいくつか紹介します:

1. サーバーレスAPIアーキテクチャ
   • API Gateway: HTTPリクエストのエンドポイントとして機能
   • Lambda: ビジネスロジックを実行
   • DynamoDB: データの永続化

2. イベント駆動型アーキテクチャ
   • EventBridge: イベントの発行と管理
   • Lambda: イベントに応じた処理を実行
   • SNS/SQS: メッセージの配信と処理の分離

3. 非同期処理アーキテクチャ
   • API Gateway: クライアントからのリクエスト受付
   • Lambda: 初期処理と非同期処理のトリガー
   • SQS: タスクのキューイング
   • Lambda: キューからのメッセージを処理
   • DynamoDB: 処理結果の保存

4. ファンアウトパターン
   • SNS: 1つのイベントを複数のサービスに配信
   • Lambda: 各サブスクライバーで異なる処理を実行
   • SQS: 処理のバッファリングとリトライ

5. マイクロサービスアーキテクチャ
   • API Gateway: 各マイクロサービスへのルーティング
   • Lambda: 各マイクロサービスのビジネスロジック
   • EventBridge: サービス間の疎結合な通信
   • DynamoDB: 各サービスの独立したデータストア

これらのサービスを組み合わせることで、スケーラブルで耐障害性の高い、コスト効率の良いアプリケーションを構築できます。具体的なユースケースや要件があれば、より詳細なアーキテクチャ設計につい
てアドバイスできます。

そして、その次に先ほどインプットした内容について問い合わせてみます。

> 先ほど伝えたサービスをリストアップしてください
先ほど伝えていただいたAWSサービスは以下の通りです:

• Lambda
• API Gateway
• EventBridge
• SQS
• SNS
• DynamoDB

なるほど。これまで会話した内容をちゃんと把握出来ていますね。

エクスポートする

この会話履歴をファイルにエクスポートすることが出来ます。
あまりユースケースがイメージできていないのですが、ワークスペースを変更した場合とか Q Developer CLI がディレクトリごとに保存している情報を手動で移動したい場合などに使う感じでしょうかね。

/saveコマンドに出力先ファイル名を指定します。ファイルは JSON 形式で出力されるようです。

> /save hoge.json

✔ Exported conversation state to hoge.json

出力されました。中身を確認してみます。

hoge1 % cat hoge.json
{
  "conversation_id": "3oYOZyKCa",
  "next_message": null,
  "history": [
    [
      {
        "additional_context": "--- CONTEXT ENTRY BEGIN ---\nThis section (like others) contains important information that I want you to use in your responses. I have gathered this context from valuable programmatic script hooks. You must follow any requests and consider all of the information in this section\n\n--- CONTEXT ENTRY END ---\n\n",
        "env_context": {
          "env_state": {
            "operating_system": "macos",
            "current_working_directory": "/Users/iwasa.takahito/work/hoge0518qdev/hoge1",
            "environment_variables": []
          }
        },
        "content": {
          "Prompt": {
            "prompt": "いくつかのAWSサービスを伝えます。Lambda, API Gateway, EventBeidge, SQS, SNS, DynamoDBです。どういうアーキテクチャが考えられますか"
          }
        },
        "images": null
      },
      {
        "Response": {
          "message_id": "N1v77XDKF",
          "content": "これらのAWSサービスを組み合わせることで、いくつかの一般的なアーキテクチャパターンが考えられます。主なパターンをいくつか紹介します:\n\n1. サーバーレスAPIアーキテクチャ\n   - API Gateway: HTTPリクエストのエンドポイントとして機能\n   - Lambda: ビジネスロジックを実行\n   - DynamoDB: データの永続化\n\n2. イベント駆動型アーキテクチャ\n   - EventBridge: イベントの発行と管理\n   - Lambda: イベントに応じた処理を実行\n   - SNS/SQS: メッセージの配信と処理の分離\n\n3. 非同期処理アーキテクチャ\n   - API Gateway: クライアントからのリクエスト受付\n   - Lambda: 初期処理と非同期処理のトリガー\n   - SQS: タスクのキューイング\n   - Lambda: キューからのメッセージを処理\n   - DynamoDB: 処理結果の保存\n\n4. ファンアウトパターン\n   - SNS: 1つのイベントを複数のサービスに配信\n   - Lambda: 各サブスクライバーで異なる処理を実行\n   - SQS: 処理のバッファリングとリトライ\n\n5. マイクロサービスアーキテクチャ\n   - API Gateway: 各マイクロサービスへのルーティング\n   - Lambda: 各マイクロサービスのビジネスロジック\n   - EventBridge: サービス間の疎結合な通信\n   - DynamoDB: 各サービスの独立したデータストア\n\nこれらのサービスを組み合わせることで、スケーラブルで耐障害性の高い、コスト効率の良いアプリケーションを構築できます。具体的なユースケースや要件があれば、より詳細なアーキテクチャ設計についてアドバイスできます。"
        }
      }
    ],
    [
      {
        "additional_context": "--- CONTEXT ENTRY BEGIN ---\nThis section (like others) contains important information that I want you to use in your responses. I have gathered this context from valuable programmatic script hooks. You must follow any requests and consider all of the information in this section\n\n--- CONTEXT ENTRY END ---\n\n",
        "env_context": {
          "env_state": {
            "operating_system": "macos",
            "current_working_directory": "/Users/iwasa.takahito/work/hoge0518qdev/hoge1",
            "environment_variables": []
          }
        },
        "content": {
          "Prompt": {
            "prompt": "先ほど伝えたサービスをリストアップしてください"
          }
        },
        "images": null
      },
      {
        "Response": {
          "message_id": "xOwSDBccY",
          "content": "先ほど伝えていただいたAWSサービスは以下の通りです:\n\n- Lambda\n- API Gateway\n- EventBridge\n- SQS\n- SNS\n- DynamoDB"
        }
      }
    ]
  ],
  "valid_history_range": [
    0,
    2
  ],
  "transcript": [
    "> いくつかのAWSサービスを伝えます。Lambda, API Gateway, EventBeidge, SQS, SNS, DynamoDBです。どういうアーキテクチャが考えられますか",
    "これらのAWSサービスを組み合わせることで、いくつかの一般的なアーキテクチャパターンが考えられます。主なパターンをいくつか紹介します:\n\n1. サーバーレスAPIアーキテクチャ\n   - API Gateway: HTTPリクエストのエンドポイントとして機能\n   - Lambda: ビジネスロジックを実行\n   - DynamoDB: データの永続化\n\n2. イベント駆動型アーキテクチャ\n   - EventBridge: イベントの発行と管理\n   - Lambda: イベントに応じた処理を実行\n   - SNS/SQS: メッセージの配信と処理の分離\n\n3. 非同期処理アーキテクチャ\n   - API Gateway: クライアントからのリクエスト受付\n   - Lambda: 初期処理と非同期処理のトリガー\n   - SQS: タスクのキューイング\n   - Lambda: キューからのメッセージを処理\n   - DynamoDB: 処理結果の保存\n\n4. ファンアウトパターン\n   - SNS: 1つのイベントを複数のサービスに配信\n   - Lambda: 各サブスクライバーで異なる処理を実行\n   - SQS: 処理のバッファリングとリトライ\n\n5. マイクロサービスアーキテクチャ\n   - API Gateway: 各マイクロサービスへのルーティング\n   - Lambda: 各マイクロサービスのビジネスロジック\n   - EventBridge: サービス間の疎結合な通信\n   - DynamoDB: 各サービスの独立したデータストア\n\nこれらのサービスを組み合わせることで、スケーラブルで耐障害性の高い、コスト効率の良いアプリケーションを構築できます。具体的なユースケースや要件があれば、より詳細なアーキテクチャ設計についてアドバイスできます。\n[Tool uses: none]",
    "> 先ほど伝えたサービスをリストアップしてください",
    "先ほど伝えていただいたAWSサービスは以下の通りです:\n\n- Lambda\n- API Gateway\n- EventBridge\n- SQS\n- SNS\n- DynamoDB\n[Tool uses: none]",
    "> /help",
    "> /save hoge.json"
  ],
  "tools": {
    "native___": [
      {
        "ToolSpecification": {
          "name": "fs_write",
          "description": "A tool for creating and editing files\n * The `create` command will override the file at `path` if it already exists as a file, and otherwise create a new file\n * The `append` command will add content to the end of an existing file, automatically adding a newline if the file doesn't end with one. The file must exist.\n Notes for using the `str_replace` command:\n * The `old_str` parameter should match EXACTLY one or more consecutive lines from the original file. Be mindful of whitespaces!\n * If the `old_str` parameter is not unique in the file, the replacement will not be performed. Make sure to include enough context in `old_str` to make it unique\n * The `new_str` parameter should contain the edited lines that should replace the `old_str`.",
          "input_schema": {
            "json": {
              "properties": {
                "old_str": {
                  "description": "Required parameter of `str_replace` command containing the string in `path` to replace.",
                  "type": "string"
                },
                "command": {
                  "description": "The commands to run. Allowed options are: `create`, `str_replace`, `insert`, `append`.",
                  "enum": [
                    "create",
                    "str_replace",
                    "insert",
                    "append"
                  ],
                  "type": "string"
                },
                "path": {
                  "type": "string",
                  "description": "Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`."
                },
                "new_str": {
                  "description": "Required parameter of `str_replace` command containing the new string. Required parameter of `insert` command containing the string to insert. Required parameter of `append` command containing the content to append to the file.",
                  "type": "string"
                },
                "insert_line": {
                  "description": "Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.",
                  "type": "integer"
                },
                "file_text": {
                  "description": "Required parameter of `create` command, with the content of the file to be created.",
                  "type": "string"
                }
              },
              "required": [
                "command",
                "path"
              ],
              "type": "object"
            }
          }
        }
      },
      {
        "ToolSpecification": {
          "name": "use_aws",
          "description": "Make an AWS CLI api call with the specified service, operation, and parameters. All arguments MUST conform to the AWS CLI specification. Should the output of the invocation indicate a malformed command, invoke help to obtain the the correct command.",
          "input_schema": {
            "json": {
              "properties": {
                "label": {
                  "type": "string",
                  "description": "Human readable description of the api that is being called."
                },
                "service_name": {
                  "type": "string",
                  "description": "The name of the AWS service. If you want to query s3, you should use s3api if possible."
                },
                "parameters": {
                  "description": "The parameters for the operation. The parameter keys MUST conform to the AWS CLI specification. You should prefer to use JSON Syntax over shorthand syntax wherever possible. For parameters that are booleans, prioritize using flags with no value. Denote these flags with flag names as key and an empty string as their value. You should also prefer kebab case.",
                  "type": "object"
                },
                "region": {
                  "type": "string",
                  "description": "Region name for calling the operation on AWS."
                },
                "profile_name": {
                  "description": "Optional: AWS profile name to use from ~/.aws/credentials. Defaults to default profile if not specified.",
                  "type": "string"
                },
                "operation_name": {
                  "description": "The name of the operation to perform.",
                  "type": "string"
                }
              },
              "required": [
                "region",
                "service_name",
                "operation_name",
                "label"
              ],
              "type": "object"
            }
          }
        }
      },
      {
        "ToolSpecification": {
          "name": "dummy",
          "description": "This is a dummy tool. If you are seeing this that means the tool associated with this tool call is not in the list of available tools. This could be because a wrong tool name was supplied or the list of tools has changed since the conversation has started. Do not show this when user asks you to list tools.",
          "input_schema": {
            "json": {
              "required": [],
              "properties": {},
              "type": "object"
            }
          }
        }
      },
      {
        "ToolSpecification": {
          "name": "execute_bash",
          "description": "Execute the specified bash command.",
          "input_schema": {
            "json": {
              "properties": {
                "command": {
                  "description": "Bash command to execute",
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "description": "A brief explanation of what the command does"
                }
              },
              "required": [
                "command"
              ],
              "type": "object"
            }
          }
        }
      },
      {
        "ToolSpecification": {
          "name": "fs_read",
          "description": "Tool for reading files (for example, `cat -n`),  directories (for example, `ls -la`) and images. If user has supplied paths that appear to be leading to images, you should use this tool right away using Image mode. The behavior of this tool is determined by the `mode` parameter. The available modes are:\n- line: Show lines in a file, given by an optional `start_line` and optional `end_line`.\n- directory: List directory contents. Content is returned in the \"long format\" of ls (that is, `ls -la`).\n- search: Search for a pattern in a file. The pattern is a string. The matching is case insensitive.\n\nExample Usage:\n1. Read all lines from a file: command=\"line\", path=\"/path/to/file.txt\"\n2. Read the last 5 lines from a file: command=\"line\", path=\"/path/to/file.txt\", start_line=-5\n3. List the files in the home directory: command=\"line\", path=\"~\"\n4. Recursively list files in a directory to a max depth of 2: command=\"line\", path=\"/path/to/directory\", depth=2\n5. Search for all instances of \"test\" in a file: command=\"search\", path=\"/path/to/file.txt\", pattern=\"test\"\n",
          "input_schema": {
            "json": {
              "properties": {
                "path": {
                  "description": "Path to the file or directory. The path should be absolute, or otherwise start with ~ for the user's home.",
                  "type": "string"
                },
                "end_line": {
                  "default": -1,
                  "description": "Ending line number (optional, for Line mode). A negative index represents a line number starting from the end of the file.",
                  "type": "integer"
                },
                "pattern": {
                  "description": "Pattern to search for (required, for Search mode). Case insensitive. The pattern matching is performed per line.",
                  "type": "string"
                },
                "context_lines": {
                  "type": "integer",
                  "default": 2,
                  "description": "Number of context lines around search results (optional, for Search mode)"
                },
                "depth": {
                  "default": 0,
                  "type": "integer",
                  "description": "Depth of a recursive directory listing (optional, for Directory mode)"
                },
                "start_line": {
                  "type": "integer",
                  "default": 1,
                  "description": "Starting line number (optional, for Line mode). A negative index represents a line number starting from the end of the file."
                },
                "image_paths": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array",
                  "description": "List of paths to the images. This is currently supported by the Image mode."
                },
                "mode": {
                  "description": "The mode to run in: `Line`, `Directory`, `Search`. `Line` and `Search` are only for text files, and `Directory` is only for directories. `Image` is for image files, in this mode `image_paths` is required.",
                  "enum": [
                    "Line",
                    "Directory",
                    "Search",
                    "Image"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "path",
                "mode"
              ],
              "type": "object"
            }
          }
        }
      },
      {
        "ToolSpecification": {
          "name": "report_issue",
          "description": "Opens the browser to a pre-filled gh (GitHub) issue template to report chat issues, bugs, or feature requests. Pre-filled information includes the conversation transcript, chat context, and chat request IDs from the service.",
          "input_schema": {
            "json": {
              "properties": {
                "expected_behavior": {
                  "type": "string",
                  "description": "Optional: The expected chat behavior or action that did not happen."
                },
                "steps_to_reproduce": {
                  "type": "string",
                  "description": "Optional: Previous user chat requests or steps that were taken that may have resulted in the issue or error response."
                },
                "actual_behavior": {
                  "description": "Optional: The actual chat behavior that happened and demonstrates the issue or lack of a feature.",
                  "type": "string"
                },
                "title": {
                  "description": "The title of the GitHub issue.",
                  "type": "string"
                }
              },
              "required": [
                "title"
              ],
              "type": "object"
            }
          }
        }
      }
    ]
  },
  "context_manager": {
    "max_context_files_size": 150000,
    "global_config": {
      "paths": [
        ".amazonq/rules/**/*.md",
        "README.md",
        "AmazonQ.md"
      ],
      "hooks": {}
    },
    "current_profile": "default",
    "profile_config": {
      "paths": [
        "terraform",
        "hoge.md"
      ],
      "hooks": {}
    }
  },
  "context_message_length": 335,
  "latest_summary": null
}

historyだけでなく、transcripttoolsなども含まれています。
これただの JSON ファイルなので、実際の履歴じゃなくても履歴ファイルの内容は用意出来そうですね。

別のワークスペースで会話履歴を使う

ここで別のワークスペースに切り替えて会話履歴に関して問い合わせをしてみます。

hoge2 % q chat

    ⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
 ⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆
 ⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿
 ⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿
 ⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃
 ⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧

╭─────────────────────────────── Did you know? ────────────────────────────────╮
│                                                                              │
│     You can resume the last conversation from your current directory by      │
│                        launching with q chat --resume                        │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

/help all commands  •  ctrl + j new lines  •  ctrl + s fuzzy search
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> 先ほど伝えたサービスをリストアップしてください
すみません、先ほどサービスについての情報を受け取っていないようです。どのようなサービスについてリストアップすればよいでしょうか?AWS のサービスや特定のカテゴリのサービスなど、もう少し詳細
を教えていただけると、お役に立てると思います。

標準ではディレクトリごとに会話履歴が保存されているので、この時点ではまだ情報を受け取っていないと回答されました。
では、この環境に先ほど出力した会話履歴ファイルをインポートしてみましょう。/loadコマンドでファイルを指定します。

> /load ../hoge1/hoge.json

✔ Imported conversation state from ../hoge1/hoge.json

> 先ほど伝えたサービスをリストアップしてください
先ほど伝えていただいたAWSサービスは以下の通りです:

• Lambda
• API Gateway
• EventBridge
• SQS
• SNS
• DynamoDB

おお、今度は先程の環境の会話履歴に関する情報を取得することが出来ましたね。

さいごに

本日は Amazon Q Developer CLI の /save と /load コマンドで異なる環境に会話履歴を移行してみました。

私は会話履歴って一時的なものでそこまで重要視したことなかったのですが、環境が変わった際に移行したり、チーム内で共有したりとか、永続的に使い続けるような情報なのですかね。

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.