Once is fine. Twice is suspicious. Three times means you need to make your hyperparameters data.
1. Why Configuration Exists
Without a config manager, every wrapper that eventually calls a model, backend, prompt, cache, benchmark, or file helper has to accept and pass through the same knobs:CM_HVNB to move those knobs into configuration data:
2. Core Idea: Scoped Layers and App Overrides
In a nutshell, the HeavenBase configuration manager is using a database backend to store a scoped KV dictionary. A scope is a named layer of overrides. Broad scopes hold shared defaults; narrower scopes override only what differs. For example,heavenbase.workspace.docs-demo resolves through:
heavenbaseheavenbase.workspaceheavenbase.workspace.docs-demo
heavenbase.query.near.default_top_k, every other config value falls back to the broader scopes and finally to the package default template.
Scope is the only thing application code needs to carry. The actual model names, provider defaults, backend paths, serialization defaults, and prompt language can stay in config data instead of being threaded through every wrapper.
3. Read Active Defaults
Start withget(...) when you need one value:
load() when you want a mutable copy of the current merged config:
load() returns a copy. Mutating that dictionary does not write back to the config store.4. Use Scopes as Context
Usescoped(...) as a context manager when a block of code should read scoped values:
5. Reuse a Snapshot
For high-volume read paths, keep a snapshot and reuse it:CM_HVNB.refresh() when a diagnostic path needs to bypass cached state immediately.
6. Edit a Scoped Layer
Config writes are persisted immediately. Use a scoped layer for demos and tests so you do not surprise the base configuration layer:items[0]replaces an item.items[]appends.items[2+]inserts before index 2.
unset(...) writes a tombstone so a child scope can hide a value inherited from its parent scope. Dicts can use __HB_OVERWRITE__ to replace a parent dict instead of recursively merging it.
7. Inspect Stored Layers
Uselayer(...) when you need the raw layer stored in one scope before parent merge and interpolation:
heavenbase.config.versioning.keep_last_k is 10, so ordinary edits keep recent history without growing forever.
8. Use Resources and Package Paths
resource(...) resolves files under the package resources/ directory when that package can be located. load_default() returns the in-memory default config template used to initialize scopes.
CM_HVNB.pj(...) understands HeavenBase package aliases such as %/ for package-local data and &/ for package resources. For ordinary caller-provided paths, use pj(...) from the File System utilities instead. See File System for more details.
9. Understand Interpolation
OmegaConf interpolation resolves when a snapshot is compiled:${env:VAR}is allowed by default.${oc.env:VAR,default}works through OmegaConf.${cmd:...}is disabled by default and requires an explicit policy override.

