agentsclimarketplace

Case 02335

Skill knownasnaffy/prompthound/dataset/case_02335

A fast, offline static risk analysis CLI for AI agent skill files. Detects malicious instructions, steganographic payloads, and dangerous capability chains.

Install
npx -y skills add knownasnaffy/prompthound --skill case_02335

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Compress and accelerate vector search in memory/RAG systems using TurboQuant (ICLR 2026) — near-optimal vector quantization with 5-8x compression and 98%+ search accuracy. Uses blockwise Hadamard rotation + Lloyd-Max scalar quantization. Use when: (1) optimizing embedding storage size, (2) speeding up semantic search, (3) user mentions "compress embeddings", "quantize vectors", "memory optimization", "faster search", "TurboQuant", "vector compression", or "embedding compression", (4) reducing memory footprint of RAG systems. Works with any embedding model (Gemini, OpenAI, Cohere, local) and any dimension ≥ 128. No GPU required. numpy only.

SKILL.md

4.3 KB, as published. Nobody here has run it

TurboQuant Memory

Compress embedding vectors 5-8x with 98%+ search accuracy using TurboQuant (Google, ICLR 2026).

Quick Start

1. Run tests

python3 scripts/turboquant.py

15 built-in tests: FWHT correctness, MSE distortion, IP correlation, recall, compression ratio, determinism.

2. Validate on your data

python3 scripts/validate.py --db /path/to/memory.sqlite --auto-detect --bits 5

Auto-detects sqlite-vec vec0 tables, analyzes distribution, reports quantization quality and recall.

3. Quantize a memory database

python3 scripts/memory_quantize.py --db /path/to/memory.db --bits 5 --benchmark
python3 scripts/memory_quantize.py --db /path/to/memory.db --bits 5 --migrate

4. Integrate into code

from turboquant import TurboQuantMSE

# Initialize (deterministic — same seed = same quantization)
tq = TurboQuantMSE(dim=3072, bits=5)

# Quantize for storage
stored = tq.quantize(embedding_vector)  # float32 → compressed

# Reconstruct
reconstructed = tq.dequantize(stored)   # compressed → float32

# Search: query stays float32, database is quantized
q_rot = tq.rotation.apply(query)
for doc in database:
    score = doc['norm'] * doc['scale'] * np.dot(q_rot, tq.codebook[doc['indices']])

Recommended Configuration

PresetModeBitsR@1CompressionUse Case
DefaultMSE598%6.4xMost memory/RAG search
ConservativeMSE698%+5.3xHigh-fidelity retrieval
AggressiveMSE492%8.0xLarge-scale, storage-constrained

Parameters

ParameterDefaultDescription
dimauto-detectEmbedding dimension (768, 1536, 3072, etc.)
bits5Bits per coordinate. See table above.
seed42Rotation seed. Same seed = reproducible quantization.

Algorithm

Blockwise Hadamard Rotation → Lloyd-Max Scalar Quantization

  1. Split vector into power-of-2 blocks (e.g., 3072 = 3 × 1024)
  2. Per block: random sign flip + Fast Walsh-Hadamard Transform (fully invertible)
  3. Per-vector scale normalization
  4. Lloyd-Max optimal scalar quantizer per coordinate (precomputed codebook for N(0,1))
  5. Pack indices into compact bit representation

Key properties:

  • Data-oblivious: no training or calibration needed
  • Fully invertible: zero information loss from rotation
  • Near-optimal: within 2.7x of Shannon information-theoretic lower bound
  • Deterministic: same seed = same output

See references/algorithm.md for full details.

Benchmark (Gemini embedding-001, 3072-dim, 112 vectors)

BitsMSECosineR@1R@5R@10Bytes/vecCompression
31.1e-50.98288%90%91%1,16010.6x
43.2e-60.99592%93%93%1,5448.0x
58.2e-70.99998%96%96%1,9286.4x
62.2e-71.00096%98%98%2,3125.3x
78e-81.000100%98%99%2,6964.6x
83e-81.00098%98%99%3,0804.0x

Compatibility

  • Python 3.9+, numpy only (no scipy, no GPU)
  • Any embedding dimension ≥ 128
  • Any embedding model (Gemini, OpenAI, Cohere, sentence-transformers, etc.)
  • SQLite / sqlite-vec vec0 tables (auto-detected)

References

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.