Configuration
The CLI loads .contextcraft.json from the selected directory, or the current
directory for explicit file inputs. Use --config to choose another file and
--no-config to disable automatic loading. Unknown keys are errors.
{
"budget_tokens": 8000,
"focus_query": "authentication",
"focus_files": ["src/auth/**"],
"output_format": "markdown",
"tokenizer_encoding": "cl100k_base",
"analysis_workers": 0,
"max_tier": "full",
"max_file_size_bytes": 16777216,
"respect_gitignore": true,
"include_hidden": true,
"use_default_excludes": true,
"exclude_patterns": ["tests/fixtures/"],
"include_directories": ["include"],
"secrets": {
"mode": "redact",
"allow_paths": []
}
}
Budget and output
| Setting | Default | Values |
|---|---|---|
budget_tokens | 16000 | Positive integer |
focus_query | "" | Task description |
focus_files | [] | Paths or glob patterns |
output_format | "markdown" | markdown, json, xml |
tokenizer_encoding | "cl100k_base" | cl100k_base, o200k_base |
max_tier | "full" | tree, sigs, skel, full |
Discovery and execution
| Setting | Default | Meaning |
|---|---|---|
analysis_workers | 0 | Automatic workers, or 1 through 8 |
max_file_size_bytes | 16777216 | Source limit below 4 GiB, with zero allowed |
respect_gitignore | true | Apply .gitignore and .ignore |
include_hidden | true | Discover hidden paths |
use_default_excludes | true | Apply common and language-specific exclusions |
exclude_patterns | [] | Additional .gitignore patterns without negation or newlines |
include_directories | [] | Repository-relative C/C++ include roots |
Worker zero selects automatic parallelism, with small inputs kept serial. The CLI uses the same worker setting for source loading and syntax analysis.
Secret policy
secrets.mode defaults to redact, with block and off also available.
secrets.allow_paths contains explicit path exemptions, each bypassing both
sensitive-file suppression and content detection. Read
secret protection before adding exemptions.
CLI precedence
Scalar CLI options override configured values, while repeatable exclusion, focus-file, include-directory, and secret-allow options extend configured lists. Positive discovery flags can re-enable settings that the file disabled.
Python configuration
The SDK uses immutable dataclasses, string literals for enum-like settings, and tuples for path collections:
from dataclasses import replace
from contextcraft import Config, SecretPolicy
config = Config(
budget_tokens=8000,
focus_files=("src/auth/**",),
secrets=SecretPolicy(mode="redact"),
)
focused = replace(config, focus_query="refresh token")
The SDK receives configuration directly rather than loading .contextcraft.json
automatically. See Config for generated
field signatures and the Python guide for engine reuse.