Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

TML-2705: consolidate agent rules into one tracked home, symlinked into .cursor/.claude - #609

Merged
wmadden merged 2 commits into
mainfrom
tml-2705-ensure-agent-rules-are-consistently-symlinked
May 29, 2026
Merged

wmadden merged 2 commits into
mainfrom
tml-2705-ensure-agent-rules-are-consistently-symlinked

Conversation

@wmadden

@wmadden wmadden commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Refs TML-2705

At a glance

Cursor reads its rules from .cursor/rules/, Claude Code from .claude/rules/. Our convention is that the real file lives once in .agents/rules/ and each tool dir just symlinks to it. But .cursor/rules is git-ignored — so when an agent drops a new rule straight into .cursor/rules (the obvious place), git silently ignores it and the rule is lost on the next clone. That's exactly what kept happening.

The root cause: .agents/rules was also git-ignored. There was no .gitignore whitelist for it, so the "canonical" path couldn't actually hold a tracked file. The convention was documented but never enforceable.

This PR makes the convention real and self-healing. .agents/rules/ becomes the one tracked copy; the tool dirs become regenerated symlink mirrors:

.agents/rules/no-bare-casts.mdc                                            # canonical, tracked
.cursor/rules/no-bare-casts.mdc  ->  ../../.agents/rules/no-bare-casts.mdc # git-ignored mirror
.claude/rules/no-bare-casts.mdc  ->  ../../.agents/rules/no-bare-casts.mdc # git-ignored mirror
pnpm rules:sync           # move any stray rule into .agents/rules + (re)build the symlink mirrors
pnpm lint:rules:symlinks  # fail if a mirror drifts from canonical (runs in CI; rules:sync runs in prepare)

Decision

.agents/rules/ is the single source of truth; .cursor/rules/ and .claude/rules/ are git-ignored symlink mirrors regenerated from it — the same arrangement skills already use (skills-contrib/ is canonical, the tool dirs are generated). Concretely, three pieces:

  1. A sync tool — scripts/sync-agent-rules.mjs consolidates any stray real-file rule into .agents/rules, rebuilds both mirrors, and prunes dangling/orphan symlinks. Idempotent; errors on a real content conflict.
  2. A lint gate — the same script's --check mode (pnpm lint:rules:symlinks) fails when a mirror drifts from canonical, wired into CI.
  3. The .gitignore fix — the actual bug. .agents/rules/** is now tracked; the two mirrors stay ignored and are rebuilt by prepare, so pnpm install heals them automatically.

How it fits together

  1. Untrack-then-whitelist the canonical dir. .gitignore goes from a blanket .agents/ to .agents/* plus !.agents/rules/. A wholesale .agents/ ignore can't have a subdir re-included; ignoring the children and re-including rules/ can. Skills and everything else under .agents/ stay ignored. (Verified with git check-ignore.)
  2. Build the sync tool test-first. scripts/sync-agent-rules.test.mjs (13 cases on temp fixtures) pins consolidation, both-mirror symlinking, idempotency, dangling-symlink pruning, conflict detection, and read-only --check.
  3. Wire it into the lifecycle. rules:sync is appended to prepare (so install rebuilds the mirrors, exactly like skills add), lint:rules:symlinks joins the CI lint job, and the test joins test:scripts.
  4. Run the one-time migration. The 68 rules that were committed as real files under .cursor/rules move into .agents/rules (git records them as clean renames), both mirrors become pure symlinks, and a long-dangling .claude/rules/drive-project-workflow.mdc is removed.
  5. Make the existing lints honest about the new layout. validate-rules now reads canonical .agents/rules (present even before prepare runs). Doing so surfaced three rules with no frontmatter at all — fixed. The footprint thresholds are raised because consolidation finally loads several rules that were canonical-but-never-mirrored (see Reviewer notes).

By the numbers

Before: .cursor/rules tracked ~70 rule files directly, only 2 of them symlinks; .agents/rules held 11 canonical rules; .claude/rules had 3 symlinks, one dangling. After: all 78 rules live in .agents/rules, and .cursor/rules + .claude/rules are 78 symlinks each and nothing else. (The 68 real files move; the 2 pre-existing symlinks and 11 already-canonical rules stay put.)

Where to look

Area What changed
scripts/sync-agent-rules.mjs (+ .test.mjs) the tool: consolidate + regenerate + --check; 13 tests
.gitignore track .agents/rules/**; keep the mirrors ignored
package.json rules:sync, lint:rules:symlinks; sync in prepare; test in test:scripts
.github/workflows/ci.yml "Validate rule symlinks" step
scripts/validate-rules.mjs, .cursor/rules-footprint.config.json read canonical; raise footprint thresholds
68 rule renames + 3 frontmatter fixes the migration
.agents/rules/README.md, AGENTS.md/CLAUDE.md rules-index reconciliation + "where rules live"

Reviewer notes

  • Most of the diff is renames. 68 entries are 100%-similarity .cursor/rules/* -> .agents/rules/* moves; the real review surface is the script, .gitignore, package.json, CI, and the docs.
  • Footprint thresholds bumped deliberately. Consolidation finally mirrors (and so loads) several alwaysApply: true rules that were stranded in .agents/rules and invisible to Cursor — e.g. git-staging, prefer-psl-in-design-docs, no-transient-project-ids-in-code — about 5 KB more always-on context. Worth a separate decision whether they should all stay always-on (see Follow-ups); this PR only raises the ceiling so CI reflects reality.
  • fs.rmSync gotcha. The script deletes symlinks with unlinkSync, not rmSync: rmSync stats the link target and silently no-ops on a dangling symlink, so the dangling rule would never get cleaned up. There's a comment at the call site.
  • README is now canonical (.agents/rules/README.md, symlinked into both mirrors). Full index reconciliation: dropped 7 entries for rules that no longer exist, added 14 that were missing — it now lists exactly the 78 real rules.

Verification

  • pnpm lint:rules — passes (reads canonical; 3 newly-surfaced frontmatter gaps fixed)
  • pnpm lint:rules:symlinks — consistent; rules:sync idempotent (second run = 0 changes); no broken symlinks
  • pnpm lint:rules:footprint — passes
  • pnpm test:scripts — 114 pass (incl. 13 new)
  • pnpm-lock.yaml unchanged; biome clean

Follow-ups

  • Decide whether the now-loaded alwaysApply: true rules should stay always-on or be scoped (globs + alwaysApply: false).

Alternatives considered

  • Commit the symlinks instead of regenerating them. Less migration churn and no dependency on prepare, but it diverges from how skills work and means committing 156 symlink entries (78 rules × 2 mirrors) that move in lockstep with canonical anyway. We chose to mirror the skills model so there's one mental model for both.
  • Reuse the skills CLI for rules. skills add only understands SKILL.md packages; it has no notion of a .mdc rule file, so a bespoke script was needed regardless.

Summary by CodeRabbit

  • New Features

    • Added new agent rules (MongoDB obsolete-command guidance; avoid Linear sub-issues) and rule metadata headers.
  • Documentation

    • Introduced a canonical rules index and updated agent workflow docs and guidance for rule sizing and organization.
    • Adjusted footprint thresholds.
  • Chores

    • Added rule sync/validation tooling, tests, CI step for symlink checks, updated ignore patterns, and setup scripts to regenerate presentation mirrors.

Review Change Stack

Agent rules now mirror the skills-contrib model: `.agents/rules/` is the
only git-tracked home, and `.cursor/rules` + `.claude/rules` are git-ignored
presentation trees containing nothing but relative symlinks back into it.

- Add scripts/sync-agent-rules.mjs (+ tests): consolidates stray real-file
  rules into the canonical dir, regenerates the symlink trees, and prunes
  dangling/orphan symlinks. `--check` is the lint gate.
- Wire `rules:sync` into `prepare` and `lint:rules:symlinks` into CI.
- Fix .gitignore so `.agents/rules/**` is tracked (the missing whitelist
  exception was the root cause: rules added only to `.cursor/rules` were
  silently git-ignored and lost).
- Migrate 68 rules into `.agents/rules`, remove the dangling
  drive-project-workflow symlink, and add frontmatter to three rules that
  had none.
- Point validate-rules at the canonical dir; bump footprint thresholds for
  the previously-orphaned alwaysApply rules now actually loaded.
- Rewrite the rules index and the AGENTS.md/CLAUDE.md "where rules live"
  section to match the new model.

Closes TML-2705

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden requested a review from a team as a code owner May 29, 2026 05:08
@pkg-pr-new

pkg-pr-new Bot commented May 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/@prisma-next/extension-author-tools@609

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/@prisma-next/mongo-runtime@609

@prisma-next/family-mongo

npm i https://pkg.pr.new/@prisma-next/family-mongo@609

@prisma-next/sql-runtime

npm i https://pkg.pr.new/@prisma-next/sql-runtime@609

@prisma-next/family-sql

npm i https://pkg.pr.new/@prisma-next/family-sql@609

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/@prisma-next/extension-arktype-json@609

@prisma-next/extension-cipherstash

npm i https://pkg.pr.new/@prisma-next/extension-cipherstash@609

@prisma-next/middleware-cache

npm i https://pkg.pr.new/@prisma-next/middleware-cache@609

@prisma-next/mongo

npm i https://pkg.pr.new/@prisma-next/mongo@609

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/@prisma-next/extension-paradedb@609

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/@prisma-next/extension-pgvector@609

@prisma-next/extension-postgis

npm i https://pkg.pr.new/@prisma-next/extension-postgis@609

@prisma-next/postgres

npm i https://pkg.pr.new/@prisma-next/postgres@609

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/@prisma-next/sql-orm-client@609

@prisma-next/sqlite

npm i https://pkg.pr.new/@prisma-next/sqlite@609

@prisma-next/target-mongo

npm i https://pkg.pr.new/@prisma-next/target-mongo@609

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/@prisma-next/adapter-mongo@609

@prisma-next/driver-mongo

npm i https://pkg.pr.new/@prisma-next/driver-mongo@609

@prisma-next/contract

npm i https://pkg.pr.new/@prisma-next/contract@609

@prisma-next/utils

npm i https://pkg.pr.new/@prisma-next/utils@609

@prisma-next/config

npm i https://pkg.pr.new/@prisma-next/config@609

@prisma-next/errors

npm i https://pkg.pr.new/@prisma-next/errors@609

@prisma-next/framework-components

npm i https://pkg.pr.new/@prisma-next/framework-components@609

@prisma-next/operations

npm i https://pkg.pr.new/@prisma-next/operations@609

@prisma-next/ts-render

npm i https://pkg.pr.new/@prisma-next/ts-render@609

@prisma-next/contract-authoring

npm i https://pkg.pr.new/@prisma-next/contract-authoring@609

@prisma-next/ids

npm i https://pkg.pr.new/@prisma-next/ids@609

@prisma-next/psl-parser

npm i https://pkg.pr.new/@prisma-next/psl-parser@609

@prisma-next/psl-printer

npm i https://pkg.pr.new/@prisma-next/psl-printer@609

@prisma-next/cli

npm i https://pkg.pr.new/@prisma-next/cli@609

@prisma-next/cli-telemetry

npm i https://pkg.pr.new/@prisma-next/cli-telemetry@609

@prisma-next/emitter

npm i https://pkg.pr.new/@prisma-next/emitter@609

@prisma-next/migration-tools

npm i https://pkg.pr.new/@prisma-next/migration-tools@609

prisma-next

npm i https://pkg.pr.new/prisma-next@609

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/@prisma-next/vite-plugin-contract-emit@609

@prisma-next/mongo-codec

npm i https://pkg.pr.new/@prisma-next/mongo-codec@609

@prisma-next/mongo-contract

npm i https://pkg.pr.new/@prisma-next/mongo-contract@609

@prisma-next/mongo-value

npm i https://pkg.pr.new/@prisma-next/mongo-value@609

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/@prisma-next/mongo-contract-psl@609

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/@prisma-next/mongo-contract-ts@609

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/@prisma-next/mongo-emitter@609

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/@prisma-next/mongo-schema-ir@609

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/@prisma-next/mongo-query-ast@609

@prisma-next/mongo-orm

npm i https://pkg.pr.new/@prisma-next/mongo-orm@609

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/@prisma-next/mongo-query-builder@609

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/@prisma-next/mongo-lowering@609

@prisma-next/mongo-wire

npm i https://pkg.pr.new/@prisma-next/mongo-wire@609

@prisma-next/sql-contract

npm i https://pkg.pr.new/@prisma-next/sql-contract@609

@prisma-next/sql-errors

npm i https://pkg.pr.new/@prisma-next/sql-errors@609

@prisma-next/sql-operations

npm i https://pkg.pr.new/@prisma-next/sql-operations@609

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/@prisma-next/sql-schema-ir@609

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/@prisma-next/sql-contract-psl@609

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/@prisma-next/sql-contract-ts@609

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/@prisma-next/sql-contract-emitter@609

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/@prisma-next/sql-lane-query-builder@609

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/@prisma-next/sql-relational-core@609

@prisma-next/sql-builder

npm i https://pkg.pr.new/@prisma-next/sql-builder@609

@prisma-next/target-postgres

npm i https://pkg.pr.new/@prisma-next/target-postgres@609

@prisma-next/target-sqlite

npm i https://pkg.pr.new/@prisma-next/target-sqlite@609

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/@prisma-next/adapter-postgres@609

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/@prisma-next/adapter-sqlite@609

@prisma-next/driver-postgres

npm i https://pkg.pr.new/@prisma-next/driver-postgres@609

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/@prisma-next/driver-sqlite@609

commit: 251ea50

@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: a26e2f97-0801-440f-bcde-a2d2db90d3d9

📥 Commits

Reviewing files that changed from the base of the PR and between 19be43a and 251ea50.

📒 Files selected for processing (2)
  • AGENTS.md
  • scripts/sync-agent-rules.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/sync-agent-rules.mjs

📝 Walkthrough

Walkthrough

Centralizes agent rules in .agents/rules/, adds a sync script (with tests and --check mode) to maintain relative symlinks into .cursor/rules and .claude/rules, updates repo wiring/CI to validate symlinks, adjusts footprint thresholds, and adds rule metadata plus a curated rules index.

Changes

Agent rules canonical home and sync workflow

Layer / File(s) Summary
Rules sync script implementation
scripts/sync-agent-rules.mjs
Implements syncAgentRules() with constants/helpers to detect rule files, consolidate stray real files into .agents/rules/, create/repair relative symlinks in .cursor/rules and .claude/rules, detect conflicts, prune dangling/orphan symlinks, and support --check drift reporting.
Rules sync test suite
scripts/sync-agent-rules.test.mjs
Tests sync-mode behaviors (symlink creation, consolidation, idempotency, dangling symlink removal, conflict handling, ignoring non-rule files) and check-mode drift reporting without filesystem mutation.
Agent rule index and rulecards
.agents/rules/README.md, .agents/rules/mongo-no-obsolete-commands.mdc, .agents/rules/mongodb-memory-server-setup.mdc, .agents/rules/no-linear-sub-issues.mdc
Adds a curated rules index with size and footprint guidance and thematic groupings; introduces a MongoDB rule discouraging obsolete find/findOne in favor of aggregate, and adds front-matter to existing MongoDB and Linear workflow rulecards.
Repository wiring, CI, and docs
.gitignore, package.json, .github/workflows/ci.yml, scripts/validate-rules.mjs, .cursor/rules-footprint.config.json, AGENTS.md
Tracks .agents/rules/ as canonical, ignores presentation mirrors, adds rules:sync and runs sync in prepare, adds CI step Validate rule symlinks, points rule validator at .agents/rules, increases footprint byte thresholds, and documents the canonical workflow in AGENTS.md.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Agent rules once scattered far and wide,
Now hop to one warm canonical side,
Symlinks stitch mirrors, tests keep them true,
CI nods yes — sync runs for me and you,
A tidy burrow for rules, neat and new.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: consolidating agent rules into a canonical tracked home (.agents/rules) with symlinked mirrors in .cursor and .claude directories, which aligns perfectly with the changeset's primary objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 tml-2705-ensure-agent-rules-are-consistently-symlinked

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@wmadden wmadden changed the title TML-2705: consolidate agent rules to a canonical home with a symlink lint gate TML-2705: consolidate agent rules into one tracked home, symlinked into .cursor/.claude May 29, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 38-39: Update the doc links that point to the gitignored mirror
paths so they reference the canonical repository location; locate occurrences of
".cursor/rules/" and ".claude/rules/" in AGENTS.md (e.g., the links referenced
near the top and the block later in the file) and replace them with
".agents/rules/<rule-name>..." so documentation always points to the canonical
`.agents/rules/` files, then run the docs/lint checks (e.g., `pnpm
lint:rules:symlinks`) to ensure consistency.

In `@scripts/sync-agent-rules.mjs`:
- Around line 56-59: The comment incorrectly references statSync; update the
comment near the try block that calls readFileSync(fullPath) to state that
readFileSync is being used to verify the symlink target exists and is readable
(i.e., it follows the symlink and will throw if the target is missing), so
change the misleading "statSync follows the link" text to explicitly mention
readFileSync and fullPath and why it's called here.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 80231aa3-f593-4600-9fc1-388a748b986c

📥 Commits

Reviewing files that changed from the base of the PR and between cbfe281 and 19be43a.

📒 Files selected for processing (85)
  • .agents/rules/README.md
  • .agents/rules/adr-examples-must-match-code.mdc
  • .agents/rules/adr-writing.mdc
  • .agents/rules/arktype-usage.mdc
  • .agents/rules/as-contract-cast-smell.mdc
  • .agents/rules/avoid-cleavage-in-prose.mdc
  • .agents/rules/capabilities-ownership.mdc
  • .agents/rules/cli-e2e-test-patterns.mdc
  • .agents/rules/cli-error-handling.mdc
  • .agents/rules/cli-package-exports.mdc
  • .agents/rules/cli-test-fixture-cleanup.mdc
  • .agents/rules/config-validation-and-normalization.mdc
  • .agents/rules/contract-default-values.mdc
  • .agents/rules/contract-space-package-layout.mdc
  • .agents/rules/control-plane-descriptors.mdc
  • .agents/rules/cursor-markdown-file-links.mdc
  • .agents/rules/declarative-config.mdc
  • .agents/rules/directory-layout.mdc
  • .agents/rules/doc-maintenance.mdc
  • .agents/rules/family-instance-domain-actions.mdc
  • .agents/rules/generic-parameters.mdc
  • .agents/rules/import-validation.mdc
  • .agents/rules/include-many-patterns.mdc
  • .agents/rules/interface-factory-pattern.mdc
  • .agents/rules/mermaid-compat.mdc
  • .agents/rules/modular-refactoring-patterns.mdc
  • .agents/rules/mongo-no-obsolete-commands.mdc
  • .agents/rules/mongodb-memory-server-setup.mdc
  • .agents/rules/moving-packages.mdc
  • .agents/rules/multi-plane-entrypoints.mdc
  • .agents/rules/multi-plane-packages.mdc
  • .agents/rules/namespace-diagnostic-wording.mdc
  • .agents/rules/no-backward-compatibility.md
  • .agents/rules/no-barrel-files.mdc
  • .agents/rules/no-direct-lockfile-edits.mdc
  • .agents/rules/no-inline-imports.mdc
  • .agents/rules/no-linear-sub-issues.mdc
  • .agents/rules/no-target-branches.mdc
  • .agents/rules/no-tautological-tests.mdc
  • .agents/rules/object-hasown.mdc
  • .agents/rules/omit-should-in-tests.mdc
  • .agents/rules/postgres-lateral-patterns.mdc
  • .agents/rules/prefer-assertions-over-defensive-checks.mdc
  • .agents/rules/prefer-object-matcher.mdc
  • .agents/rules/prefer-to-throw.mdc
  • .agents/rules/query-patterns.mdc
  • .agents/rules/read-agents-md.mdc
  • .agents/rules/resolving-cyclic-dependencies.mdc
  • .agents/rules/review-scope-overrides.mdc
  • .agents/rules/schema-driven-architecture.mdc
  • .agents/rules/shared-plane-packages.mdc
  • .agents/rules/sql-types-imports.mdc
  • .agents/rules/storage-type-hooks.mdc
  • .agents/rules/test-database-limitations.mdc
  • .agents/rules/test-file-organization.mdc
  • .agents/rules/test-import-patterns.mdc
  • .agents/rules/test-intent-readability.mdc
  • .agents/rules/test-mocking-patterns.mdc
  • .agents/rules/tsdown-config-package-source-only.mdc
  • .agents/rules/tsdown-dist-layout-in-tests.mdc
  • .agents/rules/type-extraction-from-contract.mdc
  • .agents/rules/type-predicates.mdc
  • .agents/rules/typed-contract-in-tests.mdc
  • .agents/rules/typescript-patterns.mdc
  • .agents/rules/use-ast-factories.mdc
  • .agents/rules/use-contract-ir-factories.mdc
  • .agents/rules/use-hash-constructors.mdc
  • .agents/rules/use-if-defined.mdc
  • .agents/rules/use-pathe-for-paths.mdc
  • .agents/rules/use-timeouts-helper-in-tests.mdc
  • .agents/rules/vitest-expect-typeof.mdc
  • .claude/rules/drive-project-workflow.mdc
  • .claude/rules/no-bare-casts.mdc
  • .claude/rules/optimize-for-human-time-on-prs.mdc
  • .cursor/rules-footprint.config.json
  • .cursor/rules/README.md
  • .cursor/rules/no-bare-casts.mdc
  • .cursor/rules/optimize-for-human-time-on-prs.mdc
  • .github/workflows/ci.yml
  • .gitignore
  • AGENTS.md
  • package.json
  • scripts/sync-agent-rules.mjs
  • scripts/sync-agent-rules.test.mjs
  • scripts/validate-rules.mjs
💤 Files with no reviewable changes (6)
  • .claude/rules/drive-project-workflow.mdc
  • .claude/rules/no-bare-casts.mdc
  • .cursor/rules/no-bare-casts.mdc
  • .claude/rules/optimize-for-human-time-on-prs.mdc
  • .cursor/rules/README.md
  • .cursor/rules/optimize-for-human-time-on-prs.mdc

Comment thread AGENTS.md Resolved
Comment thread scripts/sync-agent-rules.mjs Resolved
…; fix misleading comment

Addresses CodeRabbit review on PR #609:
- AGENTS.md linked to the gitignored .cursor/rules mirror; durable docs now
  point at the canonical .agents/rules paths.
- classify() comment said statSync but the code uses readFileSync.

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden merged commit 6f355d6 into main May 29, 2026
16 checks passed
@wmadden
wmadden deleted the tml-2705-ensure-agent-rules-are-consistently-symlinked branch May 29, 2026 06:52
wmadden added a commit that referenced this pull request May 29, 2026
## Why

Follow-up fix to the merged TML-2705 work (#609, commit `74cb2c1`).

That change consolidated agent rules into `.agents/rules/` and treated
**both** `.mdc` and `.md` as valid rule extensions. But the agent
harnesses (Cursor, Claude Code) only load `.mdc` files — a rule with a
`.md` extension is silently never picked up. So:

- `no-backward-compatibility.md` was a **dead rule**: tracked, symlinked
into both presentation trees, and never loaded by anything.
- The sync script and docs actively *blessed* the `.md` extension, so
the same mistake could recur on the next rule someone authored.

## What changed

- **Renamed** `.agents/rules/no-backward-compatibility.md` → `.mdc` so
the rule actually loads (its frontmatter was already valid).
- **`scripts/sync-agent-rules.mjs`**: rules are now `.mdc`-only.
`README.md` remains the single mirrored `.md` (it's the index, not a
rule). Any *other* `.md` in the canonical dir is rejected — a hard error
in sync mode (`pnpm rules:sync` / the `prepare` hook), and reported as
drift in `--check` mode (`pnpm lint:rules:symlinks`). The mistake now
fails CI instead of shipping a dead rule.
- **Docs**: `AGENTS.md` and the rules `README.md` no longer document
`.{md,mdc}`; they state plainly that rule files must be `.mdc`.
- **Tests**: updated/added cases covering the README-only `.md`
exemption and the dead-`.md`-rule rejection in both modes.

## Scope

Rules + the sync tool + its docs only. No product code touched. `pnpm
lint:rules`, `pnpm lint:rules:symlinks`, `pnpm lint:rules:footprint`,
and `pnpm test:scripts` (118 tests) all pass locally.

Signed-off-by: Will Madden <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant