Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).

## [0.78.0] - 2026-09-07

### Added
- **Bash 優先指示の解除フック `native-file-tools` を追加(Standard / Full 既定有効)**: Claude Code 2.1.261 は auto / bypassPermissions モードのセッションに「ファイルの読み書きは Read/Edit/Write ではなく cat / sed / heredoc で行え」という指示を注入する(バイナリ内の未文書化 feature flag `CLAUDE_CODE_THRIFTY_SONIC`。Fable 5.1 系モデルでは強制有効、Opus 5 は GrowthBook のコホート配信、それ以外のモデルは既定で無効だが、サーバー配信の clientData やモデル別 capability からも強制され得る条件式になっている)。この状態ではモデルが Read/Edit/Write をほぼ使わないため、キットの `PostToolUse` `Edit|Write`(prettier-hooks / biome-hooks)、`PreToolUse` `Write`(doc-blocker)、`PostToolUse` `Write`(doc-size-guard)が発火せず、`paths:` 付き Rules とサブディレクトリの CLAUDE.md も読み込まれず、native checkpoint / rewind の追跡対象にもならない。新フックは `settings.json` の `env` に `CLAUDE_CODE_THRIFTY_SONIC="0"` を入れて指示の注入を解除する
- **実 CLI で再現・修正確認済み**: Claude Code 2.1.261 / claude-fable-5-1 / `--permission-mode auto` / `--setting-sources project`(利用者のグローバル設定・プラグイン・MCP を読み込まない隔離)で、同一の合成リポジトリと課題を新規セッションで比較した。フラグ未指定では 3 セッション中 3 セッションがツール呼び出しを Bash のみで済ませ、Biome 整形なし・doc-blocker の確認なし・doc-size-guard の警告なし・`InstructionsLoaded` イベントは session_start の 2 件のみ(paths Rules / nested CLAUDE.md の遅延ロードなし)。`env.CLAUDE_CODE_THRIFTY_SONIC="0"` では 3 セッション中 3 セッションが Read / Write を使い、Biome 整形・doc-blocker の `ask`・doc-size-guard の警告・`path_glob_match` / `nested_traversal` のロードがすべて観測された。トランスクリプトに永続化される `auto_mode` attachment の `bashFirst` 値(true / 消失)でも指示の有無を直接確認した。キットが生成した `settings.json` をそのまま使った検証でも同じ結果を得た
- **保証範囲と残る制約**: 復元されるのは通常のツール選択であって、Bash の使用が禁止されるわけではない。利用者が「Bash で編集して」と指示した対照ケースでは、フラグを入れても Bash のみで編集され、フック・paths Rules は従来どおり発火しない。auto / bypassPermissions 以外のモードでは元々この指示は注入されない(バイナリの条件式が他モードで即座に空を返す。`acceptEdits` は `"1"` を入れても注入されないことを実測で確認、`default` / `plan` は条件式からの判断で実測はしていない)。doc-blocker / doc-size-guard が Edit に反応しない点は従来からの制限で、今回の対象外
- **配布形態**: `agent-teams` / `no-flicker` と同じ env-only feature(`features/native-file-tools/hooks.json`)。`ENABLE_NATIVE_FILE_TOOLS` をレジストリ・profiles・wizard(フック選択の `native-tools` トークン、確認画面、非対話デフォルト)・MDM の許可キーに登録した。Standard / Full は既定 `true`、Minimal は `false`。既存インストールは `setup.sh --update` / 自動アップデートでプロファイル既定を受け取り、custom プロファイルは agent-teams と同じく `true` で補完する。`~/.claude-starter-kit.conf` に明示的に書かれた値は上書きしない。Claude Code 側でフラグが撤去された場合はフラグメントからキーを外すだけでよく、次回アップデートの 3-way merge がこのキーを変更していない利用者の `settings.json` から除去する(#120 の effortLevel 撤去と同じ kit-removed 経路。自分で値を変更していた利用者の値は従来どおり保持され、残っても未知の env は Claude Code に無視される)
- **回帰テスト**: `tests/unit/test-native-file-tools.sh`(Standard / Full の生成 `settings.json` に env キーが入ること、Minimal と明示 `false` では入らないこと、更新経路でのプロファイル既定補完と明示値の保持、`--hooks` トークン)。修正前のコードでは 17 件中 15 件が失敗する
- **実 CLI 検証ハーネスを同梱(CI 非連動)**: `tests/manual/bash-first-steer/` に合成 fixture 生成・ケース実行・集計スクリプトと期待結果表を置いた。モデルを実際に呼ぶため通常 CI には組み込まない。キット生成の `settings.json` をそのまま検証するモードでは、実環境の `~/.claude/hooks/` を動かしてしまう `SessionStart` / `SessionEnd` フック(auto-update・web-content-update・機能レコメンド)を含むファイルを拒否する

### Changed
- **README のセキュリティ機能・native rewind の説明を実測に合わせて修正**: security-guidance の「編集時」パターン警告は Edit / Write ツール経由の変更にだけ働き、Bash 経由の変更はターン終了時の git diff レビューとコミット時レビューで拾うことを明記した(導入版 2.0.7 の `hooks.json` / `security_reminder_hook.py` で確認)。コンパクト前スナップショットの説明と `commands/checkpoint.md` に、native rewind はファイル編集ツール(Edit / Write / NotebookEdit)による変更しか復元しない(公式ドキュメント「Checkpointing」の Limitations)ことを追記した
- 後発キーのデフォルト補完(agent-teams / native-file-tools)を `wizard/registry.sh` の `_fill_late_feature_defaults` に集約し、更新経路(`_restore_config_from_manifest`)・非対話 fresh install(`_fill_noninteractive_defaults`)・対話ウィザードの保存設定再利用(`fill_missing_profile_defaults`)から呼ぶようにした

### Fixed
- **custom プロファイルで `setup.sh` を直接再実行し保存設定を再利用すると、agent-teams(と今回の native-file-tools)の env が配布されない問題を修正**: 対話ウィザードの「保存された設定を再利用する」分岐は `fill_missing_profile_defaults` でプロファイル conf を読むだけで、conf を持たない custom プロファイルでは後発キーが空のままになり、`_feature_deploy_enabled` が無効扱いして env フラグメントを出力していなかった(#138 の修正は `setup.sh --update` 経路のみを対象にしていた)。`install.sh` 経由の再実行は常に `--update` が付くため影響せず、README が案内する「リポジトリ更新後に `./setup.sh` を再実行」の手順でのみ発生する。`fill_missing_profile_defaults` からも `_fill_late_feature_defaults` を呼ぶようにし、回帰テストを追加した。保存済みの明示的な `false` は引き続き保持される

## [0.77.1] - 2026-08-31

### Fixed
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ Multiple features can safely use the same hook type (e.g., `PreCompact`, `PostCo
- **Status Line**: Python statusLine command showing model, context usage, and 5h/7d rate limits.
- **Doc Size Guard**: non-blocking size-hygiene warning when CLAUDE.md/AGENTS.md exceeds line targets after Write.
- **Feature Recommendation**: writes pending feature names and notifies via SessionStart for enabled profiles.
- **Native File Tools**: env-only feature (`CLAUDE_CODE_THRIFTY_SONIC=0`, Standard/Full) that opts out of Claude Code's Bash-first steer in auto/bypassPermissions sessions; without it Fable 5.1 reads/edits via cat/sed/heredocs (0 of 3 reproduction sessions used Read/Edit/Write) so the Edit|Write hooks, `paths:` rules and nested CLAUDE.md do not fire. Real-CLI harness (model-calling, not in CI): `tests/manual/bash-first-steer/`.

## Platform Detection

Expand Down
23 changes: 20 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Claude Code Starter Kit bootstraps a consistent, high-quality Claude Code enviro
- **8 rules**: coding-style, git-workflow, performance, security, testing, agents, anti-patterns, permissions-guide
- **21 slash commands**: /plan, /tdd, /build-fix, /e2e, /verify, /research, /web-article, /oss-analyze, /web-source-review, /handover, /update-kit, and more
- **13 skill modules**: backend-patterns, frontend-patterns, security-review, tdd-workflow, prompt-patterns, cloudnative-writing-baseline (Japanese business writing), and more
- **11 optional hooks/settings**: safety net (cc-safety-net), auto update, web content update, tmux reminder, doc blocker, Prettier or Biome formatting, PR creation log, pre-compact snapshot (opt-in), statusline, doc size guard, feature recommendation
- **12 optional hooks/settings**: safety net (cc-safety-net), auto update, web content update, tmux reminder, doc blocker, Prettier or Biome formatting, PR creation log, pre-compact snapshot (opt-in), statusline, doc size guard, feature recommendation, native file tools (keeps Read/Edit/Write in use under auto mode so the edit hooks and path-scoped rules keep firing)
- **15 plugins** from multiple marketplaces: security-guidance, commit-commands, pr-review-toolkit, feature-dev, code-review, claude-md-management, superpowers, code-simplifier, document-skills, example-skills, typescript-lsp, gopls-lsp, pyright-lsp, rust-analyzer-lsp, claude-security
- **i18n**: English & Japanese
- **Codex Plugin** sub-agent integration (optional, supports ChatGPT sign-in or OpenAI API key auth)
Expand Down Expand Up @@ -84,7 +84,7 @@ The kit's security capabilities cover four different layers; they complement rat
| Layer | Component | Activation | Profile |
|---|---|---|---|
| Always-on guardrails | `rules/security.md` + `config/permissions.json` (all profiles) + safety-net (Standard / Full) | Always | All (safety-net: Standard / Full) |
| Automatic review | **security-guidance** plugin | On edits, turn completion, and commits | Standard / Full |
| Automatic review | **security-guidance** plugin | On edits, turn completion, and commits. The edit-time pattern warnings only see changes made with the editing tools (Edit / Write / MultiEdit / NotebookEdit); Bash edits are covered later by the turn-completion git-diff review and the commit review | Standard / Full |
| One-off review | Claude Code's built-in `/security-review` | Manual, for the current branch diff | Not managed by the kit |
| Deep scan | **claude-security** plugin | Manual, with `/claude-security` | Full |

Expand Down Expand Up @@ -233,6 +233,7 @@ Hooks are automated safety checks that run automatically when Claude Code execut
| Doc Size Guard | Warns when CLAUDE.md/AGENTS.md exceeds size-hygiene targets (non-blocking; Full only) |
| Web Content Update | Auto-updates the web-content-extraction skill's deps on session start (opt-in; default in Full only) |
| Feature Recommendation | Notifies about newly available features for the selected profile |
| Native File Tools | Keeps Read/Edit/Write as the primary file tools in auto / bypassPermissions sessions so the Edit\|Write hooks above, path-scoped rules, nested CLAUDE.md and native rewind keep working (default in Standard / Full) |

#### Safety Net

Expand Down Expand Up @@ -265,6 +266,22 @@ Automatically checks for new starter kit releases on GitHub on both `SessionStar

> **Enabled by default in Standard / Full profiles.** Disable with `ENABLE_AUTO_UPDATE=false` in the hooks selection.

#### Native File Tools

Claude Code 2.1.261 injects a "Bash-first" instruction into **auto / bypassPermissions** sessions: read files with cat / sed and change them with sed / heredocs instead of the Read, Edit and Write tools (undocumented feature flag `CLAUDE_CODE_THRIFTY_SONIC`; forced on for Fable 5.1 models, cohort-gated for Opus 5). Under that instruction the model almost never calls Read/Edit/Write, so the following stop working **silently** (reproduced with real CLI sessions; see `tests/manual/bash-first-steer/README.md`):

- the `PostToolUse` `Edit|Write` formatters (Prettier / Biome), the `PreToolUse` `Write` doc blocker and the `PostToolUse` `Write` doc size guard
- `.claude/rules/*.md` with `paths:` and nested `CLAUDE.md` files (they load when Claude *reads* a matching file, not when it runs cat)
- native checkpoint / rewind tracking, and security-guidance's edit-time pattern warnings

This hook writes `CLAUDE_CODE_THRIFTY_SONIC=0` into the `env` block of `settings.json`, which removes the instruction.

- **What it guarantees**: normal tool selection comes back (on the same task, 3 of 3 sessions used Bash only before the fix and 3 of 3 used Read/Write after). It does not forbid Bash: a deliberate Bash edit, or a prompt that asks for one, still bypasses the hooks, path-scoped rules and rewind
- **Other modes**: outside auto / bypassPermissions the instruction is not injected (the gating code returns nothing for any other mode; acceptEdits was also verified empirically, default / plan follow from the code), so the setting is harmless there
- **Disable**: deselect it in the wizard's hook list, leave `native-tools` out of `--hooks`, or set `ENABLE_NATIVE_FILE_TOOLS=false` in `~/.claude-starter-kit.conf`. If Claude Code retires the flag, removing the key from the kit fragment lets the next update's 3-way merge drop it from the `settings.json` of every user who never changed the value (a user-modified value is kept, as usual; a leftover key is harmless because Claude Code ignores unknown env keys)

> **Enabled by default in Standard / Full profiles.** Existing installs pick it up on `setup.sh --update` / auto update unless `~/.claude-starter-kit.conf` explicitly says `false`. Native rewind itself only restores changes made through Claude's file editing tools (Edit, Write, NotebookEdit); Bash edits (`sed -i`, heredocs) are never tracked (see Limitations in the official Checkpointing doc).

## Usage

> **Important: You must restart your terminal after setup.**
Expand Down Expand Up @@ -362,7 +379,7 @@ NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/cloudna
--new-init=true \
--codex-plugin=false \
--commit-attribution=false \
--hooks=safety-net,auto-update,tmux,prettier,pr-log,pre-commit,agent-teams \
--hooks=safety-net,auto-update,tmux,prettier,pr-log,pre-commit,agent-teams,native-tools \
--plugins=security-guidance,commit-commands,pr-review-toolkit,document-skills@anthropic-agent-skills

# Reuse a saved config
Expand Down
Loading
Loading