pub mod file;
pub mod mcp;
use super::Lesson;
use crate::config::Config;
use anyhow::Result;
use async_trait::async_trait;
#[async_trait]
pub trait LearningBackend: Send + Sync {
async fn store(&self, lesson: &Lesson, config: &Config) -> Result<()>;
async fn retrieve(
&self,
patterns: &[String],
role: &str,
project: &str,
limit: usize,
config: &Config,
) -> Result<Vec<Lesson>>;
async fn retrieve_all(&self, role: &str, project: &str, config: &Config)
-> Result<Vec<Lesson>>;
}
pub fn create_backend(config: &super::LearningConfig) -> Box<dyn LearningBackend> {
match config.backend.as_str() {
"mcp" => Box::new(mcp::McpBackend::new(config)),
_ => Box::new(file::FileBackend),
}
}