Loading...
Loading...
Configure PostgreSQL with pgvector for GrepAI. Use this skill for team environments and large codebases.
npx skill4agent add yoanbernabeu/grepai-skills grepai-storage-postgres| Benefit | Description |
|---|---|
| 👥 Team sharing | Multiple users can access same index |
| 📏 Scalable | Handles large codebases |
| 🔄 Concurrent | Multiple simultaneous searches |
| 💾 Persistent | Data survives machine restarts |
| 🔧 Familiar | Standard database tooling |
# Run PostgreSQL with pgvector
docker run -d \
--name grepai-postgres \
-e POSTGRES_USER=grepai \
-e POSTGRES_PASSWORD=grepai \
-e POSTGRES_DB=grepai \
-p 5432:5432 \
pgvector/pgvector:pg16# Install pgvector extension (Ubuntu/Debian)
sudo apt install postgresql-16-pgvector
# Or compile from source
git clone https://github.com/pgvector/pgvector.git
cd pgvector
make
sudo make install-- Connect to your database
CREATE EXTENSION IF NOT EXISTS vector;# .grepai/config.yaml
store:
backend: postgres
postgres:
dsn: postgres://user:password@localhost:5432/grepaistore:
backend: postgres
postgres:
dsn: ${DATABASE_URL}export DATABASE_URL="postgres://user:password@localhost:5432/grepai"store:
backend: postgres
postgres:
dsn: postgres://user:password@host:5432/database?sslmode=requireuserpasswordhost5432databasesslmode| Mode | Description | Use Case |
|---|---|---|
| No SSL | Local development |
| SSL required | Production |
| SSL + verify certificate | High security |
# Production with SSL
store:
backend: postgres
postgres:
dsn: postgres://user:pass@prod.db.com:5432/grepai?sslmode=require-- Vector embeddings table
CREATE TABLE IF NOT EXISTS embeddings (
id SERIAL PRIMARY KEY,
file_path TEXT NOT NULL,
chunk_index INTEGER NOT NULL,
content TEXT NOT NULL,
start_line INTEGER,
end_line INTEGER,
embedding vector(768), -- Dimension matches your model
created_at TIMESTAMP DEFAULT NOW(),
UNIQUE(file_path, chunk_index)
);
-- Index for vector similarity search
CREATE INDEX ON embeddings USING ivfflat (embedding vector_cosine_ops);-- Connect to database
psql -U grepai -d grepai
-- Check extension is installed
SELECT * FROM pg_extension WHERE extname = 'vector';
-- Check GrepAI tables exist (after first grepai watch)
\dt# Check status
grepai status
# Should show PostgreSQL backend info-- Increase work memory for vector operations
SET work_mem = '256MB';
-- Adjust for your hardware
SET effective_cache_size = '4GB';
SET shared_buffers = '1GB';-- More lists = faster search, more memory
CREATE INDEX ON embeddings
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100); -- Adjust based on row countlists = sqrt(rows)grepai searchgrepai watch# Each developer's .grepai/config.yaml
store:
backend: postgres
postgres:
dsn: postgres://team:secret@shared-db.company.com:5432/grepai# Create databases
createdb -U postgres grepai_projecta
createdb -U postgres grepai_projectb# Project A config
store:
backend: postgres
postgres:
dsn: postgres://user:pass@localhost:5432/grepai_projectapg_dump -U grepai -d grepai > grepai_backup.sqlpsql -U grepai -d grepai < grepai_backup.sqlstore:
backend: postgres
postgres:
dsn: postgres://user:pass@localhost:5432/grepairm .grepai/index.gobgrepai watchFATAL: password authentication failedERROR: extension "vector" is not availablesudo apt install postgresql-16-pgvector
# Then: CREATE EXTENSION vector;ERROR: type "vector" does not existCREATE EXTENSION IF NOT EXISTS vector;work_mem✅ PostgreSQL Storage Configured
Backend: PostgreSQL + pgvector
Host: localhost:5432
Database: grepai
SSL: disabled
Contents:
- Files: 2,450
- Chunks: 12,340
- Vector dimension: 768
Performance:
- Connection: OK
- IVFFlat index: Yes
- Search latency: ~50ms