简介
通过 Go CLI 安全操作 Memos 数据,支持读写、搜索、过滤及管理员功能,适合自动化工作流与日常笔记管理
原始描述
Use when a user needs to read, search, create, update, delete, comment on, tag, or inspect Memos data through this repository's Go CLI, especially when the a...
通过你的 Agent 添加
安装目录:memos-cli/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
memos-cli 是一款面向 Memos 开源笔记系统的命令行管理工具,以纯 Markdown 文档形式提供完整的使用指南。用户通过 go install 安装后,可使用 memos-cli 二进制文件执行各类备忘录操作。
该技能采用配置优先的设计理念,强制要求在任何 API 调用前执行 memos-cli config check 预检命令。CLI 支持从环境变量、本地 .env 文件读取配置,包括 MEMOS_URL、MEMOS_API_KEY 和可选的 MEMOS_ADMIN_API_KEY。所有操作均支持 --json 结构化输出,便于脚本化处理和 ID 提取。
核心功能覆盖完整的 CRUD 生命周期:读取方面支持列表分页查询 (memo list)、单条获取 (memo get)、全文搜索 (search) 和 CEL 表达式过滤 (filter);写入方面支持 Markdown 内容创建与更新、标签管理、评论添加以及安全删除(需 --yes 确认)。特别针对 Agent 场景优化了工作流设计,如强制配置检查、JSON 输出优先、安全删除确认等。
显著优点
零代码风险:本 Skill 为纯 Markdown 文档,不含任何可执行脚本,从根本上杜绝了代码注入和恶意执行风险,安全基线极高。
标准化接口:将 Memos 的 HTTP API 封装为语义化的 CLI 命令,屏蔽底层细节,提供统一的错误处理和输出格式,大幅降低使用门槛。
Agent 友好设计:内置完整的安全预检机制(config check)、强制确认的保护性操作(删除需 --yes)、以及机器可读的 JSON 输出模式,特别适合自动化工作流和 AI Agent 集成。
配置管理灵活:支持环境变量与本地 .env 文件双重配置,明确区分普通 API 密钥和管理员密钥,权限边界清晰。
功能覆盖全面:涵盖备忘录的完整生命周期管理,包括 CEL 高级过滤、分页查询、Markdown 内容支持、评论系统和标签管理,满足专业用户的进阶需求。
潜在缺点与局限性
外部依赖风险:CLI 工具本身需通过 go install 从个人开发者 GitHub 仓库安装,存在供应链安全风险。当前文档建议使用 @latest 标签,未提供版本锁定机制,可能导致行为不一致。
来源可信度限制:维护者 rogeecn 为个人开发者,非知名组织或企业背书,虽然代码开源可查,但长期维护承诺和安全性更新缺乏保障。
网络配置门槛:要求用户自行部署 Memos 服务并正确配置 MEMOS_URL 和 API 密钥,对非技术用户存在使用门槛。本地服务地址(localhost:5230)的示例配置也可能暴露用户的本地开发环境信息。
功能边界明确:本 Skill 仅提供 CLI 使用文档,不包含 CLI 工具本身的源码或开发指导,也不处理 Memos 服务的部署和运维。
扩展性受限:作为纯文档型 Skill,无法直接扩展功能或修复 CLI 工具的底层问题,依赖上游项目的更新节奏。
适合的目标群体
开发者与技术写作者:熟悉命令行操作,需要将 Memos 集成到日常工作流中的软件工程师、DevOps 人员和技术文档维护者。
AI Agent 与自动化场景:需要将笔记管理功能嵌入自动化脚本、CI/CD 流程或 AI Agent 工具链的高级用户。
Memos 自托管用户:已部署 Memos 服务的个人或团队,寻求比 Web 界面更高效的批量操作方式。
数据隐私敏感用户:倾向于本地优先、自托管方案,不愿将笔记数据托管于第三方 SaaS 服务的用户。
使用风险
供应链安全:go install @latest 模式存在时间点攻击风险,建议用户改为固定版本号安装,并在使用前审查上游仓库代码。
凭证管理:API 密钥和 Admin 密钥通过环境变量或 .env 文件传递,存在被进程窥探或意外提交至版本控制的风险。文档已明确警告不要提交 .env 文件,但依赖用户自觉遵守。
误操作风险:memo delete 等破坏性操作虽要求 --yes 确认,但在自动化脚本中可能被强制绕过,导致数据丢失。建议生产环境操作前进行数据备份。
本地服务暴露:配置示例中的 localhost:5230 可能暗示用户 Memos 服务运行在本地,若配置不当(如绑定 0.0.0.0)可能存在未授权访问风险。
功能依赖:作为外部 CLI 的包装文档,若上游项目停止维护或引入破坏性变更,本 Skill 的指引可能失效,需持续关注依赖项目动态。
技能正文
name: memos-cli description: Use when a user needs to read, search, create, update, delete, comment on, tag, or inspect Memos data through this repository's Go CLI, especially when the agent should prefer real project commands over guessing HTTP API calls.
memos-cli — Repository Memos CLI Skill
Install: go install github.com/rogeecn/memos-cli@latest
Binary form: memos-cli
Primary purpose: Use this repository's Go CLI to perform Memos operations from the terminal.
Overview
This repository contains a Go CLI named memos for common Memos operations.
Agents should prefer this CLI when the user asks to list memos, fetch memo details, search content, apply CEL filters, create or update memos, delete memos, add comments, remove tags, or inspect users. The CLI already handles configuration loading, JSON output, memo formatting, and memo ID normalization behavior implemented in the repo.
When to Use
Use this skill when:
- The user wants to inspect or modify Memos data from this repository
- The task should use the repo's real command surface instead of handwritten HTTP requests
- The user needs terminal output or structured JSON from Memos commands
- The agent needs a safe preflight check for local config before calling Memos APIs
Do not use this skill when:
- The user is asking to develop the CLI itself rather than use it
- The task is purely about source code changes with no need to run Memos commands
Setup
Install the CLI first:
go install github.com/rogeecn/memos-cli@latest
Then run it as a normal installed binary:
memos-cli --help
Use memos-cli as the canonical entrypoint. Do not use go run . in this skill.
Configuration
IMPORTANT FOR AGENTS: Before executing any command that talks to the Memos API, first run:
memos-cli config check
The CLI reads configuration with this precedence:
- Shell environment variable
- Current directory
.env - Missing
Expected variables:
MEMOS_URL=http://localhost:5230
MEMOS_API_KEY=your-api-key
MEMOS_ADMIN_API_KEY=your-admin-api-key
DEFAULT_TAG=cli
Preflight Rules
- If
MEMOS_URLismissing, stop and ask the user for the Memos base URL - If
MEMOS_API_KEYismissing, stop and ask the user to provide or export it - If the task needs
user list, also requireMEMOS_ADMIN_API_KEY - Do not print secret values back to the user
- Do not suggest editing committed files for secrets; prefer shell env vars or local
.env
Output Format
Default: human-readable text
memos-cli memo list
memos-cli memo get <memo-id>
Structured output: --json
Use --json whenever the task needs machine-readable data, IDs for follow-up steps, or filtering with shell tools.
memos-cli --json memo list
Command Reference
Configuration
memos-cli config check
Read Operations
memos-cli memo list
memos-cli memo list --page-size 20
memos-cli memo list --page-token <token>
memos-cli memo get <memo-id>
memos-cli search "keyword"
memos-cli filter --expr "visibility == 'PRIVATE'"
memos-cli user list
Write Operations
The content field supports Markdown. Agents can pass plain text or Markdown content to memo and comment commands.
memos-cli memo create "# Weekly Note\n\n- shipped feature\n- fixed bug"
memos-cli memo create "memo content" --tag release --tag cli
memos-cli memo create "memo content" --visibility PUBLIC
memos-cli memo update <memo-id> --content "## Updated\n\nThis memo now uses **Markdown**."
memos-cli memo update <memo-id> --visibility PUBLIC
memos-cli memo delete <memo-id> --yes
memos-cli comment create <memo-id> "Looks good.\n\n- reviewed\n- approved"
memos-cli tag remove <memo-id> <tag>
Agent Workflows
List memos safely
memos-cli config check
memos-cli memo list
Note: memo list lists memos using the API default ordering. Treat it as the current list view, not a guaranteed dedicated recent command.
List memos as JSON for follow-up actions
memos-cli config check
memos-cli --json memo list
Fetch one memo before updating it
memos-cli memo get <memo-id>
memos-cli memo update <memo-id> --content "new content"
Search then inspect the matching memo
memos-cli --json search "deploy"
memos-cli memo get <memo-id>
Filter with CEL expression
memos-cli filter --expr "createTime > timestamp('2026-01-01T00:00:00Z') && visibility == 'PRIVATE'"
Paginate through memo lists
memos-cli memo list --page-size 20
memos-cli memo list --page-size 20 --page-token <next-token>
In text mode, the CLI prints Next page token: ... when another page exists. In JSON mode, inspect nextPageToken.
Create a memo with default and explicit tags
memos-cli memo create "ship checklist ready" --tag release --tag weekly
The CLI appends DEFAULT_TAG automatically when configured.
Delete a memo safely
memos-cli memo delete <memo-id> --yes
Deletion requires explicit --yes. If the user asks to delete a memo and has not clearly confirmed, ask before running it.
List users via admin API
go run . config check
go run . user list
If MEMOS_ADMIN_API_KEY is missing, stop and ask the user to provide admin credentials.
ID Rules
- Prefer passing the memo's plain ID, such as
abc123 - Do not invent
memos://or other URI forms for CLI commands comment createandtag removework with memo IDs and rely on the client behavior already implemented in the repo
Error Reference
| Error or symptom | Likely cause | Agent action |
|---|---|---|
MEMOS_URL is required |
Base URL missing | Ask user for MEMOS_URL or local .env |
MEMOS_API_KEY is required |
API key missing | Ask user for MEMOS_API_KEY |
MEMOS_ADMIN_API_KEY is required |
Admin command without admin key | Ask user for admin key before user list |
update requires --content or --visibility |
Update called with no changes | Re-run with at least one change flag |
delete requires --yes |
Delete missing confirmation flag | Re-run only after explicit confirmation |
| empty or unexpected search results | Filter/query too narrow or API data differs | Try --json and inspect returned structure |
| next page not visible | Pagination token not supplied | Re-run with --page-token |
Safety Notes
- Treat API keys as secrets; never echo them back in full
- Prefer
config checkover guessing whether configuration exists - Prefer
--jsonfor agent follow-up logic and ID extraction - Avoid destructive commands unless the user explicitly requested them
- Do not commit
.envor other local secret material
Common Mistakes
- Using
go run .orgo run ./cmd/memosinstead of the installedmemos-clibinary - Running API commands before
config check - Forgetting
--jsonwhen later steps need a memo ID or token - Assuming
memo listis a dedicatedrecentendpoint rather than the default list API - Forgetting
--yesfor deletions - Calling
user listwithout admin credentials
Quick Reference
- Install:
go install github.com/rogeecn/memos-cli@latest - Preflight:
memos-cli config check - List memos:
memos-cli memo list - List as JSON:
memos-cli --json memo list - Get one memo:
memos-cli memo get <memo-id> - Search text:
memos-cli search "keyword" - CEL filter:
memos-cli filter --expr "..." - Create memo:
memos-cli memo create "content" - Update memo:
memos-cli memo update <memo-id> --content "..." - Delete memo:
memos-cli memo delete <memo-id> --yes - Add comment:
memos-cli comment create <memo-id> "..." - Remove tag:
memos-cli tag remove <memo-id> <tag> - List users:
memos-cli user list
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。