Skip to content

[BUG] Cowork: Global instructions silently revert to older version after saving #40175

Description

@kerrypak-claude

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Cowork global instructions silently revert to an older version after being saved through the Claude Desktop settings UI.

When editing global instructions via Settings → Cowork → Edit Global Instructions → Save, the new instructions appear to save successfully. However, within minutes they silently revert to an older version — typically the version that was active when an existing Cowork session was started.

This has been reproduced 20+ times over 2 weeks with consistent behavior. The save always appears to succeed in the UI, but the instructions always revert.

Mechanism (traced to root cause)

This is the Cowork-specific manifestation of the .claude.json stale-write race condition documented in #27941 (now closed as stale). The root cause, confirmed via deobfuscated source analysis in that issue:

  1. Global instructions are stored in ~/.claude.json alongside internal app state (tipsHistory, cachedStatsigGates, OAuth tokens, migration flags, etc.)
  2. Each active Cowork session holds an in-memory copy of the config at session start time
  3. Claude Desktop writes to .claude.json continuously during normal operation for internal state updates
  4. Each write follows a read-modify-write cycle using the session's stale in-memory copy
  5. The saveConfigWithLock function detects external modification (mtime/size change from the user's save) and logs tengu_config_stale_write telemetry — but does not abort the write
  6. The fallback path uses a 1-second in-memory cache, further ensuring fresh disk changes are lost

Result: Any active Cowork session writing any internal state back to .claude.json silently overwrites the user's freshly saved global instructions with its stale copy. Old sessions don't need to be doing anything visible — even background state writes trigger the overwrite.

What Should Happen?

Saving global instructions via the UI should persist reliably regardless of how many Cowork sessions are active. The save should never be silently reverted.

Why This Is Not a Duplicate

Error Messages/Logs

No error messages are displayed — the save appears to succeed. The revert is completely silent. The only trace is the tengu_config_stale_write telemetry event logged internally, which is invisible to the user.

Steps to Reproduce

  1. Open Claude Desktop → Cowork tab
  2. Start a Cowork session (or have one already running)
  3. Go to Settings → Cowork → Edit Global Instructions
  4. Make a visible change to the instructions text
  5. Click Save
  6. Wait 1–5 minutes (or start a new Cowork session)
  7. Return to Settings → Cowork → Global Instructions
  8. Result: Instructions have reverted to the version that was active when the existing session started

More reliably reproduced when multiple Cowork threads/sessions exist, as each holds its own stale copy.

Suggested Fix

Short-term: When tengu_config_stale_write is detected, re-read from disk and merge (or at minimum abort the write) instead of overwriting.

Long-term (as proposed in #27941 and #30329): Separate internal state (~/.claude/state.json) from user-editable config (~/.claude/config.json) so internal writes can never touch user settings.

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

Latest Claude Desktop (March 2026)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

N/A (Cowork Desktop UI)

Additional Information

Impact: This bug makes Cowork's global instructions feature effectively unusable for power users who maintain detailed instruction sets. The only reliable workaround is to put all instructions in a CLAUDE.md file in the mounted folder, which bypasses .claude.json entirely.

Related issues: #27941, #20637, #24578, #29929, #30329, PR #29077 (unmerged community fix for the race condition)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coworkbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions