Skip to content

Latest commit

 

History

History
81 lines (54 loc) · 1.75 KB

File metadata and controls

81 lines (54 loc) · 1.75 KB

Workspace and Rules Internals

Source of truth: crates/core/src/workspace/mod.rs.

Workspace Root Detection

find_project_root(start) walks upward and stops at first match:

  1. .quavil/ directory
  2. .claude/ directory
  3. .git marker
  4. fallback to start path

Config Source Classification

ConfigSource is assigned in this priority:

  1. Quavil when .quavil/ exists
  2. ClaudeCode when .claude/ exists
  3. Cursor when .cursorrules exists
  4. GitOnly when .git exists
  5. None

Rule File Priority

load_rules selects first non-empty primary file:

  1. AGENTS.md
  2. .quavil/rules.md
  3. .quavil/instructions.md
  4. CLAUDE.md
  5. .cursorrules

Then optional local preferences:

  • QUAVIL.local.md
  • .quavil/local.md

Then modular rules from .quavil/rules/*.md:

  • sorted by filename
  • unconditional rule bodies appended
  • conditional rules (paths: frontmatter) skipped in general load path

Conditional Rules

load_conditional_rules(root, file_path):

  • scans .quavil/rules/*.md
  • extracts paths: patterns from frontmatter
  • applies lightweight glob matching
  • returns bodies whose pattern matches target file path

Supported matching helpers:

  • simple_glob (* wildcard)
  • partial ** handling in glob_matches

Scaffold Behavior (qvl init)

scaffold_quavil_dir(root) creates:

  • .quavil/config.toml
  • .quavil/rules.md
  • .quavil/rules/ directory
  • .quavil/commands/ directory
  • .quavil/commands/review.md
  • QUAVIL.local.md

It also appends to .gitignore when needed:

  • QUAVIL.local.md
  • .quavil/local.md

Why This Matters

Rule and workspace resolution directly affects:

  • system prompt construction
  • agent behavior consistency across tools/editors
  • local-vs-committed preference separation