pgvector-advanced

pgvector-advanced is an agent for Claude Code from Matt-Dionis/claude-code-configs. It costs 42 tokens per session (4,028 once invoked), scanned A, original, MIT.

An expert coding agent for advanced pgvector features in PostgreSQL, a database system. pgvector stores and searches numeric representations of data, including binary, sparse, and half-precision vectors.

In plain words
What is it for?
Use it when implementing binary or sparse vectors, half-precision storage, iterative index scans, or large-scale vector search optimization in PostgreSQL 17.
Why use it?
It helps with specialized vector-database design and performance work that requires knowledge of newer pgvector capabilities.

Agent for Claude Code

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.

agentmods
npx agentmods add agents/matt-dionis/claude-code-configs/pgvector-advanced
Clone the repo
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configs

Made for: Claude Code.

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-advanced

README.md
[![agentmods](https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/pgvector-advanced.svg)](https://agentmods.dev/agents/matt-dionis/claude-code-configs/pgvector-advanced)
Your own site
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/pgvector-advanced"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/pgvector-advanced.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00042 $0.04028
Opus 5 $0.00021 $0.02014
Sonnet 5 $0.00008 $0.00806
Haiku 4.5 $0.00004 $0.00403

Measured 3d ago against content hash 556e2db43dad, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pgvector-advanced 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 3d ago.

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.

configurations/mcp-servers/memory-mcp-server/.claude/agents/pgvector-advanced.md · 539 lines

How it starts

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

You are an expert in advanced pgvector v0.8.0 features and optimizations for PostgreSQL 17.

pgvector v0.8.0 Advanced Features

Binary Vectors (bit)

// src/db/binaryVectors.ts
import { sql } from "drizzle-orm";
import { db } from "./client";

// Binary vectors for compact storage and Hamming distance
export async function setupBinaryVectors() {
  // Create table with binary vectors
  await db.execute(sql`
    CREATE TABLE IF NOT EXISTS binary_features (
      id SERIAL PRIMARY KEY,
      companion_id TEXT NOT NULL,
      user_id TEXT NOT NULL,
      feature_name TEXT NOT NULL,
      binary_vector bit(1024),  -- 1024-bit binary vector
      created_at TIMESTAMP DEFAULT NOW()
    );
  `);

  // Create index for Hamming distance search
  await db.execute(sql`
    CREATE INDEX IF NOT EXISTS binary_features_hamming_idx
    ON binary_features
    USING ivfflat (binary_vector bit_hamming_ops)
    WITH (lists = 50);
  `);
}

// Convert float embeddings to binary for space efficiency
export function floatToBinary(embedding: number[]): string {
  // Convert to binary by thresholding at 0
  const bits = embedding.map(v => v > 0 ? '1' : '0');
  return bits.join('');
}

// Hamming distance search for binary vectors
export async function searchBinaryVectors(queryVector: string, limit = 10) {
  return await db.execute(sql`
    SELECT 
      *,
      binary_vector <~> B'${queryVector}' as hamming_distance
    FROM binary_features
    ORDER BY binary_vector <~> B'${queryVector}'
    LIMIT ${limit}
  `);
}

Sparse Vectors (sparsevec)

// src/db/sparseVectors.ts
import { sql } from "drizzle-orm";

// Sparse vectors for high-dimensional but mostly zero data
export async function setupSparseVectors() {
  // Enable sparsevec type
  await db.execute(sql`CREATE EXTENSION IF NOT EXISTS vector`);
  
  // Create table with sparse vectors
  await db.execute(sql`
    CREATE TABLE IF NOT EXISTS sparse_memories (
      id SERIAL PRIMARY KEY,
      companion_id TEXT NOT NULL,
      user_id TEXT NOT NULL,
      content TEXT,
      sparse_embedding sparsevec(100000),  -- Up to 100k dimensions
      created_at TIMESTAMP DEFAULT NOW()
    );
  `);

  // Create index for sparse vector search
  await db.execute(sql`
    CREATE INDEX IF NOT EXISTS sparse_memories_idx
    ON sparse_memories
    USING ivfflat (sparse_embedding sparsevec_l2_ops)
    WITH (lists = 100);
  `);
}

// Convert dense to sparse representation
export function denseToSparse(embedding: number[], threshold = 0.01): Record<number, number> {
  const sparse: Record<number, number> = {};
  embedding.forEach((value, index) => {
    if (Math.abs(value) > threshold) {
      sparse[index] = value;
    }
  });
  return sparse;
}

// Format sparse vector for PostgreSQL
export function formatSparseVector(sparse: Record<number, number>, dimensions: number): string {
  const entries = Object.entries(sparse)
    .map(([idx, val]) => `${idx}:${val}`)
    .join(',');
  return `{${entries}}/${dimensions}`;
}

// Search with sparse vectors
export async function searchSparseVectors(
  sparseQuery: Record<number, number>,
  dimensions: number,
  limit = 10
) {
  const sparseStr = formatSparseVector(sparseQuery, dimensions);
  
  return await db.execute(sql`
    SELECT 
      *,
      sparse_embedding <-> '${sparseStr}'::sparsevec as distance
    FROM sparse_memories
    WHERE sparse_embedding IS NOT NULL
    ORDER BY sparse_embedding <-> '${sparseStr}'::sparsevec
    LIMIT ${limit}
  `);
}

Read the full file on GitHub · 539 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. 3d ago First seen · 539 lines · 42 tokens per session scan A 556e2db43dad

Subscribe to this mod's changes

pgvector-advanced is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (625 stars, last pushed 1y ago), licensed MIT. It adds 42 tokens to every session and 4,028 once invoked, about $0.0002 per session on Opus 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-30.

Related

Other agents, from other repositories

AGENTS

In-depth tutorials on LLMs, RAGs and real-world AI agent applications.

patchy631/ai-engineering-hub · 0 tokens

streaming

Stream responses from AI providers in real-time using callbacks that execute at different points in the streaming lifecycle.

activeagents/activeagent · 20 tokens

mlops-reviewer

MLOps / model lifecycle pre-implementation reviewer. Specialises in dataset versioning (DVC / LakeFS), distributed training cost budgets, model registry (MLflow / W&B), drift detection (Evidently / WhyLabs), bias / fairness audit (Fairlearn / AIF360), shadow + A/B model serving, and EU AI Act high-risk classification.…

avelikiy/great_cto · 105 tokens

by-epitope

Deep epitope analysis agent. Maps binding interfaces from PDB structures, classifies epitope type, assesses druggability, identifies cryptic sites, cross-references SAbDab, and generates hotspot arrays in BoltzGen entities YAML format.

001TMF/blatant-why · 58 tokens

prompt_engineer

Prompt engineering specialist for LLM prompt design, few-shot and chain-of-thought structuring, eval harnesses, and RAG retrieval quality. Use when the task requires writing or reviewing prompts, building evaluation datasets, tuning retrieval for a RAG system, or diagnosing regressions in LLM outputs. For example…

josstei/maestro-orchestrate · 98 tokens

data-jupyter-expert

Expert in Jupyter Notebook and JupyterLab for interactive computing, data analysis, machine learning experimentation, and reproducible research. Specializes in production-ready notebooks, version control, CI/CD integration, parameterization with Papermill, MLOps workflows, and JupyterLab 4.4+ modern features including…

andisab/swe-marketplace · 260 tokens