MCPInstall

grepai-storage-postgres

Configure PostgreSQL with pgvector for GrepAI. Use this skill for team environments and large codebases.

Installs
553
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-storage-postgres
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads grepai-storage-postgres automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

GrepAI Storage with PostgreSQL

This skill covers using PostgreSQL with the pgvector extension as the storage backend for GrepAI.

When to Use This Skill

  • Team environments with shared index
  • Large codebases (10K+ files)
  • Need concurrent access
  • Integration with existing PostgreSQL infrastructure

Prerequisites

  1. PostgreSQL 14+ with pgvector extension
  2. Database user with create table permissions
  3. Network access to PostgreSQL server

Advantages

BenefitDescription
👥 Team sharingMultiple users can access same index
📏 ScalableHandles large codebases
🔄 ConcurrentMultiple simultaneous searches
💾 PersistentData survives machine restarts
🔧 FamiliarStandard database tooling

Setting Up PostgreSQL with pgvector

Option 1: Docker (Recommended for Development)

# 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

Option 2: Install on Existing PostgreSQL

# 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

Then enable the extension:

-- Connect to your database
CREATE EXTENSION IF NOT EXISTS vector;

Option 3: Managed Services

  • Supabase: pgvector included by default
  • Neon: pgvector available
  • AWS RDS: Install pgvector extension
  • Azure Database: pgvector available

Configuration

Basic Configuration

# .grepai/config.yaml
store:
  backend: postgres
  postgres:
    dsn: postgres://user:password@localhost:5432/grepai

With Environment Variable

store:
  backend: postgres
  postgres:
    dsn: ${DATABASE_URL}

Set the environment variable:

export DATABASE_URL="postgres://user:password@localhost:5432/grepai"

Full DSN Options

store:
  backend: postgres
  postgres:
    dsn: postgres://user:password@host:5432/database?sslmode=require

DSN components:

  • user: Database username
  • password: Database password
  • host: Server hostname or IP
  • 5432: Port (default: 5432)
  • database: Database name
  • sslmode: SSL mode (disable, require, verify-full)

SSL Modes

ModeDescriptionUse Case
disableNo SSLLocal development
requireSSL requiredProduction
verify-fullSSL + verify certificateHigh security
# Production with SSL
store:
  backend: postgres
  postgres:
    dsn: postgres://user:pass@prod.db.com:5432/grepai?sslmode=require

Database Schema

GrepAI automatically creates these tables:

-- 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);

Verifying Setup

Check pgvector Extension

-- 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

Test Connection from GrepAI

# Check status
grepai status

# Should show PostgreSQL backend info

Performance Tuning

PostgreSQL Configuration

For better vector search performance:

-- Increase work memory for vector operations
SET work_mem = '256MB';

-- Adjust for your hardware
SET effective_cache_size = '4GB';
SET shared_buffers = '1GB';

Index Tuning

For large indices, tune the IVFFlat index:

-- More lists = faster search, more memory
CREATE INDEX ON embeddings
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);  -- Adjust based on row count

Rule of thumb: lists = sqrt(rows)

Concurrent Access

PostgreSQL handles concurrent access automatically:

  • Multiple grepai search commands work simultaneously
  • One grepai watch daemon per codebase
  • Many users can share the same index

Team Setup

Shared Database

All team members point to the same database:

# Each developer's .grepai/config.yaml
store:
  backend: postgres
  postgres:
    dsn: postgres://team:secret@shared-db.company.com:5432/grepai

Per-Project Databases

For isolated projects, use separate databases:

# 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_projecta

Backup and Restore

Backup

pg_dump -U grepai -d grepai > grepai_backup.sql

Restore

psql -U grepai -d grepai < grepai_backup.sql

Migrating from GOB

  1. Set up PostgreSQL with pgvector
  2. Update configuration:
store:
  backend: postgres
  postgres:
    dsn: postgres://user:pass@localhost:5432/grepai
  1. Delete old index:
rm .grepai/index.gob
  1. Re-index:
grepai watch

Common Issues

❌ Problem: FATAL: password authentication failed ✅ Solution: Check DSN credentials and pg_hba.conf

❌ Problem: ERROR: extension "vector" is not available ✅ Solution: Install pgvector:

sudo apt install postgresql-16-pgvector
# Then: CREATE EXTENSION vector;

❌ Problem: ERROR: type "vector" does not exist ✅ Solution: Enable extension in the database:

CREATE EXTENSION IF NOT EXISTS vector;

❌ Problem: Connection refused ✅ Solution:

  • Check PostgreSQL is running
  • Verify host and port
  • Check firewall rules

❌ Problem: Slow searches ✅ Solution:

  • Add IVFFlat index
  • Increase work_mem
  • Vacuum and analyze tables

Best Practices

  1. Use environment variables: Don't commit credentials
  2. Enable SSL: For remote databases
  3. Regular backups: pg_dump before major changes
  4. Monitor performance: Check query times
  5. Index maintenance: Regular VACUUM ANALYZE

Output Format

PostgreSQL storage status:

✅ 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

FAQ

What does the grepai-storage-postgres skill do?

Configure PostgreSQL with pgvector for GrepAI. Use this skill for team environments and large codebases.

How do I install grepai-storage-postgres?

Run npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-storage-postgres in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/grepai-storage-postgres/ (personal) or .claude/skills/grepai-storage-postgres/ (project).

Which AI agents can use grepai-storage-postgres?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is grepai-storage-postgres safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains grepai-storage-postgres?

It is published by yoanbernabeu in yoanbernabeu/grepai-skills. It has 553 recorded installs.

More from yoanbernabeu/grepai-skills

View all →

grepai-search-basics

yoanbernabeu/grepai-skills

Basic semantic code search with GrepAI. Use this skill to learn fundamental search commands and concepts.

grepai-search-advanced

yoanbernabeu/grepai-skills

Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.

AI & Agents828 installs

grepai-trace-graph

yoanbernabeu/grepai-skills

Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.

805 installs

grepai-ollama-setup

yoanbernabeu/grepai-skills

Install and configure Ollama for local embeddings with GrepAI. Use this skill when setting up private, local embedding generation.

AI & Agents799 installs

grepai-trace-callers

yoanbernabeu/grepai-skills

Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.

787 installs

grepai-search-tips

yoanbernabeu/grepai-skills

Tips and best practices for effective GrepAI searches. Use this skill to improve search result quality.

Popular data & databases skills

View category →

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

OfficialData & Databases462.2K installs

prisma-client-api

prisma/skills

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

OfficialData & Databases393.5K installs

Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.

OfficialData & Databases392.3K installs

prisma-cli

prisma/skills

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

OfficialData & Databases390.8K installs

prisma-postgres

prisma/skills

Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.

OfficialData & Databases384.4K installs

Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.

OfficialData & Databases378.9K installs