JohnXu22786/semantic-search2

dsh-semantic-search

A DeepSeek Harness (dsh) plugin for local semantic code search. Builds a fragment-level index of a workspace (symbol-aware chunking for many languages), computes local embeddings (lightweight lexical TF-IDF feature vectors by default, or a configurable OpenAI-compatible embedding endpoint), and answers natural-language queries with hybrid retrieval (vector cosine + BM25, fused with reciprocal-rank fusion). Ships dsh tools sema_search / sema_reindex / sema_stats plus a stand-alone CLI.

包名
dsh-semantic-search
版本
0.1.0
许可证
MIT
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:JohnXu22786/semantic-search

CLI usage

sema index                build the full index from the workspace
sema reindex [--full]     incremental refresh (or full rebuild with --full)
sema search     hybrid vector + BM25 search, prints top hits
sema stats [--json]       index health, provider, and sizing numbers

Global options:

--root           workspace root (default: current directory)
--data-dir       index storage directory (default: /.sema)
--provider      embedding provider: lexical | openai (default: lexical)
--dim              embedding dimension (lexical default: 4096; openai 0 = auto)
--base-url       OpenAI-compatible embeddings endpoint base URL
--model         embeddings model name (openai only)
--api-key        API key (openai only; env: SEMA_EMBEDDING_API_KEY)
--top              hits to print for search (default: 20)
--json                machine-readable output where supported
--help                show this help

CLI exit codes

  • 0 — success (including a search with zero hits and a --version/--help call).
  • 1 — a runtime failure (config error, build/index/search error).
  • 2 — a usage error: unknown command, unknown flag, or a missing query.

Configuration

The plugin is configurable through the bundle row's config (see cordis.patch.yml for an example), the CLI flags above, or defaults in code:

OptionDefaultMeaning
rootcwdworkspace root to index
dataDir.semaindex storage directory
provider.kindlexicallexical (offline) or openai
provider.dimension0 (lexical: 4096)embedding dimension; 0 = auto-infer from the endpoint
provider.baseUrlhttps://api.openai.com/v1OpenAI-compatible endpoint root
provider.modeltext-embedding-3-smallembedding model name
provider.apiKeyEnvSEMA_EMBEDDING_API_KEYenv var holding the API key
allowFallbacktruefall back to the lexical provider when a remote one fails
include / ignoredefaultsglob sets of files to index / skip
maxLinesPerChunk80hard chunk size upper bound
nGram2CJK n-gram size (1 disables n-gramming)
topK20hits returned by default
rrfK60RRF fusion constant
vectorK300candidates per channel before fusion
autosavetruepersist the index after builds
autoIndextruebuild lazily on first search
watchtruewatch the workspace for changes