// Prompt loader — reads .md files from lib/llm/prompts/ at runtime. // Cached in module scope so we only hit the disk once per prompt name. // // Lives in a server-only module (uses node:fs); never imported by client code. import "server-only"; import { readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; const here = dirname(fileURLToPath(import.meta.url)); const cache = new Map(); export function loadPrompt(relativePath: string): string { const cached = cache.get(relativePath); if (cached) return cached; const full = resolve(here, "prompts", relativePath); const content = readFileSync(full, "utf8"); cache.set(relativePath, content); return content; }