Locus

v1.3.1
io.github.jmiaie/locus Checked 1 day ago Published 2 days ago

Vectorless 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.

ParameterTypeDescription
path *string
patternstring
store_pathstring

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).

ParameterTypeDescription
query *string
as_ofstringTemporal filter YYYY-MM-DD.
expansionstringLLM-free query expansion (RM3 pseudo-relevance feedback). Off by default.
filtersobjectRestrict 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_contentboolean
intentstring
limitinteger
modestringbm25 (default) or hybrid re-rank.
parentstringReturn 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_pathstring
trackbooleanRecord hits in the hot-context bulletin (set false for a pure read).
use_linksboolean

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.

ParameterTypeDescription
chunk_id *stringChunk ID from a prior locus_retrieve call.
querystringThe query to explain against (optional but recommended).
store_pathstring

locus_add_fact

Add a temporal fact (subject–predicate–object) to the KG.

ParameterTypeDescription
object *string
predicate *string
subject *string
sourcestring
store_pathstring
valid_fromstring
valid_tostring

locus_query_entity

Query all KG facts about an entity. Supports as_of temporal filter.

ParameterTypeDescription
entity *string
as_ofstring
store_pathstring

locus_kg_stats

Knowledge graph statistics.

ParameterTypeDescription
store_pathstring

locus_contradictions

Find contradicting KG triples: same subject+predicate, different objects, overlapping validity windows.

ParameterTypeDescription
entitystringOptional entity to scope.
store_pathstring

locus_add_alias

Register an entity alias so variant names resolve to the same canonical entity.

ParameterTypeDescription
alias *string
canonical *string
store_pathstring

locus_suggest_aliases

Suggest entity name pairs that may refer to the same entity (similarity-based).

ParameterTypeDescription
store_pathstring
thresholdnumber

locus_hot_context

Return the hot-tier bulletin board — frequently retrieved and pinned context.

ParameterTypeDescription
store_pathstring
token_limitinteger

locus_promote

Manually pin a chunk to Tier 0 (never auto-archived).

ParameterTypeDescription
chunk_id *string
store_pathstring

locus_session_start

Warm context open: corpus + KG + bulletin + resolver stats, hot-tier content.

ParameterTypeDescription
store_pathstring

locus_wrap_up

Session close: tick bulletin decay, return summary stats.

ParameterTypeDescription
store_pathstring

locus_status

Full status: corpus, KG, bulletin, budget, resolver.

ParameterTypeDescription
store_pathstring

locus_forget

Remove a document from the corpus.

ParameterTypeDescription
doc_path *string
store_pathstring

locus_sync

Full reindex: wipe and rebuild corpus + KG from a directory.

ParameterTypeDescription
path *string
patternstring
store_pathstring

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.

ParameterTypeDescription
query *string
as_ofstringTemporal filter YYYY-MM-DD.
limitinteger
rerankbooleanApply heuristic re-ranking after RRF.
store_pathstring
token_budgetintegerMax tokens for packed_context.

locus_cache_stats

Query cache statistics: size, hit rate, hits, misses.

ParameterTypeDescription
store_pathstring

locus_clear_cache

Manually invalidate the query result cache.

ParameterTypeDescription
store_pathstring

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.

ParameterTypeDescription
start *stringStarting entity name.
directionstring
max_depthinteger
predicate_filterarrayOnly follow these predicates.
store_pathstring

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.

ParameterTypeDescription
as_ofstringTemporal filter YYYY-MM-DD.
objstringObject pattern ('*' for any).
predicatestring
store_pathstring
subjectstring

locus_doctor

Run a health check on the Locus store. Checks corpus integrity, KG population, bulletin fill levels, entity resolver, store size, and version.

ParameterTypeDescription
store_pathstring

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.

ParameterTypeDescription
path *stringOutput file path.
formatstringExport format (auto from extension if omitted).
store_pathstring

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.

ParameterTypeDescription
vault_path *stringPath to the OMPA vault root.
patternstring
store_pathstring

locus_benchmark

Measure retrieval quality against a JSON QA file. Returns Recall@K and MRR. QA format: [{"query": "...", "expected_docs": ["path/to/doc.md"]}]

ParameterTypeDescription
qa_file *stringPath to JSON QA file.
k_valuesarray
store_pathstring

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.

ParameterTypeDescription
cluster_path *stringPath to cluster registry JSON.
query *string
as_ofstring
limitinteger
nodesarraySubset of node names. Omit for all.

locus_add_node

Register a named node (Locus store) in the cluster registry.

ParameterTypeDescription
cluster_path *string
name *stringNode name (e.g. 'jarv').
store_path *string

locus_remove_node

Unregister a node from the cluster (does not delete its store).

ParameterTypeDescription
cluster_path *string
name *string

locus_list_nodes

List all cluster nodes with their corpus and KG stats.

ParameterTypeDescription
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?'

ParameterTypeDescription
question *string
max_depthinteger
store_pathstring

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.

ParameterTypeDescription
entity_a *string
entity_b *string
max_depthinteger
predicate_filterarray
store_pathstring

locus_inspect

Inspect a document's corpus representation: chunk count, word count, top BM25 terms, entities, and internal wikilinks. Useful for debugging indexing quality.

ParameterTypeDescription
doc_path *string
limitinteger
store_pathstring

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.

ParameterTypeDescription
limitinteger
store_pathstring

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.

ParameterTypeDescription
repo *stringowner/repo
branchstring
pathstringSub-directory within repo.
patternstring
store_pathstring
tokenstringGitHub 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.

ParameterTypeDescription
query *string
max_expansionsinteger
store_pathstring

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.

ParameterTypeDescription
queries *arrayList of query variants.
as_ofstringTemporal filter YYYY-MM-DD.
limitinteger
store_pathstring

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.

ParameterTypeDescription
entity *string
as_ofstringTemporal filter YYYY-MM-DD.
store_pathstring

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.

ParameterTypeDescription
output_path *stringDestination archive path (e.g. backup.tar.gz).
store_pathstring

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.

ParameterTypeDescription
snapshot_path *stringPath to the .tar.gz archive.
overwriteboolean
store_pathstring

locus_snapshot_info

Inspect a snapshot archive: file list, archive size, uncompressed size.

ParameterTypeDescription
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.

ParameterTypeDescription
path *string
patternstring
store_pathstring

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.

ParameterTypeDescription
chunk_id *string
label *string
notestring
store_pathstring

locus_get_annotations

Return all labels and notes attached to a chunk.

ParameterTypeDescription
chunk_id *string
store_pathstring

locus_chunks_with_label

Return all chunk IDs that carry a given annotation label.

ParameterTypeDescription
label *string
store_pathstring

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.

ParameterTypeDescription
chunk_id *string
query *string
store_pathstring

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.

ParameterTypeDescription
chunk_id *string
query *string
store_pathstring