Documentation
¶
Overview ¶
Package config defines the mnemos configuration schema, its built-in defaults, and the layered loader that merges those defaults with the user's home- and project-level TOML files.
Index ¶
Constants ¶
const FileName = ".mnemos.toml"
FileName is the conventional config filename, auto-discovered in the user's home directory and the current working directory.
Variables ¶
This section is empty.
Functions ¶
func DefaultTOML ¶
func DefaultTOML() []byte
DefaultTOML returns the canonical default configuration document. `init` uses it to seed a new .mnemos.toml.
func Resolve ¶
Resolve determines the ordered config files to layer and the writable tree root, given the explicit --config value (empty means auto-discover) and the user's home directory.
Precedence is expressed by order: later files override earlier ones. When explicitPath is set it REPLACES auto-discovery and wins outright; its directory becomes the tree root. Otherwise the home file (~/.mnemos.toml) is layered first and the project file (./.mnemos.toml) overrides it, with the current directory as the tree root.
Types ¶
type CaptureConfig ¶
type CaptureConfig struct {
Dir string `koanf:"dir"`
// DeferToWatcher, when true, makes mnemos.remember write-only: the OKF file
// is written but not ingested one-shot, leaving capture_dir ingestion to a
// running watcher. Default false keeps the one-shot ingest, which is safe
// even alongside a watcher because Phase 1 hash-skip makes the watcher's
// re-sighting of the file a no-op.
DeferToWatcher bool `koanf:"defer_to_watcher"`
}
CaptureConfig configures the write-back capture directory.
type ChunkingConfig ¶
type ChunkingConfig struct {
TargetTokens int `koanf:"target_tokens"`
OverlapTokens int `koanf:"overlap_tokens"`
}
ChunkingConfig configures deterministic chunk sizing.
type Config ¶
type Config struct {
Storage StorageConfig `koanf:"storage"`
Indexing IndexingConfig `koanf:"indexing"`
Chunking ChunkingConfig `koanf:"chunking"`
Search SearchConfig `koanf:"search"`
MCP MCPConfig `koanf:"mcp"`
Capture CaptureConfig `koanf:"capture"`
Security SecurityConfig `koanf:"security"`
}
Config mirrors .mnemos.toml. It is loaded by layering the user files (if present) on top of built-in defaults, so a missing section or key always falls back to a sane value.
func Load ¶
Load builds a Config from the embedded defaults, then overlays each existing file in paths in order (later files win). Missing files are skipped: the defaults stand on their own. A malformed file is an error. fileExists is the caller-supplied existence check so callers control filesystem semantics in tests.
func (*Config) ConfinementExclude ¶
ConfinementExclude returns the globs the write/delete confinement guard enforces on caller-supplied paths (remember custom path, forget, move, okfy). Unlike SecurityExclude it is NOT gated by exclude_secrets: these globs define paths a write/delete tool may never touch, a boundary that must hold regardless of whether secrets are also being kept out of the index.
func (*Config) SecurityExclude ¶
SecurityExclude returns the indexing-time secret-exclusion globs, gated by exclude_secrets: turning that off means "index everything", so the globs no longer remove matching files from the scan and an empty set is returned.
type IndexingConfig ¶
type IndexingConfig struct {
Include []string `koanf:"include"`
Exclude []string `koanf:"exclude"`
// MaxFileBytes caps the size of a single file read into memory during
// ingestion. A matched file larger than this is skipped with a warning
// rather than read whole, which bounds memory under the parallel pipeline.
// 0 (or negative) disables the cap.
MaxFileBytes int64 `koanf:"max_file_bytes"`
}
IndexingConfig configures which files are discovered for ingestion.
type MCPConfig ¶
type MCPConfig struct {
Transport string `koanf:"transport"`
AllowWrite bool `koanf:"allow_write"`
// AllowDelete gates the destructive tree operations mnemos.forget and
// mnemos.move (and their CLI counterparts). It is distinct from AllowWrite
// so capture can be enabled without granting delete/move. Default false.
AllowDelete bool `koanf:"allow_delete"`
}
MCPConfig configures the MCP server surface.
type SearchConfig ¶
type SearchConfig struct {
DefaultLimit int `koanf:"default_limit"`
UseVectors bool `koanf:"use_vectors"`
}
SearchConfig configures retrieval defaults.
type SecurityConfig ¶
type SecurityConfig struct {
ExcludeSecrets bool `koanf:"exclude_secrets"`
Exclude []string `koanf:"exclude"`
}
SecurityConfig configures secret exclusion during ingestion.
type StorageConfig ¶
type StorageConfig struct {
Path string `koanf:"path"`
}
StorageConfig configures on-disk persistence.