gist-share
Post any content — summaries, plans, reports, pitches, logs — to GitHub Gist and share the URL. A lightweight way for agents to publish rich context that humans and other agents can read from anywhere.
Why Gists?
Agents communicate through messages, but messages disappear into scroll. A gist is:
- - Persistent — stays at a stable URL
- Readable by anyone — no auth required for public gists
- Markdown-rendered — GitHub renders it beautifully
- Shareable — paste the URL anywhere
When an agent needs to hand off context to a human, another agent, or a future session — a gist beats a wall of chat text.
Setup (One-Time)
You need a GitHub Personal Access Token (PAT) with the gist scope.
Step 1: Create a PAT
- 1. Go to github.com/settings/tokens
- Click "Generate new token (classic)"
- Give it a name like INLINECODE1
- Check the
gist scope (that's all you need) - Click Generate token
- Copy the token — you won't see it again
Step 2: Authenticate the gh CLI
OpenClaw uses the gh CLI to post gists. Set your token as an environment variable for the session:
CODEBLOCK0
Or add it permanently to your shell profile (~/.bashrc, ~/.zshrc, etc.):
CODEBLOCK1
Step 3: Verify it works
CODEBLOCK2
You should see your account and gist listed under token scopes.
How to Post a Gist
Basic usage
Use the exec tool to call gh gist create:
CODEBLOCK3
With a flag for secret gists
Replace --public with --secret if the content shouldn't be publicly indexed.
Full template
CODEBLOCK4
The command returns the gist URL on success:
✓ Created public gist FILENAME.md
https://gist.github.com/USERNAME/HASH
Workflow
- 1. Prepare content — write your markdown (report, summary, plan, pitch, log)
- Choose visibility —
--public for sharing freely, --secret for targeted sharing - Post it — run
gh gist create via INLINECODE15 - Return the URL — share it in the conversation, send it to another agent, or log it
Example: Posting a Strategic Summary
CODEBLOCK6
Tips
- - Filename matters — use
.md extension for GitHub to render markdown - Description is searchable — write something meaningful
- One gist per topic — don't cram everything into one file; use focused gists
- Update with
gh gist edit GIST_ID — gists are editable if you need to revise - List your gists —
gh gist list shows recent gists with their IDs and URLs
Troubleshooting
| Problem | Fix |
|---|
| INLINECODE19 | Install via brew install gh (macOS) or apt install gh (Linux) |
| INLINECODE22 |
Token missing or expired — re-run setup |
|
Token missing gist scope | Regenerate the PAT with
gist scope checked |
|
gh auth status shows invalid token | Run
gh auth login and follow the prompts |
Gists: the simplest way for a claw to leave a note the world can read.
gist-share
发布任何内容——摘要、计划、报告、提案、日志——到GitHub Gist并分享链接。这是一种轻量级的方式,让智能体能够发布丰富的上下文信息,供人类和其他智能体随时随地阅读。
为什么选择Gist?
智能体通过消息进行通信,但消息会消失在滚动中。而Gist具有以下特点:
- - 持久化——保存在稳定的URL地址
- 任何人可读——公开Gist无需身份验证
- Markdown渲染——GitHub会完美渲染
- 可分享——可将URL粘贴到任何地方
当智能体需要将上下文传递给人类、其他智能体或未来的会话时——Gist胜过一长串聊天文本。
设置(一次性操作)
你需要一个具有gist权限的GitHub个人访问令牌(PAT)。
步骤1:创建PAT
- 1. 访问 github.com/settings/tokens
- 点击 Generate new token (classic)
- 为其命名,例如 openclaw-gist
- 勾选 gist 权限(仅此一项即可)
- 点击 Generate token
- 复制令牌——之后将无法再次查看
步骤2:验证gh CLI
OpenClaw使用gh CLI来发布Gist。将令牌设置为当前会话的环境变量:
bash
export GITHUBTOKEN=ghpyourTokenHere
或者永久添加到你的shell配置文件(~/.bashrc、~/.zshrc等)中:
bash
echo export GITHUBTOKEN=ghpyourTokenHere >> ~/.zshrc
source ~/.zshrc
步骤3:验证是否生效
bash
gh auth status
你应该能看到你的账户,并且在令牌权限中列出了gist。
如何发布Gist
基本用法
使用exec工具调用gh gist create:
bash
gh gist create --public --desc 你的描述 --filename your-file.md - << EOF
你的内容。
支持Markdown格式。
EOF
使用标记创建私密Gist
如果内容不应被公开索引,将--public替换为--secret。
完整模板
bash
gh gist create \
--public \
--desc 描述 \
--filename 文件名.md - << GISTEOF
标题
内容写在这里
GISTEOF
成功时命令会返回Gist的URL:
✓ Created public gist 文件名.md
https://gist.github.com/用户名/哈希值
工作流程
- 1. 准备内容——编写你的Markdown(报告、摘要、计划、提案、日志)
- 选择可见性——--public用于自由分享,--secret用于定向分享
- 发布——通过exec运行gh gist create
- 返回URL——在对话中分享、发送给其他智能体或记录保存
示例:发布战略摘要
bash
gh gist create --public --desc Q2路线图摘要 --filename q2-roadmap.md - << EOF
Q2路线图摘要
第一阶段——基础(四月)
- - 完成ClawDash MVP
- 发布ClawCanvas v1
第二阶段——扩展(五月)
- - 启动ClawText测试版
- 开始ClawTomation集成
第三阶段——规模化(六月)
EOF
提示
- - 文件名很重要——使用.md扩展名以便GitHub渲染Markdown
- 描述可搜索——写有意义的内容
- 每个主题一个Gist——不要把所有内容塞进一个文件;使用聚焦的Gist
- 使用gh gist edit GIST_ID更新——Gist可编辑,便于修改
- 列出你的Gist——gh gist list显示最近的Gist及其ID和URL
故障排除
| 问题 | 解决方法 |
|---|
| gh: command not found | 通过brew install gh(macOS)或apt install gh(Linux)安装 |
| HTTP 401 Unauthorized |
令牌丢失或过期——重新执行设置 |
| Token missing gist scope | 重新生成PAT并勾选gist权限 |
| gh auth status显示无效令牌 | 运行gh auth login并按提示操作 |
Gist:爪子留下世界可读笔记的最简单方式。