owlmem 0.9.15 → 0.9.17

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.
Files changed (2) hide show
  1. package/owlmem.mjs +33 -7
  2. package/package.json +1 -1
package/owlmem.mjs CHANGED
@@ -43,7 +43,7 @@ import { join, dirname, basename, relative, isAbsolute } from "node:path";
43
43
  import { fileURLToPath } from "node:url";
44
44
  import { spawn, spawnSync } from "node:child_process";
45
45
 
46
- export const VERSION = "0.9.15";
46
+ export const VERSION = "0.9.17";
47
47
  const BASE = (process.env.OWLMEM_URL || "https://owlmem.com").replace(/\/$/, "");
48
48
  const DIR = process.env.OWLMEM_HOME || join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "owlmem");
49
49
  const enc = new TextEncoder(), dec = new TextDecoder();
@@ -506,7 +506,7 @@ async function mcpServe() {
506
506
  // The snippets here must say the same as the website (design/owlmem/site.py CODE); tests/test_owlmem_install.py compares them.
507
507
  export const MCP_URL = "https://mcp.owlmem.com/mcp";
508
508
  export const RULES = `## Team memory (OwlMem)
509
- - Before starting a task, use kb_search (documents) and kb_recall (facts) for the topic.
509
+ - Before starting a task, search with kb_find (documents, files and memory at once); use kb_search only for an exact string such as a commit id, a path or an error message.
510
510
  - When you learn something reusable — a fix, a gotcha, a decision — save it with kb_write
511
511
  under lessons/ or projects/<name>/. Search first and update the existing page instead of
512
512
  creating a duplicate.
@@ -815,7 +815,9 @@ function nextSteps(items, out) {
815
815
  const WAKE_TOOLS_0910 = ["kb_task_update", "kb_inbox", "kb_send",
816
816
  "kb_search", "kb_recall", "kb_read", "kb_list", "kb_thread", "kb_team", "kb_notices", "kb_infra", "kb_mon_alerts", "kb_mon_query",
817
817
  "kb_write", "kb_retain"];
818
- export const WAKE_TOOLS = [...WAKE_TOOLS_0910, "kb_file_get"];
818
+ // 0.9.17 (11-12): kb_find — the rules now say to look things up with kb_find first (owner: fold kb_search / kb_recall into it),
819
+ // so a woken AI that follows them must be allowed to call it. Reading only.
820
+ export const WAKE_TOOLS = [...WAKE_TOOLS_0910, "kb_file_get", "kb_find"];
819
821
  export const WAKE_CLIENTS = {
820
822
  "claude-code": { name: "Claude Code", bin: "claude",
821
823
  // -p runs one prompt and exits; it may only use the OwlMem tools in WAKE_TOOLS, beyond what your own settings allow
@@ -1188,9 +1190,32 @@ Never put passwords, tokens, keys or other secrets in any message. You have ${mi
1188
1190
  `;
1189
1191
  }
1190
1192
 
1193
+ // Claude Code can message the other Claude Code sessions running on the same computer (ListAgents, SendMessage). When the
1194
+ // person is already working with this AI in a foreground session, a reply or a note belongs there: the woken run hands it
1195
+ // over and ends, instead of acting on it in a session nobody watches (站长 11-11「能不能唤醒前台会话?」——#904 的审查结果
1196
+ // 唤醒了一个后台会话,前台那个没收到). Only for work a person or the team's own AIs sent (trust full): what came from outside
1197
+ // is never relayed into a session that can do more than look.
1198
+ export function foregroundFirst(task) {
1199
+ if (task.client !== "claude-code" || task.trust !== TRUST_FULL || !(isReply(task) || isNote(task))) return "";
1200
+ const what = isReply(task) ? (task.zh ? `回信 #${task.id}(任务 #${task.task_id} 的结果)` : `reply #${task.id} (the result of task #${task.task_id})`)
1201
+ : (task.zh ? `留言 #${task.id}` : `note #${task.id}`);
1202
+ // antigravity #908 审:先转、转成功才标已读(先标已读而转失败,这封信就静默丢了);只在恰好一个本机会话时转(多个时分不清
1203
+ // 是哪个项目,转错会让别的项目的会话动手);只转述要点,不照抄原文(防带出密钥)
1204
+ if (task.zh) return `第一步:用 ListAgents 看这台电脑上有没有正在进行的其他 Claude Code 会话(前台会话,站长可能正在用)。
1205
+ - 恰好一个本机会话:用 SendMessage 把${what}转给它——开头写「奥麦自动唤醒转来:」,用你自己的话简述是谁、哪个任务、结论或要做的事,不要照抄原文,不要写任何密码、令牌、密钥。SendMessage 明确发送成功后,再用 kb_inbox 读这封信(会标成已读),然后结束:不要自己接着做,也不要再用 kb_send 发消息。
1206
+ - 没有、有好几个、ListAgents / SendMessage 用不了,或发送失败:不要标已读,照下面做。
1207
+
1208
+ `;
1209
+ return `First: call ListAgents to see whether another Claude Code session is running on this computer (a foreground session the person may be using).
1210
+ - If there is exactly one local session: pass ${what} to it with SendMessage. Start with "Forwarded by OwlMem auto-wake:" and say in your own words who, which task, and the result or what is asked; don't copy the original text and don't include any password, token or key. Only once SendMessage has clearly succeeded, read it with kb_inbox (that marks it read), then end: don't act on it yourself and don't send a kb_send message.
1211
+ - If there is none, there are several, ListAgents / SendMessage aren't available, or sending fails: don't mark it read; do as below.
1212
+
1213
+ `;
1214
+ }
1215
+
1191
1216
  export function wakePrompt(task, place, o = {}) {
1192
- if (isReply(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + replyPrompt(task, o);
1193
- if (isNote(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + notePrompt(task, place, o);
1217
+ if (isReply(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + foregroundFirst(task) + replyPrompt(task, o);
1218
+ if (isNote(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + foregroundFirst(task) + notePrompt(task, place, o);
1194
1219
  const id = task.id, mins = o.timeout_min || WAKE_DEFAULTS.timeout_min;
1195
1220
  const where = place.worktree
1196
1221
  ? `Work in ${place.cwd}. It is a separate git worktree of ${place.repo} on the branch ${place.branch}, made for this task so it doesn't collide with other work. Commit your changes on this branch only. Don't merge, rebase or push other branches, and don't touch ${place.repo} itself. Put the branch name in your result so a person can review and merge it.`
@@ -1459,12 +1484,13 @@ function wakeLogger(dir = DIR) {
1459
1484
  };
1460
1485
  }
1461
1486
 
1462
- // Computers set up before a tool joined WAKE_TOOLS (0.7.8: kb_send; 0.9.10: reading and write-back; 0.9.11: kb_file_get) catch up when the program starts after its self-update:
1487
+ // Computers set up before a tool joined WAKE_TOOLS (0.7.8: kb_send; 0.9.10: reading and write-back; 0.9.11: kb_file_get; 0.9.17: kb_find) catch up when the program starts after its self-update:
1463
1488
  // Claude Code's --allowedTools in wake.json if it is still one we wrote, and the other apps' own settings (append only).
1464
1489
  // Returns true when wake.json changed.
1465
1490
  export function wakeTools(cfg, home_ = home(), env = process.env) {
1466
1491
  const ours = ["mcp__owlmem__kb_task_update,mcp__owlmem__kb_inbox", "mcp__owlmem__kb_task_update,mcp__owlmem__kb_inbox,mcp__owlmem__kb_send",
1467
- WAKE_TOOLS_0910.map((n) => "mcp__owlmem__" + n).join(",")], now = WAKE_TOOLS.map((n) => "mcp__owlmem__" + n).join(",");
1492
+ WAKE_TOOLS_0910.map((n) => "mcp__owlmem__" + n).join(","), [...WAKE_TOOLS_0910, "kb_file_get"].map((n) => "mcp__owlmem__" + n).join(",")],
1493
+ now = WAKE_TOOLS.map((n) => "mcp__owlmem__" + n).join(",");
1468
1494
  const cmd = cfg.clients?.["claude-code"]?.command, i = Array.isArray(cmd) ? cmd.indexOf("--allowedTools") : -1;
1469
1495
  let changed = false;
1470
1496
  if (i >= 0 && ours.includes(cmd[i + 1])) { cmd[i + 1] = now; changed = true; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owlmem",
3
- "version": "0.9.15",
3
+ "version": "0.9.17",
4
4
  "description": "OwlMem command line: connect your AI apps to OwlMem in one command (npx -y owlmem install), an end-to-end encrypted vault for your AI agents, and a local MCP server.",
5
5
  "type": "module",
6
6
  "bin": { "owlmem": "owlmem.mjs" },