← Guides

Path Weights

Boost or suppress specific files and folders in search results without rebuilding your index.

What are path weights?

Path weights are multipliers applied to search scores at query time. A weight of 1.5 boosts a folder's chunks by 50%. A weight of 0.0 effectively excludes it. The default weight is 1.0 (no change).

  • Applied at search time — no rebuild required
  • Hierarchical — a folder weight applies to all files inside it
  • Most-specific wins — a file weight overrides its parent folder weight
  • Range: 0.0 to 2.0

How it works

1
Set weights on folders or files
Via the dashboard FolderTree or the API.
2
SourcePrep resolves the most-specific weight
For src/auth/login.py, SourcePrep checks: src/auth/login.pysrc/auth/src/ → default (1.0).
3
Weight is applied as a multiplier to the similarity score
final_score = base_score × role_weight × path_weight

Using the dashboard

In the project's FolderTree panel, each file and folder shows a weight badge. Click the badge to edit the weight:

Screenshot: Path Weight Badges

Show the FolderTree panel with various colored badges (green boost, red suppress, blue manual) on files/folders.

  • Grey badge — inherited from parent (no override)
  • Blue badge — explicitly set weight
  • Green badge — boosted (> 1.0)
  • Red badge — suppressed (< 1.0)

Changes take effect immediately on the next search — no rebuild needed.

API usage

Set weights

curl -X PUT http://localhost:8400/projects/my-project/path_weights \
-H "Content-Type: application/json" \
-d '{
"path_weights": {
"src/core/": 1.5,
"src/tests/": 0.3,
"vendor/": 0.0,
"README.md": 1.8
}
}'

Get weights

curl http://localhost:8400/projects/my-project/path_weights

Common patterns

Focus on core business logic
"src/core/": 1.5, "src/utils/": 0.8, "tests/": 0.3
Exclude vendored / generated code
"vendor/": 0.0, "generated/": 0.0, "node_modules/": 0.0
Boost documentation for onboarding queries
"docs/": 1.8, "README.md": 2.0, "CONTRIBUTING.md": 1.5

API reference

PUT /projects/{id}/path_weights

Set path weights. Body: { "path_weights": { "path": weight } }. Weights are clamped to 0.0–2.0 and persisted to repo_policy.json.

GET /projects/{id}/path_weights

Returns the current path weights for the project.


Project Scope & Patterns

While path weights control ranking, the Project Settings panel controls what gets indexed in the first place. This is the coarse-grained filter before weights are applied.

Include Patterns

Glob patterns that define the allowed set of files. Think of this as an allowlist.

  • **/*.py - All Python files
  • src/**/* - Everything in src
  • docs/*.md - Root docs only
Presets: Click the "Presets" button to auto-populate standard patterns for stacks like Next.js, Python, or Rust.

Exclude Patterns

Glob patterns for files to strictly ignore, even if they match an include pattern.

  • **/node_modules/** - Dependencies
  • **/dist/** - Build artifacts
  • **/*.test.ts - Tests (optional)
SourcePrep also respects your .gitignore automatically.
Pro Tip: Use the Auto-Detect Stack button in the dashboard to scan your repository structure and automatically configure optimal Include/Exclude patterns for your language and framework.