Skip to content

feat: add PostgreSQL memory store backend with pgvector + pg_textsearch#224

Open
Dontpushme wants to merge 4 commits into
TencentCloud:mainfrom
Dontpushme:main
Open

feat: add PostgreSQL memory store backend with pgvector + pg_textsearch#224
Dontpushme wants to merge 4 commits into
TencentCloud:mainfrom
Dontpushme:main

Conversation

@Dontpushme

Copy link
Copy Markdown
  • Add PgMemoryStore implementing IMemoryStore interface
  • Support L0/L1 CRUD, vector search, BM25 full-text search, hybrid RRF
  • Add pgvector (HNSW/IVFFlat/DiskANN) and vectorscale StreamingDiskANN
  • Add pg_textsearch BM25 index with configurable text configuration
  • Add SQLite-to-PostgreSQL migration CLI tool
  • Extend config.ts, factory.ts, manifest.ts for postgres backend
  • Add openclaw.plugin.json schema for postgres config
  • Add integration tests (opt-in via TDAI_POSTGRES_TEST=1)
  • Update README.md and README_CN.md with PostgreSQL usage docs

Description | 描述

Related Issue | 关联 Issue

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Additional Notes | 其他说明

- Add PgMemoryStore implementing IMemoryStore interface
- Support L0/L1 CRUD, vector search, BM25 full-text search, hybrid RRF
- Add pgvector (HNSW/IVFFlat/DiskANN) and vectorscale StreamingDiskANN
- Add pg_textsearch BM25 index with configurable text configuration
- Add SQLite-to-PostgreSQL migration CLI tool
- Extend config.ts, factory.ts, manifest.ts for postgres backend
- Add openclaw.plugin.json schema for postgres config
- Add integration tests (opt-in via TDAI_POSTGRES_TEST=1)
- Update README.md and README_CN.md with PostgreSQL usage docs
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thanks for your attention! We will review and comment as soon as possible!

andrelin and others added 3 commits June 17, 2026 11:25
- Add memory-tencentdb skill directory with SKILL.md, HTTP client, and gateway launcher
- Add install-codebuddy-skill.sh with interactive and CLI modes
- Add pack.sh to bundle skill + T-A-M Gateway into distributable zip
- Add memory-client.mjs: zero-dependency Gateway HTTP client
- Add gateway-up.sh: idempotent Gateway auto-start
- Add config postgres subcommand to ctl.sh for PG + pgvector backend
- Support PG text-config option for Chinese tokenization (simple/jieba)
…e options

- First interactive step now asks for storage backend: SQLite / PostgreSQL / Skip
- SQLite works out-of-the-box with zero external dependencies
- PostgreSQL path adds Chinese tokenization config (simple/jieba)
- Rewrite config writing to handle both backends
- Sync standalone install script with same flow
…rch failures

When using Ollama as the embedding provider (e.g. bge-m3), the model is
unloaded from memory after 5 minutes of inactivity (Ollama default).
Subsequent embedding requests trigger a cold-start that takes 10-15s to
reload the model from disk. Since both the Gateway embedding layer and
the memory-client had a 10s timeout, search-memories and
search-conversations would consistently fail with 'request timed out'
after any idle period.

Root cause chain:
  memory-client.mjs (10s timeout)
    -> Gateway /search/memories
      -> embeddingService.embed() (10s timeout)
        -> Ollama /v1/embeddings (bge-m3)
          -> model cold-start ~13.7s  => AbortError

Changes:
- src/core/store/embedding.ts: raise DEFAULT_API_TIMEOUT_MS from 10s to
  30s so the Gateway does not abort embedding requests during cold-starts
- codebuddy-plugin/.../memory-client.mjs: raise DEFAULT_TIMEOUT_MS from
  10s to 30s for search commands; raise RECALL_TIMEOUT_MS from 3s to 5s
  (recall still degrades gracefully on timeout)
- codebuddy-plugin/.../gateway-up.sh: add warmup_embedding() that fires
  an async background request to Ollama /api/embed with keep_alive=30m
  on every gateway-up, pre-loading the model before the first real
  search and extending the model residence from 5m to 30m

Before fix: search-memories/search-conversations timeout every time
  after 5+ minutes of idle (~100% failure rate)
After fix: first search completes in <0.5s when warmed up; even without
  warmup, cold-start completes within the new 30s ceiling instead of
  being killed at 10s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants