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:
CODEBLOCK0
Then run it as a normal installed binary:
CODEBLOCK1
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:
CODEBLOCK2
The CLI reads configuration with this precedence:
- 1. Shell environment variable
- Current directory INLINECODE5
- Missing
Expected variables:
CODEBLOCK3
Preflight Rules
- - If
MEMOS_URL is missing, stop and ask the user for the Memos base URL - If
MEMOS_API_KEY is missing, stop and ask the user to provide or export it - If the task needs
user list, also require INLINECODE11 - Do not print secret values back to the user
- Do not suggest editing committed files for secrets; prefer shell env vars or local INLINECODE12
Output Format
Default: human-readable text
CODEBLOCK4
Structured output: --json
Use --json whenever the task needs machine-readable data, IDs for follow-up steps, or filtering with shell tools.
CODEBLOCK5
Command Reference
Configuration
CODEBLOCK6
Read Operations
CODEBLOCK7
Write Operations
The content field supports Markdown. Agents can pass plain text or Markdown content to memo and comment commands.
CODEBLOCK8
Agent Workflows
List memos safely
CODEBLOCK9
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
CODEBLOCK10
Fetch one memo before updating it
CODEBLOCK11
Search then inspect the matching memo
CODEBLOCK12
Filter with CEL expression
CODEBLOCK13
Paginate through memo lists
CODEBLOCK14
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
CODEBLOCK15
The CLI appends DEFAULT_TAG automatically when configured.
Delete a memo safely
CODEBLOCK16
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
CODEBLOCK17
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 INLINECODE23
- Do not invent
memos:// or other URI forms for CLI commands - INLINECODE25 and
tag remove work with memo IDs and rely on the client behavior already implemented in the repo
Error Reference
| Error or symptom | Likely cause | Agent action |
|---|
| INLINECODE27 | Base URL missing | Ask user for MEMOS_URL or local INLINECODE29 |
| INLINECODE30 |
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 check over guessing whether configuration exists - Prefer
--json for agent follow-up logic and ID extraction - Avoid destructive commands unless the user explicitly requested them
- Do not commit
.env or other local secret material
Common Mistakes
- - Using
go run . or go run ./cmd/memos instead of the installed memos-cli binary - Running API commands before INLINECODE44
- Forgetting
--json when later steps need a memo ID or token - Assuming
memo list is a dedicated recent endpoint rather than the default list API - Forgetting
--yes for deletions - Calling
user list without admin credentials
Quick Reference
- - Install: INLINECODE50
- Preflight: INLINECODE51
- List memos: INLINECODE52
- List as JSON: INLINECODE53
- Get one memo: INLINECODE54
- Search text: INLINECODE55
- CEL filter: INLINECODE56
- Create memo: INLINECODE57
- Update memo: INLINECODE58
- Delete memo: INLINECODE59
- Add comment: INLINECODE60
- Remove tag: INLINECODE61
- List users: INLINECODE62
memos-cli — 仓库备忘录 CLI 技能
安装: go install github.com/rogeecn/memos-cli@latest
二进制形式: memos-cli
主要用途: 使用此仓库的 Go CLI 从终端执行 Memos 操作。
概述
此仓库包含一个名为 memos 的 Go CLI,用于常见的 Memos 操作。
当用户要求列出备忘录、获取备忘录详情、搜索内容、应用 CEL 过滤器、创建或更新备忘录、删除备忘录、添加评论、移除标签或查看用户时,代理应优先使用此 CLI。该 CLI 已处理仓库中实现的配置加载、JSON 输出、备忘录格式化和备忘录 ID 规范化行为。
何时使用
在以下情况下使用此技能:
- - 用户想要检查或修改此仓库中的 Memos 数据
- 任务应使用仓库的真实命令接口而非手写 HTTP 请求
- 用户需要来自 Memos 命令的终端输出或结构化 JSON
- 代理在调用 Memos API 前需要对本地配置进行安全预检
在以下情况下不要使用此技能:
- - 用户要求开发 CLI 本身而非使用它
- 任务纯粹涉及源代码更改,无需运行 Memos 命令
设置
首先安装 CLI:
bash
go install github.com/rogeecn/memos-cli@latest
然后作为正常安装的二进制文件运行:
bash
memos-cli --help
使用 memos-cli 作为规范入口点。在此技能中不要使用 go run .。
配置
对代理的重要提示: 在执行任何与 Memos API 通信的命令之前,首先运行:
bash
memos-cli config check
CLI 按以下优先级读取配置:
- 1. Shell 环境变量
- 当前目录 .env
- 缺失
预期变量:
env
MEMOS_URL=http://localhost:5230
MEMOSAPIKEY=your-api-key
MEMOSADMINAPI_KEY=your-admin-api-key
DEFAULT_TAG=cli
预检规则
- - 如果 MEMOSURL 为 missing,停止并询问用户 Memos 基础 URL
- 如果 MEMOSAPIKEY 为 missing,停止并询问用户提供或导出它
- 如果任务需要 user list,还需要 MEMOSADMINAPIKEY
- 不要将秘密值完整回显给用户
- 不要建议编辑已提交的文件来存储秘密;优先使用 shell 环境变量或本地 .env
输出格式
默认:人类可读文本
bash
memos-cli memo list
memos-cli memo get
结构化输出:--json
当任务需要机器可读数据、后续步骤的 ID 或使用 shell 工具进行过滤时,使用 --json。
bash
memos-cli --json memo list
命令参考
配置
bash
memos-cli config check
读取操作
bash
memos-cli memo list
memos-cli memo list --page-size 20
memos-cli memo list --page-token
memos-cli memo get
memos-cli search keyword
memos-cli filter --expr visibility == PRIVATE
memos-cli user list
写入操作
content 字段支持 Markdown。代理可以向备忘录和评论命令传递纯文本或 Markdown 内容。
bash
memos-cli memo create # 周记\n\n- 发布了功能\n- 修复了 bug
memos-cli memo create 备忘录内容 --tag release --tag cli
memos-cli memo create 备忘录内容 --visibility PUBLIC
memos-cli memo update --content ## 已更新\n\n此备忘录现在使用 Markdown。
memos-cli memo update --visibility PUBLIC
memos-cli memo delete --yes
memos-cli comment create 看起来不错。\n\n- 已审查\n- 已批准
memos-cli tag remove
代理工作流
安全列出备忘录
bash
memos-cli config check
memos-cli memo list
注意:memo list 使用 API 默认排序列出备忘录。将其视为当前列表视图,而非保证的专用 recent 命令。
以 JSON 格式列出备忘录以供后续操作
bash
memos-cli config check
memos-cli --json memo list
更新前获取一个备忘录
bash
memos-cli memo get
memos-cli memo update --content 新内容
搜索后检查匹配的备忘录
bash
memos-cli --json search deploy
memos-cli memo get
使用 CEL 表达式过滤
bash
memos-cli filter --expr createTime > timestamp(2026-01-01T00:00:00Z) && visibility == PRIVATE
分页浏览备忘录列表
bash
memos-cli memo list --page-size 20
memos-cli memo list --page-size 20 --page-token
在文本模式下,当存在下一页时,CLI 会打印 Next page token: ...。在 JSON 模式下,检查 nextPageToken。
使用默认和显式标签创建备忘录
bash
memos-cli memo create 发布检查清单已就绪 --tag release --tag weekly
配置后,CLI 会自动追加 DEFAULT_TAG。
安全删除备忘录
bash
memos-cli memo delete --yes
删除需要显式的 --yes。如果用户要求删除备忘录但未明确确认,请在运行前询问。
通过管理 API 列出用户
bash
go run . config check
go run . user list
如果 MEMOSADMINAPI_KEY 缺失,停止并询问用户提供管理员凭据。
ID 规则
- - 优先传递备忘录的纯 ID,例如 abc123
- 不要为 CLI 命令发明 memos:// 或其他 URI 形式
- comment create 和 tag remove 使用备忘录 ID,并依赖于仓库中已实现的客户端行为
错误参考
| 错误或症状 | 可能原因 | 代理操作 |
|---|
| MEMOSURL is required | 基础 URL 缺失 | 询问用户 MEMOSURL 或本地 .env |
| MEMOSAPIKEY is required |
API 密钥缺失 | 询问用户 MEMOS
APIKEY |
| MEMOS
ADMINAPI_KEY is required | 没有管理密钥的管理命令 | 在 user list 前询问用户管理密钥 |
| update requires --content or --visibility | 调用更新但无更改 | 重新运行并至少带一个更改标志 |
| delete requires --yes | 删除缺少确认标志 | 仅在明确确认后重新运行 |
| 搜索结果为空或意外 | 过滤器/查询范围过窄或 API 数据不同 | 尝试 --json 并检查返回的结构 |
| 下一页不可见 | 未提供分页令牌 | 使用 --page-token 重新运行 |
安全注意事项
- - 将 API 密钥视为秘密;切勿完整回显它们
- 优先使用 config check 而非猜测配置是否存在
- 对于代理后续逻辑和 ID 提取,优先使用 --json
- 除非用户明确要求,否则避免破坏性命令
- 不要提交 .env 或其他本地秘密材料
常见错误
- - 使用 go run . 或 go run ./cmd/memos 而非已安装的 memos-cli 二进制文件
- 在 config check 之前运行 API 命令
- 当后续步骤需要备忘录 ID 或令牌时忘记使用 --json
- 假设 memo list 是专用的 recent 端点而非默认列表 API
- 删除时忘记 --yes
- 没有管理凭据就调用 user list
快速参考
- - 安装:go install github.com/rogeecn/memos-cli@latest
- 预检:memos-cli config check
- 列出备忘录:memos-cli memo list
- 以 JSON 列出:memos-cli --json memo list
- 获取一个备忘录:memos-cli memo get
- 搜索文本:memos-cli search keyword
- CEL 过滤:memos-cli filter --expr ...
- 创建备忘录:memos-cli memo create 内容
- 更新备忘录:memos-cli memo update