---
name: discover
description: "Discovery command — show installed forge capabilities, current project state, in-flight work, and the most useful next action. Run this when you're new to a forge-enabled project, or any time you want a one-screen overview."
---

# /discover — Discovery

Give the user a single-screen orientation to forge in this project. Five sections, in order. Keep each section terse — drill-downs go to skills (`support-system-guide` for routing) or rules (`.claude/rules/common/forge-system.md` for system structure).

## Section 1 — Installed capabilities

Count what's installed under `.claude/` and report one line:

```bash
echo "Installed: $(ls .claude/skills 2>/dev/null | wc -l | tr -d ' ') skills · $(ls .claude/commands 2>/dev/null | wc -l | tr -d ' ') commands · $(ls .claude/agents 2>/dev/null | wc -l | tr -d ' ') agents · $(find .claude/rules -name '*.md' 2>/dev/null | wc -l | tr -d ' ') rules"
```

If `.claude/` doesn't exist: say "forge not installed in this project — run `npx @jamie-tam/forge init` from the project root."

## Section 2 — Project profile

Read the `## Project Profile` block from `CLAUDE.md` and present its yaml compactly. Detect two states:

- **Unfilled** — the block still contains `{detected ...}` placeholders → say "Profile not filled — run `/setup`."
- **Filled** — show the yaml as-is.

## Section 3 — Active work

Glob `.forge/work/*/*/manifest.yaml`. Exclude items whose top-level `status` is `completed` or `escalated`. For each remaining item, infer the current phase from the first phase or gate that is not complete/locked/skipped/not-applicable. Print a compact table:

```markdown
| Type | Name | Phase | Manifest |
|---|---|---|---|
| feature | add-payments | quality.test-execution | .forge/work/feature/add-payments/manifest.yaml |
```

If nothing's in flight: say "No work items in flight."

## Section 4 — Suggested next

Pick **one** suggestion based on the state observed in sections 2 and 3. Use this priority order (first match wins):

| State | Suggested next |
|---|---|
| `.claude/` missing | `npx @jamie-tam/forge init` |
| Profile has `{detected ...}` placeholders | `/setup` |
| One in-flight item | `/resume {type}/{name}` (cite the matching item) |
| Multiple in-flight items, all recent | `/status` (then user picks) |
| Stale in-flight items (manifest `mtime` older than 30 days) | Surface them: "Item X has been idle since {date} — `/resume` to continue, or delete `.forge/work/{type}/{name}/` to drop it." Branch staleness can be cross-checked optionally: per `skills/build-pr-workflow`, work items live on `feat/<name>`, `fix/<name>`, `refactor/<name>`, or `hotfix/<name>` branches; `git log -1 --since='30 days ago' <branch>` confirms recent activity, but manifest mtime is sufficient on its own. |
| Profile filled, no work items, `pocs/` exists | `/greenfield` (resume the prototype-driven flow) |
| Profile filled, no work items, no `pocs/` | `/feature <name>` or `/greenfield <name>` — ask the user which |

Present the suggestion as one line: **Suggested next:** `<command>` — `<brief rationale>`.

## Section 5 — Commands at a glance

Print this catalog verbatim. The user can scroll back to it without re-running anything.

```
Workflow commands
  /feature <name>     lightweight by default (build → tests → review → PR); extended phases (concept / wireframe / prototype / codify) opt-in at preflight
  /greenfield <name>  new project from zero (UI stacks: prototype-driven full SDLC; non-UI: concept + executable verification by default)
  /bugfix <name>      systematic debugging + fix
  /refactor <name>    restructure without new functionality
  /hotfix <name>      emergency production fix (expedited gates)

State commands
  /status             list in-flight work
  /resume <name>      continue an in-flight item

Knowledge commands
  /note <text>        append a research note / brainstorm to aiwiki/raw/{date}.md
  /dream [scope]      consolidate aiwiki — merge duplicates, promote raw → typed, prune stale
  /wrap [focus]       capture & finalize current session into aiwiki/sessions/{date}-{id}.md

System commands
  /setup              detect stack, fill project profile, scaffold .forge/ + aiwiki/
  /validate           check skill/rule consistency
  /forge-evolve       improve the forge harness itself
  /parallel <list>    parallel agents for a punch list of ad-hoc tasks
  /triage [desc]      escape hatch for prompts that don't fit a standard workflow
```

End with one drill-down line: **For routing a specific intent or unsure which command to use, invoke the `support-system-guide` skill. For system structure (skills, agents, .forge/ layout), see `.claude/rules/common/forge-system.md`.**

## When to use

- User invokes `/discover` explicitly
- User asks "what's in this project?", "show me forge", or "what can forge do here?"
- Periodic check-in — useful at the start of a session to see if anything is in flight before starting new work

## Do NOT

- Do NOT duplicate the long skill/group descriptions inline — drill-downs to `support-system-guide` keep this command compact.
- Do NOT modify anything. This is a read-only discovery command.

## I/O Contract

| Field | Value |
|---|---|
| **Requires** | `.claude/` (skills, commands, agents, rules); `CLAUDE.md` for profile read; `.forge/work/*/*/manifest.yaml` for active work (optional) |
| **Produces** | Console output only — no files written |
| **Updates manifest** | None |
| **Feeds into** | User's choice of next command |
