Principle:AMAP ML SkillClaw Configuration Management
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Developer_Tools |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
A configuration management pattern that separates persistent application configuration from code, using declarative YAML files with defaults merging and multi-instance isolation.
Description
Configuration management addresses the problem of storing and retrieving application settings across environments. The SkillClaw pattern uses a YAML file (`~/.skillclaw/config.yaml`) as the single source of truth, with deep-merged defaults so missing keys are always filled. Multi-instance isolation is achieved via the `SKILLCLAW_HOME` environment variable, which redirects all per-instance paths (config, skills, records, dashboard DB). The configuration is loaded once at startup into a typed dataclass (`SkillClawConfig`) that flows through the application.
Usage
Use this principle when designing systems that need:
- Persistent user configuration with sensible defaults
- Multi-instance isolation on a single machine
- Typed config access (dataclass) after loading from YAML
- Interactive first-run setup wizards
Theoretical Basis
The pattern follows the 12-Factor App methodology: config varies across deployments, code does not. The deep-merge strategy ensures backward compatibility:
# Abstract algorithm (NOT real implementation)
def load_config(file_path, defaults):
user_data = yaml.safe_load(file_path) if file_path.exists() else {}
return deep_merge(defaults, user_data)
def deep_merge(base, override):
result = copy(base)
for key, value in override.items():
if key in result and isinstance(result[key], dict) and isinstance(value, dict):
result[key] = deep_merge(result[key], value)
else:
result[key] = value
return result