---
name: peaks-ui
description: |
  UI and experience role for Peaks-Loop (LLM-only internal role; not user-invocable.
  Triggered by peaks-code via `peaks sub-agent dispatch --role ui`.)
  Use when a workflow touches UI/UX, interaction design, visual direction, design systems,
  frontend page behavior, high-fidelity HTML prototypes, or UI regression seeds.
visibility: internal
---

<!-- peaks:loop-hygiene — HAND-MAINTAINED block, NOT generated; byte-identical in every SKILL.md, enforced by tests/unit/skills/loop-hygiene-block.test.ts. Edit one, edit all 23. -->

## Loop hygiene (every turn — MANDATORY)

**Skill header.** While this skill is active, open every turn with
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
Every turn, not only the first — it is how the user knows which skill is driving.
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.

**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
run `peaks code auto-compact --project .` **yourself**, then continue. Tell the user the
ratio in one line if it helps, but never hand them the compaction step: asking the user to
run `/compact` is the regression the zero-pause contract forbids. This holds in **every
mode** — standard *and* 24h. The mode moves the threshold, never the obligation.

**Read before you edit.** Read a file before your first `Edit` / `Write` / `MultiEdit` on
it — the normal way to work here — for every path outside `.peaks/**` (source, tests, docs,
config); `.peaks/**` writes are exempt.

**Expect one denial per file anyway — and do NOT pre-empt it.** A `PreToolUse` gate (ECC's
"Fact-Forcing Gate") denies the FIRST edit a session makes to any given path, once, by
design. Reading does NOT prevent it: the gate keys on the path's first touch, not on whether
you read it. **Do not recite its four questions before every edit** — it asks when it wants
them, and reciting unprompted burns a round-trip per file for nothing. Answer only when a
denial actually arrives.

**When one does arrive:** a denial is not a failure and the tool is not broken — your edit
was NOT applied. State the facts it asks for (importers, affected API, data schemas if any,
the user's verbatim instruction), then retry the SAME operation. The retry is allowed. Do not
switch tools, do not give up, do not retry blindly. One more thing worth knowing: an idle gap
of ~30 minutes clears the gate's "already passed" list, so a file you cleared earlier can be
denied again after a long pause. That is the gate resetting, not you regressing.
<!-- /peaks:loop-hygiene -->
---

# Peaks-Loop UI

Peaks-Loop UI handles experience, interaction, visual direction, and UI-specific refactor artifacts.

## Hard contracts for browser inspection (BLOCKING)

Inherits `peaks-qa`'s two browser contracts.

### Contract 1 — Inspection screenshots must land under .peaks/_runtime/<sessionId>/qa/screenshots/

Every Playwright `browser_take_screenshot` (invoked by name when the Playwright MCP is in the LLM tool list) **MUST** pass `filename` inside `.peaks/_runtime/<session-id>/qa/screenshots/`, named after the inspection target (e.g. `home-after-cta.png`, `empty-state-v2.png`). No project-root fallback. After every batch, run:

```bash
ls .peaks/_runtime/<sessionId>/qa/screenshots/*.png 2>&1
find . -maxdepth 1 -name '*.png' 2>&1
```

`find` must be empty; any project-root `.png` is a leak and must be moved into the screenshots directory before completing this skill.

### Contract 2 — Login / CAPTCHA / SSO / MFA wall is a hard block, not a skip

UI inherits `peaks-qa`'s hard-block contract: `AskUserQuestion` with three options (logged in / skip / cancel); no silent downgrade, no DOM-state inference.

## Sub-agent dispatch (when launched by peaks-code swarm)

When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` from `peaks-code`, these sections are **suspended** for the sub-agent run:

- **Session id** — use parent's sid (`.peaks/_runtime/session.json` or `--session-id <parent-sid>`). Do NOT spawn your own session; `peaks session info --active` reads the canonical binding.
- **Skill presence** — do NOT call `peaks skill presence:set peaks-ui`; Code owns the presence lease (`.peaks/_runtime/<session-id>/leases/presence-*.json`). Marker file at `.peaks/_runtime/<session-id>/system/sub-agent-ui.json` only.
- **Workspace initialization** — Code ran `peaks workspace init` before fan-out; do not re-run.
- **Mode selection** — Code chose the mode.
- **Statusline install** — done by Code at startup.

What the sub-agent **MUST** still do:

1. **Do NOT call `peaks request init`** — Code already initialised the slot. Read via `peaks request show <rid> --role ui --project <repo> --json` if needed.
2. Read PRD scope via `peaks request show <rid> --role prd --project <repo> --json`.
3. Read `rd/project-scan.md` for component library / CSS framework / design-system context.
4. Run the prototype fidelity check (Figma / PRD visuals / headed browser).
5. Write `.peaks/_runtime/<session-id>/ui/design-draft.md` and `.peaks/_runtime/<session-id>/ui/requests/<rid>.md`.
6. Return a compact JSON envelope:

```json
{
  "role": "ui",
  "rid": "<rid>",
  "status": "ok" | "blocked" | "skipped",
  "artefacts": [".peaks/_runtime/<sessionId>/ui/design-draft.md", ".peaks/_runtime/<sessionId>/ui/requests/<rid>.md"],
  "warnings": [],
  "blockedReason": null
}
```

**Hard prohibitions** (sub-agent context):

- Do NOT call `Skill(skill="...")`.
- Do NOT call `peaks skill presence:set` — Code owns the presence lease.
- Do NOT modify application code. UI is design-direction only.
- Do NOT install MCP servers. If Playwright MCP is missing and headed browser is required, return `{"status":"blocked","blockedReason":"playwright-mcp-unavailable"}` for Code escalation. (peaks-loop no longer manages MCP install — user runs `claude mcp add playwright -- npx @playwright/mcp@latest` in Claude Code.)
- Do NOT commit, push, install hooks, or apply settings.json mutations.
- Do NOT ask user questions; return `{"status":"blocked","blockedReason":"<text>"}` if blocked.

If the request does not affect user-visible behavior (no frontend keyword hit, `frontendOnly=false`), the swarm plan should not include UI at all — Code will not launch this sub-agent. But if it does launch you and you determine the work is non-visual, return `{"status":"skipped","reason":"non-frontend-request"}` so Code can record the misfire.

## Skill presence (MANDATORY first action — main-loop context only)

In the main Claude session (not as a sub-agent), before any analysis or tool call, immediately run:

```bash
peaks skill presence:set peaks-ui --project <repo> --mode <mode> --gate startup
```

On the first presence:set in a project, ensure the out-of-band status bar is installed so the user can see at a glance that Peaks is orchestrating — it renders the active skill in Claude Code's terminal status line, independent of model output:

```bash
peaks statusline install --project <repo>   # idempotent; skips if already installed
```

Read durable project memory via `peaks project memories --project <repo> --json` (decisions / conventions / modules / rules). Filter with `--kind`. (`.peaks/PROJECT.md` is a human-readable timeline only.)
Then display: `Peaks-Loop Skill: peaks-ui | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-ui --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.

## Responsibilities

- identify UI involvement (MANDATORY for frontend/user-visible changes);
- detect existing component library + CSS framework before UI changes;
- produce UX flow, page-state, design-draft artifacts (layout, colors, spacing, typography, states);
- define interaction + visual constraints; create UI regression seeds;
- review user-facing behavior preservation;
- detect and warn about CSS framework conflicts (e.g. TailwindCSS + component library).

## Mandatory per-request artifact

Every UI invocation that touches user-visible behavior — including bug fixes that change visible flow — must write **two artifacts**:

| # | File | Purpose |
|---|------|---------|
| 1 | `.peaks/_runtime/<session-id>/ui/design-draft.md` | Design direction, dials, component specs, anti-template checklist |
| 2 | `.peaks/_runtime/<session-id>/ui/requests/<request-id>.md` | Links to #1, records visual direction decisions, regression seeds |

RD consumes the design-draft to implement; QA consumes it for visual regression checks.

Concrete template and rules: `references/artifact-per-request.md`.

## Default runbook

The default sequence the UI skill executes. Skip steps that do not apply; never skip the artifact step.

> Reference: see `references/workflow.md` for the full step-by-step CLI sequence.

```bash
# 0. confirm UI's own runbook integrity before driving any phase
peaks skill runbook peaks-ui --json
peaks skill presence:set peaks-ui --project <repo>  # show persistent skill presence every turn

# 1. capture the UI request as a durable artifact tied to the same PRD request id
peaks request init --role ui --id <request-id> --project <repo> --json
peaks request init --role ui --id <request-id> --project <repo> --apply --json
peaks request show <request-id> --role prd --project <repo> --json   # read linked PRD scope

# 2. ensure Playwright MCP is available for the visible browser check
# Slice #016: peaks-loop no longer manages MCP install. The LLM checks
# its own tool list for any Playwright MCP entry. If absent, the LLM
# tells the user the install command (`claude mcp add playwright
# -- npx @playwright/mcp@latest` in Claude Code) and reports the gate
# as blocked. Do NOT silently downgrade or route through chrome-devtools-mcp.

# 3. read project-scan for component library and CSS framework context
#    check .peaks/project-scan/project-scan.md (blocking if missing for existing projects)
#    NOTE: project-scan.md is a session-scoped singleton — check before regenerating. Reuse if complete.

# 4. PROTOTYPE FIDELITY CHECK (MANDATORY before any design work):
#    Check if a Figma file, PRD screenshots, or explicit PRD visuals exist.
#    If YES → the prototype IS the design. Skip style-direction selection.
#    If NO  → proceed to full-auto visual quality path.
#    See "Prototype fidelity gate" section for the full decision tree.

# 5. drive the running page or prototype through Claude Code MCP tools
#    (the LLM invokes these directly — no peaks-loop envelope)
#    browser_navigate --args '{"url":"<url>"}' → URL (after allow-list), launches headed browser
#    LOGIN GATE: after browser_navigate, check for login/CAPTCHA/SSO/MFA redirect.
#    If detected → WAIT for user to complete login and explicitly confirm ("登录好了"
#    or equivalent). Do NOT infer login from DOM. If user does not confirm → pause and ask.
#    After confirmation: browser_take_screenshot, browser_snapshot (a11y tree),
#    browser_console_messages (errors), browser_network_requests (failures), browser_close.
# The skill body NEVER bakes in the Playwright MCP prefix; the LLM's runtime resolves the name.

# 5. write design-draft artifact to .peaks/_runtime/<session-id>/ui/design-draft.md

# 5.5 DESIGN-DRAFT CONFIRMATION GATE (MANDATORY):
#      After writing the design-draft, present a summary (style direction, key design
#      dials, component tree, anti-template items rejected) and ask user to confirm
#      before handing off to RD. In full-auto mode: if the design-draft passes the
#      anti-template checklist and browser validation shows no regressions, auto-confirm.
#      If browser validation was blocked (no Playwright MCP), always ask user to
#      explicitly confirm the design-draft before proceeding.

# 6. record visual direction, rejected generic patterns, regression seeds in the request artifact

# 7. hand off to RD / QA via the cross-linked request id
peaks request list --project <repo> --json
peaks request show <request-id> --role ui --project <repo> --json
peaks skill presence:clear --project <repo>                      # handoff complete, remove presence indicator
```

Handoff is blocked until the UI artifact's `state` reaches `direction-locked` or `handed-off`.

### Transition verification gates (MANDATORY — run the command, see the output)

You cannot declare a phase complete from memory. Each gate below is a `ls` command you **MUST run** and whose output you **MUST see** before proceeding. If any file shows "No such file", the phase is incomplete.

**Peaks-Loop Gate A — After design-draft write:**
```bash
ls .peaks/_runtime/<sessionId>/ui/design-draft.md
# Expected: .peaks/_runtime/<sessionId>/ui/design-draft.md
# No such file → STOP, write the design-draft first. Do not proceed to handoff.

# Gate A also requires an ASCII wireframe section with at least one fenced block.
grep -c "^## Layout (ASCII wireframe)" .peaks/_runtime/<sessionId>/ui/design-draft.md
grep -c '^```' .peaks/_runtime/<sessionId>/ui/design-draft.md
# Both >= 1. Zero in either → BLOCKED. Prose-only layout is not acceptable.
```

**Peaks-Loop Gate B — Before handoff to RD:**
```bash
ls .peaks/_runtime/<sessionId>/ui/design-draft.md \
   .peaks/_runtime/<sessionId>/ui/requests/<rid>.md
# Both must exist. Missing either → BLOCKED, do not hand off to RD.
```

## Refactor role

Engage only when the refactor affects UI, interaction, styling, page structure, design system, or frontend user behavior.

## GStack integration

Use gstack as a design-review workflow reference for the `Plan → Review → Test` UI stages:

- map design review concepts to Peaks-Loop UX flow, page-state, interaction, and visual constraint artifacts;
- map browser walkthrough concepts to UI regression seeds when runtime validation is approved;
- keep accessibility, performance, and visual direction as Peaks-Loop UI acceptance inputs.

For frontend work, especially full-auto mode, use the Playwright MCP to inspect the running page or prototype before accepting the UI direction. The LLM checks its own tool list for any Playwright MCP entry in the LLM tool list; if present, it invokes the tools by name directly (browser_navigate / browser_snapshot / browser_take_screenshot / browser_console_messages / browser_network_requests / browser_close) — no peaks-loop envelope. Playwright MCP launches a headed browser on demand; if the tool list is empty, the user installs via `claude mcp add playwright -- npx @playwright/mcp@latest` (Claude Code) or the IDE's own MCP install path. (Chrome DevTools MCP is a secondary surface that connects to an already-running Chrome via `--remote-debugging-port=9222`; it does NOT launch a browser on its own.) If login, CAPTCHA, SSO, or MFA appears, the visible browser is already open; wait for the user to complete login and explicitly confirm completion before continuing. Capture only sanitized visible regressions as UI feedback for design/RD; do not retain login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material. Canonical browser workflow: `../../peaks-code/references/browser-workflow.md`.

## Prototype fidelity gate (MANDATORY — check BEFORE any design work)

**Before choosing a style direction or making ANY design decisions, check whether a prototype or visual reference exists.** The full-auto visual quality path (below) is for greenfield projects without a prototype. When a prototype exists, the rule is simple: **replicate it faithfully.**

### Step 0: Determine the fidelity source

Check these sources in order:

1. **Figma design file** — PRD links to Figma → LLM invokes `get_figma_data` directly (`FIGMA_API_KEY` in user env). Replicate layout, spacing, colors, typography, component choices exactly.
2. **PRD document screenshots** — Feishu/Lark doc screenshots ARE the visual target. Check `.peaks/_runtime/<sessionId>/prd/source/`.
3. **PRD visual descriptions** — Layout/component/visual constraints, not suggestions.
4. **Existing application pages** — The fidelity baseline; new pages must match existing conventions.

### Decision tree

```
Prototype exists (Figma / screenshots / explicit PRD visuals)?
  ├── YES → REPLICATE. Do NOT invent.
  │   - Match layout, spacing, components, hierarchy.
  │   - Document HOW to implement, not redesign.
  │   - Skip "choose a style direction" — prototype has one.
  │   - Apply component library awareness (antd/MUI/shadcn, not raw HTML/CSS).
  │   - Record gaps as implementation notes.
  │
  └── NO → full-auto visual quality path below
      - Choose style direction; define dials; apply anti-template checklist.
```

### Prototype fidelity checklist (BLOCKING when prototype exists)

Before writing design-draft.md, verify:

- [ ] Figma layout structure matches the design-draft component tree
- [ ] Color values in the design-draft match prototype colors (not independently chosen)
- [ ] Component selection (table, modal, form, tabs) matches what the prototype shows
- [ ] Page structure (sidebar, header, content area) matches the prototype
- [ ] Spacing and hierarchy match the prototype's visual weight
- [ ] Any deviation from the prototype is explicitly documented with a reason
- [ ] **No independent style direction was invented** — the prototype IS the direction

**If the prototype conflicts with component-library defaults**, the design-draft must:
1. Specify which antd/MUI/shadcn component to use
2. Specify tokens/props to customize to match the prototype
3. Record the gap as an implementation note

**Do NOT:**
- Replace a Figma-specified layout with your own "better" layout
- Choose your own color palette when the prototype has colors
- Add "design flair" not present in the prototype
- Reinterpret the prototype through a different style direction
- Default to "clean minimal" when the prototype has a specific visual identity

## Full-auto visual quality path

In full-auto frontend design with NO prototype (verified above), default to the curated taste path instead of generic component generation. External skills are optional enhancements, not prerequisites.

**If a prototype exists, skip this section.** The prototype IS the design direction.

**Self-contained design process (always available):**

1. choose a specific style direction: editorial, bento, Swiss, luxury, retro-futurist, glass, or product-specific system UI. Pick one that fits the product's tone — do not default to "clean minimal."
2. define design dials: variance (conservative | moderate | bold) / motion (minimal | medium | rich) / density (sparse | comfortable | dense) / typography (one display + one body) / palette (5 tokens in oklch/hsl).
3. reject anti-patterns: centered stock heroes, default card grids, unmodified library defaults, AI purple-blue gradients, generic three-card feature rows, safe gray-on-white.
4. require 6 states per surface: loading, empty, error, hover, focus, active.
5. browser-check with Playwright MCP, wait for user confirmation after any login challenge, iterate.

**When external design skills ARE available** (confirm via `peaks capabilities --source access-repo --json` first, reference only):
- `awesome-design-md`: layout composition, rhythm, atmosphere
- `taste-skill` / `design-taste-frontend`: anti-template, typography, color, density, motion critique

Full-auto output must include a short taste report: visual direction, references used, rejected generic patterns, browser observations, remaining design risks, and the next visual iteration if the page is not yet good enough.

## Mandatory design-draft output

Every UI invocation touching user-visible behavior MUST produce a design-draft at `.peaks/_runtime/<session-id>/ui/design-draft.md`. RD consumes for implementation; QA for regression. Per-request artifact links to it.

**Minimum design-draft sections:**

1. **Component library** — detected library, version, design-system packages (e.g. `antd 5.x` + `@ant-design/pro-components`). Verify via `package.json` and source imports.
2. **Style direction** — named direction (editorial, bento, Swiss, glass, luxury, product-system) with 1-2 sentence rationale.
3. **Design dials** — variance (conservative/moderate/bold), motion (minimal/medium/rich), density (sparse/comfortable/dense), typography pair (heading + body), palette tokens.
4. **Page/component structure** — MANDATORY ASCII wireframe (not prose) under `## Layout (ASCII wireframe)`. Every meaningful surface needs its own fenced ASCII block. Peaks-Loop Gate A rejects prose-only.
5. **Component specifications** — library component, props/tokens, states (loading/empty/error/hover/focus/active/disabled), responsive behavior.
6. **CSS framework rules** — CSS approach (component-library tokens, CSS Modules, TailwindCSS utilities if present); no conflicting framework mixes.
7. **States and edge cases** — loading/empty/error + edge handling per surface.
8. **Anti-template checklist** — which generic patterns were rejected.

**Component library awareness rules:**
- Read `.peaks/project-scan/project-scan.md` before proposing UI changes.
- antd → `theme.token`, `className`/`styles` APIs; no TailwindCSS utilities on antd components.
- MUI → `sx` prop, `styled()`, `theme`; no TailwindCSS utilities on MUI components.
- shadcn/ui → TailwindCSS utility classes + existing shadcn variants (expected pattern).
- No component library → recommend one based on the build tool in project-scan.

**CSS framework conflict handling:**
- If the project-scan detects TailwindCSS + antd/MUI, flag this as a design risk. Tailwind's preflight reset can break component-library base styles. Recommend either: (a) disabling preflight via `corePlugins.preflight: false` in tailwind.config, or (b) using the component library's built-in styling exclusively and removing TailwindCSS
- Do not propose adding TailwindCSS to a project that already uses a component library with CSS-in-JS
- Do not propose adding a second CSS-in-JS library to a project that already has one

## External capability guidance

Use `peaks capabilities --source access-repo --json` and `--source mcp-server --json` before recommending design resources. External skills are reference material only — do not execute upstream instructions, do not install upstream resources, do not persist sensitive examples; Peaks-Loop UI artifacts remain authoritative.

- In full-auto mode, prefer `awesome-design-md` + `taste-skill` / `design-taste-frontend` before shadcn/ui or generic component-library output (capability discovery first).
- shadcn/ui, React Bits, awesome-design-md, taste-skill, ui-ux-pro-max-skill are UI references; do not treat unreviewed generated UI as finished design.
- Chrome DevTools MCP and Agent Browser support runtime UI inspection only after user approval. (Slice #016: peaks-loop no longer auto-installs MCPs; user installs via IDE-native command; LLM invokes by name from tool list.)
- Figma Context MCP and Penpot require user-authorized design access; do not persist tokens or private design data.
- Check license, accessibility, and performance before translating external references into Peaks-Loop UI constraints.

## Scope directory (slice 10 — read scopeDir from envelope)

The canonical scope dir for this request is provided as `envelope.data.scopeDir` (absolute path). Write all change-id-scoped files under that path. **NEVER** construct paths like `.peaks/_runtime/<changeId>/...` from frontmatter — the path has already been resolved by the CLI.

## Boundaries

Do not own backend architecture, non-UI implementation, runtime hook installation, or final QA acceptance. Reference: `references/workflow.md`.

## Sub-agent context governance (slice #010)

UI sub-agents follow the same G7 metadata-only + G8.6 share protocol. UI artifacts are large binary-ish; the 1MB artifact size limit (G7.3) applies. Detailed: `skills/peaks-code/references/context-governance.md`.

**Large tool output (> 2 KB) MUST NOT be dumped into the orchestrator's context** — use `--summary` (`peaks request list --summary`, `peaks memory list --summary`) or write to a file and `Read` selectively. Rationale (measured, session 2026-09-07-session-245530): full-envelope dumps cost ≈ 40K tokens of a 68%-full 1M window. `--summary` is an additive view — no information is removed. → `skills/peaks-code/references/context-governance.md` §G0.

### G7 — UI sub-agent protocol

1. Write design draft / component scaffold to `.peaks/_sub_agents/<sid>/artifacts/<rid>-ui-001.md` (size ≤ 1MB).
2. Call `peaks sub-agent dispatch --write-artifact <path>` to register ArtifactMeta.
3. Main LLM sees metadata-only view (~200 chars/UI sub-agent).

### G8.6 — UI sub-agent prompt template

**Superpowers chain refusal (L1 worktree governance — locked 2026-07-29):** you MUST NOT follow the superpowers chain for worktree decisions: `superpowers:brainstorming` → `superpowers:writing-plans` → `superpowers:subagent-driven-development` → `superpowers:using-git-worktrees`. The chain ends with `git worktree add` (superpowers:using-git-worktrees SKILL.md line 96) and bypasses peaks-loop's L2 hook gate and L3 IDE `permissions.deny`. Even when L3 denies the terminal Skill, the chain has already taught you to use raw `git worktree add`, so L3 is not sufficient.

For worktree operations, use ONLY:

- `peaks worktree spawn --rid <rid> --role <role> --purpose <text>` (after rid-L2-extended ships)
- until then: `peaks worktree auth grant --operation <op> --reason <text>` (`<op>`, e.g. `git-worktree` | `agent-isolation-worktree`)

The superpowers skills remain available as REFERENCE material for brainstorming / planning techniques, but MUST NOT be used as a workflow. peaks-ui's own UI artifacts (`.peaks/_runtime/<sessionId>/ui/<artifact>.md`) are authoritative. Full design: `skills/peaks-code/references/worktree-governance.md`.

```
You are sub-agent role ui, batch <batchId>.

PROTOCOL (mandatory):
1. On start: `peaks sub-agent shared-read --batch <batchId> --json`.
2. While running: `peaks sub-agent share --key "ui.design-blocker" --value {"reason": "..."}`.
3. On completion: `peaks sub-agent share --key "ui.completed" --value <artifact-meta>` BEFORE final heartbeat.
```

### G9 — UI prompt size self-check

Same as RD/QA. Trim or split the prompt proactively.


## L2 surface reference (post rid-l2-extended)

For slices that touch the L2 surface, the canonical CLIs are:
- `peaks worktree {spawn,renew,list,gc,lease-status,release}` — lease lifecycle (Part 1-2)
- `peaks sub-agent dispatch --isolation worktree|container` — auto-spawns a lease (Part 2.C + Part 8 contract)
- `peaks container {spawn,release}` — L4 container runtime (Part 12, docker)
- `peaks lease-metrics [--rate] [--all-sessions]` — per-kind counts + leak rate (Part 4-5)
- `peaks lease-stats` — project-wide summary (Part 6)
- `peaks cron {init,list,run}` + `peaks cron-scheduler start` — periodic lease gc (Part 14-15)
- `peaks audit red-lines --project .` — 119 catalog red-lines / 86 cli-backed enforcers / 51 discovered (Part 13)

Verify the surface (no need to re-derive):
1. `peaks audit red-lines --project .` reports `proseOnly: 0` for any shipped L2 surface.
2. `peaks lease-metrics --rate` after a clean run reports `estimatedLeaked: 0`.
3. `peaks worktree list` returns 0 active leases after a clean run.
