install
source · Clone the upstream repo
git clone https://github.com/kreuzberg-dev/kreuzberg
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/kreuzberg-dev/kreuzberg "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.ai-rulez/skills/config-loading-precedence" ~/.claude/skills/kreuzberg-dev-kreuzberg-config-loading-precedence && rm -rf "$T"
manifest:
.ai-rulez/skills/config-loading-precedence/SKILL.mdsource content
priority: high
Configuration Loading & Precedence
CLI Mode Precedence (highest → lowest)
- Individual CLI flags (
,--ocr
,--output-format
)--chunk - Inline JSON config (
or--config-json
)--config-json-base64 - Config file (
)--config path.toml - Auto-discovered config (
in cwd/parents)kreuzberg.{toml,yaml,json} - Default values
Server/MCP Mode Precedence
- CLI arguments (
,--host
)--port - Environment variables (
,KREUZBERG_HOST
)KREUZBERG_PORT - Config file
section[server] - Defaults (
)127.0.0.1:8000
Config File Discovery
Searches current directory and parents for
kreuzberg.toml, kreuzberg.yaml, or kreuzberg.json. Stops at first match.
Inline JSON Config
Field-level merge (not whole-object replacement):
fn merge_json_into_config(base: &ExtractionConfig, json: Value) -> Result<ExtractionConfig> { let mut config_json = serde_json::to_value(base)?; // Merge fields from json into config_json serde_json::from_value(merged)? }
Use
--config-json-base64 for shell escaping.
Config File Formats
TOML (
kreuzberg.toml):
use_cache = true [ocr] backend = "tesseract" languages = ["eng", "deu"] [security_limits] max_archive_size = 524288000
YAML and JSON follow equivalent structure.
CLI Flag Overrides
In
commands.rs: apply_extraction_overrides() applies individual flags on top of merged config.
Critical Rules
- CLI flags always win over config file
- JSON merge is field-level, not whole-object
- Auto-discovery stops at first config file found
for shell-safe JSON passing--config-json-base64- Server config uses
section + extraction config[server]