Skip to content

chore(claude-rules): add paths frontmatter for conditional loading#804

Merged
senamakel merged 1 commit intotinyhumansai:mainfrom
jwalin-shah:chore/conditional-rules-frontmatter
Apr 23, 2026
Merged

chore(claude-rules): add paths frontmatter for conditional loading#804
senamakel merged 1 commit intotinyhumansai:mainfrom
jwalin-shah:chore/conditional-rules-frontmatter

Conversation

@jwalin-shah
Copy link
Copy Markdown
Contributor

@jwalin-shah jwalin-shah commented Apr 22, 2026

Summary

Adds `paths:` YAML frontmatter to 13 of the 18 files in `.claude/rules/` so they load conditionally based on what files the AI assistant is editing, instead of every session loading all ~55k tokens of rules unconditionally.

Impact

  • Token savings: ~25-30k tokens per session when working outside the scoped areas (most sessions).
  • No content changes: only adds frontmatter; every rule file still auto-loads when you're editing files it applies to.
  • No effect on contributors without Claude Code: YAML frontmatter is inert in Markdown renderers.

Scope map

File Loads when editing
03 platform-setup-windows tauri src
04 platform-setup-macos tauri src
05 platform-setup-android `gen/android`
06 platform-setup-ios `gen/apple`
07 rust-backend-guide `*.rs` + Cargo
08 frontend-guide `app/src/**`
09 permissions-capabilities `capabilities/**`, `tauri.conf.json`
12 design-system tsx/css/tailwind
13 backend-auth auth files
14 deep-link deep-link + tauri conf
15 settings-modal `components/settings`
16 macos-background `lib.rs`, Info.plist
17 skills-memory-inference skills + memory + providers

Always-loaded (no frontmatter, unchanged): `00-project-vision`, `01-project-overview`, `02-development-commands`, `10-troubleshooting`, `11-tech-stack-detailed`.

Follow-up (not in this PR)

Several rule files reference stale architecture (e.g. MTProto references, pre-`app/` layout, crypto-platform framing from early 2026) that doesn't match the current repo. A content refresh is warranted but separate from this mechanical frontmatter change.

Test plan

  • Open a session editing only frontend files — confirm rust/android/ios/macos rules don't load
  • Open a session editing `app/src-tauri/src/lib.rs` — confirm rust + macos-bg + deep-link rules load
  • Confirm `00/01/02/10/11` always load

Summary by CodeRabbit

  • Chores
    • Updated internal documentation rule configurations with path scoping metadata to improve organizational accuracy and rule application targeting across the codebase.

@jwalin-shah jwalin-shah requested a review from a team April 22, 2026 19:08
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

This PR adds YAML front-matter metadata with paths filters to 13 rule guide files in the .claude/rules/ directory. These filters scope each rule to specific relevant source code and configuration directories, enabling context-aware rule application based on file paths being edited. No rule content or logic is modified.

Changes

Cohort / File(s) Summary
Platform Setup Rules
.claude/rules/03-platform-setup-windows.md, .claude/rules/04-platform-setup-macos.md, .claude/rules/05-platform-setup-android.md, .claude/rules/06-platform-setup-ios.md
Adds YAML frontmatter with paths filters scoping each platform-specific setup rule to relevant Tauri directories and generated platform artifacts.
Backend & Development Guides
.claude/rules/07-rust-backend-guide.md, .claude/rules/08-frontend-guide.md
Adds YAML frontmatter with paths filters targeting Rust/Tauri sources, Cargo.toml, and frontend application files respectively.
Feature & Capability Rules
.claude/rules/09-permissions-capabilities.md, .claude/rules/13-backend-auth-implementation.md, .claude/rules/14-deep-link-platform-guide.md, .claude/rules/15-settings-modal-system.md, .claude/rules/16-macos-background-execution.md
Adds YAML frontmatter with paths filters associating each feature rule with relevant source locations, configuration files, and platform-specific implementations.
System Architecture & Design Rules
.claude/rules/12-design-system.md, .claude/rules/17-skills-memory-inference-flow.md
Adds YAML frontmatter with paths filters scoping design system and memory/inference architecture rules to applicable TypeScript, styling, and backend source files.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Poem

🐰 Whiskers twitching with delight,
Rules now sorted left and right,
Paths that guide the AI's way,
Metadata makes magic play!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding paths-based YAML frontmatter to Claude rules for conditional loading. It directly matches the PR's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Scopes platform/domain rule files to only load when editing matching
paths. Keeps overview/commands/troubleshooting always-on. Saves ~25-30k
tokens per session when working outside the scoped areas.

Files scoped:
- 03/04 platform-setup (Windows/macOS) → tauri src
- 05/06 platform-setup (Android/iOS) → gen/{android,apple}
- 07 rust-backend-guide → rust + Cargo
- 08 frontend-guide → app/src
- 09 permissions-capabilities → capabilities + tauri.conf.json
- 12 design-system → tsx/css/tailwind
- 13 backend-auth-implementation → auth files
- 14 deep-link-platform-guide → deep-link + tauri.conf.json
- 15 settings-modal-system → components/settings
- 16 macos-background-execution → lib.rs + Info.plist
- 17 skills-memory-inference-flow → skills + memory + providers

Always-loaded (no frontmatter): 00 vision, 01 overview, 02 commands,
10 troubleshooting, 11 tech-stack.

Follow-up candidates (separate PR): several rule files reference stale
architecture (MTProto, pre-app/ layout, crypto-first framing). Content
refresh recommended but out of scope here.
@jwalin-shah jwalin-shah force-pushed the chore/conditional-rules-frontmatter branch from e5803bf to 9286d47 Compare April 23, 2026 03:08
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.claude/rules/14-deep-link-platform-guide.md (1)

3-3: Consider refining the overly broad glob pattern

The pattern **/*deep*link* will match any path containing both "deep" and "link" (in any order, anywhere in the path). This could inadvertently match unrelated files like:

  • deep-dive/linking-strategies.md
  • deeply/integrated/link.ts
  • link/to/deep/files.txt

Consider using a more specific pattern:

  • **/*deep-link* (hyphenated)
  • **/*deeplink* (one word)
  • Or list specific known files/directories if the scope is well-defined
📝 Suggested refinement
---
paths:
-  - "**/*deep*link*"
+  - "**/*deep-link*"
+  - "**/*deeplink*"
  - "**/tauri.conf.json"
  - "app/src-tauri/**"
---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/rules/14-deep-link-platform-guide.md at line 3, The glob pattern
"**/*deep*link*" is too broad and will match any path containing both "deep" and
"link" in any order; update the rule in .claude/rules to a more specific pattern
such as "**/*deep-link*" or "**/*deeplink*" (or enumerate explicit file paths)
by replacing the existing pattern string "**/*deep*link*" with the chosen
narrower pattern so unrelated files no longer match.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/rules/03-platform-setup-windows.md:
- Around line 1-5: Update the YAML frontmatter in
.claude/rules/03-platform-setup-windows.md by removing the legacy path entry
"src-tauri/**" so only "app/src-tauri/**" remains under paths; locate the
frontmatter block that currently lists both "- \"app/src-tauri/**\"" and "-
\"src-tauri/**\"" and delete the line containing "src-tauri/**", leaving the
frontmatter with a single paths entry.

---

Nitpick comments:
In @.claude/rules/14-deep-link-platform-guide.md:
- Line 3: The glob pattern "**/*deep*link*" is too broad and will match any path
containing both "deep" and "link" in any order; update the rule in .claude/rules
to a more specific pattern such as "**/*deep-link*" or "**/*deeplink*" (or
enumerate explicit file paths) by replacing the existing pattern string
"**/*deep*link*" with the chosen narrower pattern so unrelated files no longer
match.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5cfc4d4a-85d1-4728-a475-8dd1a40e3d1f

📥 Commits

Reviewing files that changed from the base of the PR and between 3dc0d0d and 9286d47.

📒 Files selected for processing (13)
  • .claude/rules/03-platform-setup-windows.md
  • .claude/rules/04-platform-setup-macos.md
  • .claude/rules/05-platform-setup-android.md
  • .claude/rules/06-platform-setup-ios.md
  • .claude/rules/07-rust-backend-guide.md
  • .claude/rules/08-frontend-guide.md
  • .claude/rules/09-permissions-capabilities.md
  • .claude/rules/12-design-system.md
  • .claude/rules/13-backend-auth-implementation.md
  • .claude/rules/14-deep-link-platform-guide.md
  • .claude/rules/15-settings-modal-system.md
  • .claude/rules/16-macos-background-execution.md
  • .claude/rules/17-skills-memory-inference-flow.md

Comment on lines +1 to +5
---
paths:
- "app/src-tauri/**"
- "src-tauri/**"
---
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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check which Tauri source directory exists in the repository

echo "=== Checking for Tauri source directories ==="
echo ""

echo "Checking app/src-tauri/:"
if [ -d "app/src-tauri" ]; then
  echo "✓ app/src-tauri/ exists"
  echo "Sample contents:"
  ls -la app/src-tauri/ | head -10
else
  echo "✗ app/src-tauri/ does not exist"
fi

echo ""
echo "Checking src-tauri/:"
if [ -d "src-tauri" ]; then
  echo "✓ src-tauri/ exists"
  echo "Sample contents:"
  ls -la src-tauri/ | head -10
else
  echo "✗ src-tauri/ does not exist"
fi

echo ""
echo "=== Searching for Cargo.toml in both locations ==="
fd -t f "Cargo.toml" app/src-tauri src-tauri 2>/dev/null || echo "No Cargo.toml found in either location"

Repository: tinyhumansai/openhuman

Length of output: 881


Remove legacy path pattern src-tauri/**

The src-tauri/ directory no longer exists in the repository. Keep only app/src-tauri/** in the paths frontmatter:

Current configuration
---
paths:
  - "app/src-tauri/**"
  - "src-tauri/**"
---

Change to:

---
paths:
  - "app/src-tauri/**"
---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/rules/03-platform-setup-windows.md around lines 1 - 5, Update the
YAML frontmatter in .claude/rules/03-platform-setup-windows.md by removing the
legacy path entry "src-tauri/**" so only "app/src-tauri/**" remains under paths;
locate the frontmatter block that currently lists both "- \"app/src-tauri/**\""
and "- \"src-tauri/**\"" and delete the line containing "src-tauri/**", leaving
the frontmatter with a single paths entry.

@senamakel senamakel merged commit 42d7147 into tinyhumansai:main Apr 23, 2026
7 checks passed
@jwalin-shah jwalin-shah deleted the chore/conditional-rules-frontmatter branch April 23, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants