@mastra/mcp-docs-server 1.1.5 → 1.1.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/adding-voice.md +349 -0
- package/.docs/docs/agents/agent-approval.md +558 -0
- package/.docs/docs/agents/agent-memory.md +209 -0
- package/.docs/docs/agents/guardrails.md +374 -0
- package/.docs/docs/agents/network-approval.md +275 -0
- package/.docs/docs/agents/networks.md +299 -0
- package/.docs/docs/agents/overview.md +304 -0
- package/.docs/docs/agents/processors.md +622 -0
- package/.docs/docs/agents/structured-output.md +273 -0
- package/.docs/docs/agents/supervisor-agents.md +304 -0
- package/.docs/docs/agents/using-tools.md +214 -0
- package/.docs/docs/build-with-ai/mcp-docs-server.md +238 -0
- package/.docs/docs/build-with-ai/skills.md +35 -0
- package/.docs/docs/community/contributing-templates.md +3 -0
- package/.docs/docs/community/discord.md +9 -0
- package/.docs/docs/community/licensing.md +66 -0
- package/.docs/docs/deployment/cloud-providers.md +15 -0
- package/.docs/docs/deployment/mastra-server.md +122 -0
- package/.docs/docs/deployment/monorepo.md +142 -0
- package/.docs/docs/deployment/overview.md +62 -0
- package/.docs/docs/deployment/studio.md +239 -0
- package/.docs/docs/deployment/web-framework.md +52 -0
- package/.docs/docs/deployment/workflow-runners.md +9 -0
- package/.docs/docs/evals/built-in-scorers.md +47 -0
- package/.docs/docs/evals/custom-scorers.md +519 -0
- package/.docs/docs/evals/overview.md +141 -0
- package/.docs/docs/evals/running-in-ci.md +124 -0
- package/.docs/docs/getting-started/build-with-ai.md +68 -0
- package/.docs/docs/getting-started/manual-install.md +226 -0
- package/.docs/docs/getting-started/project-structure.md +60 -0
- package/.docs/docs/getting-started/start.md +28 -0
- package/.docs/docs/getting-started/studio.md +101 -0
- package/.docs/docs/index.md +43 -0
- package/.docs/docs/mastra-cloud/deployment.md +77 -0
- package/.docs/docs/mastra-cloud/observability.md +38 -0
- package/.docs/docs/mastra-cloud/overview.md +23 -0
- package/.docs/docs/mastra-cloud/setup.md +42 -0
- package/.docs/docs/mastra-cloud/studio.md +24 -0
- package/.docs/docs/mastra-code/configuration.md +299 -0
- package/.docs/docs/mastra-code/customization.md +228 -0
- package/.docs/docs/mastra-code/modes.md +104 -0
- package/.docs/docs/mastra-code/overview.md +135 -0
- package/.docs/docs/mastra-code/tools.md +229 -0
- package/.docs/docs/mcp/overview.md +373 -0
- package/.docs/docs/mcp/publishing-mcp-server.md +95 -0
- package/.docs/docs/memory/memory-processors.md +314 -0
- package/.docs/docs/memory/message-history.md +260 -0
- package/.docs/docs/memory/observational-memory.md +248 -0
- package/.docs/docs/memory/overview.md +45 -0
- package/.docs/docs/memory/semantic-recall.md +272 -0
- package/.docs/docs/memory/storage.md +261 -0
- package/.docs/docs/memory/working-memory.md +400 -0
- package/.docs/docs/observability/datasets/overview.md +198 -0
- package/.docs/docs/observability/datasets/running-experiments.md +274 -0
- package/.docs/docs/observability/logging.md +99 -0
- package/.docs/docs/observability/overview.md +70 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +209 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +272 -0
- package/.docs/docs/observability/tracing/exporters/braintrust.md +111 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +127 -0
- package/.docs/docs/observability/tracing/exporters/datadog.md +187 -0
- package/.docs/docs/observability/tracing/exporters/default.md +209 -0
- package/.docs/docs/observability/tracing/exporters/laminar.md +100 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +213 -0
- package/.docs/docs/observability/tracing/exporters/langsmith.md +198 -0
- package/.docs/docs/observability/tracing/exporters/otel.md +476 -0
- package/.docs/docs/observability/tracing/exporters/posthog.md +148 -0
- package/.docs/docs/observability/tracing/exporters/sentry.md +208 -0
- package/.docs/docs/observability/tracing/overview.md +1112 -0
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +300 -0
- package/.docs/docs/rag/chunking-and-embedding.md +183 -0
- package/.docs/docs/rag/graph-rag.md +215 -0
- package/.docs/docs/rag/overview.md +72 -0
- package/.docs/docs/rag/retrieval.md +515 -0
- package/.docs/docs/rag/vector-databases.md +645 -0
- package/.docs/docs/server/auth/auth0.md +220 -0
- package/.docs/docs/server/auth/better-auth.md +203 -0
- package/.docs/docs/server/auth/clerk.md +132 -0
- package/.docs/docs/server/auth/composite-auth.md +234 -0
- package/.docs/docs/server/auth/custom-auth-provider.md +513 -0
- package/.docs/docs/server/auth/firebase.md +272 -0
- package/.docs/docs/server/auth/jwt.md +110 -0
- package/.docs/docs/server/auth/simple-auth.md +180 -0
- package/.docs/docs/server/auth/supabase.md +117 -0
- package/.docs/docs/server/auth/workos.md +186 -0
- package/.docs/docs/server/auth.md +38 -0
- package/.docs/docs/server/custom-adapters.md +378 -0
- package/.docs/docs/server/custom-api-routes.md +267 -0
- package/.docs/docs/server/mastra-client.md +243 -0
- package/.docs/docs/server/mastra-server.md +71 -0
- package/.docs/docs/server/middleware.md +225 -0
- package/.docs/docs/server/request-context.md +471 -0
- package/.docs/docs/server/server-adapters.md +547 -0
- package/.docs/docs/streaming/events.md +237 -0
- package/.docs/docs/streaming/overview.md +175 -0
- package/.docs/docs/streaming/tool-streaming.md +175 -0
- package/.docs/docs/streaming/workflow-streaming.md +109 -0
- package/.docs/docs/voice/overview.md +959 -0
- package/.docs/docs/voice/speech-to-speech.md +102 -0
- package/.docs/docs/voice/speech-to-text.md +79 -0
- package/.docs/docs/voice/text-to-speech.md +83 -0
- package/.docs/docs/workflows/agents-and-tools.md +166 -0
- package/.docs/docs/workflows/control-flow.md +822 -0
- package/.docs/docs/workflows/error-handling.md +360 -0
- package/.docs/docs/workflows/human-in-the-loop.md +215 -0
- package/.docs/docs/workflows/overview.md +370 -0
- package/.docs/docs/workflows/snapshots.md +238 -0
- package/.docs/docs/workflows/suspend-and-resume.md +205 -0
- package/.docs/docs/workflows/time-travel.md +309 -0
- package/.docs/docs/workflows/workflow-state.md +181 -0
- package/.docs/docs/workspace/filesystem.md +164 -0
- package/.docs/docs/workspace/overview.md +239 -0
- package/.docs/docs/workspace/sandbox.md +63 -0
- package/.docs/docs/workspace/search.md +243 -0
- package/.docs/docs/workspace/skills.md +169 -0
- package/.docs/guides/agent-frameworks/ai-sdk.md +140 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1499 -0
- package/.docs/guides/build-your-ui/assistant-ui.md +156 -0
- package/.docs/guides/build-your-ui/copilotkit.md +289 -0
- package/.docs/guides/deployment/amazon-ec2.md +130 -0
- package/.docs/guides/deployment/aws-lambda.md +248 -0
- package/.docs/guides/deployment/azure-app-services.md +114 -0
- package/.docs/guides/deployment/cloudflare.md +99 -0
- package/.docs/guides/deployment/digital-ocean.md +168 -0
- package/.docs/guides/deployment/inngest.md +682 -0
- package/.docs/guides/deployment/netlify.md +77 -0
- package/.docs/guides/deployment/vercel.md +101 -0
- package/.docs/guides/getting-started/astro.md +398 -0
- package/.docs/guides/getting-started/electron.md +504 -0
- package/.docs/guides/getting-started/express.md +251 -0
- package/.docs/guides/getting-started/hono.md +190 -0
- package/.docs/guides/getting-started/next-js.md +347 -0
- package/.docs/guides/getting-started/nuxt.md +497 -0
- package/.docs/guides/getting-started/quickstart.md +67 -0
- package/.docs/guides/getting-started/sveltekit.md +296 -0
- package/.docs/guides/getting-started/vite-react.md +425 -0
- package/.docs/guides/guide/ai-recruiter.md +226 -0
- package/.docs/guides/guide/chef-michel.md +211 -0
- package/.docs/guides/guide/code-review-bot.md +226 -0
- package/.docs/guides/guide/dev-assistant.md +307 -0
- package/.docs/guides/guide/docs-manager.md +238 -0
- package/.docs/guides/guide/github-actions-pr-description.md +236 -0
- package/.docs/guides/guide/notes-mcp-server.md +416 -0
- package/.docs/guides/guide/research-assistant.md +348 -0
- package/.docs/guides/guide/research-coordinator.md +416 -0
- package/.docs/guides/guide/stock-agent.md +132 -0
- package/.docs/guides/guide/web-search.md +320 -0
- package/.docs/guides/guide/whatsapp-chat-bot.md +405 -0
- package/.docs/guides/index.md +3 -0
- package/.docs/guides/migrations/agentnetwork.md +97 -0
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +112 -0
- package/.docs/guides/migrations/network-to-supervisor.md +261 -0
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +404 -0
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +57 -0
- package/.docs/guides/migrations/upgrade-to-v1/client.md +337 -0
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +37 -0
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +239 -0
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +143 -0
- package/.docs/guides/migrations/upgrade-to-v1/mcp.md +97 -0
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +285 -0
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +119 -0
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +68 -0
- package/.docs/guides/migrations/upgrade-to-v1/rag.md +42 -0
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +553 -0
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +180 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +412 -0
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +87 -0
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +30 -0
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +341 -0
- package/.docs/guides/migrations/vnext-to-standard-apis.md +362 -0
- package/.docs/models/embeddings.md +161 -0
- package/.docs/models/gateways/azure-openai.md +128 -0
- package/.docs/models/gateways/custom-gateways.md +545 -0
- package/.docs/models/gateways/netlify.md +88 -0
- package/.docs/models/gateways/openrouter.md +219 -0
- package/.docs/models/gateways/vercel.md +225 -0
- package/.docs/models/gateways.md +14 -0
- package/.docs/models/index.md +286 -0
- package/.docs/models/providers/302ai.md +134 -0
- package/.docs/models/providers/abacus.md +125 -0
- package/.docs/models/providers/agentrouter.md +90 -0
- package/.docs/models/providers/aihubmix.md +107 -0
- package/.docs/models/providers/alibaba-cn.md +135 -0
- package/.docs/models/providers/alibaba.md +111 -0
- package/.docs/models/providers/amazon-bedrock.md +33 -0
- package/.docs/models/providers/anthropic.md +153 -0
- package/.docs/models/providers/azure.md +33 -0
- package/.docs/models/providers/bailing.md +72 -0
- package/.docs/models/providers/baseten.md +77 -0
- package/.docs/models/providers/berget.md +78 -0
- package/.docs/models/providers/cerebras.md +101 -0
- package/.docs/models/providers/chutes.md +136 -0
- package/.docs/models/providers/cloudflare-ai-gateway.md +33 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +109 -0
- package/.docs/models/providers/cohere.md +33 -0
- package/.docs/models/providers/cortecs.md +91 -0
- package/.docs/models/providers/deepinfra.md +112 -0
- package/.docs/models/providers/deepseek.md +88 -0
- package/.docs/models/providers/fastrouter.md +84 -0
- package/.docs/models/providers/fireworks-ai.md +89 -0
- package/.docs/models/providers/firmware.md +85 -0
- package/.docs/models/providers/friendli.md +78 -0
- package/.docs/models/providers/github-models.md +125 -0
- package/.docs/models/providers/google-vertex.md +33 -0
- package/.docs/models/providers/google.md +159 -0
- package/.docs/models/providers/groq.md +107 -0
- package/.docs/models/providers/helicone.md +161 -0
- package/.docs/models/providers/huggingface.md +90 -0
- package/.docs/models/providers/iflowcn.md +84 -0
- package/.docs/models/providers/inception.md +72 -0
- package/.docs/models/providers/inference.md +79 -0
- package/.docs/models/providers/io-intelligence.md +87 -0
- package/.docs/models/providers/io-net.md +87 -0
- package/.docs/models/providers/jiekou.md +131 -0
- package/.docs/models/providers/kilo.md +333 -0
- package/.docs/models/providers/kimi-for-coding.md +100 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +71 -0
- package/.docs/models/providers/llama.md +77 -0
- package/.docs/models/providers/lmstudio.md +73 -0
- package/.docs/models/providers/lucidquery.md +72 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +102 -0
- package/.docs/models/providers/minimax-cn.md +102 -0
- package/.docs/models/providers/minimax-coding-plan.md +102 -0
- package/.docs/models/providers/minimax.md +104 -0
- package/.docs/models/providers/mistral.md +124 -0
- package/.docs/models/providers/moark.md +72 -0
- package/.docs/models/providers/modelscope.md +77 -0
- package/.docs/models/providers/moonshotai-cn.md +76 -0
- package/.docs/models/providers/moonshotai.md +76 -0
- package/.docs/models/providers/morph.md +73 -0
- package/.docs/models/providers/nano-gpt.md +103 -0
- package/.docs/models/providers/nebius.md +116 -0
- package/.docs/models/providers/nova.md +72 -0
- package/.docs/models/providers/novita-ai.md +154 -0
- package/.docs/models/providers/nvidia.md +141 -0
- package/.docs/models/providers/ollama-cloud.md +103 -0
- package/.docs/models/providers/ollama.md +33 -0
- package/.docs/models/providers/openai.md +193 -0
- package/.docs/models/providers/opencode.md +100 -0
- package/.docs/models/providers/ovhcloud.md +83 -0
- package/.docs/models/providers/perplexity.md +100 -0
- package/.docs/models/providers/poe.md +183 -0
- package/.docs/models/providers/privatemode-ai.md +75 -0
- package/.docs/models/providers/requesty.md +90 -0
- package/.docs/models/providers/scaleway.md +84 -0
- package/.docs/models/providers/siliconflow-cn.md +138 -0
- package/.docs/models/providers/siliconflow.md +140 -0
- package/.docs/models/providers/stackit.md +78 -0
- package/.docs/models/providers/stepfun.md +73 -0
- package/.docs/models/providers/submodel.md +79 -0
- package/.docs/models/providers/synthetic.md +96 -0
- package/.docs/models/providers/togetherai.md +115 -0
- package/.docs/models/providers/upstage.md +73 -0
- package/.docs/models/providers/venice.md +95 -0
- package/.docs/models/providers/vivgrid.md +106 -0
- package/.docs/models/providers/vultr.md +75 -0
- package/.docs/models/providers/wandb.md +80 -0
- package/.docs/models/providers/xai.md +141 -0
- package/.docs/models/providers/xiaomi.md +71 -0
- package/.docs/models/providers/zai-coding-plan.md +80 -0
- package/.docs/models/providers/zai.md +79 -0
- package/.docs/models/providers/zenmux.md +161 -0
- package/.docs/models/providers/zhipuai-coding-plan.md +79 -0
- package/.docs/models/providers/zhipuai.md +79 -0
- package/.docs/models/providers.md +81 -0
- package/.docs/reference/agents/agent.md +141 -0
- package/.docs/reference/agents/generate.md +186 -0
- package/.docs/reference/agents/generateLegacy.md +173 -0
- package/.docs/reference/agents/getDefaultGenerateOptions.md +36 -0
- package/.docs/reference/agents/getDefaultOptions.md +34 -0
- package/.docs/reference/agents/getDefaultStreamOptions.md +36 -0
- package/.docs/reference/agents/getDescription.md +21 -0
- package/.docs/reference/agents/getInstructions.md +34 -0
- package/.docs/reference/agents/getLLM.md +37 -0
- package/.docs/reference/agents/getMemory.md +34 -0
- package/.docs/reference/agents/getModel.md +34 -0
- package/.docs/reference/agents/getTools.md +29 -0
- package/.docs/reference/agents/getVoice.md +34 -0
- package/.docs/reference/agents/listAgents.md +35 -0
- package/.docs/reference/agents/listScorers.md +34 -0
- package/.docs/reference/agents/listTools.md +34 -0
- package/.docs/reference/agents/listWorkflows.md +34 -0
- package/.docs/reference/agents/network.md +133 -0
- package/.docs/reference/ai-sdk/chat-route.md +82 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +53 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +37 -0
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +55 -0
- package/.docs/reference/ai-sdk/network-route.md +74 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +231 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +79 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +76 -0
- package/.docs/reference/ai-sdk/with-mastra.md +59 -0
- package/.docs/reference/ai-sdk/workflow-route.md +79 -0
- package/.docs/reference/auth/auth0.md +73 -0
- package/.docs/reference/auth/better-auth.md +71 -0
- package/.docs/reference/auth/clerk.md +36 -0
- package/.docs/reference/auth/firebase.md +80 -0
- package/.docs/reference/auth/jwt.md +26 -0
- package/.docs/reference/auth/supabase.md +33 -0
- package/.docs/reference/auth/workos.md +84 -0
- package/.docs/reference/cli/create-mastra.md +137 -0
- package/.docs/reference/cli/mastra.md +336 -0
- package/.docs/reference/client-js/agents.md +437 -0
- package/.docs/reference/client-js/error-handling.md +16 -0
- package/.docs/reference/client-js/logs.md +24 -0
- package/.docs/reference/client-js/mastra-client.md +63 -0
- package/.docs/reference/client-js/memory.md +221 -0
- package/.docs/reference/client-js/observability.md +72 -0
- package/.docs/reference/client-js/telemetry.md +20 -0
- package/.docs/reference/client-js/tools.md +44 -0
- package/.docs/reference/client-js/vectors.md +79 -0
- package/.docs/reference/client-js/workflows.md +199 -0
- package/.docs/reference/configuration.md +752 -0
- package/.docs/reference/core/addGateway.md +42 -0
- package/.docs/reference/core/getAgent.md +21 -0
- package/.docs/reference/core/getAgentById.md +21 -0
- package/.docs/reference/core/getDeployer.md +22 -0
- package/.docs/reference/core/getGateway.md +38 -0
- package/.docs/reference/core/getGatewayById.md +41 -0
- package/.docs/reference/core/getLogger.md +22 -0
- package/.docs/reference/core/getMCPServer.md +47 -0
- package/.docs/reference/core/getMCPServerById.md +55 -0
- package/.docs/reference/core/getMemory.md +50 -0
- package/.docs/reference/core/getScorer.md +54 -0
- package/.docs/reference/core/getScorerById.md +54 -0
- package/.docs/reference/core/getServer.md +22 -0
- package/.docs/reference/core/getStorage.md +22 -0
- package/.docs/reference/core/getStoredAgentById.md +89 -0
- package/.docs/reference/core/getTelemetry.md +22 -0
- package/.docs/reference/core/getVector.md +22 -0
- package/.docs/reference/core/getWorkflow.md +42 -0
- package/.docs/reference/core/listAgents.md +21 -0
- package/.docs/reference/core/listGateways.md +40 -0
- package/.docs/reference/core/listLogs.md +38 -0
- package/.docs/reference/core/listLogsByRunId.md +36 -0
- package/.docs/reference/core/listMCPServers.md +55 -0
- package/.docs/reference/core/listMemory.md +56 -0
- package/.docs/reference/core/listScorers.md +29 -0
- package/.docs/reference/core/listStoredAgents.md +93 -0
- package/.docs/reference/core/listVectors.md +22 -0
- package/.docs/reference/core/listWorkflows.md +21 -0
- package/.docs/reference/core/mastra-class.md +66 -0
- package/.docs/reference/core/mastra-model-gateway.md +153 -0
- package/.docs/reference/core/setLogger.md +26 -0
- package/.docs/reference/core/setStorage.md +27 -0
- package/.docs/reference/datasets/addItem.md +37 -0
- package/.docs/reference/datasets/addItems.md +35 -0
- package/.docs/reference/datasets/compareExperiments.md +52 -0
- package/.docs/reference/datasets/create.md +51 -0
- package/.docs/reference/datasets/dataset.md +82 -0
- package/.docs/reference/datasets/datasets-manager.md +94 -0
- package/.docs/reference/datasets/delete.md +25 -0
- package/.docs/reference/datasets/deleteExperiment.md +27 -0
- package/.docs/reference/datasets/deleteItem.md +27 -0
- package/.docs/reference/datasets/deleteItems.md +29 -0
- package/.docs/reference/datasets/get.md +31 -0
- package/.docs/reference/datasets/getDetails.md +47 -0
- package/.docs/reference/datasets/getExperiment.md +30 -0
- package/.docs/reference/datasets/getItem.md +33 -0
- package/.docs/reference/datasets/getItemHistory.md +31 -0
- package/.docs/reference/datasets/list.md +31 -0
- package/.docs/reference/datasets/listExperimentResults.md +39 -0
- package/.docs/reference/datasets/listExperiments.md +33 -0
- package/.docs/reference/datasets/listItems.md +46 -0
- package/.docs/reference/datasets/listVersions.md +33 -0
- package/.docs/reference/datasets/startExperiment.md +62 -0
- package/.docs/reference/datasets/startExperimentAsync.md +43 -0
- package/.docs/reference/datasets/update.md +48 -0
- package/.docs/reference/datasets/updateItem.md +38 -0
- package/.docs/reference/deployer/cloudflare.md +79 -0
- package/.docs/reference/deployer/netlify.md +80 -0
- package/.docs/reference/deployer/vercel.md +91 -0
- package/.docs/reference/deployer.md +100 -0
- package/.docs/reference/evals/answer-relevancy.md +105 -0
- package/.docs/reference/evals/answer-similarity.md +99 -0
- package/.docs/reference/evals/bias.md +120 -0
- package/.docs/reference/evals/completeness.md +136 -0
- package/.docs/reference/evals/content-similarity.md +101 -0
- package/.docs/reference/evals/context-precision.md +196 -0
- package/.docs/reference/evals/context-relevance.md +531 -0
- package/.docs/reference/evals/create-scorer.md +270 -0
- package/.docs/reference/evals/faithfulness.md +114 -0
- package/.docs/reference/evals/hallucination.md +213 -0
- package/.docs/reference/evals/keyword-coverage.md +128 -0
- package/.docs/reference/evals/mastra-scorer.md +123 -0
- package/.docs/reference/evals/noise-sensitivity.md +675 -0
- package/.docs/reference/evals/prompt-alignment.md +614 -0
- package/.docs/reference/evals/run-evals.md +179 -0
- package/.docs/reference/evals/scorer-utils.md +326 -0
- package/.docs/reference/evals/textual-difference.md +113 -0
- package/.docs/reference/evals/tone-consistency.md +119 -0
- package/.docs/reference/evals/tool-call-accuracy.md +533 -0
- package/.docs/reference/evals/toxicity.md +123 -0
- package/.docs/reference/harness/harness-class.md +708 -0
- package/.docs/reference/index.md +277 -0
- package/.docs/reference/logging/pino-logger.md +117 -0
- package/.docs/reference/mastra-code/createMastraCode.md +108 -0
- package/.docs/reference/memory/clone-utilities.md +199 -0
- package/.docs/reference/memory/cloneThread.md +130 -0
- package/.docs/reference/memory/createThread.md +68 -0
- package/.docs/reference/memory/deleteMessages.md +38 -0
- package/.docs/reference/memory/getThreadById.md +24 -0
- package/.docs/reference/memory/listThreads.md +145 -0
- package/.docs/reference/memory/memory-class.md +147 -0
- package/.docs/reference/memory/observational-memory.md +565 -0
- package/.docs/reference/memory/recall.md +91 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +131 -0
- package/.docs/reference/observability/tracing/configuration.md +178 -0
- package/.docs/reference/observability/tracing/exporters/arize.md +141 -0
- package/.docs/reference/observability/tracing/exporters/braintrust.md +93 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +163 -0
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +138 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +116 -0
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +174 -0
- package/.docs/reference/observability/tracing/exporters/laminar.md +78 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +134 -0
- package/.docs/reference/observability/tracing/exporters/langsmith.md +108 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +199 -0
- package/.docs/reference/observability/tracing/exporters/posthog.md +92 -0
- package/.docs/reference/observability/tracing/exporters/sentry.md +184 -0
- package/.docs/reference/observability/tracing/instances.md +107 -0
- package/.docs/reference/observability/tracing/interfaces.md +743 -0
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +144 -0
- package/.docs/reference/observability/tracing/spans.md +224 -0
- package/.docs/reference/processors/batch-parts-processor.md +61 -0
- package/.docs/reference/processors/language-detector.md +82 -0
- package/.docs/reference/processors/message-history-processor.md +85 -0
- package/.docs/reference/processors/moderation-processor.md +104 -0
- package/.docs/reference/processors/pii-detector.md +108 -0
- package/.docs/reference/processors/processor-interface.md +521 -0
- package/.docs/reference/processors/prompt-injection-detector.md +72 -0
- package/.docs/reference/processors/semantic-recall-processor.md +117 -0
- package/.docs/reference/processors/system-prompt-scrubber.md +80 -0
- package/.docs/reference/processors/token-limiter-processor.md +115 -0
- package/.docs/reference/processors/tool-call-filter.md +85 -0
- package/.docs/reference/processors/tool-search-processor.md +111 -0
- package/.docs/reference/processors/unicode-normalizer.md +62 -0
- package/.docs/reference/processors/working-memory-processor.md +152 -0
- package/.docs/reference/rag/chunk.md +221 -0
- package/.docs/reference/rag/database-config.md +261 -0
- package/.docs/reference/rag/document.md +114 -0
- package/.docs/reference/rag/embeddings.md +92 -0
- package/.docs/reference/rag/extract-params.md +168 -0
- package/.docs/reference/rag/graph-rag.md +111 -0
- package/.docs/reference/rag/metadata-filters.md +216 -0
- package/.docs/reference/rag/rerank.md +75 -0
- package/.docs/reference/rag/rerankWithScorer.md +80 -0
- package/.docs/reference/server/create-route.md +262 -0
- package/.docs/reference/server/express-adapter.md +176 -0
- package/.docs/reference/server/fastify-adapter.md +90 -0
- package/.docs/reference/server/hono-adapter.md +162 -0
- package/.docs/reference/server/koa-adapter.md +127 -0
- package/.docs/reference/server/mastra-server.md +298 -0
- package/.docs/reference/server/register-api-route.md +249 -0
- package/.docs/reference/server/routes.md +306 -0
- package/.docs/reference/storage/cloudflare-d1.md +218 -0
- package/.docs/reference/storage/cloudflare.md +88 -0
- package/.docs/reference/storage/composite.md +235 -0
- package/.docs/reference/storage/convex.md +161 -0
- package/.docs/reference/storage/dynamodb.md +282 -0
- package/.docs/reference/storage/lance.md +131 -0
- package/.docs/reference/storage/libsql.md +135 -0
- package/.docs/reference/storage/mongodb.md +262 -0
- package/.docs/reference/storage/mssql.md +157 -0
- package/.docs/reference/storage/overview.md +121 -0
- package/.docs/reference/storage/postgresql.md +526 -0
- package/.docs/reference/storage/upstash.md +160 -0
- package/.docs/reference/streaming/ChunkType.md +292 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +182 -0
- package/.docs/reference/streaming/agents/stream.md +221 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +142 -0
- package/.docs/reference/streaming/workflows/observeStream.md +42 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +61 -0
- package/.docs/reference/streaming/workflows/stream.md +88 -0
- package/.docs/reference/streaming/workflows/timeTravelStream.md +142 -0
- package/.docs/reference/templates/overview.md +194 -0
- package/.docs/reference/tools/create-tool.md +237 -0
- package/.docs/reference/tools/document-chunker-tool.md +89 -0
- package/.docs/reference/tools/graph-rag-tool.md +182 -0
- package/.docs/reference/tools/mcp-client.md +954 -0
- package/.docs/reference/tools/mcp-server.md +1271 -0
- package/.docs/reference/tools/vector-query-tool.md +459 -0
- package/.docs/reference/vectors/astra.md +121 -0
- package/.docs/reference/vectors/chroma.md +264 -0
- package/.docs/reference/vectors/convex.md +300 -0
- package/.docs/reference/vectors/couchbase.md +226 -0
- package/.docs/reference/vectors/duckdb.md +318 -0
- package/.docs/reference/vectors/elasticsearch.md +189 -0
- package/.docs/reference/vectors/lance.md +220 -0
- package/.docs/reference/vectors/libsql.md +305 -0
- package/.docs/reference/vectors/mongodb.md +295 -0
- package/.docs/reference/vectors/opensearch.md +99 -0
- package/.docs/reference/vectors/pg.md +408 -0
- package/.docs/reference/vectors/pinecone.md +168 -0
- package/.docs/reference/vectors/qdrant.md +222 -0
- package/.docs/reference/vectors/s3vectors.md +277 -0
- package/.docs/reference/vectors/turbopuffer.md +157 -0
- package/.docs/reference/vectors/upstash.md +294 -0
- package/.docs/reference/vectors/vectorize.md +147 -0
- package/.docs/reference/voice/azure.md +148 -0
- package/.docs/reference/voice/cloudflare.md +83 -0
- package/.docs/reference/voice/composite-voice.md +121 -0
- package/.docs/reference/voice/deepgram.md +79 -0
- package/.docs/reference/voice/elevenlabs.md +98 -0
- package/.docs/reference/voice/google-gemini-live.md +378 -0
- package/.docs/reference/voice/google.md +228 -0
- package/.docs/reference/voice/mastra-voice.md +311 -0
- package/.docs/reference/voice/murf.md +122 -0
- package/.docs/reference/voice/openai-realtime.md +203 -0
- package/.docs/reference/voice/openai.md +88 -0
- package/.docs/reference/voice/playai.md +80 -0
- package/.docs/reference/voice/sarvam.md +126 -0
- package/.docs/reference/voice/speechify.md +75 -0
- package/.docs/reference/voice/voice.addInstructions.md +55 -0
- package/.docs/reference/voice/voice.addTools.md +67 -0
- package/.docs/reference/voice/voice.answer.md +54 -0
- package/.docs/reference/voice/voice.close.md +51 -0
- package/.docs/reference/voice/voice.connect.md +94 -0
- package/.docs/reference/voice/voice.events.md +37 -0
- package/.docs/reference/voice/voice.getSpeakers.md +129 -0
- package/.docs/reference/voice/voice.listen.md +164 -0
- package/.docs/reference/voice/voice.off.md +54 -0
- package/.docs/reference/voice/voice.on.md +111 -0
- package/.docs/reference/voice/voice.send.md +65 -0
- package/.docs/reference/voice/voice.speak.md +157 -0
- package/.docs/reference/voice/voice.updateConfig.md +60 -0
- package/.docs/reference/workflows/run-methods/cancel.md +86 -0
- package/.docs/reference/workflows/run-methods/restart.md +33 -0
- package/.docs/reference/workflows/run-methods/resume.md +59 -0
- package/.docs/reference/workflows/run-methods/start.md +58 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +67 -0
- package/.docs/reference/workflows/run-methods/timeTravel.md +142 -0
- package/.docs/reference/workflows/run.md +59 -0
- package/.docs/reference/workflows/step.md +119 -0
- package/.docs/reference/workflows/workflow-methods/branch.md +25 -0
- package/.docs/reference/workflows/workflow-methods/commit.md +17 -0
- package/.docs/reference/workflows/workflow-methods/create-run.md +63 -0
- package/.docs/reference/workflows/workflow-methods/dountil.md +25 -0
- package/.docs/reference/workflows/workflow-methods/dowhile.md +25 -0
- package/.docs/reference/workflows/workflow-methods/foreach.md +118 -0
- package/.docs/reference/workflows/workflow-methods/map.md +93 -0
- package/.docs/reference/workflows/workflow-methods/parallel.md +21 -0
- package/.docs/reference/workflows/workflow-methods/sleep.md +35 -0
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +35 -0
- package/.docs/reference/workflows/workflow-methods/then.md +21 -0
- package/.docs/reference/workflows/workflow.md +157 -0
- package/.docs/reference/workspace/e2b-sandbox.md +289 -0
- package/.docs/reference/workspace/filesystem.md +255 -0
- package/.docs/reference/workspace/gcs-filesystem.md +174 -0
- package/.docs/reference/workspace/local-filesystem.md +343 -0
- package/.docs/reference/workspace/local-sandbox.md +301 -0
- package/.docs/reference/workspace/s3-filesystem.md +175 -0
- package/.docs/reference/workspace/sandbox.md +87 -0
- package/.docs/reference/workspace/workspace-class.md +244 -0
- package/CHANGELOG.md +8 -0
- package/package.json +5 -5
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Customization
|
|
2
|
+
|
|
3
|
+
Mastra Code is designed as a composable library. The [`createMastraCode()`](https://mastra.ai/reference/mastra-code/createMastraCode) factory function accepts configuration overrides, and the returned [`Harness`](https://mastra.ai/reference/harness/harness-class) can drive any frontend, not just the built-in TUI.
|
|
4
|
+
|
|
5
|
+
## Programmatic usage
|
|
6
|
+
|
|
7
|
+
Import `createMastraCode` to bootstrap Mastra Code in your own application:
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { createMastraCode } from 'mastracode'
|
|
11
|
+
|
|
12
|
+
const { harness, mcpManager, authStorage } = createMastraCode({
|
|
13
|
+
cwd: '/path/to/project',
|
|
14
|
+
initialState: {
|
|
15
|
+
yolo: false,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
await harness.init()
|
|
20
|
+
await harness.selectOrCreateThread()
|
|
21
|
+
|
|
22
|
+
harness.subscribe(event => {
|
|
23
|
+
if (event.type === 'message_update') {
|
|
24
|
+
console.log(event.message.content)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
await harness.sendMessage({ content: 'Explain the auth module' })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The `harness` object is a standard [Harness](https://mastra.ai/reference/harness/harness-class) instance. You can subscribe to events, switch modes, manage threads, and send messages through its API.
|
|
32
|
+
|
|
33
|
+
## Custom modes
|
|
34
|
+
|
|
35
|
+
Override the default Build/Plan/Fast modes by passing a `modes` array:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { createMastraCode } from 'mastracode'
|
|
39
|
+
import { Agent } from '@mastra/core/agent'
|
|
40
|
+
|
|
41
|
+
const reviewAgent = new Agent({
|
|
42
|
+
id: 'review-agent',
|
|
43
|
+
name: 'Review Agent',
|
|
44
|
+
instructions:
|
|
45
|
+
'You are a code review specialist. Analyze code for bugs, security issues, and best practices.',
|
|
46
|
+
model: 'anthropic/claude-sonnet-4',
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const { harness } = createMastraCode({
|
|
50
|
+
modes: [
|
|
51
|
+
{
|
|
52
|
+
id: 'review',
|
|
53
|
+
name: 'Review',
|
|
54
|
+
default: true,
|
|
55
|
+
defaultModelId: 'anthropic/claude-sonnet-4',
|
|
56
|
+
color: '#f59e0b',
|
|
57
|
+
agent: reviewAgent,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'build',
|
|
61
|
+
name: 'Build',
|
|
62
|
+
defaultModelId: 'anthropic/claude-opus-4-6',
|
|
63
|
+
color: '#7c3aed',
|
|
64
|
+
agent: reviewAgent,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Each mode requires an `id` and an `agent`. The `name`, `defaultModelId`, and `color` fields control how the mode appears in the TUI.
|
|
71
|
+
|
|
72
|
+
## Extra tools
|
|
73
|
+
|
|
74
|
+
Add custom tools to the agent's tool set without replacing the built-in tools:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { createMastraCode } from 'mastracode'
|
|
78
|
+
import { createTool } from '@mastra/core/tools'
|
|
79
|
+
import { z } from 'zod'
|
|
80
|
+
|
|
81
|
+
const deployTool = createTool({
|
|
82
|
+
id: 'deploy',
|
|
83
|
+
description: 'Deploy the current branch to staging',
|
|
84
|
+
inputSchema: z.object({
|
|
85
|
+
environment: z.enum(['staging', 'production']),
|
|
86
|
+
}),
|
|
87
|
+
execute: async ({ environment }) => {
|
|
88
|
+
return { content: `Deployed to ${environment}` }
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const { harness } = createMastraCode({
|
|
93
|
+
extraTools: { deploy: deployTool },
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Extra tools are merged with the dynamic tool set and are available to the agent in all modes.
|
|
98
|
+
|
|
99
|
+
## Custom subagents
|
|
100
|
+
|
|
101
|
+
Override the default Explore/Plan/Execute subagents. Each subagent receives its own set of tools, scoping what it can do:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { createMastraCode } from 'mastracode'
|
|
105
|
+
import { createTool } from '@mastra/core/tools'
|
|
106
|
+
|
|
107
|
+
const { harness } = createMastraCode({
|
|
108
|
+
subagents: [
|
|
109
|
+
{
|
|
110
|
+
id: 'explore',
|
|
111
|
+
name: 'Explore',
|
|
112
|
+
description: 'Read-only codebase exploration',
|
|
113
|
+
instructions:
|
|
114
|
+
'You are an expert code explorer. Use read-only tools to answer questions about the codebase.',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'test-writer',
|
|
118
|
+
name: 'Test Writer',
|
|
119
|
+
description: 'Write tests for the specified module',
|
|
120
|
+
instructions:
|
|
121
|
+
'You are a test-writing specialist. Generate comprehensive tests for the given module.',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Custom storage
|
|
128
|
+
|
|
129
|
+
Connect to a remote database instead of the default local SQLite:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { createMastraCode } from 'mastracode'
|
|
133
|
+
|
|
134
|
+
const { harness } = createMastraCode({
|
|
135
|
+
storage: {
|
|
136
|
+
url: 'libsql://my-db.turso.io',
|
|
137
|
+
authToken: 'my-auth-token',
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
This is equivalent to setting `.mastracode/database.json` but allows configuration at the code level.
|
|
143
|
+
|
|
144
|
+
## Custom heartbeat handlers
|
|
145
|
+
|
|
146
|
+
Replace or extend the default background tasks:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { createMastraCode } from 'mastracode'
|
|
150
|
+
|
|
151
|
+
const { harness } = createMastraCode({
|
|
152
|
+
heartbeatHandlers: [
|
|
153
|
+
{
|
|
154
|
+
id: 'sync-config',
|
|
155
|
+
intervalMs: 60_000,
|
|
156
|
+
handler: async () => {
|
|
157
|
+
await syncConfigFromRemote()
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Heartbeat handlers run on a fixed interval. They start when `harness.init()` is called and stop when `harness.destroy()` is called.
|
|
165
|
+
|
|
166
|
+
## Building a custom TUI
|
|
167
|
+
|
|
168
|
+
Mastra Code exports the `MastraTUI` class from `mastracode/tui` for building custom terminal interfaces. The TUI is driven by the Harness event system:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { createMastraCode } from 'mastracode'
|
|
172
|
+
import { MastraTUI } from 'mastracode/tui'
|
|
173
|
+
|
|
174
|
+
const { harness, mcpManager, hookManager, authStorage } = createMastraCode()
|
|
175
|
+
|
|
176
|
+
const tui = new MastraTUI({
|
|
177
|
+
harness,
|
|
178
|
+
hookManager,
|
|
179
|
+
authStorage,
|
|
180
|
+
mcpManager,
|
|
181
|
+
appName: 'My Coding Agent',
|
|
182
|
+
version: '1.0.0',
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
tui.run()
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The TUI subscribes to harness events and renders messages, tool calls, approvals, and status information in real time.
|
|
189
|
+
|
|
190
|
+
## Initial state overrides
|
|
191
|
+
|
|
192
|
+
Control default behavior through `initialState`:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { createMastraCode } from 'mastracode'
|
|
196
|
+
|
|
197
|
+
const { harness } = createMastraCode({
|
|
198
|
+
initialState: {
|
|
199
|
+
yolo: false,
|
|
200
|
+
thinkingLevel: 'high',
|
|
201
|
+
smartEditing: true,
|
|
202
|
+
notifications: 'system',
|
|
203
|
+
permissionRules: {
|
|
204
|
+
categories: {
|
|
205
|
+
read: 'allow',
|
|
206
|
+
edit: 'ask',
|
|
207
|
+
execute: 'ask',
|
|
208
|
+
mcp: 'deny',
|
|
209
|
+
},
|
|
210
|
+
tools: {},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Available state fields
|
|
217
|
+
|
|
218
|
+
| Field | Type | Default | Description |
|
|
219
|
+
| ---------------------- | --------------------------------------- | --------------------------- | -------------------------------------------- |
|
|
220
|
+
| `yolo` | `boolean` | `true` | Auto-approve all tool calls |
|
|
221
|
+
| `thinkingLevel` | `string` | `"off"` | Extended thinking depth for Anthropic models |
|
|
222
|
+
| `smartEditing` | `boolean` | `true` | Use AST-based analysis for code edits |
|
|
223
|
+
| `notifications` | `"bell" \| "system" \| "both" \| "off"` | `"off"` | Alert when the TUI needs attention |
|
|
224
|
+
| `permissionRules` | `object` | Default policies | Per-category and per-tool approval policies |
|
|
225
|
+
| `observerModelId` | `string` | `"google/gemini-2.5-flash"` | Model for observational memory observer |
|
|
226
|
+
| `reflectorModelId` | `string` | `"google/gemini-2.5-flash"` | Model for observational memory reflector |
|
|
227
|
+
| `observationThreshold` | `number` | `30000` | Token count triggering observation pass |
|
|
228
|
+
| `reflectionThreshold` | `number` | `40000` | Token count triggering reflection pass |
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Modes
|
|
2
|
+
|
|
3
|
+
Mastra Code operates in one of three modes, each tailored to a different kind of task. Modes control which tools the agent has access to, how it approaches problems, and which default model it uses.
|
|
4
|
+
|
|
5
|
+
Switch modes with the `/mode` slash command.
|
|
6
|
+
|
|
7
|
+
## Build mode
|
|
8
|
+
|
|
9
|
+
Build mode is the default. The agent has full access to all tools — reading, writing, editing files, and running shell commands.
|
|
10
|
+
|
|
11
|
+
Use Build mode when you want the agent to make changes to your codebase: implementing features, fixing bugs, refactoring code, or running tests.
|
|
12
|
+
|
|
13
|
+
### Working style
|
|
14
|
+
|
|
15
|
+
- **Simple tasks** (typo fixes, single-file changes): The agent acts immediately without planning.
|
|
16
|
+
- **Non-trivial tasks** (3+ files, architectural decisions): The agent creates a task list, works through each step, and verifies changes before moving on.
|
|
17
|
+
|
|
18
|
+
### Implementation loop
|
|
19
|
+
|
|
20
|
+
For each change, the agent follows this cycle:
|
|
21
|
+
|
|
22
|
+
1. **Understand**: Read the relevant code and check existing conventions.
|
|
23
|
+
2. **Implement**: Make the change following existing patterns.
|
|
24
|
+
3. **Verify**: Run tests, type-check, or manually confirm the behavior.
|
|
25
|
+
4. **Clean up**: Remove debug statements and ensure no half-done work.
|
|
26
|
+
|
|
27
|
+
### Approved plans
|
|
28
|
+
|
|
29
|
+
When a plan is approved in Plan mode, Mastra Code automatically switches to Build mode and injects the plan into the agent's instructions. The agent then implements the plan step by step.
|
|
30
|
+
|
|
31
|
+
## Plan mode
|
|
32
|
+
|
|
33
|
+
Plan mode is read-only. The agent can explore the codebase but cannot modify files or run side-effect commands.
|
|
34
|
+
|
|
35
|
+
Use Plan mode when you want to analyze architecture, design an approach, or create a detailed implementation plan before writing code.
|
|
36
|
+
|
|
37
|
+
### Available tools
|
|
38
|
+
|
|
39
|
+
- `view`: Read files and list directories
|
|
40
|
+
- `search_content`: Search file contents
|
|
41
|
+
- `find_files`: Find files by pattern
|
|
42
|
+
- `execute_command`: Only for read-only commands (`git status`, `git log`, `git diff`)
|
|
43
|
+
|
|
44
|
+
### Plan submission
|
|
45
|
+
|
|
46
|
+
When the agent finishes analyzing the codebase, it submits a structured plan using the `submit_plan` tool. The plan includes:
|
|
47
|
+
|
|
48
|
+
- **Overview**: What the change does and why.
|
|
49
|
+
- **Complexity estimate**: Size, risk level, and dependencies.
|
|
50
|
+
- **Steps**: Specific files, changes, and rationale in dependency order.
|
|
51
|
+
- **Verification**: What tests to run and what to check.
|
|
52
|
+
|
|
53
|
+
After submission, you can:
|
|
54
|
+
|
|
55
|
+
- **Approve**: Mastra Code switches to Build mode and begins implementation.
|
|
56
|
+
- **Reject**: Stay in Plan mode.
|
|
57
|
+
- **Request changes**: Provide feedback for the agent to revise and resubmit.
|
|
58
|
+
|
|
59
|
+
## Fast mode
|
|
60
|
+
|
|
61
|
+
Fast mode prioritizes speed and brevity. The agent uses a faster model and keeps responses short.
|
|
62
|
+
|
|
63
|
+
Use Fast mode for quick lookups, simple questions, and small edits where latency matters more than depth.
|
|
64
|
+
|
|
65
|
+
### Rules
|
|
66
|
+
|
|
67
|
+
- Responses stay under 200 words unless the task requires more.
|
|
68
|
+
- No planning phase; the agent acts directly.
|
|
69
|
+
- For general programming questions, the agent answers from knowledge without searching the codebase.
|
|
70
|
+
- For project-specific questions, the agent reads the relevant code and answers concisely.
|
|
71
|
+
|
|
72
|
+
## Default models
|
|
73
|
+
|
|
74
|
+
Each mode has a default model that's selected when you switch to it:
|
|
75
|
+
|
|
76
|
+
| Mode | Default model |
|
|
77
|
+
| ----- | --------------------------- |
|
|
78
|
+
| Build | `anthropic/claude-opus-4-6` |
|
|
79
|
+
| Plan | `openai/gpt-5.2-codex` |
|
|
80
|
+
| Fast | `cerebras/zai-glm-4.7` |
|
|
81
|
+
|
|
82
|
+
Override the model for any mode using the `/models` command. Per-mode model selections persist to the thread, so switching back to a mode restores the last model you used in it.
|
|
83
|
+
|
|
84
|
+
> **Note:** Visit [`createMastraCode()` reference](https://mastra.ai/reference/mastra-code/createMastraCode) for details on configuring custom modes and default models.
|
|
85
|
+
|
|
86
|
+
## Subagents
|
|
87
|
+
|
|
88
|
+
In Build mode, the agent can spawn subagents to parallelize work. Subagents run as focused, independent tasks with their own tool access:
|
|
89
|
+
|
|
90
|
+
| Subagent | Access | Use case |
|
|
91
|
+
| ----------- | ------------ | ---------------------------------------------------------------------- |
|
|
92
|
+
| **Explore** | Read-only | "Find all usages of X", "How does module Y work" |
|
|
93
|
+
| **Plan** | Read-only | "Create an implementation plan for X", "Analyze the architecture of Y" |
|
|
94
|
+
| **Execute** | Read + write | "Implement feature X", "Fix bug Y", "Refactor module Z" |
|
|
95
|
+
|
|
96
|
+
The parent agent spawns subagents only when multiple tasks can run in parallel. For a single task, the agent handles it directly. Subagent outputs are treated as untrusted — the parent agent verifies results before moving on.
|
|
97
|
+
|
|
98
|
+
## Thinking level
|
|
99
|
+
|
|
100
|
+
You can control thinking depth through the `/settings` panel (or `/think`). Stored levels remain `off`, `low`, `medium`, `high`, and `xhigh` across providers. For OpenAI models, the UI shows provider-specific labels (for example, `Very High (xhigh)`), while non-OpenAI models keep generic labels.
|
|
101
|
+
|
|
102
|
+
## YOLO mode
|
|
103
|
+
|
|
104
|
+
YOLO mode auto-approves all tool calls without prompting. It's enabled by default and can be toggled through `/settings`. When disabled, Mastra Code prompts for approval before executing write operations or shell commands, based on the [permission system](https://mastra.ai/docs/mastra-code/tools).
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Mastra Code overview
|
|
2
|
+
|
|
3
|
+
Mastra Code is a terminal-based AI coding agent built on Mastra's [Harness](https://mastra.ai/reference/harness/harness-class), [Agent](https://mastra.ai/docs/agents/overview), and [Memory](https://mastra.ai/docs/memory/overview) primitives. It runs in your terminal, connects to 70+ AI models, and provides tools for reading, searching, editing, and executing code.
|
|
4
|
+
|
|
5
|
+
Mastra Code organizes its capabilities around these areas:
|
|
6
|
+
|
|
7
|
+
- [**Modes**](https://mastra.ai/docs/mastra-code/modes): Switch between Build, Plan, and Fast modes to match your workflow.
|
|
8
|
+
- [**Tools**](https://mastra.ai/docs/mastra-code/tools): Built-in tools for file viewing, editing, searching, shell commands, and web search.
|
|
9
|
+
- [**Configuration**](https://mastra.ai/docs/mastra-code/configuration): Project-scoped threads, MCP servers, hooks, custom commands, skills, and database settings.
|
|
10
|
+
- [**Customization**](https://mastra.ai/docs/mastra-code/customization): Extend Mastra Code programmatically with custom modes, tools, subagents, and storage.
|
|
11
|
+
|
|
12
|
+
## When to use Mastra Code
|
|
13
|
+
|
|
14
|
+
- **Day-to-day coding**: Ask questions about your codebase, make edits, run tests, and manage Git.
|
|
15
|
+
- **Code exploration**: Use Plan mode to analyze architecture and create implementation plans before writing code.
|
|
16
|
+
- **Quick lookups**: Switch to Fast mode for brief answers and small edits with minimal latency.
|
|
17
|
+
- **Multi-model workflows**: Compare responses across different AI providers by switching models mid-conversation.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
Mastra Code requires Node.js 22.13.0 or later.
|
|
22
|
+
|
|
23
|
+
## Get started
|
|
24
|
+
|
|
25
|
+
1. Install Mastra Code globally:
|
|
26
|
+
|
|
27
|
+
**npm**:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install -g mastracode
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**pnpm**:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pnpm add -g mastracode
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Yarn**:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
yarn global add mastracode
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Bun**:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bun add --global mastracode
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or run it with `npx`:
|
|
52
|
+
|
|
53
|
+
**npm**:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npx mastracode
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**pnpm**:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pnpm dlx mastracode
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Yarn**:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
yarn dlx mastracode
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Bun**:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
bun x mastracode
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. Navigate to your project directory and start Mastra Code:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
cd your-project
|
|
81
|
+
mastracode
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. Set an API key for your preferred provider (e.g. `export ANTHROPIC_API_KEY=sk-ant-...`), or run `/login` to authenticate with an Anthropic or OpenAI subscription. See [Configuration](https://mastra.ai/docs/mastra-code/configuration) for all supported providers.
|
|
85
|
+
|
|
86
|
+
4. Type a message and press Enter. The agent responds with streaming text and can read, edit, and run code in your project.
|
|
87
|
+
|
|
88
|
+
## Slash commands
|
|
89
|
+
|
|
90
|
+
Mastra Code provides built-in slash commands for managing sessions and settings:
|
|
91
|
+
|
|
92
|
+
| Command | Description |
|
|
93
|
+
| ----------- | ------------------------------------------------- |
|
|
94
|
+
| `/new` | Start a new conversation thread |
|
|
95
|
+
| `/threads` | List all threads for this project |
|
|
96
|
+
| `/models` | Select a different AI model |
|
|
97
|
+
| `/mode` | Switch between Build, Plan, and Fast modes |
|
|
98
|
+
| `/cost` | Show token usage for the current conversation |
|
|
99
|
+
| `/login` | Authenticate with OAuth providers |
|
|
100
|
+
| `/logout` | Log out from a provider |
|
|
101
|
+
| `/settings` | Open the settings panel |
|
|
102
|
+
| `/theme` | Switch color theme (auto, dark, or light) |
|
|
103
|
+
| `/sandbox` | Add external directories to the allowed path list |
|
|
104
|
+
| `/diff` | Show files modified in the current session |
|
|
105
|
+
| `/help` | Show available commands |
|
|
106
|
+
| `/exit` | Exit the TUI |
|
|
107
|
+
|
|
108
|
+
You can also define custom slash commands as markdown files. See [Configuration](https://mastra.ai/docs/mastra-code/configuration) for details.
|
|
109
|
+
|
|
110
|
+
## Keyboard shortcuts
|
|
111
|
+
|
|
112
|
+
| Shortcut | Action |
|
|
113
|
+
| -------- | --------------------------------------------------- |
|
|
114
|
+
| `Ctrl+C` | Interrupt current operation |
|
|
115
|
+
| `Ctrl+D` | Exit (when editor is empty) |
|
|
116
|
+
| `Ctrl+T` | Toggle thinking blocks visibility |
|
|
117
|
+
| `Ctrl+E` | Expand/collapse all tool outputs |
|
|
118
|
+
| `Ctrl+F` | Send a follow-up message while the agent is running |
|
|
119
|
+
|
|
120
|
+
## Architecture
|
|
121
|
+
|
|
122
|
+
Mastra Code is built on four layers:
|
|
123
|
+
|
|
124
|
+
1. **TUI**: Terminal interface (`pi-tui` components)
|
|
125
|
+
2. **Harness**: Mode management, thread persistence, event system, state management
|
|
126
|
+
3. **Mastra Agent**: Dynamic model selection, tool execution, memory integration, subagents
|
|
127
|
+
4. **LibSQL Storage**: Thread persistence, message history, token usage tracking, observational memory
|
|
128
|
+
|
|
129
|
+
## Next steps
|
|
130
|
+
|
|
131
|
+
- [Modes](https://mastra.ai/docs/mastra-code/modes)
|
|
132
|
+
- [Tools](https://mastra.ai/docs/mastra-code/tools)
|
|
133
|
+
- [Configuration](https://mastra.ai/docs/mastra-code/configuration)
|
|
134
|
+
- [Customization](https://mastra.ai/docs/mastra-code/customization)
|
|
135
|
+
- [API reference](https://mastra.ai/reference/mastra-code/createMastraCode)
|