Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "repo-approved temporary workspace(.claude/tmp/ と tmp/ の両方)を Vitest の test discovery から除外し、pnpm test をこれらの working tree に依存させない"
change_kind: workflowRuntime Verification Applicability
decision: immediate
applicable_acs:
- AC3
execution_environment:
cli_tools:
- node
- pnpm
auth_required: false
network_required: false
skip_conditions:
- "local repository checkout に node_modules が存在せず pnpm exec / node が利用できない場合は SKIP ではなく environment blocked として扱う"
fallback_policy:
fallback_success_is_pass: false
notes: "fallback 経由の成功を PASS に変換しない"
artifact_requirements:
- "scripts/verify-vitest-discovery-policy.mjs の probe 実行 stdout/stderr"
- "pnpm test の実行結果"reason: AC3 相当が .claude/tmp/ と tmp/ の双方に sentinel test file を実配置し、Vitest discovery / pnpm test プロセスの実挙動を確認することを要求するため。
Parent Issue
なし(単独改善)
Parent Goal Ref
- Goal: repo-approved temporary workspace(
.claude/tmp/とtmp/の class 単位)が unit-test discovery を汚染しないようにする。 - Desired Destination: N/A(単独改善 Issue のため)
Current Validated Scope
package.jsonのtestscript と.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.pyのtestgate 定義の両方に.claude/tmp/**とtmp/**の Vitest exclude を同期して追加する。tests/vitest-test-discovery-policy.test.tsを新設し、testscript が.claude/tmp/**/tmp/**と既存の.claude/worktrees/**/tests/e2e/**exclusion を保持することを検証する。scripts/verify-vitest-discovery-policy.mjsを新設し、.claude/tmp/とtmp/双方に sentinel test file を実配置する probe で discovery 除外を実行時検証する。
Remaining Parent Gaps
なし(単独改善 Issue のため)
Outcome
package.json の unit-test script、およびそれを fail-closed で検証する pnpm_gate_registry.py の test gate 定義が、.claude/tmp/** と tmp/** の双方を Vitest discovery から class 単位で除外し、その契約テストと sentinel probe が repo-approved temporary workspace 内の test file を収集せずに PASS する状態。
In Scope
package.jsonのtestscript へ.claude/tmp/**とtmp/**の exclude を追加する。.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.pyの_SCRIPTS["test"]をpackage.jsonのtestscript と同一の canonical 文字列へ同期する(pnpm_gate_registry.pyはpackage.jsonのtestscript と完全一致比較で fail-closed 検証するため)。- test discovery exclusion の static contract test(
tests/vitest-test-discovery-policy.test.ts)を新設する。 .claude/tmp/とtmp/双方に一意な sentinel test file を実配置し、discovery 除外の有無で収集結果が変わることを検証する probe script(scripts/verify-vitest-discovery-policy.mjs)を新設する。probe は成功・失敗いずれの場合も配置した sentinel を cleanup する。- 既存の
tests/e2e/**と.claude/worktrees/**exclusion が維持されることを test で固定する。 .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.pyの既存 regression が壊れないことを維持する。
Out of Scope
tmp//.claude/tmp//.claude/worktrees/の削除、cleanup authority、ownership marker の変更。- Vitest の dependency 追加・更新、
test/pnpm_gate_registry.pyのtestgate 以外の package script・gate 定義の変更。 - E2E / Playwright の test discovery 変更。
Acceptance Criteria
- AC1:
package.jsonのtestscript と.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.pyの_SCRIPTS["test"]が、tests/e2e/**、.claude/worktrees/**、.claude/tmp/**、tmp/**の 4 exclude を同一の canonical 文字列として保持する(両ファイルの同期)。 - AC2:
tests/vitest-test-discovery-policy.test.tsがtestscript の上記 4 exclusion 文字列(tests/e2e/**、.claude/worktrees/**、.claude/tmp/**、tmp/**)すべてをソース内で参照する静的契約テストとして新設される(実行時の discovery 除外確認は AC3 の sentinel probe に一本化する)。 - AC3:
scripts/verify-vitest-discovery-policy.mjsが.claude/tmp/とtmp/双方に一意な sentinel test file を作成する probe を実行し、(a) 除外を外した discovery では sentinel が発見されること、(b) canonical exclude 設定では発見されないこと、(c) sentinel が存在する状態でpnpm testが成功すること、(d) probe directory が成功・失敗いずれの場合も cleanup されること、を検証する。 - AC4:
.claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.pyの既存 regression test が引き続き PASS する(registry とpackage.jsonの同期が壊れていないことの確認)。
Verification Commands
# AC1
$ rg -n -F -- "--exclude '.claude/tmp/**'" package.json
$ rg -n -F -- "--exclude 'tmp/**'" package.json
$ rg -n -F -- "--exclude '.claude/tmp/**'" .claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py
$ rg -n -F -- "--exclude 'tmp/**'" .claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py
# AC2
# baseline-expect: fail
$ rg -n -F -- "'.claude/tmp/**'" tests/vitest-test-discovery-policy.test.ts
# baseline-expect: fail
$ rg -n -F -- "'tmp/**'" tests/vitest-test-discovery-policy.test.ts
# baseline-expect: fail
$ rg -n -F -- "'.claude/worktrees/**'" tests/vitest-test-discovery-policy.test.ts
# baseline-expect: fail
$ rg -n -F -- "'tests/e2e/**'" tests/vitest-test-discovery-policy.test.ts
# AC3
# baseline-expect: fail
$ test -f scripts/verify-vitest-discovery-policy.mjs
# AC4
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.pyAllowed Paths
- package.json
- .claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py
- .claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py
- tests/vitest-test-discovery-policy.test.ts
- scripts/verify-vitest-discovery-policy.mjs
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- なし
Required Design References
- docs/dev/workflow.md
- docs/dev/repository-folder-policy.md
Scope Delta(該当時のみ記載)
- 追加:
.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.py(_SCRIPTS["test"]の同期)、.claude/skills/issue-contract-review/tests/test_pnpm_gate_security_boundary.py(既存 regression 維持確認)、scripts/verify-vitest-discovery-policy.mjs(sentinel probe 新設)を Allowed Paths に追加。 - 追加:
tmp/**を discovery exclusion の scope に追加し、.claude/tmp/**のみだった元の class-instance 単位の記述を、temporary workspace class 単位(.claude/tmp/とtmp/双方)へ拡張。 - 変更: 既存の
.claude/worktrees/**/tests/e2e/**exclusion を維持したまま、.claude/tmp/**とtmp/**を同じ test discovery boundary に追加。AC2 の検証手段をファイル存在チェックからpnpm testの focused 実行に変更(pnpm exec vitest runは pnpm gate allowlist 違反のため)。AC3 相当を静的チェックから sentinel probe による実行時検証(runtime-verification: true)に変更。 - 変更理由: OWNER の敵対的レビュー(issuecomment-5001909838)で以下が fact-check 済み(confirmed)として指摘され、続く issuecomment-5002227104 の
ANCHOR_SCOPE_REFRAME_V1で scope 拡張と Allowed Paths delta が承認された。- Blocker 1:
pnpm_gate_registry.pyの_SCRIPTS["test"]がpackage.jsonのtestscript と完全一致比較され、不一致だとmanifest_integrity:closure_drift:testで fail-closed 拒否するため、pnpm_gate_registry.pyを Allowed Paths と AC に含める必要がある。 - Blocker 2: 単なる
pnpm testの実行だけでは除外漏れでも意図せず PASS しうるため、sentinel を用いた再現性のある probe が必要。 - Blocker 3:
rg -n -- "--exclude '.claude/tmp/**'" package.jsonは ripgrep のデフォルト正規表現モードで**がリテラルマッチせず no-match(exit 1)になるため、-F(fixed-strings)が必須。 - Major 1:
test -f tests/vitest-test-discovery-policy.test.tsはファイル存在しか検証しないため、pnpm exec vitest runの focused 実行に変更する。 - Major 2(ユーザー選択): scope を
.claude/tmp/のみでなくtmp/**も含む class 単位に拡張する。 - AC2 VC 再設計(impl-review-loop preparation preflight で確認):
pnpm_gate_registry.pyのgate_for_requestは("pnpm", "test")の厳密 2-token 一致のみを受理し、追加引数を渡す focused 実行(pnpm test <file>やpnpm exec vitest run <file>)はいずれもpnpm_gate:noncanonical_request_argv/command_not_allowedで fail-closed に拒否される。この VC 実行環境では CLI 経由の focused vitest 実行が構造的に不可能なため、AC2 を「focused 実行で欠落時に fail する」設計から「tests/vitest-test-discovery-policy.test.tsが 4 exclusion 文字列を静的に参照することをrg -n -Fで確認する」設計へ変更した。新設ファイルに対するrgの baseline 実行(ファイル未作成)はbaseline_vc_preflight.pyのnew_file_missing_expected分類(exit_code 2、stdout 空、stderr が missing-path pattern、path operand が Allowed Paths 内)でexpected_fail/goに決定論的に分類される。実行時の discovery 除外確認は AC3 の sentinel probe(test-runner が直接実行する runtime-verification: true 経路)に一本化し、AC2 は静的整合性確認に専念させる。
- Blocker 1:
- 削除: なし。
Delivery Rule
1 Issue = 1 PR- isolation worktree で実装する。
- Draft PR を既定とする。
Notes for Reviewer
- 根本原因は
pnpm testが.claude/tmp/pr1534-step2-{current,final,rerun}を Vitest test file として収集し、作業ツリー由来の失敗を unit-test regression と誤判定したことである。 - 決定論的修正として package script と
pnpm_gate_registry.pyの同期 discovery boundary を更新する。temporary workspace を削除する workaround は folder policy の report-only / cleanup authority 境界に反するため採用しない。 - OWNER の敵対的レビュー(issuecomment-5001909838)と
ANCHOR_SCOPE_REFRAME_V1(issuecomment-5002227104)で、pnpm_gate_registry.pyの完全一致比較による fail-closed 拒否、rgの**リテラルマッチ非対応(-F必須)、sentinel を用いた再現性検証、tmp/**を含む class 単位 scope 拡張が確認・承認された。技術的根拠の詳細は当該コメントを参照。 - Scope Collision (C1): 実装: Codex の SubagentStop scope-rollup capture を復旧する #1527、実装: CHATGPT_RETRO_CONTEXT marker候補判定を厳密化し、resolve-liveにfail-closed assertionを追加する #1501、実装: deploy-pages/CI で production dist への E2E hook 漏洩を fail-closed 検査する #1425、実装: visual diff AI/VLM triage を非ブロッキング助言として分離する #1390、実装: Vitest Browser Mode component VRT を report-only scaffold として追加する #1389、実装: required CI を snapshot read-only に固定し baseline canonicalization を reviewed PR 境界に限定する #1388、実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する #1386、実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326、実装: M4 Upgrade Loop の E2E / preview evidence を追加する #1283、導入: M4 Upgrade Loop 実装 parent tracker #1176、実装: AI作業ログ public-safe 要約スクリプトを追加する #947、実装: e2e 実行前に CJK フォント可用性を fail-fast 検査し豆腐 baseline の誤再生成を防ぐ #754、実装: playtest-log の JSON Schema / validator の追加 #420、実装: .claude/skills 配下スクリプトの executable bit を監査し CI guard を追加する #205、実装: SSOT 文書に YAML Frontmatter を導入し docs/ssot-registry.generated.yml を自動生成する #198 が
package.jsonまたはtestsを含む。今回の edit intent はtestscript /pnpm_gate_registry.pyのtestgate の exclude list と専用 contract test・probe script のみであり、各 Issue の feature script / runtime / VRT / CI contract を変更しない。 - 発見元: 実装: session_manifest_coordinator.sh 経由の legacy-state diagnostic e2e 可観測性を検証する #1432 の refinement preflight。実装: session_manifest_coordinator.sh 経由の legacy-state diagnostic e2e 可観測性を検証する #1432 は coordinator legacy-state E2E の契約を保持し、本 Issue の完了後に
pnpm testをその regression gate として再利用する。 - impl-review-loop preparation(issue-contract-review preflight)で AC2 VC の pnpm allowlist 違反を検出・修正(本 Scope Delta 追記のみ、AC/Allowed Paths/Outcome の実質変更なし)。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 17, 2026
you asked
message time: 2026-07-17 06:58:59
#1545
内容について関連Issue、PR、リポジトリ資産、コメントを参照した上で敵対的レビューして。
取り扱う技術や配布物の実装をWEB検索し高品質化してほしい。
chatgpt response
Issue本文・コメント・関連PR/Issue・実装を照合し、主張の弱点、破壊条件、未検証前提、代替案を敵対的に検証します。外部仕様は一次資料と実装を優先します。
chatgpt response
Issue #1545 はコメントがなく、静的検査では実行時の収集境界を証明できません。Vitest の
list --filesOnly --static-parseと汚れたローカル環境での再現試験が必要です。chatgpt response
さらに、
.claude/tmp/は正規worktree配置規約に反し、除外追加は逸脱を隠蔽します。加えてtestscript の重複固定により、Allowed Paths内の変更だけではclosure_drift:testに拒否されます。chatgpt response
判定
REQUEST_CHANGES — 現状の Issue 契約では実装着手不可です。
.claude/tmp/**を Vitest の discovery から除外する技術判断自体は妥当です。しかし #1545 は、リポジトリ固有のpnpm testセキュリティ境界をスコープから落としており、AC3 は再現条件を生成せず、AC1 の Verification Command も成立しません。Allowed Paths のまま実装すると、Issue 自身の Stop Condition に到達します。なお #1545 には現時点でコメントがないため、以下は実装差分ではなく Issue 契約に対するレビューです。関連 Issue / PR の位置づけ
pnpm testを実行したことが発見経路です。package.json変更はbootstrapscript の追加だけで、testscript 自体は変更していません。したがって feat: Codex scope-rollup capture を復旧 (#1527) #1534 はコード上の回帰原因というより、既存の discovery 境界不備を顕在化させた環境です。pnpmgate registry と manifest integrity 検査が導入されています。Blocker 1 — Allowed Paths が
pnpm testの正本を漏らしている現在の
package.jsonは次の script を持っています。ところが同じ文字列は、
.claude/skills/issue-contract-review/scripts/pnpm_gate_registry.pyの_SCRIPTS["test"]に完全一致値として重複定義されています。registry はpackage.jsonの script と期待値を完全一致比較し、差があればmanifest_integrity:closure_drift:testとして実行前に拒否します。したがって、Issue の Allowed Paths に従って
package.jsonだけを変更すると、リポジトリの canonical gate が壊れます。これは単なるテスト漏れではなく、#1511/#1529 で追加された fail-closed 境界との衝突です。既存の security-boundary test も registry を唯一の authority として扱い、manifest drift を launch 前に拒否する設計です。必須修正
Allowed Paths に最低限、次を追加する必要があります。
後者は既存テストが自動追従するだけなら編集不要かもしれませんが、変更可能範囲として明示し、少なくとも focused regression を実行すべきです。
Blocker 2 — AC3 は再現条件を作っておらず、実装前後を区別できない
AC3 は「
.claude/tmp/配下に一時 worktree が存在する状態で、そこにあるテストファイルを収集しない」と要求しています。しかし VC は単に次の一行です。pnpm test.claude/tmp/は.gitignore対象です。CI はactions/checkoutしたクリーンな Ubuntu 環境でpnpm testを実行するため、通常は問題を起こしたローカル一時 worktreeが存在しません。結果として、現在の AC3 は以下のすべてで PASS し得ます。
.claude/tmp/が空これは Issue authoring 規約が禁止する
unexpected_pass型の VC です。同規約も、実装前に確実に失敗する条件へ書き換えることを求めています。必要なのは negative control を含む sentinel probe です。
.claude/tmp/vitest-discovery-probe-<unique>/sentinel.test.tsを作る。pnpm testが成功することを確認する。finally相当で自分が作った probe directory を削除する。Vitest 4.1 には
vitest list --filesOnlyがあり、--jsonと--static-parseを組み合わせて、テストを実行せず discovery 結果を機械判定できます。全 suite の成否だけを見るより、この機能を negative control に使う方が決定的です。 (Vitest)Blocker 3 — AC1 の
rgコマンドが意図した文字列を検査しない現在の VC は次の形です。
rg -n -- "--exclude \'.claude/tmp/**\'" package.jsonripgrepは既定で検索パターンを正規表現として解釈します。この VC は glob の**を正規表現として扱ううえ、二重引用符内の\'も不要です。意図した post-change の script 行に対する固定文字列検査になっていません。ripgrep でリテラル検索する場合は-F/--fixed-stringsが必要です。 (GitHub)最低限、次に修正すべきです。
rg -n -F -- "--exclude '.claude/tmp/**'" package.jsonより強くするなら、exclude の部分文字列ではなく
scripts.testの完全な期待値を JSON として検査してください。部分文字列検査では、無効な位置への追記、重複指定、別 script への混入でも PASS します。Major 1 — AC2 はテストの存在しか証明していない
AC2 は「3つの除外を検証し、どれかが欠ければ失敗する test」を要求しています。一方 VC は次だけです。
test -f tests/vitest-test-discovery-policy.test.tsこれは空ファイル、全 test が
skipされたファイル、常に PASS する無意味な assertion でも成功します。リポジトリの workflow は各 AC が独立に検証可能であることを要求しており、AC2 はその条件を満たしていません。少なくとも focused 実行に変えるべきです。
pnpm exec vitest run tests/vitest-test-discovery-policy.test.tsPR #1534 の検証でも、同形式の focused Vitest command が使われています。
ただし、この静的 test は補助的な regression guard に留めるべきです。文字列が存在することと、Vitest が実際にファイルを除外することは別の性質です。
Major 2 — Outcome の境界が folder policy と一致していない
Issue の goal は「repo-approved temporary workspace を Vitest discovery から除外する」と一般化されています。しかし folder policy 上、同じ
repo_approved_temporary_workspaceに属するのは次の2つです。tmp/.claude/tmp/Issue が除外するのは
.claude/tmp/**だけです。Vitest 4 は既定でnode_modulesと.gitしか除外しないため、tmp/内に*.test.tsがあれば同じ汚染が起き得ます。 (Vitest)どちらかを明示的に選ぶ必要があります。
.claude/tmp/のみ」に限定する。tmp/**も除外し、双方に対する sentinel test を置く。現在のタイトルは前者ですが、goal_ref と説明は後者を主張しており、契約が過剰に一般化されています。
Major 3 — 「cleanup は policy 違反」という説明が不正確
folder policy は、現在の
post-merge-cleanupSkill/SubAgent の権限を常にreport_onlyとしています。一方で lifecycle policy は、tmp/と.claude/tmp/の所有者が自分の session subdirectory を削除するか残置理由を報告することを求めています。valid marker child は将来の executor に対するeligible_for_deleteです。したがって、正確な説明は次です。
「cleanup 自体が folder policy に違反する」と一般化するのは誤りです。除外追加が必要であるという結論は変わりませんが、根拠は修正すべきです。
Major 4 —
.claude/tmp/に実 Git worktree を作る producer が未特定workflow の canonical worktree 配置先は
.claude/worktrees/...です。#1545 は
.claude/tmp/pr1534-step2-{current,final,rerun}を「一時 worktree」と呼んでいます。この記述が正しいなら、以下のいずれかです。除外追加は defense-in-depth として正しいものの、producer、作成コマンド、ownership marker、残置理由を特定しないままでは、原因分析が「Vitest が見つけた」地点で止まっています。producer 側を直さない理由、または別 Issue へ送ることを明記すべきです。
Runtime Verification Applicability も再判定が必要
現在の
not_applicable理由は「外部サービス・権限・ネットワークが不要」であることを中心にしています。しかし repo policy の判定基準はネットワークの有無ではなく、静的検査だけで完結するか、プロセス・I/O を必要とするかです。AC3 は実ファイルを配置して Vitest discovery/process を確認する要求なので、本文どおりに検証するならimmediate側です。標準
pnpm testだけで完結する静的回帰ゲートは runtime policy の対象外ですが、現在の AC3 は fixture の作成が欠落しているため「標準コマンドだけで十分」な状態ではありません。推奨は次のいずれかです。
runtime-verification: trueを付け、sentinel discovery log を evidence とする。not_applicableを維持する。ただしこの場合、「実際に収集されない」という保証は弱くなります。前者が妥当です。
技術選択自体の評価
リポジトリは lockfile 上で Vitest 4.1.6 を使用しています。
Vitest v4 の仕様では、
excludeは project root、既定ではprocess.cwd()を基準に解決される--excludeは複数回指定でき、設定値に加算されるtinyglobbyが使われるため、repo root からの
.claude/tmp/**というパターン自体は正当です。 (Vitest)現行 upstream 実装も、project cwd に対して
dot: trueを設定し、excludeをtinyglobbyのignoreに渡しています。したがって dot-directory である.claude/を対象にできる点にも問題はありません。つまり、問題は 修正内容ではなく、Issue のスコープ・正本同期・検証設計 です。
推奨する修正版契約
最小修正案
Acceptance Criteria は次の形に再編するのが妥当です。
package.jsonとpnpm_gate_registry.pyが、3つの exclude を含む同一の canonicaltestscript を保持する。.claude/tmp/に一意な failing sentinel を作る。pnpm testでは sentinel が収集されず、suite が成功する。Verification Commands の最低構成は次です。
より良い設計案
長期的には discovery policy を長い
package.jsonscript に保持せず、既存のvite.config.tsのtest.excludeに移す方が堅牢です。現在のvite.config.tsには Vitest 設定がありません。Vitest は既存の Vite config を読み取るため、同じファイルへ
test設定を追加すれば、pnpm testだけでなく直接の Vitest CLI や editor integration にも同じ discovery policy が適用されます。公式にも Vite/Vitest で同じ config を使う構成が推奨されています。別のvitest.config.tsを作る場合はvite.config.tsを上書きするため、明示的な merge が必要です。 (Vitest)設定で
excludeを指定すると Vitest の既定値を置き換えるため、次のようにconfigDefaults.excludeを保持する必要があります。 (Vitest)ただし、この案でも
package.jsonの script を短縮・変更するならpnpm_gate_registry.pyの同期は必須です。結論として、#1545 の実装意図は採用可能ですが、現状は最低でも Blocker 1〜3と Runtime Verification Applicability を修正してから着手すべきです。
you asked
message time: 2026-07-17 07:50:43
そもそも .claude/tmp の運用について認識していない。tmp/ではないのか。リポジトリ資産に.claude/tmp の運用についてドキュメントかエージェントスキルなどに書かれているか?ClaudeやCodexのメモリなどに書かれてしまっていないか? tmp/ へ集約したい。
chatgpt response
.claude/tmp/の記載箇所、導入経緯、Claude/Codex向け指示面を横断して確認します。tmp/集約時に変更が必要な正本・consumer・テストまで特定します。現時点で、
.claude/tmp/は偶発的な残骸ではなく、AGENTS.md、フォルダポリシー、cleanup skill、schema、guard、classifier にまで組み込まれています。Codex向け指示面には明示されています。現行資産では
.claude/tmp/の常用 producer は見つかっていません。一方、利用を許可・推奨するルールだけが広範囲に残っており、運用実態よりポリシーが先行している状態です。結論
はい。
.claude/tmp/は現在、リポジトリ固有の正式な運用ルールとして複数箇所に埋め込まれています。Claude/Codexの製品標準ではなく、Issue #1404 で正式ポリシーへ昇格され、#1417 で schema・classifier・cleanup 契約にまで固定されたものです。
tmp/への一本化が妥当です。Claude / Codexの「メモリ・指示」に入っているか
Codex:明示的に入っている
ルートの
AGENTS.mdに、次の記述があります。OpenAIの公式説明では、リポジトリ内の
AGENTS.mdはCodexへ持続的なリポジトリ文脈として与えられます。したがって、これは実質的にCodexのrepo-level memory/instructionです。(OpenAI)Claude:
CLAUDE.md本体にはないが、動的に注入される現在の
CLAUDE.md自体には.claude/tmp/の記載はありません。記載されているのは、.claude/skills/**/SKILL.mdをCodexにも流用するという入口だけです。しかし、Claude Codeの
.claude/settings.jsonはroot_temporary_residue_advisory.shをPreToolUse hookとして登録しています。このhookが呼ぶproducerは、エージェントの追加コンテキストに次の内容を注入します。
tmp/,.claude/tmp/tmp/ または .claude/tmp/ を使うCodex側にも同じhookが登録されています。
つまり、Claude/Codexの両方が作業中に
.claude/tmp/を推奨候補として受け取る構造です。Claude Codeのユーザー領域にある
~/.claude/CLAUDE.mdなどはGitHubからは確認できません。Claude Codeでは/memoryによりロード済みmemory fileを確認できます。(Claude Platform Docs)埋め込まれている主なリポジトリ資産
指示・SSOT
AGENTS.mddocs/dev/repository-folder-policy.mddocs/dev/agent-skill-boundaries.mddocs/dev/hook-boundaries.md.claude/skills/post-merge-cleanup/SKILL.mdfolder policyは
tmp/と.claude/tmp/を同じrepo_approved_temporary_workspaceとして定義しています。agent boundaryも、両方を正規rootとして扱っています。
cleanup skillも両方を削除禁止・将来の削除候補rootとして列挙しています。
実装
scripts/agent-guards/root_temporary_residue_policy.pyscripts/agent-ops/temp_residue_marker.pyscripts/agent-ops/temp_residue_classifier.pyclassifierは両方をapproved rootとしてハードコードしています。
marker validatorも両方を許可しています。
Schema
schemas/temp_residue_owner_v1.schema.jsonschemas/repo_temp_folder_advice_v1.schema.jsonowner schemaは
.claude/tmpを正規のtarget_relpathとして受理します。advisory schemaはapproved rootsを2件必須としており、
tmp/と.claude/tmp/の両方をenumに持ちます。Tests
scripts/agent-guards/tests/test_root_temporary_residue_policy.py.claude/hooks/tests/test_root_temporary_residue_advisory.pytests/codex/test_root_temporary_residue_advisory.pytests/agent_ops/test_temp_residue_classifier.pyテストは
.claude/tmp/を「advisoryを出さない正規パス」として明示的に固定しています。classifier testも
.claude/tmp/session-ownedを削除候補になり得るapproved sessionとして固定しています。.gitignore.claude/tmp/はignore対象です。.claude/tmp/pr1534-step2-*は何だったのかtracked repository内には、
.claude/tmp/にworktreeを作成する恒常的なproducerは見つかりませんでした。正式なworktree配置先は次です。
したがって
.claude/tmp/pr1534-step2-*は、既存scriptの正規動作ではなく、エージェントが「.claude/tmp/はapproved workspace」という指示を解釈して一時checkout/worktreeを作った可能性が高いです。つまり原因はVitestだけではなく、
.claude/tmp/を正式なworkspaceとして宣伝しているというポリシー設計です。
tmp/一本化の方針#1545をそのまま実装して
.claude/tmp/**をVitestから除外するのは推奨しません。問題のある運用を温存します。Issueは次の目的へ置き換えるべきです。
第1段階:新規利用を停止
AGENTS.mdはtmp/のみを正本とする.claude/tmp/のapproved指定を外す.claude/tmp/**への新規Write/Bashには、tmp/へ移行するnon-blocking advisoryを返す.claude/tmp/をlegacy/report-onlyとして検出するtmp/<session>のみ許可する.claude/tmp/をapproved候補ではなくlegacy residueとして報告する現在のguardは先頭segmentが
.claudeの場合、無条件に検出対象外へ落としています。したがって.claude/tmpの明示的なdeprecated判定が必要です。第2段階:残置物を除去してignoreを外す
.claude/tmp/をread-onlyで棚卸しgit worktree list --porcelainと照合tmp/または.claude/worktrees/へ移行.gitignoreから.claude/tmp/を削除Schema上の注意
temp_residue_owner/v1から.claude/tmpを単純に削除すると、許可値の縮小=breaking changeです。schema catalogも
narrow_typeとtrust model変更をbreaking changeとして扱い、migrationとfollow-up Issueを要求しています。そのため、第1段階では次が安全です。
.claude/tmpmarkerを読めるまま残すtmp/しか生成しない.claude/tmpmarkerは常にlegacy/report-only最終判断
tmp/への集約に賛成です。現在の構成では、
tmp/は既にIssue本文・中間成果物・artifact exportの正規パスとして使用されている。.claude/worktrees/という専用rootがある。.claude/tmp/に固有の用途は定義されていない。.claude/tmp/の存在が一時checkoutの誤配置とtest discovery汚染を誘発している。したがって、
tmp/=一般一時ファイル、.claude/worktrees/=Git worktreeという2区分に整理し、.claude/tmp/は廃止するのが最も明確です。Powered by AI Exporter
squne121 commentedon Jul 17, 2026
squne121 commentedon Jul 17, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 17, 2026
Contract Review Result
squne121 commentedon Jul 17, 2026
implement-issue: 実装完了・PR起票は overlap preflight hard gate によりブロック(2026-07-17)
.claude/worktrees/issue-1545-vitest-tmp-discovery-excludeworktree-issue-1545-vitest-tmp-discovery-exclude(push 済み、head55fe582e01273548802e02c8ecb93450aae862b4)pnpm typecheck/pnpm lint/pnpm test(97 files, 1580 tests)/pnpm build)scripts/verify-vitest-discovery-policy.mjsの runtime probe を含む)PR 起票がブロックされている理由
open_pr.pyの overlap preflight hard gate(Issue #1458)がcheck_implementation_overlap.pyをオンライン再実行し、route: human_review_requiredを返すためgh pr createを実行できません。原因は本 Issue と無関係な2件の候補 Issue が、classifier の厳密な見出しマッチ(
^##\s+Outcome\s*$/^##\s+In Scope\s*$)を満たさないことです。## Outcome/## In Scope見出しが存在しない legacy 形式(## Goalを使用)。## In Scope(refinement で確定)のように見出しに追記があり、厳密一致 regex に一致しない。両候補とも本文を直接確認し、本 Issue(Vitest discovery exclusion)と意味的に disjoint であることを手動確認済みです(詳細は PR body ドラフトの Notes セクション参照)。ただし
open_pr.pyの hard gate は fresh route がproceed/proceed_with_collision_evidenceのときのみ通過する設計であり、手動確認による override機構は用意されていません(既存のoverlap_readback_waiverは #519/#520/#1429 に固定・期限切れのため対象外)。次のアクション(人間判断が必要)
check_implementation_overlap.pyの見出しマッチを緩和する fix、または 実装: schema-governance.md の Initial Known Schemas を catalog から生成するスクリプト(#131 FU-5) #521/実装: e2e 実行前に CJK フォント可用性を fail-fast 検査し豆腐 baseline の誤再生成を防ぐ #754 の本文を canonical 見出し(## Outcome/## In Scope)に修正する fix を別 Issue で検討する。gh pr create(またはupdate_pr.py/open_pr.pyの override)で直接起票する。Verification 詳細・PR body ドラフトは worktree 内に用意済みです。
fix: pnpm_gate_registry.py の test script 行を ruff E501 内に収める (#1545)
fix: probe の root削除・false-pass sentinel・spawn失敗誤判定を解消する (#1545)
実装: pnpm test から .claude/tmp の一時 worktree を除外する (#1559)