* Get the system prompt from markdown rule files, with tool reference always appended. * * Rules are loaded from ./rules/*.md files (cached in memory after first read). * Tool reference (ADDIE_TOOL_REFERENCE) is always appended (tied to code). * Fallback prompt used only when rule files
()
| 362 | * Fallback prompt used only when rule files can't be read. |
| 363 | */ |
| 364 | private getSystemPrompt(): { prompt: string } { |
| 365 | try { |
| 366 | const basePrompt = loadRules(); |
| 367 | const prompt = `${basePrompt}\n\n---\n\n${ADDIE_TOOL_REFERENCE}`; |
| 368 | return { prompt }; |
| 369 | } catch (error) { |
| 370 | logger.warn({ error }, 'Addie: Failed to load rules from files, using fallback prompt'); |
| 371 | const fallbackPrompt = `${ADDIE_FALLBACK_PROMPT}\n\n---\n\n${ADDIE_TOOL_REFERENCE}`; |
| 372 | return { prompt: fallbackPrompt }; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | private estimateMessageContentChars(content: Anthropic.MessageParam['content']): number { |
| 377 | if (typeof content === 'string') return content.length; |
no test coverage detected