From 9e0255b10bea7351e81d1c165bde777a0ccb5f8a Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 26 Nov 2025 01:09:43 +0100 Subject: [PATCH] mom: Tell mom what environment she's in (Docker vs host) --- packages/mom/src/agent.ts | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/mom/src/agent.ts b/packages/mom/src/agent.ts index 05d0dd47..b2d05582 100644 --- a/packages/mom/src/agent.ts +++ b/packages/mom/src/agent.ts @@ -42,8 +42,23 @@ function getRecentMessages(channelDir: string, count: number): string { return recentLines.join("\n"); } -function buildSystemPrompt(workspacePath: string, channelId: string, recentMessages: string): string { +function buildSystemPrompt( + workspacePath: string, + channelId: string, + recentMessages: string, + sandboxConfig: SandboxConfig, +): string { const channelPath = `${workspacePath}/${channelId}`; + const isDocker = sandboxConfig.type === "docker"; + + const envDescription = isDocker + ? `You are running inside a Docker container (Alpine Linux). +- Install tools with: apk add +- Your changes persist across sessions +- You have full control over this container` + : `You are running directly on the host machine. +- Be careful with system modifications +- Use the system's package manager if needed`; return `You are mom, a helpful Slack bot assistant. @@ -61,11 +76,13 @@ function buildSystemPrompt(workspacePath: string, channelId: string, recentMessa - Links: - Do NOT use **double asterisks** or [markdown](links) +## Your Environment +${envDescription} + ## Your Workspace Your working directory is: ${channelPath} -This is YOUR computer - you have full control. You can: -- Install tools with the system package manager (apk, apt, etc.) +You can: - Configure tools and save credentials - Create files and directories as needed @@ -114,7 +131,7 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner { const channelId = ctx.message.channel; const workspacePath = executor.getWorkspacePath(channelDir.replace(`/${channelId}`, "")); const recentMessages = getRecentMessages(channelDir, 50); - const systemPrompt = buildSystemPrompt(workspacePath, channelId, recentMessages); + const systemPrompt = buildSystemPrompt(workspacePath, channelId, recentMessages, sandboxConfig); // Set up file upload function for the attach tool // For Docker, we need to translate paths back to host