← Guides

Knowledge Scope

Select exactly which files and folders your AI assistant knows about.

What is the Knowledge Scope?

The Knowledge Scope is the set of files and folders you've selected in the dashboard's FolderTree panel. When you toggle a file or folder on, it gets included in your project's index. When you toggle it off, it's excluded. Only selected files are searchable and available as context for your AI tools.

Two halves of SourcePrep's RAG: The Code Graph (trace) provides structural context automatically — imports, call chains, symbol relationships. The Knowledge Scope lets you manually curate which files are in the search index. Together, they give your AI both structural understanding and the exact files you care about.

How it works

1
Select files in the FolderTree
Toggle individual files or entire folders. Selecting a folder includes all files inside it.
2
Selection syncs to the server
Your selection is persisted server-side in the project config. It survives browser refreshes, works across clients (dashboard, Tauri app), and is readable by MCP tools.
3
Build indexes only your selected files
When you rebuild, only files in your Knowledge Scope are chunked and embedded. Files outside the scope are completely excluded from search results and context assembly.
4
Combine with Path Weights for fine-grained control
Use the Knowledge Scope to decide what is indexed, and Path Weights to control how much each file matters in search ranking.

Using the dashboard

Open the Knowledge Sources panel in your dashboard. Each file and folder has a checkbox. Checked items are in scope; unchecked items are excluded.

Loading component preview…

Live preview: Per-agent file tree selection with AI auto-populate and role presets.

  • Select a folder — includes all files inside it (descendants are cleaned up automatically)
  • Deselect a folder — removes it and all descendants; if a parent was selected, it "explodes" into sibling selections
  • Clear all — removes all selections (next build will index everything matching your glob patterns)

After changing your selection, click Build to re-index with the new scope. Pro-tier users with auto-rebuild enabled get automatic debounced rebuilds.

API usage

Get current scope

curl http://localhost:8400/projects/my-project/included_paths
{ "success": true, "data": { "included_paths": ["src", "docs/README.md"] } }

Set scope (full replacement)

curl -X PUT http://localhost:8400/projects/my-project/included_paths \
-H "Content-Type: application/json" \
-d '{ "included_paths": ["src", "docs/README.md"] }'

Add files to scope

curl -X POST http://localhost:8400/projects/my-project/scope/add \
-H "Content-Type: application/json" \
-d '{ "paths": ["tests/test_auth.py"] }'

Remove files from scope

curl -X POST http://localhost:8400/projects/my-project/scope/remove \
-H "Content-Type: application/json" \
-d '{ "paths": ["vendor"] }'
Knowledge Scope vs. Include/Exclude Globs
Globs (in Project Settings) define the file types SourcePrep can see: **/*.py, **/*.md. Knowledge Scope then lets you pick specific files/folders from that set. Think of globs as the "universe" and scope as your "selection."
Knowledge Scope vs. Path Weights
Scope controls what is indexed (binary: in or out). Path Weights control how much indexed files matter in ranking (0.0–2.0 multiplier). Use both together: scope to curate, weights to prioritize.
Knowledge Scope + Code Graph
The Code Graph traces structural relationships (imports, calls) across your entire codebase. The Knowledge Scope controls the embedding index. When you use prep (the primary MCP tool), it combines both: atlas routing from the graph + semantic search from your selected files.

API reference

GET /projects/{id}/included_paths

Returns the current Knowledge Scope (list of selected file/folder paths).

PUT /projects/{id}/included_paths

Replace the entire scope. Body: { "included_paths": ["src", "docs"] }. Paths are deduplicated and sorted.

POST /projects/{id}/scope/add

Add paths to the scope. Body: { "paths": ["src/core"] }. Adding a parent auto-removes explicit children.

POST /projects/{id}/scope/remove

Remove paths from the scope. Body: { "paths": ["vendor"] }. Removing a path also removes descendants.

GET /projects/{id}/scope/status

Returns pipeline status (state, pending changes, debounce info) plus the full included_paths list.