rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Convex Vector Search

Embeddings-based search via Convex's built-in vector index. Embed via OpenAI text-embedding-3-small (1536-dim), query via vectorIndex().

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
vector-search.prompt.mdmarkdown
# Install `vector-search` — Convex Vector Search

> Embeddings-based search via Convex's built-in vector index.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/vector-search
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=vector-search
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/vector-search

## 1. Install

```bash
npm i openai
# alias: npx rr add vector-search
```

The CLI copies `frontend/slices/vector-search/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- npm: `@convex-dev/vector-search`
- shadcn primitives: `card`, `input`
- env vars:
  - `OPENAI_API_KEY` (convex, required)
- convex feature paths: `convex/features/search`

## 3. Wire it up

Run `npx rr add vector-search`. Add embedding field + vectorIndex per searchable table. Re-embed on upsert via Convex action. Cache embeddings — don't re-call OpenAI on every read.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.