pub trait KnowledgeBase: Send + Sync {
Show 15 methods
// Required methods
fn record(&mut self, experiment: ExperimentRecord) -> Result<()>;
fn all(&self) -> Result<Vec<ExperimentRecord>>;
fn len(&self) -> usize;
// Provided methods
fn refresh(&mut self) -> Result<usize> { ... }
fn is_empty(&self) -> bool { ... }
fn get(&self, id: &str) -> Result<Option<ExperimentRecord>> { ... }
fn search(
&self,
query: &str,
max_results: usize,
) -> Result<Vec<ExperimentRecord>> { ... }
fn retrieve(&self, query: &RetrievalQuery) -> Result<Vec<ScoredRecord>> { ... }
fn lineage(&self, id: &str) -> Result<Option<Lineage>> { ... }
fn experiments_in_line(&self, line: &str) -> Result<Vec<ExperimentRecord>> { ... }
fn research_lines(&self) -> Result<Vec<ResearchLine>> { ... }
fn promising_lines(&self, metric: &str) -> Result<Vec<ResearchLine>> { ... }
fn trajectory(&self, line: &str, metric: &str) -> Result<Vec<(String, f64)>> { ... }
fn change_points(
&self,
line: &str,
metric: &str,
threshold: f64,
) -> Result<Vec<ChangePoint>> { ... }
fn children(&self, experiment_id: &str) -> Result<Vec<ExperimentRecord>> { ... }
}Expand description
Trait for knowledge base backends.
Required Methods§
Sourcefn record(&mut self, experiment: ExperimentRecord) -> Result<()>
fn record(&mut self, experiment: ExperimentRecord) -> Result<()>
Store a new experiment record.
Sourcefn all(&self) -> Result<Vec<ExperimentRecord>>
fn all(&self) -> Result<Vec<ExperimentRecord>>
Every record this base holds, in insertion order.
Provided Methods§
Sourcefn refresh(&mut self) -> Result<usize>
fn refresh(&mut self) -> Result<usize>
Pick up records another process appended since this handle was opened. Returns how many were newly loaded.
Defaults to a no-op for bases with nothing behind them. A long-lived reader (the MCP server) must call this before a read, or it answers from a snapshot that gets staler by the hour.
Sourcefn get(&self, id: &str) -> Result<Option<ExperimentRecord>>
fn get(&self, id: &str) -> Result<Option<ExperimentRecord>>
Get an experiment by ID.
Sourcefn search(
&self,
query: &str,
max_results: usize,
) -> Result<Vec<ExperimentRecord>>
fn search( &self, query: &str, max_results: usize, ) -> Result<Vec<ExperimentRecord>>
Substring search over name, hypothesis, notes, tags and pipeline.
Kept as a cheap literal filter; retrieve is
the ranked one.
Sourcefn retrieve(&self, query: &RetrievalQuery) -> Result<Vec<ScoredRecord>>
fn retrieve(&self, query: &RetrievalQuery) -> Result<Vec<ScoredRecord>>
Rank records against a query by relevance, structure, recency
and importance. See crate::retrieval for the formula.
Sourcefn lineage(&self, id: &str) -> Result<Option<Lineage>>
fn lineage(&self, id: &str) -> Result<Option<Lineage>>
An experiment with its ancestors and descendants.
Sourcefn experiments_in_line(&self, line: &str) -> Result<Vec<ExperimentRecord>>
fn experiments_in_line(&self, line: &str) -> Result<Vec<ExperimentRecord>>
List experiments in a research line, ordered chronologically.
Sourcefn research_lines(&self) -> Result<Vec<ResearchLine>>
fn research_lines(&self) -> Result<Vec<ResearchLine>>
Get all research lines with trend analysis.
Sourcefn promising_lines(&self, metric: &str) -> Result<Vec<ResearchLine>>
fn promising_lines(&self, metric: &str) -> Result<Vec<ResearchLine>>
Find promising research lines (improving trend, high metric values).
Sourcefn trajectory(&self, line: &str, metric: &str) -> Result<Vec<(String, f64)>>
fn trajectory(&self, line: &str, metric: &str) -> Result<Vec<(String, f64)>>
Get the metric trajectory for a research line.
Sourcefn change_points(
&self,
line: &str,
metric: &str,
threshold: f64,
) -> Result<Vec<ChangePoint>>
fn change_points( &self, line: &str, metric: &str, threshold: f64, ) -> Result<Vec<ChangePoint>>
Detect change points where metrics shifted significantly.
Sourcefn children(&self, experiment_id: &str) -> Result<Vec<ExperimentRecord>>
fn children(&self, experiment_id: &str) -> Result<Vec<ExperimentRecord>>
Direct children of an experiment.