Documentation
¶
Overview ¶
Package config loads ~/.culi/config.yaml with defaults. The base directory is overridable via CULI_HOME so tests and sandboxes never touch the real user store.
Index ¶
- Constants
- func BaseDir() (string, error)
- func DBPath(base string) string
- func InboxDir(base string) string
- func KnowledgeDir(base string) string
- func LogDir(base string) string
- func RecommendedLearnModels(provider string) (cheap, strong string)
- func SetKnobs(base string, values map[string]string) (int, error)
- func SetRepos(base string, repos []string) error
- func StateDir(base string) string
- type Config
- type ImportConfig
- type LearnConfig
- type OllamaConfig
Constants ¶
const InternalEnv = "CULI_INTERNAL"
InternalEnv marks a culi-spawned terminal-model subprocess (`claude -p` or `codex exec`). Those calls can inherit culi's own hooks; the hook path checks this var and no-ops for every event. Without it, each mining call would get context injected into its prompt (UserPromptSubmit) and its transcript enqueued (SessionEnd) — culi mining its own mining calls (self-ingestion loop).
Variables ¶
This section is empty.
Functions ¶
func KnowledgeDir ¶
KnowledgeDir returns the canonical card store directory under base.
func RecommendedLearnModels ¶ added in v0.3.0
RecommendedLearnModels returns provider-appropriate starting models for the Settings UI and for safe fallback when a user switches provider but still has model IDs from the previous vendor in config.yaml.
func SetKnobs ¶ added in v0.2.0
SetKnobs writes the given safe knobs into config.yaml in place, preserving comments and every unlisted key (C4: never destroy user content). Values arrive as strings (the console's form fields); non-whitelisted keys are ignored. Returns the number of keys applied. A parse error on any value aborts the whole write — config.yaml is left untouched.
func SetRepos ¶
SetRepos rewrites only the `repos:` list in config.yaml, preserving every other key and all of the operator's comments. It round-trips through yaml.Node and replaces just the repos sequence node — a full Marshal of the Config struct would strip comments (C4: never destroy user content).
Types ¶
type Config ¶
type Config struct {
// PushBudget is the max estimated tokens injected per UserPromptSubmit.
PushBudget int `yaml:"push_budget"`
// BaselineBudget is the max estimated tokens injected at SessionStart.
BaselineBudget int `yaml:"baseline_budget"`
// Ollama configures the local embedding endpoint (used from Phase 3).
Ollama OllamaConfig `yaml:"ollama"`
// ExtraAcks extends the built-in acknowledgement lexicon (the
// inject-nothing gate) with the user's own phrases, any language.
ExtraAcks []string `yaml:"extra_acks"`
// ExtraStopwords extends the built-in stopword packs.
ExtraStopwords []string `yaml:"extra_stopwords"`
// Repos lists absolute paths of repositories whose .claude directories
// and CLAUDE.md files `culi import` reconciles into the canonical store.
Repos []string `yaml:"repos"`
// Import configures the drift-reconcile pipeline.
Import ImportConfig `yaml:"import"`
// Learn configures the background learning pipelines.
Learn LearnConfig `yaml:"learn"`
}
Config holds user-tunable settings. Zero values are replaced by defaults in Load so a partial (or absent) config.yaml always yields a usable Config.
type ImportConfig ¶
type ImportConfig struct {
// Provider selects the merge backend: auto (default), openai, codex-cli,
// anthropic, claude-cli, ollama, or none (mechanical only).
Provider string `yaml:"provider"`
// MergeModel is the model used to reconcile diverged clusters and
// decompose CLAUDE.md files. For anthropic/claude-cli this is a Claude
// model ID; provider resolution replaces a model from the other vendor with
// a safe default. For Ollama it MUST be a local model (e.g. qwen3).
MergeModel string `yaml:"merge_model"`
}
ImportConfig tunes `culi import merge`.
type LearnConfig ¶
type LearnConfig struct {
// Enabled is the master switch (default true).
Enabled bool `yaml:"enabled"`
// Provider selects the mining backend like import.provider: auto (default),
// anthropic, openai, claude-cli, codex-cli, ollama, or none.
Provider string `yaml:"provider"`
// CheapModel handles routine mining; StrongModel is the one-step
// escalation on schema failures. For ollama both MUST be local models.
CheapModel string `yaml:"cheap_model"`
StrongModel string `yaml:"strong_model"`
// DailyUSDCap bounds estimated API spend per day (OpenAI/Anthropic only;
// terminal providers and Ollama cost $0). 0 = default.
DailyUSDCap float64 `yaml:"daily_usd_cap"`
// DailyCallCap bounds model calls per day on every backend — the
// subscription-quota guard for terminal providers. 0 = default.
DailyCallCap int `yaml:"daily_call_cap"`
// CandidateTTLDays auto-retires mined candidate cards left unreinforced for
// this many days (file mtime is the clock). 0 = default (30); a negative
// value disables the janitor. Confirmed cards are NEVER auto-retired —
// dormant ones are only reported by `culi stats` (C4).
CandidateTTLDays int `yaml:"candidate_ttl_days"`
// MaxJobsPerRun caps how many queued transcripts one `culi learn` run mines,
// newest first (recent conversations carry the most relevant lessons). 0 =
// default (50); a negative value = unlimited. `culi learn --no-cap` always
// drains the whole backlog regardless of this.
MaxJobsPerRun int `yaml:"max_jobs_per_run"`
// ConfirmAt is how many independent observations promote a mined candidate
// to a confirmed, injecting card without manual review. 0 = default (2:
// corroboration from two separate sessions). 1 = auto-confirm on first
// sighting (trust the model — noisier); higher = more conservative.
// `culi review` can always confirm/reject sooner regardless of this.
ConfirmAt int `yaml:"confirm_at"`
// OAuthTokenFile points the claude-cli backend at a file holding a
// CLAUDE_CODE_OAUTH_TOKEN. Empty (default) = off. Set it when background
// learning runs headless: Claude Code does not propagate its OAuth token to
// hook-spawned processes, so `claude -p` has no auth; culi reads the token
// from this file and injects it into the subprocess env. Leading ~ expands.
OAuthTokenFile string `yaml:"oauth_token_file"`
// AnthropicAPIKeyFile points the anthropic backend at a file holding an
// ANTHROPIC_API_KEY, for users who prefer the metered API over the
// subscription CLI. Empty (default) = off; the env var is used when set.
// Its presence also makes provider:auto prefer the Anthropic API. ~ expands.
AnthropicAPIKeyFile string `yaml:"anthropic_api_key_file"`
// OpenAIAPIKeyFile points the OpenAI API backend at a file holding an
// OPENAI_API_KEY. Empty uses the environment. This is metered API auth and
// is deliberately separate from the Codex CLI's ChatGPT/subscription login.
OpenAIAPIKeyFile string `yaml:"openai_api_key_file"`
}
LearnConfig tunes transcript mining (Phase 4). Both caps must pass for a model call to run; hooks always enqueue regardless (the queue drains when caps reset). To spend nothing, set enabled: false or provider: none.
type OllamaConfig ¶
OllamaConfig points at the local embedding server.