amazon-q-developer-cli icon indicating copy to clipboard operation
amazon-q-developer-cli copied to clipboard

Per-session support for /context

Open jlhood opened this issue 1 year ago • 3 comments

Today, /context allows you to add/remove context either globally or per profile (with per profile being the default). However, there are good use cases for adding context just for the current Q chat session.

Here's what it would look like:

/context add <path>  <-- adds to session (only persists for current session)
/context add --profile <path>  <-- adds to current profile context (persistent between sessions)
/context add --global <path>  <-- adds to global context (persistent between sessions)

Note: This is a backwards-incompatible change since it changes the behavior of /context add <path> from adding context to profile to adding to session. It's probably early enough that it's ok to do this if we feel conviction that this is a better experience.

jlhood avatar Apr 30 '25 19:04 jlhood

While adding this, we should also add a flag to the q chat command to pass per-session context files. Maybe a repeated --context flag. The key use case would be for adding per-session context files in non-interactive mode.

jlhood avatar May 02 '25 13:05 jlhood

Given these three types of contexts, it would be great to have these values show up in the Q dev cli prompt in the same manner that you might expect a zsh or bash prompt to show the git status. For instance, a very minimal count that is prepended to the prompt for each context type, just to give the user a summary of what the context looks like without having to run /context show all the time:

3-0-0 > /profile set test
3-0-0 [test] > /context add <path>
...
3-0-1 [test] > /context add --profile <path>
...
3-1-1 [test] > /context add --global <path>
...
4-1-1 [test] > /context show
🌍 global:
      ...

👤 profile (test):
      ...

6 matched files in use:
...

Make it prettier to taste, but the immediate feedback on if rules were found and if context is still lingering or hasn't been added would be a big productivity boost.

tobinquadros avatar May 02 '25 21:05 tobinquadros

After the launch of Custom Agents, this is the current behavior of /context

mschrage avatar Aug 11 '25 17:08 mschrage