Skip to content

feat(local-llm): P-0 classifier opt-in + §10 ブランチ分離運用 (ADR-038 Phase 5)#123

Merged
aloekun merged 2 commits intomasterfrom
feature/local-llm-dogfood
May 7, 2026
Merged

feat(local-llm): P-0 classifier opt-in + §10 ブランチ分離運用 (ADR-038 Phase 5)#123
aloekun merged 2 commits intomasterfrom
feature/local-llm-dogfood

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 7, 2026

Summary

  • ADR-038 Phase 5 dogfood の着手 PR — docs/local-llm-offload-analysis.md に §10「ブランチ分離運用」を追加し、P-0 (config opt-in) として pr-monitor-config.toml[classifier] enabled=true を land
  • 後続の §A-2 P-1〜P-5 dogfood が master 上で classifier (mistral:7b) を自動起動できる状態にする
  • §8.D / §8.E / §8.F (新規実装、動作不確実) は feature/local-llm-dogfood 枝に残置 — 検証完了まで master に流さない

Changes

docs/local-llm-offload-analysis.md

  • §10 ブランチ分離運用追加 (8 サブセクション)
    • §10.1 方針 (Option B 隔離ベース) — 隔離スコープを §8.D/E/F (新規実装) に限定
    • §10.2 ブランチ構成 (master + feature/local-llm-dogfood)
    • §10.3 責務分担表 — P-0 / P-1〜P-5 / 非 LLM PR は master、§8.D/E/F は枝
    • §10.4 dogfood 実行手順 (master 上で classifier 自動起動)
    • §10.5 グローバル設定バックアップ規約 (__backup-claude-config/ 手動運用、強制 hook 化なし)
    • §10.6 採用 / 却下判断後の処理 — A 採用 / B §8.D 先行 / C 却下 (kill-switch checklist) / D 6 ヶ月経過
    • §10.7 検証作業の再開チェックリスト — A: P-N PR 着手 / B: §8.D/E/F 追加実装
    • §10.8 関連 ADR / 規約
  • §A-2 計測ログに P-0 完了状態を記録 (smoke test 結果含む)
  • §A-2 Setup 手順を master 完結型に整理 (枝 checkout step 削除)
  • 冒頭 front matter に「検証ブランチ運用」line 追加

pr-monitor-config.toml

  • [classifier] section 追加 (enabled=true / model=mistral:7b / endpoint=http://localhost:11434 / timeout_secs=30)
  • section コメントで kill-switch 経路を明示 (revert PR で enabled=false に戻す)

P-0 動作確認

  • Ollama: mistral:7b (4.0GB) + llama2:13b (6.9GB) 起動確認
  • classifier exe (.claude/cli-finding-classifier.exe, 2.2MB) 配備確認
  • finding {Major / unused import / remove statement}action=auto_fix / action_confidence=1.0 (妥当な分類)
  • cli-pr-monitor は新 [classifier] section を読み込み可、compile 通過

背景 — モデル簡素化の経緯

本セッション 1 ターン目で「ローカル LLM の検証作業を feature ブランチに分離したい」というユーザー要望に応じ、§10 で Option B (隔離ベース) を策定。当初は P-0 / P-1〜P-5 も feature 枝のみとしていたが、2 ターン目で「P-1〜P-5 は PR を個別に実装する想定」というユーザー directive を受け、隔離スコープを §8.D / §8.E / §8.F (新規実装) に限定 する model に整理。

判断根拠:

  1. master 上の classifier は smoke test で動作確認済 + revert PR が即時 fallback として機能するため、P-0 / P-1〜P-5 を枝に閉じ込めるのは過剰隔離
  2. P-1〜P-5 は通常 PR フローで classifier が自動起動 (§A-2 dogfood 効率化)
  3. §8.D/E/F (新規 prompt v2 / 新 facet / 新 skill 前処理) は動作不確実性が高いため枝で隔離継続

kill-switch

classifier 起動が予期せぬ問題を起こした場合は revert PR で [classifier] enabled = false に戻す のが kill-switch (§10.6 C 簡易版)。crate 削除等の物理削除は dogfood 失敗判定後にまとめて実施 (§10.6 C 完全版)。

Test plan

  • Ollama 起動確認 (curl -s http://localhost:11434/api/tags)
  • classifier exe 配備確認 (ls -la .claude/cli-finding-classifier.exe)
  • classifier smoke test (echo '[...]' | .claude/cli-finding-classifier.exe --timeout-secs 60 → JSON 妥当)
  • cli-pr-monitor compile + config parse (cargo run --bin cli-pr-monitor で no parse error)
  • pre-push-review pass (security-review APPROVE / simplicity-review APPROVE)
  • (後続セッション) P-1 (Bundle g-1, 順位 85+86) の post-pr-monitor で classifier 自動起動・分類妥当性を確認
  • (後続セッション) P-1〜P-5 の集計で agreement rate ≥80% / token 削減 ≥10% を達成

関連

  • ADR-038: ローカル LLM による CodeRabbit findings classification
  • §A-2: Phase 5 dogfood 計測 (本ファイル内、P-0 land 後に P-1 着手)
  • §10.6 C: kill-switch (revert PR の経路)

Summary by CodeRabbit

リリースノート

  • ドキュメント

    • ローカルLLM統合の段階的実行計画と運用ガイダンスを追加しました。
  • 新機能

    • ローカルLLM分類器をオプト機能として追加しました。Mistral 7Bモデルをサポートし、タイムアウトは30秒に設定されています。

aloekun added 2 commits May 7, 2026 18:11
§A-2 Phase 5 dogfood の前提セットアップ。pr-monitor-config.toml に
[classifier] section を追加し enabled=true でローカル LLM (mistral:7b) による
CodeRabbit findings classification を master 上で有効化。

§10 ブランチ分離運用を以下のように修正 (本セッション 2 ターン目のユーザー
directive 「P-1〜P-5 は PR を個別に実装する想定」に従い、過剰隔離を解消):

- §10.3: P-0 / P-1〜P-5 はすべて master ベース個別 PR (元案では feature 枝のみ
  だったが、master の classifier は smoke test 動作確認済 + revert PR が即時
  fallback として機能するため、過剰隔離だった)
- §10.4: dogfood は master 上で classifier 自動起動。枝切替不要
- §10.7: 再開チェックリストを A (P-N PR 着手) / B (§8.D/E/F 追加実装) に分割
- 隔離スコープを §8.D / §8.E / §8.F (新規実装) に限定
- §10.6 C/D の参照誤りを修正 (kill-switch は C、6 ヶ月経過は D)

§A-2 計測ログに P-0 完了状態を記録 (smoke test 結果含む)。Setup 手順から
枝 checkout step を削除 (master 上で完結する dogfood に対応)。

P-0 smoke test:
- Ollama: mistral:7b (4.0GB) + llama2:13b (6.9GB) 起動確認
- classifier exe (.claude/cli-finding-classifier.exe, 2.2MB) 配備確認
- finding {Major / unused import} → action=auto_fix / confidence=1.0 (妥当)
- cli-pr-monitor は新 [classifier] section を読み込み可、compile 通過

本 PR は feature/local-llm-dogfood → master の squash merge を想定。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

概要

ローカルLLM分類器(Ollama)の段階的検証と統合のための構成スキーマを追加し、フェーズ5計測計画、マスター/フィーチャーブランチ間の分離戦略、実行ガイダンス、および環境チェックリストを定義します。

変更内容

ローカルLLM検証統合ワークフロー

レイヤー / ファイル 概要
分類器構成スキーマ
pr-monitor-config.toml
新しい [classifier] セクションを導入。enabled: truemodel: "mistral:7b"endpoint: "http://localhost:11434"timeout_secs: 30 を設定。ADR-038 の検証およびキルスイッチ説明をコメント記載。
ブランチ分離戦略と運用計画
docs/local-llm-offload-analysis.md
§10「検証作業のブランチ分離運用」を新規作成。マスター vs feature/local-llm-dogfood の分離戦略、フェーズ5実行ステップ、グローバル CLAUDE 設定バックアップ規則、提案承認/却下時のキルスイッチを定義。初期運用ノートで§8.D/E/F をフィーチャーブランチに隔離。フェーズ5前提条件で P-0 のマスターランディングと P-1~P-5 の個別マスタープルリクエスト進行を明確化。
実行ガイドとチェックリスト
docs/local-llm-offload-analysis.md
検証作業再開チェックリスト(マスター同期、[classifier] 有効化確認、Ollama モデル確認、分類器実行可能性確認、計測ログ)を新規追加。P-1~P-5 再開 vs §8.D/E/F フィーチャーブランチ実装の分岐を記載。フィーチャーブランチ統合パス(§10.6 A 採択ルート)を指定。
ドキュメント参照更新
docs/local-llm-offload-analysis.md
「関連 ADR / 規約」参照リストを更新。提案ワークフロー、フェーズ5計測計画、ブランチ分離戦略を ADR-022、ADR-038、docs-governance.md に紐付け。

推定レビュー工数

🎯 2 (Simple) | ⏱️ ~12 分

関連の可能性があるプルリクエスト

  • aloekun/claude-code-hook-test#122: メインPRのドキュメント更新(フェーズ5検証計画とブランチ分離)が PR #122 の同一ファイル更新と重複・拡張関係にあります。

  • aloekun/claude-code-hook-test#120: メインPRのドキュメント内容と新しい [classifier] 構成が PR #120 の ClassifierConfig 実装と cli-pr-monitor 統合に直結し、同一構成フィールドとドキュメント領域を対象としています。

  • aloekun/claude-code-hook-test#121: 両PR が local-llm-offload-analysis.md ドキュメント(ADR-038)の更新と分類器統合進捗の記録を共有し、変更内容が直結しています。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、ローカルLLM分類器のオプトイン機能(P-0フェーズ)とブランチ分離運用戦略(§10)の追加を正確に反映しており、主な変更内容を明確に要約しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
docs/local-llm-offload-analysis.md (1)

354-356: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

jq フィルタに余分な ) があり、コンパイルエラーになります。

test("[a-zA-Z]{8,}") の後の ) が対応する ( なしに現れており、実行すると jq: error: compile error で失敗します。

🐛 修正案
-jq '[.classified_findings[] | select(.normalized_issue) | .normalized_issue | test("[a-zA-Z]{8,}"))]' .claude/pr-monitor-state.json
+jq '[.classified_findings[] | select(.normalized_issue) | .normalized_issue | test("[a-zA-Z]{8,}")]' .claude/pr-monitor-state.json

なお、このコマンドは true/false のブール値配列を返します。違反件数を直接カウントする場合は末尾に | length を追加するか、select(test(...)) 形式に変更するとより直接的です。

🤖 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 `@docs/local-llm-offload-analysis.md` around lines 354 - 356, The jq expression
contains an extra closing parenthesis after test("[a-zA-Z]{8,}") causing a
compile error; remove the stray ')' so the expression becomes valid and, if you
want a count rather than a boolean array, append | length or rewrite the
pipeline to use select(test(...)) to return matching objects directly; target
the jq command line shown (the expression using .classified_findings[],
.normalized_issue, and test("[a-zA-Z]{8,}")) and fix the unmatched parenthesis
and optionally add | length or change to select(test(...)) as described.
🤖 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.

Outside diff comments:
In `@docs/local-llm-offload-analysis.md`:
- Around line 354-356: The jq expression contains an extra closing parenthesis
after test("[a-zA-Z]{8,}") causing a compile error; remove the stray ')' so the
expression becomes valid and, if you want a count rather than a boolean array,
append | length or rewrite the pipeline to use select(test(...)) to return
matching objects directly; target the jq command line shown (the expression
using .classified_findings[], .normalized_issue, and test("[a-zA-Z]{8,}")) and
fix the unmatched parenthesis and optionally add | length or change to
select(test(...)) as described.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f97307c-a4da-4cb9-8e38-0e8122710b05

📥 Commits

Reviewing files that changed from the base of the PR and between a32a346 and b45b261.

📒 Files selected for processing (2)
  • docs/local-llm-offload-analysis.md
  • pr-monitor-config.toml

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