grepai-storage-postgres
Configure PostgreSQL with pgvector for GrepAI. Use this skill for team environments and large codebases.
What this skill does
# 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
| 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)
```bash
# 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
```bash
# 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:
```sql
-- 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
```yaml
# .grepai/config.yaml
store:
backend: postgres
postgres:
dsn: postgres://user:password@localhost:5432/grepai
```
### With Environment Variable
```yaml
store:
backend: postgres
postgres:
dsn: ${DATABASE_URL}
```
Set the environment variable:
```bash
export DATABASE_URL="postgres://user:password@localhost:5432/grepai"
```
### Full DSN Options
```yaml
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
| Mode | Description | Use Case |
|------|-------------|----------|
| `disable` | No SSL | Local development |
| `require` | SSL required | Production |
| `verify-full` | SSL + verify certificate | High security |
```yaml
# Production with SSL
store:
backend: postgres
postgres:
dsn: postgres://user:[email protected]:5432/grepai?sslmode=require
```
## Database Schema
GrepAI automatically creates these tables:
```sql
-- 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
```sql
-- 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
```bash
# Check status
grepai status
# Should show PostgreSQL backend info
```
## Performance Tuning
### PostgreSQL Configuration
For better vector search performance:
```sql
-- 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:
```sql
-- 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:
```yaml
# Each developer's .grepai/config.yaml
store:
backend: postgres
postgres:
dsn: postgres://team:[email protected]:5432/grepai
```
### Per-Project Databases
For isolated projects, use separate databases:
```bash
# Create databases
createdb -U postgres grepai_projecta
createdb -U postgres grepai_projectb
```
```yaml
# Project A config
store:
backend: postgres
postgres:
dsn: postgres://user:pass@localhost:5432/grepai_projecta
```
## Backup and Restore
### Backup
```bash
pg_dump -U grepai -d grepai > grepai_backup.sql
```
### Restore
```bash
psql -U grepai -d grepai < grepai_backup.sql
```
## Migrating from GOB
1. Set up PostgreSQL with pgvector
2. Update configuration:
```yaml
store:
backend: postgres
postgres:
dsn: postgres://user:pass@localhost:5432/grepai
```
3. Delete old index:
```bash
rm .grepai/index.gob
```
4. Re-index:
```bash
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:
```bash
sudo apt install postgresql-16-pgvector
# Then: CREATE EXTENSION vector;
```
โ **Problem:** `ERROR: type "vector" does not exist`
โ
**Solution:** Enable extension in the database:
```sql
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
```
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only โ no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.