aws / aws/amazon-q-developer-cli

q_cli_default agent override not loading custom resources

Open
#2,922 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

## Bug Description

The `q_cli_default` agent override feature documented in [default-agent-behavior.md](https://github.com/aws/amazon-q-developer-cli/blob/main/docs/default-agent-behavior.md#create-a-custom-default) is not working as expected. When a custom `q_cli_default.json` file is placed in `.amazonq/cli-agents/`, it is ignored and the built-in default agent is used instead.

## Expected Behavior

When a `q_cli_default.json` file exists in the local or global agent directories, it should completely override the built-in default agent configuration, including custom resources, tools, and settings.

## Actual Behavior

The custom `q_cli_default.json` file is ignored, and the built-in default agent with hardcoded resources (AmazonQ.md, README.md, etc.) is used instead.

## Root Cause

In `crates/chat-cli/src/cli/agent/mod.rs` around line 688, the code directly calls `Agent::default()` without first checking if a `q_cli_default.json` file exists.

## Reproduction Steps

1. Create `.amazonq/cli-agents/q_cli_default.json` with custom resources
2. Run `q chat`
3. Check `/context show` - shows built-in resources instead of custom ones

## Impact

This prevents teams from setting up workspace-specific default agents that automatically load project context and rules when anyone runs `q chat` in their workspace.

## Additional Issues

- Documentation is missing the `.json` extension requirement
- No test coverage for this feature

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.