← Back to Docs

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 Knowledge Scope panel 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 Knowledge Scope panel, each file and folder shows its current weight as a small ×N.N control on the right side of the row. Click any weight to edit it inline.

Loading component preview…

Path-weight controls. src/core is boosted (×1.5), src/utils and tests are suppressed (×0.7 and ×0.3), docs/README.md is boosted (×1.8). Child files show inherited weights in italic.

Visual cues on the ×N.N control:

  • ×1.5 — green tint means a boost (> 1.0).
  • ×0.5 — amber tint means a suppression (< 1.0).
  • ×1.0 — faded means default (no override on this path).
  • italic — the weight is inherited from a parent folder, not explicitly set on this row.

The colored dots/circles you may see elsewhere on the row are indexing status indicators (indexed, pending, ignored), not weight indicators — different concept.

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.