Bluesky CLI
Full-featured CLI for Bluesky/AT Protocol.
Agent Instructions
First: Check if logged in
CODEBLOCK0
- - If shows handle → ready to use commands below
- If "Not logged in" → guide user through Setup section
Common tasks:
- - "Post to Bluesky" → INLINECODE0
- "Check my timeline" → INLINECODE1
- "Like this post" → INLINECODE2
- "Follow someone" → INLINECODE3
Setup
If user isn't logged in (bsky whoami shows "Not logged in"), guide them through setup:
Getting an App Password
Tell the user:
Go to bsky.app → click your avatar → Settings → Privacy and Security → App Passwords → Add App Password. Name it "OpenClaw" and copy the password (like xxxx-xxxx-xxxx-xxxx). You'll only see it once!
Logging In
Once they have the app password, run:
CODEBLOCK1
Example:
CODEBLOCK2
Security: Password is used once to get a session token, then immediately discarded. Never stored on disk. Session auto-refreshes.
Quick Reference
| Action | Command |
|---|
| View timeline | INLINECODE6 or INLINECODE7 |
| Post |
bsky post "text" |
| Post with image |
bsky post "text" --image photo.jpg --alt "description" |
| Reply |
bsky reply <url> "text" |
| Quote-post |
bsky quote <url> "text" |
| View thread |
bsky thread <url> |
| Create thread |
bsky create-thread "Post 1" "Post 2" "Post 3" or
bsky ct |
| Like |
bsky like <url> |
| Repost |
bsky repost <url> |
| Follow |
bsky follow @handle |
| Block |
bsky block @handle |
| Mute |
bsky mute @handle |
| Search |
bsky search "query" |
| Notifications |
bsky notifications or
bsky n |
| Delete post |
bsky delete <url> |
Commands
Timeline
CODEBLOCK3
Posting
CODEBLOCK4
Reply & Quote
CODEBLOCK5
Thread View
CODEBLOCK6
Create Thread
CODEBLOCK7
Engagement
CODEBLOCK8
Social Graph
CODEBLOCK9
Moderation
CODEBLOCK10
Search & Notifications
CODEBLOCK11
Delete
CODEBLOCK12
JSON Output
Add --json to read commands for structured output:
CODEBLOCK13
Error Handling
| Error | Fix |
|---|
| "Session expired" | Run bsky login again |
| "Not logged in" |
Run
bsky login --handle ... --password ... |
| "Post is X chars (max 300)" | Shorten text |
| "Image too large" | Use image under 1MB |
Notes
- - All
<url> parameters accept either https://bsky.app/... URLs or at:// URIs - Handles auto-append
.bsky.social if no domain specified - Image posts require
--alt for accessibility (Bluesky requirement) - Session tokens auto-refresh; password never stored
Bluesky CLI
Bluesky/AT协议的全功能命令行工具。
代理指令
第一步:检查登录状态
bash
bsky whoami
- - 如果显示用户名 → 可直接使用以下命令
- 如果显示未登录 → 引导用户完成设置部分
常见任务:
- - 发布到Bluesky → bsky post 文本
- 查看我的时间线 → bsky timeline
- 点赞此帖子 → bsky like
- 关注某人 → bsky follow @用户名
设置
如果用户未登录(bsky whoami显示未登录),引导他们完成设置:
获取应用密码
告知用户:
前往 bsky.app → 点击头像 → 设置 → 隐私与安全 → 应用密码 → 添加应用密码。命名为OpenClaw并复制密码(格式如xxxx-xxxx-xxxx-xxxx)。密码仅显示一次!
登录
获取应用密码后,运行:
bash
bsky login --handle 用户.bsky.social --password 应用密码
示例:
bash
bsky login --handle alice.bsky.social --password abcd-1234-efgh-5678
安全提示: 密码仅用于获取会话令牌,使用后立即丢弃。不会存储在磁盘上。会话会自动刷新。
快速参考
| 操作 | 命令 |
|---|
| 查看时间线 | bsky timeline 或 bsky tl |
| 发布 |
bsky post 文本 |
| 带图片发布 | bsky post 文本 --image 照片.jpg --alt 描述 |
| 回复 | bsky reply
文本 |
| 引用转发 | bsky quote 文本 |
| 查看帖子串 | bsky thread |
| 创建帖子串 | bsky create-thread 帖子1 帖子2 帖子3 或 bsky ct |
| 点赞 | bsky like |
| 转发 | bsky repost |
| 关注 | bsky follow @用户名 |
| 屏蔽 | bsky block @用户名 |
| 静音 | bsky mute @用户名 |
| 搜索 | bsky search 查询 |
| 通知 | bsky notifications 或 bsky n |
| 删除帖子 | bsky delete |
命令
时间线
bash
bsky timeline # 10条帖子
bsky timeline -n 20 # 20条帖子
bsky timeline --json # JSON输出
发布
bash
bsky post 你好,世界! # 基本发布
bsky post 看看这个! --image 图片.jpg --alt 一张照片 # 带图片
bsky post 测试 --dry-run # 仅预览
回复与引用
bash
bsky reply <帖子-url> 你的回复
bsky quote <帖子-url> 你的看法
查看帖子串
bash
bsky thread <帖子-url> # 查看对话
bsky thread --depth 10 # 更多回复
bsky thread --json # JSON输出
创建帖子串
bash
bsky create-thread 第一条帖子 第二条帖子 第三条帖子 # 创建帖子串
bsky ct 帖子1 帖子2 帖子3 # 短别名
bsky create-thread 你好! 更多想法 --dry-run # 仅预览
bsky create-thread 看! 不错 --image 图片.jpg --alt 一张照片 # 第一条帖子带图片
互动
bash
bsky like <帖子-url> # ❤️ 点赞
bsky unlike <帖子-url> # 取消点赞
bsky repost <帖子-url> # 🔁 转发(别名:boost, rt)
bsky unrepost <帖子-url> # 取消转发
社交图谱
bash
bsky follow @某人 # 关注用户
bsky unfollow @某人 # 取消关注
bsky profile @某人 # 查看个人资料
bsky profile --json # JSON输出
管理
bash
bsky block @某人 # 🚫 屏蔽用户
bsky unblock @某人 # 取消屏蔽
bsky mute @某人 # 🔇 静音用户
bsky unmute @某人 # 取消静音
搜索与通知
bash
bsky search 查询 # 搜索帖子
bsky search 主题 -n 20 # 更多结果
bsky notifications # 最近通知
bsky n -n 30 # 更多通知
删除
bash
bsky delete <帖子-url> # 删除你的帖子
bsky delete <帖子-id> # 按ID删除
JSON输出
在读取命令中添加--json以获得结构化输出:
bash
bsky timeline --json
bsky search 主题 --json
bsky notifications --json
bsky profile @某人 --json
bsky thread --json
错误处理
| 错误 | 解决方法 |
|---|
| 会话已过期 | 重新运行bsky login |
| 未登录 |
运行bsky login --handle ... --password ... |
| 帖子长度为X字符(最大300) | 缩短文本 |
| 图片过大 | 使用小于1MB的图片 |
说明
- - 所有参数接受https://bsky.app/...网址或at://URI
- 如果未指定域名,用户名会自动添加.bsky.social后缀
- 带图片的帖子需要--alt参数以确保无障碍访问(Bluesky要求)
- 会话令牌自动刷新;密码不会存储