@romiluz/clawmongo 2026.3.22 → 2026.3.24

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026.3.22",
3
- "commit": "c5216fd93b01ba7c1fc71ebb457943a3b01f1030",
4
- "builtAt": "2026-03-21T22:31:09.354Z"
2
+ "version": "2026.3.24",
3
+ "commit": "c0da01d073349d5536336d54965c562cb09ca034",
4
+ "builtAt": "2026-03-22T09:54:41.559Z"
5
5
  }
@@ -1 +1 @@
1
- 856ec64ed868b65801dc2f33c1f301b111dccdea3ccae019c7a67c7a42a81e23
1
+ 5bb97da39c969f15f4f6c2e635463a7bd72ab48619e302f1632b2a3a4682ab4d
@@ -0,0 +1,213 @@
1
+ # ClawMongo Onboarding Flow Design
2
+
3
+ ## Overview
4
+
5
+ ClawMongo's onboarding must verify MongoDB infrastructure before proceeding to channel setup. This is a design document for future implementation -- no code changes are expected from this document.
6
+
7
+ The current OpenClaw onboarding flow (`clawmongo onboard --install-daemon`) goes directly from model provider selection to gateway setup. It does not verify MongoDB connectivity, mongot availability, or Voyage AI configuration. ClawMongo needs these checks to prevent users from completing onboarding with a broken memory backend.
8
+
9
+ ---
10
+
11
+ ## Current State
12
+
13
+ The existing onboarding flow (implemented across 34 files in `src/commands/onboard*.ts`):
14
+
15
+ 1. Select model provider (Anthropic, OpenAI, Google, etc.)
16
+ 2. Enter API key
17
+ 3. Configure gateway (port 18789, loopback bind)
18
+ 4. Install daemon (launchd/systemd)
19
+ 5. Open Control UI
20
+
21
+ **What is missing:**
22
+
23
+ - MongoDB connection verification (is MongoDB reachable?)
24
+ - Replica set verification (are change streams available?)
25
+ - MongoDB version check (>= 7.0 for mongot compatibility?)
26
+ - mongot verification (is Search Index Management available?)
27
+ - Voyage AI configuration check (can mongot generate embeddings?)
28
+ - Collection and index bootstrap verification (were all 20 collections created?)
29
+ - Memory write/read cycle test (does the full pipeline work end-to-end?)
30
+
31
+ ---
32
+
33
+ ## Proposed Flow
34
+
35
+ ### Step 1: MongoDB Connection
36
+
37
+ **Goal:** Verify the MongoDB URI is valid and the server is reachable.
38
+
39
+ - Prompt for MongoDB URI (or detect from environment variable `MONGODB_URI` / existing config)
40
+ - Test connection with `db.admin().command({ ping: 1 })`
41
+ - Verify replica set membership (required for change streams)
42
+ - If single node: suggest `--replSet rs0` startup flag
43
+ - If standalone: warn that change streams will be unavailable (ClawMongo falls back to periodic sync)
44
+ - Check MongoDB version via `db.admin().command({ buildInfo: 1 })`
45
+ - Minimum: 7.0 (for mongot compatibility)
46
+ - Recommended: 8.0+ (for `$rankFusion`)
47
+ - Optimal: 8.2+ (for `$scoreFusion`)
48
+
49
+ **Error handling:**
50
+ - Connection refused: print connection troubleshooting steps
51
+ - Auth failure: prompt for credentials
52
+ - Version too old: warn and suggest upgrade path
53
+
54
+ ### Step 2: mongot Verification
55
+
56
+ **Goal:** Verify that MongoDB Search (mongot) is available for text and vector indexing.
57
+
58
+ - Attempt `collection.listSearchIndexes()` on a probe collection
59
+ - If successful: mongot is available, proceed
60
+ - If failed with "Search Index Management service" error: mongot not available
61
+ - Print setup instructions for the user's deployment type (Docker, local, Atlas)
62
+ - Allow proceeding without mongot (degraded mode: BSON `$text` indexes only, no vector search)
63
+
64
+ **Error handling:**
65
+ - mongot not running: provide platform-specific startup instructions
66
+ - Atlas without Search enabled: link to Atlas Search documentation
67
+
68
+ ### Step 3: Voyage AI Configuration
69
+
70
+ **Goal:** Verify that Voyage AI embeddings work through mongot.
71
+
72
+ - If mongot is available: attempt to create a test vector search index with `autoEmbed`
73
+ - Verify the index reaches `READY` state (not `FAILED` or `PENDING`)
74
+ - If the index fails due to Voyage AI credentials: prompt for Voyage AI API key
75
+ - Set `memory.mongodb.embeddingMode = "automated"` in config
76
+
77
+ **Error handling:**
78
+ - Missing Voyage AI key: prompt for key, provide signup link (voyageai.com)
79
+ - Invalid key: display error, prompt for re-entry
80
+ - Rate limit: suggest waiting and retrying
81
+
82
+ ### Step 4: Collection Bootstrap
83
+
84
+ **Goal:** Create all required collections and indexes.
85
+
86
+ - Run `ensureCollections(db, prefix)` to create all 20 collections with JSON Schema validation
87
+ - Run `ensureStandardIndexes(db, prefix)` to create all 53 standard indexes
88
+ - If mongot available: run `ensureSearchIndexes(db, prefix, ...)` to create up to 8 search indexes
89
+ - Verify counts:
90
+ - 20 collections created
91
+ - 53 standard indexes created
92
+ - Search indexes created (if mongot available)
93
+
94
+ **Display to user:**
95
+ - Collection count created
96
+ - Index count created
97
+ - Search index status (created / skipped due to no mongot)
98
+ - Any schema validation warnings
99
+
100
+ **Error handling:**
101
+ - Permission denied: suggest database role requirements
102
+ - Index creation failure: log specific index and suggest manual creation
103
+
104
+ ### Step 5: LLM Provider (Existing Flow)
105
+
106
+ **Goal:** Configure the LLM that powers the agent's reasoning.
107
+
108
+ This step is unchanged from the current onboarding flow:
109
+
110
+ - Select model provider (Anthropic, OpenAI, Google, Mistral, etc.)
111
+ - Enter API key
112
+ - Test model connection with a simple prompt
113
+ - Save to config
114
+
115
+ ### Step 6: Channel Setup (Existing Flow)
116
+
117
+ **Goal:** Connect the agent to a messaging channel.
118
+
119
+ This step is unchanged from the current onboarding flow:
120
+
121
+ - Suggest Telegram as the quickest channel
122
+ - Walk through channel-specific credential setup
123
+ - Test channel connection
124
+ - Save to config
125
+
126
+ ### Step 7: Health Check
127
+
128
+ **Goal:** Verify the complete system works end-to-end.
129
+
130
+ - Run `clawmongo doctor` with MongoDB-specific checks:
131
+ - MongoDB connectivity (ping)
132
+ - Replica set status
133
+ - Collection count (expected: 20)
134
+ - Index count (expected: 53+)
135
+ - mongot availability
136
+ - Voyage AI embedding generation (if mongot available)
137
+ - Run a memory write + read cycle:
138
+ - Write a test event via `writeEvent()`
139
+ - Read it back via `getEventsByTimeRange()`
140
+ - Verify the event was projected to a chunk
141
+ - Clean up test data
142
+ - Show status summary:
143
+ - MongoDB: connected / version / replica set status
144
+ - mongot: available / unavailable
145
+ - Voyage AI: working / not configured
146
+ - Collections: N/20 created
147
+ - Indexes: N/53 created
148
+ - Memory write/read: passed / failed
149
+ - LLM: connected / model name
150
+ - Channel: connected / channel name (if configured)
151
+
152
+ ---
153
+
154
+ ## Error Handling Summary
155
+
156
+ | Failure | Recovery | Blocking? |
157
+ |---------|----------|-----------|
158
+ | MongoDB unreachable | Print connection troubleshooting, retry prompt | Yes |
159
+ | Replica set not configured | Warn, suggest `--replSet`, allow proceeding (degraded) | No |
160
+ | MongoDB version < 7.0 | Warn, suggest upgrade | No |
161
+ | mongot not available | Warn, allow proceeding without vector search | No |
162
+ | Voyage AI key missing/invalid | Prompt for key, retry | No (proceed without autoEmbed) |
163
+ | Collection creation failed | Log error, suggest permissions fix | Yes |
164
+ | Index creation failed | Log specific index, continue with others | No |
165
+ | LLM connection failed | Retry prompt, allow different provider | Yes |
166
+ | Channel setup failed | Skip, allow setup later | No |
167
+ | Memory write/read failed | Log error, suggest troubleshooting | Yes |
168
+
169
+ ---
170
+
171
+ ## Implementation Notes
172
+
173
+ ### Files to Modify
174
+
175
+ - `src/commands/onboard-interactive.ts` -- add MongoDB steps before LLM provider selection
176
+ - `src/commands/onboard-config.ts` -- add MongoDB URI and embeddingMode to config generation
177
+ - `src/commands/onboard-helpers.ts` -- add MongoDB connection test, mongot probe, and collection bootstrap helpers
178
+
179
+ ### New Functions Needed
180
+
181
+ - `testMongoDBConnection(uri: string)` -- ping + version + replica set check
182
+ - `testMongotAvailability(db: Db)` -- listSearchIndexes probe
183
+ - `testVoyageAIConfiguration(db: Db, prefix: string)` -- create + verify test vector index
184
+ - `bootstrapCollections(db: Db, prefix: string)` -- ensureCollections + ensureStandardIndexes + report
185
+ - `verifyMemoryWriteReadCycle(db: Db, prefix: string, agentId: string)` -- write event, read back, verify projection
186
+
187
+ ### Non-Interactive Mode
188
+
189
+ The `--non-interactive` mode should accept MongoDB configuration via environment variables or config file:
190
+
191
+ - `MONGODB_URI` or `memory.mongodb.uri` in config
192
+ - `MONGODB_EMBEDDING_MODE` or `memory.mongodb.embeddingMode` in config
193
+ - Skip interactive prompts, run all verification steps, exit non-zero on any blocking failure
194
+
195
+ ### Estimated Implementation Effort
196
+
197
+ - **Step 1 (MongoDB connection)**: Small. Mostly wrapping existing `MongoClient.connect()` with user-friendly error messages.
198
+ - **Step 2 (mongot verification)**: Small. `listSearchIndexes()` probe already exists in `detectCapabilities()`.
199
+ - **Step 3 (Voyage AI check)**: Medium. Need to create and verify a test search index, then clean it up.
200
+ - **Step 4 (Collection bootstrap)**: Small. `ensureCollections()` and `ensureStandardIndexes()` already exist.
201
+ - **Step 5-6 (LLM + Channel)**: None. Existing flow unchanged.
202
+ - **Step 7 (Health check)**: Medium. Need to wire existing doctor checks + new memory write/read cycle.
203
+
204
+ Total: approximately 300-500 lines of new code across 3 files, plus test coverage.
205
+
206
+ ---
207
+
208
+ ## Open Questions (for Implementation Phase)
209
+
210
+ 1. Should the onboarding flow support creating a MongoDB replica set automatically for Docker users?
211
+ 2. Should the Voyage AI key be stored in ClawMongo config (accessible to the application) or only in mongot config (inaccessible to the application)?
212
+ 3. Should the onboarding flow support Atlas auto-detection (detect Atlas URI format and skip local mongot checks)?
213
+ 4. What should the timeout be for mongot search index creation verification? Atlas indexes can take 1-5 minutes to reach READY state.