An OpenClaw skill that archives X/Twitter bookmarks as enriched Markdown notes.
This skill has two parts:
- Your OpenClaw agent reads
SKILL.mdand handles the intelligence - writing interpretive summaries, picking relevant tags, assessing relevance, and enriching notes with link context scripts/sync.pyhandles the mechanical work - fetching bookmarks from the X API, managing sync state, extracting articles, and writing note files
The agent is the brain. The script is the hands. Together they turn throwaway bookmarks into durable, searchable notes in your Obsidian vault (or any Markdown-based workflow).
The script also works standalone (e.g., as a cron job) using built-in heuristics for summaries and tags - but the agent-driven mode produces significantly better notes.
- Agent-written summaries that interpret content, not just copy tweet text
- Smart tagging from a configurable vocabulary
- X Article extraction cascade:
article.plain_textβx-tweet-fetcherβ HTML fallback - Obsidian-safe tags: lowercase, hyphens, underscores only
- Idempotent: safe to rerun, never duplicates existing notes
- Works with or without OpenClaw (heuristic fallback for standalone use)
.
βββ SKILL.md
βββ README.md
βββ config.example.json
βββ LICENSE
βββ .gitignore
βββ scripts/
βββ fetch_article.py
βββ requirements.txt
βββ sync.py
- OpenClaw installed and running
xurl(X API CLI)- Python 3.10+
- Optional:
x-tweet-fetcherskill for stronger X Article extraction
No third-party Python dependencies β the scripts run on Python's standard library.
Clone or copy this repo into your OpenClaw workspace skills folder:
cd ~/.openclaw/workspace/skills
git clone https://github.com/benmillerat/openclaw-x-bookmark-archiver.git x-bookmark-archiverThat's it β OpenClaw automatically discovers skills in this folder. Your agent will see the SKILL.md and know how to use it.
Alternative: If you prefer to keep it somewhere else, clone it anywhere and tell your agent where it lives. OpenClaw agents can read any skill file you point them to.
Now configure the X API connection. You only need to do this once.
You need an X Developer account to use the bookmarks API.
- Go to developer.x.com and sign in with your X account
- Create a new project and app (free tier is fine)
- Under your app settings, enable OAuth 2.0 and set the type to Confidential Client
- Copy your Client ID and Client Secret - you will need them in the next step
Note: Make sure your app has the
bookmark.readandtweet.readOAuth 2.0 scopes enabled. X controls this under your app's permissions settings.
xurl is the CLI used to talk to the X API. Install it via npm:
npm install -g @xdevplatform/xurlConfirm it is available:
xurl --helpxurl auth apps add my-bookmark-app --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRETReplace my-bookmark-app with any name you like - you will use it in your config as app_name.
xurl auth oauth2 --app my-bookmark-appThis opens a browser flow. Complete it to store your OAuth2 token.
Important: OAuth2 bookmark tokens expire every 2 hours. If bookmark sync starts returning
401 Unauthorized, just re-run this command to refresh. Always pass--app my-bookmark-app(or whatever you named it) - omitting--appmakesxurlpick the wrong app.
After authenticating, run:
xurl --auth oauth2 --app my-bookmark-app "/2/users/me"The response contains an id field - that is your user_id. Copy it.
cp config.example.json config.jsonOpen config.json and fill in:
user_id- the ID you just got from/2/users/meapp_name- the name you chose in step 3 (e.g.my-bookmark-app)output_dir- where you want the Markdown notes written (e.g.~/notes/x-bookmarks)sync_state_path- where the sync state file lives (e.g.~/notes/x-bookmarks/.sync-state.json)
Before writing any notes, do a dry run to confirm everything is connected:
python3 scripts/sync.py --config ./config.json --dry-runIf this prints a count of bookmarks found without errors, you are good to go.
python3 scripts/sync.py --config ./config.jsonNotes will appear in your output_dir. Reruns are safe - existing bookmarks are never overwritten.
For better X Article extraction, install the x-tweet-fetcher OpenClaw skill. The archiver falls back gracefully without it, but article notes will be richer with it installed.
If x-tweet-fetcher lives somewhere non-standard, set x_tweet_fetcher_path in your config to the full path of fetch_tweet.py.
| Key | Type | Default | Notes |
|---|---|---|---|
user_id |
string | none | Required. X user ID whose bookmarks are archived. |
app_name |
string | none | Required. Passed to xurl --app. |
output_dir |
string | none | Required. Directory where Markdown notes are written. |
sync_state_path |
string | none | Required. Path to the sync-state JSON file. |
tags_vocabulary |
array of strings | fixed built-in list | Allowed tags. x-bookmarks is always included. |
max_results |
integer | 100 |
Per-page bookmark fetch size. Must be 1-100. |
summary_backend |
string | heuristic |
Summary mode for standalone use. When run as an OpenClaw skill, the agent handles summaries directly. |
x_tweet_fetcher_path |
string or null |
null |
Optional explicit path to x-tweet-fetcher/scripts/fetch_tweet.py. |
{
"user_id": "YOUR_X_USER_ID",
"app_name": "your-xurl-app-name",
"output_dir": "~/notes/x-bookmarks",
"sync_state_path": "~/notes/x-bookmarks/.sync-state.json",
"tags_vocabulary": [
"x-bookmarks",
"openclaw",
"ai-agents",
"coding-tools",
"homelab",
"apple",
"3d-printing",
"career",
"design",
"open-source",
"browser-automation",
"mcp",
"llm",
"cli",
"dev-tools",
"tutorial",
"hardware",
"productivity",
"self-hosted"
],
"max_results": 100,
"summary_backend": "heuristic",
"x_tweet_fetcher_path": null
}Always run from the project root - sync.py imports fetch_article.py as a sibling module and Python resolves it relative to the scripts/ directory:
python3 scripts/sync.py --config ./config.json0 * * * * cd /path/to/openclaw-x-bookmark-archiver && python3 scripts/sync.py --config /path/to/config.json >> /tmp/x-bookmark-archiver.log 2>&1The generated notes follow this shape:
---
author: "@yourusername"
date: 2026-03-06
tags: [x-bookmarks, tutorial, dev-tools]
relevance: try-this
tweet_id: "1234567890"
url: https://x.com/yourusername/status/1234567890
article_title: "Example X Article"
article_url: https://x.com/i/article/1234567890
article_extracted: true
source: x-bookmark
---
> A cleaned copy of the tweet text with t.co links removed.
π https://example.com/post
**Summary:** Practical bookmark about a workflow or tool, written as an interpretation rather than copied tweet text.
**Link:** The linked page provides the main context behind the bookmark and explains the idea in more detail.
[View on X](https://x.com/yourusername/status/1234567890)
## Summary (Librarian)
**TL;DR:** One-sentence article summary.
**Key takeaways:**
- First takeaway.
- Second takeaway.
**Actionables (if any):**
- Try the workflow yourself.
## Article (full text)
Full extracted article text goes here.Notes are written as:
Compact Description - Author Name.md
Examples:
OpenClaw Bookmarking Patterns - Your Name.mdCLI Workflow Notes - @yourusername.md
If a filename already exists, the script appends (2), (3), and so on.
x-bookmarksis always included- 1-3 topical tags are added from the configured vocabulary
- tags are sanitized to lowercase plus
-and_ - empty tag arrays are never written
For X Articles, the helper tries these sources in order:
article.plain_textreturned by the X APIx-tweet-fetcher- readable HTML extraction fallback
This mirrors the production workflow closely while keeping the public package easy to configure.
Refresh OAuth2 for the exact app in your config:
xurl auth oauth2 --app your-app-nameThen retry the sync.
Make sure you are passing --app your-app-name explicitly. Without --app, xurl can use the wrong app and the bookmark endpoint will still fail.
The bookmark fetch must request article in tweet.fields. This repo already does that. If the article still cannot be expanded, the note is still written with article_extracted: false and the article URL preserved.
If you're running sync.py standalone, summaries use built-in heuristics (keyword matching, URL content, article text). For richer AI-generated summaries, run the archiver as an OpenClaw skill - the agent writes interpretive summaries and picks smarter tags. See SKILL.md for the full agent workflow.
Install x-tweet-fetcher and set x_tweet_fetcher_path if it is not in a standard OpenClaw skill location.
MIT