Skip to main content

rto_graph/
lib.rs

1//! Provenance-tagged knowledge graph store.
2//!
3//! Every edge in a Roteiro graph carries a [`Provenance`] tag recording how it
4//! was produced: deterministically derived from source ASTs, authored by a
5//! human or agent in an ADR/blueprint, or inferred heuristically from docs and
6//! other artifacts. See ADR-0001.
7//!
8//! The graph is a set of [`Node`]s addressed by a deterministic natural
9//! [`Node::key`], connected by [`Edge`]s. Facts extracted from one source blob
10//! are grouped into a [`FactSet`] and applied atomically to a [`Store`].
11//!
12//! @rto:0001
13
14mod artifact;
15// Audio metadata (ADR-0016): codec, rate, bit depth, channels, duration and tags,
16// read from the container without decoding and without a model. Unlike the media
17// module below, these *are* `derived` facts and do live in `nodes`/`edges` — the
18// complement of ADR-0015 rather than an exception to it.
19#[cfg(feature = "audio-metadata")]
20pub mod audio;
21mod cache;
22mod codegraph;
23mod config_keys;
24mod context;
25// The holder for the media extractors' process-wide native engines — and the
26// deterministic release that keeps a Metal build from aborting at exit (#291) —
27// now lives one level down, next to the llama.cpp backend that shares the same
28// mechanism: `rto_llama::EngineSlot` (#296).
29mod extract;
30// Analyzer findings (ADR-0012): a *separate* artifact store, deliberately not a
31// provenance class and deliberately not in `nodes`/`edges`.
32mod findings;
33mod git;
34#[cfg(feature = "inference")]
35mod infer;
36mod links;
37mod markers;
38// Generated media content (ADR-0015): ASR transcripts and VLM descriptions. Like
39// findings, a *separate* artifact store — generated text is not a deterministic
40// function of the bytes, so it is not a `derived` fact and never enters
41// `nodes`/`edges`.
42pub mod media;
43// Episodic agent memory (ADR-0013): what a session learned, which has no
44// generating function at all — so it is neither `derived` nor `authored`, and it
45// gets a *separate* artifact store on the same terms as findings and media.
46mod memory;
47mod migrations;
48mod model;
49// Which model serves which task, and **why** (Stage 33). Deliberately in *this*
50// crate: `gix` is pinned here without transports, so a resolver that decides
51// which model runs structurally cannot grow a "check for a newer one" call.
52#[cfg(feature = "models")]
53pub mod model_choice;
54#[cfg(feature = "models")]
55mod models;
56mod provenance;
57mod query;
58// Stage 35 — the adjudicated review corpus, and the two pure decisions made over
59// it. In *this* crate for the same reason `model_choice` is: `gix` is pinned here
60// without transports, and both a historical record that must not be "refreshed
61// from the GitHub API" and a suppression rule that must not "just ask CI" are
62// precisely the code that would otherwise acquire such a call.
63pub mod compile_claim;
64pub mod review_corpus;
65pub mod review_score;
66// Stage 35b — the reviewer's judgement, which is likewise pure: prompt assembly,
67// response parsing and the compile-claim site derivation are functions of bytes,
68// so what the reviewer *decides* is testable with no model and no network. The
69// loop that calls an engine is in the binary, where the engine already is.
70pub mod reviewer;
71mod store;
72mod sync;
73mod text;
74// Whether a producer's identity is measured or asserted (ADR-0019 §5). In *this*
75// crate rather than in `rto-remote` because `rto-remote` depends on this one, so
76// `ModelSource::Remote` cannot name a type that lives there — and because the
77// grade qualifies `Producer`, which is here. Two variants and a sentence: it
78// brings no transport with it.
79pub mod trust;
80mod workspace;
81
82pub use artifact::{ARTIFACT_SCHEMA, GraphArtifact};
83#[cfg(feature = "audio-metadata")]
84pub use audio::{AUDIO_STREAM_KIND, AudioDuration, AudioFacts, AudioTag, Exactness};
85pub use cache::{CacheError, ObjectCache, ObjectSweep};
86pub use codegraph::{ORACLE_SCHEMA, OracleError, OracleReport, compare as compare_codegraph};
87pub use config_keys::{
88    ConfigKey, canonicalize as canonicalize_config_key, flatten as flatten_config, is_config_path,
89    is_secret_key, is_tooling_config_path, normalize as normalize_config_key,
90};
91pub use context::{
92    BoundedEdges, ContextEdge, ContextNode, ContextRefresh, NodeContext, OmittedEdges,
93    TOOL_CONTEXT_EDGE_CAP, ToolContext, build_context, context, dependents, refresh_contexts,
94    tool_context,
95};
96pub use extract::{
97    Extractor, FileNodeExtractor, IngestConfig, MediaEngineGuard, Registry, RustExtractor,
98    cap_content, is_prose, release_media_engines,
99};
100pub use findings::{
101    AdvisoryDb, AnalysisRun, CommandPolicy, EnvironmentPolicy, FINDING_KEY_PREFIX, Finding,
102    FindingKey, FindingsApplied, FindingsError, FindingsLayer, Isolation, MAX_ANALYZER_ID,
103    MAX_IDENTITY_PART, NetworkPolicy, RunnerKind, SECURITY_LAYER_PREFIX, Severity, SourceIdentity,
104    WorktreeAccess, WorktreeId, analyzer_id_error, is_valid_analyzer_id, layer_key,
105};
106pub use git::{BlobRef, ChangeStatus, ChangedFile, GitError, GraphSource, Repo, Submodule};
107#[cfg(feature = "inference")]
108pub use infer::{
109    DuplicateConfig, DuplicatePair, DuplicateReport, EMBED_REF, Embedder, HashEmbedder,
110    InferenceConfig, duplicates, duplicates_with, embed, infer_edges, infer_edges_with, similarity,
111};
112pub use links::{
113    EXTERNAL_REF_KIND, LINKS_REF, external_ref_key, external_ref_node, external_ref_target,
114};
115pub use media::{
116    CandidateCount, GateReason, GateThresholds, GeneratedContent, MAX_MODEL_ID, MAX_PROMPT,
117    MEDIA_PRODUCER_PREFIX, MEDIA_SCHEMA, MediaBlob, MediaBuildOptions, MediaBuildReport,
118    MediaError, MediaFilter, MediaKind, MediaOutcome, MediaProducer, MediaRecord, MediaSkip,
119    MediaStatus, MediaWrite, Producer, ProducerId, ProducerSummary, ProducerSummaryAvailable,
120    SkipEntry, build_media, is_valid_model_id, media_blobs, status as media_status,
121};
122pub use memory::{
123    AnchorState, CACHE_BUDGET_ENV, CACHE_SCHEMA, CacheEntry, CacheStats, CacheSweep, CacheWrite,
124    DEFAULT_BASE_CONFIDENCE, DEFAULT_CACHE_BUDGET_BYTES, DEFAULT_DECAY_SPAN, DEFAULT_HALF_LIFE,
125    DEFAULT_MEMORY_SCOPE, Decay, MAX_MEMORY_BODY, MAX_MEMORY_SCOPE, MEMORY_SCHEMA, MemoryAnchor,
126    MemoryError, MemoryFilter, MemoryForgotten, MemoryKind, MemoryListing, MemoryRecord,
127    MemoryWrite, RECALL_SCHEMA, Recall, RecallOptions, Recalled, anchor_penalty,
128    cache_budget_bytes,
129};
130pub use model::{Direction, Edge, EdgeKind, FactSet, Node, NodeKind, Span};
131#[cfg(feature = "models")]
132pub use model_choice::{
133    DEFAULT_GENERATIVE, DEFAULT_OCR, ModelChoice, ModelChoiceError, ModelPins, ModelSource,
134    ModelTask, RemoteTier, TASKS as MODEL_TASKS, resolve as resolve_model,
135    resolve_all_with as resolve_models, resolve_with as resolve_model_with,
136    resolve_with_remote as resolve_model_with_remote, set_model_pins,
137};
138#[cfg(feature = "models")]
139pub use models::{
140    DownloadError, DownloadEvent, ModelFile, ModelKind, ModelRole, ModelSpec, ModelVariant,
141    Platform, REGISTRY, RangeKind, RangeReply, Removal, ResourceTier, discard_partial,
142    download_resumable, download_verified, ensure_model_dir, find as find_model, installed_size,
143    interpret_range_response, is_installed, model_dir, partial_meta_path, partial_path,
144    remove_model, set_model_store, sha256_hex, store_root, verify_sha256,
145};
146pub use provenance::Provenance;
147pub use query::{
148    ConfigSecretItem, ConfigSecretReport, CouplingItem, CouplingOrder, CouplingReport,
149    DEFAULT_MIN_LINES, DebtDensityReport, DebtItem, DebtReport, DensityItem, DensityOrder, EdgeRef,
150    Explanation, GeneratedHit, Listing, MemoryHit, NodeSummary, Path, PathHop, RedactionState,
151    SCHEMA, SearchHit, SearchOptions, SearchResults, config_secrets, coupling, debt, debt_density,
152    explain, list_kind, path, search, search_channels, window,
153};
154pub use store::{ImportApplied, SchemaAhead, Store, StoreError};
155pub use sync::{
156    DEFAULT_KEEP_GENERATIONS, ReclaimReport, SyncError, SyncReport, sweep_superseded, sync,
157    sync_index, sync_tree, sync_worktree,
158};
159pub use text::{first_h1, heading_text, markdown_dialect, slugify};
160pub use trust::ProducerTrust;
161pub use workspace::{
162    Follow, ResolvedWorkspace, Workspace, WorkspaceError, WorkspaceSet, discover_repos_under,
163    parse_qualified,
164};