meshcfg

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package meshcfg reads and writes a solo vault's local embedding config at <vault>/.mesh/config.toml. It is the solo counterpart to a team vault's hub-authoritative mesh.toml: it pins the embedding endpoint/model/dim so `mesh search`, `mesh mcp`, and friends work without re-exporting env vars every session. Environment variables always override the file (the file is a fallback, never an authority), and secrets are never stored: key_env names the env var that holds the bearer key, it does not hold the key itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(meshDir string, e Embedding) error

Save writes the [embedding] section, preserving any other sections already in the file. Kept for the `mesh embed` caller; new callers should use SaveConfig.

func SaveConfig

func SaveConfig(meshDir string, c Config) error

SaveConfig writes the full <meshDir>/config.toml atomically (temp + rename), 0644.

Types

type Code

type Code struct {
	Index     bool
	Roots     []string
	Languages []string
}

Code is the [code] section: the opt-in source-code index (the graphify replacement). Index gates it on; Roots are the repos to walk (separate from the note vault, since source lives elsewhere); Languages is an allowlist of language tags (empty = all supported). Env MESH_CODE_INDEX / MESH_CODE_ROOTS override.

type Config

type Config struct {
	Embedding Embedding
	Retrieval Retrieval
	Code      Code
}

Config is the full solo config.toml (embedding + retrieval + code).

func LoadConfig

func LoadConfig(meshDir string) (Config, error)

LoadConfig reads the full config.toml (embedding + retrieval). A missing file returns a zero Config, like Load.

type Embedding

type Embedding struct {
	Endpoint    string
	Model       string
	Dim         int
	KeyEnv      string // env var NAME holding the bearer key (never the key itself)
	QueryPrefix string // e.g. "search_query: " for nomic-style asymmetric models
	DocPrefix   string // e.g. "search_document: "
}

Embedding is the [embedding] section of a solo config.toml.

func Load

func Load(meshDir string) (Embedding, error)

Load reads <meshDir>/config.toml. A missing file is not an error: it returns a zero Embedding so callers can treat "no config" and "empty config" the same.

type Retrieval

type Retrieval struct {
	WeightFTS      float64
	WeightGraph    float64
	WeightVec      float64
	RerankEndpoint string
	RerankModel    string
	RerankKeyEnv   string
	RerankBlend    float64
	HNSWThreshold  int
	// FreshnessHalfLifeDays decays non-institutional notes in ranking by age (0 =
	// off, the default, so nothing changes silently). Env MESH_FRESHNESS_HALFLIFE_DAYS
	// wins. Tier-0 (decisions/gotchas/post-mortems) + entities/concepts/maps never
	// decay; only note/status notes do, floored so an old note is demoted, not buried.
	FreshnessHalfLifeDays int
}

Retrieval is the [retrieval] + [rerank] + [ann] sections of config.toml: the solo fallback for fusion weights, the cross-encoder rerank stage, and the ANN gate. As with [embedding], the matching env vars (MESH_WEIGHT_*, MESH_RERANK_*, MESH_HNSW_THRESHOLD) override these; keys live in env vars named by *KeyEnv.

Jump to

Keyboard shortcuts

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