Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MitchCDisney
Copy link
Contributor

Fixes #3148

Problem

The migrate_legacy_knowledge_base function was incorrectly moving other agent directories into the current agent's directory when running /knowledge show. This created nested directory structures like:

~/.aws/amazonq/knowledge_bases/
  agent_a/
    agent_b/  <-- Wrong! Agent B nested inside Agent A

Root Cause

The migration logic didn't distinguish between files and directories when filtering entries in the knowledge_bases root. It was treating other agent directories as "legacy files" to migrate.

Solution

Added a check to ensure only FILES are migrated from the root directory, leaving other agent directories untouched.

Testing

  • Verified the filter now checks path.is_file() before migrating
  • Other agent directories will no longer be moved into the current agent's directory

Fixes aws#3148

The migrate_legacy_knowledge_base function was incorrectly moving
other agent directories into the current agent's directory when
running /knowledge show. This happened because the migration logic
didn't distinguish between files and directories.

Now only files are migrated from the knowledge_bases root, leaving
other agent directories untouched.
@kkashilk kkashilk merged commit e1a1981 into aws:main Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Knowledge for two agents, nests knowledge so the agents can't find their brain.

4 participants