关于 pi-share
pi-share 是用于从 URL 或 gist ID 加载并解析会话记录的 skill,也可从人的角度分析目标、引导、修正和提示风格。
主要功能
- 01通过 URL 或 gist ID 加载会话
- 02解码并提取对话记录
- 03输出标头或 JSON 行条目
- 04生成以人为中心的会话摘要
适用场景
- 01查看分享的编码 Agent 会话
- 02分析用户如何引导 Agent
- 03筛选消息并统计工具调用
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mitsuhiko/ agent-stuff --skill pi-share安装后在 Claude Code 中输入/pi-share确认已加载。
附带文件fetch-session.mjs
详细介绍
pi-share / buildwithpi 会话加载器
从 pi-share URL(shittycodingagent.ai、buildwithpi.ai、buildwithpi.com、pi.dev)加载并解析会话记录。
适用场景
加载会话: 用户提供以下格式的 URL 时,请使用此技能:
https://shittycodingagent.ai/session/?<gist_id>https://buildwithpi.ai/session/?<gist_id>https://buildwithpi.com/session/?<gist_id>https://pi.dev/session/?<gist_id>https://pi.dev/session/#<gist_id>- 或仅提供 gist ID,例如
46aee35206aefe99257bc5d5e60c6121 - 或提供带哈希前缀的简写,例如
#46aee35206aefe99257bc5d5e60c6121
人工摘要: 用户要求你执行以下操作时,请使用 --human-summary:
- 总结人类在 pi/编码 Agent 会话中做了什么
- 了解用户如何与 Agent 互动
- 分析用户行为、引导模式或提示词风格
- 从以人为中心的角度了解会话(关注人类做了什么,而非 Agent 做了什么)
人工摘要重点关注:初始目标、重新提示、引导/纠正、干预措施以及整体提示词风格。
工作原理
- 会话导出内容存储为 GitHub Gist
- URL 中
?后的部分包含 gist ID - Gist 包含一个
session.html文件,其中存有经过 base64 编码的会话数据 - 辅助脚本会获取并解码这些数据,以提取完整对话
用法
# Get full session data (default)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url-or-gist-id>"
# Get just the header
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --header
# Get entries as JSON lines (one entry per line)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --entries
# Get the system prompt
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --system
# Get tool definitions
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --tools
# Get human-centric summary (what did the human do in this session?)
node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --human-summary
人工摘要
--human-summary 标志会生成一份约 300 字的摘要,重点关注人类的体验:
- 他们最初的目标是什么?
- 他们多频繁地重新提示或引导 Agent?
- 他们采取了哪些干预措施?(纠正、澄清、表达不满)
- 他们的指令有多具体或含糊?
此功能会通过 pi -p 使用 claude-haiku-4-5 分析经过精简的会话记录。
会话数据结构
解码后的会话包含:
interface SessionData {
header: {
type: "session";
version: number;
id: string; // Session UUID
timestamp: string; // ISO timestamp
cwd: string; // Working directory
};
entries: SessionEntry[]; // Conversation entries (JSON lines format)
leafId: string | null; // Current branch leaf
systemPrompt?: string; // System prompt text
tools?: { name: string; description: string }[];
}
条目类型包括:
message- 包含内容块的用户/助手/toolResult 消息model_change- 模型切换thinking_level_change- 思考模式变更compaction- 上下文压缩事件
消息内容块类型:
text- 文本内容toolCall- 工具调用,包含toolName和argsthinking- 模型思考内容image- 嵌入的图片
示例:分析会话
# Pipe entries through jq to filter
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url>" --entries | jq 'select(.type == "message" and .message.role == "user")'
# Count tool calls
node ~/.pi/agent/skills/pi-share/fetch-session.mjs "<url>" --entries | jq -s '[.[] | select(.type == "message") | .message.content[]? | select(.type == "toolCall")] | length'
评论
支持 Markdown