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
64 changes: 0 additions & 64 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,73 +54,9 @@ jobs:
- name: Test
run: pnpm test

- name: Verify core package contents
run: pnpm --filter @agent-memory/core pack --dry-run

- name: Verify local adapter package contents
run: pnpm --filter @agent-memory/local pack --dry-run

- name: Verify SQLite adapter package contents
run: pnpm --filter @agent-memory/sqlite pack --dry-run

- name: Verify Postgres adapter package contents
run: pnpm --filter @agent-memory/postgres pack --dry-run

- name: Verify OpenAI adapter package contents
run: pnpm --filter @agent-memory/openai pack --dry-run

- name: Verify Anthropic adapter package contents
run: pnpm --filter @agent-memory/anthropic pack --dry-run

- name: Verify Gemini adapter package contents
run: pnpm --filter @agent-memory/gemini pack --dry-run

- name: Verify xAI adapter package contents
run: pnpm --filter @agent-memory/xai pack --dry-run

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

- name: Publish core
run: pnpm --filter @agent-memory/core publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish local adapter
run: pnpm --filter @agent-memory/local publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish SQLite adapter
run: pnpm --filter @agent-memory/sqlite publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Postgres adapter
run: pnpm --filter @agent-memory/postgres publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish OpenAI adapter
run: pnpm --filter @agent-memory/openai publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Anthropic adapter
run: pnpm --filter @agent-memory/anthropic publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Gemini adapter
run: pnpm --filter @agent-memory/gemini publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish xAI adapter
run: pnpm --filter @agent-memory/xai publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish public package
run: pnpm --filter agent-memory publish --access public --no-git-checks
env:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,5 @@ jobs:
- name: Test
run: pnpm test

- name: Verify core package contents
run: pnpm --filter @agent-memory/core pack --dry-run

- name: Verify local adapter package contents
run: pnpm --filter @agent-memory/local pack --dry-run

- name: Verify SQLite adapter package contents
run: pnpm --filter @agent-memory/sqlite pack --dry-run

- name: Verify Postgres adapter package contents
run: pnpm --filter @agent-memory/postgres pack --dry-run

- name: Verify OpenAI adapter package contents
run: pnpm --filter @agent-memory/openai pack --dry-run

- name: Verify Anthropic adapter package contents
run: pnpm --filter @agent-memory/anthropic pack --dry-run

- name: Verify Gemini adapter package contents
run: pnpm --filter @agent-memory/gemini pack --dry-run

- name: Verify xAI adapter package contents
run: pnpm --filter @agent-memory/xai pack --dry-run

- name: Verify public package contents
run: pnpm --filter agent-memory pack --dry-run
22 changes: 11 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

This repo is a TypeScript-first pnpm workspace for the `agent-memory` SDK.

- `packages/core` (`@agent-memory/core`) is runtime-neutral. Do not add Node `fs`, provider SDKs, or database drivers here.
- `packages/local` (`@agent-memory/local`) owns local `.memory/memory.json` persistence.
- `packages/sqlite` (`@agent-memory/sqlite`) owns real SQLite `.memory/memory.sqlite` persistence.
- `packages/postgres` (`@agent-memory/postgres`) owns Postgres persistence, automatic migrations, and pgvector search.
- `packages/openai` (`@agent-memory/openai`) owns OpenAI model calls through the official `openai` SDK, plus compatible custom endpoint support.
- `packages/anthropic` (`@agent-memory/anthropic`) owns Anthropic model calls through the official `@anthropic-ai/sdk` package.
- `packages/gemini` (`@agent-memory/gemini`) owns Gemini model calls through the official `@google/genai` package.
- `packages/xai` (`@agent-memory/xai`) owns xAI model calls through the documented OpenAI SDK-compatible client path with xAI defaults.
- `packages/agent-memory` is the public convenience package. It should keep `createAgent({ model })` easy and automatic.
- `packages/core` is the private runtime-neutral workspace package. Do not add Node `fs`, provider SDKs, or database drivers here.
- `packages/local` is the private workspace package for local `.memory/memory.json` persistence.
- `packages/sqlite` is the private workspace package for real SQLite `.memory/memory.sqlite` persistence.
- `packages/postgres` is the private workspace package for Postgres persistence, automatic migrations, and pgvector search.
- `packages/openai` is the private workspace package for OpenAI model calls through the official `openai` SDK, plus compatible custom endpoint support.
- `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`.
- `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 direct `@agent-memory/core` usage should stay adapter-neutral.
- Default memory should be automatic in `agent-memory`, 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 not include `apps/playground`, `.memory`, `.ai-memory`, generated tarballs, screenshots, logs, or local databases.
Package dry-runs must only target `agent-memory` and must not include `apps/playground`, `.memory`, `.ai-memory`, generated tarballs, screenshots, logs, or local databases.
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ The Postgres adapter runs migrations automatically before the first memory opera

## Model Providers

First-party provider integrations should use provider SDKs or documented provider client paths. The OpenAI adapter depends on the official `openai` TypeScript SDK:
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:

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

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

Anthropic and Gemini live in their own adapter packages and are also re-exported by `agent-memory`:
Anthropic and Gemini are exported by `agent-memory` and use their official SDKs internally:

```ts
import { anthropic, gemini } from "agent-memory"
Expand All @@ -116,7 +116,7 @@ const anthropicModel = anthropic("anthropic-model")
const geminiModel = gemini("gemini-2.5-pro")
```

xAI has a first-class package too. It uses the documented OpenAI SDK-compatible client path with xAI defaults:
xAI is exported by `agent-memory` too. It uses the documented OpenAI SDK-compatible client path with xAI defaults:

```ts
import { xai } from "agent-memory"
Expand All @@ -136,17 +136,22 @@ const model = openAICompatible({
})
```

## Packages
## Package

- `agent-memory`: public convenience package with automatic local memory defaults.
- `@agent-memory/core`: runtime-neutral engine, contracts, compiler, retrieval, and in-memory store.
- `@agent-memory/local`: local JSON persistence adapter.
- `@agent-memory/sqlite`: real SQLite persistence adapter.
- `@agent-memory/postgres`: Postgres persistence adapter with pgvector migrations.
- `@agent-memory/openai`: OpenAI official SDK adapter, plus OpenAI-compatible custom endpoint support.
- `@agent-memory/anthropic`: Anthropic official SDK adapter.
- `@agent-memory/gemini`: Gemini official SDK adapter.
- `@agent-memory/xai`: xAI adapter using the documented OpenAI SDK-compatible client path.
`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.

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

- `packages/core`: runtime-neutral engine, contracts, compiler, retrieval, and in-memory store.
- `packages/local`: local JSON persistence adapter.
- `packages/sqlite`: real SQLite persistence adapter.
- `packages/postgres`: Postgres persistence adapter with pgvector migrations.
- `packages/openai`: OpenAI official SDK adapter, plus OpenAI-compatible custom endpoint support.
- `packages/anthropic`: Anthropic official SDK adapter.
- `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.

## Examples

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

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

## License

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"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/core pack --dry-run && pnpm --filter @agent-memory/local pack --dry-run && pnpm --filter @agent-memory/sqlite pack --dry-run && pnpm --filter @agent-memory/postgres pack --dry-run && pnpm --filter @agent-memory/openai pack --dry-run && pnpm --filter @agent-memory/anthropic pack --dry-run && pnpm --filter @agent-memory/gemini pack --dry-run && pnpm --filter @agent-memory/xai pack --dry-run && pnpm --filter agent-memory pack --dry-run",
"pack:check": "pnpm --filter agent-memory pack --dry-run",
"version:from-tag": "node scripts/sync-package-version-from-tag.mjs"
},
"devDependencies": {
Expand Down
15 changes: 6 additions & 9 deletions packages/agent-memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@
"package.json"
],
"scripts": {
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.json",
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.json && node ../../scripts/bundle-public-package.mjs",
"test": "pnpm build && node --test test/*.test.mjs"
},
"dependencies": {
"@agent-memory/anthropic": "workspace:*",
"@agent-memory/core": "workspace:*",
"@agent-memory/gemini": "workspace:*",
"@agent-memory/local": "workspace:*",
"@agent-memory/openai": "workspace:*",
"@agent-memory/postgres": "workspace:*",
"@agent-memory/sqlite": "workspace:*",
"@agent-memory/xai": "workspace:*"
"@anthropic-ai/sdk": "^0.104.1",
"@google/genai": "^2.8.0",
"openai": "^6.10.0",
"pg": "^8.16.3",
"sql.js": "^1.13.0"
},
"engines": {
"node": ">=20.12"
Expand Down
11 changes: 11 additions & 0 deletions packages/agent-memory/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "../..",
"rootDir": "src",
"outDir": "dist",
"paths": {
"@agent-memory/anthropic": ["packages/anthropic/dist/index.d.ts"],
"@agent-memory/core": ["packages/core/dist/index.d.ts"],
"@agent-memory/gemini": ["packages/gemini/dist/index.d.ts"],
"@agent-memory/local": ["packages/local/dist/index.d.ts"],
"@agent-memory/openai": ["packages/openai/dist/index.d.ts"],
"@agent-memory/postgres": ["packages/postgres/dist/index.d.ts"],
"@agent-memory/sqlite": ["packages/sqlite/dist/index.d.ts"],
"@agent-memory/xai": ["packages/xai/dist/index.d.ts"]
},
"tsBuildInfoFile": "dist/.tsbuildinfo"
},
"include": ["src/**/*.ts"]
Expand Down
1 change: 1 addition & 0 deletions packages/anthropic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/anthropic",
"version": "0.0.0",
"private": true,
"description": "Anthropic official SDK model provider adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
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 @@
# @agent-memory/core
# packages/core

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

Most users should install and import from `agent-memory`.
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/core",
"version": "0.0.0",
"private": true,
"description": "Core provider-neutral agent memory runtime.",
"type": "module",
"author": "Gharibyan",
Expand Down
1 change: 1 addition & 0 deletions packages/gemini/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/gemini",
"version": "0.0.0",
"private": true,
"description": "Google Gemini official SDK model provider adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
Expand Down
9 changes: 4 additions & 5 deletions packages/local/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# @agent-memory/local
# packages/local

Local persistent memory adapter for `agent-memory`.
Private local persistent memory implementation for `agent-memory`.

```ts
import { createAgent } from "@agent-memory/core"
import { localMemory } from "@agent-memory/local"
import { createAgent, localMemory } from "agent-memory"

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 `@agent-memory/sqlite` 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` when you need a real SQLite database file.
1 change: 1 addition & 0 deletions packages/local/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/local",
"version": "0.0.0",
"private": true,
"description": "Local persistent memory adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
Expand Down
9 changes: 4 additions & 5 deletions packages/openai/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# @agent-memory/openai
# packages/openai

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

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

const agent = createAgent({
model: openai("gpt-5")
Expand All @@ -14,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/openai"
import { openAICompatible } from "agent-memory"

const model = openAICompatible({
model: "deepseek-chat",
Expand Down
1 change: 1 addition & 0 deletions packages/openai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/openai",
"version": "0.0.0",
"private": true,
"description": "OpenAI official SDK model provider adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
Expand Down
7 changes: 3 additions & 4 deletions packages/postgres/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# @agent-memory/postgres
# packages/postgres

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

```ts
import { createAgent } from "agent-memory"
import { postgresMemory } from "@agent-memory/postgres"
import { createAgent, postgresMemory } from "agent-memory"

const agent = createAgent({
model,
Expand Down
1 change: 1 addition & 0 deletions packages/postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agent-memory/postgres",
"version": "0.0.0",
"private": true,
"description": "Postgres and pgvector persistent memory adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
Expand Down
7 changes: 3 additions & 4 deletions packages/sqlite/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# @agent-memory/sqlite
# packages/sqlite

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

```ts
import { createAgent, openai } from "agent-memory"
import { sqliteMemory } from "@agent-memory/sqlite"
import { createAgent, openai, sqliteMemory } from "agent-memory"

const agent = createAgent({
model: openai("gpt-5"),
Expand Down
Loading
Loading