---
name: social-media-content
description: "Use when the user wants to create, schedule, or automate social media posts (LinkedIn, Twitter/X, etc.). Covers research, drafting, tone guidance, cron scheduling, and email delivery of drafts."
---

# Social Media Content Automation

## Trigger
User asks to:
- Create scheduled social media posts (LinkedIn, Twitter/X, etc.)
- Automate weekly/daily content drafting for social platforms
- Set up a job that researches tech news and drafts posts
- Deliver post drafts via email for manual review and publishing

## Workflow

### 1. Clarify Scope and Platform
Before creating the job, ask:
- Which platform? (LinkedIn, X/Twitter, etc.)
- Draft-only or auto-publish?
  - **Draft-only** (recommended): Agent researches and drafts, delivers to user for manual review/publish. No credentials needed.
  - **Auto-publish**: Requires login cookies/session auth, fragile, user must share login state. Generally discouraged for LinkedIn.
- Delivery method: email, Telegram, Discord, etc.
- Topic focus: tech facts, tools, frameworks, general dev news, specific niche?
- Tone preference: casual/nerdy vs corporate/formal

### 2. Build the Prompt
The cron prompt should instruct the agent to:
1. Research recent news/tools/facts in the chosen topic area
2. Draft a post in the user's preferred tone (see User Preferences below)
3. Include relevant hashtags
4. Suggest best posting time/day for engagement

### 3. Schedule the Cron Job
```
schedule: "0 7 * * 1"  # Monday 9 AM Brussels (CEST) = 7 AM UTC
deliver: "local"
enabled_toolsets: ["terminal"]
```

### 4. Email Delivery (Critical Workaround)
**Pitfall**: The `deliver` field on a cron job CANNOT be a raw email address like `sage.stockmans@pm.me`. This produces:
```
last_delivery_error: "no delivery target resolved for deliver=sage.stockmans@pm.me"
```

**Fix**: Embed SMTP sending inside the prompt itself using the `terminal` toolset:
- Use `deliver: "local"` and `enabled_toolsets: ["terminal"]`
- Include in the prompt: "After drafting, send the post via email using Apple iCloud SMTP (smtp.mail.me.com:587, STARTTLS). Source APPLE_ID_PASSWORD and APPLE_APP_PASSWORD from environment variables. Use smtplib. To: sage.stockmans@pm.me. Subject: Weekly LinkedIn Tech Post Draft. If credentials missing, print draft to stdout and report failure."
- See Morning Briefing job for a working example of this pattern.

## User Preferences (Sage)
- **Tone**: Casual, nerdy, approachable. Not corporate or formal. Matches age/experience level.
- **Formatting**: NO em-dashes (—) in sentences. Use hyphens or other punctuation instead.
- **Length**: 150-300 words for LinkedIn posts.
- **Hashtags**: Include relevant ones at the end.
- **Delivery**: Prefers email by default (sage.stockmans@pm.me).
- **Timezone**: Brussels CEST (UTC+2 in summer). Schedule in local time.

## Pitfalls
1. **Never set deliver to a raw email address** on cron jobs. Always use local delivery + embedded SMTP in the prompt.
2. **Never auto-post to LinkedIn** without explicit user consent and credential sharing. Draft-only is the safe default.
3. If the user says "activate it" after creating a cron job, check if it's already enabled. Cron jobs created with `action=create` are enabled by default. "Activate" often means "confirm it's running" — just verify `state: scheduled` and `enabled: true`.
4. If user says "run a test for it", use `cronjob(action='run', job_id=...)` but warn that the output will be in the job logs unless email delivery is configured.

## References
- See `references/cron-email-delivery.md` for the full SMTP-in-prompt workaround pattern.
