Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "squne121(OWNER)の明示指示(『.claude/tmp/ は使わない。tmp/ を使ってほしい。』)に沿い、ESLint 設定で tmp/ と .claude/tmp/ の両方を lint scan 対象外にし、ドキュメント上の正本記述を tmp/ 単一へ更新する。production writer / marker / classifier / schema の破壊的変更は follow-up Issue へ分離する(OWNER 敵対的レビューによる scope narrowing)。PR #2001 に対する OWNER 敵対的レビュー(issuecomment-5203294136)を受け、AC3-AC5 の実装方式・AC6/AC7 検証強度・Safety Claim Matrix 記載を追加改訂した"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: 現状
docs/dev/repository-folder-policy.mdの REPOSITORY_FOLDER_POLICY_V1 はtmp/と.claude/tmp/を同格の approved local temporary workspace として認めている。Issue 実装: write-set-audit-helper に origin/storageKey 境界の記録を追加する #1993 の issue-refinement-loop 実行中、.claude/tmp/に長期間蓄積した数百件の未追跡 session artifact がpnpm lint(ESLint、.claude/tmp/**が ignore 対象外だった)のスキャン対象に巻き込まれ、.claude/tmp/agy-live-e2e/.../pyright/dist/*.js等の vendor 相当ファイルに対して 5735件のエラーを検出し、無関係な Issue(実装: write-set-audit-helper に origin/storageKey 境界の記録を追加する #1993)の regression gate を偽陽性で fail させる実害が発生した。.claude/tmp/の中身を削除したところpnpm lintは即座に clean になった。 - OWNER の後続コメント(実装: repo-approved local temporary workspace を tmp/ へ一本化し .claude/tmp/ を非推奨化する #1995 (comment))による敵対的レビューと、それへの独立したコードベース調査により、当初案(実装: repo-approved local temporary workspace を tmp/ へ一本化し .claude/tmp/ を非推奨化する #1995 初版)の以下の問題が CONFIRMED された。
scripts/session-recording/bootstrap-source-bound-readiness.mjs(行37)が実際に.claude/tmp/session-recording/scope-rollup-readiness.jsonへ書き込む production writer であり、.claude/hooks/capture_scope_rollup_final_response.py(行34-37 付近)がそれを読む consumer として既に存在する。docs/dev/session-recording-policy.mdはこの場所を固定 private location として authority contract 定義している。初版 Issue は「writer 未特定」として移行を Out of Scope にしていたが、これは事実誤認だった。- 初版 AC7(
scripts/agent-ops/temp_residue_marker.pyの_TARGET_RELPATH_REから.claude/tmpパターンを削除)は既存 marker を malformed 化し、Issue 実装: temp residue の再検査付き削除 executor を追加する #1616(legacy cleanup executor)の安全な削除経路を壊しうる。 - 初版 AC6(
scripts/agent-ops/temp_residue_classifier.pyのAPPROVED_ROOTSから.claude/tmpを削除)は legacy residue の scan/report を停止させてしまう。 schemas/repo_temp_folder_advice_v1.schema.jsonのapproved_temporary_rootsはenum: ["tmp/", ".claude/tmp/"]かつminItems: 2/uniqueItems: trueであり、enum から片方を削除すると schema 自体が充足不能になる(JSON Schema Draft 2020-12 でenumは validation assertion でありdeprecatedannotation では無害化できない)。この改訂は breaking change であり別 Issue の schema v2 migration で扱うべきであって、本 Issue の AC には含めない。- 初版 AC8 の VC(
! rg -qi 'claude/tmp' .claude/skills/post-merge-cleanup-executor/SKILL.md)は.claude/tmp/をnever_deleteとする安全記述(TEMP_CLEANUP_SAFETY_RULES_V1)ごと削除を要求しており危険。 - Runtime Verification Applicability が
not_applicableになっていたが、ESLint scan 除外は実行時挙動でありimmediate分類が必要。 - OWNER は「hooks による制限は動作検証できるまで実装しない。厳密な制限は不要、
.claude/tmp/を使ったらtmp/を案内する程度でよい」と明言し、hook を enforcement 境界にしない方針を確定している。scripts/agent-guards/root_temporary_residue_policy.pyは path 先頭 segment が.claudeの場合に早期 return するため(_match_repo_relative_pathのfirst_segment in {"tmp", ".claude"}分岐、確認済み)、初版 AC5(定数変更のみ)はこの guard の実際の advisory 発火に無関係だった(既に.claude/tmpをスキップしているため定数変更で検出は増減しない)。新たな検出ロジック追加は本 Issue のスコープに含めない。
- Desired Destination:
eslint.config.mjsの ignores にtmp/**と.claude/tmp/**(両方)が追加され、pnpm lintがどちらのディレクトリも scan せず、将来同種の未追跡ファイルによる regression gate 偽陽性を再発防止する状態。加えてdocs/dev/repository-folder-policy.md/AGENTS.md/docs/dev/agent-skill-boundaries.md/docs/dev/hook-boundaries.md/.claude/skills/post-merge-cleanup-executor/SKILL.mdが「tmp/が canonical / 新規書き込み先、.claude/tmp/は非推奨 legacy root(構造・read/scan/report・safety rule は温存)」という一貫した記述になっている状態。
Current Validated Scope
eslint.config.mjs(ignores配列。現状.claude/tmp/**/tmp/**のいずれも含まれておらず、これが実害の直接原因。確認済み)docs/dev/repository-folder-policy.md(REPOSITORY_FOLDER_POLICY_V1 定義本体)AGENTS.md(approved local temporary workspace の正本記述)docs/dev/agent-skill-boundaries.md(cleanup authority / temp_residue_classifier 説明)docs/dev/hook-boundaries.md(hook advisory メッセージの移行先案内。advisory 文言のみで enforcement 境界には言及しない).claude/skills/post-merge-cleanup-executor/SKILL.md(TEMP_CLEANUP_SAFETY_RULES_V1のnever_deleteにtmp//.claude/tmp//.claude/worktrees/が既に存在。確認済み。この記述は削除せず維持したまま canonical/deprecated の追記のみ行う)- 上記変更に追従する既存テスト(ESLint ignore regression test を含む。新規追加でよい)
Remaining Parent Gaps
schemas/repo_temp_folder_advice_v1.schema.jsonのapproved_temporary_rootsenum(minItems: 2制約により片方削除で schema が充足不能になることを確認済み)は breaking change であり、schema v2 migration として follow-up Issue で扱う。scripts/session-recording/bootstrap-source-bound-readiness.mjs(production writer, 行37)/.claude/hooks/capture_scope_rollup_final_response.py(consumer)/docs/dev/session-recording-policy.md(authority contract)の.claude/tmp/session-recording/からtmp/への段階的移行は、writer/consumer の同時変更とSESSION_RECORDING_SCOPE_ROLLUP_READINESS_V1契約の再検証を要するため follow-up Issue で扱う。scripts/agent-guards/root_temporary_residue_policy.pyのAPPROVED_TEMPORARY_ROOTS定数、scripts/agent-ops/temp_residue_classifier.pyのAPPROVED_ROOTS、scripts/agent-ops/temp_residue_marker.pyの_TARGET_RELPATH_REは、いずれも.claude/tmpを除去すると既存 legacy residue の scan/report/marker 経路を壊すため、本 Issue では変更しない(follow-up Issue で writer 移行完了後に再検討する)。- 関連の delete executor(Issue 実装: temp residue の再検査付き削除 executor を追加する #1616、未マージ)は
tmp/・.claude/tmp/・.claude/worktrees/の root 全体削除を明示的に Out of Scope としており、本 Issue のスコープ narrowing 後も互換性がある。
Outcome
eslint.config.mjs の ignores に tmp/** と .claude/tmp/**(および **/.claude/tmp/**)の両方が追加され pnpm lint がいずれも scan 対象外にする一方、通常の source path は引き続き lint される状態。docs/dev/repository-folder-policy.md / AGENTS.md / docs/dev/agent-skill-boundaries.md / docs/dev/hook-boundaries.md / .claude/skills/post-merge-cleanup-executor/SKILL.md が「tmp/ を新規書き込みの正本、.claude/tmp/ を非推奨 legacy root(構造・read/scan/report・never_delete safety rule は温存)」という一貫した記述に更新され、.claude/skills/post-merge-cleanup-executor/SKILL.md の TEMP_CLEANUP_SAFETY_RULES_V1(never_delete に .claude/tmp/ を含む)が変更前と同一のまま残っている状態。pnpm typecheck / pnpm lint / pnpm test / pnpm build が成功する状態を完了とする。production writer・schema enum・marker・classifier の変更は本 Issue の完了条件に含めない。 .claude/tmp/session-recording/ は scripts/session-recording/bootstrap-source-bound-readiness.mjs(production writer)と .claude/hooks/capture_scope_rollup_final_response.py(consumer)が現在も active に使用し続ける明示的な legacy exception であり、 その tmp/ への移行は follow-up Issue #2004(#2004)で扱う。
In Scope
eslint.config.mjsのignores配列にtmp/**と.claude/tmp/**(および**/.claude/tmp/**)の両方を追加し、いずれのディレクトリもpnpm lintの scan 対象外にする。通常の source path(例:scripts/**/*.mjs等の既存 lint 対象)は引き続き lint される状態を維持するdocs/dev/repository-folder-policy.mdに、tmp/を canonical write destination、.claude/tmp/を deprecated legacy root(構造は残存し、read/scan/report は継続する)と明記する追記を行う(既存の Root Class / Marker Effect Matrix の構造・既存記述は削除しない)docs/dev/repository-folder-policy.mdのREPOSITORY_FOLDER_POLICY_V1構造化定義(YAML/表形式の folder 一覧)自体を修正し、tmp/の guidance を canonical write destination を示す値、.claude/tmp/の guidance を deprecated/legacy read-scan-report-only を示す値に分離する(folder_classフィールドは互換性のため即削除不要)。あわせて文書内の「tmp/と.claude/tmp/の両方が使える」という既存プローズ運用ルール記述を「新規書き込みはtmp/のみ。.claude/tmp/は legacy residue の read/scan/report と登録済み例外のみ」に置換するAGENTS.mdの approved local temporary workspace 記述を「新規書き込みはtmp/を正本とする。.claude/tmp/は非推奨の legacy root であり、read/scan 目的では引き続き認識される」という趣旨に更新する(.claude/tmp/を正本として並記しない、かつ.claude/tmp/という語自体・その構造の存在は否定しない)docs/dev/agent-skill-boundaries.md/docs/dev/hook-boundaries.mdの cleanup authority・hook advisory メッセージ関連記述を、新しい canonical/deprecated 区別に合わせて更新する(hook を enforcement 境界にしないという OWNER 方針と矛盾しない advisory 文言のみとし、新たな検出・block ロジックの追加は行わない).claude/skills/post-merge-cleanup-executor/SKILL.mdに「tmp/が canonical、.claude/tmp/は deprecated legacy だがnever_delete/report_onlyの安全境界は維持する」という趣旨の追記を行う。既存のTEMP_CLEANUP_SAFETY_RULES_V1(never_deleteにtmp//.claude/tmp//.claude/worktrees/を含む記述)は一切削除・改変しない- ESLint ignore regression test(新規追加でよい)を含め、上記変更に追従する既存テストの期待値を更新する
- PR 本文の Safety Claim Matrix に、
.claude/tmp/session-recording/の active production writer/consumer 契約(scripts/session-recording/bootstrap-source-bound-readiness.mjs/.claude/hooks/capture_scope_rollup_final_response.py)をNot controlledな明示的 legacy exception として記載し、follow-up Issue 実装: source-bound eligibility/readiness の固定 private location を tmp/session-recording/ へ同時移行する #2004 を参照する
Out of Scope
schemas/repo_temp_folder_advice_v1.schema.jsonのapproved_temporary_rootsenum 変更(minItems: 2により片方削除で schema が充足不能になる breaking change。schema v2 migration として follow-up Issue で扱う)scripts/agent-guards/root_temporary_residue_policy.pyのAPPROVED_TEMPORARY_ROOTS定数・検出ロジックの変更scripts/agent-ops/temp_residue_classifier.pyのAPPROVED_ROOTS定数の変更scripts/agent-ops/temp_residue_marker.pyの_TARGET_RELPATH_REの変更scripts/session-recording/bootstrap-source-bound-readiness.mjs/.claude/hooks/capture_scope_rollup_final_response.py/docs/dev/session-recording-policy.mdが定義する.claude/tmp/session-recording/production writer/consumer のtmp/への移行(writer/consumer 同時変更・契約再検証を要するため follow-up Issue で扱う).claude/tmp/ディレクトリ自体の削除・.gitignoreからの除去(ディレクトリ構造は残存させる)- Issue 実装: temp residue の再検査付き削除 executor を追加する #1616(temp residue 削除 executor)の実装・スコープ変更
.claude/skills/**/SKILL.md/.claude/agents/*.mdの網羅的な.claude/tmp/参照棚卸し(post-merge-cleanup-executor/SKILL.md以外は本調査時点で該当なし).claude/worktrees/**の取り扱い方針変更- hook をベースにした新規の enforcement/検出ロジックの追加(OWNER は hook を enforcement 境界にしない方針を明言している)
Acceptance Criteria
- AC1:
eslint.config.mjsのignores配列に.claude/tmp/**が含まれる - AC2:
eslint.config.mjsのignores配列にtmp/**が含まれる - AC3:
tests/eslint-ignore-policy.test.tsで ESLint Node.js API(ESLint#isPathIgnored())により.claude/tmp/配下パス(root直下および nested、例:nested/.claude/tmp/__fixture__/invalid.js)が ignored と判定されることを検証する(実ファイル書き込み・子プロセス起動なし) - AC4:
tests/eslint-ignore-policy.test.tsで同様にtmp/配下パスが ignored と判定されることを検証する(実ファイル書き込み・子プロセス起動なし) - AC5:
tests/eslint-ignore-policy.test.tsで negative control として通常 source path(例:src/__fixture__.ts)が ignored ではないと判定され、かつeslint.lintText()によりその path に対して実際に lint エラーが検出される(isPathIgnoredだけでなくlintTextの実 lint 結果でも確認する)ことを検証する - AC6:
docs/dev/repository-folder-policy.mdに.claude/tmp/の非推奨(deprecated)を示す記述が存在する - AC7:
docs/dev/repository-folder-policy.mdにtmp/を canonical write destination とする記述が存在する - AC8:
docs/dev/repository-folder-policy.mdのREPOSITORY_FOLDER_POLICY_V1構造化定義(YAML)本体において、path: "tmp/"エントリのguidanceフィールドの値がtmp/ is the canonical write destinationという文言を含む(folder_class: repo_approved_temporary_workspaceをtmp//.claude/tmp/双方に同格で残したままの追記のみでは満たさない) - AC9: 同構造化定義の
path: ".claude/tmp/"エントリのguidanceフィールドの値が.claude/tmp/ is a deprecated legacy rootという文言を含む - AC10:
docs/dev/repository-folder-policy.mdの「運用ルール」節の既存プローズ「tmp/と.claude/tmp/は repo-approved local temporary workspace として使える」相当の記述が、「新規書き込みはtmp/のみ。.claude/tmp/は legacy residue の read/scan/report と登録済み例外のみ」相当の記述に置換されている - AC11:
AGENTS.mdの approved local temporary workspace 記述がtmp/単一を正本とする内容に更新されている(.claude/tmp/を正本として並記しない) - AC12:
.claude/skills/post-merge-cleanup-executor/SKILL.mdに.claude/tmp/が deprecated legacy root である旨の記述が追加されている - AC13:
.claude/skills/post-merge-cleanup-executor/SKILL.mdのTEMP_CLEANUP_SAFETY_RULES_V1のnever_deleteに.claude/tmp/が引き続き含まれている(削除されていないことの回帰防止) - AC14: PR 本文の Safety Claim Matrix に
.claude/tmp/session-recording/の session-recording writer/consumer(scripts/session-recording/bootstrap-source-bound-readiness.mjs/.claude/hooks/capture_scope_rollup_final_response.py)が active な legacy exception としてNot controlled記載され、follow-up Issue 実装: source-bound eligibility/readiness の固定 private location を tmp/session-recording/ へ同時移行する #2004 への参照が含まれている(VC は human_judgment。reviewer が PR 本文を目視確認する) - AC15:
pnpm typecheckが成功する - AC16:
pnpm lintが成功する - AC17:
pnpm testが成功する - AC18:
pnpm buildが成功する
Runtime Verification Applicability
- decision: immediate
- reason: ESLint の
ignores設定は静的な設定ファイル記述だけでなく実行時の path 判定挙動そのものであり、tmp//.claude/tmp/配下パスが実際に ignored 判定されること、および通常 source path が引き続き lint 対象になることを ESLint Node.js API 経由で実行時に確認する必要がある。実ファイル fixture の固定パス書き込み・pnpm lintの子プロセス多重起動は行わない(OWNER 指摘: 安全性低下・CI runtime 悪化・Vitest 並列実行との競合)。
applicable_acs: AC3, AC4, AC5
execution_environment: ローカル Node.js + Vitest(eslintパッケージのESLint#isPathIgnored()/ESLint#lintText()を in-process 呼び出し)。子プロセス起動・追加の外部 CLI・認証・ネットワークは不要。
skip_conditions:node/vitestが実行環境に存在しない場合は exit 77 で SKIP する(既存 vitest 実行基盤に依存するため、pnpm test自体が動く環境であれば常に実行可能)。
fallback_policy:isPathIgnored/lintText呼び出しが失敗した場合はテスト失敗として扱い、フォールバック経由の成功を PASS として扱わない。
artifact_requirements: 追加の証跡ファイルは生成しない。実ファイル fixture を repo 上の固定パスへ書き込まない(in-memorylintTextのみを使用する)。
Verification Commands
# AC1
# baseline-expect: fail
$ rg -qF "'.claude/tmp/**'" eslint.config.mjs# AC2
# baseline-expect: fail
$ rg -qF "'tmp/**'" eslint.config.mjs# AC3
# target test name (informational, not part of the allowlisted command): "GIVEN .claude/tmp/__fixture__/invalid.js THEN ignored=true" in tests/eslint-ignore-policy.test.ts
# baseline-expect: fail (test file does not exist yet)
$ pnpm test -- tests/eslint-ignore-policy.test.ts# AC4
# target test name (informational, not part of the allowlisted command): "GIVEN tmp/__fixture__/invalid.js THEN ignored=true" in tests/eslint-ignore-policy.test.ts
# baseline-expect: fail (test file does not exist yet)
$ pnpm test -- tests/eslint-ignore-policy.test.ts# AC5
# target test name (informational, not part of the allowlisted command): "GIVEN src/__fixture__.ts THEN ignored=false" in tests/eslint-ignore-policy.test.ts
# baseline-expect: fail (test file does not exist yet)
$ pnpm test -- tests/eslint-ignore-policy.test.ts# AC6
# baseline-expect: fail
$ rg -qi 'claude/tmp.*deprecated' docs/dev/repository-folder-policy.md# AC7
# baseline-expect: fail
$ rg -qi 'tmp/.*canonical' docs/dev/repository-folder-policy.md# AC8
# baseline-expect: fail
$ rg -qF 'guidance: tmp/ is the canonical write destination' docs/dev/repository-folder-policy.md# AC9
# baseline-expect: fail
$ rg -qF 'guidance: .claude/tmp/ is a deprecated legacy root' docs/dev/repository-folder-policy.md# AC10
# baseline-expect: fail
$ rg -qF 'legacy residue の read/scan/report と登録済み例外のみ' docs/dev/repository-folder-policy.md# AC11
# baseline-expect: fail
$ rg -qF 'repo-approved local temporary workspace は `tmp/` を正本とし' AGENTS.md# AC12
# baseline-expect: fail
$ rg -qi 'deprecated' .claude/skills/post-merge-cleanup-executor/SKILL.md# AC13
# baseline-expect: pass
$ rg -qF '".claude/tmp/"' .claude/skills/post-merge-cleanup-executor/SKILL.md# AC14
# preflight-scope: pr_review_only
$ gh pr view --json body --jq .body# AC15
$ pnpm typecheck# AC16
$ pnpm lint# AC17
$ pnpm test# AC18
$ pnpm buildAllowed Paths
- eslint.config.mjs
- docs/dev/repository-folder-policy.md
- AGENTS.md
- docs/dev/agent-skill-boundaries.md
- docs/dev/hook-boundaries.md
- .claude/skills/post-merge-cleanup-executor/SKILL.md
- tests/eslint-ignore-policy.test.ts
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
schemas/repo_temp_folder_advice_v1.schema.jsonの enum 変更が必要と判明した場合(本 Issue のスコープ外であり follow-up Issue で扱う)scripts/agent-guards/root_temporary_residue_policy.py/scripts/agent-ops/temp_residue_classifier.py/scripts/agent-ops/temp_residue_marker.pyの変更が必要と判明した場合(本 Issue のスコープ外)scripts/session-recording/bootstrap-source-bound-readiness.mjs/.claude/hooks/capture_scope_rollup_final_response.py/docs/dev/session-recording-policy.mdの production writer/consumer 契約の変更が必要と判明した場合(本 Issue のスコープ外であり follow-up Issue で扱う)- hook をベースにした新規の enforcement/検出ロジック追加が必要と判明した場合(OWNER が明示的に不要と判断済み)
Required Skills
- TypeScript / JavaScript(ESLint flat config)
- Markdown ドキュメント編集
Required Design References
- docs/dev/repository-folder-policy.md(REPOSITORY_FOLDER_POLICY_V1 の変更対象そのもの)
- .claude/skills/post-merge-cleanup-executor/SKILL.md(
TEMP_CLEANUP_SAFETY_RULES_V1の温存を確認する対象)
Notes for Reviewer
- 本 Issue は squne121(OWNER)が Issue 実装: write-set-audit-helper に origin/storageKey 境界の記録を追加する #1993 の issue-refinement-loop 実行中に発見した
.claude/tmp/蓄積によるpnpm lintregression gate 偽陽性の再発防止を目的とする(当該残置物自体は初版起票前にrm -rf済み)。 - 本 Issue は OWNER の敵対的レビュー(実装: repo-approved local temporary workspace を tmp/ へ一本化し .claude/tmp/ を非推奨化する #1995 (comment))を受けて全面的に narrow 化された改訂版である。初版は production writer(
bootstrap-source-bound-readiness.mjs)の存在を「未特定」として看過し、marker/classifier/schema の破壊的変更を含んでいたため、安全に実装可能な ESLint containment + ドキュメント更新のみへスコープを縮小した。 - schema v2 migration・production writer 移行・hook 以外の enforcement 代替案の検討は、いずれも本 Issue のスコープ外であり別途 follow-up Issue として起票判断する(本 Issue の body では起票しない)。
- Issue 実装: temp residue の再検査付き削除 executor を追加する #1616(temp residue 削除 executor、未マージ)とは scope が異なる。互換性は確認済み。
- 本改訂は PR 実装: repo-approved local temporary workspace を tmp/ へ一本化する #2001 に対する OWNER 敵対的レビュー(実装: repo-approved local temporary workspace を tmp/ へ一本化する #2001 (comment))を受けたもの。 AC3-AC5 は実ファイル fixture の固定パス書き込み・再帰削除・
pnpm lint子プロセス3重起動という安全性の低い実装方針を、 ESLint Node.js API(isPathIgnored()/lintText())による in-process 検証へ全面的に置き換えた(fixture 書き込み・子プロセス起動なし、CI runtime 悪化なし)。 AC6・AC7 は「deprecated/canonical という語の存在」検査のみではREPOSITORY_FOLDER_POLICY_V1の構造化定義本体(YAML)の矛盾を見逃す偽陰性だったため、 AC8-AC10 として構造化定義本体のguidanceフィールド値変更・運用ルール プローズ置換を新設 AC で要求する。.claude/tmp/session-recording/の active production writer/consumer 契約は本 Issue のスコープ外の legacy exception として維持し、 その移行は follow-up Issue 実装: source-bound eligibility/readiness の固定 private location を tmp/session-recording/ へ同時移行する #2004(実装: source-bound eligibility/readiness の固定 private location を tmp/session-recording/ へ同時移行する #2004)で扱う。AC14 で PR 本文 Safety Claim Matrix への明記を求める。
Activity
squne121 commentedon Aug 4, 2026
Scope Collision (C1) advisory(overlap preflight, non-blocking, #1860 Owner Decision): related_issue=#1952, #1909, #1908, #1881, #1738, #1737, #1735, #1616, #1604, #1601, #1595, #1588, #1587, #1432, #1429, #1363, #1288, #1117, #1093, #1009, #420, #260, #237, #225, #213, #205, #197, #82, #63, #56; overlapping_paths=AGENTS.md, docs/dev/agent-skill-boundaries.md, docs/dev/hook-boundaries.md, docs/dev/repository-folder-policy.md, scripts/agent-guards/root_temporary_residue_policy.py, scripts/agent-ops/temp_residue_classifier.py, scripts/agent-ops/temp_residue_marker.py
non_conflict_reason: 上記は広く共有される docs/policy ファイルであり、多数の Issue が touch する一般的な重複(agent-skill-boundaries.md 等)。本 Issue 固有の意図は「REPOSITORY_FOLDER_POLICY_V1 の approved root を tmp/ 単一へ統合し .claude/tmp/ を非推奨化する」ことに限定され、他候補 Issue とは変更意図が異なる。
edit_intent: 本 Issue は approved root 定義(tmp/ 単一化)に関する記述追加・定数変更のみを行い、他候補 Issue が扱う別テーマ(Codex parity、context budget 等)とは独立。
dependency ordering: なし(並行実装可)。
squne121 commentedon Aug 5, 2026
you asked
message time: 2026-08-05 23:10:52
#1995
内容について関連Issue、PR、リポジトリ資産、コメントを参照した上で敵対的レビューして。
取り扱う技術や配布物の実装をWEB検索し高品質化してほしい。
chatgpt response
Issue #1995 の契約、依存関係、既存実装、関連コメントを先に再構成し、その後に外部仕様・実装慣行と照合して破綻条件を洗います。最後に、重大度順の指摘と修正版の受け入れ基準まで落とします。
初期確認では、Issue は「ポリシー一本化」と「lint 汚染防止」を同じ変更に束ねています。ここで最も危険なのは、
.claude/tmp/を非承認にしながら writer の棚卸しをスコープ外にしている点と、既存 v1 schema の enum 値削除を許容している点です。リポジトリ横断検索で、Issue 本文が「対応コード未特定」として除外した
.claude/tmp/writer 契約が、現行の session-recording SSOT に固定 private location として明記されていることを確認しました。これは単なる文書残りではなく、非承認化後も正規 producer が書き続ける可能性を示すため、現行スコープのままでは一本化が成立しません。敵対的レビュー結果
判定: BLOCKED / 契約全面修正が必要
ESLint の除外追加自体は妥当です。しかし Issue #1995 は、以下の別問題を一つの変更に混在させています。
現行契約のまま実装すると、
.claude/tmp/への書き込みは残ったまま、それを ESLint と residue classifier の両方から見えにくくする可能性があります。「一本化」ではなく、問題を不可視化して旧 residue を取り残す変更になり得ます。P0-1: 「writer が特定できなかった」という前提が現行 main と一致しない
Issue は、session-recording の
.claude/tmp/session-recording/...を実際に書くコードを発見できなかったとして、移行を Out of Scope にしています。また、未特定 writer が発見された場合を Stop Condition にしています。しかし現行リポジトリには、少なくとも以下が存在します。
scripts/session-recording/bootstrap-source-bound-readiness.mjsは、環境変数による override がなければ.claude/tmp/session-recording/scope-rollup-readiness.jsonをデフォルト出力先とし、親ディレクトリを生成して artifact を書き込みます。.claude/hooks/capture_scope_rollup_final_response.pyも、同じ.claude/tmp/session-recording/...を canonical reader location としています。docs/dev/session-recording-policy.mdは、この場所を単なる例ではなく「固定 private location のみ」とする authority contract として定義しています。pnpm bootstrapは上記 readiness writer を実行します。scripts/verify-vitest-discovery-policy.mjsは runtime sentinel を.claude/tmp/とtmp/の両方へ実際に作成します。したがって、Issue 自身の Stop Condition が既に成立しています。これらの writer・reader・SSOT は Allowed Paths に含まれていません。
Issue コメントは「定数変更のみで独立しており dependency ordering なし、並行実装可」としていますが、この判定は不完全な writer inventory に基づいています。
必要な修正
BLOCKEDにする。.claude/tmp/の production writer、reader、test-only writer、文書化された固定 location を再棚卸しする。scripts/session-recording/bootstrap-source-bound-readiness.mjs.claude/hooks/capture_scope_rollup_final_response.py.claude/scripts/check_session_recording_runtime_safety.pydocs/dev/session-recording-policy.mdscripts/verify-vitest-discovery-policy.mjsP0-2: marker と classifier を狭めると、legacy residue を安全に扱えなくなる
現行
temp_residue_owner/v1は、tmp/<session>と.claude/tmp/<session>の両方を valid target とします。Python validator と JSON Schema は同じ制約を持ち、実装コメントでは両者の parity を必須としています。Issue の AC7 は
_TARGET_RELPATH_REから.claude/tmpを削除することを要求しています。これを実行すると、過去に作られた valid marker が突然 malformed になります。classifier 側でも
APPROVED_ROOTS = ("tmp", ".claude/tmp")を("tmp",)に変えるだけでは、.claude/tmp/は「deprecated root」として分類されません。単に scan 対象から外れる可能性があります。さらに
temp_residue_classification/v1のfolder_classには、以下しかありません。repo_approved_temporary_workspaceroot_temporary_aliasmanaged_worktree_rootdeprecated_legacy_temporary_workspaceに相当する状態はありません。ところがこの schema は Issue の Allowed Paths 外です。Issue #1616 は、両 approved root 配下の exact owned session subdirectory を、marker・Git state・FD containment 等の再検査後に削除する将来 executor を定義しています。#1995 が marker を invalid 化し、classifier の scan 対象から外せば、#1616 の安全な legacy cleanup 経路を壊します。「互換性あり」という #1995 の判断は成立しません。
必要な移行モデル
「新規作成先の制限」と「既存 artifact の読み取り互換性」を同じ正規表現で表現してはいけません。
P0-3: schema 変更契約が自己矛盾している
repo_temp_folder_advice_v1は現在、approved_temporary_rootsに次の制約を持ちます。tmp/,.claude/tmp/minItems: 2uniqueItems: trueenum から
.claude/tmp/だけを削除すると、配列に2件以上の一意な要素を入れられなくなり、schema が充足不能になります。また schema catalog は、以下を breaking change として明示しています。
temp_residue_owner/v1:narrow_type,change_trust_modeltemp_residue_classification/v1:narrow_type,change_recommendation_semantics一方、Issue 本文は、
と相反する指示を持っています。
JSON Schema Draft 2020-12 の
enumは validation assertion であり、値を削除すればその値は invalid になります。deprecatedは annotation にすぎず、利用禁止を validator が強制するものではありません。したがって、enum 値の削除をdeprecated: trueで無害化することはできません。(JSON Schema)推奨設計
REPO_TEMP_FOLDER_ADVICE_V2を作る方が安全です。v1producer/consumer を一斉に破壊せず、consumer inventory と cutover 条件を定義してください。P1-1: 現行 guard は
.claude/tmp/への書き込みを検出しないroot_temporary_residue_policy.pyは、repo-relative path の先頭 segment がtmpまたは.claudeの場合、早期にNoneを返します。つまりAPPROVED_TEMPORARY_ROOTSの配列とメッセージだけを変更しても、.claude/tmp/への書き込みは advisory 対象になりません。既存テストも
.claude/tmp/session-123/result.jsonに対して advice が返らないことを明示的に保証しています。必要なのは定数変更ではなく、独立した状態判定です。
さらに、
deprecatedを advisory にするのか deny にするのかを固定してください。block: falseのままなら、「唯一の approved root」にしたというポリシー主張はできますが、書き込み停止は保証できません。P1-2: Runtime Verification
not_applicableは誤判定Issue は「静的定義とテストだけなので runtime verification 不要」としています。
しかし完了条件には次の runtime behavior が含まれます。
.claude/tmp/write を検出するtmp/になるリポジトリの runtime-verification policy では、プロセス起動や実 I/O により初めて確認できる AC は
immediateです。最低限、以下の実動作検証が必要です。
.claude/tmp/とtmp/へ置くpnpm lintはそれらを走査しない.claude/tmp/new-session/output.jsonへの write payload を guard に渡すdeprecated_temporary_rootを返す.claude/tmp/<session>に置いて classifier を実行tmp/session-recording/...に生成されるP1-3: AC8 は安全性を悪化させる
AC8 の Verification Command は、cleanup executor Skill から
claude/tmpという文字列が完全に消えることを要求しています。しかし cleanup executor は、現在
.claude/tmp/root 全体をnever_deleteとして明示し、owned child も現時点では advisory-only であることを記録しています。この文字列を完全に消すと、次の重要情報まで削除されます。
AC8 は次のように変更すべきです。
ESLint 対策の評価
ESLint ignore の追加は必要です。
現在の
eslint.config.mjsの先頭 object はignores以外のキーを持たないため、現状でも global ignores として機能します。 ESLint flat config は.gitignoreを自動では読み込まず、デフォルトで除外されるのは主にnode_modulesと.gitです。そのため、.gitignoreに.claude/tmp/があってもeslint .の安全性は保証されません。(ESLint)実装は、意図を明確にするため
globalIgnores()を使うのが適切です。**/tmp/は一般的な source tree 内のtmpまで除外するため追加すべきではありません。root のtmp/と、明示的な.claude/tmp/だけを対象にしてください。ESLint 公式文書でも、root-relative directory と recursive directory は別 pattern として扱われます。(ESLint)ただし、この ignore は lint 汚染の封じ込めであって、writer 移行完了の証拠ではありません。
推奨する Issue 分割
Issue A: ESLint 一時生成物汚染の即時封じ込め
スコープを以下に限定します。
eslint.config.mjstmp/と.claude/tmp/の両方を safety net として除外これは incident fix として独立して先にマージできます。
Issue B: temporary workspace の v2 migration
こちらで以下を扱います。
tmp/へ移行この分割なら、ESLint 事故の再発を即時に防ぎつつ、schema・cleanup・session-recording を急いで破壊することを避けられます。
修正版の主要 Acceptance Criteria
Canonical writer
.claude/tmp/に書くコードがゼロ。Legacy compatibility
.claude/tmp/<session>の既存temp_residue_owner/v1marker が引き続き parse 可能。deprecated_legacy_temporary_workspaceとして観測し、少なくともreport_onlyを返す。Write enforcement
.claude/tmp/への write operation はdeprecated_temporary_rootとして検出される。Schema governance
schemas/catalog.yaml、catalog tests、producer/consumer inventory を更新。ESLint boundary
tmp/と.claude/tmp/内の invalid JS は lint 対象外。Runtime evidence
immediateに変更。you asked
message time: 2026-08-06 06:38:27
hooksによる制限はうまく動作検証できるようになるまで実装しない。ほかの代替案があったら教えて。厳密にAIエージェントの書き込みを制限できなくてもいい。.claude/tmp/をつかったらtmp/を使うような案内がでるとか。pushできないとか。
chatgpt response
hooks を enforcement 境界にしない方針でよいです。代わりに「実行時は案内」「変更時は静的検査」「PR は必須チェックで止める」の三層に分けると、動作検証しやすく、既存の legacy 読み取りも壊しません。
hooks を 強制境界にしない方針で問題ありません。現時点では、次の構成が最も安全です。
推奨構成
1.
tmp/を canonical、.claude/tmp/を legacy と定義するポリシーは次のように分離します。
重要なのは、
.claude/tmp/を classifier や marker validator から削除しないことです。現在の classifier と marker は両方の root を認識しているため、ここは legacy 読み取り互換として維持します。代替案1: writer 側で案内または自動変換する
hook ではなく、各 producer が呼ぶ共通 helper を追加します。
結果例:
動作は次のようにします。
.claude/tmp/の扱いtmp/へ自動変換この方式なら unit test と subprocess test で完全に動作検証できます。hook の起動状態、trust、複数 hook の順序などに依存しません。
ただし、helper を使わず直接
Path(...).write_text()する実装は捕捉できません。厳密な制限が不要なら、この程度で十分です。代替案2: 静的 policy checker を CI 必須チェックにする
新規コードが
.claude/tmp/を write default として追加していないか検査するスクリプトを用意します。例:
検査対象は単純な全件 grep ではなく、用途を分類します。
結果例:
これを required CI にすれば、push 自体は可能でも PR はマージできません。
この方法は hooks より単純で、fixture を使った決定論的テストが可能です。既存の schema catalog と同様、allowlist には用途・理由・期限を持たせるとよいです。
代替案3: hook ではない push wrapper で止める
「pushできない」に近い動作が必要なら、標準の agent push 経路を wrapper にします。
内部処理:
例えば
.claude/tmp/に残置物がある場合:これは Git hook ではありません。通常の CLI として独立しているため、以下を動作検証できます。
.claude/tmp/が空なら push subprocess を呼ぶtmp/の残置物では止めないただし raw
git pushで迂回できます。今回の「厳密でなくてよい」という条件なら許容できます。導入順序
既存 writer を移行する前から residue を hard block すると、現在の session-recording producer が
.claude/tmp/session-recording/...を生成して毎回 push を止めます。現行 bootstrap は実際にそこへ書くためです。したがって、最初は次の段階制が適切です。
代替案4: 非 blocking の advisory hook だけ残す
hook による制限をしないだけで、案内用途なら次の条件で残せます。
.claude/tmp/への write を検出したときだけ、と additional context を返します。
ただし advisory hook が起動しなかった場合でも処理は継続します。これを policy enforcement や移行完了の証拠にはしません。
現行 guard は
.claude先頭の path を早期除外しているため、定数とメッセージだけを変更しても.claude/tmp/write の advisory は出ません。専用のdeprecated_temporary_root判定が必要です。代替案5: post-merge cleanup で残置を報告する
write 時点では止めず、cleanup 時に次を出します。
これは既存 classifier と親和性があります。
ただし
.claude/tmp/をAPPROVED_ROOTSから単純に削除すると scan 自体が行われなくなるため、以下のように分類を分ける必要があります。理想的には:
ただし新しい
folder_classを追加するとtemp_residue_classification/v1の schema 変更になるため、当面は既存 class のまま reason code を追加する方が小さい変更です。名称は多少不自然ですが、schema v2 を急いで作らずに移行できます。
「使用したら push 不可」の注意点
現在
/tmp/と.claude/tmp/は.gitignore対象です。したがって、通常の Git diff や commit だけから「このセッションで.claude/tmp/を使用した」という事実は分かりません。push を止めるには、次のいずれかが必要です。
最も単純なのは filesystem residue check です。利用履歴ではなく「push 時点で残っているか」を判定します。
#1995 に推奨する修正内容
残すもの
tmp/と.claude/tmp/の両方を ignoretmp/を唯一の canonical write destination と記載.claude/tmp/は deprecated legacy root と記載tmp/のみにするtmp/へ移行現在 Vitest は既に両方を exclusion safety net として扱っています。ESLint も同じ考え方で両方を除外するのが妥当です。
削除すべき要件
.claude/tmp/を即時削除.claude/tmp/を即時削除.claude/tmp/の全文字列を消す AC追加すべき要件
推奨する最終構成
この設計なら、hook runtime の信頼性が確立するまで待たずに、
.claude/tmp/の新規利用を実用上かなり減らせます。Powered by AI Exporter
squne121 commentedon Aug 5, 2026
issue-refinement-loop: approved
anchor comment(https://github.com/squne121/loop-protocol/issues/1995#issuecomment-5197739490)の敵対的レビュー指摘(P0-1 writer inventory不足 / P0-2 marker・classifier互換性破壊 / P0-3 schema v1 充足不能 / P1-1 guard検出gap / P1-3 AC8安全情報削除 / C9 runtime verification誤分類)と、OWNERフォローアップ(hooksをenforcement境界にしない方針)を反映し、3 iteration で本文を再設計・承認しました。
immediateに変更。pnpm vitest run→ allowlist内pnpm test+ 非実行コメントで対象明記、# baseline-expectannotation追加)。issue-reviewer が APPROVE。Final Gate:
issue-contract-review(run_contract_review_once.py)を実行しstatus: go(body_sha256: sha256:4b81d6e60f7f69fd4b8eac9d9f62b468efd79ea160640acb2600780790d88779、現行 Issue body と一致、fresh)を確認しました。squne121 commentedon Aug 5, 2026
implement-issue: 実装完了 (2026-08-06)
.claude/worktrees/issue-1995-tmp-canonicalizationworktree-issue-1995-tmp-canonicalization修正: OWNER敵対的レビューを反映しAC3-AC5/AC8-AC10を改訂実装する (#1995)
squne121 commentedon Aug 6, 2026
OWNER 敵対的レビュー(PR #2001 issuecomment-5203294136)を受けた改訂を実装しました。
実装内容
tests/eslint-ignore-policy.test.tsを ESLint Node.js API(ESLint#isPathIgnored()/ESLint#lintText())による in-process 検証へ全面書き換え。実ファイル fixture の固定パス書き込み・pnpm lint子プロセス多重起動を廃止(AC3-AC5)。root 直下・nested(nested/.claude/tmp/...)両方の.claude/tmp/パターン、tmp/パターン、negative control(src/__fixture__.ts)をisPathIgnored/lintText両方で検証。docs/dev/repository-folder-policy.mdのREPOSITORY_FOLDER_POLICY_V1構造化定義のguidanceフィールドを、tmp/= canonical write destination、.claude/tmp/= deprecated legacy root(read/scan/report only)に変更(AC8, AC9)。「運用ルール」節のプローズも新規書き込みtmp/単一の記述へ置換(AC10)。.claude/tmp/session-recording/の active production writer/consumer(bootstrap-source-bound-readiness.mjs/capture_scope_rollup_final_response.py)をNot controlledな明示的 legacy exception として記載し、follow-up Issue 実装: source-bound eligibility/readiness の固定 private location を tmp/session-recording/ へ同時移行する #2004 への参照を追加(AC14)。検証結果
pnpm typecheck/pnpm lint/pnpm test(1856 tests pass)/pnpm buildすべて成功。PR head SHA:
50b7ab48fa46c13b282f7947af433e0d43bfc9db実装: repo-approved local temporary workspace を tmp/ へ一本化する (#2001)
実装: source-bound eligibility/readiness の固定 private location を tmp/ses…