mastra-file-agents
Installation
SKILL.md
Migrate Mastra agents to file-based directories
Convert agents built with new Agent({...}) and registered in a
new Mastra({ agents: {...} }) map into one directory per agent under
src/mastra/agents/<name>/. Sibling files replace the old constructor options.
Preserve the agent's behavior. Move each option to the file that owns it, keep the same model, instructions, tools, memory, skills, and subagents, and do not invent config the agent did not have.
Check discovery and collisions first
Confirm the discovery path
The Mastra bundler discovers file-based agents during mastra dev and mastra build.
It does not discover them when an app imports the mastra instance directly, as a
library, custom server, or test might do. Confirm how the app runs before migrating.
Keep directly imported agents in code and explain why.