Local-first repository context tool for LLM agents — MCP server with SQLite/FTS5 index, symbol-aware ranking, token-budgeted packs, and durable memory.
Project description
Lodestar
Lodestar is a local-first repository context tool for LLM agents. It builds a per-repo index inside /.lodestar/, returns bounded context packs, and keeps agent workflows grounded in summaries and evidence instead of large raw file dumps.
Install
pip install lodestar-context # primary install
pip install "lodestar-context[parsers]" # add tree-sitter parsers
pip install "lodestar-context[embeddings]" # add sentence-transformers dense retrieval
The package ships on PyPI as lodestar-context; the import path remains lodestar.
The lodestar and lodestar-mcp console scripts are available after install.
Current scope
- repository scanning and role detection
- per-repo SQLite index at
/.lodestar/index.db - incremental refresh by file hash
- repo overview generation
- subsystem summaries
- symbol extraction — heuristic baseline + optional tree-sitter for Python, JS, TS, Go, Rust, Java, Ruby, PHP (
pip install "lodestar-context[parsers]") - relation graph between files and symbols
- search, retrieve, explain, remember, pack, timeline, capture, locate-symbol primitives
- hybrid ranking — FTS5 BM25 (porter-stemmed) + exact token matching + cosine-style overlap + role-based boost (
source×1.3,documentation×0.7) + optional dense semantic similarity - symbol-aware ranking v2 — kind boosts (class/function > section), graph-proximity (results connected via relations get a bonus), and file-recency multipliers. Gate with
"ranking_v2": falsein/.lodestar/config.jsonto fall back to v1. - optional semantic retrieval via sentence-transformers embeddings (
pip install "lodestar-context[embeddings]") — covers files, symbols, subsystems and memories - memory store with evidence-hash staleness detection, chunk-level evidence refs,
last_validated_atfreshness tracking, aggressive stale suppression, and dense memory recall - query result caching (retrieve and search)
- repo-local configuration via
/.lodestar/config.json elapsed_mson index, refresh, search, retrieve, pack, timeline, and explain responsesevalcommand — fixture-based precision@K benchmarking with--fixture,--top-k, per-queryfound_refs/missing_refs, andavg_precision- MCP stdio server with parse-error recovery,
result.isErrortool errors,-32602invalid-param responses, and stderr protocol logging - CLI commands
Storage layout
Every indexed repository gets a local state directory:
/.lodestar/
index.db
config.json (optional — repo-local policy overrides)
cache/
logs/
state/
version.json
Repo-local configuration
Create /.lodestar/config.json in any indexed repository to override indexing and retrieval behaviour without changing Lodestar itself.
{
"extra_excludes": ["bootstrap/cache", "public/build"],
"include_overrides": ["bootstrap/app.php"],
"role_overrides": {
"app/Models/*.php": "source",
"config/*.php": "config"
},
"parser_overrides": {
"php": false
},
"retrieval_defaults": {
"budget_tokens": 2400,
"limit": 12
}
}
All keys are optional. Missing or malformed config silently falls back to global defaults.
| Key | Type | Effect |
|---|---|---|
extra_excludes |
string[] |
Additional directory names to skip during scanning (same semantics as built-in EXCLUDED_DIRS) |
include_overrides |
string[] |
Glob patterns (relative path) that bypass all exclusion rules |
role_overrides |
{glob: role} |
Override the inferred role for paths matching a glob, applied before built-in heuristics |
parser_overrides |
{language: bool} |
Set false to disable symbol extraction for a language (file is still indexed, just without symbols) |
retrieval_defaults |
{budget_tokens?, limit?} |
Default token budget and result limit when the caller does not specify them explicitly |
CLI
lodestar index /path/to/repo
lodestar refresh /path/to/repo
lodestar overview /path/to/repo
lodestar search /path/to/repo "auth middleware"
lodestar retrieve /path/to/repo "where is auth enforced?" --budget 1800
lodestar pack /path/to/repo "where is auth enforced?" --budget 1800
lodestar explain /path/to/repo "config loading"
lodestar remember /path/to/repo "auth path" "Authentication starts in middleware." --evidence src/auth.py
lodestar timeline /path/to/repo --since last_index
lodestar capture /path/to/repo --from json --source memories.json --commit
lodestar capture /path/to/repo --from claude-jsonl --source ~/.claude/projects/<slug>/<session>.jsonl
lodestar locate-symbol /path/to/repo LodestarService.search
lodestar eval /path/to/repo
lodestar eval /path/to/repo --queries "auth middleware" "config loading" "database schema"
lodestar eval /path/to/repo --fixture /path/to/fixtures.json --top-k 10
MCP
After pip install lodestar-context, run the stdio server with:
lodestar-mcp
Example Claude Desktop config:
{
"mcpServers": {
"lodestar": {
"command": "lodestar-mcp"
}
}
}
Development (running from source)
If you are running from this repository without installing the package, start the MCP server like this:
PYTHONPATH=src python3 -m lodestar.mcp_server
You can also use the included wrapper script:
./scripts/lodestar-mcp-stdio
Claude Desktop config file on macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
After restarting Claude Desktop, call Lodestar tools with the target repository path in repo_root, for example:
{
"repo_root": "/path/to/your/project"
}
Supported tool names:
project.indexproject.refreshproject.overviewproject.searchproject.retrieveproject.packproject.explainproject.rememberproject.timelineproject.captureproject.locate_symbol_rangeproject.find_usages
Notes
- The baseline is intentionally standard-library-first so it can run without extra dependencies.
- Search uses hybrid ranking: FTS5 BM25 (porter-stemmed) + exact token matching + cosine-style term overlap + role-based multipliers + optional dense semantic similarity + graph-neighbor expansion in
retrieve. - Install
pip install "lodestar-context[parsers]"to enable tree-sitter symbol extraction for Python, JS, TS, Go, Rust, Java, Ruby, and PHP. Without it, Lodestar falls back to heuristic regex parsing. Tree-sitter gives accurateClassName.methodnaming and proper nested scope handling. - Install
pip install "lodestar-context[embeddings]"to enable dense semantic retrieval. This embeds file, symbol, and subsystem summaries (and memory bodies) usingall-MiniLM-L6-v2(viasentence-transformers) and blends cosine similarity scores into every search, retrieve, and memory-recall call. Useful for natural-language queries that don't share vocabulary with identifiers in the code. - Evidence refs passed to
remembersupportfile:,symbol:, andchunk:prefixes for increasingly precise staleness detection. Stale memories are suppressed in retrieval unless no fresh memories match the query. - The MCP server logs protocol-level failures (framing errors, unknown methods) to stderr. Tool execution errors are returned as
result.isError: trueper the MCP spec, not as JSON-RPC error objects.
Project details
Release history Release notifications | RSS feed
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 lodestar_context-0.2.1.tar.gz.
File metadata
- Download URL: lodestar_context-0.2.1.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f902db3a6fdc5f638c46c0233d8fda203eab13ea77818aab00204e7bf202b054
|
|
| MD5 |
c69b52c77a923fd298f685ce643d76cd
|
|
| BLAKE2b-256 |
9132eaf47c3ba96761999f4d83b500c0f12cde7f62b104c123b48380c0dc59a2
|
Provenance
The following attestation bundles were made for lodestar_context-0.2.1.tar.gz:
Publisher:
release.yml on kostyadudin/lodestar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lodestar_context-0.2.1.tar.gz -
Subject digest:
f902db3a6fdc5f638c46c0233d8fda203eab13ea77818aab00204e7bf202b054 - Sigstore transparency entry: 1552985639
- Sigstore integration time:
-
Permalink:
kostyadudin/lodestar@1926330ee2443ea76bc8c26f634b58fa774a1c52 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/kostyadudin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1926330ee2443ea76bc8c26f634b58fa774a1c52 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lodestar_context-0.2.1-py3-none-any.whl.
File metadata
- Download URL: lodestar_context-0.2.1-py3-none-any.whl
- Upload date:
- Size: 46.6 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 |
5aaa0330b5e12293aff856fe7b8dad02797cf950a4f8e937a530abb7aa8c1ae0
|
|
| MD5 |
9e1a497621c365b5e8d0021f10a69bdb
|
|
| BLAKE2b-256 |
fad78fa32f462eaf07e90e1b2e8b833e056c5fa8cd822bbaa70cde7e50461d7b
|
Provenance
The following attestation bundles were made for lodestar_context-0.2.1-py3-none-any.whl:
Publisher:
release.yml on kostyadudin/lodestar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lodestar_context-0.2.1-py3-none-any.whl -
Subject digest:
5aaa0330b5e12293aff856fe7b8dad02797cf950a4f8e937a530abb7aa8c1ae0 - Sigstore transparency entry: 1552985648
- Sigstore integration time:
-
Permalink:
kostyadudin/lodestar@1926330ee2443ea76bc8c26f634b58fa774a1c52 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/kostyadudin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1926330ee2443ea76bc8c26f634b58fa774a1c52 -
Trigger Event:
push
-
Statement type: