claude-code - 💡(How to fix) Fix [Feature Request] Verification baseline: enforce origin/main reads over local files [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46235Fetched 2026-04-11 06:25:35
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×3closed ×1commented ×1

Claude reads files from the local worktree when verifying facts, instead of from origin/main. Local state may contain uncommitted or unmerged changes, producing wrong verification results.

In one session (2026-04-10):

  • Read proof_coverage.json from local branch (28 entries) instead of origin/main (27 entries)
  • Wrote README with wrong statistics based on local state
  • Violated the same rule 3 times after writing it into its own discipline document

Root Cause

Local worktree ≠ canonical state. Every verification on local files is potentially wrong if the agent has uncommitted work, is on a feature branch, or has local-only changes. This is especially dangerous for formal verification registries where overclaiming coverage has protocol-safety implications.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single report
  • I am using the latest version of Claude Code

Summary

Claude reads files from the local worktree when verifying facts, instead of from origin/main. Local state may contain uncommitted or unmerged changes, producing wrong verification results.

In one session (2026-04-10):

  • Read proof_coverage.json from local branch (28 entries) instead of origin/main (27 entries)
  • Wrote README with wrong statistics based on local state
  • Violated the same rule 3 times after writing it into its own discipline document

Proposed Solution

For verification/audit tasks, Claude should default to git show origin/main:<file> instead of reading local files. Specifically:

  1. When verifying claims about repository state (counts, hashes, content)
  2. When writing documentation that references repo statistics
  3. When cross-checking sub-agent findings

A hook could detect open("proof_coverage.json") in Python scripts and suggest git show origin/main:proof_coverage.json instead.

Why This Matters

Local worktree ≠ canonical state. Every verification on local files is potentially wrong if the agent has uncommitted work, is on a feature branch, or has local-only changes. This is especially dangerous for formal verification registries where overclaiming coverage has protocol-safety implications.

Environment

  • Claude Code CLI (latest)
  • Model: Claude Opus (Max plan)
  • macOS

extent analysis

TL;DR

To fix the issue, Claude should default to reading files from origin/main instead of the local worktree when verifying facts, using git show origin/main:<file>.

Guidance

  • Identify all instances where Claude reads files for verification tasks and update them to use git show origin/main:<file> instead of reading local files.
  • Implement a hook to detect when Python scripts attempt to open files like proof_coverage.json and suggest using git show origin/main:proof_coverage.json instead.
  • Review all verification/audit tasks to ensure they are using the canonical state from origin/main instead of local files.
  • Consider updating the documentation to reflect the importance of using origin/main for verification tasks to avoid potential errors due to uncommitted or unmerged changes.

Example

# Before
with open('proof_coverage.json') as f:
    # ...

# After
import subprocess
output = subprocess.check_output(['git', 'show', 'origin/main:proof_coverage.json'])
with io.BytesIO(output) as f:
    # ...

Notes

This solution assumes that git show origin/main:<file> is a viable alternative for reading files in the canonical state. If this is not the case, further investigation may be needed to determine the correct approach.

Recommendation

Apply the workaround by updating Claude to use git show origin/main:<file> for verification tasks, as this directly addresses the issue of using local files instead of the canonical state from origin/main.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING