import { readFile } from 'node:fs/promises'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; const HERE = dirname(fileURLToPath(import.meta.url)); export const AGENTS_DIR = join(HERE, 'agents'); /** Load a Han agent persona — the markdown body after the YAML frontmatter. */ export async function loadPersona(agent: string): Promise { const md = await readFile(join(AGENTS_DIR, `${agent}.md`), 'utf8'); return md.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim(); }