10-search-stack

A project rulebook for changing search behavior, ranking, or index-building code in a documentation search system.

In plain words
What is it for?
Use it when modifying indexes, BM25 ranking, prefix or phrase matching, source boosts, context detection, or documentation URL and library mappings.
Why use it?
It keeps search changes aligned with the existing indexing, SQLite full-text search, scoring, metadata, and query-processing design.

Cursor rule for Cursor

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 rules/marianfoo/abap-mcp-server/10-search-stack
Clone the repo
git clone --depth 1 https://github.com/marianfoo/abap-mcp-server

Made for: Cursor.

Per session 492 This file is loaded in full into every session.
When invoked 492 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00492 $0.00492
Opus 5 $0.00246 $0.00246
Sonnet 5 $0.00098 $0.00098
Haiku 4.5 $0.00049 $0.00049

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

Security

Grade A, and why

10-search-stack 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 2d 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.

Origin

This is a copy

100% identical to 10-search-stack — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/10-search-stack.mdc · 43 lines

What it actually says

Search & Indexing (Rule)

When modifying search behavior, ranking, or index builds.

Search Architecture (BM25-Only with FTS5)

  • Index Build: scripts/build-index.tsdist/data/index.json
  • FTS Database: scripts/build-fts.tsdist/data/docs.sqlite (SQLite FTS5)
  • Hybrid Search: FTS5 candidate filtering → sophisticated scoring
  • Search Logic: Pure BM25 via src/lib/search.ts using metadata APIs
  • Query Processing: toMatchQuery() in src/lib/searchDb.ts
  • Configuration: All source settings in src/metadata.json
  • Performance: 16x faster with FTS5 hybrid approach (~42ms vs 700ms)

Metadata-Driven Configuration

  • Source Boosts: Context-aware scoring via getContextBoosts()
  • Library Mappings: ID resolution via getAllLibraryMappings()
  • URL Generation: Documentation links via getDocUrlConfig()
  • Source Paths: File system paths via getSourcePath()

Key Search Features

  • OR Logic: Better recall for multi-term queries
  • Prefix Matching: Terms get * suffix for broader matching
  • Phrase Queries: Dotted terms (sap.m.Button) quoted for exact match
  • Context Awareness: UI5/CAP/wdi5 context detection and scoring
  • ABAP Version Filtering: Intelligent version detection and result filtering
  • Graceful Fallback: Falls back to full search if FTS finds no candidates

Performance

  • FTS5: SQLite full-text search for sub-second response times
  • Centralized Config: Single metadata load at startup
  • Efficient APIs: Type-safe configuration access

@file scripts/build-index.ts @file scripts/build-fts.ts @file src/lib/searchDb.ts @file src/lib/search.ts @file src/lib/metadata.ts @file src/metadata.json @file src/lib/localDocs.ts @file docs/FTS5-IMPLEMENTATION-COMPLETE.md @file docs/ABAP-INTEGRATION-SUMMARY.md @file docs/ARCHITECTURE.md @file docs/DEV.md

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. 2d ago First seen · 43 lines · 492 tokens per session scan A 764f639fc318

Subscribe to this mod's changes

10-search-stack is a cursor rule published in the GitHub repository marianfoo/abap-mcp-server (88 stars, last pushed 14d ago), licensed Apache-2.0. It adds 492 tokens to every session, about $0.0025 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to 10-search-stack, differing in 0 lines, and is treated as a copy.