@memfork/cli 0.1.46 → 0.1.48

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/cli.js CHANGED
@@ -66,6 +66,16 @@ program
66
66
  .command("status")
67
67
  .description("show current tree, network, branch, and signer")
68
68
  .action(wrap(cmdStatus));
69
+ program
70
+ .command("namespace [branch]")
71
+ .description("print the MemWal namespace for a branch (use with memwal_recall namespace= arg)")
72
+ .action(wrap(async (branch) => {
73
+ const { cfg } = await import("./config.js").then((m) => ({ cfg: m.resolveConfig() }));
74
+ const { resolveBranch } = await import("./branch.js");
75
+ const { branchNamespace } = await import("@memfork/core");
76
+ const b = resolveBranch({ explicit: branch, configDefault: cfg.defaultBranch });
77
+ console.log(branchNamespace(cfg.treeId, b));
78
+ }));
69
79
  program
70
80
  .command("log")
71
81
  .description("show recent commits on a branch")
@@ -85,6 +95,7 @@ program
85
95
  .requiredOption("-m, --message <msg>", "commit message")
86
96
  .option("-b, --branch <name>", "branch (default: current git branch)")
87
97
  .option("-f, --facts <facts...>", "one or more fact strings")
98
+ .option("--tool <tool>", "tool that wrote this commit: codex | cursor | sdk")
88
99
  .option("--from-response <text>", "extract facts from a full response text")
89
100
  .option("--auto-extract", "use LLM to extract durable facts (requires --from-response)")
90
101
  .option("--file <path>", "attach a file as a Walrus artifact (repeatable). Requires artifacts.enabled = true in config.", (v, acc) => [...acc, v], [])
@@ -16,6 +16,7 @@ export declare function cmdCommit(opts: {
16
16
  branch?: string;
17
17
  message: string;
18
18
  facts?: string[];
19
+ tool?: string;
19
20
  fromResponse?: string;
20
21
  autoExtract?: boolean;
21
22
  /**
@@ -155,6 +155,7 @@ export async function cmdCommit(opts) {
155
155
  const { blobId, artifacts: refs } = await client.commit(branch, {
156
156
  facts,
157
157
  message: opts.message,
158
+ ...(opts.tool ? { tool: opts.tool } : {}),
158
159
  ...(artifacts.length > 0 ? { artifacts } : {}),
159
160
  });
160
161
  const out = { blobId, branch, artifacts: refs };
@@ -242,6 +242,19 @@ async function handleApiHistory(res, url) {
242
242
  message: facts?.length ? facts[0] : `commit ${entry.blob_id.slice(0, 8)}`,
243
243
  delta: payload["delta"] ?? {},
244
244
  ...(artifacts?.length ? { artifacts } : {}),
245
+ // author is stored as base64-encoded bytes; decode to 0x-prefixed hex address.
246
+ ...(payload["author"] ? {
247
+ author: (() => {
248
+ try {
249
+ const hex = Buffer.from(String(payload["author"]), "base64").toString("hex");
250
+ return `0x${hex}`;
251
+ }
252
+ catch {
253
+ return undefined;
254
+ }
255
+ })(),
256
+ } : {}),
257
+ ...(payload["tool"] ? { tool: payload["tool"] } : {}),
245
258
  }];
246
259
  });
247
260
  commits.sort((a, b) => a.ts_ms - b.ts_ms);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memfork/cli",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "MemForks CLI — init, commit, recall, merge, install plugins",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,7 +54,8 @@ memfork doctor
54
54
  | `memfork merge <src> <dst>` | Propose a cross-branch memory merge |
55
55
  | `memfork status / log / proposals` | Inspect the on-chain DAG |
56
56
 
57
- Memory is namespaced by Git branch `namespace="branch/<branch-name>"`.
57
+ Memory is namespaced by Git branch in the form `memforks/<treeId>/<branch>`.
58
+ Run `memfork namespace` to get the exact string for the current branch.
58
59
 
59
60
  ## What gets installed
60
61
 
@@ -12,24 +12,38 @@ Do not run `memfork recall` from the shell; the MCP tool is faster and context-a
12
12
 
13
13
  ## Usage
14
14
 
15
+ MemWal namespaces are scoped to the tree in the form `memforks/<treeId>/<branch>`.
16
+ Get the correct namespace first:
17
+
18
+ ```bash
19
+ memfork namespace # current branch
20
+ memfork namespace feat/auth # specific branch
21
+ ```
22
+
23
+ Then recall:
24
+
15
25
  ```
16
26
  memwal_recall(
17
27
  query="<natural language — what you want to find>",
18
- namespace="branch/<current-git-branch>",
28
+ namespace="memforks/<treeId>/<current-git-branch>",
19
29
  limit=5
20
30
  )
21
31
  ```
22
32
 
33
+ If you cannot run `memfork namespace`, omit `namespace` entirely — MemWal will search
34
+ the full account across all branches.
35
+
23
36
  Examples:
24
37
  ```
25
- memwal_recall(query="auth system design", namespace="branch/main")
26
- memwal_recall(query="database schema decisions", namespace="branch/feature/payments")
38
+ memwal_recall(query="auth system design", namespace="memforks/<treeId>/main")
39
+ memwal_recall(query="database schema decisions", namespace="memforks/<treeId>/feature/payments")
27
40
  memwal_recall(query="what do we know about the API rate limits?", limit=10)
28
41
  ```
29
42
 
30
43
  ## Rules
31
44
 
32
45
  - Always scope to the current Git branch namespace unless the user asks for cross-branch context.
46
+ Use `memfork namespace` to get the exact string; never guess `branch/<name>`.
33
47
  - High relevance scores = verified prior context.
34
48
  - If recall returns nothing, tell the user memory is empty for this branch and offer to start capturing.
35
49
  - Never fabricate facts — only use what `memwal_recall` returns.
@@ -21,11 +21,20 @@ have been discussed before, call the MCP tool:
21
21
  memwal_recall(query="<natural language query>", limit=5)
22
22
  ```
23
23
 
24
- Use the namespace matching the current Git branch:
24
+ Use the namespace matching the current Git branch. Get the exact value from the CLI first:
25
25
 
26
+ ```bash
27
+ memfork namespace # prints: memforks/<treeId>/<current-branch>
28
+ memfork namespace feat/auth # prints namespace for a specific branch
26
29
  ```
27
- memwal_recall(query="auth system design decisions", namespace="branch/<current-branch>")
30
+
31
+ Then pass it to the MCP tool:
32
+
28
33
  ```
34
+ memwal_recall(query="auth system design decisions", namespace="memforks/<treeId>/feat/auth")
35
+ ```
36
+
37
+ If you cannot run the CLI, omit `namespace` — MemWal will search the full account across all branches.
29
38
 
30
39
  Results with high relevance scores are verified context from prior sessions.
31
40
 
@@ -111,7 +120,9 @@ human governance act.
111
120
  ## Branch awareness
112
121
 
113
122
  - The `memfork` CLI auto-detects the current Git branch; pass `--branch` only to override it.
114
- - The `memwal_*` MCP tools have no Git context, so pass `namespace="branch/<current-branch>"` explicitly.
123
+ - The `memwal_*` MCP tools have no Git context. MemWal namespaces are in the form
124
+ `memforks/<treeId>/<branch>` — get the exact value with `memfork namespace <branch>`,
125
+ then pass it as `namespace=` to recall. Without it, omit namespace to search all branches.
115
126
  - When the user switches branches, recall from the new branch namespace.
116
127
  - Use `memfork status` to see the current branch, on-chain tree state, and open merge proposals.
117
128