SecondBrain/reference/claude-code-setting-sources...

44 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2026-07-08 18:23:40 +00:00
---
summary: Claude Code's --setting-sources flag silently disables ALL plugins and hooks if "user" is omitted, because plugin enablement and hook wiring live only in ~/.claude/settings.json.
tags:
- type/reference
- tool/claude-code
scope: global
type: reference
source: cc-os docs/plans/c3-spike-findings.md (spike a, 2026-07-08)
date: 2026-07-08
last_updated: 2026-07-08
---
# Claude Code `--setting-sources` silently drops all plugins without "user"
Verified 2026-07-08 via transcript-level inspection of headless runs (model self-report is
unreliable for this — check the session JSONL for `hook_additional_context` /
`skill_listing` entries instead).
- `--setting-sources` picks which settings files load: `user` (`~/.claude/settings.json`),
`project` (`.claude/settings.json`), `local`.
- **Plugin enablement (`enabledPlugins`) and all hook wiring live in the `user` file.**
Any invocation whose source list omits `user` (e.g. `--setting-sources ""` or
`project,local`) starts a session with ZERO plugins and ZERO hooks — no error, no
warning. Memory capture, vault sync, ADR reminders, orchestration injection: all
silently absent for that session.
- Symlinked local plugins and absolute-path hooks are NOT the issue — the only failure
axis is whether `user` is in the list.
## `--settings <overlay.json>` deep-merges `enabledPlugins` (verified 2026-07-08)
An overlay file passed via `--settings` merges `enabledPlugins` key-by-key into the user
settings — only plugins explicitly set `false` are disabled; unlisted plugins and all
hooks are untouched. Diff-only profile overlays (e.g. `~/.claude/profiles/*.json`) are
therefore safe. Measured caveat: disabling plugins saves almost no context
(32 to 632 tokens for 59 plugins, post-ToolSearch) — the win is focus, not tokens.
## Rule
Any wrapper, profile, or script that passes `--setting-sources` MUST include `user`.
To slim a session, subtract via a `--settings <overlay.json>` file (e.g. an
`enabledPlugins` diff in `~/.claude/profiles/`) — never by dropping the user source.
Related: [[cc-os-hub]], [[memsearch-sessionstart-injection-hardcoded]]