Skip to content

spt-reasoning-core

Core reasoning engine with pattern matching and similarity scoring

Overview

Provides the foundational types and algorithms for storing, retrieving, and analyzing reasoning patterns with adaptive learning capabilities. This is the base crate of the ReasoningBank system -- all other reasoning crates depend on it for core types like Pattern, VectorEmbedding, and ReasoningEngine.

Key Features

  • Pattern Matching -- Store and retrieve reasoning patterns with metadata and task outcomes
  • Similarity Scoring -- Vector embedding comparison via SimilarityMetrics
  • Compression Learning -- Track and analyze compressed Claude API call outcomes with CompressionTrajectory
  • Incremental Statistics -- Efficient running averages and trajectory aggregation
  • Configurable Engine -- ReasoningEngine with pluggable EngineConfig

Dependencies

Key internal dependencies: none (this is the leaf crate).

External: ndarray, ordered-float, uuid, chrono, serde.

Usage

rust
use spt_reasoning_core::{
    ReasoningEngine, EngineConfig, Pattern, PatternMetadata,
    SimilarityMetrics, VectorEmbedding,
    CompressionTrajectory, CompressionInsights,
};

let config = EngineConfig::default();
let engine = ReasoningEngine::new(config);

API Reference

Core Types

TypeDescription
ReasoningEngineMain engine for pattern matching and reasoning
EngineConfigConfiguration for the reasoning engine
PatternA stored reasoning pattern
PatternMetadataMetadata attached to a pattern
TaskOutcomeResult of a task execution
SimilarityMetricsScoring functions for vector similarity
VectorEmbeddingDense vector representation for patterns
CompressionTrajectoryRecords outcomes of compressed API requests
CompressionInsightsDerived recommendations from trajectory analysis
TrajectoryStatsAggregated statistics over trajectories
RunningAverageEfficient incremental averaging
ReasoningErrorError enum for all reasoning operations

Released under the MIT License.