关于 memos
memos 是通过 REST API 管理 Memos 实例的命令行技能,涵盖备忘录增删改查及评论、回应、附件和关联管理。
主要功能
- 01列出、筛选和分页备忘录
- 02创建、读取、更新和删除备忘录
- 03管理评论和回应
- 04管理附件和备忘录关联
适用场景
- 01按状态或可见性查找备忘录
- 02创建或编辑私有及公开笔记
- 03查看或添加评论和回应
- 04更新备忘录附件及交叉引用
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ akhy/ agent-skills --skill memos安装后在 Claude Code 中输入/memos确认已加载。
附带文件scripts/memos.sh
详细介绍
Memos 技能
通过其 REST API(/api/v1/memos)与 Memos 实例交互。
前提条件
使用此技能前,请设置以下环境变量:
export MEMOS_URL="https://memos.example.com"
export MEMOS_ACCESS_TOKEN="your_access_token" # from Memos account settings
所有请求均使用 Authorization: Bearer $MEMOS_ACCESS_TOKEN。
脚本
所有操作均通过 scripts/memos.sh 执行。运行命令:bash memos/scripts/memos.sh <command> [options]。
不带参数运行以查看完整用法:
bash memos/scripts/memos.sh --help
操作
列出备忘录
# All memos
bash memos/scripts/memos.sh list
# With filter (AIP-160 syntax)
bash memos/scripts/memos.sh list --filter 'state == "NORMAL"' --page-size 20
# Include deleted
bash memos/scripts/memos.sh list --show-deleted
创建备忘录
bash memos/scripts/memos.sh create --content "Hello, world!" --visibility PUBLIC
# Pinned private memo
bash memos/scripts/memos.sh create --content "Important note" --pinned
--visibility:PUBLIC | PROTECTED | PRIVATE(默认值:PRIVATE)
获取备忘录
bash memos/scripts/memos.sh get memos/123
备忘录资源名称的格式为 memos/{id}。
更新备忘录
bash memos/scripts/memos.sh update memos/123 --content "Updated content"
bash memos/scripts/memos.sh update memos/123 --visibility PUBLIC --pinned true
bash memos/scripts/memos.sh update memos/123 --state ARCHIVED
updateMask 中仅会发送指定字段。
删除备忘录
# Soft delete
bash memos/scripts/memos.sh delete memos/123
# Hard delete
bash memos/scripts/memos.sh delete memos/123 --force
评论
# List comments
bash memos/scripts/memos.sh comments memos/123
# Post a comment
bash memos/scripts/memos.sh comment memos/123 --content "Great memo!"
表情回应
# List reactions
bash memos/scripts/memos.sh reactions memos/123
# Add a reaction
bash memos/scripts/memos.sh react memos/123 --reaction "👍"
# Remove a reaction (reaction ID from list response)
bash memos/scripts/memos.sh delete-reaction memos/123 reactions/456
附件
# List attachments
bash memos/scripts/memos.sh attachments memos/123
# Set attachments (replaces existing)
bash memos/scripts/memos.sh set-attachments memos/123 --names "attachments/1,attachments/2"
关联
# List relations
bash memos/scripts/memos.sh relations memos/123
# Set relations (replaces existing)
bash memos/scripts/memos.sh set-relations memos/123 --relations '[{"memo":"memos/123","relatedMemo":"memos/456","type":"REFERENCE"}]'
分页
列表命令支持 --page-size N 和 --page-token TOKEN。有更多结果时,响应会包含 nextPageToken:
result=$(bash memos/scripts/memos.sh list --page-size 10)
next=$(echo "$result" | jq -r '.nextPageToken // empty')
# Fetch next page
bash memos/scripts/memos.sh list --page-size 10 --page-token "$next"
筛选
使用 AIP-160 筛选表达式和 --filter:
bash memos/scripts/memos.sh list --filter 'state == "NORMAL"'
bash memos/scripts/memos.sh list --filter 'visibility == "PUBLIC"'
响应格式
所有响应均为 JSON。可通过管道传递给 jq 以提取字段:
# Get all memo names and snippets
bash memos/scripts/memos.sh list | jq '.memos[] | {name, snippet}'
# Get a single field
bash memos/scripts/memos.sh get memos/123 | jq '.content'
评论
支持 Markdown