Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

grepai-storage-postgresgrepai storage Postgres 搜索

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

7,938

周安装

341

GitHub Stars

16

下载量

2,783
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:grepai-storage-postgres(grepai storage Postgres 搜索)
来源仓库:https://github.com/yoanbernabeu/grepai-skills
仓库路径:skills/grepai-storage-postgres
安装命令:
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-storage-postgres
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

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

简介

用于辅助数据库表结构、查询语句和迁移脚本任务。

  • 它适合分析 schema、编写 SQL 或排查查询问题,支持索引优化建议。
  • 使用时需明确数据库类型和连接环境,区分只读分析与写入操作。
  • 安装命令:npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-storage-postgres。
  • 涉及删除或更新时,应优先 dry-run 或备份,避免误操作风险。

SKILL.md

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 failedSolution: Check DSN credentials and pg_hba.conf

Problem: ERROR: extension "vector" is not availableSolution: Install pgvector:

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

Problem: ERROR: type "vector" does not existSolution: 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

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.69%
按下载量换算965

Claude

29.55%
按下载量换算822

Cursor

20.64%
按下载量换算574

Gemini CLI

9.76%
按下载量换算272

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills