diff --git a/src/commands/personality.ts b/src/commands/personality.ts index a64da35..bf1dddc 100644 --- a/src/commands/personality.ts +++ b/src/commands/personality.ts @@ -6,7 +6,6 @@ import { parse, stringify } from "yaml"; const HERMES_HOME = process.env.HERMES_HOME || join(homedir(), ".hermes"); const CONFIG_PATH = join(HERMES_HOME, "config.yaml"); const SOUL_PATH = join(HERMES_HOME, "SOUL.md"); -const CONVENTIONS_PATH = join(HERMES_HOME, "CONVENTIONS.md"); interface Config { agent?: { @@ -57,8 +56,17 @@ function getPreview(value: string | PersonalityDict): string { // --- SOUL.md management --- function loadConventions(): string { - if (!existsSync(CONVENTIONS_PATH)) return ""; - return readFileSync(CONVENTIONS_PATH, "utf-8").trim(); + try { + const { execSync } = require("child_process"); + const result = execSync("cfg get FAMILY_CONVENTIONS", { + encoding: "utf-8", + timeout: 5000, + stdio: ["pipe", "pipe", "pipe"], + }).trim(); + return result || ""; + } catch { + return ""; + } } function writeSoulMd(personalityPrompt: string) { @@ -146,7 +154,6 @@ function switchLocal(name: string) { saveConfig(config); writeSoulMd(""); console.log("Personality cleared."); - if (existsSync(CONVENTIONS_PATH)) console.log("SOUL.md updated (conventions only)."); return; }