Skip to content

fix(cursor): deploy user-scope instructions to ~/.cursor/rules - #2506

Merged
Daniel Meppiel (danielmeppiel) merged 13 commits into
microsoft:mainfrom
yahavi:feature/cursor-user-scope-instructions
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 13 commits into
microsoft:mainfrom
yahavi:feature/cursor-user-scope-instructions

Conversation

@yahavi

@yahavi Yahav Itschak (yahavi) commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Fix #3054

fix(cursor): deploy user-scope instructions to ~/.cursor/rules

TL;DR

apm install -g / apm update -g for Cursor skipped the instructions primitive because the target profile marked them unsupported at user scope. That filter is removed: Cursor is fully user-scope supported and instructions deploy via the same cursor_rules path as project scope (~/.cursor/rules/*.mdc). Docs, CHANGELOG, and scope tests are updated to match.

Note

Cursor cloud agents whose workspace is not under $HOME remain a Cursor-side resolution gap (documented in the targets matrix); this PR does not claim to fix that.

Problem (WHY)

  • KNOWN_TARGETS["cursor"] set unsupported_user_primitives=("instructions",) and user_supported="partial", so for_scope(user_scope=True) dropped instructions before any integrator ran.
  • apm install -g --target cursor therefore wrote agents/skills/hooks under ~/.cursor/ but produced zero instruction files — silent omission, not an error.
  • [!] Docs claimed Cursor global rules were Settings-UI-only, which contradicted the file-backed .mdc model Cursor documents for rules under .cursor/rules.

Why these matter: APM’s multi-harness contract is that the same instruction primitive should land in each target’s native layout when that layout exists. Cursor’s documented project-rules surface is file-backed .mdc under .cursor/rules (“Project rules live in .cursor/rules as .mdc files”); excluding that path at user scope broke parity with project-scope Cursor installs and with fully user-supported targets like Claude.

Approach (WHAT)

# Fix
1 Mark Cursor user_supported=True and clear unsupported_user_primitives so instructions survive for_scope(user_scope=True).
2 Keep the existing cursor_rules transform — no new format; user scope reuses project-scope .mdc emission under ~/.cursor/rules/.
3 Sync concepts + targets-matrix docs and Unreleased CHANGELOG; extend covering-array / install-uninstall / warning tests.

Implementation (HOW)

  • src/apm_cli/integration/targets.py — Cursor profile: full user support; comment updated to describe file-backed ~/.cursor/rules/*.mdc alongside Settings UI User Rules. No new integrator code.
  • tests/unit/core/test_scope.py — Asserts Cursor is fully supported, supports_at_user_scope("instructions") is true, and the unsupported-scope warning no longer lists cursor (instructions).
  • tests/unit/integration/test_scope_install_uninstall.py — User-scope install/uninstall cycle expects .cursor/rules/*.mdc plus agents, and cleans both up.
  • tests/unit/integration/test_scope_integration.py — Resolved user-scope Cursor profile retains cursor_rules instructions.
  • tests/integration/test_primitive_target_covering_array.py — Adds cursor-instruction-user covering row.
  • docs/.../primitives-and-targets.md, docs/.../targets-matrix.md, CHANGELOG.md — Document full user-scope support and the home-directory / cloud-agent caveat.

Diagrams

Legend: user-scope Cursor install now keeps instructions through for_scope, then reuses the existing cursor_rules writer into ~/.cursor/rules/*.mdc (dashed = newly exercised path).

flowchart LR
    subgraph Resolve[for_scope user_scope]
        P[KNOWN_TARGETS.cursor]
        F[filter unsupported_user_primitives]
        O[scoped TargetProfile]
        P --> F --> O
    end
    subgraph Deploy[InstructionIntegrator]
        I[instructions remain in primitives]
        T[cursor_rules transform]
        W["write ~/.cursor/rules/*.mdc"]
        I --> T --> W
    end
    O --> I
    classDef new stroke-dasharray: 5 5;
    class I,T,W new;
Loading

Trade-offs

  • Reuse cursor_rules at user scope vs invent a Settings-UI sync path. Chose file deploy; rejected UI automation because APM’s install model is filesystem-native and Cursor already loads .mdc rules from disk for workspaces under $HOME.
  • Promote Cursor to fully supported vs keep partial. Chose full support once instructions were unblocked; remaining Settings UI “User Rules” plaintext is additive, not a missing APM primitive.
  • Cloud-agent workspaces outside $HOME left as documented caveat. Surgical fix; fixing Cursor’s resolution walk is out of scope.

Benefits

  1. apm install -g --target cursor deploys instruction .mdc files under ~/.cursor/rules/ (previously 0 files).
  2. Cursor leaves the “partially supported” warning bucket for the instructions exclusion.
  3. Project and user Cursor instruction layouts share one transform (cursor_rules), reducing format drift.
  4. Docs/CHANGELOG match runtime behavior for the next release notes cut.

Validation

uv run python -m pytest \
  tests/unit/core/test_scope.py \
  tests/unit/integration/test_scope_install_uninstall.py::TestCursorInstallUninstallCycle \
  tests/unit/integration/test_scope_integration.py::TestResolveTargetsConsistency \
  tests/integration/test_primitive_target_covering_array.py \
  --tb=line

======================== 54 passed, 12 skipped in 0.29s ========================
Key assertions exercised
  • TestTargetProfileUserScope::test_cursor_is_supported_at_user_scope
  • TestTargetProfileUserScope::test_supports_at_user_scope_cursor
  • TestScopeWarnings::test_warn_message_includes_unsupported_primitives (cursor (instructions) absent)
  • TestCursorInstallUninstallCycle::test_user_scope (deploy + uninstall .mdc + agents)
  • covering-array row cursor-instruction-user

Scenario Evidence

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 apm install -g --target cursor deploys instruction rules as ~/.cursor/rules/*.mdc and uninstall removes them Multi-harness support, Portability by manifest, DevX tests/unit/integration/test_scope_install_uninstall.py::TestCursorInstallUninstallCycle::test_user_scope (regression-trap) unit
2 Cursor is treated as fully user-scope supported; instructions is not filtered by for_scope Multi-harness support tests/unit/core/test_scope.py::TestTargetProfileUserScope::test_cursor_is_supported_at_user_scope
tests/unit/core/test_scope.py::TestTargetProfileUserScope::test_supports_at_user_scope_cursor
tests/unit/integration/test_scope_integration.py::TestResolveTargetsConsistency
unit
3 User-scope unsupported warning no longer claims cursor (instructions) DevX tests/unit/core/test_scope.py::TestScopeWarnings::test_warn_message_includes_unsupported_primitives unit
4 Covering array includes Cursor instructions at user scope Portability by manifest, OSS / community-driven tests/integration/test_primitive_target_covering_array.py (cursor-instruction-user) integration

How to test

  • On a machine with Cursor: apm install -g --target cursor for a package that ships .apm/instructions/ → expect new ~/.cursor/rules/*.mdc files.
  • Open a project under $HOME in Cursor Agent and confirm the deployed rule appears in context (or via Rules UI / @-mention).
  • apm uninstall -g --target cursor <pkg> → those .mdc files are removed; other ~/.cursor/ content for the package is cleaned as before.
  • uv run python -m pytest tests/unit/core/test_scope.py tests/unit/integration/test_scope_install_uninstall.py::TestCursorInstallUninstallCycle -q stays green.

Co-authored-by: Copilot [email protected]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Cursor user-scope (apm install -g / apm update -g) instruction deployment by marking Cursor as fully user-scope supported and no longer filtering out the instructions primitive, so instructions deploy via the existing cursor_rules transform to ~/.cursor/rules/*.mdc. It also updates tests, docs, and the changelog to reflect the corrected behavior.

Changes:

  • Update the Cursor TargetProfile to user_supported=True and remove the unsupported_user_primitives filter for instructions.
  • Extend unit/integration tests to assert Cursor user-scope instructions deploy/uninstall correctly and add a covering-array row for Cursor user-scope instructions.
  • Update docs to reflect Cursor’s file-backed user-scope rules and add an Unreleased changelog entry.

Reviewed changes

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

Show a summary per file
File Description
src/apm_cli/integration/targets.py Marks Cursor as fully user-scope supported and allows instructions at user scope.
tests/unit/core/test_scope.py Updates scope support assertions and warning-message expectations for Cursor.
tests/unit/integration/test_scope_integration.py Ensures user-scope Cursor retains instructions with cursor_rules format.
tests/unit/integration/test_scope_install_uninstall.py Validates Cursor user-scope install/uninstall includes .cursor/rules/*.mdc instructions.
tests/integration/test_primitive_target_covering_array.py Adds a covering-array row for Cursor instructions at user scope.
docs/src/content/docs/reference/targets-matrix.md Updates Cursor target matrix to describe full user-scope instructions deployment and caveat.
docs/src/content/docs/concepts/primitives-and-targets.md Updates Cursor notes to reflect full user-scope instruction support.
CHANGELOG.md Adds an Unreleased “Fixed” entry describing the Cursor user-scope instructions fix.

Comment thread CHANGELOG.md Resolved
@yahavi Yahav Itschak (yahavi) changed the title Fix Cursor user-scope instructions deploying to ~/.cursor/rules fix(cursor): deploy user-scope instructions to ~/.cursor/rules Aug 6, 2026
@yahavi

Copy link
Copy Markdown
Contributor Author

Hi Daniel Meppiel (@danielmeppiel)
Any chance to get a review for this small fix?

@yahavi

Copy link
Copy Markdown
Contributor Author

Sergio Sisternes (@sergio-sisternes-epam)?

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Aug 18, 2026
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

Yahav Itschak (@yahavi) I've triggered the CI now, and also our Agentic panel-review plus a Copilot Review with Balanced Effort (previous was Lite). Please keep an eye to further comments from the agents. As soon as any feedback is fixed please re-mention me, but I've assigned it so it keeps under my radar now.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (1)

docs/src/content/docs/reference/targets-matrix.md:167

  • Cursor's official rules documentation describes ~/.cursor/rules as machine-local user rules that apply across all projects, not as project rules discovered by walking upward from the workspace. The home-directory/cloud-agent caveat is therefore inaccurate and understates the scope of the feature.
  "User Rules" surface. Rule resolution walks upward from the workspace, so
  `~/.cursor/rules` applies to projects under `$HOME` (the normal local case);
  Cursor cloud agents whose workspace is not under the home directory are a
  known Cursor-side gap, not an APM limitation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Suppressed comments (3)

docs/src/content/docs/reference/targets-matrix.md:165

  • This support claim contradicts Cursor's documented model: .cursor/rules contains project rules scoped to the codebase, while global User Rules are a separate Settings surface. The official docs do not state that rule discovery walks above the workspace root, so a project under $HOME is not evidence that ~/.cursor/rules will be loaded. Retain the partial-support wording rather than documenting ineffective deployment as full support.
- **User scope.** Fully supported. Instructions deploy to
  `~/.cursor/rules/<name>.mdc` (same `cursor_rules` transform as project
  scope). Cursor loads those file-backed rules in addition to the Settings UI
  "User Rules" surface. Rule resolution walks upward from the workspace, so
  `~/.cursor/rules` applies to projects under `$HOME` (the normal local case);

docs/src/content/docs/concepts/primitives-and-targets.md:101

  • Cursor does not document ~/.cursor/rules/*.mdc as a user-wide rule source; .cursor/rules is the project-rule location and User Rules are configured separately. This line should continue to describe instructions as unavailable through APM at user scope unless a supported global storage API is identified.
- **cursor** -- Cursor IDE. Rules use the `.mdc` extension. Full user-scope support; instructions deploy to `~/.cursor/rules/*.mdc`.

CHANGELOG.md:15

  • The stated fix is not supported by Cursor's documented rule resolution: .cursor/rules is project-scoped, and the docs do not define ~/.cursor/rules as global User Rules storage. The changelog should not promise that global installs now produce usable Cursor instructions.
- `apm install -g` / `apm update -g` now deploy instructions to
  `~/.cursor/rules/*.mdc` for the Cursor target. Previously they were skipped
  based on an incorrect assumption that Cursor global rules were
  Settings-UI-only. (#2506)

Comment thread src/apm_cli/integration/targets.py Resolved
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Ship now: clean config fix with solid test coverage; doc-table gaps are real but non-blocking follow-ups.

cc Yahav Itschak (@yahavi) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The panel converges strongly. Eight specialists reviewed; none found code-level defects, security regressions, or missing test coverage. The python-architect confirms the change is data-only (removing an exclusion tuple and flipping a boolean). The test-coverage-expert validated that deploy-path I/O and e2e matrices already cover the new behavior -- no evidence gaps exist.

The doc-writer raised two blocking-severity findings: the output-directory table in primitives-and-targets.md and the deploy-directory bullet in targets-matrix.md both omit the new ~/.cursor/ user-scope path. These are factual accuracy gaps in reference docs, not code correctness issues. I side with shipping the code now and folding the two doc fixes as a same-day follow-up (or amending before merge if trivial). The reason: the code fix resolves a silent user-facing bug today; the doc tables were already incomplete before this PR (they never documented the path because it didn't exist). Holding a tested bug fix for prose alignment inverts priority. That said, these are one-line edits -- if the author can amend in 5 minutes, do it in-PR.

No dissent worth escalating. All nits are genuine quality improvements (CHANGELOG wording, inline comments, diagnostic notes) but none rise above advisory polish.

Dissent. The doc-writer classified two findings as blocking while no other panelist raised blocking concerns. I downweight these to recommended for merge-gating purposes: they are factual doc gaps introduced by omission (not by incorrect statements), the code is independently correct and tested, and both fixes are single-line edits that can land in a fast follow-up commit.

Aligned with: Multi-harness (restores Cursor to full parity with Claude Code and Copilot at user scope); Portability by manifest (same apm.yml instructions now deploy to one more scope without author intervention); Pragmatic-as-npm (fixes a silent skip that violated least-surprise).

Growth signal. Bundle into next minor release narrative as 'full Cursor parity'. The silent-omission fix is a trust signal for Cursor-community adopters evaluating APM -- worth a one-line release-note beat framed as user benefit, not internal plumbing.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 1 Clean data-only config change; removes an exclusion from the Cursor TargetProfile. Architecturally correct, no new abstractions needed.
CLI Logging Expert 0 0 0 Warning suppression is correct -- Cursor is now fully supported at user scope so removing it from the partial-support warning is the right behavior.
DevX UX Expert 0 0 1 Solid UX fix: removes a silent omission that violated install-adds-never-silently-mutates; caveat is documented; parity restored.
Supply Chain Security 0 0 1 No new security surface exposed; existing path containment and cleanup guards apply to the new user-scope write path.
OSS Growth Hacker 0 0 2 Solid silent-bug fix for a top-tier target; worth a release-note beat but not a standalone announcement.
Doc Writer 2 2 1 Docs are mostly consistent; two stale deploy-directory references omit ~/.cursor/ at user scope, and the targets-matrix user-scope block is verbose vs. peer targets.
Test Coverage Expert 0 0 0 All critical surfaces covered: deploy path has real-I/O install+uninstall cycle test; covering array adds e2e row. Ship.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Doc Writer] Update primitives-and-targets.md output-directory table to show ~/.cursor/ for user scope -- Canonical quick-reference table is factually incomplete after this fix; one-line edit.
  2. [Doc Writer] Update targets-matrix.md deploy-directory bullet to list both project and user-scope paths -- Peer targets already list both paths; omitting cursor's creates an inconsistency readers will hit.
  3. [OSS Growth Hacker] Reword CHANGELOG entry to lead with user benefit -- Release notes convert better when framed as outcomes, not implementation details.
  4. [DevX UX Expert] Consider emitting a diagnostic note about Cursor cloud-agent gap during user-scope install -- Prevents a support trip when users discover the limitation post-install.
  5. [Supply Chain Security] Document user-scope blast-radius note in enterprise security docs -- Consistent with existing guidance for other targets; not a regression but worth making explicit for enterprise adopters.

Architecture

classDiagram
    direction LR
    class TargetProfile {
        <<ValueObject>>
        +capability TargetCapability
        +root_dir str
        +primitives dict~str, PrimitiveMapping~
        +user_supported bool | str
        +user_root_dir str | None
        +unsupported_user_primitives tuple~str~
        +user_primitive_overrides dict | None
        +for_scope(user_scope bool) TargetProfile | None
        +supports_at_user_scope(primitive str) bool
        +deploy_path(project_root Path) Path
    }
    class PrimitiveMapping {
        <<ValueObject>>
        +sub_dir str
        +extension str
        +format_id str
        +output_compare bool
    }
    class TargetCapability {
        <<ValueObject>>
        +display_name str
        +aliases tuple~str~
    }
    class KNOWN_TARGETS {
        <<Registry>>
        +cursor TargetProfile
        +copilot TargetProfile
        +claude TargetProfile
    }
    TargetProfile *-- PrimitiveMapping : primitives dict
    TargetProfile *-- TargetCapability : capability
    KNOWN_TARGETS o-- TargetProfile : contains
    class TargetProfile:::touched
    classDef touched fill:#fff3b0,stroke:#d47600
Loading
flowchart TD
    A["KNOWN_TARGETS['cursor']"] --> B{"for_scope(user_scope=True)"}
    B -->|user_supported=True| C["Filter primitives by unsupported_user_primitives"]
    C -->|empty tuple now| D["All primitives pass through"]
    D --> E["Apply user_primitive_overrides if any"]
    E --> F["Return cloned TargetProfile\nroot_dir='.cursor'"]
    F --> G["[FS] Integrator deploys to\n~/.cursor/rules/*.mdc"]
    B -->|user_supported=False| H["Return None -- skip target"]
Loading

Recommendation

Ship this PR now. The code change is minimal, architecturally sound, fully tested, and resolves a real silent-failure bug for Cursor users. The two doc-table gaps are genuine but non-blocking -- they are one-line amendments the author can fold before merge or land in an immediate follow-up commit. No security, performance, or architectural concerns. Tests pass. This is a clean win for multi-harness parity.


Full per-persona findings

Python Architect

  • [nit] Comment could note that cursor_rules transform is reused unchanged at user scope at src/apm_cli/integration/targets.py
    A future reader may wonder whether the cursor_rules format_id path needed any user-scope adaptation. A one-line note that the same PrimitiveMapping (format_id=cursor_rules) drives both scopes would save them a grep.
    Suggested: Add inline note: # Same cursor_rules transform applies at both project and user scope.

CLI Logging Expert

No findings.

DevX UX Expert

  • [nit] Caveat about cloud agents could also appear in apm install -g output when target is cursor
    Users hitting the Cursor cloud-agent gap will see no warning at install time and only discover the limitation when rules fail to load. A one-line info diagnostic during install would save a support trip to docs.
    Suggested: Emit a diagnostic note during user-scope cursor install: 'Note: ~/.cursor/rules applies to workspaces under $HOME; Cursor cloud agents outside $HOME may not pick up these rules.'

Supply Chain Security Expert

  • [nit] Cursor user-scope rules directory is global blast radius for malicious instruction content at src/apm_cli/integration/targets.py:555
    Unlike project-scope rules (contained to one repo), user-scope .mdc files in ~/.cursor/rules/ are loaded across ALL projects. A compromised package delivering adversarial LLM instructions now reaches every Cursor workspace on the machine. This is equivalent to the existing behaviour for claude/copilot user-scope instructions and is not a regression, but worth noting in docs.
    Suggested: Consider documenting in enterprise/security.md that user-scope instruction deployment widens blast radius to all workspaces for that IDE, consistent with how other targets already behave.

OSS Growth Hacker

  • [nit] CHANGELOG entry could lead with user benefit, not internal detail at CHANGELOG.md:12
    Release notes are read by users, not maintainers. Leading with the user outcome converts better than leading with the command flags.
    Suggested: Reword to: '- Cursor: apm install -g now deploys instruction files to ~/.cursor/rules/*.mdc, closing the gap between project and user scope. Previously instructions were silently skipped. (fix(cursor): deploy user-scope instructions to ~/.cursor/rules #2506)'
  • [nit] Targets-matrix cloud-agent caveat could note this is a Cursor-side limitation more clearly at docs/src/content/docs/reference/targets-matrix.md
    Users may interpret the caveat as an APM limitation without clear framing.
    Suggested: Add: 'Note: Cursor user-scope rules apply only when the workspace is under $HOME. Remote/cloud workspaces may not inherit them.'

Auth Expert -- inactive

No auth-related files changed; targets.py edit is deploy-surface configuration, not authentication or token management.

Doc Writer

  • [blocking] primitives-and-targets.md output-directory table still shows only '.cursor/' for cursor, omitting user-scope path at docs/src/content/docs/concepts/primitives-and-targets.md:88
    The table at line 88 is the canonical quick-reference for output directories. Every reader who consults it will see '.cursor/' with no user-scope path for cursor, while copilot shows both project and user-scope paths. After this fix cursor has a user-scope path too; leaving the table unchanged makes the fix invisible to the most commonly consulted surface.
    Suggested: Change the cursor row to show .cursor/ (project), ~/.cursor/ (user scope).
  • [blocking] targets-matrix.md 'Deploy directory' bullet for cursor omits the user-scope path at docs/src/content/docs/reference/targets-matrix.md:153
    Line 153 reads '- Deploy directory. .cursor/.' After the fix, user-scope deploys land in ~/.cursor/. Peer targets list both project and user paths in this bullet.
    Suggested: Change to: '- Deploy directory. .cursor/ (project scope); ~/.cursor/ (user scope).'
  • [recommended] User scope block in targets-matrix is significantly more verbose than peer target blocks at docs/src/content/docs/reference/targets-matrix.md:161
    Peer blocks use 1-2 sentences; the new cursor block is 5 sentences. The cloud-agent caveat detail risks drift.
    Suggested: Trim to: '- User scope. Fully supported. Instructions deploy to ~/.cursor/rules/<name>.mdc. Cloud-agent workspaces outside $HOME are a known Cursor-side gap.'
  • [recommended] Caveat bullet for claude_command transformer lacks cross-reference for diagnostics at docs/src/content/docs/reference/targets-matrix.md:170
    Says 'surfaced via diagnostics' but no link. Reader has no path forward.
    Suggested: Add a link to diagnostics reference.
  • [nit] CHANGELOG entry uses slash notation inconsistently with surrounding entries at CHANGELOG.md
    Minor style consistency.
    Suggested: Use 'and' instead of '/'.

Test Coverage Expert

No findings.

Performance Expert -- inactive

No perf-path files changed; adding one static field to a target profile is O(1) and does not affect any hot path.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) removed the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Aug 18, 2026
auto-merge was automatically disabled August 19, 2026 13:16

Head branch was pushed to by a user without write access

@yahavi

Copy link
Copy Markdown
Contributor Author

Sergio Sisternes (@sergio-sisternes-epam) Feedback from the panel doc tables is in this push: the primitives output-directory table and the targets-matrix deploy-directory bullet now list ~/.cursor/ at user scope, matching peer targets.

Copilot's request to revert Cursor user-scope instructions was declined on the review thread: file-backed ~/.cursor/rules is distinct from the Settings User Rules surface, and workspaces under $HOME load those .mdc files.

@yahavi
Yahav Itschak (yahavi) force-pushed the feature/cursor-user-scope-instructions branch from 2c9005e to e4cf21a Compare August 19, 2026 13:25
@yahavi

Copy link
Copy Markdown
Contributor Author

Hi Sergio Sisternes (@sergio-sisternes-epam) — when you have a moment, could you please review this PR? Thank you.

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Thank you for the work you have put into APM. We are closing this PR as part of a maintainer-led issue-first intake reset because we could not identify an APM issue tracking this change.

Our small maintainer team cannot sustainably review implementations before agreeing which problems and scope we can support. We recognize this process was not clear when some contributions began, and we are sorry for that. This is a review-capacity decision, not a judgment of your work's quality.

Thank you for responding to the existing review and following up. Those efforts remain part of this PR's history; this is not a request to repeat them.

Please open an issue describing the problem and proposed scope, or point us to the existing matching issue, and link it here. For substantive changes, a responsible human maintainer must agree the scope, acceptance criteria and review contact under the contribution rules.

Once the tracking and applicable scope decision are in place, please ask here to reopen this PR so the existing work can be reused. There is no need to discard your contribution or start over. The same issue-first expectations apply to maintainer-authored and automated PRs.

@yahavi

Copy link
Copy Markdown
Contributor Author

Tracking issue for this change: #3054

That issue describes the silent skip of Cursor instructions at user scope (apm install -g / apm update -g), the proposed scope (reuse existing cursor_rules into ~/.cursor/rules/*.mdc; no Settings-UI sync; cloud-agent $HOME gap stays documented), and points back here so this implementation can be reused.

Daniel Meppiel (@danielmeppiel) please review the issue for scope / acceptance criteria. Once a maintainer agrees, please reopen this PR so the existing work can land against that tracking issue.

@yahavi
Yahav Itschak (yahavi) force-pushed the feature/cursor-user-scope-instructions branch from a28ebcb to 9702828 Compare October 19, 2026 08:53
@yahavi

Copy link
Copy Markdown
Contributor Author

Daniel Meppiel (@danielmeppiel) / Sergio Sisternes (@sergio-sisternes-epam) - could you please give this PR an approval?

…-scope-instructions

Keep the unreleased Cursor user-scope changelog entry alongside the fixes that landed on main.
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

Thank you for carrying the approved scope from #3054 into this pull request. The linked issue is marked status/accepted, so this recommendation is ready for human review. Requested reviewers are Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam). This is advisory only, not merge or scope approval.


Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added area/multi-target Multi-target deploy spec, target directory creation, agent surface routing. theme/portability triage/recommended Automated advice completed; not human scope approval. type/bug Something does not work as documented. status/accepted Human scope approval; verify the issue's approval record and review contact before work. labels Nov 3, 2026
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

Yahav Itschak (@yahavi) thanks for sticking with this one, and for carrying the scope from #3054 through. The branch now has merge conflicts with main, so GitHub cannot run the required checks on it. Could you rebase onto current main and push? Once the head is clean, a maintainer can approve the workflow runs and the checks can go green. We are not changing your branch ourselves for now.

This comment is AI-generated and may contain errors.

…-scope-instructions

Keep the unreleased Cursor user-scope changelog entry out of the v0.35.0 notes.
@yahavi

Copy link
Copy Markdown
Contributor Author

Thanks, Sergio Sisternes (@sergio-sisternes-epam).
I merged from the main branch.

@yahavi

Copy link
Copy Markdown
Contributor Author

Sergio Sisternes (@sergio-sisternes-epam) - can you trigger the workflow and merge?

Brings the PR current with main. CHANGELOG.md takes main's version; the
auto-merge had re-inserted the microsoft#3439 and microsoft#3407 entries a second time
under 0.35.1.

Co-authored-by: Copilot App <[email protected]>
The microsoft#3054 scope record requires real installed-CLI lifecycle coverage for
Cursor user-scope rules: install, reinstall, update, frozen replay,
read-only audit and ownership-aware removal, with independent filesystem
and lockfile evidence. The new test runs both user and project scope,
keeps a handwritten neighboring rule intact through removal, pins the
existing rule-dir collision policy (apm#1662) and the fail-closed edited
managed-file uninstall contract. Mutation-break: restoring the
instructions filter on the Cursor profile fails the user case.

Addresses scope gap (a) from the merge-worker plan.

Co-authored-by: Copilot App <[email protected]>
The microsoft#3054 scope record asks docs, shipped guidance and code comments to
describe the qualified behavior only: local Cursor 2.1+ clients include
~/.cursor/rules in context, APM manages the files and removes only
package-owned rules, and cloud or remote surfaces are not qualified.
Adds the same note to the apm-guide package-authoring resource.

Addresses scope gaps (c), (d) and (e) from the merge-worker plan.

Co-authored-by: Copilot App <[email protected]>
The microsoft#3054 done-when requires a release note under Fixed. The author's
entry was dropped while resolving main conflicts; restore it in the
current Unreleased block with contributor credit.

Addresses scope gap (b) from the merge-worker plan.

Co-authored-by: Copilot App <[email protected]>
The rule-dir ownership policy (apm#1662) replaces an existing rule whose
filename matches a package rule; at user scope that now reaches
~/.cursor/rules. State it in the release note, targets matrix and shipped
guidance instead of promising unconditional preservation, drop the
inaccurate 'silently' (the old warning listed cursor instructions), link
the concept note to the canonical matrix entry, and give the guide note
its own paragraph.

Addresses panel follow-ups from doc-writer (1 recommended, 2 nits) and
devx-ux-expert (1 nit).

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Community fix enables Cursor user-scope instruction delivery with a one-line registry change, backed by a real installed-CLI lifecycle test and full panel agreement.

panel-mode=full; personas=python-architect,test-coverage-expert,doc-writer,devx-ux-expert,supply-chain-security-expert,apm-ceo

cc Yahav Itschak (@yahavi) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Thank you Yahav Itschak (@yahavi) for carrying this through the issue-first reset. The fix itself is unchanged: Cursor becomes user_supported=True with no instructions filter, so apm install -g --target cursor writes ~/.cursor/rules/*.mdc through the existing cursor_rules transform. This pass merged current main and added what the #3054 scope record requires. That covers a real installed-CLI lifecycle test, qualified docs and shipped guidance, and the release note.

None of the five panelists found a code or security defect. The architect confirms the change is data-only: the registry flag propagates through for_scope() with no integrator, dispatch or finalize changes. Test coverage reports every scope-record demand met. The only substantive finding came from doc-writer, about disclosing the existing same-name rule replacement, and it was folded in this run.

Native consumption. The rules being written to disk and Cursor actually loading them are separate claims. The tests prove file creation, update, ownership and removal only. Native loading rests on Cursor's official 2.1 changelog ("Rules in home folder (~/.cursor/rules) will be included in context"). It is also backed by static inspection of the Cursor 2.6.19 rule service, which resolves user rules to userHome/.cursor/rules/<name>.mdc. Cursor itself was not driven in this run, so a quick manual check on a local Cursor 2.1+ client is the one remaining human step in the #3054 done-when.

Aligned with: multi-harness (Cursor reaches user-scope parity for instructions with no new code paths); portable by manifest (same cursor_rules transform at both scopes); secure by default (containment, scanning, lockfile ownership and fail-closed uninstall apply unchanged at user scope); community-driven (contributor fix carried through the issue-first process).

Panel summary

Persona B R N Takeaway
Python Architect 0 0 1 Clean data-driven enablement via the KNOWN_TARGETS registry; no new authority or logic change.
Test Coverage Expert 0 0 0 All scope-record demands met: installed-CLI lifecycle, neighbor preservation, covering-array row, scope tests.
Doc Writer 0 1 2 Docs cite the Cursor 2.1 changelog with no upward-walk claim; disclose same-name replacement (folded).
Devx Ux Expert 0 0 1 Replaces the instruction skip with a real deploy; warning, docs and CHANGELOG aligned.
Supply Chain Security Expert 0 0 1 No regression; containment, scanning, lockfile and ownership guards apply uniformly at user scope.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 2 follow-ups

  1. [Apm Ceo] Maintainer manual check of native Cursor recognition: apm install -g --target cursor a small rules package, open a project in local Cursor 2.1+, confirm the rule appears in context. -- This is the only part of the [BUG] Cursor user-scope install skips instructions (no ~/.cursor/rules/*.mdc) #3054 done-when that automation here could not execute.
  2. [Supply Chain Security Expert] Follow-up issue: a standard-verbosity warning when a rule-dir rewrite replaces an untracked same-named file at user scope. -- The existing apm#1662 policy now reaches ~/.cursor/rules; the diagnostic is verbose-only today. Out of scope here because it changes the shared rule-dir owner across Claude, Cursor and Windsurf.

Architecture

classDiagram
    direction LR
    class KNOWN_TARGETS {
      <<Registry>>
      +dict~str, TargetProfile~
    }
    class TargetProfile {
      <<ValueObject>>
      +user_supported bool|str
      +unsupported_user_primitives tuple
      +user_root_dir str|None
      +for_scope(user_scope) TargetProfile|None
      +supports_at_user_scope(primitive) bool
    }
    class PrimitiveMapping {
      <<ValueObject>>
      +subdir str
      +format_id str
      +output_compare bool
    }
    class InstructionIntegrator {
      <<Integrator>>
      +integrate_instructions_for_target(target) IntegrationResult
      +_convert_to_cursor_rules(content) str
      +sync_for_target(target) dict
    }
    class warn_unsupported_user_scope {
      <<Pure>>
      +warn_unsupported_user_scope() str
    }
    KNOWN_TARGETS *-- TargetProfile : contains
    TargetProfile *-- PrimitiveMapping : primitives
    InstructionIntegrator ..> TargetProfile : reads scoped primitives
    warn_unsupported_user_scope ..> KNOWN_TARGETS : queries
    class KNOWN_TARGETS:::touched
    class TargetProfile:::touched
    classDef touched fill:#fff3b0,stroke:#d47600
Loading
flowchart TD
    A["apm install -g --target cursor"] --> C{"TargetProfile.for_scope(user_scope=True)"}
    C -->|"user_supported=True, no filter"| D["scoped profile keeps instructions"]
    C -.->|"before: partial, instructions filtered"| X["instructions dropped (removed)"]
    D --> F["InstructionIntegrator cursor_rules"]
    F --> I["write ~/.cursor/rules/name.mdc"]
    I --> J["apm.lock.yaml content_hash + owners"]
    J --> K{"finalize compile hint"}
    K -->|"cursor excluded"| L["no apm compile -g hint"]
Loading

Recommendation

The in-scope items from this pass are folded: same-name disclosure in CHANGELOG, targets matrix and guide; dropped "silently"; linked the concept note to the matrix; gave the guide note its own paragraph. CI is green on the latest head. Before merge, do the quick manual Cursor recognition check. Track the user-scope rule-dir collision warning as a separate issue.

Folded in this run

  • (scope) Merged current main; CHANGELOG takes main's version (the auto-merge had duplicated fix(receipts): preserve macOS identity across remounts with downgrade-safe migration #3439/fix(install): keep the locked commit as the cached source pin #3407 under 0.35.1) -- resolved in f165ca0.
  • (scope) Installed-CLI lifecycle test tests/integration/test_cursor_rules_lifecycle.py, user and project scope: install, reinstall (byte/mtime/lock identical), deps update (rewrite + retire), --frozen replay, read-only audit, audit --ci drift on an edited managed rule, fail-closed then ownership-aware uninstall that keeps a handwritten neighbor -- resolved in 1d10f5e.
  • (scope) Docs, shipped guidance (packages/apm-guide) and code comment qualified to local Cursor 2.1+; cloud/remote surfaces and Settings UI User Rules called out as not managed -- resolved in d94df8d.
  • (scope) CHANGELOG Fixed entry restored with contributor credit -- resolved in 270f182.
  • (panel) Disclose that an existing same-named rule is replaced on install (existing apm#1662 rule-dir policy), drop "silently", link concept note to the matrix, separate guide paragraph -- resolved in 2df6ed9.

Copilot signals reviewed

  • CHANGELOG.md -- LEGIT: entry should be one line ending with the PR number (resolved in 270f182).
  • src/apm_cli/integration/targets.py:811 -- NOT-LEGIT: keeping Cursor partial contradicts Cursor's documented 2.1 home-folder rules and the approved [BUG] Cursor user-scope install skips instructions (no ~/.cursor/rules/*.mdc) #3054 scope.
  • docs/.../targets-matrix.md:167 (suppressed) -- LEGIT: the upward-walk explanation was undocumented; replaced by the 2.1 changelog wording earlier and kept out in this run.
  • docs/.../targets-matrix.md:165, primitives-and-targets.md:101, CHANGELOG.md:15 (suppressed) -- NOT-LEGIT: same premise as above, settled by the Cursor 2.1 changelog.

Deferred (out-of-scope follow-ups)

Regression-trap evidence (mutation-break gate)

  • tests/integration/test_cursor_rules_lifecycle.py::test_cursor_rules_installed_lifecycle[user] -- restored user_supported="partial" + unsupported_user_primitives=("instructions",); the test FAILED as expected (along with 4 scope unit tests); guard restored.

Lint contract

ruff check and ruff format --check (src, tests and the architecture linter scripts), pylint R0801, lint-auth-signals.sh and lint-architecture-boundaries.sh all silent at the pushed head.

CI

All required checks pass on 2df6ed9 (24 success, 2 neutral, 1 skipped; license/cla pass), after 0 CI fix iteration(s).

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#2506 2df6ed9 ship_with_followups 1 5 1 2 green MERGEABLE BLOCKED pending required review; manual Cursor check

Convergence

1 outer iteration(s); 2 Copilot round(s). Final panel stance: ship_with_followups. Ready for maintainer review.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 2b14652 into microsoft:main Nov 12, 2026
27 checks passed
Daniel Meppiel (danielmeppiel) added a commit to Kaustubh1235/apm that referenced this pull request Nov 12, 2026
Resolves the conflicting state after microsoft#2506 and microsoft#3534 landed on main.

Co-authored-by: Copilot App <[email protected]>
Junya Nakazato (jey3dayo) added a commit to jey3dayo/apm-workspace that referenced this pull request Nov 19, 2026
…ursor rule under APM 0.36

APM 0.36.0 deploys user-scope instructions to ~/.cursor/rules (microsoft/apm#2506, fixing a silent omission) and ports scoped applyTo to Cursor globs (#2030). Update the fixture expectation and the distribution doc row accordingly: the file now exists, carries the applyTo pattern as globs, and is never alwaysApply.
Junya Nakazato (jey3dayo) added a commit to jey3dayo/apm-workspace that referenced this pull request Nov 19, 2026
* chore(mise): bump apm-cli to 0.36.1

* test(native): expect the scoped design instruction as a glob-scoped Cursor rule under APM 0.36

APM 0.36.0 deploys user-scope instructions to ~/.cursor/rules (microsoft/apm#2506, fixing a silent omission) and ports scoped applyTo to Cursor globs (#2030). Update the fixture expectation and the distribution doc row accordingly: the file now exists, carries the applyTo pattern as globs, and is never alwaysApply.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/multi-target Multi-target deploy spec, target directory creation, agent surface routing. status/accepted Human scope approval; verify the issue's approval record and review contact before work. triage/recommended Automated advice completed; not human scope approval. type/bug Something does not work as documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Cursor user-scope install skips instructions (no ~/.cursor/rules/*.mdc)

5 participants