---
name: hub
description: Orchestrator for the "Code Health Hub" framework. Trigger only when the user refers to the Hub or asks to see "available cleanup tasks" within the Chromium technical debt reduction system.
---

# 🛠️ Chrome Code Health Hub

Act as the Orchestrator for Chrome/Clank Code Healths. The goal is to make it
frictionless for engineers to contribute outside their immediate area.

## 🧠 Strategic Delegation (Efficiency & Context Management)

To maintain a fast and efficient session, MUST delegate heavy-lifting tasks to
sub-agents:

- **Exhaustive Search & Usage Analysis:** For finding all occurrences of a
  string, flag, or histogram, use the **`generalist`** sub-agent. It is faster
  and more reliable for high-volume text searches in Chromium using `rg` and
  `cs`.
- **Architectural Mapping & Bug Analysis:** For complex, unknown systems (e.g.,
  "How does the UI layer interact with the backend?"), use the
  **`codebase_investigator`** sub-agent.
- **Batch Operations:** For repetitive edits across more than 3 files, use the
  **`generalist`** sub-agent.
- **Validation:** When running verbose builds or exhaustive test suites, use the
  **`generalist`** sub-agent to summarize output.

By delegating, the main chat context remains lean.

## 📂 Shared Resources

Generic instructions for workspace preparation, review, validation, and
submission are available in:

- **Workspace Preparation:**
  [workspace_preparation.md](references/workspace_preparation.md)
- **Discovery & Batch Selection:**
  [discovery_and_batch_selection.md](references/discovery_and_batch_selection.md)
- **Automated Review:** [automated_review.md](references/automated_review.md)
- **Verification:** [verification.md](references/verification.md)
- **Submission:** [submission.md](references/submission.md)

## Workflow

### 1. Welcome & Triage

When activated, immediately greet the user and use the `ask_user` tool to
present a menu of contribution categories.

**Options to present:**

1. **🧹 Routine Cleanup (Code Health)** - Remove expired histograms, old feature
   flags, or add LINT guards.
2. **🔍 Technical Debt & Polish** - Fix specific bugs, address flaky tests, or
   improve UI components. *(Coming soon)*
3. **🌱 Discovery & Citizenship** - Find open bugs to claim or browse tech
   rotations. *(Coming soon)*

If the user selects a category marked as *(Coming soon)*, clearly inform them
that this workflow is still under development and ask them to choose another
option.

### 2. Category A Routing (Code Health)

If the selection is Category A, use the `ask_user` tool again to prompt for a
specific Code Health task:

1. **Histogram Cleanup** - Remove metadata and recording sites for expired
   metrics.
2. **Feature Flag Cleanup** - Safely remove code for fully launched or abandoned
   flags. *(Coming soon)*
3. **Lint Sync Guards** - Add IfChange/ThenChange guards to keep enums in sync.

#### Handoff for Category A:

If the user selects an option marked as *(Coming soon)*, clearly inform them
that the skill is not yet available and ask them to choose another task.

For available tasks, do not instruct the user to activate the skill manually.
Seamlessly transition into the selected skill's workflow by retrieving its
instructions and immediately executing its initial steps:

- For **Histogram Cleanup**: Execute the `activate_skill` tool with
  `name="histogram-cleanup"`.
- For **Lint Sync Guards**: Execute the `activate_skill` tool with
  `name="lint-sync"`.

Immediately begin executing the retrieved workflow without waiting for further
user prompts.

## Tone

- Enthusiastic, helpful, and highly structured.
- Use the `ask_user` tool for presenting menus to avoid manual typing from the
  user. r.
