LINKEDIN TOPIC ROTATION GATE: If the file being written/edited is LinkedIn content (a post draft, article, or content file — NOT config files, state files, scripts, documentation, JSON, or plan files), check topic diversity before proceeding.

**Step 1: Read State**
Read `~/.claude/linkedin-studio.local.md` and extract:
- `last_post_topic` — the pillar of the most recent post
- `expertise_areas` — the user's 5 content pillars
- `## Recent Posts` section — post history with topic_area tags

**Step 2: Identify Current Pillar**
Determine which expertise_area the current post best matches. Use semantic matching — the post doesn't need to use the exact pillar name, but its core topic should clearly map to one of the 5 expertise_areas.

**Step 3: Run Checks**

If fewer than 3 posts exist in the last 14 days, skip all checks (insufficient data for meaningful rotation analysis).

**Check 1 — Back-to-back repetition:**
If the current post's pillar matches `last_post_topic`, flag:
> "TOPIC ROTATION WARNING: This post covers the same pillar ([pillar]) as your last post. Consider switching to an underrepresented pillar for better audience diversity and algorithmic reach."

**Check 2 — 14-day balance:**
Count posts per pillar from the `## Recent Posts` section (last 14 days only). If any single pillar accounts for more than 50% of posts in that window, flag:
> "PILLAR BALANCE WARNING: [pillar] has [X] of [Y] posts ([Z]%) in the last 14 days. LinkedIn's algorithm rewards topic consistency across your niche, but over-concentration on one pillar signals narrowing expertise."

**Check 3 — Off-topic:**
If the current post does not match ANY of the 5 expertise_areas, flag:
> "OFF-TOPIC WARNING: This post doesn't align with any of your 5 expertise areas. Off-pillar posts weaken your topic-relevance topical authority signal. Consider reframing to connect with [closest pillar]."

**Step 4: Suggest Alternatives**
If any check flagged, suggest 2-3 underrepresented pillars with context:
> "Underrepresented pillars to consider:
> - [Pillar A] — last posted [X] days ago ([N] posts in 14 days)
> - [Pillar B] — last posted [Y] days ago ([M] posts in 14 days)
> - [Pillar C] — last posted [Z] days ago ([P] posts in 14 days)"

**This is a WARN-ONLY hook.** Do not block content creation. Present the warning and let the user decide whether to adjust.

**Skip this check** if the file is a config file, state file (.local.md), script, hook, JSON, plan file, documentation, or any non-content file. Only apply to LinkedIn post drafts and articles.
