Skip to main content

Crate brainwires_cognition

Crate brainwires_cognition 

Source
Expand description

§Brainwires Cognition — Unified Intelligence Layer

This crate consolidates three previously separate crates into a single coherent intelligence layer for the Brainwires Agent Framework:

§Knowledge (from brainwires-brain)

  • BrainClient — Persistent thought storage with semantic search
  • Entity/Relationship Graph — Entity types, co-occurrence, impact analysis
  • BKS — Behavioral Knowledge System (shared truths with confidence scoring)
  • PKS — Personal Knowledge System (user-scoped facts)
  • Fact Extraction — Automatic categorization and tag extraction

§Prompting (from brainwires-prompting)

  • Techniques — 15 prompting techniques from the adaptive selection paper
  • Clustering — K-means task clustering by semantic similarity
  • Generator — Dynamic prompt generation with BKS/PKS/SEAL integration
  • Learning — Technique effectiveness tracking and BKS promotion
  • Temperature — Adaptive temperature optimization per cluster

§RAG (from brainwires-rag)

  • RagClient — Core semantic code search with hybrid BM25+vector search
  • Embedding — FastEmbed (all-MiniLM-L6-v2) local embedding generation
  • Indexer — File walking, AST-based chunking for 12 languages
  • Git Search — Semantic search over commit history
  • Documents — PDF, markdown, and plaintext document processing

§Spectral

  • SpectralReranker — MSS-inspired log-det maximization for diverse retrieval
  • GraphOps — Laplacian, Fiedler vector, spectral clustering, sparsification
  • Kernel — Relevance-weighted kernel matrix construction
  • Linalg — Cholesky decomposition and log-determinant computation

§Code Analysis

  • RepoMap — AST-based symbol extraction (definitions, references)
  • Relations — Call graph generation, definition/reference lookup
  • Storage — LanceDB persistence for code relations

Re-exports§

pub use knowledge::brain_client::BrainClient;
pub use knowledge::entity::ContradictionEvent;
pub use knowledge::entity::ContradictionKind;
pub use knowledge::entity::Entity;
pub use knowledge::entity::EntityStore;
pub use knowledge::entity::EntityStoreStats;
pub use knowledge::entity::ExtractionResult;
pub use knowledge::entity::Relationship;
pub use knowledge::relationship_graph::EntityContext;
pub use knowledge::relationship_graph::RelationshipGraph;
pub use knowledge::thought::Thought;
pub use knowledge::thought::ThoughtCategory;
pub use knowledge::thought::ThoughtSource;
pub use knowledge::types::CaptureThoughtRequest;
pub use knowledge::types::CaptureThoughtResponse;
pub use knowledge::types::DeleteThoughtRequest;
pub use knowledge::types::DeleteThoughtResponse;
pub use knowledge::types::GetThoughtRequest;
pub use knowledge::types::GetThoughtResponse;
pub use knowledge::types::ListRecentRequest;
pub use knowledge::types::ListRecentResponse;
pub use knowledge::types::MemoryStatsRequest;
pub use knowledge::types::MemoryStatsResponse;
pub use knowledge::types::SearchKnowledgeRequest;
pub use knowledge::types::SearchKnowledgeResponse;
pub use knowledge::types::SearchMemoryRequest;
pub use knowledge::types::SearchMemoryResponse;
pub use prompting::clustering::TaskCluster;
pub use prompting::clustering::TaskClusterManager;
pub use prompting::clustering::cosine_similarity;
pub use prompting::generator::GeneratedPrompt;
pub use prompting::generator::PromptGenerator;
pub use prompting::learning::ClusterSummary;
pub use prompting::learning::PromptingLearningCoordinator;
pub use prompting::learning::TechniqueStats;
pub use prompting::library::TechniqueLibrary;
pub use prompting::seal::SealProcessingResult;
pub use prompting::techniques::ComplexityLevel;
pub use prompting::techniques::PromptingTechnique;
pub use prompting::techniques::TaskCharacteristic;
pub use prompting::techniques::TechniqueCategory;
pub use prompting::techniques::TechniqueMetadata;
pub use prompting::temperature::TemperatureOptimizer;
pub use prompting::temperature::TemperaturePerformance;
pub use brainwires_core;

Modules§

knowledge
Knowledge graph, entities, thoughts, BKS/PKS, brain client.
prelude
Prelude for convenient imports.
prompting
Adaptive prompting techniques, clustering, temperature optimization. Adaptive Prompting Techniques

Structs§

GraphEdge
An edge in the relationship graph.
GraphNode
A node in the relationship graph.

Enums§

EdgeType
Types of edges in the relationship graph.
EntityType
Types of entities tracked in the knowledge graph.