feat: follow Claude Code model-switch hooks, project-scope defaultMode and newly scoped settings keys - #3278
Merged
Conversation
…e and newly scoped settings keys Add the PreModelSwitch/PostModelSwitch hook events (with matcher), drop a project-scope permissions.defaultMode of auto or bypassPermissions that Claude Code ignores there, and add twelve settings keys whose documented scope rules out the files rulesync writes. Refs #2664 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4MwhqMc6s4ct5MzMReGJj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4MwhqMc6s4ct5MzMReGJj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follows the Claude Code upstream changes tracked in #2664 where they fit an existing rulesync mechanism. Each one was checked against the current Claude Code docs (code.claude.com/docs, fetched 2026-10-02).
PreModelSwitch/PostModelSwitch(gap A, v2.1.251). Added the canonicalpreModelSwitch/postModelSwitchevents toHOOK_EVENTS,CLAUDE_HOOK_EVENTSandCANONICAL_TO_CLAUDE_EVENT_NAMES, so they are generated and imported forclaudecodeandclaudecode-plugin. Both take a matcher (the canonical name of the model being switched to, per the hooks matcher table), so they stay out of the no-matcher set. The hook event matrix is regenerated.permissions.defaultMode(gap B, v2.1.257). Permission modes saysautoandbypassPermissionsin.claude/settings.json/.claude/settings.local.jsondo not take effect. At project scope these two values are now dropped with a warning in the existing "not honored in the project-scoped file" wording, and the widening warning (which described a mode that never applies) no longer fires for them.acceptEdits/plan/defaultare unchanged, and--globalstill writes every value with the widening warning.### key/ Scope row in the settings reference against the two drop tables found twelve missing keys. These include the three named in the 2026-09-26 comment.User or managed/User, local, or managed→CLAUDECODE_USER_SCOPE_ONLY_KEYS:appendPlugins,prependPlugins,syncClaudeAiPlugins.Managed→CLAUDECODE_UNHONORED_KEY_SOURCES:allowClaudeInChromeWithManagedMcp,allowedProviders,availableModelsMatch,deniedModels.Global config(~/.claude.json) →CLAUDECODE_UNHONORED_KEY_SOURCES:claudeInChromeDefaultEnabled,copyFullResponse,defaultToAgentsView,leftArrowOpensAgents,prStatusFooterEnabled.Already resolved on main (verified, no change here)
skills-processor.tswarns and skipsclaudecode.scheduled-taskskills at project scope. The desktop scheduled tasks docs still document only~/.claude/scheduled-tasks/<task-name>/SKILL.md(or the same path underCLAUDE_CONFIG_DIR).claudecode-plugin --globalwalking$HOME.generate --targets claudecode-plugin --features "*" --global --dry-runnow prints "supports only project scope … Skipping." instead of scanning the home directory.Not implemented (left open on #2664)
.claude/workflows/,~/.claude/workflows/, pluginworkflows/). A workflow is a plain-JavaScript.jsscript. It has no frontmatter,export const meta = { name, description }must be its first statement, it uses top-levelawaitandagent()/pipeline()/parallel(), andimport()is rejected (workflows docs). None of this fits rulesync's markdown-with-frontmattercommands/skillsmodel. Supporting it needs a new feature dimension (sources, processors, tool targets, import, gitignore, docs), which is a product decision rather than a follow-up fix.env). The published list needs prefix/suffix patterns plus off-value exceptions (none,0), and the current tables have no mechanism for that..mcp.jsonpaths →${CLAUDE_PLUGIN_ROOT}). This needs a newClaudecodePluginMcpclass with generate/import path rewriting.settings.json, output styles,.claude/loop.md,.worktreeinclude,REVIEW.md). Each would be a new feature dimension.agenthook underPermissionRequest(v2.1.280). Rejecting it needs a per-event hook-type restriction, which no hooks converter has today.teammateDefaultModelwarning wording. The key was removed upstream in v2.1.234. It is still dropped in both scopes, which is the right outcome. Only the warning text (which points at~/.claude.json) is stale.Test plan
auto/bypassPermissionsis dropped with the new warning and without the widening warning. The global-scope widening tests now run with--global. The new keys are dropped at the expected scopes.pnpm cicheckRefs #2664
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y4MwhqMc6s4ct5MzMReGJj