# buildBasePrompt() `buildBasePrompt()` builds the shared base system prompt for a coding agent — the behavioral instructions that make the agent a good coding assistant. It takes a `PromptContext` describing the current environment (project, platform, git branch, mode, model) and returns the prompt as a string. Product-specific strings are parameterized through `productName`, `coAuthorName`, and `coAuthorEmail`, so you can rebrand the prompt and commit trailer without forking it. They default to `"Mastra Code"` / `"noreply@mastra.ai"`, so existing callers keep identical output. Use this with [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent) when you build dynamic instructions for the agent. ## Usage example Build the base prompt from a `PromptContext`: ```typescript import { buildBasePrompt } from '@mastra/core/coding-agent' const prompt = buildBasePrompt({ projectPath: process.cwd(), projectName: 'my-app', gitBranch: 'main', platform: process.platform, date: new Date().toDateString(), mode: 'build', modelId: 'openai/gpt-5', toolGuidance: '', }) ``` To rebrand the prompt, pass the product and co-author fields: ```typescript const prompt = buildBasePrompt({ // ...environment fields productName: 'Acme Coder', coAuthorName: 'Acme Bot', coAuthorEmail: 'bot@acme.dev', }) ``` ## Parameters `buildBasePrompt()` takes a single `PromptContext` object. **projectPath** (`string`): Absolute path to the project root. **projectName** (`string`): Display name of the project. **gitBranch** (`string`): Current git branch, if the project is a git repository. **platform** (`string`): Operating system platform (for example, the value of process.platform). **commonBinaries** (`{ name: string; path: string | null }[]`): Common binaries detected on the system, each with a name and resolved path (or null when not found). **date** (`string`): Current date string injected into the prompt. **mode** (`string`): Active agent mode (for example, "build" or "plan"). **modelId** (`string`): Identifier of the active model, included in the commit Co-Authored-By line when provided. **activePlan** (`{ title: string; plan: string; approvedAt: string } | null`): The currently approved plan, if any. **toolGuidance** (`string`): Tool-usage guidance section appended to the prompt. **productName** (`string`): Display name used in the prompt header. (Default: `Mastra Code`) **coAuthorName** (`string`): Name used in the commit Co-Authored-By line. (Default: `Mastra Code`) **coAuthorEmail** (`string`): Email used in the commit Co-Authored-By line. (Default: `noreply@mastra.ai`) ## Returns **prompt** (`string`): The base system prompt for the coding agent. ## Related - [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent)