npx skills add https://github.com/boshu2/agentops --skill learn你必须执行此工作流程。不要仅仅描述它。
手动捕获知识以供未来会话使用。无需运行完整回顾即可快速启动知识飞轮。
| 标志 | 默认值 | 描述 |
|---|---|---|
--global | 关闭 | 写入 ~/.agents/learnings/ 而非 .agents/knowledge/pending/。适用于所有项目通用的知识。 |
--promote | 关闭 | 将本地学习提升为全局知识。读取本地文件,抽象化仓库上下文,写入 ~/.agents/learnings/,并在本地文件标记 promoted_to:。 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
何时使用
--global: 适用于所有项目通用的知识(例如,语言模式、工具偏好、调试技巧)。对于仓库特定知识(例如,架构决策、本地约定),请使用默认值(无标志)。何时使用
--promote: 当现有的本地学习被发现具有可移植性时使用。该技能读取本地文件,重写以移除仓库特定引用,将抽象化版本写入~/.agents/learnings/,并在本地副本上标记promoted_to:前言,以便ao inject跳过它。
给定 /learn [内容]:
如果内容作为参数提供: 直接使用。
如果没有参数: 通过 AskUserQuestion 询问用户:"你学到了什么或想记住什么?" 然后以自由文本形式收集内容。
使用 AskUserQuestion 询问类型:
Tool: AskUserQuestion
Parameters:
questions:
- question: "这是什么类型的知识?"
header: "类型"
multiSelect: false
options:
- label: "decision"
description: "做出的选择及其原因"
- label: "pattern"
description: "可复用的方法或技巧"
- label: "learning"
description: "新发现的内容(默认)"
- label: "constraint"
description: "需要记住的规则或限制"
- label: "gotcha"
description: "需要避免的陷阱或误区"
如果用户未选择,则默认为 "learning"。
根据内容创建 slug:
检查冲突:
# 如果文件已存在,则追加 -2、-3 等
slug="<generated-slug>"
counter=2
if [[ "$GLOBAL" == "true" ]]; then
base_dir="$HOME/.agents/learnings"
else
base_dir=".agents/knowledge/pending"
fi
while [ -f "${base_dir}/$(date +%Y-%m-%d)-${slug}.md" ]; do
slug="<generated-slug>-${counter}"
((counter++))
done
# 如果 --global:写入全局模式(跨仓库)
# 否则:写入本地知识(仓库特定)
if [[ "$GLOBAL" == "true" ]]; then
mkdir -p ~/.agents/learnings
else
mkdir -p .agents/knowledge/pending
fi
路径:
.agents/knowledge/pending/YYYY-MM-DD-<slug>.md--global:~/.agents/learnings/YYYY-MM-DD-<slug>.md格式:
---
type: <classification>
source: manual
date: YYYY-MM-DD
---
# Learning: <short title>
**ID**: L1
**Category**: <classification>
**Confidence**: medium
## What We Learned
<content>
## Source
Manual capture via /learn
示例:
---
type: pattern
source: manual
date: 2026-02-16
---
# Learning: Token Bucket Rate Limiting
**ID**: L1
**Category**: pattern
**Confidence**: high
## What We Learned
Use token bucket pattern for rate limiting instead of fixed windows. Allows burst traffic while maintaining average rate limit. Implementation: bucket refills at constant rate, requests consume tokens, reject when empty.
Key advantage: smoother user experience during brief bursts.
## Source
Manual capture via /learn
如果使用 --global 或 --promote: 写入文件后,grep 查找仓库特定指示符:
file="<path-to-written-file>"
leaks=""
leaks+=$(grep -iEn '(internal/|cmd/|\.go:|/pkg/|/src/|AGENTS\.md|CLAUDE\.md)' "$file" 2>/dev/null)
leaks+=$(grep -En '[A-Z][a-z]+[A-Z][a-z]+\.(go|py|ts|rs)' "$file" 2>/dev/null)
leaks+=$(grep -En '\./[a-z]+/' "$file" 2>/dev/null)
如果找到任何匹配项:警告用户,显示匹配的行并询问是否继续或修改。这不会阻止操作——它捕获明显的仓库特定引用,如 athena/internal/validate/audit.go:32。
如果没有匹配项:静默继续。
给定 /learn --promote <path-to-local-learning>:
读取本地学习文件
重写内容以移除仓库特定引用(文件路径、函数名、包名、内部架构)。保留核心见解。
生成 slug 根据抽象化后的内容
写入抽象化版本到 ~/.agents/learnings/YYYY-MM-DD-<slug>.md
运行抽象化 lint 检查(步骤 5.5)
添加 promoted_to: 前言到本地文件:
---
promoted_to: ~/.agents/learnings/YYYY-MM-DD-<slug>.md
---
ao inject 会跳过设置了 promoted_to: 的学习,防止重复计数。
7. 确认: "已提升为全局知识:~/.agents/learnings/YYYY-MM-DD-<slug>.md"
检查是否安装了 ao:
if command -v ao &>/dev/null; then
echo "✓ Knowledge saved to <path>"
echo ""
echo "To move this into cached memory now:"
echo " ao pool ingest <path>"
echo " ao pool list --status pending"
echo " ao pool stage <candidate-id>"
echo " ao pool promote <candidate-id>"
echo ""
echo "Or let hooks run close-loop automation."
else
echo "✓ Knowledge saved to <path>"
echo ""
echo "Note: Install ao CLI to enable automatic knowledge flywheel."
fi
不要自动运行提升命令。 用户应决定何时暂存/提升。
注意: 如果设置了 --global 或 --promote,则跳过 ao CLI 集成。全局学习由 ao inject 直接从 ~/.agents/learnings/ 发现。
告知用户:
Learned: <one-line summary from content>
Saved to: .agents/knowledge/pending/YYYY-MM-DD-<slug>.md
Type: <classification>
This capture is queued for flywheel ingestion; once promoted it is available via /research and /inject.
# Learning: 块用户说: /learn "use token bucket for rate limiting"
会发生什么:
token-bucket-rate-limiting.agents/knowledge/pending/2026-02-16-token-bucket-rate-limiting.mdao pool ingest + 暂存/提升选项用户说: /learn
Agent 询问内容和类型,生成 slug never-eval-hooks,创建 .agents/knowledge/pending/2026-02-16-never-eval-hooks.md,确认保存。
用户说: /learn "bd dep add A B means A depends on B, not A blocks B"
Agent 分类为 "gotcha",生成 slug bd-dep-direction,在 pending 中创建文件,确认保存。
| 问题 | 原因 | 解决方案 |
|---|---|---|
| Slug 冲突 | 同一天同一主题 | 自动追加 -2、-3 计数器 |
| 内容过长 | 用户粘贴了大段内容 | 接受它。/learn 没有长度限制。如果内容非常大,建议使用 /retro 进行结构化提取。 |
| ao pool ingest/stage 失败 | 候选 ID 不匹配或 ao 未安装 | 显示确切的后续命令(ingest、list、stage、promote)并确认文件已保存 |
| 重复知识 | 相同的见解已被捕获 | 写入前用 grep 检查现有文件。如果重复,告知用户并显示现有路径。 |
手动捕获与自动提取使用相同的飞轮:
/learn → .agents/knowledge/pending/ → ao pool ingest → .agents/learnings/ → /inject
此技能用于快速见效。如需深入反思,请使用 /retro。
每周安装量
122
仓库
GitHub 星标数
205
首次出现
2026年2月17日
安全审计
安装于
github-copilot120
codex120
gemini-cli120
opencode120
kimi-cli118
amp118
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Capture knowledge manually for future sessions. Fast path to feed the knowledge flywheel without running a full retrospective.
| Flag | Default | Description |
|---|---|---|
--global | off | Write to ~/.agents/learnings/ instead of .agents/knowledge/pending/. Use for knowledge that applies across all projects. |
--promote | off | Promote a local learning to global. Reads local file, abstracts repo context, writes to ~/.agents/learnings/, marks local with promoted_to:. |
When to use
--global: Use for knowledge that applies across all your projects (e.g., language patterns, tooling preferences, debugging techniques). Use default (no flag) for repo-specific knowledge (e.g., architecture decisions, local conventions).When to use
--promote: Use when an existing local learning turns out to be transferable. The skill reads the local file, rewrites it to remove repo-specific references, writes the abstracted version to~/.agents/learnings/, and marks the local copy withpromoted_to:frontmatter soao injectskips it.
Given /learn [content]:
If content provided as argument: Use it directly.
If no argument: Ask the user via AskUserQuestion: "What did you learn or want to remember?" Then collect the content in free text.
Use AskUserQuestion to ask which type:
Tool: AskUserQuestion
Parameters:
questions:
- question: "What type of knowledge is this?"
header: "Type"
multiSelect: false
options:
- label: "decision"
description: "A choice that was made and why"
- label: "pattern"
description: "A reusable approach or technique"
- label: "learning"
description: "Something new discovered (default)"
- label: "constraint"
description: "A rule or limitation to remember"
- label: "gotcha"
description: "A pitfall or trap to avoid"
Default to "learning" if user doesn't choose.
Create a slug from the content:
Check for collisions:
# If file exists, append -2, -3, etc.
slug="<generated-slug>"
counter=2
if [[ "$GLOBAL" == "true" ]]; then
base_dir="$HOME/.agents/learnings"
else
base_dir=".agents/knowledge/pending"
fi
while [ -f "${base_dir}/$(date +%Y-%m-%d)-${slug}.md" ]; do
slug="<generated-slug>-${counter}"
((counter++))
done
# If --global: write to global patterns (cross-repo)
# Otherwise: write to local knowledge (repo-specific)
if [[ "$GLOBAL" == "true" ]]; then
mkdir -p ~/.agents/learnings
else
mkdir -p .agents/knowledge/pending
fi
Path:
.agents/knowledge/pending/YYYY-MM-DD-<slug>.md--global: ~/.agents/learnings/YYYY-MM-DD-<slug>.mdFormat:
---
type: <classification>
source: manual
date: YYYY-MM-DD
---
# Learning: <short title>
**ID**: L1
**Category**: <classification>
**Confidence**: medium
## What We Learned
<content>
## Source
Manual capture via /learn
Example:
---
type: pattern
source: manual
date: 2026-02-16
---
# Learning: Token Bucket Rate Limiting
**ID**: L1
**Category**: pattern
**Confidence**: high
## What We Learned
Use token bucket pattern for rate limiting instead of fixed windows. Allows burst traffic while maintaining average rate limit. Implementation: bucket refills at constant rate, requests consume tokens, reject when empty.
Key advantage: smoother user experience during brief bursts.
## Source
Manual capture via /learn
If--global or --promote: After writing the file, grep for repo-specific indicators:
file="<path-to-written-file>"
leaks=""
leaks+=$(grep -iEn '(internal/|cmd/|\.go:|/pkg/|/src/|AGENTS\.md|CLAUDE\.md)' "$file" 2>/dev/null)
leaks+=$(grep -En '[A-Z][a-z]+[A-Z][a-z]+\.(go|py|ts|rs)' "$file" 2>/dev/null)
leaks+=$(grep -En '\./[a-z]+/' "$file" 2>/dev/null)
If any matches found: WARN the user by showing the matched lines and asking whether to proceed or revise. This does NOT block — it catches obvious repo-specific references like athena/internal/validate/audit.go:32.
If no matches: proceed silently.
Given /learn --promote <path-to-local-learning>:
Read the local learning file
Rewrite content to remove repo-specific references (file paths, function names, package names, internal architecture). Preserve the core insight.
Generate slug from the abstracted content
Write abstracted version to ~/.agents/learnings/YYYY-MM-DD-<slug>.md
Run abstraction lint check (Step 5.5)
Addpromoted_to: frontmatter to the local file:
---
promoted_to: ~/.agents/learnings/YYYY-MM-DD-<slug>.md
---
ao inject skips learnings with promoted_to: set, preventing double-counting.
7. Confirm: "Promoted to global: ~/.agents/learnings/YYYY-MM-DD-<slug>.md"
Check if ao is installed:
if command -v ao &>/dev/null; then
echo "✓ Knowledge saved to <path>"
echo ""
echo "To move this into cached memory now:"
echo " ao pool ingest <path>"
echo " ao pool list --status pending"
echo " ao pool stage <candidate-id>"
echo " ao pool promote <candidate-id>"
echo ""
echo "Or let hooks run close-loop automation."
else
echo "✓ Knowledge saved to <path>"
echo ""
echo "Note: Install ao CLI to enable automatic knowledge flywheel."
fi
Do NOT auto-run promotion commands. The user should decide when to stage/promote.
Note: If --global or --promote is set, skip ao CLI integration. Global learnings are discovered directly by ao inject from ~/.agents/learnings/.
Tell the user:
Learned: <one-line summary from content>
Saved to: .agents/knowledge/pending/YYYY-MM-DD-<slug>.md
Type: <classification>
This capture is queued for flywheel ingestion; once promoted it is available via /research and /inject.
# Learning: block with category/confidenceUser says: /learn "use token bucket for rate limiting"
What happens:
token-bucket-rate-limiting.agents/knowledge/pending/2026-02-16-token-bucket-rate-limiting.mdao pool ingest + stage/promote optionsUser says: /learn
Agent asks for content and type, generates slug never-eval-hooks, creates .agents/knowledge/pending/2026-02-16-never-eval-hooks.md, confirms save.
User says: /learn "bd dep add A B means A depends on B, not A blocks B"
Agent classifies as "gotcha", generates slug bd-dep-direction, creates file in pending, confirms save.
| Problem | Cause | Solution |
|---|---|---|
| Slug collision | Same topic on same day | Append -2, -3 counter automatically |
| Content too long | User pasted large block | Accept it. /learn has no length limit. Suggest /retro for structured extraction if very large. |
| ao pool ingest/stage fails | Candidate ID mismatch or ao not installed | Show exact next commands (ingest, list, stage, promote) and confirm file was saved |
| Duplicate knowledge |
Manual captures feed the same flywheel as automatic extraction:
/learn → .agents/knowledge/pending/ → ao pool ingest → .agents/learnings/ → /inject
This skill is for quick wins. For deeper reflection, use /retro.
Weekly Installs
122
Repository
GitHub Stars
205
First Seen
Feb 17, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot120
codex120
gemini-cli120
opencode120
kimi-cli118
amp118
AI 代码实施计划编写技能 | 自动化开发任务分解与 TDD 流程规划工具
50,900 周安装
| Same insight already captured |
| Check existing files with grep before writing. If duplicate, tell user and show existing path. |