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
9 changes: 9 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ jobs:
cache: pnpm
registry-url: https://registry.npmjs.org

- name: Validate npm publish token
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "NPM_TOKEN secret is required for npm publishing"
exit 1
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ node_modules/
.memory/
.ai-memory/
.idea/
.env
.env.*
!.env.example
!apps/**/.env.example
*.log
*.sqlite
*.sqlite-shm
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,24 @@ const model = openAICompatible({
- `@agent-memory/gemini`: Gemini official SDK adapter.
- `@agent-memory/xai`: xAI adapter using the documented OpenAI SDK-compatible client path.

## Playground
## Examples

```sh
pnpm --filter @agent-memory/playground dev
```

The playground is private to the repository and is not included in npm packages.
The local playground uses an echo model and local JSON memory.

For a real OpenAI call with SQLite memory:

```sh
cp apps/openai-sqlite-demo/.env.example apps/openai-sqlite-demo/.env
pnpm --filter @agent-memory/openai-sqlite-demo dev
```

Set `OPENAI_API_KEY` in `apps/openai-sqlite-demo/.env` or in your server environment. The key stays server-side, and memory persists to `.memory/openai-demo.sqlite` by default.

Both example apps are private to the repository and are not included in npm packages.

## Development

Expand Down
5 changes: 5 additions & 0 deletions apps/openai-sqlite-demo/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
OPENAI_API_KEY=
OPENAI_MODEL=gpt-5.4-mini
AGENT_MEMORY_DEMO_SQLITE_PATH=.memory/openai-demo.sqlite
AGENT_MEMORY_DEMO_CONTEXT_BUDGET=1400
PORT=4318
41 changes: 41 additions & 0 deletions apps/openai-sqlite-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# OpenAI SQLite Demo

Interactive server-side example that calls OpenAI with `OPENAI_API_KEY` and stores compounding memory in SQLite through `sqliteMemory()`.

The browser never receives the API key. The server reads `OPENAI_API_KEY`, creates an `openai()` model provider, and persists memory to `.memory/openai-demo.sqlite` by default.

## Run Locally

```sh
cp apps/openai-sqlite-demo/.env.example apps/openai-sqlite-demo/.env
pnpm --filter @agent-memory/openai-sqlite-demo dev
```

Then open [http://localhost:4318](http://localhost:4318).

## Interactive Scenarios

The demo includes four real-life walkthroughs:

- Customer support: remembers reply tone and refund escalation rules.
- Sales CRM: remembers buyer communication preferences and follow-up constraints.
- Personal assistant: remembers planning style and durable user facts.
- Product ops: remembers launch decisions and operational constraints.

Each scenario has "Run scenario step" actions that teach memory and a "Try recall" action that asks the model to use what was stored. The response panels show the assistant answer, memories used, memories created, ignored memory candidates, recent events, and a plain-English explanation of how the SDK handled recall and learning.

Set these values in `apps/openai-sqlite-demo/.env` or in your deployment environment:

```sh
OPENAI_API_KEY=
OPENAI_MODEL=gpt-5.4-mini
AGENT_MEMORY_DEMO_SQLITE_PATH=.memory/openai-demo.sqlite
AGENT_MEMORY_DEMO_CONTEXT_BUDGET=1400
PORT=4318
```

## Deployment

Deploy this demo to a server runtime, not a static-only host. Good targets include a VM, container host, Codespaces-style development environment, or any Node server platform that can set environment variables securely.

Do not put `OPENAI_API_KEY` in browser code, static hosting config, checked-in files, or client-side environment variables.
11 changes: 11 additions & 0 deletions apps/openai-sqlite-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@agent-memory/openai-sqlite-demo",
"private": true,
"type": "module",
"scripts": {
"dev": "node server.mjs"
},
"dependencies": {
"agent-memory": "workspace:*"
}
}
Loading
Loading