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.
npx agentmods add agents/matt-dionis/claude-code-configs/pgvector-advancedgit clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsWrote 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.
[](https://agentmods.dev/agents/matt-dionis/claude-code-configs/pgvector-advanced)<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>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.
| Model | Per session | Once 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 |
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.
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}
`);
}
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.
- 3d ago First seen · 539 lines · 42 tokens per session scan A 556e2db43dad
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.
Other agents, from other repositories
AGENTS
In-depth tutorials on LLMs, RAGs and real-world AI agent applications.
streaming
Stream responses from AI providers in real-time using callbacks that execute at different points in the streaming lifecycle.
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.…
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.
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…
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…