This file provides guidance to coding agents when working in this repository.
- Unless the user explicitly asks for it, do not inspect, reference, or modify files in
examples/. - Prefer the most specific
AGENTS.mdfile available for the directory you are changing. - For work in
packages/*, read the package-localpackages/<name>/AGENTS.mdbefore making changes.
- This repository is a
pnpmworkspace orchestrated with Turborepo. - Major areas include
auth/,client-sdks/,deployers/,docs/,integrations/,observability/,packages/,pubsub/,server-adapters/,stores/,voice/,workflows/, andworkspaces/. - The
docs/area has its own instructions indocs/AGENTS.md. - All packages use TypeScript with strict type checking.
- Vitest is the default test runner, with tests usually co-located with source files.
- Prefer the narrowest relevant build, test, and typecheck commands for the code you changed.
- For
packages/*work, start with the package's own scripts from inside the package directory. - If you need to work from the repository root, prefer package-specific root scripts such as
pnpm build:coreor filtered commands such aspnpm --filter ./packages/<name> <script>. - Do not default to
pnpm run setup,pnpm build,pnpm build:packages, or repo-wide test runs when a package-local or filtered command is sufficient. - Building the entire monorepo is slow and should be a last resort, not the default verification path.
- Use broader verification only when changes cross package boundaries, affect shared exports/contracts, or touch shared build tooling.
- Integration tests may require
pnpm dev:services:up/pnpm dev:services:downand, in some integration-test folders,pnpm i --ignore-workspace.
- Avoid repo-wide builds unless the change truly spans multiple packages or shared build tooling.
pnpm build- Build the repository except docs and examples.pnpm build:packages- Build all packages underpackages/.pnpm build:deployers- Build deployment adapters.pnpm build:combined-stores- Build storage adapters.
pnpm test:core,pnpm test:memory,pnpm test:rag,pnpm test:cli,pnpm test:auth,pnpm test:server-adapters- Targeted root test entry points for common packages.- When a package splits unit, integration, or E2E coverage, run the narrowest relevant suite first.
pnpm dev:services:up/pnpm dev:services:down- Start or stop Docker-backed services required by some integration suites.
- Prefer package-local lint or typecheck scripts when they exist.
pnpm typecheck- TypeScript checks across the workspace.pnpm prettier:format- Format code with Prettier.pnpm format- Run linting with auto-fixes across packages.
- Code changes must include related documentation updates when needed.
- Follow
docs/AGENTS.mdand the styleguides underdocs/styleguides/when editing docs.
- After code changes, create a changeset.
- Follow
@.mastracode/commands/changeset.mdfor changeset guidance.
Mastra is a modular AI framework built around central orchestration with pluggable components.
- Mastra Class (
mastra/) - Central configuration hub with dependency injection. - Agents (
agent/) - AI interaction abstraction with tools, memory, and voice. - Tools (
tools/) - Dynamic tool composition from multiple sources. - Memory (
memory/) - Thread-based persistence with semantic recall and working memory. - Workflows (
workflows/) - Step-based execution with suspend/resume. - Storage (
storage/) - Pluggable backends with shared interfaces.
- Any directory named
ee/is licensed under the Mastra Enterprise License. - Everything else is Apache-2.0 unless noted otherwise.
- EE code is imported through subpath exports such as
@mastra/core/auth/ee. - New EE features should live in an
ee/subdirectory within the relevant package. LICENSE.mdmaps directories to their licenses.