Skip to main content

Module context

Module context 

Source
Expand description

Context Provider Extension Point

This module provides the extension point for integrating context databases like OpenViking into the agent loop. Context providers can supply memory, resources, and skills to augment the LLM’s context.

§Usage

Implement the ContextProvider trait and register it with a session:

use a3s_code::context::{ContextProvider, ContextQuery, ContextResult};

struct MyProvider { /* ... */ }

#[async_trait::async_trait]
impl ContextProvider for MyProvider {
    fn name(&self) -> &str { "my-provider" }

    async fn query(&self, query: &ContextQuery) -> anyhow::Result<ContextResult> {
        // Retrieve relevant context...
    }
}

Re-exports§

pub use assembler::ContextAssembler;
pub use assembler::ContextAssembly;
pub use assembler::ContextAssemblyPolicy;
pub use assembler::ContextBudget;
pub use assembler::ContextSourcePolicy;
pub use fs_provider::FileSystemContextConfig;
pub use fs_provider::FileSystemContextProvider;
pub use ripgrep_provider::RipgrepContextConfig;
pub use ripgrep_provider::RipgrepContextProvider;
pub use static_provider::StaticContextProvider;

Modules§

assembler
Budgeted assembly for context items.
fs_provider
File System Context Provider
ripgrep_provider
Ripgrep Context Provider
static_provider
Static context provider for session-local context items.

Structs§

ContextItem
A single piece of retrieved context
ContextQuery
Query to a context provider
ContextResult
Result from a context provider query

Enums§

ContextDepth
Retrieval depth for tiered context (L0/L1/L2 pattern)
ContextType
Type of context being queried

Constants§

CONTEXT_FRESHNESS_METADATA
CONTEXT_PRIORITY_METADATA
CONTEXT_PROVENANCE_METADATA
CONTEXT_TRUST_METADATA

Traits§

ContextProvider
Context provider trait - implement this for OpenViking, RAG systems, etc.