@memfork/cli 0.1.19 → 0.1.20

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.
@@ -21,8 +21,8 @@ import path from "node:path";
21
21
  import { fileURLToPath } from "node:url";
22
22
  import { readCredentials, readProjectConfig, MEMWAL_CONSTANTS } from "../config.js";
23
23
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
- // dist/commands/install.js → packages/clipackages → repo root → plugins/
25
- const PLUGIN_ROOT = path.resolve(__dirname, "..", "..", "..", "..", "plugins");
24
+ // dist/commands/install.js → dist/ → package root → plugins/
25
+ const PLUGIN_ROOT = path.resolve(__dirname, "..", "..", "plugins");
26
26
  function ok(s) { return chalk.green("✓") + " " + s; }
27
27
  function warn(s) { return chalk.yellow("⚠") + " " + s; }
28
28
  function tip(s) { return chalk.cyan("→") + " " + s; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memfork/cli",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "MemForks CLI — init, commit, recall, merge, install plugins",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,8 @@
29
29
  "access": "public"
30
30
  },
31
31
  "files": [
32
- "dist"
32
+ "dist",
33
+ "plugins"
33
34
  ],
34
35
  "dependencies": {
35
36
  "@inquirer/prompts": "^8.5.2",
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "memforks",
3
+ "version": "0.2.0",
4
+ "description": "On-chain, branch-aware memory DAG for Codex. MemForks anchors decisions to Sui and proposes cross-branch merges — memory storage is handled by the MemWal MCP server.",
5
+ "author": {
6
+ "name": "MemForks",
7
+ "email": "team@memforks.dev"
8
+ },
9
+ "homepage": "https://github.com/memforks/memforks",
10
+ "repository": "https://github.com/memforks/memforks",
11
+ "license": "Apache-2.0",
12
+ "keywords": [
13
+ "memory",
14
+ "sui",
15
+ "blockchain",
16
+ "provenance",
17
+ "branching",
18
+ "codex",
19
+ "agent-memory",
20
+ "memwal"
21
+ ],
22
+ "skills": "./skills/",
23
+ "interface": {
24
+ "displayName": "MemForks",
25
+ "shortDescription": "On-chain, branch-aware memory DAG",
26
+ "longDescription": "MemForks gives Codex a tamper-proof, branch-synced memory DAG anchored on Sui. Memory recall and storage are handled natively by the MemWal MCP server. MemForks adds the version-control layer: immutable on-chain commits, Git branch-scoped history, and conflict-free cross-branch merges via an on-chain resolver.",
27
+ "developerName": "MemForks",
28
+ "category": "Productivity",
29
+ "capabilities": [
30
+ "Read",
31
+ "Write"
32
+ ],
33
+ "websiteURL": "https://github.com/memforks/memforks",
34
+ "privacyPolicyURL": "https://github.com/memforks/memforks",
35
+ "termsOfServiceURL": "https://github.com/memforks/memforks/blob/main/LICENSE",
36
+ "defaultPrompt": [
37
+ "Recall any relevant context for this branch",
38
+ "Show my MemForks memory status",
39
+ "Commit the decisions we made today"
40
+ ],
41
+ "brandColor": "#1f9d72",
42
+ "screenshots": []
43
+ }
44
+ }
@@ -0,0 +1,81 @@
1
+ # MemForks — Codex Plugin
2
+
3
+ On-chain, branch-aware memory DAG for Codex.
4
+
5
+ **Memory storage** is handled by the MemWal MCP server — the agent calls
6
+ `memwal_recall` and `memwal_remember` natively as tool calls.
7
+
8
+ **On-chain versioning** is handled by the `memfork` CLI — decisions get
9
+ cryptographically anchored to Sui with branch context and a full commit DAG.
10
+
11
+ ## Setup (one time, per machine)
12
+
13
+ ```bash
14
+ npm install -g @memfork/cli
15
+
16
+ # Recommended — zero copy-paste, ~30 seconds on testnet:
17
+ memfork init --quick
18
+
19
+ # Or manual if you already have a Sui key + MemWal account:
20
+ memfork init
21
+ ```
22
+
23
+ ## Install the plugin
24
+
25
+ ```bash
26
+ memfork install codex
27
+ ```
28
+
29
+ This does two things:
30
+
31
+ 1. **Writes `~/.codex/config.toml`** — adds a `[mcp_servers.memwal]` entry using
32
+ the delegate key provisioned by `memfork init`. No browser login needed.
33
+
34
+ 2. **Copies `.codex-plugin/`** — installs the plugin skills into the current project.
35
+
36
+ Then register with Codex:
37
+
38
+ ```bash
39
+ codex plugin add .codex-plugin
40
+ ```
41
+
42
+ ## Verify
43
+
44
+ ```bash
45
+ memfork doctor
46
+ ```
47
+
48
+ ## What the agent can do
49
+
50
+ | Tool / Command | What it does |
51
+ |----------------|-------------|
52
+ | `memwal_recall(query, namespace)` | Semantic search over branch memory (MCP tool) |
53
+ | `memwal_remember(text, namespace)` | Save a fact to branch memory (MCP tool) |
54
+ | `memwal_analyze(text)` | Extract and save multiple facts at once (MCP tool) |
55
+ | `memfork commit --facts …` | Anchor a decision on-chain with full provenance |
56
+ | `memfork merge <src> <dst>` | Propose a cross-branch memory merge |
57
+ | `memfork status / log / proposals` | Inspect the on-chain DAG |
58
+
59
+ Memory is namespaced by Git branch — `namespace="branch/<branch-name>"`.
60
+
61
+ ## What gets installed
62
+
63
+ ```
64
+ ~/.codex/config.toml ← MemWal MCP server entry (auto-configured)
65
+ .codex-plugin/
66
+ plugin.json ← plugin metadata
67
+ skills/
68
+ memory-recall/ ← when/how to use memwal_recall
69
+ memforks-status/ ← when/how to use memfork commit/merge/status
70
+ ```
71
+
72
+ No shell hooks. The MCP server is the transport.
73
+
74
+ ## Override for CI / headless use
75
+
76
+ ```bash
77
+ MEMFORK_TREE_ID=0x…
78
+ MEMFORK_PRIVATE_KEY=suiprivkey1…
79
+ MEMFORK_MEMWAL_ACCOUNT=0x…
80
+ MEMFORK_MEMWAL_KEY=<hex>
81
+ ```
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: memforks-status
3
+ description: >-
4
+ Show MemForks on-chain status: branch DAG, open merge proposals, recent commits.
5
+ Use when the user asks about memory status, proposals, or the commit log.
6
+ Also use when committing decisions or proposing a merge.
7
+ ---
8
+
9
+ # MemForks On-Chain Operations
10
+
11
+ MemForks is the version-control layer on top of MemWal. Use the `memfork` CLI for
12
+ DAG operations — not for routine recall/remember (that's the MCP server's job).
13
+
14
+ ## Check status
15
+
16
+ ```bash
17
+ memfork status # current tree, branch, signer, head commit
18
+ memfork log --branch <branch> # recent on-chain commits
19
+ memfork proposals # open merge proposals
20
+ memfork ui # open the DAG visualizer
21
+ ```
22
+
23
+ ## Commit a decision on-chain
24
+
25
+ Use this after significant architectural decisions — not for routine facts.
26
+ (Routine facts go through `memwal_remember` via MCP.)
27
+
28
+ ```bash
29
+ memfork commit \
30
+ --branch $(git rev-parse --abbrev-ref HEAD) \
31
+ --message "decided: <one-line summary>" \
32
+ --facts "<fact 1>" "<fact 2>"
33
+ ```
34
+
35
+ ## Merge branches
36
+
37
+ When two branches need to reconcile their memory:
38
+
39
+ ```bash
40
+ # Zero-config — LastWriteWins, self-finalizes immediately
41
+ memfork merge <from-branch> <into-branch>
42
+
43
+ # Governed — jury / LLM resolver (requires MEMFORK_RESOLVER_ID env var or --resolver flag)
44
+ memfork merge <from-branch> <into-branch> --resolver <resolver-id>
45
+ ```
46
+
47
+ With no `--resolver` flag and no `MEMFORK_RESOLVER_ID` set, the merge uses
48
+ LastWriteWins and finalizes immediately — no resolver service required.
49
+
50
+ When a resolver is configured, the command waits for the on-chain resolver service
51
+ to collect attestations and finalize before returning.
52
+
53
+ ---
54
+
55
+ ## Suggesting a merge — proactive but not autonomous
56
+
57
+ You may **suggest** a merge when you notice the current branch has accumulated
58
+ durable facts not yet on `main`. Phrase it as an offer:
59
+
60
+ > "This branch has several facts that aren't on main yet — want me to merge them?
61
+ > I'll run `memfork merge <branch> main`."
62
+
63
+ **Never run `memfork merge` without the user explicitly confirming.** Merging
64
+ changes shared team memory and creates an on-chain anchor — it is a governance
65
+ act, not a routine commit.
66
+
67
+ Suggest a merge when:
68
+ - The user says "we're done with this branch" or "I'm about to open a PR"
69
+ - You've committed 3+ significant facts this session and the user hasn't merged
70
+ - The user asks "what should I do next?" at the end of a long session
71
+
72
+ Once the user confirms, run:
73
+
74
+ ```bash
75
+ memfork merge <current-branch> main
76
+ ```
77
+
78
+ ---
79
+
80
+ ## When to use this skill
81
+
82
+ - User asks "what's the status of my memory?"
83
+ - User asks "are there any pending merges?"
84
+ - User says "commit what we decided today"
85
+ - User confirms they want to merge memory from one branch into another
86
+ - User wants to open the DAG visualizer
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: memory-recall
3
+ description: >-
4
+ Recall relevant memory for the current task using the MemWal MCP tool.
5
+ Use when the user asks about prior decisions, past context, or what you remember.
6
+ ---
7
+
8
+ # Memory Recall
9
+
10
+ Memory is stored via the **MemWal MCP server** — use `memwal_recall` directly as a tool call.
11
+ Do not run `memfork recall` from the shell; the MCP tool is faster and context-aware.
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ memwal_recall(
17
+ query="<natural language — what you want to find>",
18
+ namespace="branch/<current-git-branch>",
19
+ limit=5
20
+ )
21
+ ```
22
+
23
+ Examples:
24
+ ```
25
+ memwal_recall(query="auth system design", namespace="branch/main")
26
+ memwal_recall(query="database schema decisions", namespace="branch/feature/payments")
27
+ memwal_recall(query="what do we know about the API rate limits?", limit=10)
28
+ ```
29
+
30
+ ## Rules
31
+
32
+ - Always scope to the current Git branch namespace unless the user asks for cross-branch context.
33
+ - High relevance scores = verified prior context.
34
+ - If recall returns nothing, tell the user memory is empty for this branch and offer to start capturing.
35
+ - Never fabricate facts — only use what `memwal_recall` returns.
36
+
37
+ ## After recalling
38
+
39
+ If relevant facts were found, summarise them briefly before answering. Cite them as
40
+ "from memory" so the user knows they come from a prior session.
@@ -0,0 +1,86 @@
1
+ # MemForks — Cursor Plugin
2
+
3
+ On-chain, branch-aware memory DAG for Cursor.
4
+
5
+ **Memory storage** is handled by the MemWal MCP server — the agent calls
6
+ `memwal_recall` and `memwal_remember` natively as tool calls, mid-conversation,
7
+ at exactly the right moment.
8
+
9
+ **On-chain versioning** is handled by the `memfork` CLI — architectural decisions
10
+ get cryptographically anchored to Sui with branch context and a full commit history.
11
+
12
+ ## Setup (one time, per machine)
13
+
14
+ ```bash
15
+ npm install -g @memfork/cli
16
+
17
+ # Recommended — zero copy-paste, ~30 seconds on testnet:
18
+ memfork init --quick
19
+
20
+ # Or manual if you already have a Sui key + MemWal account:
21
+ memfork init
22
+ ```
23
+
24
+ ## Install the plugin
25
+
26
+ ```bash
27
+ memfork install cursor
28
+ ```
29
+
30
+ This does two things:
31
+
32
+ 1. **Writes `~/.cursor/mcp.json`** — configures the MemWal MCP server using the
33
+ delegate key provisioned by `memfork init`. No browser login needed.
34
+
35
+ 2. **Copies `.cursor/rules/memforks.mdc`** — tells the agent when to use
36
+ `memwal_recall`, `memwal_remember`, and `memfork commit`.
37
+
38
+ ## Verify
39
+
40
+ ```bash
41
+ memfork doctor
42
+ ```
43
+
44
+ Restart Cursor — the agent now has MemWal MCP tools available immediately.
45
+
46
+ ## What the agent can do
47
+
48
+ | Tool / Command | What it does |
49
+ |----------------|-------------|
50
+ | `memwal_recall(query, namespace)` | Semantic search over branch memory (MCP tool) |
51
+ | `memwal_remember(text, namespace)` | Save a fact to branch memory (MCP tool) |
52
+ | `memwal_analyze(text)` | Extract and save multiple facts at once (MCP tool) |
53
+ | `memfork commit --facts …` | Anchor a decision on-chain with full provenance |
54
+ | `memfork merge <src> <dst>` | Propose a cross-branch memory merge |
55
+ | `memfork status / log / proposals` | Inspect the on-chain DAG |
56
+
57
+ Memory is namespaced by Git branch — switching branches automatically scopes
58
+ recall to the new branch context.
59
+
60
+ ## What gets installed
61
+
62
+ ```
63
+ ~/.cursor/mcp.json ← MemWal MCP server (Streamable HTTP, auto-configured)
64
+ .cursor/rules/memforks.mdc ← always-on agent guidance rule
65
+ ```
66
+
67
+ No shell hooks. No subprocess wrappers. The MCP server is the transport.
68
+
69
+ ## Override for CI / headless use
70
+
71
+ ```bash
72
+ MEMFORK_TREE_ID=0x…
73
+ MEMFORK_PRIVATE_KEY=suiprivkey1…
74
+ MEMFORK_MEMWAL_ACCOUNT=0x…
75
+ MEMFORK_MEMWAL_KEY=<hex>
76
+ ```
77
+
78
+ ## Uninstall
79
+
80
+ ```bash
81
+ # Remove the rule:
82
+ rm .cursor/rules/memforks.mdc
83
+
84
+ # Remove the MCP server entry from ~/.cursor/mcp.json:
85
+ # Delete the "memwal" key from mcpServers
86
+ ```
@@ -0,0 +1,103 @@
1
+ ---
2
+ description: MemForks — on-chain, branch-aware memory. Use memwal MCP tools for recall/remember. Use memfork CLI only for on-chain commits and merges.
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # MemForks Memory
7
+
8
+ This project uses MemForks: a version-controlled, branch-aware memory DAG anchored on Sui.
9
+
10
+ Memory storage is handled by the **MemWal MCP server** (already configured).
11
+ On-chain versioning is handled by the **memfork CLI**.
12
+
13
+ ---
14
+
15
+ ## Recall — use the MCP tool
16
+
17
+ When the user asks about prior decisions, architecture choices, or anything that might
18
+ have been discussed before, call the MCP tool:
19
+
20
+ ```
21
+ memwal_recall(query="<natural language query>", limit=5)
22
+ ```
23
+
24
+ Use the namespace matching the current Git branch:
25
+
26
+ ```
27
+ memwal_recall(query="auth system design decisions", namespace="branch/<current-branch>")
28
+ ```
29
+
30
+ Results with high relevance scores are verified context from prior sessions.
31
+
32
+ ## Remember — use the MCP tool
33
+
34
+ When you learn a durable fact (not ephemeral task state), save it:
35
+
36
+ ```
37
+ memwal_remember(text="<the complete fact>", namespace="branch/<current-branch>")
38
+ ```
39
+
40
+ Only save facts that will be useful in future sessions:
41
+ - Architecture decisions
42
+ - Project conventions and preferences
43
+ - Resolved problems and their solutions
44
+ - Key constraints or non-obvious requirements
45
+
46
+ Do **not** save: current task state, in-progress work, temporary findings.
47
+
48
+ ---
49
+
50
+ ## On-chain commit — use the CLI
51
+
52
+ After a significant turn where you've committed an architectural decision or resolved
53
+ a non-trivial problem, also anchor it on-chain for immutable versioning:
54
+
55
+ ```bash
56
+ memfork commit \
57
+ --branch $(git rev-parse --abbrev-ref HEAD) \
58
+ --message "decided: <one-line summary>" \
59
+ --facts "<fact 1>" "<fact 2>"
60
+ ```
61
+
62
+ This creates a cryptographically verifiable commit on Sui — not just a blob.
63
+ Use it for decisions that matter for audit trail, not routine facts.
64
+
65
+ ---
66
+
67
+ ## Branch awareness
68
+
69
+ - Memory is scoped to the current Git branch via the `namespace` parameter
70
+ - When the user switches branches, recall from the new branch namespace
71
+ - Use `memfork status` to see the on-chain tree state and open merge proposals
72
+
73
+ ---
74
+
75
+ ## Suggesting a merge — proactive but not autonomous
76
+
77
+ You may **suggest** a merge when you notice the current branch has accumulated
78
+ durable facts that are not yet on `main`. Do this by saying something like:
79
+
80
+ > "This branch has several facts that aren't on main yet — want me to merge them?
81
+ > I'll run `memfork merge <branch> main` which will write a merge anchor on-chain."
82
+
83
+ **Never run `memfork merge` without the user explicitly confirming.** Merging
84
+ changes shared team memory — it is a governance act, not a routine commit.
85
+
86
+ Situations where a suggestion is appropriate:
87
+ - The user says "we're done with this branch" or "I'm about to open a PR"
88
+ - You've committed 3+ significant facts in this session and the user hasn't merged yet
89
+ - The user asks "what should I do next?" at the end of a long session
90
+
91
+ Always phrase it as an offer, never as an action you are about to take automatically.
92
+
93
+ ---
94
+
95
+ ## Slash commands
96
+
97
+ | Command | Action |
98
+ |---------|--------|
99
+ | `/memforks status` | Branch status, head commit, open proposals |
100
+ | `/memforks log` | Recent on-chain commits on this branch |
101
+ | `/memforks recall <query>` | Manual MCP recall with a specific query |
102
+ | `/memforks merge <src> <dst>` | Merge branch memory on-chain (confirm with user first) |
103
+ | `/memforks ui` | Open the DAG visualizer |