[DOCS] Perforce docs missing `CLAUDE_CODE_PERFORCE_MODE` and read-only file workflow

Resolved 💬 2 comments Opened Apr 9, 2026 by coygeek Closed May 28, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/env-vars

Section/Topic

CLAUDE_CODE_PERFORCE_MODE and the Perforce-specific behavior for Edit/Write/NotebookEdit on read-only files.

Current Documentation

The current Perforce references only cover custom worktree creation:

Worktree isolation works with git by default. For other version control systems like SVN, Perforce, or Mercurial, configure WorktreeCreate and WorktreeRemove hooks to provide custom worktree creation and cleanup logic.

The environment variables reference currently has no entry for CLAUDE_CODE_PERFORCE_MODE.

What's Wrong or Missing?

Claude Code v2.1.98 added CLAUDE_CODE_PERFORCE_MODE, but the docs do not explain:

A. How to enable it

There is no env-var reference entry for the setting.

B. What behavior it changes

The docs do not describe that, when enabled, Edit, Write, and NotebookEdit fail on read-only files and surface a p4 edit hint instead of silently overwriting those files.

C. Where it fits into existing Perforce guidance

Current Perforce documentation focuses on worktree hooks, but not on day-to-day edit behavior in Perforce-managed workspaces where files are commonly read-only until checked out.

Suggested Improvement

Add an env-vars entry such as:

CLAUDE_CODE_PERFORCE_MODE — Set to 1 to make Edit, Write, and NotebookEdit fail on read-only files and suggest p4 edit instead of overwriting them. Useful in Perforce workspaces where files remain read-only until checked out.

Also add a short note to the Perforce/non-git workflow docs explaining that this setting is for edit-time behavior, while WorktreeCreate/WorktreeRemove hooks cover workspace creation and cleanup.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/env-vars | reference missing | No entry for CLAUDE_CODE_PERFORCE_MODE |
| https://code.claude.com/docs/en/common-workflows | 741-743 | Mentions Perforce worktree hooks but not the new read-only edit workflow |
| https://code.claude.com/docs/en/hooks | 1768-1770 | Mentions Perforce as a custom worktree backend, but not edit-time p4 edit guidance |

Total scope: 3 pages affected

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗