pub mod claude_code;
pub mod claude_memory;
pub mod cursor;
mod persist;
pub mod session_evidence;
pub use persist::{IngestStore, StoreOutcome, store_ingest_result};
use std::path::Path;
use anyhow::Result;
use second_brain_core::schema::{Conversation, Memory};
pub fn project_slug(projects_root: &Path, transcript: &Path) -> Option<String> {
transcript
.strip_prefix(projects_root)
.ok()?
.components()
.next()
.map(|c| c.as_os_str().to_string_lossy().to_string())
}
pub trait Adapter: Send + Sync {
fn name(&self) -> &str;
fn discover_conversations(&self) -> Result<Vec<ConversationSource>>;
fn ingest_conversation(&self, source: &ConversationSource) -> Result<IngestResult>;
fn session_key(&self, _path: &Path, _content: &str) -> Option<String> {
None
}
}
#[derive(Debug, Clone)]
pub struct ConversationSource {
pub id: String,
pub path: String,
pub source_name: String,
pub machine_id: String,
}
#[derive(Debug, Clone)]
pub struct ExtractedEntity {
pub name: String,
pub entity_type: String,
}
#[derive(Debug, Clone)]
pub struct IngestResult {
pub conversation: Conversation,
pub memories: Vec<Memory>,
pub entities: Vec<(ExtractedEntity, uuid::Uuid)>,
pub entities_extracted: usize,
}