import type { MarkdownConfigs } from "./markdown-config-loader.js"; const PREAMBLE = "You may update your long-term memory by writing to memory.md using the Write tool. Use this to persist important facts, lessons learned, and context across sessions."; interface SectionDef { key: keyof MarkdownConfigs; header: string; } const SECTIONS: SectionDef[] = [ { key: "identity", header: "## Identity" }, { key: "soul", header: "## Personality" }, { key: "agents", header: "## Operating Rules" }, { key: "user", header: "## User Context" }, { key: "memory", header: "## Long-Term Memory" }, { key: "tools", header: "## Tool Configuration" }, ]; export class SystemPromptAssembler { assemble(configs: MarkdownConfigs): string { const parts: string[] = [PREAMBLE, ""]; for (const { key, header } of SECTIONS) { const content = configs[key]; if (content != null && content !== "") { parts.push(`${header}\n\n${content}\n`); } } return parts.join("\n"); } }