@snoai/mem-claude 1.7.2 → 2.0.0

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/README.md CHANGED
@@ -4,6 +4,8 @@ Close a Claude Code session and most of what it learned is gone. Sno Memory keep
4
4
  encrypted memory on your own machine that Claude Code fills as you work and reads from at the
5
5
  start of every session.
6
6
 
7
+ **New in 2.0: Tag Team.** Run `sno reach pair "Fix the login redirect"` and two agents take the task: one builds, one challenges, and the work reaches you already argued over. Your status line says when they need you, and `sno squad` shows the whole squad. An interrupted task comes back, or you are told it did not, and a lesson you approve works from the next reply. [What changed](https://github.com/sno-ai/sno-station#new-in-20-tag-team).
8
+
7
9
  ## What you get
8
10
 
9
11
  - **It remembers without being asked.** Each session is captured in the background once it has been quiet for 30 minutes or has ended.
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { homedir } from "node:os";
3
3
  import { isAbsolute, join } from "node:path";
4
+ import { composeContinuityContext, observeAgentEvent, refreshContinuityBrief, renderAgentStatusLine } from "@snoai/memory/coding-skin";
4
5
  import { doctor } from "./doctor.js";
5
6
  import { correctCommand, getCommand, recallCommand, rememberCommand } from "./explicit.js";
6
7
  import { postToolUse, preToolUse, sessionEnd, sessionStart, stop, userPromptSubmit } from "./hooks.js";
@@ -10,23 +11,34 @@ import { MESSAGES } from "./messages.js";
10
11
  import { isTemporaryDirectory, workspaceRoot } from "./scope.js";
11
12
  import { runWorker } from "./worker.js";
12
13
  async function readStdin() {
14
+ const text = await readStdinText();
15
+ return text.trim() ? JSON.parse(text) : {};
16
+ }
17
+ async function readStdinText() {
13
18
  const chunks = [];
14
19
  for await (const chunk of process.stdin)
15
20
  chunks.push(Buffer.from(chunk));
16
- const text = Buffer.concat(chunks).toString("utf8").trim();
17
- return text ? JSON.parse(text) : {};
21
+ return Buffer.concat(chunks).toString("utf8");
18
22
  }
19
23
  function option(args, name) {
20
24
  const index = args.indexOf(name);
21
25
  return index >= 0 ? args[index + 1] : undefined;
22
26
  }
23
- const HOOK_COMMANDS = ["session-start", "user-prompt-submit", "stop", "session-end", "pre-tool-use", "post-tool-use"];
27
+ const HOOK_COMMANDS = ["session-start", "user-prompt-submit", "stop", "session-end", "pre-tool-use", "post-tool-use", "pre-compact"];
24
28
  async function main() {
25
29
  const [command, ...args] = process.argv.slice(2);
30
+ if (command === "status-line")
31
+ return renderAgentStatusLine("claude", option(args, "--sno-original") ?? "W10=", await readStdinText());
32
+ if (command === "agent-state-hook") {
33
+ await observeAgentEvent("claude", args[0] ?? "unknown", await readStdin());
34
+ return 0;
35
+ }
26
36
  const input = HOOK_COMMANDS.includes(command ?? "") ? await readStdin() : undefined;
27
37
  // The Cursor IDE runs Claude Code hooks with Cursor-shaped input; Sno's Cursor hooks own Cursor, so these do nothing there.
28
38
  if (input && typeof input === "object" && "cursor_version" in input)
29
39
  return 0;
40
+ if (input !== undefined && command)
41
+ await observeAgentEvent("claude", command, input);
30
42
  // Scripted runs (a temporary directory, `claude -p`) and background-task notices are not conversations; the
31
43
  // real-agent release journeys set SNO_CAPTURE_SCRIPTED=1 to be recorded anyway. Measured 2026-10-13: 616 of 785 queued turns.
32
44
  if (input && process.env["SNO_CAPTURE_SCRIPTED"] !== "1" && typeof input === "object") {
@@ -39,11 +51,15 @@ async function main() {
39
51
  return 0;
40
52
  }
41
53
  if (command === "session-start") {
42
- process.stdout.write(`${await sessionStart(input)}\n`);
54
+ process.stdout.write(`${await composeContinuityContext("claude", "SessionStart", input, () => sessionStart(input))}\n`);
43
55
  return 0;
44
56
  }
45
57
  if (command === "user-prompt-submit") {
46
- process.stdout.write(`${await userPromptSubmit(input)}\n`);
58
+ process.stdout.write(`${await composeContinuityContext("claude", "UserPromptSubmit", input, () => userPromptSubmit(input))}\n`);
59
+ return 0;
60
+ }
61
+ if (command === "pre-compact") {
62
+ await refreshContinuityBrief("claude", input);
47
63
  return 0;
48
64
  }
49
65
  if (command === "stop") {
@@ -128,13 +144,13 @@ async function main() {
128
144
  }
129
145
  main().then(code => {
130
146
  process.exitCode = code;
131
- if (["session-start", "user-prompt-submit", "stop", "session-end", "pre-tool-use", "post-tool-use", "worker"].includes(process.argv[2] ?? "")) {
147
+ if ([...HOOK_COMMANDS, "agent-state-hook", "worker"].includes(process.argv[2] ?? "")) {
132
148
  process.stdout.write("", () => process.exit(code));
133
149
  }
134
150
  }, error => {
135
151
  const reason = error instanceof Error ? error.message : "engine-failed";
136
152
  const command = process.argv[2];
137
- const silentHooks = ["stop", "session-end", "pre-tool-use", "post-tool-use"];
153
+ const silentHooks = ["stop", "session-end", "pre-tool-use", "post-tool-use", "agent-state-hook"];
138
154
  if (command === "session-start" || command === "user-prompt-submit" || (command !== undefined && silentHooks.includes(command))) {
139
155
  process.stderr.write(`${JSON.stringify({ event: command, reason: "invalid-input" })}\n`);
140
156
  if (command === "session-start" || command === "user-prompt-submit") {
package/dist/install.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
2
2
  import { basename, dirname, isAbsolute, join } from "node:path";
3
- import { CODING_SKIN_HOOKS, codingSkinHookCommand, isCodingSkinHookCommand, snoProgramPath, shellQuote, } from "@snoai/memory/coding-skin";
3
+ import { fileURLToPath } from "node:url";
4
+ import { CODING_SKIN_HOOKS, composeAgentStatusLine, codingSkinHookCommand, continuityBriefPath, isCodingSkinHookCommand, snoProgramPath, shellQuote, } from "@snoai/memory/coding-skin";
4
5
  import { z } from "zod";
5
6
  import { APP_NAME } from "./constants.js";
6
7
  import { MESSAGES } from "./messages.js";
@@ -11,6 +12,14 @@ const settingsSchema = z.looseObject({
11
12
  permissions: z.looseObject({ allow: z.array(z.string()).optional() }).optional(),
12
13
  disableAllHooks: z.boolean().optional(),
13
14
  });
15
+ const CLAUDE_HOOKS = {
16
+ ...CODING_SKIN_HOOKS,
17
+ PreCompact: { subcommand: "pre-compact", timeout: 5 },
18
+ PermissionRequest: { subcommand: "permission-request", timeout: 5 },
19
+ Notification: { subcommand: "notification", timeout: 5 },
20
+ StopFailure: { subcommand: "stop-failure", timeout: 5 },
21
+ };
22
+ const CLI_ENTRY = fileURLToPath(new URL("../dist/cli.js", import.meta.url));
14
23
  function isOwnedProgram(program) {
15
24
  return basename(program) === APP_NAME || /\/mem-claude\/(?:dist|src)\/cli\.(?:js|ts)$/.test(program);
16
25
  }
@@ -31,6 +40,8 @@ export function isOwnedHookCommand(command, subcommand) {
31
40
  return isOwnedProgram(program);
32
41
  }
33
42
  export function isOwnedPermissionRule(rule) {
43
+ if (/^(?:Read|Edit)\(\/\/.+\/station\/handoff\/\*\*\)$/.test(rule))
44
+ return true;
34
45
  if (!rule.startsWith("Bash(") || !rule.endsWith(" *)"))
35
46
  return false;
36
47
  const body = rule.slice(5, -3);
@@ -63,8 +74,8 @@ export async function readSettings(configDir) {
63
74
  }
64
75
  function updateSettings(settings, programPath) {
65
76
  settings.hooks ??= {};
66
- for (const event of Object.keys(CODING_SKIN_HOOKS)) {
67
- const details = CODING_SKIN_HOOKS[event];
77
+ for (const event of Object.keys(CLAUDE_HOOKS)) {
78
+ const details = CLAUDE_HOOKS[event];
68
79
  const groups = settings.hooks[event] ?? [];
69
80
  let installed = false;
70
81
  const hook = {
@@ -90,13 +101,14 @@ function updateSettings(settings, programPath) {
90
101
  }
91
102
  settings.permissions ??= {};
92
103
  const allow = settings.permissions.allow ?? [];
93
- const rule = `Bash(${programPath} memory *)`;
104
+ // Reading and editing the task brief directory, and nothing else, so keeping the brief never asks for approval.
105
+ const briefs = `/${dirname(continuityBriefPath("session"))}/**`;
106
+ const rules = [`Bash(${programPath} memory *)`, `Read(${briefs})`, `Edit(${briefs})`];
94
107
  const index = allow.findIndex(isOwnedPermissionRule);
95
- if (index < 0)
96
- allow.push(rule);
97
- else
98
- allow.splice(index, allow.length - index, rule, ...allow.slice(index + 1).filter(current => !isOwnedPermissionRule(current)));
99
- settings.permissions.allow = allow;
108
+ const kept = allow.filter(current => !isOwnedPermissionRule(current));
109
+ kept.splice(index < 0 ? kept.length : index, 0, ...rules);
110
+ settings.permissions.allow = kept;
111
+ composeAgentStatusLine(settings, CLI_ENTRY, "claude", true);
100
112
  }
101
113
  // Removes the hooks, rule and skill installClaude wrote; every other setting stays as it was.
102
114
  export async function uninstallClaude(options) {
@@ -104,11 +116,12 @@ export async function uninstallClaude(options) {
104
116
  if (!settings)
105
117
  throw new Error(MESSAGES.settingsUnparsable);
106
118
  const before = JSON.stringify(settings);
107
- for (const event of Object.keys(CODING_SKIN_HOOKS)) {
119
+ composeAgentStatusLine(settings, CLI_ENTRY, "claude", false);
120
+ for (const event of Object.keys(CLAUDE_HOOKS)) {
108
121
  const groups = settings.hooks?.[event];
109
122
  if (!settings.hooks || !groups)
110
123
  continue;
111
- const kept = groups.map(group => ({ ...group, hooks: group.hooks.filter(hook => !hook.command || !isOwnedHookCommand(hook.command, CODING_SKIN_HOOKS[event].subcommand)) }))
124
+ const kept = groups.map(group => ({ ...group, hooks: group.hooks.filter(hook => !hook.command || !isOwnedHookCommand(hook.command, CLAUDE_HOOKS[event].subcommand)) }))
112
125
  .filter(group => group.hooks.length > 0);
113
126
  if (kept.length)
114
127
  settings.hooks[event] = kept;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snoai/mem-claude",
3
- "version": "1.7.2",
3
+ "version": "2.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": { "access": "public" },
6
6
  "repository": {
@@ -9,7 +9,7 @@
9
9
  "directory": "apps/mem-claude"
10
10
  },
11
11
  "type": "module",
12
- "description": "Give Claude Code a memory. It remembers what you worked on and brings it back next session.",
12
+ "description": "Put Claude Code on a squad: one memory with your other agents, a status line that says who needs you, and a task that survives compaction.",
13
13
  "files": [
14
14
  "dist",
15
15
  "skills",
@@ -25,7 +25,7 @@
25
25
  "lint:fix": "biome check --write src/"
26
26
  },
27
27
  "dependencies": {
28
- "@snoai/memory": "^1.7.0",
28
+ "@snoai/memory": "^2.0.0",
29
29
  "fs-native-extensions": "^1.5.1",
30
30
  "zod": "^4.5.4"
31
31
  },