Skip to content

q_cli_default agent override not loading custom resources #2922

@gogakoreli

Description

@gogakoreli

Bug Description

The q_cli_default agent override feature documented in default-agent-behavior.md 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions