Fix AI confusion: clean projects_get output, clarify project vs app in system prompt

projects_get was dumping raw JSONB including turborepo scaffold fields
(product/website/admin/storybook sub-app configs), which Gemini mistook
for live deployed services. Now returns a clean summary with only the
fields relevant to the AI. Also updated the system prompt to explicitly
distinguish Vibn project records (planning artifacts) from Coolify apps
(actual running services), instructing the model to call apps_list when
the user asks what's live.

Made-with: Cursor
This commit is contained in:
2026-04-27 17:37:18 -07:00
parent 7138f86427
commit 0cb5d8bc50
2 changed files with 26 additions and 2 deletions

View File

@@ -62,16 +62,25 @@ function buildSystemPrompt(projects: any[], workspace: string): string {
return `You are Vibn AI, an expert product and infrastructure assistant embedded in the Vibn platform.
You are talking to the owner of the "${workspace}" workspace.
## Architecture (important — read carefully)
Vibn has two separate concepts:
1. **Projects** (in the Vibn DB) — planning/concept records. They store a product vision, status, and metadata. They are NOT running services.
2. **Apps / Services** (in Coolify) — actual live deployments. These are what have domains and real endpoints. Call \`apps_list\` to see what is actually running.
When a user asks what's live, call \`apps_list\` — not \`projects_get\`. Project records from \`projects_get\` describe what the user *wants* to build, not what is deployed.
## Current workspace projects
${projectsText}
## Your capabilities
You can take real actions by calling tools:
- List/inspect projects and deployed apps
- List/inspect projects and deployed apps (\`apps_list\` shows live services)
- Deploy new applications from templates (n8n, WordPress, Twenty CRM, etc.) or Docker images
- Register and manage custom domains
- View application logs
- Search available app templates
- Search GitHub for open-source projects to reference or fork
- Fetch any public URL or file
## Guidelines
- Be concise and action-oriented. If the user wants to deploy something, do it — don't just describe how.

View File

@@ -380,8 +380,23 @@ async function toolProjectsGet(principal: Principal, params: Record<string, any>
return NextResponse.json({ error: 'Project not found in this workspace' }, { status: 404 });
}
const r = rows[0];
const d = r.data || {};
// Return a clean summary rather than the raw JSONB, which contains noisy
// internal scaffold fields (product/website/admin/storybook sub-app configs)
// that the AI tends to misread as live deployed services.
return NextResponse.json({
result: { id: r.id, data: r.data, createdAt: r.created_at, updatedAt: r.updated_at },
result: {
id: r.id,
name: d.productName || d.name || d.title || 'Untitled',
status: d.status || 'defining',
vision: d.productVision || d.vision || null,
domain: d.domain || d.customDomain || null,
coolifyAppUuid: d.coolifyAppUuid || d.coolifyServiceUuid || null,
coolifyDomain: d.coolifyDomain || null,
repositoryUrl: d.repositoryUrl || null,
createdAt: r.created_at,
updatedAt: r.updated_at,
},
});
}