Motivation
Config today is split: env vars / .env (src/config/settings.py RAGConfig + the LLM client) and the per-corpus profile JSON (CorpusProfile). There's no general config-file base layer. As settings accumulate (attachment extractor + cloud opt-in from #38, and especially the MCP server settings in Phase 1b #32 — port, exposed tools), a single canonical config file becomes worthwhile.
Proposal
Add a config-file base layer with standard precedence (low → high):
- config file — e.g.
~/.mailrag/config.toml (tomllib is stdlib, read-only; or YAML, already a dep)
- env / .env — existing
RAG_* vars override the file
- CLI flag — highest priority per-invocation override
Consolidate the existing RAG_* settings (LLM provider/model/temperature/base-url/key, embedding provider/model/batch/workers, chunk size/overlap) plus the new RAG_ATTACH_EXTRACTOR (#38) and the future MCP settings.
Scope / sequencing
Refs: #38 (extractor + cloud opt-in), #32 (MCP settings), src/config/settings.py.
Motivation
Config today is split: env vars /
.env(src/config/settings.pyRAGConfig+ the LLM client) and the per-corpus profile JSON (CorpusProfile). There's no general config-file base layer. As settings accumulate (attachment extractor + cloud opt-in from #38, and especially the MCP server settings in Phase 1b #32 — port, exposed tools), a single canonical config file becomes worthwhile.Proposal
Add a config-file base layer with standard precedence (low → high):
~/.mailrag/config.toml(tomllibis stdlib, read-only; or YAML, already a dep)RAG_*vars override the fileConsolidate the existing
RAG_*settings (LLM provider/model/temperature/base-url/key, embedding provider/model/batch/workers, chunk size/overlap) plus the newRAG_ATTACH_EXTRACTOR(#38) and the future MCP settings.Scope / sequencing
RAG_*through the loader touchessettings.py, which has fragiletest_settings_embedding_providercases — do it carefully with tests for the precedence cascade.llm< envRAG_ATTACH_EXTRACTOR< CLI--extractor(forward-compatible: the same keys move into the file later).Refs: #38 (extractor + cloud opt-in), #32 (MCP settings),
src/config/settings.py.