pgvector-search

pgvector-search is a skill for Claude Code from ArieGoldkin/claude-forge. It costs 32 tokens per session (1,922 once invoked), scanned A, original, MIT.

An aspirational guide to combining PostgreSQL vector search with BM25 keyword search, then merging the rankings. It also describes metadata filters and performance improvements, but says these patterns are not implemented in the reference platform.

In plain words
What is it for?
Use it as design guidance for hybrid search with PGVector, keyword matching, result merging, metadata filtering, and retrieval optimization.
Why use it?
It explains a possible way to retrieve documents by both meaning and exact words, while clearly separating planned patterns from available functionality.

Skill for Claude Code

Written for Claude Code: paths in frontmatter.

Part of the atk plugin — 16 skills, 25 commands, 1 agent, 1 hook shipped together

Good fit Use it as design guidance for hybrid search with PGVector, keyword matching, result merging, metadata filtering, and retrieval optimization.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ariegoldkin/claude-forge/pgvector-search
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ArieGoldkin/claude-forge --skill pgvector-search
Clone the repo
git clone --depth 1 https://github.com/ArieGoldkin/claude-forge

Made for: Claude Code.

Or install atk, the plugin that ships this one along with the rest of its 16 skills, 25 commands, 1 agent, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pgvector-search

README.md
[![agentmods](https://agentmods.dev/badge/skills/ariegoldkin/claude-forge/pgvector-search/github.svg)](https://agentmods.dev/skills/ariegoldkin/claude-forge/pgvector-search)
Your own site
<a href="https://agentmods.dev/skills/ariegoldkin/claude-forge/pgvector-search"><img src="https://agentmods.dev/badge/skills/ariegoldkin/claude-forge/pgvector-search/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pgvector-search

Your own site · 80×15
<a href="https://agentmods.dev/skills/ariegoldkin/claude-forge/pgvector-search"><img src="https://agentmods.dev/badge/skills/ariegoldkin/claude-forge/pgvector-search.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,922 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.01922
Opus 5.5 $0.00013 $0.00769
Sonnet 5.5 $0.00006 $0.00384
Haiku 4.5 $0.00003 $0.00192

Measured 1mo ago against content hash 78467e3ef7d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pgvector-search scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (templates/chunk-repository.py, templates/search-service.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ai-toolkit/skills/pgvector-search/SKILL.md · 245 lines

How it starts

The opening of the file, as written. The whole thing — 245 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Aspirational — these patterns are not yet implemented in the reference platform.

Production-grade semantic + keyword search using PostgreSQL

Overview

Hybrid search combines semantic similarity (vector embeddings) with keyword matching (BM25) to achieve better retrieval than either alone.

Architecture:

Query
  ↓
[Generate embedding] → Vector Search (PGVector) → Top 30 results
  ↓
[Generate ts_query]  → Keyword Search (BM25)    → Top 30 results
  ↓
[Reciprocal Rank Fusion (RRF)] → Merge & re-rank → Top 10 final results

Core Concepts

1. Semantic Search (Vector Similarity)

How it works:

  1. Embed query: "database indexing strategies" → [0.23, -0.15, ..., 0.42] (1024 dims)
  2. Find nearest neighbors: ORDER BY embedding <=> query_embedding LIMIT 30
  3. Returns: Conceptually similar documents (even with different words)

Example:

  • Query: "machine learning model training"
  • Matches: "neural network optimization", "deep learning techniques"
  • Misses: "ML model training" (different embeddings despite similar meaning)

Strengths:

  • Captures semantic meaning
  • Works across languages
  • Handles synonyms ("car" matches "automobile")

Weaknesses:

  • Slow for exact keyword matches
  • Sensitive to embedding quality
  • Doesn't handle rare technical terms well

2. Keyword Search (BM25)

How it works:

  1. Tokenize query: "database indexing" → database & indexing
  2. Full-text search: WHERE content_tsvector @@ to_tsquery('database & indexing')
  3. Rank by BM25 score (TF-IDF + document length normalization)

Example:

  • Query: "PostgreSQL B-tree index"
  • Matches: Documents with exact phrase "PostgreSQL B-tree index"
  • Misses: "Postgres tree-based indexing" (different words)

Strengths:

  • Fast exact matches
  • Handles technical terms well
  • Works for rare/specific phrases

Weaknesses:

  • No semantic understanding
  • Requires exact word matches
  • Sensitive to typos

3. Reciprocal Rank Fusion (RRF)

Read the full file on GitHub · 245 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 245 lines · 32 tokens per session scan A 78467e3ef7d4

Subscribe to this mod's changes

pgvector-search is a skill published in the GitHub repository ArieGoldkin/claude-forge (7 stars, last pushed 2mo ago), licensed MIT. It adds 32 tokens to every session and 1,922 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.