Skip to content

Claude settings json - #1262

Merged
shunkakinoki merged 4 commits into
mainfrom
claude-settings-json
Mar 23, 2026
Merged

Claude settings json#1262
shunkakinoki merged 4 commits into
mainfrom
claude-settings-json

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Add a dedicated Claude hooks config and make hook commands non-blocking and more robust. Standardizes session/task automation, ensures .claude/settings.json is tracked, and fixes a missing trailing newline.

  • New Features

    • Added .claude/settings.json with session and task hooks that call entire hooks claude-code ... (async, 30s).
    • Set env defaults: ANTHROPIC_DEFAULT_HAIKU_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL.
    • Denied reads to ./.entire/metadata/**; updated .gitignore to ignore .claude/* but track .claude/settings.json.
  • Refactors

    • Made git-ai checkpoint claude --hook-input stdin run async to avoid blocking.
    • Guarded dcg calls with command -v dcg >/dev/null 2>&1 && dcg; removed unnecessary async on a dcg hook.
    • Kept existing timeouts (5s/15s) while improving reliability.

Written for commit 54f68cd. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 23, 2026 07:16
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 23, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7a7971c-c643-4a81-8a3e-e5bf57c10ca2

📥 Commits

Reviewing files that changed from the base of the PR and between c114144 and 54f68cd.

📒 Files selected for processing (1)
  • .claude/settings.json
✅ Files skipped from review due to trivial changes (1)
  • .claude/settings.json

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Added Claude workflow settings with lifecycle and tool hooks for session and prompt events
    • Exposed model env vars for haiku/sonnet defaults and denied read access to internal metadata
    • Updated ignore rules to keep the workflow settings tracked while ignoring other Claude files
    • Adjusted async/timeouts for tool checkpoints and made a shell-existence check for a CLI helper command

Walkthrough

Adds a new Claude workflow settings file and updates existing Claude config and .gitignore to register lifecycle/tool hooks, set Anthropic model env vars, and restrict read permissions to internal metadata.

Changes

Cohort / File(s) Summary
New Claude configuration
\.claude/settings.json
Adds a claude-code workflow config registering lifecycle hooks (SessionStart, SessionEnd, UserPromptSubmit, Stop) and tool hooks (PreToolUse, PostToolUse) with commands, timeouts, async flags, env vars for Anthropic models, and permissions.deny for ./.entire/metadata/**.
Version control update
\.gitignore
Change ignores to /.claude/* while explicitly unignoring !.claude/settings.json so settings remain tracked.
Existing Claude config edits
config/claude/settings.json
Made several hook entries async (PreToolUse for Write/Edit/MultiEdit and PostToolUse), adjusted Bash dcg invocation to check availability before running, and removed an async flag from one Bash entry.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Claude as "Claude (hooks)"
  participant Tool as "Tool (git‑ai / dcg)"
  participant FS as "Filesystem / VCS"

  User->>Claude: Submit prompt / start session
  Claude-->>User: Acknowledge (SessionStart/UserPromptSubmit hooks)
  Claude->>Tool: PreToolUse hook (run checkpoint or pre-task command)
  Tool->>FS: Check/commit or run dcg (command -v dcg ...)
  Tool-->>Claude: Tool result
  Claude->>Tool: PostToolUse hook (post-task / post-todo / checkpoint)
  Claude-->>User: Finalize (SessionEnd/Stop hooks)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐇 I hopped into hooks with a curious nose,

Commands and timeouts in tidy rows.
Pre-tasks primed and post-tasks too,
Haiku and sonnet models queued anew—
A rabbit's cheer for settings made true.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague and generic. It uses a non-descriptive term 'Claude settings json' that doesn't convey the meaningful context of the changes (adding hooks configuration and making commands non-blocking). Consider a more descriptive title like 'Add Claude hooks configuration and make hook commands non-blocking' that better summarizes the main changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-related to the changeset, providing clear details about new features (Claude hooks config, environment defaults) and refactors (async commands, guarded dcg calls).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude-settings-json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a dedicated settings file for Claude AI configurations, centralizing the management of AI session hooks and default model selections. It refines the Git tracking behavior for Claude-related files and modifies existing Claude settings to optimize the execution of specific commands by making checkpoint operations asynchronous and standardizing tool command calls, enhancing overall AI integration and performance.

Highlights

  • New Claude Settings File: Introduced a new .claude/settings.json file to centralize Claude AI configurations, including session lifecycle hooks and default model selections.
  • Git Ignore Configuration: Updated the .gitignore file to specifically track .claude/settings.json while ignoring all other files within the .claude directory.
  • Asynchronous Checkpoint Commands: Modified existing Claude settings in config/claude/settings.json to execute git-ai checkpoint commands asynchronously, improving performance during PreToolUse and PostToolUse hooks.
  • Standardized Tool Command Execution: Standardized the execution of the dcg command in existing Claude settings, ensuring it runs only if available and adjusting its asynchronous property for consistency.
  • Default Model Configuration: Set default Anthropic models for both Haiku and Sonnet to claude-sonnet-4-6-1m within the new settings file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Mar 23, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Added a dedicated Claude settings file (.claude/settings.json) to define lifecycle hooks, made existing Claude-related hook commands non-blocking and more robust, and updated .gitignore to track the new settings file while ignoring other .claude contents.

What changed?

  • .claude/settings.json: Introduced a new configuration file defining Claude lifecycle hooks (SessionStart, SessionEnd, UserPromptSubmit, Stop, PreToolUse, PostToolUse) that execute entire hooks claude-code commands asynchronously with a 30-second timeout. Also set default Anthropic models and denied read access to ./.entire/metadata/**.
  • .gitignore: Updated to specifically ignore all files within .claude/ except for .claude/settings.json, which will now be tracked.
  • config/claude/settings.json: Modified existing settings to enable asynchronous execution for git-ai checkpoint claude commands, disabled async for one dcg command, and added a conditional execution check for another dcg command.

Description generated by Mesa. Update settings

Entire-Checkpoint: 8089241e7f0e

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a new .claude/settings.json file, configuring various hooks and setting Anthropic model environment variables, and updates .gitignore to specifically include this new settings file while ignoring other .claude directory contents. Additionally, the existing config/claude/settings.json is modified to adjust async properties for certain hooks and to make the dcg command execution conditional on its availability. Review comments indicate that the ANTHROPIC_DEFAULT_HAIKU_MODEL in the new settings file is incorrectly assigned a Sonnet model, which could have unintended performance and cost implications, and that the new JSON file is missing a trailing newline character.

Comment thread .claude/settings.json
]
},
"env": {
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-6-1m",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ANTHROPIC_DEFAULT_HAIKU_MODEL is set to a Sonnet model (claude-sonnet-4-6-1m). This is likely a configuration error. Haiku models are designed for speed and lower cost, so using a Sonnet model here negates those benefits and may have unintended performance and cost implications. Please update this to a valid Haiku model identifier.

Comment thread .claude/settings.json Outdated
"Read(./.entire/metadata/**)"
]
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The JSON file should end with a newline character. It's a standard convention that prevents issues with file concatenation and some tools.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a project-level Claude Code configuration under .claude/settings.json and aligns/adjusts hook behavior in the existing config/claude/settings.json, while updating .gitignore so the new settings file is committed but other .claude/ artifacts remain ignored.

Changes:

  • Add .claude/settings.json with hook commands, env overrides, and a permissions deny rule.
  • Update config/claude/settings.json hook entries (make git-ai checkpoint async; make dcg invocation conditional).
  • Refine .gitignore to ignore .claude/* while explicitly keeping .claude/settings.json tracked.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.

File Description
config/claude/settings.json Tweaks hook execution behavior (async for checkpoint; safer dcg invocation).
.gitignore Stops ignoring .claude entirely; ignores contents except the committed settings file.
.claude/settings.json Introduces repo-local Claude Code settings with entire-based hooks and model env overrides.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .claude/settings.json
Comment on lines +8 to +12
"type": "command",
"command": "entire hooks claude-code session-start",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +20 to +25
{
"type": "command",
"command": "entire hooks claude-code session-end",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +33 to +38
{
"type": "command",
"command": "entire hooks claude-code user-prompt-submit",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +46 to +51
{
"type": "command",
"command": "entire hooks claude-code stop",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +59 to +64
{
"type": "command",
"command": "entire hooks claude-code pre-task",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +72 to +77
{
"type": "command",
"command": "entire hooks claude-code post-task",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +83 to +88
{
"type": "command",
"command": "entire hooks claude-code post-todo",
"timeout": 30,
"async": true
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook command relies on the entire binary, but this repo doesn’t appear to install entire cross-platform (it’s only listed in the Darwin Homebrew bundle). As-is, contributors without entire will get failing hooks. Consider guarding the command (e.g., check command -v entire first) or routing through a repo-managed script that no-ops when unavailable.

Copilot uses AI. Check for mistakes.
Comment thread .claude/settings.json
Comment on lines +94 to +95
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-6-1m",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6-1m"

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model IDs here don’t match the repo’s configured Anthropic model names (e.g., models.json and config/claude/settings.json use claude-sonnet-4-6 and claude-haiku-4-5-20251001). Unless claude-sonnet-4-6-1m is a confirmed valid model in your environment, this will likely break model selection. Also, setting ANTHROPIC_DEFAULT_HAIKU_MODEL to a Sonnet model looks accidental—consider using the configured Haiku model (or remove the Haiku override).

Suggested change
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-6-1m",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6-1m"
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6"

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
config/claude/settings.json (1)

219-228: ⚠️ Potential issue | 🟠 Major

Duplicate "Bash" matcher causes dcg to execute twice per Bash tool use.

There are two "Bash" matchers in PreToolUse: one at lines 176-207 (containing dcg at line 186) and another at lines 219-228 (containing dcg at line 224). Both invoke the same command -v dcg >/dev/null 2>&1 && dcg command, meaning dcg will run twice for every Bash command.

Remove the duplicate matcher or consolidate the hooks into a single "Bash" matcher.

🔧 Proposed fix: remove duplicate matcher
       }
-    },
-    {
-      "matcher": "Bash",
-      "hooks": [
-        {
-          "type": "command",
-          "command": "command -v dcg >/dev/null 2>&1 && dcg",
-          "timeout": 5
-        }
-      ]
     }
   ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/claude/settings.json` around lines 219 - 228, There are two identical
"Bash" matchers that both run the same hook command "command -v dcg >/dev/null
2>&1 && dcg", causing dcg to execute twice; remove the duplicate entry or merge
their "hooks" arrays so only one matcher named "Bash" remains (keep the single
hook with the command/timestamp/timeout settings) — look for the duplicate
matcher objects containing "matcher": "Bash" and the hook with "command":
"command -v dcg >/dev/null 2>&1 && dcg" and delete or consolidate one of them.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/settings.json:
- Around line 93-96: The project-level env keys ANTHROPIC_DEFAULT_HAIKU_MODEL
and ANTHROPIC_DEFAULT_SONNET_MODEL are set to "claude-sonnet-4-6-1m" which
conflicts with the user-level config that uses "claude-sonnet-4-6"; either
change these two values to match the user config (claude-sonnet-4-6) or, if the
1m context is intentional for this repo, add a concise comment next to these env
entries explaining the deliberate override so maintainers know why the
project-level models differ.

---

Outside diff comments:
In `@config/claude/settings.json`:
- Around line 219-228: There are two identical "Bash" matchers that both run the
same hook command "command -v dcg >/dev/null 2>&1 && dcg", causing dcg to
execute twice; remove the duplicate entry or merge their "hooks" arrays so only
one matcher named "Bash" remains (keep the single hook with the
command/timestamp/timeout settings) — look for the duplicate matcher objects
containing "matcher": "Bash" and the hook with "command": "command -v dcg
>/dev/null 2>&1 && dcg" and delete or consolidate one of them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e23c1a7a-5d5e-43a8-9c3f-fda996414eb3

📥 Commits

Reviewing files that changed from the base of the PR and between 3532cf7 and c114144.

📒 Files selected for processing (3)
  • .claude/settings.json
  • .gitignore
  • config/claude/settings.json

Comment thread .claude/settings.json
Comment on lines +93 to +96
"env": {
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-6-1m",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6-1m"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Model version mismatch between project and user configs.

This project-scoped config sets models to claude-sonnet-4-6-1m, while the user-scoped config/claude/settings.json sets them to claude-sonnet-4-6. Project-scoped settings typically take precedence, so this repository will use different models than defined in the user config.

If this is intentional (e.g., 1m context for this specific project), consider adding a comment. Otherwise, align the model versions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/settings.json around lines 93 - 96, The project-level env keys
ANTHROPIC_DEFAULT_HAIKU_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL are set to
"claude-sonnet-4-6-1m" which conflicts with the user-level config that uses
"claude-sonnet-4-6"; either change these two values to match the user config
(claude-sonnet-4-6) or, if the 1m context is intentional for this repo, add a
concise comment next to these env entries explaining the deliberate override so
maintainers know why the project-level models differ.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@shunkakinoki
shunkakinoki merged commit 276618a into main Mar 23, 2026
34 checks passed
@shunkakinoki
shunkakinoki deleted the claude-settings-json branch March 23, 2026 07:40
@coderabbitai coderabbitai Bot mentioned this pull request May 19, 2026
6 tasks
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.

2 participants