Grepai Storage Gob

yoanbernabeu/grepai-skills/skills/storage/grepai-storage-gob

作者 yoanbernabeu382d40261c0d41109c6e11872574ba0be9b064d0無授權條款收錄於 2026年10月9日更新於 2026年10月9日

Configure GOB local file storage for GrepAI. Use this skill for simple, single-machine setups.

AI 產生的概覽

說明如何設定 GrepAI 的 GOB 本機檔案儲存後端,涵蓋設定、操作、限制與移轉。

功能
此技能說明如何將 GOB(Go 原生的二進位序列化格式)用作 GrepAI 的儲存後端。內容涵蓋設定 YAML、儲存位置與檔案結構、索引建立、狀態查詢、備份、清除與搬移索引,以及索引大小、記憶體用量與搜尋速度的預期。也說明使用限制、.gitignore 建議、移轉至 PostgreSQL 或 Qdrant 的步驟,以及常見問題排解。
適用情境
適用於簡單的單機 GrepAI 情境,例如單人開發專案、中小型程式碼庫、本機開發環境,或不想引入外部儲存服務時。也適合在因索引體積、並行存取或共享需求而考慮是否從 GOB 移轉時參考。
執行需求
需要 GrepAI 命令列工具(grepai init、grepai watch、grepai status),以及可建立 .grepai 目錄的專案目錄。不含指令碼,僅為說明文件。移轉章節提到 PostgreSQL 或 Qdrant 服務,但這些是選用的替代方案。

GrepAI Storage with GOB

This skill covers using GOB (Go Binary) as the storage backend for GrepAI, the default and simplest option.

When to Use This Skill

  • Single developer projects
  • Small to medium codebases
  • Simple setup without external dependencies
  • Local development environments

What is GOB Storage?

GOB is Go's native binary serialization format. GrepAI uses it to store:

  • Vector embeddings
  • File metadata
  • Chunk information

Everything is stored in a single local file.

Advantages

BenefitDescription
🚀 SimpleNo external services needed
⚡ Fast setupWorks immediately
📁 PortableSingle file, easy to backup
💰 FreeNo infrastructure costs
🔒 PrivateData stays local

Limitations

LimitationDescription
📏 ScalabilityNot ideal for very large codebases
👤 Single userNo concurrent access
🔄 No sharingCan't share index across machines
💾 MemoryLoads into RAM for searches

Configuration

Default Configuration

GOB is the default backend. Minimal config:

yaml
# .grepai/config.yamlstore:  backend: gob

Explicit Configuration

yaml
store:  backend: gob  # Index stored in .grepai/index.gob (automatic)

Storage Location

GOB storage creates files in your project's .grepai/ directory:

.grepai/├── config.yaml    # Configuration├── index.gob      # Vector embeddings└── symbols.gob    # Symbol index for trace

File Sizes

Approximate .grepai/index.gob sizes:

CodebaseFilesChunksIndex Size
Small100500~5 MB
Medium1,0005,000~50 MB
Large10,00050,000~500 MB

Operations

Creating the Index

bash
# Initialize projectgrepai init
# Start indexing (creates index.gob)grepai watch

Checking Index Status

bash
grepai status
# Output:# Index: .grepai/index.gob# Files: 245# Chunks: 1,234# Size: 12.5 MB# Last updated: 2025-01-28 10:30:00

Backing Up the Index

bash
# Simple file copycp .grepai/index.gob .grepai/index.gob.backup

Clearing the Index

bash
# Delete and re-indexrm .grepai/index.gobgrepai watch

Moving to a New Machine

bash
# Copy entire .grepai directorycp -r .grepai /path/to/new/location/
# Note: Only works if using same embedding model

Performance Considerations

Memory Usage

GOB loads the entire index into RAM for searches:

Index SizeRAM Usage
10 MB~20 MB
50 MB~100 MB
500 MB~1 GB

Search Speed

GOB provides fast searches for typical codebases:

Codebase SizeSearch Time
Small (100 files)<50ms
Medium (1K files)<200ms
Large (10K files)<1s

When to Upgrade

Consider PostgreSQL or Qdrant when:

  • Index exceeds 1 GB
  • Need concurrent access
  • Want to share index across team
  • Codebase has 50K+ files

.gitignore Configuration

Add .grepai/ to your .gitignore:

gitignore
# GrepAI (machine-specific index).grepai/

Why: The index is machine-specific because:

  • Contains binary embeddings
  • Tied to the embedding model used
  • Each machine should generate its own

Sharing Index (Not Recommended)

While you can copy the index file, it's not recommended because:

  1. Must use identical embedding model
  2. File paths are absolute
  3. Different machines may have different code versions

Better approach: Each developer runs their own grepai watch.

Migrating to Other Backends

To PostgreSQL

  1. Update config:
yaml
store:  backend: postgres  postgres:    dsn: postgres://user:pass@localhost:5432/grepai
  1. Re-index:
bash
rm .grepai/index.gobgrepai watch

To Qdrant

  1. Update config:
yaml
store:  backend: qdrant  qdrant:    endpoint: localhost    port: 6334
  1. Re-index:
bash
rm .grepai/index.gobgrepai watch

Common Issues

❌ Problem: Index file too large ✅ Solution: Add more ignore patterns or migrate to PostgreSQL/Qdrant

❌ Problem: Slow searches on large codebase ✅ Solution: Migrate to Qdrant for better performance

❌ Problem: Corrupted index ✅ Solution: Delete and re-index:

bash
rm .grepai/index.gob .grepai/symbols.gobgrepai watch

❌ Problem: "Index not found" error ✅ Solution: Run grepai watch to create the index

Best Practices

  1. Use for small/medium projects: Up to ~10K files
  2. Add to .gitignore: Don't commit the index
  3. Backup before major changes: Copy index.gob before experiments
  4. Re-index after model changes: If you change embedding models
  5. Monitor file size: Migrate if index exceeds 1GB

Output Format

GOB storage status:

✅ GOB Storage Configured
   Backend: GOB (local file)   Index: .grepai/index.gob   Size: 12.5 MB
   Contents:   - Files: 245   - Chunks: 1,234   - Vectors: 1,234 × 768 dimensions
   Performance:   - Search latency: <100ms   - Memory usage: ~25 MB

來源與署名

來源:yoanbernabeu/grepai-skills位於skills/storage/grepai-storage-gob提交382d402

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架