Skip to content

fix(setup): stop writing unread Cursor global rule, write informational copy#522

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/521-cursor-global-rule
Jun 20, 2026
Merged

fix(setup): stop writing unread Cursor global rule, write informational copy#522
Alan-TheGentleman merged 1 commit into
mainfrom
fix/521-cursor-global-rule

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked Issue

Closes #521


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • engram setup cursor wrote ~/.cursor/rules/engram.mdc as an always-applied global rule, but Cursor does not read global rule files.mdc/alwaysApply only work at the project level; global "User Rules" are Settings-only plain text with no filesystem path. The Memory Protocol was therefore silently never applied.
  • Now it writes the Memory Protocol (plain, no frontmatter) to an informational file ~/.cursor/engram-memory-protocol.md, and the post-install steps tell the user to paste it as a User Rule in Settings → Rules. MCP registration (~/.cursor/mcp.json) is unchanged.

📂 Changes

File Change
internal/setup/agents.go Cursor adapter writes informational engram-memory-protocol.md instead of the unread .mdc; updated description + postInstall; new cursorMemoryProtocolPath; removed dead cursorRulesBody/cursorRulesPath
internal/setup/registry_test.go Tests assert the .mdc is NOT written and the new plain file exists (no alwaysApply frontmatter); VS Code frontmatter test split out

🧪 Test Plan

  • go test ./internal/setup/..., go vet, go build ./..., gofmt all clean
  • Verified Cursor's rule model against docs/forum: global rule files are not read (open feature request for ~/.cursor/rules global support)

✅ Contributor Checklist

  • I linked an approved issue above (Closes #N)
  • I added exactly one type:* label to this PR
  • Conventional commit format
  • No Co-Authored-By trailers

Summary by CodeRabbit

Release Notes

  • Changed

    • Cursor integration now provides a Memory Protocol markdown file for manual copy/paste configuration instead of automatically installing rule files, giving users more control over their setup.
  • Tests

    • Updated integration tests to verify the new memory protocol behavior and confirm the removal of legacy automatic rule installation.

…al copy

Cursor does not read global rule files from the filesystem — .mdc files with alwaysApply outside a project are silently ignored (global User Rules are UI-only, plain text, no path). So engram setup cursor was writing ~/.cursor/rules/engram.mdc that Cursor never read. Instead write the Memory Protocol to ~/.cursor/engram-memory-protocol.md (plain, no frontmatter) and instruct the user via postInstall to paste it as a User Rule in Settings → Rules. MCP registration is unchanged. Removes dead cursorRulesBody/cursorRulesPath; updates tests. Closes #521.
Copilot AI review requested due to automatic review settings June 20, 2026 10:24
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label Jun 20, 2026
@Alan-TheGentleman Alan-TheGentleman merged commit 9ee6b7f into main Jun 20, 2026
5 of 7 checks passed
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e44c0a4c-6ea1-4013-9afe-c42b999afd63

📥 Commits

Reviewing files that changed from the base of the PR and between 980ebd8 and 3804019.

📒 Files selected for processing (2)
  • internal/setup/agents.go
  • internal/setup/registry_test.go

📝 Walkthrough

Walkthrough

The Cursor agent adapter is changed from writing ~/.cursor/rules/engram.mdc (an always-applied .mdc rule Cursor ignores globally) to writing ~/.cursor/engram-memory-protocol.md as a plain informational file for manual copy/paste into Cursor's User Rules. The cursorRulesBody() and cursorRulesPath() helpers are removed; cursorMemoryProtocolPath() is added. Tests are updated to match the new behavior.

Changes

Cursor adapter: .mdc → informational markdown

Layer / File(s) Summary
Adapter config and path helpers
internal/setup/agents.go
Removes cursorRulesPath() and cursorRulesBody(), adds cursorMemoryProtocolPath() pointing to ~/.cursor/engram-memory-protocol.md, and updates the Cursor adapter entry to use wholeFile instructions and revised postInstall messaging for manual User Rules paste.
Registry and frontmatter tests
internal/setup/registry_test.go
Updates the declarative agents table to reference cursorMemoryProtocolPath. Removes TestCursorAndVSCodeInstructionsCarryFrontmatter; adds TestCursorMemoryProtocolHasNoFrontmatter (asserts legacy .mdc not written, new file has no alwaysApply/---) and TestVSCodeInstructionsCarryFrontmatter (retains Copilot frontmatter check).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Gentleman-Programming/engram#493: Touches the same internal/setup/agents.go and internal/setup/registry_test.go files for Cursor's declarative adapter configuration and registry-driven tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/521-cursor-global-rule

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes engram setup cursor writing an unread global .mdc rule by instead writing an informational Memory Protocol markdown file and guiding the user to paste it into Cursor “User Rules” (while keeping MCP registration behavior unchanged).

Changes:

  • Update the Cursor adapter to write ~/.cursor/engram-memory-protocol.md (plain protocol, no .mdc/alwaysApply frontmatter) and adjust post-install instructions accordingly.
  • Update setup registry tests to assert the old .cursor/rules/engram.mdc is not written and the new informational file is written and frontmatter-free.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/setup/agents.go Switch Cursor instruction surface from global .mdc rule to an informational Memory Protocol markdown file; update post-install guidance; add new path helper.
internal/setup/registry_test.go Update declarative agent instruction path for Cursor and add coverage ensuring the legacy .mdc file is not created and the new file has no frontmatter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +191 to +194
oldMDCPath := filepath.Join(home, ".cursor", "rules", "engram.mdc")
if _, err := os.Stat(oldMDCPath); err == nil {
t.Errorf("cursor: ~/.cursor/rules/engram.mdc should not be written (Cursor ignores global rule files)")
}
Alan-TheGentleman added a commit that referenced this pull request Jun 20, 2026
TestPrintPostInstall/cursor still asserted the removed 'engram.mdc' string after #522 switched Cursor to an informational engram-memory-protocol.md + manual User Rule step. Update the expectation to the current output. Closes #523.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(setup): Cursor global rule file is never read — write an informational copy and instruct a manual User Rule

2 participants