diff --git a/plugins/linkedin-thought-leadership/commands/batch.md b/plugins/linkedin-thought-leadership/commands/batch.md index c25b7c8..ff429e9 100644 --- a/plugins/linkedin-thought-leadership/commands/batch.md +++ b/plugins/linkedin-thought-leadership/commands/batch.md @@ -152,7 +152,7 @@ Ask if they want to: After approval: - Confirm all drafts are saved and queued -- Update state file with planned topics +- Update state file with planned topics (note: state updates for batch posts happen at publish time via `/linkedin:publish`, not at batch creation) - Show queue summary: ``` diff --git a/plugins/linkedin-thought-leadership/commands/carousel.md b/plugins/linkedin-thought-leadership/commands/carousel.md index 1ea19df..94ea359 100644 --- a/plugins/linkedin-thought-leadership/commands/carousel.md +++ b/plugins/linkedin-thought-leadership/commands/carousel.md @@ -192,6 +192,17 @@ Offer refinement options as text (no interactive prompt): ## Step 7: State Update -If the user confirms the carousel is ready: -- Note in state file: topic, format=carousel, slide count -- Suggest: "After publishing, run the 5x5x5 engagement method for maximum reach." +If the user confirms the carousel is ready, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'carousel' +})); +" +``` +Replace placeholders with actual post data. Suggest: "After publishing, run the 5x5x5 engagement method for maximum reach." diff --git a/plugins/linkedin-thought-leadership/commands/first-post.md b/plugins/linkedin-thought-leadership/commands/first-post.md index 0651ab6..c67015a 100644 --- a/plugins/linkedin-thought-leadership/commands/first-post.md +++ b/plugins/linkedin-thought-leadership/commands/first-post.md @@ -145,13 +145,20 @@ Then present: "Post copied to clipboard. Go to linkedin.com, click 'Start a post ## Step 7: State Update -After finalizing: -- Set `first_post_date` to today (YYYY-MM-DD) — this is the most important update -- Set `last_post_date` to today -- Set `last_post_topic` to the topic -- Set `posts_this_week` to 1 (or increment if week matches) -- Set `current_streak` to 1 -- Add entry to "## Recent Posts" +After finalizing, update state deterministically (this also sets `first_post_date` automatically): +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'post' +})); +" +``` +Replace placeholders with actual post data. `first_post_date` is set automatically when null. ## Step 8: Next Steps diff --git a/plugins/linkedin-thought-leadership/commands/pipeline.md b/plugins/linkedin-thought-leadership/commands/pipeline.md index 769f9a1..186c771 100644 --- a/plugins/linkedin-thought-leadership/commands/pipeline.md +++ b/plugins/linkedin-thought-leadership/commands/pipeline.md @@ -182,13 +182,20 @@ After 48 hours, run `/linkedin:analyze` to review: ## State Update -After pipeline completes, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today -- Set `last_post_topic` to the topic -- Increment `posts_this_week` -- Update streak -- Add to Recent Posts -- Set `next_planned_topic` if discussed +After pipeline completes, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'pipeline' +})); +" +``` +Replace placeholders with actual post data. Set `next_planned_topic` manually if discussed. ## Reference Files diff --git a/plugins/linkedin-thought-leadership/commands/post.md b/plugins/linkedin-thought-leadership/commands/post.md index 579e661..1dc05c1 100644 --- a/plugins/linkedin-thought-leadership/commands/post.md +++ b/plugins/linkedin-thought-leadership/commands/post.md @@ -173,14 +173,20 @@ Before they post, remind them: - Target: 15+ engagements in first hour **State Update:** -After the post is finalized, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today's date (YYYY-MM-DD) -- Set `last_post_topic` to the main topic -- Check if ISO week changed — if so, reset `posts_this_week` to 0, update `current_week` -- Increment `posts_this_week` -- Update streak: increment if consecutive day, reset to 1 if gap > 2 days -- Update `longest_streak` if current exceeds it -- Add entry to "## Recent Posts": [YYYY-MM-DD] "Hook text..." (char count) - topic +After the post is finalized, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'post' +})); +" +``` +Replace placeholders with actual post data. This replaces manual YAML editing. ## Reference Files diff --git a/plugins/linkedin-thought-leadership/commands/publish.md b/plugins/linkedin-thought-leadership/commands/publish.md index dc872cf..d38158e 100644 --- a/plugins/linkedin-thought-leadership/commands/publish.md +++ b/plugins/linkedin-thought-leadership/commands/publish.md @@ -65,15 +65,20 @@ node --input-type=module -e "import { queueUpdateStatus } from '${CLAUDE_PLUGIN_ ## Step 5: Update State File -Update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today (YYYY-MM-DD) -- Set `last_post_topic` to the post's pillar/topic -- If `first_post_date` is null, set to today (set ONCE, never changed) -- Check if ISO week changed — if so, reset `posts_this_week` to 0 and update `current_week` -- Increment `posts_this_week` -- Update streak: increment `current_streak` if posting on consecutive days, reset to 1 if gap > 2 days -- Update `longest_streak` if current exceeds it -- Add entry to `## Recent Posts` section +Update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'FORMAT' +})); +" +``` +Replace placeholders with actual post data from the published post. ## Step 6: First-Hour Engagement Reminders diff --git a/plugins/linkedin-thought-leadership/commands/quick.md b/plugins/linkedin-thought-leadership/commands/quick.md index 40cb309..0febb26 100644 --- a/plugins/linkedin-thought-leadership/commands/quick.md +++ b/plugins/linkedin-thought-leadership/commands/quick.md @@ -150,12 +150,20 @@ Then confirm: "Copied to clipboard." Do NOT proactively offer alternative versions. Only generate alternatives if the user asks. **State Update:** -After the post is finalized, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today's date (YYYY-MM-DD) -- Set `last_post_topic` to the main topic -- Check if ISO week changed — if so, reset `posts_this_week` to 0, update `current_week` -- Increment `posts_this_week` -- Update streak and add entry to "## Recent Posts" +After the post is finalized, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'quick' +})); +" +``` +Replace placeholders with actual post data. This replaces manual YAML editing. ## Common Mistakes to Avoid diff --git a/plugins/linkedin-thought-leadership/commands/react.md b/plugins/linkedin-thought-leadership/commands/react.md index 6636cfe..a8dc7a3 100644 --- a/plugins/linkedin-thought-leadership/commands/react.md +++ b/plugins/linkedin-thought-leadership/commands/react.md @@ -148,14 +148,20 @@ Wait for the user to respond naturally. ## Step 8: State Update -After the post is finalized, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today's date (YYYY-MM-DD) -- Set `last_post_topic` to the main topic -- Check if ISO week changed — if so, reset `posts_this_week` to 0, update `current_week` -- Increment `posts_this_week` -- Update streak: increment if consecutive day, reset to 1 if gap > 2 days -- Update `longest_streak` if current exceeds it -- Add entry to "## Recent Posts": [YYYY-MM-DD] "Hook text..." (char count) - topic +After the post is finalized, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'react' +})); +" +``` +Replace placeholders with actual post data. This replaces manual YAML editing. --- @@ -245,7 +251,7 @@ Offer same refinement options as Step 7. ### Step 8b: State Update -Same as Step 8 — update state file with topic, increment counts, etc. +Same as Step 8 — run `state-updater.mjs` with actual post data. --- diff --git a/plugins/linkedin-thought-leadership/commands/video.md b/plugins/linkedin-thought-leadership/commands/video.md index 0acb1c8..c7cfba1 100644 --- a/plugins/linkedin-thought-leadership/commands/video.md +++ b/plugins/linkedin-thought-leadership/commands/video.md @@ -202,12 +202,20 @@ Before you record: ``` **State Update:** -After the script is finalized, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today's date -- Check if ISO week changed — if so, reset `posts_this_week` to 0, update `current_week` -- Increment `posts_this_week` -- Update streak: increment if consecutive day, reset to 1 if gap > 2 days -- Add to "Recent Posts": `[YYYY-MM-DD] "Hook text..." [VIDEO/type/length] - topic` +After the script is finalized, update state deterministically: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'Hook text here...', + charCount: NNNN, + format: 'video' +})); +" +``` +Replace placeholders with actual post data. This replaces manual YAML editing. ## Reference Files diff --git a/plugins/linkedin-thought-leadership/hooks/prompts/post-creation-automation.md b/plugins/linkedin-thought-leadership/hooks/prompts/post-creation-automation.md index d736c03..1039102 100644 --- a/plugins/linkedin-thought-leadership/hooks/prompts/post-creation-automation.md +++ b/plugins/linkedin-thought-leadership/hooks/prompts/post-creation-automation.md @@ -19,7 +19,7 @@ Based on the day of the week, suggest the next optimal posting window: Remind: 'Before posting, spend 15-20 minutes on 5x5x5 pre-engagement: find 5 people with overlapping audiences, comment thoughtfully on their recent posts.' **4. Content Logging** -Note: The post topic and hook should be logged to the state file when the session ends (handled by Stop hook). +Note: State tracking is handled deterministically by `state-updater.mjs` via the Stop hook. Do not manually edit the state file YAML frontmatter. **5. Voice Sample Suggestion** diff --git a/plugins/linkedin-thought-leadership/hooks/prompts/state-update-reminder.md b/plugins/linkedin-thought-leadership/hooks/prompts/state-update-reminder.md index 1f4e70e..f4cdb0d 100644 --- a/plugins/linkedin-thought-leadership/hooks/prompts/state-update-reminder.md +++ b/plugins/linkedin-thought-leadership/hooks/prompts/state-update-reminder.md @@ -1,23 +1,34 @@ Before ending this LinkedIn content session, do two things: **1. Update State File** -If a post was created or finalized in this session, update `~/.claude/linkedin-thought-leadership.local.md`: -- Set `last_post_date` to today (YYYY-MM-DD format) -- Set `last_post_topic` to the main topic (use the matching `expertise_areas` value when possible for consistent pillar tracking) -- If `first_post_date` is null and a post was created, set `first_post_date` to today (YYYY-MM-DD). This is set ONCE and never changed after that. -- Check if ISO week has changed — if so, reset `posts_this_week` to 0 and update `current_week` -- Increment `posts_this_week` -- Update streak: increment `current_streak` if posting on consecutive days (gap <= 1 day), reset to 1 if gap > 2 days -- Update `longest_streak` if current exceeds it -- Add entry to '## Recent Posts' section: [YYYY-MM-DD] "Hook text..." (char count) - topic_area (use expertise_area name for consistent pillar tracking) +If a post was created or finalized in this session, use the state-updater script: +```bash +node --input-type=module -e " +import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updatePostTracking(content, { + postDate: 'YYYY-MM-DD', + postTopic: 'topic_area', + hookText: 'First 60 chars of hook...', + charCount: NNNN, + format: 'post' +})); +" +``` +Replace the placeholder values with actual post data from this session. + +If the user mentioned or updated their follower count during this session: +```bash +node --input-type=module -e " +import { writeState, updateFollowerCount } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs'; +writeState(content => updateFollowerCount(content, { + count: NNNN, + month: 'YYYY-MM' +})); +" +``` + - Clear `next_planned_topic` if it was used, or set it to the next suggested topic - If analytics data was imported in this session, set `last_import_date` to today (YYYY-MM-DD) and `last_import_week` to current ISO week (YYYY-WXX) -- If the user mentioned or updated their follower count during this session: - - Update `follower_count` to the new value - - If the month changed since last monthly_growth entry, append: {month: "YYYY-MM", count: X, delta: X} - - Recalculate `growth_rate_needed`: (follower_target - follower_count) / months_remaining - - Recalculate `projected_10k_date` from average of last 3 monthly deltas - - Add entry to '## Milestone Log': [YYYY-MM] count (+delta) **2. Pre-Publish Reminders** (only if a post was created)