chore(linkedin): v2.0.0 — import trim, router gating, full doc pass (S20)

This commit is contained in:
Kjell Tore Guttormsen 2026-05-28 06:53:55 +02:00
commit 8de481399e
12 changed files with 146 additions and 108 deletions

View file

@ -206,71 +206,37 @@ Import 2-3 more weeks of data for meaningful trend analysis.
## Step 6: Analytics-to-Strategy Feedback Loop
After successful import, auto-run a brief analysis to give the user immediate value.
After successful import, the analysis fan-out (pillar performance, format
performance, day-of-week heatmap, actionable recommendations) is **delegated
to `/linkedin:report`** — both commands consume the same `trends` CLI from
`scripts/analytics/`, and keeping a second analysis pipeline here drifted
out of sync with `report.md`.
### Step 6a: Content Pillar Performance
### Step 6a: Run the report
Read the user's `expertise_areas` from the state file (`~/.claude/linkedin-thought-leadership.local.md`). Run the trends CLI for impressions and engagement rate:
```bash
ANALYTICS_ROOT="${CLAUDE_PLUGIN_ROOT}/assets/analytics" node --import tsx "${CLAUDE_PLUGIN_ROOT}/scripts/analytics/src/cli.ts" trends --period 4w --metric impressions
ANALYTICS_ROOT="${CLAUDE_PLUGIN_ROOT}/assets/analytics" node --import tsx "${CLAUDE_PLUGIN_ROOT}/scripts/analytics/src/cli.ts" trends --period 4w --metric engagement_rate
```
Cross-reference post topics with expertise_areas. Present a pillar performance table:
Invoke the report generator and surface its output inline:
```
### Content Pillar Performance (last 4 weeks)
| Pillar | Posts | Avg Impressions | Avg Engagement | Trend |
|-------------------|-------|-----------------|----------------|-------|
| Azure AI | 5 | 2,400 | 4.2% | Up |
| Copilot Studio | 3 | 1,800 | 3.1% | Flat |
| Power Platform | 4 | 1,200 | 5.8% | Up |
| Semantic Kernel | 2 | 3,100 | 2.9% | New |
| AI Strategy | 3 | 900 | 2.1% | Down |
Run /linkedin:report (period: 4w)
```
### Step 6b: Post Type Analysis
`/linkedin:report` will:
Categorize imported posts by format (text-only, list, story, question, carousel, poll) based on content patterns. Present format performance:
1. Read `expertise_areas` from `~/.claude/linkedin-thought-leadership.local.md`
2. Call `trends` for impressions and engagement_rate over the last 4 weeks:
```bash
ANALYTICS_ROOT="${CLAUDE_PLUGIN_ROOT}/assets/analytics" node --import tsx "${CLAUDE_PLUGIN_ROOT}/scripts/analytics/src/cli.ts" trends --period 4w --metric impressions
ANALYTICS_ROOT="${CLAUDE_PLUGIN_ROOT}/assets/analytics" node --import tsx "${CLAUDE_PLUGIN_ROOT}/scripts/analytics/src/cli.ts" trends --period 4w --metric engagement_rate
```
3. Produce the Content Pillar Performance, Format Performance, and
Day-of-Week Performance tables, plus exactly 3 actionable recommendations
4. Return its summary back to this import flow
```
### Format Performance
If `/linkedin:report` is unavailable (analytics dir empty, tsx missing),
fall back to a one-line status: "Import complete — run `/linkedin:report`
manually when analytics are ready."
| Format | Posts | Avg Impressions | Avg Engagement | Best Hook |
|------------|-------|-----------------|----------------|-----------|
| Lists | 4 | 2,800 | 5.1% | "5 things..." |
| Stories | 3 | 2,200 | 4.5% | "Last week..." |
| Questions | 2 | 1,600 | 6.2% | "What if..." |
| Text-only | 5 | 1,100 | 2.8% | — |
```
### Step 6c: Optimal Posting Time
Analyze publishing dates vs. performance. Present day-of-week performance:
```
### Day-of-Week Performance
| Day | Posts | Avg Impressions | Avg Engagement |
|-----------|-------|-----------------|----------------|
| Monday | 2 | 1,400 | 3.2% |
| Tuesday | 4 | 2,600 | 4.8% |
| Wednesday | 3 | 2,100 | 4.1% |
| Thursday | 3 | 2,300 | 3.9% |
| Friday | 2 | 1,000 | 2.5% |
```
### Step 6d: Actionable Recommendations
Based on the analysis above, generate exactly 3 concrete, data-driven recommendations. Examples:
- "Your list posts average 2.5x the impressions of text-only posts. Consider using list format for your next 2 posts."
- "Tuesday is your strongest day (2,600 avg impressions). Schedule your best content for Tuesdays."
- "Azure AI posts are trending up (+18% impressions). Double down on this pillar next week."
### Step 6e: Update State with Import Date
### Step 6b: Update State with Import Date
After successful import and analysis, update the state file: