---
name: explore
description: Codebase exploration anchored to project documentation
---

# Explore

Codebase exploration anchored to project documentation.

**Usage:** `/explore [area or question]`

## Process

### Step 0: OS-Vocab Classification

Before orienting, scan the user's query for Organization OS terminology. If any of the following appear, classify the query as **OS-relevant** and follow the OS context steps below; otherwise skip to Step 1.

**OS vocabulary triggers:**

- System layer: `system`, `systems`, `SystemModule`, `system key`, `system gate`, `system access`, `gate`, `gating`, `access`, `enable`, `disable`
- Shell / nav: `manifest`, `shell`, `sub-shell`, `sidebar`, `nav`, `navigation`, `route`
- Auth / guards: `guard`, `SystemGuard`, `AdminGuard`, `ProtectedRoute`, `admin`
- Org model: `organization`, `org model`, `organization model`, `domain`, `surface`
- Foundations: `foundation`, `foundations`, `@core/`, `adapter`
- Platform ops: `workflow`, `agent`, `deployment`, `resource`

**If OS-relevant:**

1. Read `.claude/rules/active-change-index.md` immediately. If the target area is flagged as under active refactor, surface the watch-area warning to the user before proceeding — include the "Load:" doc paths listed in that entry so investigation does not rely on stale scaffold prose.
2. Build the OS context bundle to pass into Step 3:
   - Always: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`, `.claude/rules/active-change-index.md`, `.claude/rules/agent-start-here.md`
   - Systems / Shell / Gating queries: add `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` + `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
   - Workflow / Operations queries: add `.claude/rules/operations.md` + glob `operations/src/**`
   - Organization-model queries: add `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` + `core/config/README.md`

**OS layer → query intent map** (guides which reference docs the investigator loads first):

| Query intent                             | Primary OS layers                | Key reference                                                                            |
| ---------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------- |
| "Why doesn't my system show up?"         | Systems + UI Shell Runtime       | `glossary.md` (SystemModule, SystemGuard), `feature-flags-and-gating.md`                 |
| "How do I add a nav item?"               | Systems + Toolkit                | `feature-flags-and-gating.md`, `contracts.md`                                            |
| "How does admin gating work?"            | Systems + UI Shell Runtime       | `glossary.md` (AdminGuard, requiresAdmin, ProtectedRoute), `feature-flags-and-gating.md` |
| "What runs when this workflow triggers?" | Platform Public API + Operations | `.claude/rules/operations.md`, `resources.md`                                            |
| "Why does the foundations adapter fail?" | Foundations                      | `glossary.md` (domain vs surface, settings asymmetry), `core/config/README.md`    |

### Step 1: Orient

1. Read `.claude/rules/agent-start-here.md` for project structure, task-class routing, and boundary resolution
2. Determine which domain the user's question falls into

### Step 2: Load Domain Context

Read the relevant doc(s) and source directories based on the area being explored. Use the Navigation table in `CLAUDE.md` for quick reference.

For OS-relevant queries, also inject the OS context bundle assembled in Step 0 into the investigator's starting context.

### Step 3: Investigate

For targeted questions:

- Use Grep to search for specific patterns, function names, or strings
- Use Glob to find files by pattern
- Read specific files for detailed understanding

For broad exploration:

- Dispatch a `general-purpose` subagent with the domain context and exploration question
- The subagent should read files, trace data flow, and return a structured report
- For OS-relevant queries, pass the preloaded OS context bundle so the subagent starts with terminology already resolved

### Step 4: Report

Present findings with:

- Direct answers to the question
- Relevant code locations (file:function format)
- Connections to other parts of the system
- Suggestions for related areas to explore (if relevant)
