# #1794 PR-2 — Deferred worktree advisory delivery

## Why this PR exists

PR-1 (#1797) fixed the literal-named-directory bug from #1794 by switching `worktree-lifecycle-logger` to `outputSilentSuccess()` on command-type WorktreeCreate. That fix was correct — CC does not consume `additionalContext` on `WorktreeCreate` — but it had a side effect: the monorepo `sparsePaths` nudge was silenced. It now only reaches `ctx.log()` (dev-facing), not the model.

## Mechanism

Two-step bridge across the event boundary:

1. `writeWorktreeAdvisory(advisory, name, projectDir)` — called from the WorktreeCreate hook when monorepo + no sparsePaths. Writes `.claude/state/worktree-advisory-<slug>.md`.
2. `prompt/worktree-advisory-consumer` — UserPromptSubmit hook reads all `.claude/state/worktree-advisory-*.md` on the next prompt, concatenates, deletes the files, injects via `outputPromptContext()` (allow-listed for UserPromptSubmit).

## Properties

- One-shot. Files are deleted after read, so advisories never repeat.
- Best-effort. I/O errors do not throw — fall back to `ctx.log()` as in PR-1.
- Concurrency-safe. Two worktree creates in flight write to different files (slug-keyed); consumer reads in sorted order.
- Side-effect-free read. Consumer returns silent success when nothing pending (cheap: one readdirSync per prompt).

## Tests

- `worktree-advisory.test.ts` — 22 tests for writeWorktreeAdvisory + consumeWorktreeAdvisories + slugify (file system round-trip via mkdtempSync)
- `worktree-advisory-consumer.test.ts` — 8 tests for the hook (silent paths, single + multi advisory, project_dir fallback, no leak on non-advisory files, defensive on null input)
- Total: 30 tests, all passing

## Hook count

Total hooks: 195 → 196 (one new `prompt/` hook).

This page exists to satisfy the M119 playground gate.

Closes #1794 follow-up (PR-2). Refs #1797 (PR-1).