config

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChunkSize is the default character count per text chunk for indexing.
	DefaultChunkSize = 512

	// DefaultChunkOverlap is the default character overlap between adjacent chunks.
	DefaultChunkOverlap = 64

	// DefaultDedupThreshold is the default cosine similarity threshold for deduplication.
	DefaultDedupThreshold = 0.92
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig added in v0.4.0

type APIConfig struct {
	ListenAddr string `mapstructure:"listen_addr"`
	AuthToken  string `mapstructure:"auth_token"`
}

APIConfig holds HTTP API server settings.

type CaptureQualityConfig added in v0.4.0

type CaptureQualityConfig struct {
	ContextWindowTurns           int      `mapstructure:"context_window_turns"`
	ReinforcementThreshold       float64  `mapstructure:"reinforcement_threshold"`
	ReinforcementConfidenceBoost float64  `mapstructure:"reinforcement_confidence_boost"`
	MinUserMessageLength         int      `mapstructure:"min_user_message_length"`
	MinAssistantMessageLength    int      `mapstructure:"min_assistant_message_length"`
	BlocklistPatterns            []string `mapstructure:"blocklist_patterns"`
}

CaptureQualityConfig controls capture extraction quality.

type ClaudeConfig

type ClaudeConfig struct {
	APIKey string `mapstructure:"api_key"`
	Model  string `mapstructure:"model"`
}

ClaudeConfig holds Anthropic Claude API settings.

func (ClaudeConfig) String added in v0.4.0

func (c ClaudeConfig) String() string

String returns a safe representation of ClaudeConfig with the API key masked.

type Config

type Config struct {
	Qdrant         QdrantConfig         `mapstructure:"qdrant"`
	Ollama         OllamaConfig         `mapstructure:"ollama"`
	Claude         ClaudeConfig         `mapstructure:"claude"`
	Memory         MemoryConfig         `mapstructure:"memory"`
	Logging        LoggingConfig        `mapstructure:"logging"`
	API            APIConfig            `mapstructure:"api"`
	Embedder       EmbedderConfig       `mapstructure:"embedder"`
	Recall         RecallConfig         `mapstructure:"recall"`
	CaptureQuality CaptureQualityConfig `mapstructure:"capture_quality"`
}

Config holds all configuration for cortex.

func Load

func Load() (*Config, error)

Load reads configuration from file and environment variables.

func (*Config) Validate added in v0.4.0

func (c *Config) Validate() error

Validate checks that required configuration fields are set and consistent.

type EmbedderConfig added in v0.4.0

type EmbedderConfig struct {
	// Provider selects the embedding backend: "ollama" (default) or "openai".
	Provider string `mapstructure:"provider"`

	// OpenAIKey is the OpenAI API key. May also be supplied via OPENCLAW_CORTEX_OPENAI_API_KEY.
	OpenAIKey string `mapstructure:"openai_api_key"`

	// OpenAIModel is the OpenAI embedding model. Defaults to "text-embedding-3-small".
	OpenAIModel string `mapstructure:"openai_model"`

	// OpenAIDim is the number of dimensions requested from the OpenAI API.
	// Defaults to 768 to maintain compatibility with existing Qdrant collections.
	OpenAIDim int `mapstructure:"openai_dimensions"`
}

EmbedderConfig selects which embedding provider to use and holds provider-specific settings.

func (EmbedderConfig) String added in v0.4.0

func (c EmbedderConfig) String() string

String returns a safe representation of EmbedderConfig with the API key masked.

type LoggingConfig

type LoggingConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
}

LoggingConfig holds structured logging settings.

type MemoryConfig

type MemoryConfig struct {
	MemoryDir          string  `mapstructure:"memory_dir"`
	ChunkSize          int     `mapstructure:"chunk_size"`
	ChunkOverlap       int     `mapstructure:"chunk_overlap"`
	DedupThreshold     float64 `mapstructure:"dedup_threshold"`
	DedupThresholdHook float64 `mapstructure:"dedup_threshold_hook"` // default 0.95
	DefaultTTLHours    int     `mapstructure:"default_ttl_hours"`
	VectorDimension    uint64  `mapstructure:"vector_dimension"`
}

MemoryConfig holds memory indexing and deduplication settings.

type OllamaConfig

type OllamaConfig struct {
	BaseURL string `mapstructure:"base_url"`
	Model   string `mapstructure:"model"`
}

OllamaConfig holds Ollama embedding service settings.

type QdrantConfig

type QdrantConfig struct {
	Host       string `mapstructure:"host"`
	GRPCPort   int    `mapstructure:"grpc_port"`
	HTTPPort   int    `mapstructure:"http_port"`
	Collection string `mapstructure:"collection"`
	UseTLS     bool   `mapstructure:"use_tls"`
}

QdrantConfig holds Qdrant vector database connection settings.

type RecallConfig added in v0.4.0

type RecallConfig struct {
	RerankScoreSpreadThreshold float64             `mapstructure:"rerank_score_spread_threshold"`
	RerankLatencyBudgetHooksMs int                 `mapstructure:"rerank_latency_budget_hooks_ms"`
	RerankLatencyBudgetCLIMs   int                 `mapstructure:"rerank_latency_budget_cli_ms"`
	Weights                    RecallWeightsConfig `mapstructure:"weights"`
}

RecallConfig holds re-ranking and latency budget settings for recall.

type RecallWeightsConfig added in v0.4.0

type RecallWeightsConfig struct {
	Similarity    float64 `mapstructure:"similarity"`
	Recency       float64 `mapstructure:"recency"`
	Frequency     float64 `mapstructure:"frequency"`
	TypeBoost     float64 `mapstructure:"type_boost"`
	ScopeBoost    float64 `mapstructure:"scope_boost"`
	Confidence    float64 `mapstructure:"confidence"`
	Reinforcement float64 `mapstructure:"reinforcement"`
	TagAffinity   float64 `mapstructure:"tag_affinity"`
}

RecallWeightsConfig holds the scoring weights for the recall ranking formula.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL