Semi-Automating X Post Drafts with an AI Agent — GitHub Actions and Email Notifications

Lead

Hi, I’m Pomarano.

Under the Introspection Tech brand, I wanted to post one short piece each day on X (@syouwanotaisyou) — a Buddhist teaching plus a small practice for everyday life.
Researching and writing every morning is hard to sustain. On the other hand, fully automated posting to X felt risky for quality and platform rules.

So I built a semi-automatic setup: an AI agent handles research and copy; I review and post.
GitHub Actions runs the job, Gmail delivers notifications, and the agent runs through the Cursor SDK. Each morning I get the draft by email, check it, then post to @syouwanotaisyou.

This post covers why I chose semi-automation, how the system is wired, what broke along the way, and how to reproduce the essentials.


What the agent does vs what I do

RoleWork
AgentTopic research, post copy, saving draft files
Me (Pomarano)Review, edit if needed, copy-paste to X (@syouwanotaisyou)

I deliberately did not wire up the X API for auto-posting. Three reasons:

  1. Quality — Buddhist “quotes” often lack real sources; a human check is needed
  2. Policy & risk — automated posting is not zero-risk for account enforcement
  3. Tone & length — Japanese posts on X are capped at 140 characters. I want the final trim in my hands

Semi-automation balances posting every day with not shipping sloppy content.


Theme and format for each post

Posts follow the Introspection Tech brand:

  • One teaching — a Buddhist idea or concept (phrased as “it is said that…,” never fake “the Buddha said…”)
  • One step for today — a small practice for work, social media, chores, etc.
  • Lengthwithin 140 Japanese characters (hashtags and line breaks count)

The tone matches the CBT/ACT-style introspection in Attachment Isn’t Just a Bad Habit. A spec file locks that in.

Topics rotate by weekday (awareness, impermanence, compassion, etc.). The agent also avoids repeating the same concept within the last 30 drafts.


End-to-end flow

flowchart LR
  subgraph cloud [GitHub Actions daily 7am JST]
    A[Cursor SDK] --> B[Create draft .md]
    B --> C[Commit to repo]
    B --> D[Gmail notify]
  end
  E[Pomarano] --> F[Review email]
  F --> G[Post to X]
  D --> F
  C --> F

In plain steps:

  1. Every day at 7:00 JST — GitHub Actions runs
  2. Cursor SDK — reads the spec and prompt in the repo; the agent generates one post
  3. social/x-drafts/YYYY-MM-DD.md — stores post body and source notes
  4. Gmail — sends the post body by email (when configured)
  5. Me — review via email or GitHub → paste to @syouwanotaisyou

Source code: pomarano/x_auto_writing


Tech stack

PieceChoiceWhy
Agent runtimeCursor SDK (@cursor/sdk)Research + file writes in one job
SchedulingGitHub ActionsNo dependency on my PC being awake
NotificationGmail SMTPEasy for personal use
PostingManualMatches the semi-auto policy

I used GitHub Actions from the start — no local cron on my Mac.


Instructions passed to the agent

The prompt requires:

  • Follow x-shuuchaku-agent-spec.md
  • No unsourced “words of the Buddha”
  • Post body within 140 Japanese characters (count before saving)
  • Skip if today’s file already exists (no duplicate generation)

As I wrote in Measuring AI Harness Engineering, AI work goes better with rules and checks, not vague asks. Character limits and duplicate avoidance are a lightweight harness here.


What went wrong (honest notes)

Email never arrived

The workflow showed green, but nothing in the inbox. The receiver was blocking it. Adding the sender to an allowlist fixed delivery.

Manual run skipped email

At first, email sent only when a new draft was created. If today’s file already existed, manual Run workflow skipped mail. I changed the condition so manual runs send email even for an existing draft (useful for testing).

Node.js 20 deprecation warning

Old versions of checkout, setup-node, and action-send-mail triggered warnings. Updated to v6 / v17 (Node 24–compatible).

Japanese X character limit

I initially assumed 280 characters. Japanese posts cap at 140. I updated the spec and prompt.


Setup overview (for reproduction)

Details live in automation/x-daily/README.md in the repo. Skeleton only:

GitHub Secrets

NamePurpose
CURSOR_API_KEYCursor SDK (Dashboard → API Keys)
NOTIFY_EMAILNotification recipient
MAIL_USERNAMESender Gmail address
MAIL_APP_PASSWORDGmail app password

GitHub Variables

NameValue
X_DAILY_EMAIL_ENABLEDtrue

Smoke test

Actions tab → run X Daily Draft manually → post body arrives by email → confirm you can paste to @syouwanotaisyou.


What worked and what’s next

What worked

  • A steady rhythm: researched copy in my inbox every morning
  • One post per day on @syouwanotaisyou under Introspection Tech
  • Lower “keep going” friction; X fits the same world as blog posts and a planned attachment app

What’s next

  • Separate English X drafts if I add an English account later
  • When the attachment app ships, maybe one blog link per week
  • Easier tracking of status: posted on drafts

Summary

  • Semi-auto: AI for research and copy; human for review and posting
  • GitHub Actions + Cursor SDK + Gmail for a daily run that does not depend on my Mac sleeping
  • Posts go to X @syouwanotaisyou. 140 Japanese characters and careful sourcing for Buddhist themes — encoded in spec and prompt
  • Gotchas (email blocking, character limit, Actions warnings) were fixed with logs and workflow conditions

This continues my agent posts: from harness theory to build it and run it. Starting small with semi-automation fits a personal blog well.


コメント