pub struct KnowledgeLens { /* private fields */ }Expand description
KnowledgeLens — semantic overlay over KnowledgeBase.
Owns the HNSW index (via MemoryManager) and keeps it synchronized with the markdown knowledge base via file-change callbacks.
Implementations§
Source§impl KnowledgeLens
impl KnowledgeLens
Sourcepub fn new(kb: Arc<KnowledgeBase>, memory: Arc<MemoryManager>) -> Result<Self>
pub fn new(kb: Arc<KnowledgeBase>, memory: Arc<MemoryManager>) -> Result<Self>
Create a new KnowledgeLens wrapping the given knowledge base.
Registers a file-change callback to keep the memory index in sync.
Sourcepub fn knowledge_base(&self) -> &Arc<KnowledgeBase> ⓘ
pub fn knowledge_base(&self) -> &Arc<KnowledgeBase> ⓘ
Get the underlying knowledge base (read-only access).
Sourcepub fn mark_agent_write(&self, path: &str)
pub fn mark_agent_write(&self, path: &str)
Mark a file as having been written by an agent.
Sourcepub fn is_agent_write(&self, path: &str) -> bool
pub fn is_agent_write(&self, path: &str) -> bool
Check if a file was written by an agent.
Sourcepub fn clear_agent_write(&self, path: &str)
pub fn clear_agent_write(&self, path: &str)
Clear the agent-write marker for a file.
Sourcepub async fn recall_for_context(
&self,
query: &str,
limit: usize,
) -> Result<KnowledgeContext>
pub async fn recall_for_context( &self, query: &str, limit: usize, ) -> Result<KnowledgeContext>
Recall relevant knowledge for a given context/query.
Combines markdown note search (via KnowledgeBase) with agent memory search (via MemoryManager). Returns notes ranked by relevance.
Sourcepub async fn copilot_chat(
&self,
engine: Arc<dyn EngineProvider>,
model_id: &str,
question: &str,
context_path: Option<&str>,
) -> Result<CopilotResponse>
pub async fn copilot_chat( &self, engine: Arc<dyn EngineProvider>, model_id: &str, question: &str, context_path: Option<&str>, ) -> Result<CopilotResponse>
Copilot chat — AI-powered question answering about the knowledge base.
This method is async (uses provider.stream() which is Send).