Skip to content

feat: follow Claude Code model-switch hooks, project-scope defaultMode and newly scoped settings keys - #3278

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2664-claudecode-followups
Oct 2, 2026
Merged

dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2664-claudecode-followups

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

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).

  • hooks: PreModelSwitch / PostModelSwitch (gap A, v2.1.251). Added the canonical preModelSwitch / postModelSwitch events to HOOK_EVENTS, CLAUDE_HOOK_EVENTS and CANONICAL_TO_CLAUDE_EVENT_NAMES, so they are generated and imported for claudecode and claudecode-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: project-scope permissions.defaultMode (gap B, v2.1.257). Permission modes says auto and bypassPermissions in .claude/settings.json / .claude/settings.local.json do 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 / default are unchanged, and --global still writes every value with the widening warning.
  • permissions: newly scoped settings keys. A fresh diff of every top-level ### 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)

  • Gap 2 (scheduled-task skills written to an unread project path) was fixed by fix(skills): skip claudecode scheduled-task skills at project scope #3003. skills-processor.ts warns and skips claudecode.scheduled-task skills at project scope. The desktop scheduled tasks docs still document only ~/.claude/scheduled-tasks/<task-name>/SKILL.md (or the same path under CLAUDE_CONFIG_DIR).
  • claudecode-plugin --global walking $HOME. generate --targets claudecode-plugin --features "*" --global --dry-run now prints "supports only project scope … Skipping." instead of scanning the home directory.

Not implemented (left open on #2664)

  • Gaps 1 and 3: dynamic workflows (.claude/workflows/, ~/.claude/workflows/, plugin workflows/). A workflow is a plain-JavaScript .js script. It has no frontmatter, export const meta = { name, description } must be its first statement, it uses top-level await and agent() / pipeline() / parallel(), and import() is rejected (workflows docs). None of this fits rulesync's markdown-with-frontmatter commands / skills model. 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.
  • Gap C (env variables Claude Code ignores in project/local env). The published list needs prefix/suffix patterns plus off-value exceptions (none, 0), and the current tables have no mechanism for that.
  • Gap D (plugin .mcp.json paths → ${CLAUDE_PLUGIN_ROOT}). This needs a new ClaudecodePluginMcp class with generate/import path rewriting.
  • Gap E and other new surfaces (plugin LSP servers, monitors, plugin settings.json, output styles, .claude/loop.md, .worktreeinclude, REVIEW.md). Each would be a new feature dimension.
  • An agent hook under PermissionRequest (v2.1.280). Rejecting it needs a per-event hook-type restriction, which no hooks converter has today.
  • teammateDefaultModel warning 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

  • Unit tests: model-switch events generate with their matcher and import back. A project-scope auto / bypassPermissions is 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 cicheck

Refs #2664

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y4MwhqMc6s4ct5MzMReGJj

…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
@dyoshikawa
dyoshikawa merged commit f3aee7c into main Oct 2, 2026
9 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2664-claudecode-followups branch October 2, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant