#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

Tests

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).