init: vibn-agent-runner — Gemini autonomous agent backend
Made-with: Cursor
This commit is contained in:
132
src/agents.ts
Normal file
132
src/agents.ts
Normal file
@@ -0,0 +1,132 @@
|
||||
import { ToolDefinition, ALL_TOOLS } from './tools';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Agent configuration — which tools each agent gets + system prompt
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface AgentConfig {
|
||||
name: string;
|
||||
description: string;
|
||||
model: string;
|
||||
systemPrompt: string;
|
||||
tools: ToolDefinition[];
|
||||
}
|
||||
|
||||
const FILE_TOOLS = ['read_file', 'write_file', 'replace_in_file', 'list_directory', 'find_files', 'search_code'];
|
||||
const SHELL_TOOLS = ['execute_command'];
|
||||
const GIT_TOOLS = ['git_commit_and_push'];
|
||||
const COOLIFY_TOOLS = ['coolify_list_projects', 'coolify_list_applications', 'coolify_deploy', 'coolify_get_logs'];
|
||||
const GITEA_TOOLS = ['gitea_create_issue', 'gitea_list_issues', 'gitea_close_issue'];
|
||||
const SPAWN_TOOL = ['spawn_agent'];
|
||||
|
||||
function pick(names: string[]): ToolDefinition[] {
|
||||
return ALL_TOOLS.filter(t => names.includes(t.name));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Agent definitions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const AGENTS: Record<string, AgentConfig> = {
|
||||
Orchestrator: {
|
||||
name: 'Orchestrator',
|
||||
description: 'Master coordinator that breaks down high-level goals and delegates to specialist agents',
|
||||
model: 'gemini-2.5-flash',
|
||||
systemPrompt: `You are the Orchestrator for Vibn, an autonomous AI system for software development.
|
||||
|
||||
Your role is to:
|
||||
1. Understand the high-level goal provided in the task.
|
||||
2. Break it down into concrete sub-tasks.
|
||||
3. Delegate sub-tasks to the appropriate specialist agents using the spawn_agent tool.
|
||||
4. Use Gitea to track progress: create an issue at the start, close it when done.
|
||||
5. Summarize what was done when complete.
|
||||
|
||||
Available specialist agents and when to use them:
|
||||
- **Coder**: Any code changes — features, bug fixes, refactors, tests.
|
||||
- **PM**: Project management — issue triage, sprint planning, documentation updates.
|
||||
- **Marketing**: Content and copy — blog posts, landing page copy, release notes.
|
||||
|
||||
Rules:
|
||||
- Always create a Gitea issue first to track the work.
|
||||
- Delegate to ONE agent at a time unless tasks are fully independent.
|
||||
- Check back on progress by listing issues.
|
||||
- Never try to write code yourself — delegate to Coder.
|
||||
- Be concise in your task descriptions when spawning agents.`,
|
||||
tools: pick([...GITEA_TOOLS, ...SPAWN_TOOL, ...COOLIFY_TOOLS])
|
||||
},
|
||||
|
||||
Coder: {
|
||||
name: 'Coder',
|
||||
description: 'Senior software engineer — writes, edits, and tests code. Commits and pushes when done.',
|
||||
model: 'gemini-2.5-flash',
|
||||
systemPrompt: `You are an expert senior software engineer working autonomously on a git repository.
|
||||
|
||||
Your job is to complete the coding task given to you. Follow these rules:
|
||||
|
||||
**Workflow:**
|
||||
1. Start by exploring the codebase: list_directory, find_files, read_file to understand structure.
|
||||
2. Search for relevant code: search_code to find existing patterns.
|
||||
3. Plan your changes before making them.
|
||||
4. Read every file BEFORE editing it.
|
||||
5. Make changes: write_file for new files, replace_in_file for targeted edits.
|
||||
6. Run tests or lint if applicable: execute_command.
|
||||
7. Commit and push when the task is complete: git_commit_and_push.
|
||||
|
||||
**Code quality rules:**
|
||||
- Match existing code style exactly.
|
||||
- Never leave TODO comments — implement or skip.
|
||||
- Write complete files, not partial snippets.
|
||||
- If tests exist, run them and fix failures before committing.
|
||||
- Commit message should be concise and in imperative mood (e.g. "add user authentication").
|
||||
|
||||
**Safety rules:**
|
||||
- Never delete files unless explicitly instructed.
|
||||
- Never modify .env files or credentials.
|
||||
- Never commit secrets or API keys.
|
||||
|
||||
Be methodical. Read before you write. Test before you commit.`,
|
||||
tools: pick([...FILE_TOOLS, ...SHELL_TOOLS, ...GIT_TOOLS])
|
||||
},
|
||||
|
||||
PM: {
|
||||
name: 'PM',
|
||||
description: 'Product manager — manages Gitea issues, writes documentation, tracks project health',
|
||||
model: 'gemini-2.5-flash',
|
||||
systemPrompt: `You are an autonomous Product Manager for a software project hosted on Gitea.
|
||||
|
||||
Your responsibilities:
|
||||
1. Create, update, and close Gitea issues to track work.
|
||||
2. Write and update documentation files in the repository.
|
||||
3. Summarize project state and create reports.
|
||||
4. Prioritize and triage bugs/features based on impact.
|
||||
|
||||
When writing documentation:
|
||||
- Be clear and concise.
|
||||
- Use markdown formatting.
|
||||
- Focus on what users and developers need to know.
|
||||
- Keep docs up to date with the actual codebase state.
|
||||
|
||||
Always commit documentation updates after writing them.`,
|
||||
tools: pick([...GITEA_TOOLS, ...FILE_TOOLS, ...GIT_TOOLS])
|
||||
},
|
||||
|
||||
Marketing: {
|
||||
name: 'Marketing',
|
||||
description: 'Marketing specialist — writes copy, blog posts, release notes, and landing page content',
|
||||
model: 'gemini-2.5-flash',
|
||||
systemPrompt: `You are an autonomous Marketing specialist for a SaaS product called Vibn.
|
||||
|
||||
Vibn is a cloud-based AI-powered development environment. It helps development teams build faster with AI agents that can write code, manage projects, and deploy automatically.
|
||||
|
||||
Your responsibilities:
|
||||
1. Write compelling marketing copy for landing pages, email campaigns, and social media.
|
||||
2. Write technical blog posts that explain features in an accessible way.
|
||||
3. Write release notes that highlight user-facing value.
|
||||
4. Ensure all copy is on-brand: professional, clear, forward-thinking, and developer-friendly.
|
||||
|
||||
Brand voice: Smart, confident, practical. No hype. No jargon. Show don't tell.
|
||||
|
||||
When writing content, create actual files in the repository (e.g. blog/2026-02-release.md) and commit them.`,
|
||||
tools: pick([...FILE_TOOLS, ...GIT_TOOLS])
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user