SuperAPI AI Directory

x-tracker

General & other

View repository

Updated 10-15 20:35

About this skill

X Tracker

Sync and archive X data (following list, bookmarks, personal tweets), supporting content aggregation, rewriting, and Notion sync.

Path conventions:

  • {SKILL_DIR} — skill directory (contains scripts/, references/)
  • {PROJECT_ROOT} — skill parent directory (contains config.json, data/, digests/)

Initial setup

  1. Configure OAuth 2.0: refer to references/oauth-setup.md
  2. Initialize:cd {SKILL_DIR} && bun scripts/auth.ts init
  3. Log in:cd {SKILL_DIR} && bun scripts/auth.ts login

Required scope:tweet.read, users.read, follows.read, bookmark.read, offline.access

Data sync

Important: do not proactively run sync-following.ts. The following list is synced by scheduled tasks or manually by the user; new follows are only included in tracking after user confirmation.

cd {SKILL_DIR}
# bun scripts/sync-following.ts        # ⚠️ 仅限用户明确要求时运行
bun scripts/sync-bookmarks.ts          # 书签 → data/bookmarks/
bun scripts/fetch-my-tweets.ts         # 个人推文 → data/my-tweets/
bun scripts/fetch-following-tweets.ts  # 关注者推文 → data/following-tweets/

Daily sync (excluding the following list):bun scripts/sync-bookmarks.ts && bun scripts/fetch-my-tweets.ts && bun scripts/fetch-following-tweets.ts

Daily Digest

cd {SKILL_DIR} && bun scripts/analyze.ts digest [--date YYYY-MM-DD]

Zero API calls, based on local following-tweets + bookmarks. Sort by score = like + retweet×3 + bookmark×2 and take the Top 20. Output digests/{date}/digest.json。

Trigger flow("Daily Digest"/"Today's Digest"):

  1. Run the digest command, generating digests/{date}/digest.json
  2. Read the JSON, confirm the date_distribution date distribution
  3. Generate Chinese highlights by category, each item in the format:
    • 作者 | 类型 | 来源标签 | 互动数据
    • English original text (keep the original content)
    • Chinese translation/summary (no more than 2 sentences summarizing the core)
  4. Source tags: 🔖 Bookmark / 📌 Dual source / No tag = Following
  5. Based on tweet_date mark the publication date; for content not from the current day, mark [MM-DD]
  6. Write to {PROJECT_ROOT}/digests/{date}/digest.md

Content Rewrite

cd {SKILL_DIR} && bun scripts/analyze.ts rewrite [--date YYYY-MM-DD] [--top 10]

Take the Top N by score, output digests/{date}/rewrite.json(including is_link_only、expanded_url)。

Trigger flow("Tweet Rewrite"/"Content Rewrite"/"rewrite"):

  1. Run the rewrite command
  2. Read the JSON,confirm the date: check the proportion of each date in date_distribution ; if the current day (tweet_date = today) is less than half, show the distribution and let the user confirm whether to continue
  3. Pure link handling(is_link_only: true): list the expanded_urlof these tweets, prompt the user to manually save the webpage content before rewriting, skip these items and process the rest first
  4. Parallel sub-agents (Task, general-purpose, model=sonnet), one per item (skip pure links)
  5. For the rewrite style, see "Rewrite Style Guide" below
  6. Merge and write to digests/{date}/rewrite.md

Rewrite Style Guide(must be included in the sub-agent prompt):

  • Person: first person, written from the user's perspective, like posting a tweet/writing a WeChat public account article, not writing a news release
  • Tone: colloquial, mainly short sentences, can be self-deprecating, can be direct, not pretentious, no clichés like "it is worth noting that"
  • Structure: title (one sentence that grabs attention) + body (200-400 words), no stacked subheadings
  • Content: state the facts first (explain what happened in one or two sentences), then give your own views/feelings, and you can connect it to your own experience
  • Forbidden: AI-speak (repeated appearances of "it is worth noting that", "in essence", "marks"), excessive summarizing, three-part parallelism, vague "the future is promising"
  • Reference tone:data/my-tweets/all.json : the original tweet style in — mixed Chinese and English, natural internet slang, tech person's perspective

Style Analysis

cd {SKILL_DIR} && bun scripts/analyze.ts style

Analyze personal tweet style, output data/my-style/style-profile.json。

Single tweet retrieval

cd {SKILL_DIR} && bun scripts/fetch-tweet.ts <tweet_id>

Retrieve the full text of a single tweet via the X API v2 (including note_tweet), output JSON to stdout.

Notion sync

cd {SKILL_DIR} && bun scripts/notion-sync.ts <following|bookmarks|all>

Incremental push to the Notion database. See references/notion-schema.md。

Configuration

{PROJECT_ROOT}/config.json(gitignored):

{
  "client_id": "...",
  "client_secret": "...",
  "access_token": "...",
  "refresh_token": "...",
  "user_id": "...",
  "data_dir": "./data",
  "notion": { "following_db_id": "...", "bookmarks_db_id": "..." }
}

Reference documentation

  • references/x-api-endpoints.md — API endpoint reference
  • references/oauth-setup.md — OAuth 2.0 configuration guide
  • references/notion-schema.md — Notion database schema