Skip to main content

TypeScript SDK Reference

The @moorcheh-ai/memanto SDK for Node.js / TypeScript boots a local Memanto server on demand via uvx and exposes an ergonomic client.

Prerequisites

  • Node.js 18+
  • uvx on PATH — install uv (which ships uvx)

Installation

npm install @moorcheh-ai/memanto

Quick Start

import { Memanto } from "@moorcheh-ai/memanto";

const memanto = new Memanto({
  agentId: "my-agent",
  apiKey: process.env.MOORCHEH_API_KEY,
});

await memanto.remember({ content: "Alex prefers oat milk." });

const { memories } = await memanto.recall({ query: "what does Alex drink?" });
console.log(memories);

const { answer } = await memanto.answer({ question: "Does Alex drink dairy?" });
console.log(answer);

await memanto.close();
On the first call, the SDK:
  1. Picks a free port and spawns uvx memanto serve --port <port>.
  2. Polls /health until the server is ready.
  3. Creates the agent (if autoCreate is enabled — default true) and activates a session.
  4. Sends the request with the session token attached.
When close() is called (or the Node process exits), the server is sent SIGTERM.

Memanto Client

Constructor

new Memanto(options: MemantoOptions)
OptionTypeDefaultDescription
agentIdstringRequired. Agent identifier.
apiKeystringMoorcheh API key, passed to the server as MOORCHEH_API_KEY.
autoCreatebooleantrueCreate the agent if it does not exist.
baseUrlstringUse an already-running server URL instead of spawning one.
portnumberautoBind the spawned server to this port.
hoststring127.0.0.1Bind host.
uvxPathstringuvxOverride the path to uvx.
packageSpecstringmemantoPackage spec for uvx. Use memanto==0.2.3 to pin.
healthTimeoutMsnumber60000Health-check timeout.
verbosebooleanfalseStream server logs to the parent process.

Memory Write Methods

await memanto.remember({ content, type?, title?, confidence?, tags?, source?, provenance? })
await memanto.batchRemember(items[])         // up to 100 items
await memanto.extractMemories({ messages, dryRun?, maxMemories?, aiModel? })
await memanto.uploadFile({ path, filename? }) // .pdf, .docx, .xlsx, .json, .txt, .csv, .md
await memanto.deleteMemory(memoryId)

Memory Read Methods

await memanto.recall({ query, limit?, minSimilarity?, type? })
await memanto.recallAsOf({ asOf, limit?, type? })        // point-in-time
await memanto.recallChangedSince({ since, limit?, type? }) // what changed after
await memanto.recallRecent({ limit?, type? })               // newest-first
await memanto.answer({ question, limit?, threshold?, temperature?, aiModel?, kioskMode? })

Analysis Methods

await memanto.dailySummary({ date?, outputPath? })
await memanto.generateConflicts({ date? })
await memanto.listConflicts({ date? })
await memanto.resolveConflict({ conflictIndex, action, date?, manualContent?, manualType? })
action is one of: keep_old | keep_new | keep_both | remove_both | manual.

Agent & Session Lifecycle

await memanto.listAgents()
await memanto.getAgent()
await memanto.createAgent({ pattern?, description? })
await memanto.deleteAgent()
await memanto.deactivate()    // end session, next call rebootstraps
await memanto.status()        // current session info
await memanto.close()         // stop the spawned server

Diagnostics

import { doctor } from "@moorcheh-ai/memanto";

const result = await doctor();
if (!result.uvxAvailable) {
  console.error(result.hint);
}

Versioning

The npm package version tracks the matching PyPI release. Pin the server version with:
new Memanto({
  packageSpec: "memanto==0.2.3",
  // ...
});

License

MIT