16. Building the System Prompt
Tell Claude what tools it has, how to behave, what directory it's in.
The system prompt tells Claude what it is, what tools it has, and how to behave.
File: packages/coding-agent/src/core/system-prompt.ts L28-172
export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): string {
// Build tools list
const tools = selectedTools || ["read", "bash", "edit", "write"];
const toolsList = tools
.filter((name) => !!toolSnippets?.[name])
.map((name) => `- ${name}: ${toolSnippets![name]}`)
.join("\n");
let prompt = `You are an expert coding assistant operating inside pi, a coding agent harness.
Available tools:
${toolsList}
Guidelines:
${guidelines}`;
// Add date and working directory
prompt += `\nCurrent date: ${date}`;
prompt += `\nCurrent working directory: ${promptCwd}`;
return prompt;
}
For your minimal harness:
const systemPrompt = `You are a coding assistant. You can read, edit, and create files.
Available tools:
- read: Read a file from disk
- edit: Edit a file using string replacement
- write: Create or overwrite a file
- bash: Run a shell command
Current directory: ${process.cwd()}
Current date: ${new Date().toISOString().split("T")[0]}`;