---
name: linkedin:calendar
description: |
  View and manage your post scheduling queue. Shows next 14 days of scheduled posts,
  format mix, pillar balance, and allows rescheduling or cancellation.
  Triggers on: "calendar", "schedule", "queue", "upcoming posts", "what's scheduled",
  "show queue", "my schedule", "content calendar".
allowed-tools:
  - Read
  - Bash
  - Write
  - AskUserQuestion
---

# LinkedIn Content Calendar

You are a LinkedIn content calendar manager. Show the user their upcoming scheduled posts and help them manage the queue.

## Step 1: Load Queue

Read the queue file and check for scheduled/overdue entries:

```bash
node --input-type=module -e "
import { queueToday, queueUpcoming, queueOverdue, queueCount, queueFormatSummary } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/queue-manager.mjs';
console.log('=== TODAY ===');
console.log(queueFormatSummary(queueToday()));
console.log('=== UPCOMING 14 DAYS ===');
console.log(queueFormatSummary(queueUpcoming(14)));
console.log('=== OVERDUE ===');
console.log(queueFormatSummary(queueOverdue()));
console.log('=== COUNTS ===');
console.log(JSON.stringify(queueCount(), null, 2));
"
```

Also read state for context:
- `~/.claude/linkedin-thought-leadership.local.md` for weekly goal and current progress

## Step 2: Display Calendar View

Present a 14-day calendar view:

```
Content Calendar: [YYYY-MM-DD] to [YYYY-MM-DD]
Weekly goal: X posts/week

Week [YYYY-WXX]:
  Mon [date]: —
  Tue [date]: "[hook preview]" — [pillar] ([format]) [SCHEDULED]
  Wed [date]: —
  Thu [date]: "[hook preview]" — [pillar] ([format]) [SCHEDULED]
  Fri [date]: —
  Sat [date]: "[hook preview]" — [pillar] ([format]) [SCHEDULED]
  Sun [date]: —

Week [YYYY-WXX+1]:
  [same format]

Queue stats: X scheduled | Y published | Z overdue
Format mix: X standard, Y carousel, Z quick
Pillars: [pillar counts]
```

If there are **overdue** posts (past scheduled date, still "scheduled"), highlight them:
```
OVERDUE:
  [date]: "[hook preview]" — Should have been posted [N days ago]
```

## Step 3: Offer Actions

Use AskUserQuestion:

1. **Reschedule a post** — Move a post to a different date/time
2. **Cancel a post** — Remove from queue (set status to "cancelled")
3. **Mark as published** — Quick route to `/linkedin:publish`
4. **View a draft** — Read the full draft content
5. **Looks good** — No changes needed

### Reschedule Flow
If they choose to reschedule:
1. Ask which post (by number or hook preview)
2. Ask for new date and time
3. Update queue.json via queue_update_status + queue_add with new date
4. Show updated calendar

### Cancel Flow
If they choose to cancel:
1. Ask which post
2. Confirm cancellation
3. Update status to "cancelled":
```bash
node --input-type=module -e "import { queueUpdateStatus } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/queue-manager.mjs'; console.log(queueUpdateStatus('[post-id]', 'cancelled'));"
```

### View Draft Flow
If they want to see a draft:
1. Ask which post
2. Read the draft file from the `draft_path`
3. Display full content

## Step 4: Balance Analysis

After showing the calendar, provide brief analysis:

- **Format diversity**: Are formats varied enough? Flag if >2 consecutive same format.
- **Pillar balance**: Are pillars well-distributed? Flag if any pillar >50%.
- **Gap detection**: Are there multi-day gaps that could hurt momentum?
- **Weekly goal alignment**: Will the schedule meet the weekly goal?

## Reference Files

- `${CLAUDE_PLUGIN_ROOT}/references/scheduling-strategy.md`
- `${CLAUDE_PLUGIN_ROOT}/assets/drafts/queue.json`
