|
| 1 | +# Hybrid Setup Guide (Central + Project Instances) |
| 2 | + |
| 3 | +This setup gives you: |
| 4 | +- One central memory instance for user-level facts/preferences. |
| 5 | +- One isolated memory instance per project for project context. |
| 6 | + |
| 7 | +## Topology |
| 8 | + |
| 9 | +```bash |
| 10 | +~/memory-core/ # central instance on 8787 (preferences, identity, facts) |
| 11 | +project-a/ # project-specific instance on 8788 (project scopes only) |
| 12 | +project-b/ # project-specific instance on 8789 (project scopes only) |
| 13 | +``` |
| 14 | + |
| 15 | +## 1) Start the central memory instance |
| 16 | + |
| 17 | +From this repository: |
| 18 | + |
| 19 | +```bash |
| 20 | +npm run dev:central |
| 21 | +``` |
| 22 | + |
| 23 | +Central defaults: |
| 24 | +- `OPENCLAW_PORT=8787` |
| 25 | +- `OPENCLAW_RUNTIME_DIR=~/memory-core/runtime` |
| 26 | +- `OPENCLAW_ALLOWED_SCOPE_PREFIXES=preferences,identity,facts` |
| 27 | + |
| 28 | +## 2) Start project instances |
| 29 | + |
| 30 | +From this repository: |
| 31 | + |
| 32 | +```bash |
| 33 | +npm run dev:project-a |
| 34 | +npm run dev:project-b |
| 35 | +``` |
| 36 | + |
| 37 | +Project defaults: |
| 38 | +- `project-a` runs on `8788` with runtime at `./runtime/project-a` |
| 39 | +- `project-b` runs on `8789` with runtime at `./runtime/project-b` |
| 40 | +- Both enforce project-only scopes via: |
| 41 | + - `OPENCLAW_DEFAULT_SCOPE=project` |
| 42 | + - `OPENCLAW_ALLOWED_SCOPE_PREFIXES=project,<project-name>` |
| 43 | + |
| 44 | +### Docker alternative |
| 45 | + |
| 46 | +```bash |
| 47 | +docker compose -f docker-compose.hybrid.yml up -d |
| 48 | +``` |
| 49 | + |
| 50 | +## 3) Verify each instance |
| 51 | + |
| 52 | +```bash |
| 53 | +curl http://localhost:8787/health |
| 54 | +curl http://localhost:8788/health |
| 55 | +curl http://localhost:8789/health |
| 56 | +``` |
| 57 | + |
| 58 | +Each health response includes: |
| 59 | +- `instance_name` |
| 60 | +- `default_scope` |
| 61 | +- `allowed_scope_prefixes` |
| 62 | + |
| 63 | +## 4) MCP configuration per project |
| 64 | + |
| 65 | +Build once first: |
| 66 | + |
| 67 | +```bash |
| 68 | +npm run build |
| 69 | +``` |
| 70 | + |
| 71 | +### Central MCP server |
| 72 | + |
| 73 | +```json |
| 74 | +{ |
| 75 | + "mcpServers": { |
| 76 | + "memorycore-central": { |
| 77 | + "command": "node", |
| 78 | + "args": ["dist/src/mcp.js"], |
| 79 | + "cwd": "/path/to/Project-AI-MemoryCore", |
| 80 | + "env": { |
| 81 | + "OPENCLAW_INSTANCE": "central", |
| 82 | + "OPENCLAW_RUNTIME_DIR": "/home/you/memory-core/runtime", |
| 83 | + "OPENCLAW_DB_PATH": "/home/you/memory-core/runtime/openclaw.db", |
| 84 | + "OPENCLAW_DEFAULT_SCOPE": "preferences", |
| 85 | + "OPENCLAW_ALLOWED_SCOPE_PREFIXES": "preferences,identity,facts" |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +### Project A MCP server |
| 93 | + |
| 94 | +```json |
| 95 | +{ |
| 96 | + "mcpServers": { |
| 97 | + "memorycore-project-a": { |
| 98 | + "command": "node", |
| 99 | + "args": ["dist/src/mcp.js"], |
| 100 | + "cwd": "/path/to/Project-AI-MemoryCore", |
| 101 | + "env": { |
| 102 | + "OPENCLAW_INSTANCE": "project-a", |
| 103 | + "OPENCLAW_RUNTIME_DIR": "/path/to/project-a/.memorycore", |
| 104 | + "OPENCLAW_DB_PATH": "/path/to/project-a/.memorycore/openclaw.db", |
| 105 | + "OPENCLAW_DEFAULT_SCOPE": "project", |
| 106 | + "OPENCLAW_ALLOWED_SCOPE_PREFIXES": "project,project-a" |
| 107 | + } |
| 108 | + } |
| 109 | + } |
| 110 | +} |
| 111 | +``` |
| 112 | + |
| 113 | +### Project B MCP server |
| 114 | + |
| 115 | +```json |
| 116 | +{ |
| 117 | + "mcpServers": { |
| 118 | + "memorycore-project-b": { |
| 119 | + "command": "node", |
| 120 | + "args": ["dist/src/mcp.js"], |
| 121 | + "cwd": "/path/to/Project-AI-MemoryCore", |
| 122 | + "env": { |
| 123 | + "OPENCLAW_INSTANCE": "project-b", |
| 124 | + "OPENCLAW_RUNTIME_DIR": "/path/to/project-b/.memorycore", |
| 125 | + "OPENCLAW_DB_PATH": "/path/to/project-b/.memorycore/openclaw.db", |
| 126 | + "OPENCLAW_DEFAULT_SCOPE": "project", |
| 127 | + "OPENCLAW_ALLOWED_SCOPE_PREFIXES": "project,project-b" |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +## Migration Strategy |
| 135 | + |
| 136 | +1. Start central memory first and store user preferences/facts there. |
| 137 | +2. Add project-specific instances and keep project context in those DBs only. |
| 138 | +3. In each project workspace, point MCP to that project instance config. |
| 139 | +4. Keep central MCP available for cross-project personal memory. |
0 commit comments