Repository navigation
Description
Problem
A pack installed with mcs sync --global reaches every project, and there is no way to switch it off in just one. The workaround is project-scoped installs everywhere else, which flips the default: every new repo starts without the pack until someone remembers to add it.
Packs can't solve this themselves without each inventing its own marker (see mcs-cli/memory#49, closed in favour of this), and a pack only controls its hooks. Its MCP servers, skills, plugins and CLAUDE.md section are installed by mcs, so mcs is the one place that can switch all of them off together.
Proposal
State. A project records which global packs are off in .mcs-project: disabledGlobalPacks: ["memory"]. Nothing changes in ~/.mcs/global-state.json or in global files other than the hook guard below.
UX. The project picker already lists global packs under "Already installed globally" and skips them. That section becomes a toggle: on here (default) or off here. For scripts: mcs sync --disable <id> / --enable <id>, and a disable: list in mcs.yaml for mcs bootstrap.
Applying it. Project sync derives the overrides from the global pack's current manifest on every run and writes them into files it already owns. Nothing is stored per artifact, so a pack that gains a skill or server is covered on the next mcs update --all-projects.
| Artifact | Off switch | Written to |
|---|---|---|
| Hooks | env.MCS_DISABLED_PACKS, read by a guard on global hook commands |
settings.local.json |
| MCP servers | the server name in disabledMcpServers (the list /mcp → disable writes); the server never starts |
~/.claude.json → projects[<path>] |
| Skills | skillOverrides: { "<skill>": "off" } |
settings.local.json |
| Plugins | enabledPlugins: { "<plugin>": false } |
settings.local.json |
| Templates | see open question 1 | CLAUDE.local.md or settings.local.json |
Pack settings |
out of scope: mcs can't know a key's "off" value; documented as staying in effect | — |
The hook guard. ComponentDefinition.hookCommand(pathPrefix:) wraps global-scope commands only:
case " $MCS_DISABLED_PACKS " in *" memory "*) ;; *) node ~/.claude/hooks/memory/kb-gate.mts ;; esac- With the variable unset the hook runs exactly as today; stdin and the exit code pass through.
- No runtime dependency on the
mcsbinary. - Doctor and global cleanup keep matching, since both derive from
hookCommandand cleanup keys on the path token. - It follows the session's project, not the hook's cwd, so a
cdmid-session doesn't flip it. - Existing global installs pick up the guard on their next global sync; until then they behave as today.
Doctor. In a project with a disabled pack, skip that pack's checks and add one check that its overrides are present.
Verified on Claude Code 2.1.312
Throwaway project, headless sessions, overrides only in the project's settings.local.json:
envreaches hook commands on SessionStart, UserPromptSubmit and PreToolUse; the guard silenced only the disabled pack's hooks.skillOverrides: "off"removes a~/.claude/skills/skill from both the model's skill list and slash commands.- A project
enabledPlugins: falseoverrides a usertrue. claudeMdExcludesexcludes an@imported file.- Not run:
disabledMcpServers(it would mean editing a real~/.claude.json). It is documented for user-scoped servers and theprojects[<path>]shape is what Claude Code writes today.
Alternatives considered
- Wrapper binary (
mcs hook run <pack> -- <cmd>): cleaner command and logic testable in Swift, but every global hook would depend onmcsbeing on the hook's PATH and pay a process start. The shell guard has neither cost. - Marker file per pack (what memory#49 did): agent-writable, and resolves against the hook's cwd.
settings.local.jsonis Claude Code's own per-project config and already composed by mcs. - Removing the hook entry per project: not possible; Claude Code merges hooks across scopes and has no per-hook override, only
disableAllHooks.
Open questions
- Templates. (a) Write a
CLAUDE.local.mdsection saying the pack is off here: no change to the global layout, but the global section still loads. (b) Write each global pack's template to its own file imported from~/.claude/CLAUDE.md, and add that file to the project'sclaudeMdExcludes: a real exclusion, but it changes every user's globalCLAUDE.mdlayout and needs a migration. I'd start with (a). - Protective hooks. Disabling a pack disables all its hooks, including safety ones such as the memory pack's write gate. Since it's an explicit mcs action stored in Claude Code settings, I think that's acceptable, but a pack could opt out of being disableable if you'd rather.
- Relation to Let packs declare supported scopes and enforce them on sync #457. Complementary: Let packs declare supported scopes and enforce them on sync #457 is the author limiting where a pack may be installed; this is the user switching a global one off locally. A pack with
scopes: [project]never appears as disableable.
Acceptance
- Integration: disabling a global pack in a project writes each override above, and re-enabling removes exactly those entries.
- Integration: a project without disabled packs gets byte-identical
settings.local.jsonandCLAUDE.local.md. - Unit:
hookCommandwraps global-scope commands only; doctor's hook check still matches guarded commands. - Integration: a pack that gains a skill after being disabled has it switched off on the next project sync.
Docs
docs/cli.md: the picker toggle,--disable/--enable,mcs.yamldisable:.docs/architecture.md: the guard inhookCommandand the per-artifact table.docs/troubleshooting.md: packsettingskeys stay in effect when a pack is disabled.
Activity
bguidolim commentedon Oct 28, 2026
Thanks for writing this up, and for testing the mechanisms on a real Claude Code build. I didn't know about the
envguard orskillOverridesbefore reading this.I'd like to hold this one, though. mcs already supports per-project installs, and adding a third state ("installed globally, off here") costs a lot for what it buys. Every global hook command gets a guard, mcs starts writing
~/.claude.jsondirectly, and a real template exclusion means changing the layout of every user's globalCLAUDE.md. Even after all that, the pack'ssettingskeys stay in effect. So far memory-loop is the only pack asking for this.memory-loop can also tell on its own when it has nothing to do: a project without
.claude/memorieshas no KB, so its hooks can exit early there. Unlike the marker in #49, nothing new gets created. The hook only checks the pack's own precondition.I do agree about the default. If you want a pack in most repos, per-project installs mean remembering it in every new one. I'd rather fix that directly:
mcs config set default-packs memory), pre-selected in the picker for a project that has never been synced, plusmcs sync --defaultsto apply them without prompts.mcs check-updates --hookalready runs there) when a repo has never been synced and default packs are set, or when itsmcs.yamlhasn't been applied.mcs sync --pack <id> --all-projectsto add a pack to every tracked project, reusing the loopmcs update --all-projectsalready has.mcs.yamlwithmcs bootstrapfor teams, which ISSUE-411: Route mcs.yaml packs to project or global scope #461 is extending.If another pack runs into the same need, I'm happy to reopen this. Some parts of the proposal would need changing then:
HookInterpreter.interpreter(ofRegisteredCommand:)expects the hook path to be the last token. A guarded command ends in;; esac, so doctor would fall back tobashand stop checking that node or python is installed for global hooks.claude plugin disable <id> -s local. Since Plugin enablement is written under a key Claude Code ignores, and project syncs install plugins globally #450 the CLI ownsenabledPlugins, and mcs doesn't write it.disabledMcpServerswould be mcs's first direct write to~/.claude.json, which running sessions rewrite all the time.