---
id: 003-c4g3
title: Configuration system - TOML parsing, defaults, per-repo config
status: done
priority: P1
created: 2026-01-31
updated: 2026-01-31
dependencies: [001-a7e1]
---

## Description

Implement TOML configuration system for .mdkb/config.toml with sensible defaults.

## Acceptance Criteria

- [x] Config struct with serde serialization
- [x] Load from .mdkb/config.toml with fallback to defaults
- [x] Sections: [indexing], [chunking], [search], [memory], [models]
- [x] Validation of config values on load
- [x] Default config generation for new projects
- [x] Environment variable override support
- [x] Tests for parsing and defaults (19 tests)

## Implementation Notes

Config sections:
- indexing: default_pattern, debounce_ms, parse_frontmatter, parse_wikilinks
- chunking: strategy (fixed/markdown), max_tokens, overlap_tokens
- search: default_limit, min_score, rrf_k, weights
- memory: enabled, warmup_limit, order_by, track_access
- models: (Phase 3+) embedding/reranker repos and files

## Work Log

2026-01-31: Completed with TDD
- Added ModelsConfig section (embedding, reranker, condense repos/files)
- Implemented validate() method with field validation
- Implemented from_env_with_defaults() for env var overrides
- 19 passing tests covering all acceptance criteria
