Memax CLI
raw JSON → 0.1.2 verified Sat Apr 25 auth: no javascript
Universal context and memory hub CLI designed for AI agents, currently at v0.1.2. Provides persistent memory, inter-agent context sharing, and role-based context injection for AI assistants like Claude Code. Key differentiators: integrates with LLM-powered workflows via JSON commands, supports dynamic memory retrieval, and offers both authentication and session-based memory management. Actively developed with a focus on agent-to-agent communication.
Common errors
error Error: Cannot find module 'memax-cli' ↓
cause Missing peer dependency node-fetch or incorrect Node.js version (<14)
fix
npm install node-fetch@2 and ensure Node >=14
error TypeError: memax is not a function ↓
cause Using default import instead of named import
fix
Use import { MemaxClient } from 'memax-cli'
error UnhandledPromiseRejection: 401 Unauthorized ↓
cause Missing or invalid MEMAX_API_KEY environment variable
fix
Set MEMAX_API_KEY in environment or pass apiKey to constructor
Warnings
breaking API versioning: requests without Accept header default to v1, but future versions may break ↓
fix Always set Accept: application/vnd.memax.v2+json in requests when upgrading
deprecated setContext parameter now requires object, not string; v0.1.0 accepted strings ↓
fix Wrap string values in an object: { value: 'mystring' }
gotcha Memory search may return stale results due to eventual consistency (up to 2s delay) ↓
fix Wait 2 seconds after setContext or use the 'immediate' mode: { consistency: 'strong' }
Install
npm install memax-cli yarn add memax-cli pnpm add memax-cli Imports
- default wrong
const memax = require('memax-cli')correctimport memax from 'memax-cli' - MemaxClient wrong
import MemaxClient from 'memax-cli'correctimport { MemaxClient } from 'memax-cli' - login wrong
import login from 'memax-cli'correctimport { login } from 'memax-cli'
Quickstart
import { MemaxClient } from 'memax-cli';
const client = new MemaxClient({
apiKey: process.env.MEMAX_API_KEY ?? '',
session: 'my-session'
});
await client.setContext('user', { name: 'Alice', mood: 'curious' });
const ctx = await client.getContext('user');
console.log(ctx);
await client.shareContext('agent-2', ['user']);
const search = await client.searchMemory('curious');
console.log(search);