@memfork/core
v0.1.12
Published
Git for AI agent memory — TypeScript SDK for MemForks on Sui
Downloads
2,328
Readme
@memfork/core
TypeScript SDK for MemForks — git for AI agent memory on Sui.
Branch-aware commits, semantic recall via MemWal, merge proposals, and delegate access control — with mainnet defaults and optional gas sponsorship.
Install
npm install @memfork/corePeer stack (installed automatically):
@mysten/sui@mysten-incubation/memwal
Quick start
import { MemForksClient } from "@memfork/core";
// Auto-config from .memfork/config.json + ~/.memfork/credentials.json
const client = await MemForksClient.connect();
// Or explicit config
const client = await MemForksClient.connect({
treeId: "0x…",
signer: process.env.MEMFORK_PRIVATE_KEY!,
network: "mainnet",
});
// Write facts to the current branch
await client.commit({
branch: "main",
message: "Chose PostgreSQL over MongoDB",
facts: ["Database: PostgreSQL", "Reason: ACID + team familiarity"],
});
// Semantic recall
const facts = await client.recall("database decision", { branch: "main", limit: 5 });Auto-configuration
MemForksClient.connect() with no arguments resolves config from:
- Environment variables (
MEMFORK_TREE_ID,MEMFORK_PRIVATE_KEY,MEMFORK_NETWORK, …) .memfork/config.jsonin the project directory~/.memfork/credentials.jsonfor secrets
Run npx @memfork/cli init once to generate these files.
Gas sponsorship (mainnet)
On mainnet, on-chain operations can be gas-sponsored — developers don't need SUI in their wallet:
export MEMFORK_SPONSOR_URL=https://sponsor.memfork.aiThe SDK sends unsigned transactions to the sponsor, receives gas-included bytes, signs, and submits.
API surface
| Export | Purpose |
|--------|---------|
| MemForksClient | Primary client — commit, recall, branch, proposeMerge, … |
| MemoryClient | Alias for MemForksClient |
| MemForksIndexer | Event-driven branch head + merge state |
| resolvers | Decode on-chain resolver configs |
| PERM / perms | Delegate permission bitflags |
Framework adapters
| Package | Use case |
|---------|----------|
| @memfork/langgraph | LangGraph checkpointer |
| @memfork/vercel-ai | Vercel AI SDK middleware |
Mainnet package ID
0xc13cc014fb8084b3468f6e5ffdc272e64ef35b7a912332eba7a0d44dd66b3121Override with MEMFORK_PACKAGE_ID or packageId in config.
Links
License
Apache-2.0
