Rules with paths not auto-loaded when editing matching files

Resolved 💬 3 comments Opened May 22, 2026 by jintianxiayu Closed Jun 21, 2026

Bug Description

Rules defined in .claude/rules/*.md with paths frontmatter are not automatically loaded when Claude Code edits a matching file.

Expected Behavior

According to the documentation:

"A rule with paths: loads only when Claude reads a matching file"

Given a rule file like .claude/rules/typescript-style.md with:

---
paths: 
  - '**/*.ts'
---

When editing a .ts file (e.g., src/kmp.ts), the rule should be automatically loaded.

Actual Behavior

When editing src/kmp.ts, the rule is not loaded. Claude Code proceeds without reading the TypeScript style rules, resulting in code that doesn't follow the project's established conventions.

Steps to Reproduce

  1. Create a rule file .claude/rules/typescript-style.md with paths: ['**/*.ts']
  2. Edit a TypeScript file (e.g., create new file or modify existing)
  3. Observe that the rules are not applied

Environment

  • Platform: Windows
  • Claude Code version: (please include if known)

Evidence

The rule file exists at .claude/rules/typescript-style.md with correct frontmatter:

---
paths: 
  - '**/*.ts'
---

But when editing src/kmp.ts, the rules were not applied.

Workaround

Using hooks in settings.json can force rule checking, but shouldn't be necessary if auto-load works as documented.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗