feat(claude): メモリ更新時にNotion反映リマインダーを注入するhookを追加 - #950
Conversation
~/.claude/projects/*/memory/ 配下へのWrite/Edit後に、NotionコンテキストDoc(🔄)とデイリーログへの反映確認をClaudeに自動注入する。反映漏れの再発防止。
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR documents new MCP server/credential support (Sentry, Gemini, Notion, GitHub Packages) in the credentials README, adds a Claude Code PostToolUse hook detecting memory file edits, updates Homebrew casks/brews, and extends the nix-darwin config test suite with new assertions. ChangesCredential Documentation
Estimated code review effort: 2 (Simple) | ~10 minutes Claude Code Memory Hook
macOS System Configuration
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3df1eb1778
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # NOTE: This list is duplicated in nix/home/zsh.nix (home.file). Keep both in sync. | ||
| # Clear previously exported tokens so removed entries in ~/.devcontainer.env don't linger. | ||
| unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN | ||
| unset SUPABASE_ACCESS_TOKEN VERCEL_TOKEN LINEAR_API_KEY DOPPLER_TOKEN ELU_SENTRY_TOKEN GEMINI_API_KEY ELU_NOTION_API_KEY OYKOT_NOTION_API_KEY GITHUB_TOKEN NODE_AUTH_TOKEN |
There was a problem hiding this comment.
Preserve inherited GitHub/npm tokens
When a devcontainer, Codespace, or parent shell already injects GITHUB_TOKEN or NODE_AUTH_TOKEN, this startup file now unsets them before it even checks whether ~/.devcontainer.env exists or contains replacements. Because nix/home/zsh.nix sources this loader during zsh startup, shells without those keys in ~/.devcontainer.env lose otherwise-valid GitHub/npm credentials and gh, npm package installs, or package publishing can fail; the home-manager copy of this list needs the same treatment.
Useful? React with 👍 / 👎.
| ] | ||
| }, | ||
| { | ||
| "matcher": "Write|Edit", |
There was a problem hiding this comment.
Match MultiEdit for memory updates
If a Claude Code version exposes MultiEdit (as the adjacent post-edit hook already accounts for), memory files changed via that tool skip this reminder entirely because the Claude Code hooks reference treats Write|Edit as an exact list of tool names, not a substring regex. Batched updates under ~/.claude/projects/*/memory/ therefore won't inject the Notion sync context even though they are the same memory-update scenario.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/settings.json:
- Line 277: The hook matcher currently only covers Write and Edit, so MultiEdit
changes will bypass the Notion-sync reminder. Update the matcher in the relevant
settings entry to include MultiEdit as well, matching the pattern used by the
neighboring hooks in the same configuration.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9e3577f0-a3bb-4fce-8e8a-b4e716f50583
📒 Files selected for processing (8)
.claude/settings.json.zsh/configs/pre/devcontainer-env.zshcredentials/README.mdcredentials/templates/mcp.env.templatenix/home/zsh.nixnix/modules/homebrew.nixtest/integration/credentials_templates.batstest/nix-darwin-config.test.js
|
(aside) |
|
Claude finished @keito4's task in 11m 7s —— View job コンフリクト解決完了 ✅
解決内容
|
mainブランチの最新変更をマージ。コンフリクト解決方針: - credentials/templates/mcp.env.template: mainによる削除を採用(private-config分離) - .zsh/configs/pre/devcontainer-env.zsh: mainのキーセット(4キー)を採用 - nix/home/zsh.nix: mainの外部allowlistファイル方式を採用 - nix/modules/homebrew.nix: duet/linear/readdle-spark(feature)+ jordanbaird-ice(main)をマージ - test/nix-darwin-config.test.js: mainの新テスト群 + duet/linear/readdle-spark の確認を追加 - test/integration/credentials_templates.bats: private-config未存在時はスキップする方式に更新 Co-authored-by: keito4 <keito4@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
nix/home/dotfiles.nix (1)
10-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHardcoded absolute path reduces portability.
privateConfighardcodes/Users/keito/develop/github.com/keito4/private-config/.... Sinceconfigis already passed into this module, prefer building the path fromconfig.home.homeDirectoryto avoid breakage if the username or home path differs.♻️ Proposed fix
privateConfig = path: { - source = config.lib.file.mkOutOfStoreSymlink "/Users/keito/develop/github.com/keito4/private-config/${path}"; + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/develop/github.com/keito4/private-config/${path}"; force = true; };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/home/dotfiles.nix` around lines 10 - 13, The privateConfig helper currently hardcodes an absolute /Users/keito/develop/github.com/keito4/private-config path, which makes the module non-portable. Update the privateConfig function in dotfiles.nix to build the symlink target from config.home.homeDirectory instead of a fixed username-specific path, while keeping the existing mkOutOfStoreSymlink and force behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/settings-hooks.test.js`:
- Around line 174-187: The drift check in referencedHookScripts only extracts
hooks/*.py matches from hook.command, so it misses inline or non-Python hooks
like the jq memory hook and can let mismatched settings pass. Update
referencedHookScripts in the settings-hooks parity test to collect and compare
normalized matcher + command pairs, or whole hook entries, from
settingsObject.hooks instead of scanning only .py script references, so the
comparison covers every hook command consistently.
---
Nitpick comments:
In `@nix/home/dotfiles.nix`:
- Around line 10-13: The privateConfig helper currently hardcodes an absolute
/Users/keito/develop/github.com/keito4/private-config path, which makes the
module non-portable. Update the privateConfig function in dotfiles.nix to build
the symlink target from config.home.homeDirectory instead of a fixed
username-specific path, while keeping the existing mkOutOfStoreSymlink and force
behavior unchanged.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: e2f984c8-eedd-49f5-b15e-bb734ab53100
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (58)
.claude/commands/sync-settings.md.claude/hooks/README.md.claude/hooks/stop_test_verification.py.context/code-complexity-baseline.json.context/complexity-report.md.devcontainer/Dockerfile.devcontainer/claude-settings.json.filelengthignore.github/workflows/claude-code-review.yml.github/workflows/claude.yml.github/workflows/scheduled-maintenance.yml.gitignore.zsh/configs/virtual/node.zsh.zsh/functions/opAGENTS.mdcommitlint.config.jscredentials/templates/devcontainer.env.templatecredentials/templates/mcp.env.templatedocs/adr/0016-use-kanary-for-keyboard-remapping.mddocs/adr/0017-manage-bettertouchtool-gestures.mddocs/adr/README.mddocs/mcp-servers-guide.mddocs/tool-catalog.mddot/aerospace.tomldot/config/agent-deck/config.tomldot/config/codespaces-secrets/repos.txtnix/home/default.nixnix/home/dotfiles.nixnix/home/input-source.nixnix/home/zsh.nixnix/hosts/darwin/default.nixnix/modules/homebrew.nixpackage.jsonscript/README.mdscript/check-workflow-template-sync.jsscript/credentials.shscript/macos/agent-select-input-source.shscript/macos/select-input-source.swiftscript/macos/setup-bettertouchtool.jsscript/repo-maintenance.shscript/update-agents-md.shtemplates/workflows/claude.ymltemplates/workflows/scheduled-maintenance.ymltest/brew-categories.test.jstest/claude-workflow-contract.test.jstest/eslint-complexity-rules.test.jstest/eslint-main-config.test.jstest/hooks-integrity.test.jstest/hooks-lifecycle.test.jstest/hooks-post-pr-tools.test.jstest/hooks-post-tools.test.jstest/integration/core-scripts.batstest/integration/credentials_templates.batstest/integration/lib_functions.batstest/issue-resolver-agents.test.jstest/nix-darwin-config.test.jstest/required-workflow-trigger.test.jstest/settings-hooks.test.js
💤 Files with no reviewable changes (6)
- dot/config/agent-deck/config.toml
- dot/config/codespaces-secrets/repos.txt
- credentials/templates/devcontainer.env.template
- credentials/templates/mcp.env.template
- script/macos/select-input-source.swift
- test/claude-workflow-contract.test.js
✅ Files skipped from review due to trivial changes (13)
- .github/workflows/scheduled-maintenance.yml
- script/macos/agent-select-input-source.sh
- .filelengthignore
- nix/home/input-source.nix
- test/hooks-integrity.test.js
- .gitignore
- .zsh/configs/virtual/node.zsh
- .context/code-complexity-baseline.json
- docs/adr/README.md
- docs/adr/0016-use-kanary-for-keyboard-remapping.md
- .claude/hooks/README.md
- .context/complexity-report.md
- AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (1)
- test/integration/credentials_templates.bats
| function referencedHookScripts(settingsObject) { | ||
| const scripts = new Set(); | ||
| const events = Object.values(settingsObject.hooks || {}); | ||
| for (const entries of events) { | ||
| for (const entry of entries) { | ||
| for (const hook of entry.hooks) { | ||
| for (const match of hook.command.matchAll(/hooks\/(\w+\.py)/g)) { | ||
| scripts.add(match[1]); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return scripts; | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
sed -n '1,260p' test/settings-hooks.test.jsRepository: keito4/config
Length of output: 10685
🏁 Script executed:
python3 - <<'PY'
import json, pathlib
for p in [pathlib.Path('.claude/settings.json'), pathlib.Path('.devcontainer/claude-settings.json')]:
data = json.loads(p.read_text())
print(f'FILE: {p}')
for event, entries in data.get('hooks', {}).items():
print(f' EVENT: {event}')
for entry in entries:
print(f' matcher: {entry.get("matcher")}')
for hook in entry.get('hooks', []):
print(f' type={hook.get("type")} command={hook.get("command")}')
print()
PYRepository: keito4/config
Length of output: 6131
Parity test should compare full hook commands, not just .py scripts test/settings-hooks.test.js:174-187 The jq memory hook in .claude/settings.json is skipped by referencedHookScripts(), so an inline hook added to only one settings file can still pass this drift check. Compare normalized matcher + command pairs (or full hook entries) instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/settings-hooks.test.js` around lines 174 - 187, The drift check in
referencedHookScripts only extracts hooks/*.py matches from hook.command, so it
misses inline or non-Python hooks like the jq memory hook and can let mismatched
settings pass. Update referencedHookScripts in the settings-hooks parity test to
collect and compare normalized matcher + command pairs, or whole hook entries,
from settingsObject.hooks instead of scanning only .py script references, so the
comparison covers every hook command consistently.
|
(aside) |
|
Claude finished @keito4's task in 10m 53s —— View job コンフリクト解決完了 ✅
解決内容前回のClaudeが
補足
|
…ommit) mainブランチの最新変更(PR#949: 型安全性改善)をマージ。 前回のgit read-treeによる単一親コミットを置き換え、正しいマージコミットを作成。 コンフリクト解決方針: - .claude/settings.json: HEADのメモリhookを保持 + matcherをWrite|Edit|MultiEditに修正 - credentials/README.md: HEADのSentry/Gemini/Notion/GitHub Packages参照を保持 - nix/modules/homebrew.nix: HEADのduet/linear/readdle-spark追加を保持 - test/nix-darwin-config.test.js: HEADのduet/linear/readdle-sparkテストを保持 Co-authored-by: keito4 <keito4@users.noreply.github.com>
|
🎉 This PR is included in version 1.121.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Why
ローカルのClaude自動メモリ(~/.claude/projects/*/memory/)を更新した際に、Notion側(コンテキストDocの🔄・デイリーログ)への反映を忘れるケースがあったため。
What
How
Risk
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes