You've hit a known limitation — uploaded file knowledge sources are stored as document content in Dataverse, and solution packages transport component metadata and references, not the actual file binary content. This is why the references survive but the content doesn't.
There is no built-in solution task or PAC CLI command that migrates uploaded file content as part of a managed solution import today.
Here are your practical options, in order of recommendation:
1. Switch to SharePoint as your knowledge source. This is the cleanest ALM path. Upload your documents to a SharePoint document library, then point your agent's knowledge to the SharePoint URL instead of uploaded files. SharePoint knowledge sources are referenced by URL — the content lives in SharePoint, not in Dataverse, so there's nothing to migrate. Both dev and prod agents point to the same (or environment-specific) SharePoint site. This is what Microsoft recommends for production agents.
2. Switch to public website URLs. If your documents are published internally (e.g., on an intranet or Learn site), you can use website URLs as knowledge sources. Same benefit — the reference travels with the solution, the content lives externally.
3. Post-deployment script using Power Platform CLI. If you must use uploaded files, you can automate the re-upload step in your pipeline. After the managed solution import step, add a pipeline task that uses the PAC CLI or Dataverse Web API to upload the files programmatically. This isn't elegant, but it closes the gap. You'd store your source documents in your repo and script the upload against the target environment.
4. Configuration Migration Tool (CMT). CMT can export/import Dataverse data including file attachments. In theory, you could use it to transfer the knowledge file records. However, I'd test this carefully — the knowledge source indexing may not automatically trigger after a CMT import, which could leave you with files present but not searchable.
My recommendation: Option 1 (SharePoint). It eliminates the problem entirely, works better at scale, respects document permissions via Entra ID auth, and is the pattern Microsoft is investing in for enterprise knowledge.
Ref: https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-copilot-studio
Ref: https://learn.microsoft.com/en-us/microsoft-copilot-studio/authoring-export-import-bots