@memfork/cli 0.1.42 → 0.1.44

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.
@@ -15,6 +15,7 @@
15
15
  * codex — ~/.codex/config.toml + installs plugin into this project
16
16
  */
17
17
  import chalk from "chalk";
18
+ import { execSync } from "node:child_process";
18
19
  import fs from "node:fs";
19
20
  import os from "node:os";
20
21
  import path from "node:path";
@@ -122,17 +123,49 @@ function installCodex(cwd) {
122
123
  else {
123
124
  console.log(warn("MemWal MCP skipped — run `memfork init` first to provision credentials."));
124
125
  }
125
- // ── 2. Codex plugin (skills + metadata) ──────────────────────────────────
126
+ // ── 2. Codex plugin build marketplace layout + register + install ───────
127
+ //
128
+ // Codex uses a marketplace model. We copy the plugin source into
129
+ // ~/.memfork/codex-plugin/ (a global location so it works from any project),
130
+ // register it as a local marketplace, then install memforks@memforks.
131
+ // The user runs nothing extra.
132
+ const marketplaceDst = path.join(os.homedir(), ".memfork", "codex-plugin");
126
133
  const pluginSrc = path.join(PLUGIN_ROOT, "codex");
127
- const pluginDst = path.join(cwd, ".codex-plugin");
128
- copyDir(pluginSrc, pluginDst);
129
- console.log(ok("Plugin: .codex-plugin/ (skills + plugin.json)"));
134
+ copyDir(pluginSrc, marketplaceDst);
135
+ console.log(ok(`Plugin files: ${dim(marketplaceDst)}`));
136
+ // Register marketplace (idempotent — Codex no-ops if already added).
137
+ try {
138
+ execSync(`codex plugin marketplace add ${JSON.stringify(marketplaceDst)} --json`, {
139
+ stdio: "pipe",
140
+ });
141
+ }
142
+ catch (e) {
143
+ const msg = e instanceof Error ? e.message : String(e);
144
+ // Codex exits non-zero when the marketplace is already registered.
145
+ if (!msg.includes("already")) {
146
+ console.log(warn(`Marketplace registration failed: ${msg}`));
147
+ console.log(dim(` Run manually: codex plugin marketplace add ~/.memfork/codex-plugin`));
148
+ }
149
+ }
150
+ // Install / upgrade the plugin (idempotent).
151
+ try {
152
+ execSync(`codex plugin add memforks@memforks --json`, { stdio: "pipe" });
153
+ console.log(ok("Plugin: memforks@memforks (installed)"));
154
+ }
155
+ catch (e) {
156
+ const msg = e instanceof Error ? e.message : String(e);
157
+ // Already installed at the same version is not a real error.
158
+ if (msg.includes("already")) {
159
+ console.log(ok("Plugin: memforks@memforks (up to date)"));
160
+ }
161
+ else {
162
+ console.log(warn(`Plugin install failed: ${msg}`));
163
+ console.log(dim(` Run manually: codex plugin add memforks@memforks`));
164
+ }
165
+ }
130
166
  // ── Summary ────────────────────────────────────────────────────────────────
131
167
  console.log("");
132
- console.log(chalk.bold("Done."));
133
- console.log("");
134
- console.log(tip("Register the plugin in Codex:"));
135
- console.log(dim(" codex plugin add .codex-plugin"));
168
+ console.log(chalk.bold("Done.") + " Restart Codex to pick up the plugin and MCP server.");
136
169
  console.log("");
137
170
  console.log(tip("The agent now has:"));
138
171
  console.log(dim(" memwal_recall / memwal_remember — memory storage via MemWal MCP"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memfork/cli",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "MemForks CLI — init, commit, recall, merge, install plugins",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "memforks",
3
+ "interface": { "displayName": "MemForks" },
4
+ "plugins": [
5
+ {
6
+ "name": "memforks",
7
+ "source": { "source": "local", "path": "./plugins/memforks" },
8
+ "policy": { "installation": "AVAILABLE", "authentication": "ON_USE" },
9
+ "category": "Productivity"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: memory-commit
3
+ description: >-
4
+ Commit facts to the MemForks memory DAG using memfork commit --facts.
5
+ Use whenever the user says "remember that", "commit this", "save that",
6
+ "note that", "don't forget", or any phrasing that asks you to persist
7
+ a decision, convention, or finding for future sessions.
8
+ ---
9
+
10
+ # Memory Commit
11
+
12
+ When the user asks you to remember something — a decision, a convention, a
13
+ finding — **always use `memfork commit --facts`**, not `memwal_remember`.
14
+
15
+ `memfork commit --facts` does two things in one command:
16
+
17
+ 1. Indexes the facts in MemWal for semantic recall (same as `memwal_remember`)
18
+ 2. Anchors them on-chain on Sui, tagged to the current Git branch
19
+
20
+ `memwal_remember` alone does only step 1. It saves to `namespace=default`
21
+ with no branch scoping and no on-chain anchor. Use it only for transient,
22
+ throwaway notes that don't warrant a permanent record.
23
+
24
+ ## Procedure
25
+
26
+ ### 1. Identify the facts
27
+
28
+ Extract 1–3 concrete, standalone facts from what the user said. Facts should
29
+ be self-contained sentences — readable out of context in a future session.
30
+
31
+ Good:
32
+ ```
33
+ "error handling convention: always wrap in AppError, never throw raw"
34
+ "auth latency target: p99 < 200ms on bcrypt verify"
35
+ ```
36
+
37
+ Bad (too vague, depends on context):
38
+ ```
39
+ "we agreed on this"
40
+ "the thing we discussed"
41
+ ```
42
+
43
+ ### 2. Run the commit
44
+
45
+ ```bash
46
+ memfork commit \
47
+ --message "<one-line summary of the decision>" \
48
+ --facts "<fact 1>" "<fact 2>"
49
+ ```
50
+
51
+ The CLI auto-detects the current Git branch — do **not** pass `--branch`
52
+ unless explicitly targeting a different branch.
53
+
54
+ ### 3. Confirm to the user
55
+
56
+ After the commit succeeds, print a confirmation in this form:
57
+
58
+ ```
59
+ [memforks] Committed to <branch> — "<message>"
60
+ ```
61
+
62
+ Do not print the full CLI output. One line is enough.
63
+
64
+ ## Rules
65
+
66
+ - Never use `memwal_remember` for facts the user explicitly asks to save.
67
+ - Never commit task state, in-progress work, or temporary findings.
68
+ - If `memfork commit` fails (e.g. no tree initialised), tell the user to
69
+ run `memfork init` first and offer to retry.
70
+ - One commit per logical decision — don't batch unrelated facts together.