aws / aws/amazon-q-developer-cli

Feature Request: Add `on_quit` Hook for Amazon Q CLI to Enable Post-Session Processing

Open
#2,052 0 comments 8 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

I'd like to request an `on_quit` hook for Amazon Q CLI that would execute user-defined scripts when a session ends. This would enable automated post-session workflows such as saving chat logs and running processing scripts.

**Use Case:**
As an Amazon Q CLI user, I want to automatically:
- Save my chat logs to a specified location when I end a session
- Run custom processing scripts on those logs (e.g., for analysis, formatting, or integration with other tools)
- Execute cleanup or notification tasks when I exit Amazon Q

**Proposed Implementation:**
1. Add support for an `on_quit` hook in the Amazon Q CLI configuration file
2. Allow users to specify a script or command to run when the session ends (via `/quit` command or other termination methods)
3. Pass relevant session data (like chat history) to the script as parameters or environment variables

Example Configuration:
```json
{
"hooks": {
"on_quit": {
"command": "/path/to/my/script.sh",
"args": ["--save-path", "/path/to/logs/"],
"env": {
"Q_SESSION_ID": "$SESSION_ID"
}
}
}
}
```

**Benefits:**
- Enables automated workflows and integrations with other tools
- Improves productivity by eliminating manual steps after each session
- Allows for custom data retention and analysis of chat interactions
- Supports more sophisticated use cases for power users and developers, such as prompt or profile performance analysis

**Priority**: _Medium_

**Additional Notes:**
This feature would be particularly valuable for users who integrate Amazon Q into their development workflows and want to maintain records of their interactions or perform automated actions based on session content.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.