Locus
v1.3.1Vectorless RAG over markdown: BM25, temporal knowledge graph and link walking, with provenance.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
locus_index
Index a file or directory into Locus. Builds BM25 inverted index, extracts KG triples from wikilinks, tags, and prose sentences. Skips unchanged files (checksum dedup). Run this first.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
pattern | string | |
store_path | string |
locus_retrieve
BM25 retrieval (SQLite FTS5) with an optional re-rank of the BM25 candidates by KG entity expansion, link walking, frontmatter structural matching, recency and link popularity (mode='hybrid', weighted RRF). Default mode is 'bm25'; passing as_of selects 'hybrid'. Deterministic. Each result carries a provenance tag (bm25 / kg / link:hopN / structural / recency / link_pop).
| Parameter | Type | Description |
|---|---|---|
query * | string | |
as_of | string | Temporal filter YYYY-MM-DD. |
expansion | string | LLM-free query expansion (RM3 pseudo-relevance feedback). Off by default. |
filters | object | Restrict results by source-document metadata. Keys: path / exclude_path (glob or list), type (str or list), tags (all of), tags_any (any of), date_from / date_to (YYYY-MM-DD on frontmatter `date`), as… |
full_content | boolean | |
intent | string | |
limit | integer | |
mode | string | bm25 (default) or hybrid re-rank. |
parent | string | Return the enclosing section or whole document of the matched chunks (parent-child retrieval); each result's `spans` cite the matched passages by character offset. |
store_path | string | |
track | boolean | Record hits in the hot-context bulletin (set false for a pure read). |
use_links | boolean |
locus_explain
Explain WHY a chunk was (or would be) retrieved for a query. Reports which BM25 terms matched, which KG entities link to the document, and which structural signals fired. Returns a plain-English narrative. Unique to graph-based RAG — impossible with vector search.
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | Chunk ID from a prior locus_retrieve call. |
query | string | The query to explain against (optional but recommended). |
store_path | string |
locus_add_fact
Add a temporal fact (subject–predicate–object) to the KG.
| Parameter | Type | Description |
|---|---|---|
object * | string | |
predicate * | string | |
subject * | string | |
source | string | |
store_path | string | |
valid_from | string | |
valid_to | string |
locus_query_entity
Query all KG facts about an entity. Supports as_of temporal filter.
| Parameter | Type | Description |
|---|---|---|
entity * | string | |
as_of | string | |
store_path | string |
locus_kg_stats
Knowledge graph statistics.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_contradictions
Find contradicting KG triples: same subject+predicate, different objects, overlapping validity windows.
| Parameter | Type | Description |
|---|---|---|
entity | string | Optional entity to scope. |
store_path | string |
locus_add_alias
Register an entity alias so variant names resolve to the same canonical entity.
| Parameter | Type | Description |
|---|---|---|
alias * | string | |
canonical * | string | |
store_path | string |
locus_suggest_aliases
Suggest entity name pairs that may refer to the same entity (similarity-based).
| Parameter | Type | Description |
|---|---|---|
store_path | string | |
threshold | number |
locus_hot_context
Return the hot-tier bulletin board — frequently retrieved and pinned context.
| Parameter | Type | Description |
|---|---|---|
store_path | string | |
token_limit | integer |
locus_promote
Manually pin a chunk to Tier 0 (never auto-archived).
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | |
store_path | string |
locus_session_start
Warm context open: corpus + KG + bulletin + resolver stats, hot-tier content.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_wrap_up
Session close: tick bulletin decay, return summary stats.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_status
Full status: corpus, KG, bulletin, budget, resolver.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_forget
Remove a document from the corpus.
| Parameter | Type | Description |
|---|---|---|
doc_path * | string | |
store_path | string |
locus_sync
Full reindex: wipe and rebuild corpus + KG from a directory.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
pattern | string | |
store_path | string |
locus_prepare_context
All-in-one context preparation for LLM agents. Retrieves → re-ranks → packs into token budget → assesses confidence → adds KG facts for query entities. Single call returns everything needed to answer the query. Recommended primary tool for agent workflows.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
as_of | string | Temporal filter YYYY-MM-DD. |
limit | integer | |
rerank | boolean | Apply heuristic re-ranking after RRF. |
store_path | string | |
token_budget | integer | Max tokens for packed_context. |
locus_cache_stats
Query cache statistics: size, hit rate, hits, misses.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_clear_cache
Manually invalidate the query result cache.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_kg_traverse
BFS traversal from a starting entity. Walks the KG graph up to max_depth hops, optionally filtered by predicate or direction. Returns all reachable entities and their facts.
| Parameter | Type | Description |
|---|---|---|
start * | string | Starting entity name. |
direction | string | |
max_depth | integer | |
predicate_filter | array | Only follow these predicates. |
store_path | string |
locus_kg_match
Pattern match over the KG with wildcard support. '*' matches any value. Examples: match('Alice','*','*') — all Alice facts; match('*','leads','*') — all leadership; match('*','works_at','Acme') — everyone at Acme.
| Parameter | Type | Description |
|---|---|---|
as_of | string | Temporal filter YYYY-MM-DD. |
obj | string | Object pattern ('*' for any). |
predicate | string | |
store_path | string | |
subject | string |
locus_doctor
Run a health check on the Locus store. Checks corpus integrity, KG population, bulletin fill levels, entity resolver, store size, and version.
| Parameter | Type | Description |
|---|---|---|
store_path | string |
locus_export_kg
Export the knowledge graph to a file. Formats: graphml (Gephi/Cytoscape), jsonl (scripting), dot (Graphviz). Format is auto-detected from the file extension if not specified.
| Parameter | Type | Description |
|---|---|---|
path * | string | Output file path. |
format | string | Export format (auto from extension if omitted). |
store_path | string |
locus_ingest_ompa
Import an OMPA vault into the Locus store. Indexes all markdown files and copies KG triples directly from OMPA's .palace/knowledge_graph.sqlite3 (same schema — zero transformation). Safe to re-run; unchanged files are skipped via checksum dedup.
| Parameter | Type | Description |
|---|---|---|
vault_path * | string | Path to the OMPA vault root. |
pattern | string | |
store_path | string |
locus_benchmark
Measure retrieval quality against a JSON QA file. Returns Recall@K and MRR. QA format: [{"query": "...", "expected_docs": ["path/to/doc.md"]}]
| Parameter | Type | Description |
|---|---|---|
qa_file * | string | Path to JSON QA file. |
k_values | array | |
store_path | string |
locus_cluster_retrieve
Query multiple Locus nodes simultaneously and fuse results via RRF. Provenance tags include the node name (e.g. 'jarv:bm25', 'kai:kg'). Designed for Jarv/Kai/Tai multi-node setups.
| Parameter | Type | Description |
|---|---|---|
cluster_path * | string | Path to cluster registry JSON. |
query * | string | |
as_of | string | |
limit | integer | |
nodes | array | Subset of node names. Omit for all. |
locus_add_node
Register a named node (Locus store) in the cluster registry.
| Parameter | Type | Description |
|---|---|---|
cluster_path * | string | |
name * | string | Node name (e.g. 'jarv'). |
store_path * | string |
locus_remove_node
Unregister a node from the cluster (does not delete its store).
| Parameter | Type | Description |
|---|---|---|
cluster_path * | string | |
name * | string |
locus_list_nodes
List all cluster nodes with their corpus and KG stats.
| Parameter | Type | Description |
|---|---|---|
cluster_path * | string |
locus_reason
Multi-hop KG reasoning. Extracts entities from the question, explores their KG neighbourhood, and surfaces connecting paths between them. Returns reasoning_chains, entity_neighborhood, and detected entities. Ideal for questions like 'How is Alice connected to the auth system?'
| Parameter | Type | Description |
|---|---|---|
question * | string | |
max_depth | integer | |
store_path | string |
locus_find_paths
Find all shortest KG paths between two entities using BFS. Returns each path as a list of hops with a human-readable narrative. Useful for tracing how two people, systems, or concepts are connected.
| Parameter | Type | Description |
|---|---|---|
entity_a * | string | |
entity_b * | string | |
max_depth | integer | |
predicate_filter | array | |
store_path | string |
locus_inspect
Inspect a document's corpus representation: chunk count, word count, top BM25 terms, entities, and internal wikilinks. Useful for debugging indexing quality.
| Parameter | Type | Description |
|---|---|---|
doc_path * | string | |
limit | integer | |
store_path | string |
locus_top_terms
Return the corpus-wide top terms by document frequency. Each entry includes the term, how many chunks contain it, and total TF. Useful for understanding what vocabulary dominates the knowledge base.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
store_path | string |
locus_ingest_github
Fetch markdown files from a GitHub repository and index them. Fetches the file tree, downloads matching files, and calls locus_index. Requires a GITHUB_TOKEN env var or token param for private repos.
| Parameter | Type | Description |
|---|---|---|
repo * | string | owner/repo |
branch | string | |
path | string | Sub-directory within repo. |
pattern | string | |
store_path | string | |
token | string | GitHub PAT (or set GITHUB_TOKEN env var). |
locus_expand_query
Expand a query using KG alias resolution and first-hop neighbours. If query terms match known entity aliases, their canonical names and related entities are appended to produce a richer query string. Returns original, expanded, added_terms, and entity_matches.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
max_expansions | integer | |
store_path | string |
locus_multi_retrieve
Run multiple query variants and fuse results via Reciprocal Rank Fusion. Ideal for query reformulation, typo tolerance, or multi-intent queries. Each query runs through the full six-signal pipeline independently.
| Parameter | Type | Description |
|---|---|---|
queries * | array | List of query variants. |
as_of | string | Temporal filter YYYY-MM-DD. |
limit | integer | |
store_path | string |
locus_timeline
Show a chronological timeline of all KG facts for an entity. Facts are sorted by valid_from date; undated facts appear last. Useful for tracking how knowledge about an entity evolved over time.
| Parameter | Type | Description |
|---|---|---|
entity * | string | |
as_of | string | Temporal filter YYYY-MM-DD. |
store_path | string |
locus_snapshot
Archive the entire Locus store to a portable .tar.gz file. The snapshot captures the corpus index, KG, bulletin, entity resolver, and all SQLite databases. Can be restored with locus_restore.
| Parameter | Type | Description |
|---|---|---|
output_path * | string | Destination archive path (e.g. backup.tar.gz). |
store_path | string |
locus_restore
Restore a Locus store from a snapshot archive. Extracts to store_path (default: .locus-restored). Use overwrite=true to replace an existing store.
| Parameter | Type | Description |
|---|---|---|
snapshot_path * | string | Path to the .tar.gz archive. |
overwrite | boolean | |
store_path | string |
locus_snapshot_info
Inspect a snapshot archive: file list, archive size, uncompressed size.
| Parameter | Type | Description |
|---|---|---|
snapshot_path * | string |
locus_diff
Preview what would change if a directory were re-indexed now. Returns lists of new, changed, and deleted files without modifying the corpus. Run before locus_sync to understand the impact.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
pattern | string | |
store_path | string |
locus_annotate
Attach a label and optional note to a chunk. Labels are arbitrary strings: 'important', 'outdated', 'reviewed', etc. Multiple labels per chunk are supported.
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | |
label * | string | |
note | string | |
store_path | string |
locus_get_annotations
Return all labels and notes attached to a chunk.
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | |
store_path | string |
locus_chunks_with_label
Return all chunk IDs that carry a given annotation label.
| Parameter | Type | Description |
|---|---|---|
label * | string | |
store_path | string |
locus_mark_relevant
Mark a chunk as relevant for a query. Persists a +0.25 boost that the reranker applies on future retrieve calls for the same query. Use after a successful retrieval to reinforce good results.
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | |
query * | string | |
store_path | string |
locus_mark_irrelevant
Mark a chunk as irrelevant for a query. Persists a -0.40 penalty that the reranker applies on future retrieve calls for the same query. Use to suppress consistently bad results.
| Parameter | Type | Description |
|---|---|---|
chunk_id * | string | |
query * | string | |
store_path | string |