[Bug] memos-local-plugin 2.0: chunks table never created — causes viewer dashboard data drift and auto-recall injection failure
Pre-submission checklist
Bug Description
Summary
In memos-local-plugin v2.0.x, the chunks table is never created by any of the 12 schema migrations. This causes the MemOS Viewer dashboard (port 18799) to display data correctly for a brief moment after gateway restart, then drift to empty/zero as soon as a message is processed. Auto-recall injection also fails to retrieve relevant context.
Symptoms
- Viewer dashboard data drift: After
openclaw gateway restart, the dashboard at http://127.0.0.1:18799 shows correct data momentarily. Within 10-20 seconds — or immediately upon sending a message to the agent — all data disappears and shows empty/zero.
- Auto-recall returns empty or irrelevant results: Cross-session memory recall fails. Manual vector search via Ollama bge-m3 works correctly (relevant results found in top-K), but the plugin's auto-recall pipeline does not inject them.
embedding_retry_queue fills up: 72 failed retry entries referencing a corrupted local ONNX model (separate issue, see below).
Key Finding
The chunks table — which the Viewer dashboard and retrieval pipeline depend on — does not exist in the 2.0 database. Examination of all 12 SQL migration files reveals that none of them contain a CREATE TABLE chunks statement.
This is a regression from 1.0 (memos-local-openclaw-plugin), where chunks is properly created via CREATE TABLE IF NOT EXISTS chunks in sqlite.ts.
How to Reproduce
- Install
@memtensor/memos-local-plugin v2.0.10 on OpenClaw (tested on v7.1)
- Configure embedding provider as
openai_compatible (Ollama bge-m3) in config.yaml
- Start the gateway:
openclaw gateway start
- Open
http://127.0.0.1:18799 → Dashboard shows data normally ✅
- Send any message to the agent → Dashboard data immediately drifts to empty ❌
- Verify:
sqlite3 ~/.openclaw/memos-plugin/data/memos.db ".tables" → no chunks table
Environment
- OpenClaw: v7.1 (stable release)
- memos-local-plugin: v2.0.10 (npm latest)
- OS: macOS 15 (Darwin 24.6.0, ARM64)
- Node.js: v25.8.1
- Embedding: Ollama bge-m3 (1024-dim) via OpenAI-compatible endpoint
- LLM: GLM-5.2 via third-party provider
Investigation Details
We conducted a thorough 5-round investigation (on a clone of the production environment) to isolate the root cause:
Round 1: Database schema audit
Inspected the 2.0 database (~/.openclaw/memos-plugin/data/memos.db):
Tables that exist (9 with data):
| Table |
Rows |
traces |
64,958 |
episodes |
35,142 |
sessions |
1,194 |
skills |
481 |
api_logs |
1,454 |
schema_migrations |
12 |
embedding_retry_queue |
72 |
kv, audit_events, feedback, etc. |
0 |
Tables that are MISSING:
| Table |
Impact |
chunks |
Dashboard cannot display memory content |
embeddings |
No vector data for viewer |
tasks |
— |
skill_embeddings |
— |
task_embeddings |
— |
Round 2: Migration history
All 12 migrations execute at startup:
001-initial.sql
002-embedding-retry-queue.sql
003-embedding-retry-lease.sql
004-skill-usage.sql
005-skill-trials.sql
006-world-model-version.sql
007-namespace-visibility.sql
008-feedback-experience-metadata.sql
009-policies-fts.sql
010-trace-policy-links.sql
011-hub-sharing.sql
012-trace-turn-pagination-index.sql
None of these migrations create a chunks table. The 001-initial.sql creates 13 tables: schema_migrations, sessions, episodes, traces, policies, l2_candidate_pool, world_model, skills, feedback, decision_repairs, audit_events, api_logs, kv.
Round 3: ONNX model corruption (independent issue)
Found that the local ONNX model (Xenova/all-MiniLM-L6-v2) was corrupted (8.1 MB instead of ~22 MB, Protobuf parsing failed). We deleted and re-downloaded the correct model. After restart:
- ✅ ONNX model healthy (22 MB)
- ✅ No new entries in
embedding_retry_queue
- ❌
chunks table still doesn't exist
- ❌ Dashboard drift not fixed
Conclusion: ONNX corruption and missing chunks table are two independent problems.
Round 4: Configuration analysis
Config (config.yaml) specifies:
embedding:
provider: openai_compatible
endpoint: http://192.168.3.7:11434/v1
model: bge-m3
However, the plugin still attempts to load the local ONNX model first, despite openai_compatible being configured. The Ollama endpoint works perfectly (verified independently). This suggests the embedding provider selection logic may have a fallback issue.
Round 5: Code-level evidence on current main branch
We verified the latest code on main (as of 2026-07-20):
- 1.0 plugin (
apps/memos-local-openclaw/src/storage/sqlite.ts): Contains CREATE TABLE IF NOT EXISTS chunks ✅
- 2.0 plugin (
apps/memos-local-plugin/core/storage/migrations/001-initial.sql): Does NOT contain CREATE TABLE chunks ❌
- 2.0 plugin (
server/routes/migrate.ts): Comments reference "The schema (chunks/skills/tasks) is the same across both" — indicating chunks was expected to exist in 2.0 as well
Comparison: 1.0 vs 2.0 database
| Aspect |
1.0 (memos-local-openclaw) |
2.0 (memos-local-plugin) |
chunks table |
✅ Created (42K+ rows in production) |
❌ Never created |
embeddings table |
✅ Created |
❌ Missing |
traces table |
— |
✅ 64K+ rows |
| Architecture |
Single chunks table |
Split into traces/episodes/sessions |
Root Cause Analysis
The 2.0 plugin underwent an architecture change — the flat chunks table from 1.0 was split into a normalized traces → episodes → sessions hierarchy. However:
- The Viewer dashboard and retrieval pipeline still contain code paths that query the
chunks table
- No migration creates
chunks in the 2.0 schema
- The
migrate.ts route (for importing 1.0 data) explicitly references the chunks table schema in comments
This results in:
- Startup: Dashboard reads from in-memory cache or
traces pre-load → appears normal
- Message received: Triggers a refresh/re-query targeting
chunks → table doesn't exist → empty result → dashboard drifts to zero
Suggested Fix Direction
Option A: Add a migration to create the chunks table (if it's still needed by viewer/retrieval code paths)
Option B: Update all code paths that reference chunks to use the new traces/episodes/sessions schema instead
Additional Context
Related issues
Production impact
This bug makes memos 2.0 unusable in production — the viewer is non-functional and auto-recall doesn't work. We are forced to stay on 1.0 (memos-local-openclaw-plugin v1.0.10) until this is resolved.
We have detailed investigation reports (including full database dumps, schema comparisons, and step-by-step reproduction) available if the team needs them.
Willingness to Implement
[Bug] memos-local-plugin 2.0:
chunkstable never created — causes viewer dashboard data drift and auto-recall injection failurePre-submission checklist
Bug Description
Summary
In
memos-local-pluginv2.0.x, thechunkstable is never created by any of the 12 schema migrations. This causes the MemOS Viewer dashboard (port 18799) to display data correctly for a brief moment after gateway restart, then drift to empty/zero as soon as a message is processed. Auto-recall injection also fails to retrieve relevant context.Symptoms
openclaw gateway restart, the dashboard athttp://127.0.0.1:18799shows correct data momentarily. Within 10-20 seconds — or immediately upon sending a message to the agent — all data disappears and shows empty/zero.embedding_retry_queuefills up: 72 failed retry entries referencing a corrupted local ONNX model (separate issue, see below).Key Finding
The
chunkstable — which the Viewer dashboard and retrieval pipeline depend on — does not exist in the 2.0 database. Examination of all 12 SQL migration files reveals that none of them contain aCREATE TABLE chunksstatement.This is a regression from 1.0 (
memos-local-openclaw-plugin), wherechunksis properly created viaCREATE TABLE IF NOT EXISTS chunksinsqlite.ts.How to Reproduce
@memtensor/memos-local-pluginv2.0.10 on OpenClaw (tested on v7.1)openai_compatible(Ollama bge-m3) inconfig.yamlopenclaw gateway starthttp://127.0.0.1:18799→ Dashboard shows data normally ✅sqlite3 ~/.openclaw/memos-plugin/data/memos.db ".tables"→ nochunkstableEnvironment
Investigation Details
We conducted a thorough 5-round investigation (on a clone of the production environment) to isolate the root cause:
Round 1: Database schema audit
Inspected the 2.0 database (
~/.openclaw/memos-plugin/data/memos.db):Tables that exist (9 with data):
tracesepisodessessionsskillsapi_logsschema_migrationsembedding_retry_queuekv,audit_events,feedback, etc.Tables that are MISSING:
chunksembeddingstasksskill_embeddingstask_embeddingsRound 2: Migration history
All 12 migrations execute at startup:
None of these migrations create a
chunkstable. The001-initial.sqlcreates 13 tables:schema_migrations,sessions,episodes,traces,policies,l2_candidate_pool,world_model,skills,feedback,decision_repairs,audit_events,api_logs,kv.Round 3: ONNX model corruption (independent issue)
Found that the local ONNX model (
Xenova/all-MiniLM-L6-v2) was corrupted (8.1 MB instead of ~22 MB, Protobuf parsing failed). We deleted and re-downloaded the correct model. After restart:embedding_retry_queuechunkstable still doesn't existConclusion: ONNX corruption and missing
chunkstable are two independent problems.Round 4: Configuration analysis
Config (
config.yaml) specifies:However, the plugin still attempts to load the local ONNX model first, despite
openai_compatiblebeing configured. The Ollama endpoint works perfectly (verified independently). This suggests the embedding provider selection logic may have a fallback issue.Round 5: Code-level evidence on current
mainbranchWe verified the latest code on
main(as of 2026-07-20):apps/memos-local-openclaw/src/storage/sqlite.ts): ContainsCREATE TABLE IF NOT EXISTS chunks✅apps/memos-local-plugin/core/storage/migrations/001-initial.sql): Does NOT containCREATE TABLE chunks❌server/routes/migrate.ts): Comments reference"The schema (chunks/skills/tasks) is the same across both"— indicatingchunkswas expected to exist in 2.0 as wellComparison: 1.0 vs 2.0 database
memos-local-openclaw)memos-local-plugin)chunkstableembeddingstabletracestablechunkstabletraces/episodes/sessionsRoot Cause Analysis
The 2.0 plugin underwent an architecture change — the flat
chunkstable from 1.0 was split into a normalizedtraces→episodes→sessionshierarchy. However:chunkstablechunksin the 2.0 schemamigrate.tsroute (for importing 1.0 data) explicitly references thechunkstable schema in commentsThis results in:
tracespre-load → appears normalchunks→ table doesn't exist → empty result → dashboard drifts to zeroSuggested Fix Direction
Option A: Add a migration to create the
chunkstable (if it's still needed by viewer/retrieval code paths)Option B: Update all code paths that reference
chunksto use the newtraces/episodes/sessionsschema insteadAdditional Context
Related issues
chunkstable bloat (65K records in 1 week) — confirmschunksis a known problem areaProduction impact
This bug makes memos 2.0 unusable in production — the viewer is non-functional and auto-recall doesn't work. We are forced to stay on 1.0 (
memos-local-openclaw-pluginv1.0.10) until this is resolved.We have detailed investigation reports (including full database dumps, schema comparisons, and step-by-step reproduction) available if the team needs them.
Willingness to Implement