@contextableai/openclaw-memory-graphiti 0.1.1 → 0.1.2

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @openclaw/memory-graphiti
1
+ # @contextableai/openclaw-memory-graphiti
2
2
 
3
3
  Two-layer memory plugin for OpenClaw: **SpiceDB** for authorization, **Graphiti** for knowledge graph storage.
4
4
 
@@ -30,7 +30,21 @@ Agents remember conversations as structured entities and facts in a knowledge gr
30
30
 
31
31
  **SpiceDB** determines which `group_id`s a subject (agent or person) can access, then **Graphiti** searches or stores memories scoped to those groups.
32
32
 
33
- ## Quick Start
33
+ ## Installation
34
+
35
+ ```bash
36
+ openclaw plugins install @contextableai/openclaw-memory-graphiti
37
+ ```
38
+
39
+ Or with npm:
40
+
41
+ ```bash
42
+ npm install @contextableai/openclaw-memory-graphiti
43
+ ```
44
+
45
+ Then restart the gateway. On first start, the plugin automatically:
46
+ - Writes the SpiceDB authorization schema (if not already present)
47
+ - Creates group membership for the configured agent in the default group
34
48
 
35
49
  ### Prerequisites
36
50
 
@@ -43,45 +57,26 @@ Agents remember conversations as structured entities and facts in a knowledge gr
43
57
  cd docker
44
58
  cp .env.example .env
45
59
  # Edit .env — set OPENAI_API_KEY at minimum
46
- docker compose up -d falkordb graphiti-mcp spicedb
60
+ docker compose up -d
47
61
  ```
48
62
 
49
63
  This starts:
50
64
  - **FalkorDB** on port 6379 (graph database, web UI on port 3000)
51
65
  - **Graphiti MCP Server** on port 8000 (knowledge graph API)
66
+ - **PostgreSQL** on port 5432 (persistent datastore for SpiceDB)
52
67
  - **SpiceDB** on port 50051 (authorization engine)
53
68
 
54
- ### 2. Configure the Plugin
55
-
56
- Add to your OpenClaw plugin configuration:
57
-
58
- ```json
59
- {
60
- "spicedb": {
61
- "endpoint": "localhost:50051",
62
- "token": "dev_token",
63
- "insecure": true
64
- },
65
- "graphiti": {
66
- "endpoint": "http://localhost:8000",
67
- "defaultGroupId": "main"
68
- },
69
- "subjectId": "my-agent"
70
- }
71
- ```
72
-
73
- ### 3. Initialize SpiceDB Schema
69
+ ### 2. Restart the Gateway
74
70
 
75
71
  ```bash
76
- openclaw graphiti-mem schema-write
72
+ openclaw gateway restart
77
73
  ```
78
74
 
79
- ### 4. Add Group Membership
75
+ The plugin auto-initializes on startup — no manual `schema-write` or `add-member` needed for basic use. The SpiceDB schema is written automatically on first run, and the configured `subjectId` is added to the `defaultGroupId`.
80
76
 
81
- ```bash
82
- # Add the agent to a group
83
- openclaw graphiti-mem add-member main my-agent --type agent
77
+ ### 3. (Optional) Add More Group Members
84
78
 
79
+ ```bash
85
80
  # Add people to groups
86
81
  openclaw graphiti-mem add-member family mom --type person
87
82
  openclaw graphiti-mem add-member family dad --type person
@@ -271,16 +266,16 @@ The `docker/` directory contains a full-stack Docker Compose configuration:
271
266
  | `spicedb` | 50051, 8443, 9090 | Authorization engine (gRPC, HTTP, metrics) |
272
267
  | `openclaw-gateway` | 18789, 18790 | OpenClaw gateway (optional) |
273
268
 
274
- ### Infrastructure Only
269
+ ### Infrastructure (default)
275
270
 
276
271
  ```bash
277
- docker compose up -d falkordb graphiti-mcp postgres spicedb-migrate spicedb
272
+ docker compose up -d
278
273
  ```
279
274
 
280
- ### Full Stack (Gateway + Infrastructure)
275
+ ### With OpenClaw Gateway
281
276
 
282
277
  ```bash
283
- docker compose up -d
278
+ docker compose --profile gateway up -d
284
279
  ```
285
280
 
286
281
  When running inside Docker Compose, use service hostnames in the plugin config:
@@ -1,24 +1,26 @@
1
- # Full-stack: OpenClaw gateway + memory-graphiti infrastructure
2
- #
3
- # All services share the same Docker network, so the gateway plugin
4
- # reaches Graphiti and SpiceDB by service hostname — no localhost hacks.
1
+ # memory-graphiti infrastructure: FalkorDB + Graphiti MCP + PostgreSQL + SpiceDB
5
2
  #
6
3
  # Usage:
7
- # cp .env.example .env # Fill in OPENAI_API_KEY and other vars
8
- # docker compose up -d # Start everything
4
+ # cp .env.example .env # Fill in OPENAI_API_KEY at minimum
5
+ # docker compose up -d # Start infrastructure
9
6
  # docker compose logs -f # Watch startup
10
7
  #
11
- # The gateway will be available at http://localhost:18789
12
- # FalkorDB web UI at http://localhost:3000
8
+ # Infrastructure services are available at:
9
+ # FalkorDB: localhost:6379 (Redis protocol), localhost:3000 (web UI)
10
+ # Graphiti MCP: http://localhost:8000
11
+ # SpiceDB gRPC: localhost:50051
12
+ # SpiceDB HTTP: localhost:8443
13
+ # PostgreSQL: localhost:5432
13
14
  #
14
- # To run without the gateway (infra only, for dev/testing):
15
- # docker compose up -d falkordb graphiti-mcp spicedb
15
+ # To also run the OpenClaw gateway (optional):
16
+ # docker compose --profile gateway up -d
16
17
 
17
18
  services:
18
19
  # --------------------------------------------------------------------------
19
- # OpenClaw Gateway
20
+ # OpenClaw Gateway (opt-in via --profile gateway)
20
21
  # --------------------------------------------------------------------------
21
22
  openclaw-gateway:
23
+ profiles: [gateway]
22
24
  image: ${OPENCLAW_IMAGE:-openclaw:local}
23
25
  environment:
24
26
  HOME: /home/node
@@ -27,8 +29,6 @@ services:
27
29
  CLAUDE_AI_SESSION_KEY: ${CLAUDE_AI_SESSION_KEY:-}
28
30
  CLAUDE_WEB_SESSION_KEY: ${CLAUDE_WEB_SESSION_KEY:-}
29
31
  CLAUDE_WEB_COOKIE: ${CLAUDE_WEB_COOKIE:-}
30
- # Memory-graphiti plugin will read these from the plugin config,
31
- # but we also pass them as env vars for ${...} interpolation in config
32
32
  OPENAI_API_KEY: ${OPENAI_API_KEY}
33
33
  SPICEDB_TOKEN: ${SPICEDB_TOKEN:-dev_token}
34
34
  volumes:
package/index.ts CHANGED
@@ -909,8 +909,17 @@ const memoryGraphitiPlugin = {
909
909
  const graphitiOk = await graphiti.healthCheck();
910
910
  let spicedbOk = false;
911
911
  try {
912
- await spicedb.readSchema();
912
+ const existing = await spicedb.readSchema();
913
913
  spicedbOk = true;
914
+
915
+ // Auto-write schema if SpiceDB has no schema yet
916
+ if (!existing || !existing.includes("memory_group")) {
917
+ api.logger.info("memory-graphiti: writing SpiceDB schema (first run)");
918
+ const schemaPath = join(dirname(fileURLToPath(import.meta.url)), "schema.zed");
919
+ const schema = readFileSync(schemaPath, "utf-8");
920
+ await spicedb.writeSchema(schema);
921
+ api.logger.info("memory-graphiti: SpiceDB schema written successfully");
922
+ }
914
923
  } catch {
915
924
  // Will be retried on first use
916
925
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextableai/openclaw-memory-graphiti",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "OpenClaw two-layer memory plugin: SpiceDB authorization + Graphiti knowledge graph",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,6 +46,11 @@
46
46
  "openclaw": {
47
47
  "extensions": [
48
48
  "./index.ts"
49
- ]
49
+ ],
50
+ "install": {
51
+ "npmSpec": "@contextableai/openclaw-memory-graphiti",
52
+ "localPath": "extensions/memory-graphiti",
53
+ "defaultChoice": "npm"
54
+ }
50
55
  }
51
56
  }