Token-efficient CLI for indexing and searching code symbols (Python-first, designed for minimal LLM/agent context size)
Project description
Sampler
Token-efficient CLI for indexing and searching code symbols across projects.
Compact output. Short paths. Low-noise symbol views.
The code isn't the problem. The problem is the distance between you and the code.
Sampler closes that distance. One index. One query. The right symbol, the right relationship, the right context — delivered without the noise. Because in a world drowning in repositories, the person who finds what matters first is the person who moves the work forward.
Installation
pip install sampler-cli
Development:
pip install -e '.[dev]'
Semantic stack (TF-IDF + local hash fallback):
pip install -e '.[semantic]'
Quick Start
sampler init
sampler project add myproj /absolute/path/to/project --language auto
sampler index myproj
sampler search retry --project myproj
sampler symbols myproj
sampler overview src/main.py
Commands
Core
| Command | Description |
|---|---|
sampler version [--plain] |
Show version |
sampler init |
Initialize Sampler config and data directory |
sampler index <project> |
Index a project's symbols and relationships |
sampler search <query> |
Search symbols across a project |
sampler search-all <query> |
Search across all indexed projects |
sampler symbols <project> |
List symbols in a project |
sampler overview <filepath> |
Show symbol overview for a file |
Search options: --project, --type, --limit, --semantic, --style plain|bars
Relationships
| Command | Description |
|---|---|
sampler callers <symbol> |
Find callers of a symbol |
sampler usages <symbol> |
Find usages of a symbol |
sampler related <symbol> |
Find related symbols |
Symbols can also be selected as <path>:<symbol>, e.g. app/utils/helpers.py:format_kda.
Project Management
| Command | Description |
|---|---|
sampler project add <name> <path> --language <lang> |
Add a project |
sampler project update <name> |
Update project path or language |
sampler project list |
List projects |
sampler project deps <name> |
Show project dependencies |
sampler project remove <name> |
Remove a project |
Languages: python, go, typescript, javascript, vue, auto.
Config & Analysis
| Command | Description |
|---|---|
sampler config show |
Show current config |
sampler config embeddings |
Configure embedding provider |
sampler embed <project> |
Precompute embeddings |
sampler stale-code <project> |
Find candidate stale code |
Embeddings & Semantic Search
sampler search --semantic uses a pluggable adapter pattern:
- Default:
bge-small(BAAI/bge-small-en-v1.5 via fastembed — local ONNX, ~384 dim) - Built-ins:
hash(deterministic fallback),ollama,nomic,openai,fastembed - Lexical primary: TF-IDF (sklearn, on-the-fly, no pre-embedding required)
- Final fallback: hash fingerprint (always available)
Configure in ~/.sampler/config.yaml or via sampler config embeddings:
embeddings:
provider: "bge-small"
# provider: "ollama"
# model: "nomic-embed-text"
# base_url: "http://localhost:11434"
Install extras:
pip install 'sampler-cli[embeddings]' # BGE (recommended)
pip install 'sampler-cli[ollama-embeddings]'
pip install 'sampler-cli[openai-embeddings]'
Run sampler embed <project> to precompute vectors for the active provider. Change providers? Re-run embed after updating config.
Offline or air-gapped: set provider: hash, or rely on TF-IDF + hash with the [semantic] extra.
Language Support
| Language | Parser |
|---|---|
| Python | stdlib AST |
| Go | tree-sitter-go |
| TypeScript / JavaScript | tree-sitter-typescript |
| Vue | Extracts <script> / <script setup>, delegates to TS/JS parser |
| Auto | Per-file detection for monorepos and multi-language projects |
Stale Code Detection
sampler stale-code <project> finds functions that may no longer be needed:
- Called only from test files
- Zero non-test callers in the project call graph
- Defined in production code
Supported test patterns:
- Python:
tests/,test_*.py,*_test.py - Go:
*_test.go - TypeScript / JavaScript / Vue:
__tests__/,test/,spec/,*.test.*,*.spec.*
This is a heuristic signal, not a guarantee of dead code.
Examples
$ sampler search worker --project myproj
myproj:src/tasks/celery_app.py:70 function on_worker_ready def on_worker_ready(sender)
$ sampler related ConfigManager --project myproj --style bars
myproj:src/config.py:24-105 class ConfigManager [parent]
...
$ sampler stale-code myproj
myproj:src/utils/retry.py:12-28 function retry_request test_callers=2 non_test_callers=0 [tests.test_retry.test_retry_request]
Data Location
- Config:
~/.sampler/config.yaml - Database:
~/.sampler/graph.db
Running Tests
pytest -q
Notes
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sampler_cli-0.4.5.tar.gz.
File metadata
- Download URL: sampler_cli-0.4.5.tar.gz
- Upload date:
- Size: 61.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d9f62145c8250fd17a3bbd5009a122e3230ce05541c7db26acef8c2ab1865ff
|
|
| MD5 |
26a9f3021f8f9d4a95d1eafd6ca486ef
|
|
| BLAKE2b-256 |
43061281483390a3919fca3b6c0ef1cb1450548f1cf72b7c352e0ec8e433d955
|
Provenance
The following attestation bundles were made for sampler_cli-0.4.5.tar.gz:
Publisher:
publish.yml on SamuelCarmona83/sampler-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sampler_cli-0.4.5.tar.gz -
Subject digest:
6d9f62145c8250fd17a3bbd5009a122e3230ce05541c7db26acef8c2ab1865ff - Sigstore transparency entry: 2048193771
- Sigstore integration time:
-
Permalink:
SamuelCarmona83/sampler-cli@304fb2363a6cb8ead3bf297af45e6bf15226239d -
Branch / Tag:
refs/tags/v0.4.5 - Owner: https://github.com/SamuelCarmona83
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@304fb2363a6cb8ead3bf297af45e6bf15226239d -
Trigger Event:
release
-
Statement type:
File details
Details for the file sampler_cli-0.4.5-py3-none-any.whl.
File metadata
- Download URL: sampler_cli-0.4.5-py3-none-any.whl
- Upload date:
- Size: 58.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd3b886467a034f92518437512f23c5080e01d8e75988ea650fafee6674aaf5
|
|
| MD5 |
d2087aac25100794eba669c43fa26b09
|
|
| BLAKE2b-256 |
405f622c787863e7e975eee915094366d02291b3af4d6e1b395f9032bf953d4c
|
Provenance
The following attestation bundles were made for sampler_cli-0.4.5-py3-none-any.whl:
Publisher:
publish.yml on SamuelCarmona83/sampler-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sampler_cli-0.4.5-py3-none-any.whl -
Subject digest:
9cd3b886467a034f92518437512f23c5080e01d8e75988ea650fafee6674aaf5 - Sigstore transparency entry: 2048194298
- Sigstore integration time:
-
Permalink:
SamuelCarmona83/sampler-cli@304fb2363a6cb8ead3bf297af45e6bf15226239d -
Branch / Tag:
refs/tags/v0.4.5 - Owner: https://github.com/SamuelCarmona83
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@304fb2363a6cb8ead3bf297af45e6bf15226239d -
Trigger Event:
release
-
Statement type: