Skip to content

install never updates an existing instruction block: improvements to CLAUDE.md/AGENTS.md guidance never reach existing users #883

Description

@tirth8205

_inject_instructions (code_review_graph/skills.py:1451) is append-only with a marker guard:

if marker in existing:
    logger.info("%s already contains instructions, skipping.", file_path.name)
    return False

It never compares content. Once the marker is in a file, no later release can change that section. Reinstalling is a no-op.

Impact

Every improvement to the injected instruction text only reaches brand-new installs. Everyone who installed at any earlier version keeps the original wording forever, including the unguarded "ALWAYS use the graph BEFORE using Grep/Glob/Read" phrasing that #314 is about. Since the text steers agent behavior in every session, this silently pins existing users to whatever guidance shipped the day they installed.

Reproduction

On a checkout that has the marker in CLAUDE.md, run the install path with a modified section:

from pathlib import Path
from code_review_graph.skills import inject_claude_md, inject_platform_instructions
inject_claude_md(Path('.'))
inject_platform_instructions(Path('.'))

CLAUDE.md, AGENTS.md, GEMINI.md and the two .github copilot files are left byte-identical even though the generated section differs. Only files that did not exist yet get written.

Why it is not a one-line fix

The generated section has an opening marker and no closing marker, so its end boundary is implicit. Replacing to end of file would eat user-authored content that follows the block. A correct fix needs an explicit end marker for new writes, exact-match replacement of known historical section variants for legacy blocks, and a refusal that preserves the file and tells the user when the block has been hand-edited. There is precedent for that exact-match approach in _remove_legacy_instruction_file.

Same failure class as the still-open upgrade half of #558, where reinstall leaves stale hook blocks alongside new ones.

Being fixed alongside #314.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions