home / skills / yoanbernabeu / grepai-skills / grepai-workspaces

grepai-workspaces skill

/skills/advanced/grepai-workspaces

This skill helps you manage multi-project codebases with unified search across workspaces, enabling monorepos, microservices, and cross-project queries.

npx playbooks add skill yoanbernabeu/grepai-skills --skill grepai-workspaces

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
8.3 KB
---
name: grepai-workspaces
description: Configure multi-project workspaces in GrepAI. Use this skill for monorepos and multiple related projects.
---

# GrepAI Workspaces

This skill covers using GrepAI workspaces to manage multiple related projects with a unified search index.

## When to Use This Skill

- Working with monorepos
- Searching across multiple related projects
- Managing microservices architecture
- Organizing large codebases

## What are Workspaces?

Workspaces allow you to:
- Group multiple projects together
- Search across all projects at once
- Or search specific projects within the workspace
- Share configuration across projects

## Creating a Workspace

```bash
grepai workspace create my-workspace
```

Output:
```
āœ… Workspace 'my-workspace' created
   Location: ~/.grepai/workspaces/my-workspace/

   Next: Add projects with 'grepai workspace add'
```

## Adding Projects

```bash
# Add first project
grepai workspace add my-workspace /path/to/frontend

# Add more projects
grepai workspace add my-workspace /path/to/backend
grepai workspace add my-workspace /path/to/shared-lib
```

Output:
```
āœ… Added '/path/to/frontend' to workspace 'my-workspace'

   Projects in workspace:
   1. frontend (/path/to/frontend)

   Run 'grepai watch --workspace my-workspace' to index all projects.
```

## Listing Workspaces

```bash
grepai workspace list
```

Output:
```
šŸ“ Workspaces

1. my-workspace
   - Projects: 3
   - Status: Not indexed

2. work-projects
   - Projects: 5
   - Status: Indexed (updated 2h ago)
```

## Viewing Workspace Details

```bash
grepai workspace show my-workspace
```

Output:
```
šŸ“ Workspace: my-workspace

Projects:
1. frontend
   Path: /path/to/frontend
   Files: 450
   Last indexed: 2025-01-28 10:30

2. backend
   Path: /path/to/backend
   Files: 320
   Last indexed: 2025-01-28 10:30

3. shared-lib
   Path: /path/to/shared-lib
   Files: 85
   Last indexed: 2025-01-28 10:30

Total: 855 files, 4,200 chunks
```

## Indexing a Workspace

```bash
# Index all projects in workspace
grepai watch --workspace my-workspace
```

Output:
```
šŸ” Indexing workspace 'my-workspace'

   [1/3] frontend...
         Found 450 files, 2,100 chunks
   [2/3] backend...
         Found 320 files, 1,500 chunks
   [3/3] shared-lib...
         Found 85 files, 600 chunks

   Total: 855 files, 4,200 chunks indexed
   Watching for changes...
```

### Background Indexing

```bash
grepai watch --workspace my-workspace --background
```

## Searching Workspaces

### Search All Projects

```bash
grepai search --workspace my-workspace "user authentication"
```

Results include project context:
```
Score: 0.89 | [backend] src/auth/middleware.go:15-45
──────────────────────────────────────────
func AuthMiddleware() ...

Score: 0.85 | [frontend] src/hooks/useAuth.ts:10-30
──────────────────────────────────────────
export function useAuth() ...

Score: 0.78 | [shared-lib] src/types/auth.ts:5-25
──────────────────────────────────────────
export interface AuthState ...
```

### Search Specific Project

```bash
grepai search --workspace my-workspace --project frontend "form validation"
```

Only searches the frontend project.

## Workspace Status

```bash
grepai workspace status my-workspace
```

Output:
```
šŸ“Š Workspace Status: my-workspace

Projects: 3
Total files: 855
Total chunks: 4,200
Index size: 45 MB

Per-project breakdown:
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ Project     │ Files │ Chunks │ Updated  │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ frontend    │ 450   │ 2,100  │ 2h ago   │
│ backend     │ 320   │ 1,500  │ 2h ago   │
│ shared-lib  │ 85    │ 600    │ 2h ago   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Daemon: Running (PID 12345)
```

## Removing Projects from Workspace

```bash
grepai workspace remove my-workspace /path/to/old-project
```

## Deleting a Workspace

```bash
grepai workspace delete my-workspace
```

This removes the workspace configuration but NOT the project files.

## Workspace Configuration

Workspaces store config in `~/.grepai/workspaces/<name>/`:

```
~/.grepai/workspaces/my-workspace/
ā”œā”€ā”€ workspace.yaml    # Workspace config
ā”œā”€ā”€ index.gob         # Combined index
└── symbols.gob       # Combined symbols
```

### workspace.yaml

```yaml
name: my-workspace
created: 2025-01-28T10:00:00Z

projects:
  - name: frontend
    path: /path/to/frontend
  - name: backend
    path: /path/to/backend
  - name: shared-lib
    path: /path/to/shared-lib

# Optional: override global config per workspace
embedder:
  provider: ollama
  model: nomic-embed-text

ignore:
  - node_modules
  - dist
```

## MCP with Workspaces

Use workspaces with MCP servers:

```json
{
  "mcpServers": {
    "grepai": {
      "command": "grepai",
      "args": ["mcp-serve", "--workspace", "my-workspace"]
    }
  }
}
```

## Use Cases

### Monorepo

```bash
# Full monorepo
grepai workspace create monorepo
grepai workspace add monorepo /path/to/monorepo/apps/web
grepai workspace add monorepo /path/to/monorepo/apps/mobile
grepai workspace add monorepo /path/to/monorepo/packages/ui
grepai workspace add monorepo /path/to/monorepo/packages/core
```

### Microservices

```bash
# Related microservices
grepai workspace create services
grepai workspace add services /path/to/user-service
grepai workspace add services /path/to/order-service
grepai workspace add services /path/to/payment-service
grepai workspace add services /path/to/notification-service
```

### Frontend + Backend

```bash
# Full stack
grepai workspace create fullstack
grepai workspace add fullstack /path/to/frontend
grepai workspace add fullstack /path/to/backend
grepai workspace add fullstack /path/to/shared-types
```

## Cross-Project Search Examples

### Find All API Endpoints

```bash
grepai search --workspace services "REST API endpoint handler"
```

### Find Shared Type Usage

```bash
grepai search --workspace fullstack "User interface definition"
```

### Find Cross-Project Dependencies

```bash
# What calls the shared auth library?
grepai trace callers --workspace fullstack "validateToken"
```

## Best Practices

1. **Name descriptively:** `ecommerce-stack` not `ws1`
2. **Group related projects:** Only projects that you'd search together
3. **One daemon per workspace:** Run `grepai watch --workspace`
4. **Use project filter:** When you know which project to search
5. **Update after major changes:** Re-index after adding/removing files

## Common Issues

āŒ **Problem:** Workspace not found
āœ… **Solution:** Check workspace exists: `grepai workspace list`

āŒ **Problem:** Project paths changed
āœ… **Solution:** Remove old path, add new path:
```bash
grepai workspace remove my-workspace /old/path
grepai workspace add my-workspace /new/path
```

āŒ **Problem:** Search returns mixed results
āœ… **Solution:** Use `--project` flag to filter:
```bash
grepai search --workspace ws --project backend "query"
```

## Output Format

Workspace overview:

```
šŸ“ Workspace: my-workspace

Configuration:
- Location: ~/.grepai/workspaces/my-workspace/
- Created: 2025-01-28

Projects (3):
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ Name        │ Path                      │ Files │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ frontend    │ /path/to/frontend        │ 450   │
│ backend     │ /path/to/backend         │ 320   │
│ shared-lib  │ /path/to/shared-lib      │ 85    │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Commands:
- Index: grepai watch --workspace my-workspace
- Search: grepai search --workspace my-workspace "query"
- Status: grepai workspace status my-workspace
```

Overview

This skill helps you configure and manage multi-project workspaces in GrepAI so related repositories can share a unified search index and configuration. It streamlines indexing, cross-project semantic search, and workspace-level status and configuration. Use it to organize monorepos, microservices, or any set of related projects you want to query together.

How this skill works

You create a named workspace and add project paths to it; GrepAI stores workspace config under ~/.grepai/workspaces/<name> and builds a combined index and symbols store. Run grepai watch --workspace <name> to index all projects (foreground or background), then search across the entire workspace or limit queries to a single project with --project. The workspace also exposes status, listing, removal, and deletion commands so you can manage the index and daemon per workspace.

When to use it

  • Managing a monorepo with many packages that should be searchable together
  • Exploring dependencies across microservices or separate services
  • Keeping frontend, backend, and shared libraries in one searchable context
  • Maintaining a combined semantic index for related projects
  • Running an MCP server or daemon scoped to a logical project group

Best practices

  • Name workspaces descriptively (e.g., ecommerce-stack) for clarity
  • Group only related projects you commonly search together to reduce noise
  • Run a single watcher per workspace (grepai watch --workspace) to keep indexes up to date
  • Re-index after major refactors, adds, or removals to keep search accurate
  • Use the --project filter when you want focused results from one codebase

Example use cases

  • Create a monorepo workspace and add web, mobile, and shared packages for unified search
  • Bundle related microservices into a services workspace to trace cross-service calls
  • Combine frontend, backend, and shared-types into a fullstack workspace for end-to-end queries
  • Run grepai watch --workspace my-workspace --background to keep a long-running indexer
  • Use grepai search --workspace services "REST API endpoint handler" to locate handlers across services

FAQ

How do I remove a moved project path from a workspace?

Run grepai workspace remove <workspace> /old/path then add the new path with grepai workspace add <workspace> /new/path.

Does deleting a workspace remove my project files?

No. Deleting a workspace removes its configuration and combined index but does not delete project source files.