Skip to main content

Crate brainwires_seal

Crate brainwires_seal 

Source
Expand description

SEAL (Self-Evolving Agentic Learning) Integration Module

This module implements techniques from the SEAL paper to enhance conversational question answering, semantic parsing, and self-evolving agent capabilities in brainwires-cli.

§Components

  • Coreference Resolution: Resolves pronouns and elliptical references (“it”, “the file”, “that function”) to concrete entities from dialog history.

  • Query Core Extraction: Extracts structured S-expression-like query cores from natural language for graph traversal and code understanding.

  • Self-Evolving Learning: Learns from successful interactions without retraining, building a library of effective patterns.

  • Reflection Module: Post-execution analysis and error correction to improve response quality.

§Architecture

User Input
    │
    ▼
┌─────────────────────────┐
│ Coreference Resolution  │──► Resolves "it", "the file", etc.
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│ Query Core Extraction   │──► Creates structured query
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│ Learning Coordinator    │──► Checks for learned patterns
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│   Query Execution       │──► Runs against RelationshipGraph
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│   Reflection Module     │──► Validates and corrects
└─────────────────────────┘

§Usage

use brainwires_seal::{SealProcessor, SealConfig};

let config = SealConfig::default();
let mut processor = SealProcessor::new(config);

// Process a user message with SEAL enhancements
let result = processor.process(
    "What uses it?",  // User's query with unresolved reference
    &dialog_state,
    &entity_store,
    Some(&relationship_graph),
)?;

// result.resolved_query might be: "What uses [main.rs]?"
// result.query_core might be: QueryCore { op: DependsOn, ... }

Re-exports§

pub use coreference::CoreferenceResolver;
pub use coreference::DialogState;
pub use coreference::ReferenceType;
pub use coreference::ResolvedReference;
pub use coreference::SalienceScore;
pub use coreference::UnresolvedReference;
pub use feedback_bridge::FeedbackBridge;
pub use feedback_bridge::FeedbackProcessingStats;
pub use knowledge_integration::EntityResolutionStrategy;
pub use knowledge_integration::IntegrationConfig;
pub use knowledge_integration::SealKnowledgeCoordinator;
pub use learning::GlobalMemory;
pub use learning::LearningCoordinator;
pub use learning::LocalMemory;
pub use learning::PatternHint;
pub use learning::QueryPattern;
pub use learning::TrackedEntity;
pub use query_core::FilterPredicate;
pub use query_core::QueryCore;
pub use query_core::QueryCoreExtractor;
pub use query_core::QueryExpr;
pub use query_core::QueryOp;
pub use query_core::QueryResult;
pub use query_core::QuestionType;
pub use query_core::RelationType;
pub use query_core::SuperlativeDir;
pub use reflection::CorrectionRecord;
pub use reflection::ErrorType;
pub use reflection::Issue;
pub use reflection::ReflectionConfig;
pub use reflection::ReflectionModule;
pub use reflection::ReflectionReport;
pub use reflection::Severity;
pub use reflection::SuggestedFix;

Modules§

coreference
Coreference Resolution for Multi-Turn Conversations
feedback_bridge
Feedback Bridge — AuditLogger to SEAL Learning Loop
knowledge_integration
SEAL + Knowledge System Integration
learning
Self-Evolving Learning Mechanism
pattern_store
LanceDB-backed pattern store for SEAL self-evolving learning.
query_core
Semantic Query Core Extraction
reflection
Reflection Module for Error Detection and Correction

Structs§

SealConfig
Configuration for the SEAL processor
SealProcessingResult
Result of SEAL processing pipeline
SealProcessor
Main SEAL processor that orchestrates all components