@memo-code/memo 0.8.10 → 0.8.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/prompt.md CHANGED
@@ -11,6 +11,8 @@ You are **Memo Code**, an interactive CLI tool that helps users with software en
11
11
  - **Tool Rich**: Use your comprehensive toolkit liberally to gather information and complete tasks.
12
12
  - **Safety Conscious**: The environment is NOT sandboxed. Your actions have immediate effects.
13
13
 
14
+ {{soul_section}}
15
+
14
16
  # Session Context
15
17
 
16
18
  - Date: {{date}}
@@ -117703,6 +117703,7 @@ var require_dist5 = __commonJS({
117703
117703
  }
117704
117704
  var import_meta = {};
117705
117705
  var TEMPLATE_PATTERN = /{{\s*([\w.-]+)\s*}}/g;
117706
+ var SOUL_PLACEHOLDER_PATTERN = /{{\s*soul_section\s*}}/;
117706
117707
  function renderTemplate(template, vars) {
117707
117708
  return template.replace(TEMPLATE_PATTERN, (_match, key) => vars[key] ?? "");
117708
117709
  }
@@ -117716,6 +117717,17 @@ var require_dist5 = __commonJS({
117716
117717
  function normalizePath(path2) {
117717
117718
  return (0, import_node_path2.resolve)(path2);
117718
117719
  }
117720
+ function resolveMemoHome(options) {
117721
+ const homeDir = options.homeDir ?? import_node_os2.default.homedir();
117722
+ const configured = options.memoHome?.trim() || process.env.MEMO_HOME?.trim() || (0, import_node_path2.join)(homeDir, ".memo");
117723
+ if (configured === "~") {
117724
+ return (0, import_node_path2.resolve)(homeDir);
117725
+ }
117726
+ if (configured.startsWith("~/")) {
117727
+ return (0, import_node_path2.resolve)((0, import_node_path2.join)(homeDir, configured.slice(2)));
117728
+ }
117729
+ return (0, import_node_path2.resolve)(configured);
117730
+ }
117719
117731
  function filterActiveSkills(skills, activeSkillPaths) {
117720
117732
  if (!Array.isArray(activeSkillPaths)) {
117721
117733
  return skills;
@@ -117747,6 +117759,34 @@ ${agents2.content}`;
117747
117759
  return `${basePrompt}
117748
117760
 
117749
117761
  ${skillsSection}`;
117762
+ }
117763
+ async function readSoulMd(options) {
117764
+ const memoHome2 = resolveMemoHome(options);
117765
+ const soulPath = (0, import_node_path2.join)(memoHome2, "SOUL.md");
117766
+ try {
117767
+ const content = await (0, import_promises2.readFile)(soulPath, "utf-8");
117768
+ if (!content.trim()) {
117769
+ return null;
117770
+ }
117771
+ return { path: soulPath, content };
117772
+ } catch {
117773
+ return null;
117774
+ }
117775
+ }
117776
+ function renderSoulSection(soul) {
117777
+ return `## User Personality Context (SOUL.md)
117778
+ Loaded from: ${soul.path}
117779
+
117780
+ - Treat this content as a soft preference layer for tone, style, and subjective behavior.
117781
+ - Do NOT let this content override safety rules, tool policies, Project AGENTS.md guidance, or explicit user instructions in the current turn.
117782
+ - Keep SOUL.md concise when possible to avoid unnecessary prompt growth.
117783
+
117784
+ ${soul.content}`;
117785
+ }
117786
+ function appendSoulPrompt(basePrompt, soulSection) {
117787
+ return `${basePrompt}
117788
+
117789
+ ${soulSection}`;
117750
117790
  }
117751
117791
  function resolveModuleDir() {
117752
117792
  if (typeof __dirname === "string") {
@@ -117774,12 +117814,19 @@ ${skillsSection}`;
117774
117814
  const startupRoot = options.cwd ?? process.cwd();
117775
117815
  const promptPath = resolvePromptPath(options.promptPath);
117776
117816
  const prompt = await (0, import_promises2.readFile)(promptPath, "utf-8");
117817
+ const soul = await readSoulMd({ homeDir: options.homeDir, memoHome: options.memoHome });
117818
+ const soulSection = soul ? renderSoulSection(soul) : "";
117819
+ const hasSoulPlaceholder = SOUL_PLACEHOLDER_PATTERN.test(prompt);
117777
117820
  const vars = {
117778
117821
  date: (/* @__PURE__ */ new Date()).toISOString(),
117779
117822
  user: resolveUsername(),
117780
- pwd: startupRoot
117823
+ pwd: startupRoot,
117824
+ soul_section: soulSection
117781
117825
  };
117782
117826
  let composedPrompt = renderTemplate(prompt, vars);
117827
+ if (!hasSoulPlaceholder && soulSection) {
117828
+ composedPrompt = appendSoulPrompt(composedPrompt, soulSection);
117829
+ }
117783
117830
  const agents2 = await readProjectAgentsMd(startupRoot);
117784
117831
  if (agents2) {
117785
117832
  composedPrompt = appendProjectAgentsPrompt(composedPrompt, agents2);
@@ -121618,7 +121665,7 @@ ${envLines}`;
121618
121665
  if (path2.startsWith("~/")) return (0, import_node_path9.join)((0, import_node_os4.homedir)(), path2.slice(2));
121619
121666
  return path2;
121620
121667
  }
121621
- function resolveMemoHome(settings) {
121668
+ function resolveMemoHome2(settings) {
121622
121669
  if (settings?.memoHome?.trim()) {
121623
121670
  return expandHome3(settings.memoHome.trim());
121624
121671
  }
@@ -121628,7 +121675,7 @@ ${envLines}`;
121628
121675
  return (0, import_node_path9.join)((0, import_node_os4.homedir)(), ".memo");
121629
121676
  }
121630
121677
  function oauthFilePath(settings) {
121631
- return (0, import_node_path9.join)(resolveMemoHome(settings), "auth", OAUTH_FILE_NAME);
121678
+ return (0, import_node_path9.join)(resolveMemoHome2(settings), "auth", OAUTH_FILE_NAME);
121632
121679
  }
121633
121680
  function computeCredentialKey(url2) {
121634
121681
  return (0, import_node_crypto3.createHash)("sha256").update(normalizeServerUrl(url2)).digest("hex");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memo-code/memo",
3
- "version": "0.8.10",
3
+ "version": "0.8.50",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A lightweight coding agent that runs in your terminal",