workspace command group manages semantic code search, allowing you to index directories and perform intelligent queries across your codebase.
Usage
Subcommands
sync
Synchronize a directory for semantic search by indexing its contents.Path to the directory to sync. Defaults to current directory.
Number of files to process concurrently.
list
List all indexed workspaces.Output in machine-readable format.Alias:
-pquery
Query the workspace using semantic search.Search query.
Path to the directory to search. Defaults to current directory.
Maximum number of results to return.Alias:
-lNumber of highest probability tokens to consider (1-1000).
Describe your intent or goal to filter results for relevance.Alias:
-rFilter results to files starting with this prefix.
Filter results to files ending with this suffix.
info
Show workspace information for an indexed directory.Path to the directory to get information for. Defaults to current directory.
delete
Delete one or more workspaces.Workspace IDs to delete. Multiple IDs can be specified.
status
Show sync status of all files in the workspace.Path to the directory to check status for. Defaults to current directory.
Output in machine-readable format.Alias:
-pinit
Initialize an empty workspace for the provided directory.Path to the directory to initialize as a workspace. Defaults to current directory.
Examples
Sync Current Directory
Sync with Custom Batch Size
List All Workspaces
Query Workspace
Query with Filters
View Workspace Status
Get Workspace Info
Delete Workspace
Initialize New Workspace
Use Cases
Finding Specific Code Patterns
Locating Test Files
Exploring New Codebase
Machine-Readable Output
Storage Location
Workspace indexes are stored in:Performance Tips
- Use
--batch-sizeto adjust indexing speed based on your system - Larger batch sizes (200-500) work well for SSDs
- Smaller batch sizes (50-100) may be better for HDDs
- Re-sync periodically to keep the index up to date
Related Commands
forge- AI assistant can use workspace search automaticallyforge list workspace- Alternative way to list workspaces
Notes
- Workspaces must be synced before querying
- The
synccommand respects.gitignorefiles - Semantic search uses AI embeddings for intelligent matching
- Query results are ranked by relevance
- Use
--use-caseto improve result relevance - File filters (
--starts-with,--ends-with) narrow results efficiently