Installation
TypeScript
The TypeScript client.
npm
npm install @get-hivemind/sdkbun
bun add @get-hivemind/sdkts
import { Hivemind } from "@get-hivemind/sdk";
const hm = new Hivemind({ apiKey: process.env.HIVEMIND_API_KEY! });
await hm.remember({ content: "We cap production deploys at 3 a month" });
const { payload } = await hm.recall({ q: "how often can we deploy?" });Create a key under Connected tools in the dashboard. Treat it like a password, it grants full access to your memory.
Options
| Default | ||
|---|---|---|
apiKey | required | From the dashboard |
sourceRef | none | Default origin for calls that do not name one, or withOrigin() |
maxRetries | 2 | 0 disables retrying |
timeoutMs | 30000 | Per attempt |
baseUrl | hosted | Point at a different deployment |
fetch | global | Inject your own, for tests or a proxy |
Asking from one origin
ts
const acme = hm.withOrigin("acme");
await acme.remember({ content: "Their staging runs Postgres 16" });Everything on the derived client names that origin. Searches still cover everything owned; results from the origin are preferred, never exclusive. The original is unchanged.
Retries
Transient failures, 408, 409, 429, and 5xx, are retried with exponential backoff and jitter. Client errors are not: retrying a 400 cannot succeed, and retrying a quota error only delays the message you need to read.