Skip to main content

ContextColumn

Trait ContextColumn 

Source
pub trait ContextColumn: Send + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn display_name(&self) -> &'static str;
    fn is_active(&self) -> bool;
    fn ingest(
        &self,
        query: &str,
        ctx: &ColumnContext,
    ) -> Result<ColumnInput, String>;

    // Provided methods
    fn compress(
        &self,
        input: &ColumnInput,
        ctx: &ColumnContext,
    ) -> Result<ColumnCompressed, String> { ... }
    fn verify(
        &self,
        compressed: &ColumnCompressed,
        ctx: &ColumnContext,
    ) -> Result<ColumnOutput, String> { ... }
    fn process(
        &self,
        query: &str,
        ctx: &ColumnContext,
    ) -> Result<ColumnOutput, String> { ... }
}
Expand description

The cortical column trait — uniform processing pipeline for any data source.

Each implementation represents one “column” in the cortex: filesystem, GitHub, Jira, PostgreSQL, etc. All columns share the same interface but process different input modalities.

Required Methods§

Source

fn id(&self) -> &'static str

Unique column identifier (matches provider ID for external columns).

Source

fn display_name(&self) -> &'static str

Human-readable name for discovery/logging.

Source

fn is_active(&self) -> bool

Whether this column is currently operational.

Source

fn ingest( &self, query: &str, ctx: &ColumnContext, ) -> Result<ColumnInput, String>

L4 (Input Layer): Ingest raw data and produce ContentChunks.

For filesystem: read file, parse AST, extract chunks. For GitHub: fetch API, parse JSON, normalize to chunks. For DB: query schema/data, structure as chunks.

Provided Methods§

Source

fn compress( &self, input: &ColumnInput, ctx: &ColumnContext, ) -> Result<ColumnCompressed, String>

L2/3 (Predictive Compression): Compress chunks based on task context.

Uses the mode predictor (Thompson Sampling) to select the optimal compression mode, then applies it. The prediction compares expected vs actual information content (predictive coding).

Source

fn verify( &self, compressed: &ColumnCompressed, ctx: &ColumnContext, ) -> Result<ColumnOutput, String>

L5 (Output + Verification): Validate output, check budget, discover hints.

Ensures the compressed output meets quality thresholds and stays within the token budget. Also discovers cross-source hints by checking chunk references against the graph index.

Source

fn process( &self, query: &str, ctx: &ColumnContext, ) -> Result<ColumnOutput, String>

Full pipeline: L4 → L2/3 → L5, with L6 context flowing top-down.

Convenience method that chains all layers. Override individual layers for custom behavior per column.

Implementors§