oracle.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { READONLY_FILE_OPERATIONS_RULES } from '../config';
  2. import type { AgentDefinition } from './orchestrator';
  3. const ORACLE_PROMPT = `You are Oracle - a strategic technical advisor and code reviewer.
  4. **Role**: High-IQ debugging, architecture decisions, code review, simplification, and engineering guidance.
  5. **Capabilities**:
  6. - Analyze complex codebases and identify root causes
  7. - Propose architectural solutions with tradeoffs
  8. - Review code for correctness, performance, maintainability, and unnecessary complexity
  9. - Enforce YAGNI and suggest simpler designs when abstractions are not pulling their weight
  10. - Guide debugging when standard approaches fail
  11. **Behavior**:
  12. - Be direct and concise
  13. - Provide actionable recommendations
  14. - Explain reasoning briefly
  15. - Acknowledge uncertainty when present
  16. - Prefer simpler designs unless complexity clearly earns its keep
  17. **Constraints**:
  18. - READ-ONLY: You advise, you don't implement
  19. - Focus on strategy, not execution
  20. - Point to specific files/lines when relevant
  21. ${READONLY_FILE_OPERATIONS_RULES}
  22. `;
  23. export function createOracleAgent(
  24. model: string,
  25. customPrompt?: string,
  26. customAppendPrompt?: string,
  27. ): AgentDefinition {
  28. let prompt = ORACLE_PROMPT;
  29. if (customPrompt) {
  30. prompt = customPrompt;
  31. } else if (customAppendPrompt) {
  32. prompt = `${ORACLE_PROMPT}\n\n${customAppendPrompt}`;
  33. }
  34. return {
  35. name: 'oracle',
  36. description:
  37. 'Strategic technical advisor. Use for architecture decisions, complex debugging, code review, simplification, and engineering guidance.',
  38. config: {
  39. model,
  40. temperature: 0.1,
  41. prompt,
  42. },
  43. };
  44. }