SkilVaultSign inStart free

Catalogue / cross-project-search-index

cross-project-search-index

Older skill: source not recordedSignedBundles several project directories into a single GrepAI workspace so one shared semantic index serves the whole group. Covers creating the workspace, registering each project, building and refreshing the combined index, querying everything or a single member, tracing a symbol across projects, readi…
---
name: cross-project-search-index
description: >
  Bundles several project directories into a single GrepAI workspace so one
  shared semantic index serves the whole group. Covers creating the workspace,
  registering each project, building and refreshing the combined index,
  querying everything or a single member, tracing a symbol across projects,
  reading status, adjusting membership, and wiring the workspace into an MCP
  client. Use when the user explicitly asks to set up, manage, index, search,
  inspect, modify, or remove a GrepAI workspace spanning multiple project
  directories, or to connect such a workspace to an MCP client. Not for
  searching inside one repository, for installing or upgrading GrepAI, for
  literal grep-style text lookups, or for conversations that merely mention
  monorepos or microservices without requesting workspace work.
---

Cross-Project Search Through One GrepAI Index

What you are building

A workspace is a named bundle of project directories that GrepAI indexes into one combined index. A single query then returns ranked matches from every member, each tagged with the project it came from, and group-wide settings such as the embedder and ignore patterns are declared once instead of per repository. All workspace state lives under ~/.grepai/workspaces/<name>/; nothing inside the member projects is written, moved, or rearranged by any command in this skill.

The running example is a group of three related repositories — a card-payment gateway, an anti-fraud service, and a shared contracts library — gathered into a workspace called payments-hub.

Workflow

1. Create the workspace and register the projects

Pick a name you will recognize later, because you retype it in every command that follows.

grepai workspace create payments-hub
grepai workspace add payments-hub /src/pay-gateway
grepai workspace add payments-hub /src/fraud-svc
grepai workspace add payments-hub /src/contracts-lib

Register projects one per command and read the member list echoed after each one, so a mistyped path is caught on the spot. When the last add succeeds, verify the full picture with grepai workspace show payments-hub, which lists each member's path, file count, and last-indexed time. grepai workspace list gives the coarser overview of all workspaces with member counts and index freshness.

2. Index the group, then let the watcher keep it current

grepai watch --workspace payments-hub

The first pass indexes every member into the shared index. For the example group expect output along these lines: pay-gateway 402 files and 1,760 chunks; fraud-svc 271 files and 1,120 chunks; contracts-lib 88 files and 510 chunks — 761 files and 3,390 chunks overall. The process then keeps running and absorbs ordinary file edits by itself. Append --background when you want the terminal back.

Before starting a watcher, run grepai workspace status payments-hub and check the daemon line. If a watcher is already alive for that workspace, do not start a second one; it would repeat the indexing work for no gain. Reserve a deliberate re-index for upheavals the watcher cannot digest gracefully — a branch switch touching hundreds of files, or the admission of a brand-new member.

3. Query the whole group, or zoom into one member

When the question cuts across repositories, address the workspace as a whole:

grepai search --workspace payments-hub "chargeback reason code mapping"

Every hit carries a bracketed project tag, so you can tell at a glance whether you are looking at the implementation in fraud-svc or a passing reference in pay-gateway.

When you already know the answer lives in one member, add --project to drop cross-project noise and get results back faster:

grepai search --workspace payments-hub --project pay-gateway "3-D Secure redirect flow"

To follow one shared symbol across the group, trace its callers:

grepai trace callers --workspace payments-hub "AuthorizeCapture"

4. Read status before debugging anything

grepai workspace status payments-hub reports total files, chunks, index size (41 MB for the example), a per-member table of files, chunks, and last-update time, plus the daemon state. Make it your first stop whenever results look stale or thin: a member row with an old or missing timestamp usually means that member joined after the most recent indexing pass and needs the watcher restarted or a deliberate re-index.

5. Adjust membership only with the user's sign-off

Membership commands rewrite the workspace configuration, so treat every membership change as something the user must approve in the conversation before you act.

  • A repository has moved: say that you intend to unregister the old path and register the new one, naming both the workspace and each path, and wait for an explicit yes. Only then run the pair:
  grepai workspace remove payments-hub /src/old-fraud-path
  grepai workspace add payments-hub /src/fraud-svc
  • Hits from an unrelated member are cluttering the answers: re-run the search with --project instead of touching membership at all.
  • A command replies that the workspace is unknown: print grepai workspace list and match the name against that listing character by character before retrying.

6. Delete a workspace only on confirmed instruction

Deleting throws away the workspace's settings and its combined index for good; the member codebases stay exactly as they are. State both halves of that to the user, then ask them to confirm the exact workspace name. Do not run the delete subcommand until they have confirmed that name back to you; once they have, run:

grepai workspace delete payments-hub

7. Serve the workspace to an MCP client

To hand the workspace to an MCP client, insert a server entry into the client's servers configuration:

{
  "mcpServers": {
    "grepai": {
      "command": "grepai",
      "args": ["mcp-serve", "--workspace", "payments-hub"]
    }
  }
}

That configuration file usually belongs to other tools as well, so show the user the exact block you intend to insert and get their approval before writing to it.

What the workspace folder holds

| File | Contents | |---|---| | workspace.yaml | Workspace name, member projects, optional setting overrides | | index.gob | The combined search index | | symbols.gob | The combined symbol table |

Example workspace.yaml for the running setup:

name: payments-hub
created: 2025-06-02T11:40:00Z

projects:
  - name: pay-gateway
    path: /src/pay-gateway
  - name: fraud-svc
    path: /src/fraud-svc
  - name: contracts-lib
    path: /src/contracts-lib

# Optional overrides, applied to every member project
embedder:
  provider: ollama
  model: nomic-embed-text

ignore:
  - node_modules
  - target
  - .venv

Pinning one embedder per workspace keeps chunks from different projects comparable. The file is plain text on disk, so keep tokens and passwords out of it.

Command summary

| Purpose | Command | |---|---| | Create a workspace | grepai workspace create payments-hub | | Register a project | grepai workspace add payments-hub /src/pay-gateway | | List workspaces | grepai workspace list | | Per-member detail | grepai workspace show payments-hub | | Index and watch | grepai watch --workspace payments-hub (append --background to detach) | | Search everything | grepai search --workspace payments-hub "query" | | Search one member | grepai search --workspace payments-hub --project pay-gateway "query" | | Trace a symbol | grepai trace callers --workspace payments-hub "SymbolName" | | Unregister a path | grepai workspace remove payments-hub /src/old-path — only after user confirmation | | Delete the workspace | grepai workspace delete payments-hub — only after user confirms the name |

Hard rules

  • Do not remove a member or delete a workspace without the user's explicit confirmation in the conversation, naming the exact workspace and, for removal, the exact path.
  • Do not start a second watcher for a workspace whose status already shows a live daemon.
  • Do not create, rename, or delete anything inside the member repositories while managing a workspace; these commands write only under the GrepAI workspace directory.
  • Do not edit the MCP client's configuration file without first showing the intended block and receiving approval.

Reporting to the user

Summarize a workspace as a compact table of member name, path, and file count, followed by index freshness and the single next command — index, search, or status — that matches what the user asked for.

Scope

This skill does not cover installing or upgrading GrepAI, single-repository search, or choosing embedding providers beyond the per-workspace override shown above.