@poprobertdaniel/openclaw-memory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +410 -0
  3. package/dist/chunk-CRPEAZ44.cjs +1881 -0
  4. package/dist/chunk-CRPEAZ44.cjs.map +1 -0
  5. package/dist/chunk-JNWCMHOB.js +309 -0
  6. package/dist/chunk-JNWCMHOB.js.map +1 -0
  7. package/dist/chunk-JSQBXYDM.js +1881 -0
  8. package/dist/chunk-JSQBXYDM.js.map +1 -0
  9. package/dist/chunk-NHFPLDZK.js +236 -0
  10. package/dist/chunk-NHFPLDZK.js.map +1 -0
  11. package/dist/chunk-NMUPGLJW.cjs +752 -0
  12. package/dist/chunk-NMUPGLJW.cjs.map +1 -0
  13. package/dist/chunk-RFLG2CCR.js +752 -0
  14. package/dist/chunk-RFLG2CCR.js.map +1 -0
  15. package/dist/chunk-VXULEX3A.cjs +236 -0
  16. package/dist/chunk-VXULEX3A.cjs.map +1 -0
  17. package/dist/chunk-ZY2C2CJQ.cjs +309 -0
  18. package/dist/chunk-ZY2C2CJQ.cjs.map +1 -0
  19. package/dist/cli/index.cjs +764 -0
  20. package/dist/cli/index.cjs.map +1 -0
  21. package/dist/cli/index.d.cts +1 -0
  22. package/dist/cli/index.d.ts +1 -0
  23. package/dist/cli/index.js +764 -0
  24. package/dist/cli/index.js.map +1 -0
  25. package/dist/index.cjs +48 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +790 -0
  28. package/dist/index.d.ts +790 -0
  29. package/dist/index.js +48 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/memory-service-6WDMF6KX.cjs +9 -0
  32. package/dist/memory-service-6WDMF6KX.cjs.map +1 -0
  33. package/dist/memory-service-GKEG6J2D.js +9 -0
  34. package/dist/memory-service-GKEG6J2D.js.map +1 -0
  35. package/dist/server-BTbRv-yX.d.cts +1199 -0
  36. package/dist/server-BTbRv-yX.d.ts +1199 -0
  37. package/dist/server.cjs +9 -0
  38. package/dist/server.cjs.map +1 -0
  39. package/dist/server.d.cts +2 -0
  40. package/dist/server.d.ts +2 -0
  41. package/dist/server.js +9 -0
  42. package/dist/server.js.map +1 -0
  43. package/docker/full.yml +45 -0
  44. package/docker/standard.yml +26 -0
  45. package/package.json +109 -0
  46. package/skill/SKILL.md +139 -0
  47. package/templates/.env.example +42 -0
  48. package/templates/docker-compose.full.yml +45 -0
  49. package/templates/docker-compose.standard.yml +26 -0
  50. package/templates/openclaw-memory.config.ts +49 -0
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkNMUPGLJWcjs = require('./chunk-NMUPGLJW.cjs');
4
+ require('./chunk-CRPEAZ44.cjs');
5
+ require('./chunk-ZY2C2CJQ.cjs');
6
+
7
+
8
+ exports.createServer = _chunkNMUPGLJWcjs.createServer;
9
+ //# sourceMappingURL=server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/robertpop/work/personal/openclaw-memory/dist/server.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,sDAAC","file":"/Users/robertpop/work/personal/openclaw-memory/dist/server.cjs"}
@@ -0,0 +1,2 @@
1
+ import 'elysia';
2
+ export { y as createServer } from './server-BTbRv-yX.cjs';
@@ -0,0 +1,2 @@
1
+ import 'elysia';
2
+ export { y as createServer } from './server-BTbRv-yX.js';
package/dist/server.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-RFLG2CCR.js";
4
+ import "./chunk-JSQBXYDM.js";
5
+ import "./chunk-JNWCMHOB.js";
6
+ export {
7
+ createServer
8
+ };
9
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,45 @@
1
+ # openclaw-memory — Full tier infrastructure
2
+ # SQLite (local) + Qdrant (Docker) + PostgreSQL/AGE (Docker)
3
+ #
4
+ # Usage:
5
+ # docker compose -f full.yml up -d
6
+
7
+ services:
8
+ qdrant:
9
+ image: qdrant/qdrant:v1.12.0
10
+ container_name: openclaw-memory-qdrant
11
+ ports:
12
+ - "6333:6333"
13
+ - "6334:6334"
14
+ volumes:
15
+ - qdrant_data:/qdrant/storage
16
+ environment:
17
+ QDRANT__SERVICE__GRPC_PORT: 6334
18
+ restart: unless-stopped
19
+ healthcheck:
20
+ test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
21
+ interval: 10s
22
+ timeout: 5s
23
+ retries: 5
24
+
25
+ postgres-age:
26
+ image: apache/age:PG16-v1.5.0
27
+ container_name: openclaw-memory-age
28
+ ports:
29
+ - "5432:5432"
30
+ environment:
31
+ POSTGRES_USER: openclaw
32
+ POSTGRES_PASSWORD: openclaw-memory
33
+ POSTGRES_DB: agent_memory
34
+ volumes:
35
+ - postgres_data:/var/lib/postgresql/data
36
+ restart: unless-stopped
37
+ healthcheck:
38
+ test: ["CMD-SHELL", "pg_isready -U openclaw"]
39
+ interval: 10s
40
+ timeout: 5s
41
+ retries: 5
42
+
43
+ volumes:
44
+ qdrant_data:
45
+ postgres_data:
@@ -0,0 +1,26 @@
1
+ # openclaw-memory — Standard tier infrastructure
2
+ # SQLite (local) + Qdrant (Docker)
3
+ #
4
+ # Usage:
5
+ # docker compose -f standard.yml up -d
6
+
7
+ services:
8
+ qdrant:
9
+ image: qdrant/qdrant:v1.12.0
10
+ container_name: openclaw-memory-qdrant
11
+ ports:
12
+ - "6333:6333"
13
+ - "6334:6334"
14
+ volumes:
15
+ - qdrant_data:/qdrant/storage
16
+ environment:
17
+ QDRANT__SERVICE__GRPC_PORT: 6334
18
+ restart: unless-stopped
19
+ healthcheck:
20
+ test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
21
+ interval: 10s
22
+ timeout: 5s
23
+ retries: 5
24
+
25
+ volumes:
26
+ qdrant_data:
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@poprobertdaniel/openclaw-memory",
3
+ "version": "0.1.0",
4
+ "description": "Triple-layer memory system for AI agents — SQLite + Qdrant + Postgres/AGE",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "./server": {
21
+ "import": {
22
+ "types": "./dist/server.d.ts",
23
+ "default": "./dist/server.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/server.d.cts",
27
+ "default": "./dist/server.cjs"
28
+ }
29
+ }
30
+ },
31
+ "bin": {
32
+ "openclaw-memory": "./dist/cli/index.js"
33
+ },
34
+ "files": [
35
+ "dist/",
36
+ "templates/",
37
+ "docker/",
38
+ "skill/",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "dev": "bun --watch run src/server.ts",
45
+ "start": "bun run src/server.ts",
46
+ "test": "echo 'No tests yet'",
47
+ "typecheck": "tsc --noEmit",
48
+ "prepublishOnly": "npm run build"
49
+ },
50
+ "keywords": [
51
+ "ai",
52
+ "memory",
53
+ "agents",
54
+ "sqlite",
55
+ "qdrant",
56
+ "graph",
57
+ "knowledge-graph",
58
+ "semantic-search",
59
+ "vector-database",
60
+ "openclaw",
61
+ "llm",
62
+ "rag",
63
+ "apache-age",
64
+ "triple-layer"
65
+ ],
66
+ "license": "MIT",
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "https://github.com/openclaw/openclaw-memory"
70
+ },
71
+ "homepage": "https://github.com/openclaw/openclaw-memory#readme",
72
+ "bugs": {
73
+ "url": "https://github.com/openclaw/openclaw-memory/issues"
74
+ },
75
+ "engines": {
76
+ "node": ">=20.0.0"
77
+ },
78
+ "dependencies": {
79
+ "@elysiajs/cors": "^1.2.0",
80
+ "commander": "^13.0.0",
81
+ "elysia": "^1.2.0",
82
+ "openai": "^4.80.0",
83
+ "picocolors": "^1.1.0",
84
+ "uuid": "^11.1.0"
85
+ },
86
+ "optionalDependencies": {
87
+ "better-sqlite3": "^11.0.0"
88
+ },
89
+ "peerDependencies": {
90
+ "@qdrant/js-client-rest": ">=1.0.0",
91
+ "pg": "^8.13.0"
92
+ },
93
+ "peerDependenciesMeta": {
94
+ "@qdrant/js-client-rest": {
95
+ "optional": true
96
+ },
97
+ "pg": {
98
+ "optional": true
99
+ }
100
+ },
101
+ "devDependencies": {
102
+ "@types/better-sqlite3": "^7.6.0",
103
+ "@types/node": "^22.0.0",
104
+ "@types/pg": "^8.11.0",
105
+ "@types/uuid": "^10.0.0",
106
+ "tsup": "^8.0.0",
107
+ "typescript": "^5.7.0"
108
+ }
109
+ }
package/skill/SKILL.md ADDED
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: memory
3
+ version: 0.1.0
4
+ description: Persistent triple-layer memory — store, search, and connect knowledge across sessions
5
+ author: openclaw
6
+ license: MIT
7
+ tags: [memory, knowledge-graph, vector-search, persistence]
8
+ tier: core
9
+ ---
10
+
11
+ # Memory Skill
12
+
13
+ Give your agent persistent memory that survives across sessions. Store facts, search by meaning, and traverse entity relationships.
14
+
15
+ ## What This Skill Does
16
+
17
+ When installed, your agent gains the ability to:
18
+
19
+ - **Remember** facts, decisions, conversations, and context
20
+ - **Search** memories by keyword (FTS) or meaning (semantic vectors)
21
+ - **Connect** entities — people, projects, teams, decisions — in a knowledge graph
22
+ - **Recall** memories by time, tags, agent, or metadata filters
23
+ - **Forget** specific memories when asked
24
+
25
+ ## How Agents Should Use It
26
+
27
+ ### Storing Memories
28
+
29
+ Store important information as it comes up in conversation. Don't store everything — store what matters: decisions, facts about people, project context, preferences, and lessons learned.
30
+
31
+ **Good memories to store:**
32
+ - "The user prefers dark mode and Vim keybindings"
33
+ - "Decided to use PostgreSQL instead of MongoDB for the user service"
34
+ - "Alice Chen is the VP of Engineering, reports to CEO David Park"
35
+ - "The deploy pipeline takes ~12 minutes and requires 2 approvals"
36
+
37
+ **Don't store:**
38
+ - Routine greetings or small talk
39
+ - Information already in files the agent can read
40
+ - Temporary context that won't matter tomorrow
41
+
42
+ ### Searching Memories
43
+
44
+ Before answering questions about people, projects, or past decisions, search memory first. This prevents the agent from asking the user to repeat themselves.
45
+
46
+ ### Graph Traversal
47
+
48
+ When the user asks relationship questions ("who reports to Alice?", "what projects is the platform team working on?"), use graph queries instead of text search.
49
+
50
+ ## Quick Start
51
+
52
+ The memory service is available at `http://localhost:7777`. Check health:
53
+
54
+ ```bash
55
+ curl http://localhost:7777/api/health
56
+ ```
57
+
58
+ ## Storing Memories
59
+
60
+ ```bash
61
+ curl -X POST http://localhost:7777/api/memories \
62
+ -H "Content-Type: application/json" \
63
+ -H "Authorization: Bearer $MEMORY_TOKEN" \
64
+ -d '{
65
+ "agent_id": "YOUR_AGENT_ID",
66
+ "scope": "user",
67
+ "subject_id": "USER_ID",
68
+ "content": "The fact or preference to remember",
69
+ "tags": ["optional", "tags"]
70
+ }'
71
+ ```
72
+
73
+ ### Scopes
74
+ - `user` — About a specific person (requires subject_id)
75
+ - `agent` — Agent's private knowledge
76
+ - `global` — Shared across all agents
77
+ - `project` — About a specific project (subject_id = project slug)
78
+ - `session` — Conversation summaries
79
+
80
+ ## Searching Memories
81
+
82
+ ```bash
83
+ curl -X POST http://localhost:7777/api/search \
84
+ -H "Content-Type: application/json" \
85
+ -H "Authorization: Bearer $MEMORY_TOKEN" \
86
+ -d '{
87
+ "agent_id": "YOUR_AGENT_ID",
88
+ "query": "natural language question",
89
+ "limit": 5
90
+ }'
91
+ ```
92
+
93
+ The search auto-selects the best strategy:
94
+ - **Semantic** for broad/exploratory queries
95
+ - **Fulltext** for specific keyword lookups
96
+ - **Graph** for relationship queries
97
+
98
+ ## When to Use
99
+
100
+ - **Store** when the user tells you something important about themselves
101
+ - **Store** decisions, preferences, project details
102
+ - **Search** at the start of each session for relevant context
103
+ - **Search** when the user asks "do you remember..."
104
+ - **Summarize** conversations at session end
105
+
106
+ ## Example Conversations
107
+
108
+ ### Building Memory Over Time
109
+
110
+ ```
111
+ User: We just hired Sarah Kim as the new DevOps lead. She'll report to Alice.
112
+
113
+ Agent: Got it — I'll remember that.
114
+ [stores: "Sarah Kim hired as DevOps lead, reports to Alice Chen"]
115
+ [graph: Sarah Kim (Person, DevOps Lead) -[REPORTS_TO]-> Alice Chen]
116
+
117
+ User: (3 days later) Who's on Alice's team now?
118
+
119
+ Agent: [graph query: related entities for Alice Chen]
120
+ Based on what I know, Alice Chen's direct reports include:
121
+ • Bob Smith (Team Lead)
122
+ • Sarah Kim (DevOps Lead, joined recently)
123
+ ```
124
+
125
+ ### Semantic Recall
126
+
127
+ ```
128
+ User: What did we decide about the message queue situation?
129
+
130
+ Agent: [search: "message queue decision"]
131
+ Found a relevant memory from January 15th:
132
+ "Decided to switch from Kafka to NATS for the event bus.
133
+ Reasons: simpler ops, lower latency for our workload."
134
+ ```
135
+
136
+ ## Environment
137
+
138
+ - `MEMORY_URL` — Service URL (default: http://localhost:7777)
139
+ - `MEMORY_TOKEN` — Auth token
@@ -0,0 +1,42 @@
1
+ # ── openclaw-memory environment variables ────────────────────────────────
2
+
3
+ # Server
4
+ # OPENCLAW_MEMORY_PORT=7777
5
+ # OPENCLAW_MEMORY_HOST=0.0.0.0
6
+ # OPENCLAW_MEMORY_TIER=lite
7
+
8
+ # Authentication
9
+ MEMORY_AUTH_TOKEN=change-me-to-a-secure-token
10
+
11
+ # SQLite (all tiers)
12
+ # SQLITE_PATH=~/.openclaw-memory/memory.sqlite
13
+
14
+ # ── Standard tier ────────────────────────────────────────────────────────
15
+
16
+ # Qdrant
17
+ # QDRANT_URL=http://localhost:6333
18
+ # QDRANT_COLLECTION=openclaw_memories
19
+
20
+ # Embedding provider (any OpenAI-compatible API)
21
+ # OPENAI_API_KEY=sk-your-key-here
22
+ # EMBEDDING_MODEL=text-embedding-3-small
23
+ # EMBEDDING_BASE_URL=https://api.openai.com/v1
24
+
25
+ # Or use OpenRouter
26
+ # OPENROUTER_API_KEY=sk-or-v1-your-key
27
+ # EMBEDDING_BASE_URL=https://openrouter.ai/api/v1
28
+ # EMBEDDING_MODEL=openai/text-embedding-3-small
29
+
30
+ # Entity extraction LLM
31
+ # EXTRACTION_MODEL=gpt-4o-mini
32
+ # EXTRACTION_BASE_URL=https://api.openai.com/v1
33
+
34
+ # ── Full tier ────────────────────────────────────────────────────────────
35
+
36
+ # PostgreSQL + Apache AGE
37
+ # PGHOST=localhost
38
+ # PGPORT=5432
39
+ # PGUSER=openclaw
40
+ # PGPASSWORD=your-password
41
+ # PGDATABASE=agent_memory
42
+ # AGE_GRAPH=agent_memory
@@ -0,0 +1,45 @@
1
+ # openclaw-memory — Full tier infrastructure
2
+ # SQLite (local) + Qdrant (Docker) + PostgreSQL/AGE (Docker)
3
+ #
4
+ # Usage:
5
+ # docker compose -f full.yml up -d
6
+
7
+ services:
8
+ qdrant:
9
+ image: qdrant/qdrant:v1.12.0
10
+ container_name: openclaw-memory-qdrant
11
+ ports:
12
+ - "6333:6333"
13
+ - "6334:6334"
14
+ volumes:
15
+ - qdrant_data:/qdrant/storage
16
+ environment:
17
+ QDRANT__SERVICE__GRPC_PORT: 6334
18
+ restart: unless-stopped
19
+ healthcheck:
20
+ test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
21
+ interval: 10s
22
+ timeout: 5s
23
+ retries: 5
24
+
25
+ postgres-age:
26
+ image: apache/age:PG16-v1.5.0
27
+ container_name: openclaw-memory-age
28
+ ports:
29
+ - "5432:5432"
30
+ environment:
31
+ POSTGRES_USER: openclaw
32
+ POSTGRES_PASSWORD: openclaw-memory
33
+ POSTGRES_DB: agent_memory
34
+ volumes:
35
+ - postgres_data:/var/lib/postgresql/data
36
+ restart: unless-stopped
37
+ healthcheck:
38
+ test: ["CMD-SHELL", "pg_isready -U openclaw"]
39
+ interval: 10s
40
+ timeout: 5s
41
+ retries: 5
42
+
43
+ volumes:
44
+ qdrant_data:
45
+ postgres_data:
@@ -0,0 +1,26 @@
1
+ # openclaw-memory — Standard tier infrastructure
2
+ # SQLite (local) + Qdrant (Docker)
3
+ #
4
+ # Usage:
5
+ # docker compose -f standard.yml up -d
6
+
7
+ services:
8
+ qdrant:
9
+ image: qdrant/qdrant:v1.12.0
10
+ container_name: openclaw-memory-qdrant
11
+ ports:
12
+ - "6333:6333"
13
+ - "6334:6334"
14
+ volumes:
15
+ - qdrant_data:/qdrant/storage
16
+ environment:
17
+ QDRANT__SERVICE__GRPC_PORT: 6334
18
+ restart: unless-stopped
19
+ healthcheck:
20
+ test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
21
+ interval: 10s
22
+ timeout: 5s
23
+ retries: 5
24
+
25
+ volumes:
26
+ qdrant_data:
@@ -0,0 +1,49 @@
1
+ import { defineConfig } from 'openclaw-memory';
2
+
3
+ export default defineConfig({
4
+ // Tier: 'lite' (SQLite only), 'standard' (+Qdrant), 'full' (+Qdrant+AGE)
5
+ tier: 'lite',
6
+
7
+ // HTTP server
8
+ port: 7777,
9
+ host: '0.0.0.0',
10
+
11
+ // Authentication
12
+ auth: {
13
+ token: process.env.MEMORY_AUTH_TOKEN || 'change-me',
14
+ enabled: true,
15
+ },
16
+
17
+ // SQLite — always required (all tiers)
18
+ sqlite: {
19
+ path: '~/.openclaw-memory/memory.sqlite',
20
+ },
21
+
22
+ // ── Uncomment for Standard tier ─────────────────────────────────────
23
+
24
+ // qdrant: {
25
+ // url: 'http://localhost:6333',
26
+ // collection: 'openclaw_memories',
27
+ // },
28
+ // embedding: {
29
+ // apiKey: process.env.OPENAI_API_KEY || '',
30
+ // model: 'text-embedding-3-small',
31
+ // dimensions: 1536,
32
+ // },
33
+ // extraction: {
34
+ // apiKey: process.env.OPENAI_API_KEY || '',
35
+ // model: 'gpt-4o-mini',
36
+ // enabled: true,
37
+ // },
38
+
39
+ // ── Uncomment for Full tier ─────────────────────────────────────────
40
+
41
+ // age: {
42
+ // host: 'localhost',
43
+ // port: 5432,
44
+ // user: 'openclaw',
45
+ // password: process.env.PGPASSWORD || '',
46
+ // database: 'agent_memory',
47
+ // graph: 'agent_memory',
48
+ // },
49
+ });