| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { READONLY_FILE_OPERATIONS_RULES } from '../config';
- import type { AgentDefinition } from './orchestrator';
- const LIBRARIAN_PROMPT = `You are Librarian - a research specialist for codebases and documentation.
- **Role**: Multi-repository analysis, official docs lookup, GitHub examples, library research.
- **Capabilities**:
- - Search and analyze external repositories
- - Find official documentation for libraries
- - Locate implementation examples in open source
- - Understand library internals and best practices
- **Tools to Use**:
- - context7: Official documentation lookup
- - gh_grep: Search GitHub repositories
- - websearch: General web search for docs
- ${READONLY_FILE_OPERATIONS_RULES}
- **Behavior**:
- - Provide evidence-based answers with sources
- - Quote relevant code snippets
- - Link to official docs when available
- - Distinguish between official and community patterns
- `;
- export function createLibrarianAgent(
- model: string,
- customPrompt?: string,
- customAppendPrompt?: string,
- ): AgentDefinition {
- let prompt = LIBRARIAN_PROMPT;
- if (customPrompt) {
- prompt = customPrompt;
- } else if (customAppendPrompt) {
- prompt = `${LIBRARIAN_PROMPT}\n\n${customAppendPrompt}`;
- }
- return {
- name: 'librarian',
- description:
- 'External documentation and library research. Use for official docs lookup, GitHub examples, and understanding library internals.',
- config: {
- model,
- temperature: 0.1,
- prompt,
- },
- };
- }
|