Skip to content

Grounding refresh writes mixed line endings in .cursor/rules/hunch.mdc and .windsurf/rules/hunch.md (Windows, CRLF repo) #657

Open

Description

@davesheffer

Version: 1.56.0 (global npm install), Windows 11, Node 24.13.0, git 2.52.0.windows.1, core.autocrlf=true

What happens
After a grounding refresh (hunch grounding --refresh, or the refresh the post-merge / post-commit hooks run), .cursor/rules/hunch.mdc and .windsurf/rules/hunch.md end up with mixed line endings, both in the working tree and in the index (git ls-files --eol → i/mixed w/mixed).

In both files, the generated block body is CRLF, but these lines are LF:

  • the front matter (lines 1–5: ---, description: …, alwaysApply: true, ---, blank)
  • the <!-- HUNCH:END --> marker
  • the trailing blank line

CLAUDE.md, AGENTS.md and .github/copilot-instructions.md stay pure CRLF, so this looks specific to the writers that add front matter around the block.

Repro

  1. A Windows repo where these files are committed as CRLF.
  2. Normalize both files to CRLF and commit.
  3. Run a refresh (or make any commit that triggers the hook refresh).
  4. git ls-files --eol .cursor/rules/hunch.mdc .windsurf/rules/hunch.md → i/mixed w/mixed.

Impact
Line-ending churn in every refresh diff (each refresh rewrites ~14 lines in each file when only the count line changed). It can't be worked around locally: normalizing the files and committing triggers another hook refresh, which writes the mixed endings again.

Expected
Detect the file's existing EOL (or follow core.autocrlf / .gitattributes) and use it for the front matter and end marker too, as the block body already does.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions