grepai-storage-postgres▌
yoanbernabeu/grepai-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
This skill covers using PostgreSQL with the pgvector extension as the storage backend for GrepAI.
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
- PostgreSQL 14+ with pgvector extension
- Database user with create table permissions
- Network access to PostgreSQL server
Advantages
| 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 |
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 usernamepassword: Database passwordhost: Server hostname or IP5432: Port (default: 5432)database: Database namesslmode: SSL mode (disable, require, verify-full)
SSL Modes
| Mode | Description | Use Case |
|---|---|---|
disable |
No SSL | Local development |
require |
SSL required | Production |
verify-full |
SSL + verify certificate | High security |
# Production with SSL
store:
backend: postgres
postgres:
dsn: postgres://user:[email protected]: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 searchcommands work simultaneously - One
grepai watchdaemon 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
- Set up PostgreSQL with pgvector
- Update configuration:
store:
backend: postgres
postgres:
dsn: postgres://user:pass@localhost:5432/grepai
- Delete old index:
rm .grepai/index.gob
- 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
- Use environment variables: Don't commit credentials
- Enable SSL: For remote databases
- Regular backups: pg_dump before major changes
- Monitor performance: Check query times
- 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
How to use grepai-storage-postgres on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add grepai-storage-postgres
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches grepai-storage-postgres from GitHub repository yoanbernabeu/grepai-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate grepai-storage-postgres. Access the skill through slash commands (e.g., /grepai-storage-postgres) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★63 reviews- ★★★★★Liam Chawla· Dec 20, 2024
Registry listing for grepai-storage-postgres matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kabir Choi· Dec 16, 2024
Keeps context tight: grepai-storage-postgres is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Yuki Liu· Nov 27, 2024
Keeps context tight: grepai-storage-postgres is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Kwame Sethi· Nov 19, 2024
grepai-storage-postgres fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Zaid Brown· Nov 15, 2024
grepai-storage-postgres is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Yusuf Chawla· Nov 11, 2024
grepai-storage-postgres reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Ishan Farah· Nov 7, 2024
I recommend grepai-storage-postgres for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Zaid Smith· Nov 7, 2024
grepai-storage-postgres is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Kabir Srinivasan· Oct 26, 2024
grepai-storage-postgres reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Ishan Torres· Oct 26, 2024
grepai-storage-postgres fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 63