Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
publish:
name: Publish agent-memory to npm
name: Publish agent-memory-sdk to npm
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -55,9 +55,9 @@ jobs:
run: pnpm test

- name: Verify public package contents
run: pnpm --filter agent-memory pack --dry-run
run: pnpm --filter agent-memory-sdk pack --dry-run

- name: Publish public package
run: pnpm --filter agent-memory publish --access public --no-git-checks
run: pnpm --filter agent-memory-sdk publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
run: pnpm test

- name: Verify public package contents
run: pnpm --filter agent-memory pack --dry-run
run: pnpm --filter agent-memory-sdk pack --dry-run
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ This repo is a TypeScript-first pnpm workspace for the `agent-memory` SDK.
- `packages/anthropic` is the private workspace package for Anthropic model calls through the official `@anthropic-ai/sdk` package.
- `packages/gemini` is the private workspace package for Gemini model calls through the official `@google/genai` package.
- `packages/xai` is the private workspace package for xAI model calls through the documented OpenAI SDK-compatible client path with xAI defaults.
- `packages/agent-memory` is the only public npm package. It should keep `createAgent({ model })` easy and automatic and bundle private workspace package output into `dist/internal`.
- `packages/agent-memory` (`agent-memory-sdk`) is the only public npm package. It should keep `createAgent({ model })` easy and automatic and bundle private workspace package output into `dist/internal`.
- `apps/playground` is private and must never ship in npm packages.

## Development Rules

- Keep source in TypeScript under `src`; generated output belongs in `dist`.
- Add tests before changing SDK behavior.
- Keep package build scripts cleaning `dist` before `tsc` so stale artifacts do not publish.
- Default memory should be automatic in `agent-memory`, but core internals should stay adapter-neutral.
- Default memory should be automatic in `agent-memory-sdk`, but core internals should stay adapter-neutral.
- Major first-party model provider adapters should use official provider SDKs. Compatibility wrappers are for custom OpenAI-compatible endpoints.
- Keep `sqliteMemory()` backed by a real SQLite database file, not JSON.
- Keep `postgresMemory()` responsible for running its own versioned migrations before the first database operation by default.
Expand All @@ -36,4 +36,4 @@ pnpm lint
pnpm pack:check
```

Package dry-runs must only target `agent-memory` and must not include `apps/playground`, `.memory`, `.ai-memory`, generated tarballs, screenshots, logs, or local databases.
Package dry-runs must only target `agent-memory-sdk` and must not include `apps/playground`, `.memory`, `.ai-memory`, generated tarballs, screenshots, logs, or local databases.
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# agent-memory
# agent-memory-sdk

TypeScript SDK for building AI agents with automatic, scoped, persistent memory.

`agent-memory` wraps model calls with memory recall and learning so apps can keep useful user, thread, and operation context without manually stuffing long chat histories into every prompt.
`agent-memory-sdk` wraps model calls with memory recall and learning so apps can keep useful user, thread, and operation context without manually stuffing long chat histories into every prompt.

## Install

Install from npm:

```sh
npm install agent-memory-sdk
```

Or with another package manager:

```sh
pnpm add agent-memory
pnpm add agent-memory-sdk
yarn add agent-memory-sdk
```

For workspace development:
Expand All @@ -22,7 +31,7 @@ pnpm pack:check
## Quick Start

```ts
import { createAgent, openai } from "agent-memory"
import { createAgent, openai } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5")
Expand Down Expand Up @@ -54,10 +63,10 @@ If `userId` is omitted, memory is stored in the shared default scope. That is us

## Storage

The public `agent-memory` package defaults to local JSON persistence:
The public `agent-memory-sdk` package defaults to local JSON persistence:

```ts
import { createAgent, openai } from "agent-memory"
import { createAgent, openai } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5")
Expand All @@ -69,7 +78,7 @@ By default this writes to `.memory/memory.json`.
For a real SQLite database:

```ts
import { createAgent, openai, sqliteMemory } from "agent-memory"
import { createAgent, openai, sqliteMemory } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5"),
Expand All @@ -82,7 +91,7 @@ const agent = createAgent({
For Postgres with pgvector:

```ts
import { createAgent, openai, postgresMemory } from "agent-memory"
import { createAgent, openai, postgresMemory } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5"),
Expand All @@ -99,35 +108,35 @@ The Postgres adapter runs migrations automatically before the first memory opera

## Model Providers

First-party provider integrations are exported from `agent-memory` and use provider SDKs or documented provider client paths internally. The OpenAI adapter depends on the official `openai` TypeScript SDK:
First-party provider integrations are exported from `agent-memory-sdk` and use provider SDKs or documented provider client paths internally. The OpenAI adapter depends on the official `openai` TypeScript SDK:

```ts
import { openai } from "agent-memory"
import { openai } from "agent-memory-sdk"

const model = openai("gpt-5")
```

Anthropic and Gemini are exported by `agent-memory` and use their official SDKs internally:
Anthropic and Gemini are exported by `agent-memory-sdk` and use their official SDKs internally:

```ts
import { anthropic, gemini } from "agent-memory"
import { anthropic, gemini } from "agent-memory-sdk"

const anthropicModel = anthropic("anthropic-model")
const geminiModel = gemini("gemini-2.5-pro")
```

xAI is exported by `agent-memory` too. It uses the documented OpenAI SDK-compatible client path with xAI defaults:
xAI is exported by `agent-memory-sdk` too. It uses the documented OpenAI SDK-compatible client path with xAI defaults:

```ts
import { xai } from "agent-memory"
import { xai } from "agent-memory-sdk"

const model = xai("grok-4")
```

Use the OpenAI-compatible helper only for custom providers that expose a compatible chat completions API:

```ts
import { openAICompatible } from "agent-memory"
import { openAICompatible } from "agent-memory-sdk"

const model = openAICompatible({
model: "deepseek-chat",
Expand All @@ -138,7 +147,7 @@ const model = openAICompatible({

## Package

`agent-memory` is the only public npm package. It bundles the runtime, storage adapters, and model provider adapters behind one install and one import surface.
`agent-memory-sdk` is the only public npm package. It bundles the runtime, storage adapters, and model provider adapters behind one install and one import surface.

The repository still keeps implementation boundaries under `packages/*`:

Expand All @@ -151,7 +160,7 @@ The repository still keeps implementation boundaries under `packages/*`:
- `packages/gemini`: Gemini official SDK adapter.
- `packages/xai`: xAI adapter using the documented OpenAI SDK-compatible client path.

Those workspace packages are private build units. They are compiled into `agent-memory/dist/internal/*` during the public package build and are not published separately.
Those workspace packages are private build units. They are compiled into `packages/agent-memory/dist/internal/*` during the public package build and are not published separately.

## Examples

Expand Down Expand Up @@ -181,7 +190,7 @@ pnpm lint
pnpm pack:check
```

Package dry-runs must only publish the `agent-memory` artifact and must not include `apps/playground`, `.memory`, local databases, logs, screenshots, or generated tarballs.
Package dry-runs must only publish the `agent-memory-sdk` artifact and must not include `apps/playground`, `.memory`, local databases, logs, screenshots, or generated tarballs.

## License

Expand Down
2 changes: 1 addition & 1 deletion apps/openai-sqlite-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"dev": "node server.mjs"
},
"dependencies": {
"agent-memory": "workspace:*"
"agent-memory-sdk": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion apps/openai-sqlite-demo/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises"
import { existsSync } from "node:fs"
import { dirname, resolve, relative } from "node:path"
import { fileURLToPath } from "node:url"
import { createAgent, openai, sqliteMemory } from "agent-memory"
import { createAgent, openai, sqliteMemory } from "agent-memory-sdk"

const appDir = dirname(fileURLToPath(import.meta.url))
const rootDir = resolve(appDir, "../..")
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"dev": "node server.mjs"
},
"dependencies": {
"agent-memory": "workspace:*"
"agent-memory-sdk": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion apps/playground/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createAgent,
customModel,
localMemory
} from "agent-memory"
} from "agent-memory-sdk"

const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), "../..")
const port = Number(process.env.PORT ?? 4317)
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default tseslint.config(
ignores: [
".memory/**",
".ai-memory/**",
"agent-memory-*.tgz",
"agent-memory-sdk-*.tgz",
"coverage/**",
"dist/**",
"**/dist/**",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"packages/*"
],
"scripts": {
"build": "pnpm --filter @agent-memory/core build && pnpm --filter @agent-memory/local build && pnpm --filter @agent-memory/sqlite build && pnpm --filter @agent-memory/postgres build && pnpm --filter @agent-memory/openai build && pnpm --filter @agent-memory/anthropic build && pnpm --filter @agent-memory/gemini build && pnpm --filter @agent-memory/xai build && pnpm --filter agent-memory build",
"build": "pnpm --filter @agent-memory/core build && pnpm --filter @agent-memory/local build && pnpm --filter @agent-memory/sqlite build && pnpm --filter @agent-memory/postgres build && pnpm --filter @agent-memory/openai build && pnpm --filter @agent-memory/anthropic build && pnpm --filter @agent-memory/gemini build && pnpm --filter @agent-memory/xai build && pnpm --filter agent-memory-sdk build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "pnpm build && node --test packages/agent-memory/test/*.test.mjs test/*.test.mjs",
"pack:check": "pnpm --filter agent-memory pack --dry-run",
"pack:check": "pnpm --filter agent-memory-sdk pack --dry-run",
"version:from-tag": "node scripts/sync-package-version-from-tag.mjs"
},
"devDependencies": {
Expand Down
17 changes: 15 additions & 2 deletions packages/agent-memory/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# agent-memory
# agent-memory-sdk

TypeScript SDK for building AI agents with automatic, scoped, persistent memory.

Full project documentation: [github.com/gharibyan/agent-memory](https://github.com/gharibyan/agent-memory).

## Install

```sh
npm install agent-memory-sdk
```

```sh
pnpm add agent-memory-sdk
yarn add agent-memory-sdk
```

## Quick Start

```ts
import { createAgent, openai } from "agent-memory"
import { createAgent, openai } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5")
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-memory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agent-memory",
"version": "0.0.0",
"name": "agent-memory-sdk",
"version": "0.0.1",
"description": "Provider-neutral agent runtime with automatic persistent memory.",
"type": "module",
"author": "Gharibyan",
Expand Down
4 changes: 2 additions & 2 deletions packages/anthropic/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# @agent-memory/anthropic

Anthropic model provider adapter for `agent-memory`, backed by the official `@anthropic-ai/sdk` TypeScript SDK.
Anthropic model provider adapter for `agent-memory-sdk`, backed by the official `@anthropic-ai/sdk` TypeScript SDK.

```ts
import { createAgent } from "agent-memory"
import { createAgent } from "agent-memory-sdk"
import { anthropic } from "@agent-memory/anthropic"

const agent = createAgent({
Expand Down
4 changes: 2 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# packages/core

Private provider-neutral runtime implementation for `agent-memory`.
Private provider-neutral runtime implementation for `agent-memory-sdk`.

Most users should install and import from `agent-memory`.
Most users should install and import from `agent-memory-sdk`.
4 changes: 2 additions & 2 deletions packages/gemini/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# @agent-memory/gemini

Google Gemini model provider adapter for `agent-memory`, backed by the official `@google/genai` TypeScript SDK.
Google Gemini model provider adapter for `agent-memory-sdk`, backed by the official `@google/genai` TypeScript SDK.

```ts
import { createAgent } from "agent-memory"
import { createAgent } from "agent-memory-sdk"
import { gemini } from "@agent-memory/gemini"

const agent = createAgent({
Expand Down
6 changes: 3 additions & 3 deletions packages/local/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# packages/local

Private local persistent memory implementation for `agent-memory`.
Private local persistent memory implementation for `agent-memory-sdk`.

```ts
import { createAgent, localMemory } from "agent-memory"
import { createAgent, localMemory } from "agent-memory-sdk"

const agent = createAgent({
model,
memory: localMemory()
})
```

By default, local memory persists to `.memory/memory.json` in the current working directory. This adapter is meant for local development, prototypes, and single-node apps. Use `sqliteMemory()` from `agent-memory` when you need a real SQLite database file.
By default, local memory persists to `.memory/memory.json` in the current working directory. This adapter is meant for local development, prototypes, and single-node apps. Use `sqliteMemory()` from `agent-memory-sdk` when you need a real SQLite database file.
6 changes: 3 additions & 3 deletions packages/openai/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# packages/openai

Private OpenAI model provider implementation for `agent-memory`, backed by the official `openai` TypeScript SDK.
Private OpenAI model provider implementation for `agent-memory-sdk`, backed by the official `openai` TypeScript SDK.

```ts
import { createAgent, openai } from "agent-memory"
import { createAgent, openai } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5")
Expand All @@ -13,7 +13,7 @@ const agent = createAgent({
For custom models or providers that expose an OpenAI-compatible chat completions API, use `openAICompatible()`:

```ts
import { openAICompatible } from "agent-memory"
import { openAICompatible } from "agent-memory-sdk"

const model = openAICompatible({
model: "deepseek-chat",
Expand Down
4 changes: 2 additions & 2 deletions packages/postgres/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# packages/postgres

Private Postgres persistence implementation for `agent-memory` with automatic migrations and pgvector retrieval.
Private Postgres persistence implementation for `agent-memory-sdk` with automatic migrations and pgvector retrieval.

```ts
import { createAgent, postgresMemory } from "agent-memory"
import { createAgent, postgresMemory } from "agent-memory-sdk"

const agent = createAgent({
model,
Expand Down
4 changes: 2 additions & 2 deletions packages/sqlite/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# packages/sqlite

Private SQLite persistent memory implementation for `agent-memory`.
Private SQLite persistent memory implementation for `agent-memory-sdk`.

```ts
import { createAgent, openai, sqliteMemory } from "agent-memory"
import { createAgent, openai, sqliteMemory } from "agent-memory-sdk"

const agent = createAgent({
model: openai("gpt-5"),
Expand Down
4 changes: 2 additions & 2 deletions packages/xai/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# @agent-memory/xai

xAI model provider adapter for `agent-memory`, using the documented OpenAI SDK-compatible client path with xAI defaults.
xAI model provider adapter for `agent-memory-sdk`, using the documented OpenAI SDK-compatible client path with xAI defaults.

```ts
import { createAgent } from "agent-memory"
import { createAgent } from "agent-memory-sdk"
import { xai } from "@agent-memory/xai"

const agent = createAgent({
Expand Down
Loading
Loading