forked from alvinunreal/oh-my-opencode-slim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrarian.ts
More file actions
49 lines (40 loc) · 1.37 KB
/
Copy pathlibrarian.ts
File metadata and controls
49 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
${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,
prompt,
},
};
}