# Config Schema & Install Scripts ## openclaw.plugin.json ```json { "$schema": "https://openclaw.ai/schemas/plugin-config.json", "configSchema": { "type": "object", "additionalProperties": false, "properties": { "myToken": { "type": "string" }, "myFlag": { "type": "boolean", "default": false } } } } ``` ### Rules - `additionalProperties: false` is mandatory — OpenClaw validates config against schema - Removing a config field requires removing it from schema too (or gateway fails to start) - Sensitive fields (tokens, keys): no `default`, user must configure manually ## Install Script (scripts/install.mjs) ### Install does: 1. Build dist (compile TypeScript) 2. Clean and copy to `~/.openclaw/plugins//` 3. Update `openclaw.json`: - Add to `plugins.allow` - Add to `plugins.load.paths` - Set `plugins.entries..enabled = true` - Set default config via `setIfMissing` (never overwrite existing values) 4. Never set sensitive fields (tokens) — add comments for manual configuration ### Uninstall does: 1. Remove from `plugins.allow` 2. Delete `plugins.entries.` 3. Remove from `plugins.load.paths` 4. Delete install directory ### setIfMissing pattern ```javascript function setIfMissing(obj, key, value) { if (obj[key] === undefined || obj[key] === null) { obj[key] = value; } } ``` ### Config field changes When renaming or removing config fields: 1. Update `openclaw.plugin.json` schema first (source of truth) 2. Update `normalizeConfig()` in index.ts 3. Update install script `setIfMissing` calls 4. Document migration steps for users