Repository navigation
Closed
Labels
featNew featurepriority: mediumMedium priorityservice: platformPlatform serviceservice: ragRAG service
Description
Summary
Add an optional folder_path filter parameter to the RAG search API, allowing search results to be scoped to documents within a specific folder hierarchy. Currently, RAG search is scoped only by team_id — there is no way to restrict results to a particular folder.
Motivation
Users organize documents into folders (e.g., /templates, /data-room/project-alpha). When asking the AI to "find precedents in folder X" or "search only within the data room", the system should be able to restrict search results to that folder scope.
Proposed Changes
RAG Search API
Add optional folder_path parameter to POST /api/v1/search:
{
"query": "change of control clause",
"team_id": "team_123",
"folder_path": "/data-room/project-alpha",
"top_k": 10
}When folder_path is provided, only return results from documents whose path starts with the given prefix (hierarchical matching).
Database Changes
- Ensure
folder_pathis stored inprivate_knowledge.documentsduring ingestion - The folder path should be passed from the platform when uploading documents to RAG
- Add an index on
(team_id, folder_path)if needed for performance
Platform Side
- Update the RAG upload action to include folder path from document metadata
- Update
rag_search_tool.tsto accept an optionalfolderPathparameter - Update
query_rag_context.tsif folder-scoped auto-injection is desired
Acceptance Criteria
- RAG search API accepts optional
folder_pathparameter - Results correctly filtered to matching folder prefix
- Folder path stored during document ingestion
-
rag_searchagent tool supportsfolderPathparameter - Tests covering: folder filtering, nested folder matching, no folder (existing behavior unchanged)
Metadata
Metadata
Assignees
Labels
featNew featurepriority: mediumMedium priorityservice: platformPlatform serviceservice: ragRAG service
Activity
yannickmonney commentedon Apr 7, 2026
This requires changes to the RAG service Python API (
services/rag/). The folder_path parameter needs to be added to the search endpoint and the vector query needs to support metadata filtering by folder path.yannickmonney commentedon May 31, 2026
Triaged — valid feature, keeping open. Confirmed there's no
folder_pathfilter in the RAG search API today (onlyquery/team_id/top_k). This would add an optional folder-prefix filter so search can be scoped to a folder hierarchy — spanning the RAG Python API (vector metadata filtering) and the platform RAG tool. Assigned to me. Related metadata-filtering work: #1517.