Amazon Q Developer CLI で Git を使って更新チェックポイントを自動で管理してくれる「/checkpoint」機能を使ってみた
いわさです。
Amazon Q Developer CLI を使って様々なタスクを行っている時、様々なファイルの作成や更新を行うと思いますが特定時点の状態に戻したい時などがあると思います。
通常ワークスペースが Git 管理されており、コミットしていれば特定時点に復元することは出来ます。
先日の Amazon Q Developer CLI の v1.17.0 アップデートで「チェックポイント」という機能が追加されました。
この機能を使うと、ワークスペース外の Amazon Q Developer 用の一時フォルダへ内部的に Git のベアリポジトリを作成し/checkpoint
コマンドで利用されます。
特定時点に復元したり、あるいは Amazon Q Developer CLI が変更を反映した時にチェックポイントの作成を自動で行ってくれたりします。
以下のプルリクエストで実装されたものになります。
有効化
今回の機能はコマンドとしては/checkpoint
になります。
ただし、本日時点でヘルプ上にはまだこのコマンドは表示されていません。
> /help
q (Amazon Q Chat)
Usage: /<COMMAND>
Commands:
quit Quit the application
clear Clear the conversation history
agent Manage agents
context Manage context files for the chat session
editor Open $EDITOR (defaults to vi) to compose a prompt
reply Open $EDITOR with the most recent assistant message quoted for reply
compact Summarize the conversation to free up context space
tools View tools and permissions
issue Create a new Github issue or make a feature request
changelog View changelog for Amazon Q CLI
prompts View and retrieve prompts
hooks View context hooks
usage Show current session's context window usage
mcp See mcp server loaded
model Select a model for the current conversation session
experiment Toggle experimental features
subscribe Upgrade to a Q Developer Pro subscription for increased query limits
save Save the current conversation
load Load a previous conversation
todos View, manage, and resume to-do lists
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
ただし、コマンド自体は存在していて使うことは可能です。
叩いてみると次のように表示がされますね。
> /checkpoint
(Beta) Manage workspace checkpoints (init, list, restore, expand, diff, clean)
Experimental features may be changed or removed at any time
Usage: /checkpoint <COMMAND>
Commands:
init Initialize checkpoints manually
restore Restore workspace to a checkpoint
list List all checkpoints
clean Delete the shadow repository
expand Show details of a checkpoint
diff Show differences between checkpoints
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
そしてこのコマンドは本日時点ではベータ機能というか、実験的機能という位置付けになっています。
そのため、利用にあたっては/experiment
で有効化する必要があります。
> /experiment
⚠ Experimental features may be changed or removed at any time
? Select an experiment to toggle ›
❯ Knowledge [OFF] Enables persistent context storage and retrieval across chat sessions (/knowledge)
Thinking [OFF] Enables complex reasoning with step-by-step thought processes
Tangent Mode [OFF] Enables entering into a temporary mode for sending isolated conversations (/tangent)
Todo Lists [ON] Enables Q to create todo lists that can be viewed and managed using /todos
Checkpoint [OFF] Enables workspace checkpoints to snapshot, list, expand, diff, and restore files (/checkpoint)
Note: Cannot be used in tangent mode (to avoid mixing up conversation history)
Context Usage Indicator [OFF] Shows context usage percentage in the prompt (e.g., [rust-agent] 6% >)
チェックポイントを使う
有効化後はコマンドが利用できるようになりますので試してみましょう。
色々なサブコマンドが用意されていますね。
チェックポイントの一覧を表示したり、復元したりの操作ができそうです。
> /experiment
⚠ Experimental features may be changed or removed at any time
Checkpoint experiment enabled
> /checkpoint
(Beta) Manage workspace checkpoints (init, list, restore, expand, diff, clean)
Experimental features may be changed or removed at any time
Usage: /checkpoint <COMMAND>
Commands:
init Initialize checkpoints manually
restore Restore workspace to a checkpoint
list List all checkpoints
clean Delete the shadow repository
expand Show details of a checkpoint
diff Show differences between checkpoints
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
試しにチェックポイント一覧を表示する/checkpoint list
を試してみようとしたところ、まずは/checkpoint init
で有効化する必要があると言われました。
git init
するようなイメージでしょうかね。
> /checkpoint list
⚠️ Checkpoints not enabled. Use '/checkpoint init' to enable.
ということで、/checkpoint init
で有効化しましょう。
> /checkpoint init
📷 Checkpoints are enabled! (took 0.15s)
有効化出来ました。
チェックポイント一覧の確認
チェックポイントの一覧を確認してみます。
> /checkpoint list
[0] 2025-10-06 04:42:30 - Initial state
先程 Init した時点のチェックポイントが1件存在していますね。
チェックポイントの作成
ではここから適当なアプリケーションコードを変更する指示をしてみましょう。
> コンソール出力メッセージをもう少し詳しくしてください
> コンソール出力メッセージを詳しくするために、まず現在のコードを確認させてください。
:
● Completed in 3.889s [1.3]
> 完了しました。コンソール出力が詳細になり、実行時刻と明確な開始・終了メッセージが表示されるようになりました。
✓ Created checkpoint 1
変更の過程は重要じゃないのですが、最後の 1 行を見てみてください。
自動でチェックポイントが作成されていることがわかりますね。
/checkpoint list
でチェックポイントの確認を行ってみましょう。
> /checkpoint list
[0] 2025-10-06 04:49:12 - Initial state
[1] 2025-10-06 04:50:30 - コンソール出力メッセージをもう少し詳しく... (+23 ~2)
先程の変更指示で作成されたチェックポイントが確認出来ますね。
差分を確認
続いてチェックポイント同士の差分を確認できる/checkpoint diff
というコマンドがあるみたいなので、こちらも試してみます。
リストした時の1列目の情報がタグみたいで、これを指定するらしいです。
> /checkpoint diff 0 1
Changes from 0 to 1:
~ Program.cs (modified)
+ bin/Debug/net8.0/HelloWorld (added)
+ bin/Debug/net8.0/HelloWorld.deps.json (added)
+ bin/Debug/net8.0/HelloWorld.dll (added)
+ bin/Debug/net8.0/HelloWorld.pdb (added)
+ bin/Debug/net8.0/HelloWorld.runtimeconfig.json (added)
~ hoge.md (modified)
+ obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (added)
+ obj/Debug/net8.0/HelloWorld.AssemblyInfo.cs (added)
+ obj/Debug/net8.0/HelloWorld.AssemblyInfoInputs.cache (added)
+ obj/Debug/net8.0/HelloWorld.GeneratedMSBuildEditorConfig.editorconfig (added)
+ obj/Debug/net8.0/HelloWorld.assets.cache (added)
+ obj/Debug/net8.0/HelloWorld.csproj.CoreCompileInputs.cache (added)
+ obj/Debug/net8.0/HelloWorld.csproj.FileListAbsolute.txt (added)
+ obj/Debug/net8.0/HelloWorld.dll (added)
+ obj/Debug/net8.0/HelloWorld.genruntimeconfig.cache (added)
+ obj/Debug/net8.0/HelloWorld.pdb (added)
+ obj/Debug/net8.0/apphost (added)
+ obj/Debug/net8.0/ref/HelloWorld.dll (added)
+ obj/Debug/net8.0/refint/HelloWorld.dll (added)
+ obj/HelloWorld.csproj.nuget.dgspec.json (added)
+ obj/HelloWorld.csproj.nuget.g.props (added)
+ obj/HelloWorld.csproj.nuget.g.targets (added)
+ obj/project.assets.json (added)
+ obj/project.nuget.cache (added)
Program.cs | 3 +
bin/Debug/net8.0/HelloWorld | Bin 0 -> 124448 bytes
bin/Debug/net8.0/HelloWorld.deps.json | 23 ++++++
bin/Debug/net8.0/HelloWorld.dll | Bin 0 -> 5120 bytes
bin/Debug/net8.0/HelloWorld.pdb | Bin 0 -> 10336 bytes
bin/Debug/net8.0/HelloWorld.runtimeconfig.json | 12 +++
hoge.md | 34 +++++++-
.../.NETCoreApp,Version=v8.0.AssemblyAttributes.cs | 4 +
obj/Debug/net8.0/HelloWorld.AssemblyInfo.cs | 22 ++++++
.../net8.0/HelloWorld.AssemblyInfoInputs.cache | 1 +
...World.GeneratedMSBuildEditorConfig.editorconfig | 15 ++++
obj/Debug/net8.0/HelloWorld.assets.cache | Bin 0 -> 159 bytes
.../HelloWorld.csproj.CoreCompileInputs.cache | 1 +
.../net8.0/HelloWorld.csproj.FileListAbsolute.txt | 14 ++++
obj/Debug/net8.0/HelloWorld.dll | Bin 0 -> 5120 bytes
obj/Debug/net8.0/HelloWorld.genruntimeconfig.cache | 1 +
obj/Debug/net8.0/HelloWorld.pdb | Bin 0 -> 10336 bytes
obj/Debug/net8.0/apphost | Bin 0 -> 124448 bytes
obj/Debug/net8.0/ref/HelloWorld.dll | Bin 0 -> 5120 bytes
obj/Debug/net8.0/refint/HelloWorld.dll | Bin 0 -> 5120 bytes
obj/HelloWorld.csproj.nuget.dgspec.json | 82 +++++++++++++++++++
obj/HelloWorld.csproj.nuget.g.props | 15 ++++
obj/HelloWorld.csproj.nuget.g.targets | 2 +
obj/project.assets.json | 87 +++++++++++++++++++++
obj/project.nuget.cache | 12 +++
25 files changed, 327 insertions(+), 1 deletion(-)
なるほど、こんな感じか。
ファイルごとの差分表示というわけではないみたいですね。
指定したチェックポイントに戻す
diff
と同様にタグを指定する形で対象チェックポイント時点に戻すことができます。
> /checkpoint restore 0
✓ Restored to checkpoint 0
> /checkpoint restore 1
✓ Restored to checkpoint 1
これは一番使いそうな操作ですね。
復元を使っても最新のチェックポイントは残るので、いつでも戻すことができます。
ただし、ファイルへの変更が全て管理されているわけではなく明示的にチェックポイントの作成が行われている必要があるみたいなので、Amazon Q Developer CLI への指示と手動での編集が混在している場合には少し注意しましょう。私はチェックポイントの復元で手動編集した部分が失われてしまいました。
クリーン
最後に、不要になったセッション中のチェックポイントは/checkpoint clean
で削除することができます。
> /checkpoint clean
Deleting: /Users/iwasa.takahito/.aws/amazonq/cli-checkpoints/c2c9fbff-092e-4b60-bedc-db5033238d27
✓ Deleted shadow repository for this session.
> /checkpoint list
⚠️ Checkpoints not enabled. Use '/checkpoint init' to enable.
さいごに
本日は Amazon Q Developer CLI で Git を使って更新チェックポイントを自動で管理してくれる「/chckpoint」機能を使ってみました。
そもそも Git リポジトリを使っているので不要という方もいるかもしれませんが、コミット忘れていても Q が自動でチェックポイント作ってくれたりするので全然併用しても良さそうだと思いました。
デメリットもないですし、とりあえず有効化しておいても良さそうな機能ですね。