extract
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExtract Skill
提取Skill
Typically runs automatically via SessionStart hook.
Process pending learning extractions from previous sessions.
通常通过SessionStart钩子自动运行。
处理之前会话中待完成的经验提取任务。
How It Works
工作原理
The SessionStart hook runs:
bash
ao extractThis checks for queued extractions and outputs prompts for Claude to process.
SessionStart钩子会执行:
bash
ao extract这会检查队列中的待提取任务,并输出提示信息供Claude处理。
Manual Execution
手动执行
Given :
/extract输入后:
/extractStep 1: Check for Pending Extractions
步骤1:检查待处理的提取任务
bash
ao extract 2>/dev/nullOr check the pending queue:
bash
cat .agents/ao/pending.jsonl 2>/dev/null | head -5bash
ao extract 2>/dev/null或者检查待处理队列:
bash
cat .agents/ao/pending.jsonl 2>/dev/null | head -5Step 2: Process Each Pending Item
步骤2:处理每个待处理项
For each queued session:
- Read the session summary
- Extract actionable learnings
- Write to
.agents/learnings/
对于队列中的每个会话:
- 读取会话摘要
- 提取可落地的经验总结
- 写入到目录
.agents/learnings/
Step 3: Write Learnings
步骤3:写入经验总结
Write to:
.agents/learnings/YYYY-MM-DD-<session-id>.mdmarkdown
undefined写入路径:
.agents/learnings/YYYY-MM-DD-<session-id>.mdmarkdown
undefinedLearning: <Short Title>
Learning: <简短标题>
ID: L1
Category: <debugging|architecture|process|testing|security>
Confidence: <high|medium|low>
ID: L1
Category: <debugging|architecture|process|testing|security>
Confidence: <high|medium|low>
What We Learned
我们的收获
<1-2 sentences describing the insight>
<1-2句话描述洞察内容>
Why It Matters
重要性
<1 sentence on impact/value>
<1句话说明影响/价值>
Source
来源
Session: <session-id>
undefinedSession: <session-id>
undefinedStep 3.5: Validate Learnings
步骤3.5:验证经验总结
After writing learning files, validate each has required fields:
- Scan newly written files:
bash
ls -t .agents/learnings/YYYY-MM-DD-*.md 2>/dev/null | head -5-
For each file, check required fields:
- Heading: File must start with (non-empty title)
# Learning: <title> - Category: Must contain where value is one of:
**Category**: <value>,debugging,architecture,process,testingsecurity - Confidence: Must contain where value is one of:
**Confidence**: <value>,high,mediumlow - Content: Must contain a section with at least one non-empty line after the heading
## What We Learned
- Heading: File must start with
-
Report validation results:
- For each valid learning: "✓ <filename>: valid"
- For each invalid learning: "⚠ <filename>: missing <field>" (list each missing field)
-
Do NOT delete or retry invalid learnings. Log the warning and proceed. Invalid learnings are still better than no learnings — the warning helps identify extraction quality issues over time.
写入经验总结文件后,验证每个文件是否包含必填字段:
- 扫描新写入的文件:
bash
ls -t .agents/learnings/YYYY-MM-DD-*.md 2>/dev/null | head -5-
对每个文件,检查必填字段:
- 标题: 文件必须以开头(标题不能为空)
# Learning: <标题> - 分类: 必须包含,其中值为以下之一:
**Category**: <值>、debugging、architecture、process、testingsecurity - 置信度: 必须包含,其中值为以下之一:
**Confidence**: <值>、high、mediumlow - 内容: 必须包含章节,且标题后至少有一行非空内容
## 我们的收获
- 标题: 文件必须以
-
报告验证结果:
- 对于每个有效的经验总结:"✓ <文件名>: 有效"
- 对于每个无效的经验总结:"⚠ <文件名>: 缺失<字段>"(列出每个缺失的字段)
-
不要删除或重试无效的经验总结。 记录警告并继续执行。无效的经验总结总比没有好——警告有助于长期识别提取质量问题。
Step 4: Clear the Queue
步骤4:清空队列
bash
ao extract --clear 2>/dev/nullbash
ao extract --clear 2>/dev/nullStep 5: Report Completion
步骤5:报告完成情况
Tell the user:
- Number of learnings extracted
- Key insights
- Location of learning files
告知用户:
- 提取的经验总结数量
- 关键洞察内容
- 经验总结文件的存储位置
The Knowledge Loop
知识循环
Session N ends:
→ ao forge --last-session --queue
→ Session queued in pending.jsonl
Session N+1 starts:
→ ao extract (this skill)
→ Claude processes the queue
→ Writes to .agents/learnings/
→ Validates required fields
→ Loop closed会话N结束:
→ ao forge --last-session --queue
→ 会话被加入pending.jsonl队列
会话N+1开始:
→ ao extract(本Skill)
→ Claude处理队列
→ 写入.agents/learnings/目录
→ 验证必填字段
→ 循环完成Key Rules
核心规则
- Runs automatically - usually via hook
- Process the queue - don't leave extractions pending
- Be specific - actionable learnings, not vague observations
- Close the loop - extraction completes the knowledge cycle
- 自动运行 - 通常通过钩子触发
- 处理队列 - 不要让提取任务处于待处理状态
- 具体明确 - 提取可落地的经验总结,而非模糊的观察
- 闭环管理 - 提取完成整个知识循环