Skip to contents

Core API

Primary user-facing functions for building a project graph, querying it for LLM context, and generating static instructions.

build_rrlm_graph()
Build an RLM-Graph for an R project
query_context()
Query the rrlm graph and retrieve a token-budgeted context
chat_with_context()
Chat with an LLM using graph-derived context
generate_instructions()
Generate a Copilot-style instruction file from the project graph
update_graph_incremental()
Incrementally update the graph for changed files

Graph Construction

Parse R source files into nodes and edges.

detect_rproject()
Detect an R project type and discover its files
extract_function_nodes()
Extract function nodes from R source files
build_call_edges()
Build CALLS edges between function nodes
build_import_edges()
Build IMPORTS edges from R files to package dependencies
build_test_edges()
Build TEST edges from test files to user-defined functions
build_co_change_edges()
Build CO_CHANGES edges from git commit history
build_dispatch_edges()
Build DISPATCHES_ON and EXTENDS edges for OOP patterns
find_calls_in_body()
Find function calls within an R function body
embed_nodes()
Embed function nodes with TF-IDF, Ollama, or OpenAI vectors
embed_query()
Embed a free-text query into the model's vector space
build_node_context()
Build a text representation of a single graph node
assemble_context_string()
Assemble a structured, LLM-ready context string from ranked hits
compute_relevance()
Compute composite relevance score for a graph node
cosine_similarity()
Compute cosine similarity between two numeric vectors

Caching & Persistence

Save, load, and export the graph.

save_graph_cache()
Save an rrlm_graph to a local cache directory
load_graph_cache()
Load an rrlm_graph from a local cache
is_cache_stale()
Check whether the graph cache is stale
export_to_sqlite()
Export an rrlm_graph to a SQLite database

Task Trace

Record and weight LLM interaction feedback.

log_task_trace()
Log a task-trace entry to the JSONL feedback file
update_task_weights()
Update task-trace weights on graph vertices
update_task_polarity()
Update the polarity of recent task-trace entries

Utilities

ollama_available()
Check whether Ollama is available

S3 Methods

Print, summary, and plot for rrlm_graph / rrlm_context.

print(<rrlm_graph>)
Print a compact one-line summary of an rrlm_graph
summary(<rrlm_graph>)
Detailed summary of an rrlm_graph
plot(<rrlm_graph>)
Plot an rrlm_graph
print(<rrlm_context>)
Print an rrlm_context object
summary(<rrlm_context>)
Summarise an rrlm_context object