harvest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Harvest

Harvest

Capture high-signal conversation knowledge into
docs/notes/
for reuse across sessions.
Terminology:
harvest
is the skill name (the action of capturing knowledge). The second brain it builds belongs to the project — name it
[Project Name] Second Brain
, not "Harvest".
将高价值对话知识捕获到
docs/notes/
目录中,以便在不同会话间复用。
术语说明
harvest
是技能名称(即捕获知识的操作)。它构建的第二大脑属于项目,命名为
[Project Name] Second Brain
,而非“Harvest”。

When to Trigger

触发时机

Explicit request:
  • "harvest", "/harvest"
  • "harvest this", "harvest this conversation"
  • "save this to second brain"
  • "document this work", "capture this knowledge"
Natural breakpoints — AI may suggest (never auto-execute):
  • Significant decision made
  • Complex problem solved after multiple attempts
  • Important lesson learned
  • Discussion wrapping up with valuable content
We just [made a decision/solved X/learned Y].
Would you like me to update the second brain?
Wait for user confirmation. Never auto-execute.
明确请求
  • "harvest"、"/harvest"
  • "harvest this"、"harvest this conversation"
  • "save this to second brain"
  • "document this work"、"capture this knowledge"
自然断点——AI可建议(绝不能自动执行):
  • 做出重大决策时
  • 多次尝试后解决复杂问题时
  • 学到重要经验时
  • 讨论结束且内容有价值时
我们刚刚[做出了一项决策/解决了问题X/学到了经验Y]。
是否需要我更新第二大脑?
等待用户确认,绝不能自动执行。

Non-Negotiables

不可违背规则

  • Never auto-execute. Always wait for explicit user confirmation.
  • Use template files as the single source of structure.
  • Keep
    context_id
    in frontmatter for smart merge.
  • Keep MOCs as index files: link to context anchors, do not duplicate full lesson content.
  • Omit optional empty sections. Do not write empty headers or "None" placeholders.
  • Keep behavior logic in this file; keep structure/manifest data in
    references/
    .
  • Use list-first formatting for context content. Use tables only for short, fixed-width, easy-to-scan fields.
  • 绝不能自动执行,始终等待用户明确确认。
  • 将模板文件作为结构的唯一来源。
  • 在前置元数据中保留
    context_id
    以实现智能合并。
  • 将MOC作为索引文件:链接到上下文锚点,不要复制完整的经验内容。
  • 省略可选的空章节,不要写入空标题或“无”占位符。
  • 行为逻辑保留在本文件中;结构/清单数据存放在
    references/
    目录下。
  • 上下文内容优先使用列表格式。仅在字段简短、固定宽度且易于扫描时使用表格。

Quick Start

快速开始

  1. Ensure
    docs/notes/
    exists (initialize when missing).
  2. Run lesson review for this harvest run.
  3. Detect
    context_id
    and check whether matching context file exists.
  4. Create new context or smart-merge existing context.
  5. Update
    docs/notes/00-INDEX.md
    and related MOCs.
  6. Confirm created/updated files to user.
  1. 确保
    docs/notes/
    目录存在(若缺失则初始化)。
  2. 针对本次Harvest运行进行经验回顾。
  3. 检测
    context_id
    并检查是否存在匹配的上下文文件。
  4. 创建新上下文或智能合并现有上下文。
  5. 更新
    docs/notes/00-INDEX.md
    及相关MOC文件。
  6. 向用户确认已创建/更新的文件。

Workflow

工作流程

Phase 1: Prepare

阶段1:准备

  1. Initialize second brain storage when
    docs/notes/
    is missing:
    • Use references/initialization-manifest.md as the single source for initialization inventory.
    • Follow idempotent behavior: create missing files/directories, preserve existing files unless explicit update is requested.
    • Check
      AGENTS.md
      then
      CLAUDE.md
      ; if both exist or neither exists, ask user which file to append, then append section from references/agents-lessons-section.md.
    • Do not own or maintain
      .base
      template syntax in this skill. If
      obsidian-bases
      is available, delegate default base-file creation to
      obsidian-bases
      using references/bases-generation-spec.md.
  2. Mandatory lesson review for this harvest run:
    • Read
      docs/notes/00-INDEX.md
      when available.
    • Scan
      docs/notes/mocs/lessons-learned.md
      when available.
    • Apply matched lessons (tech, operation type, error pattern).
  1. docs/notes/
    目录缺失时初始化第二大脑存储:
    • 以[references/initialization-manifest.md]作为初始化清单的唯一来源。
    • 遵循幂等行为:创建缺失的文件/目录,除非明确要求更新,否则保留现有文件。
    • 检查
      AGENTS.md
      CLAUDE.md
      ;若两者都存在或都不存在,询问用户要追加到哪个文件,然后从[references/agents-lessons-section.md]追加内容。
    • 本技能不负责维护
      .base
      模板语法。若
      obsidian-bases
      可用,将默认基础文件的生成委托给
      obsidian-bases
      ,使用[references/bases-generation-spec.md]。
  2. 针对本次Harvest运行进行强制经验回顾:
    • docs/notes/00-INDEX.md
      存在则阅读该文件。
    • docs/notes/mocs/lessons-learned.md
      存在则扫描该文件。
    • 应用匹配的经验(技术、操作类型、错误模式)。

Phase 2: Detect + Route

阶段2:检测与路由

  1. Build
    context_id
    :
    • Prefer helper script
      scripts/context_id.py
      (Python stdlib only, no third-party packages).
    • Default call:
      python3 scripts/context_id.py --format json
      (or
      python
      when
      python3
      is unavailable).
    • Stateless policy (no state file): env keys (
      OPENCODE_*_ID
      /
      *_ID
      ) -> optional
      --infer-latest-session
      -> generated
      ctx-YYYYMMDDHHMMSS-<hex6>
      .
    • Do not pass
      --infer-latest-session
      by default. Use it only when the user explicitly requests latest-session inference.
    • If script is unavailable or fails, use inline fallback: first env var matching
      *SESSION*ID*
      /
      *CONVERSATION*ID*
      /
      *THREAD*ID*
      ; otherwise generate
      ctx-YYYYMMDDHHMMSS-<hex6>
      .
  2. Look for
    docs/notes/contexts/<context_id>-*.md
    .
ConditionAction
Matching context file existsRun Phase 4 (Smart Merge)
No matching context fileRun Phase 3 (New Context)
User rejects suggested filenameAsk for new slug and regenerate filename
User cancels confirmationStop without writing files
  1. 生成
    context_id
    • 优先使用辅助脚本
      scripts/context_id.py
      (仅使用Python标准库,无第三方依赖)。
    • 默认调用方式:
      python3 scripts/context_id.py --format json
      (若
      python3
      不可用则使用
      python
      )。
    • 无状态策略(无状态文件):环境变量(
      OPENCODE_*_ID
      /
      *_ID
      )→ 可选
      --infer-latest-session
      → 生成
      ctx-YYYYMMDDHHMMSS-<hex6>
    • 默认不传递
      --infer-latest-session
      参数,仅当用户明确请求最新会话推断时使用。
    • 若脚本不可用或执行失败,使用内联回退方案:优先匹配
      *SESSION*ID*
      /
      *CONVERSATION*ID*
      /
      *THREAD*ID*
      的环境变量;否则生成
      ctx-YYYYMMDDHHMMSS-<hex6>
  2. 查找
    docs/notes/contexts/<context_id>-*.md
    文件。
条件操作
存在匹配的上下文文件执行阶段4(智能合并)
无匹配的上下文文件执行阶段3(新上下文)
用户拒绝建议的文件名询问新的slug并重新生成文件名
用户取消确认停止操作,不写入任何文件

Phase 3: New Context

阶段3:新上下文

  1. Extract high-signal items: work, decisions (with rationale), unsolved, lessons, optional source notes.
    • Use stable item IDs for merge safety:
      D-*
      ,
      Q-*
      ,
      LL-*
      .
    • Keep technical signal high: merge routine process/SOP chatter into one short note instead of many standalone decisions.
    • If planning files (
      task_plan.md
      ,
      findings.md
      ,
      progress.md
      ) are present, capture medium-density snapshots (
      conclusion + evidence + source note
      ) into context content.
    • Do not copy full planning files. Do not create Obsidian wikilinks to files outside
      docs/notes/
      .
    • Exclude harvest-process artifacts from captured knowledge (command menus, filename suggestion prompts, merge/update status lines, and other capture bookkeeping).
  2. Generate filename
    <context_id>-<topic-slug>.md
    and confirm:
Found: [N] decisions, [N] unsolved, [N] lessons
Suggested: contexts/<context_id>-<topic-slug>.md
1. Use this  2. Change slug  3. Cancel
  1. Create
    docs/notes/contexts/<filename>.md
    from references/context-template.md.
  2. Use
    obsidian-markdown
    when available for wikilinks/frontmatter/anchors.
  3. Update
    docs/notes/00-INDEX.md
    according to references/index-template.md:
    • Recent Updates (top 5), Topics, Key Decisions, Open Questions, Recent Lessons, Stats.
  4. Manage MOCs:
    • Lessons MOC: for error-related lessons (>15 min impact), ensure
      docs/notes/mocs/lessons-learned.md
      exists via references/lessons-learned-moc-template.md, then append links only.
    • Topic MOC: when a topic appears in 3+ contexts without MOC, ask user first; create from references/moc-template.md after confirmation.
  5. Confirm:
✓ Created: contexts/<filename>.md
✓ Updated: 00-INDEX.md
✓ Updated: mocs/lessons-learned.md (when relevant)
✓ Created: mocs/<topic>.md (when relevant)
  1. 提取高价值内容:工作内容、决策(含理由)、未解决问题、经验、可选的源笔记。
    • 使用稳定的条目ID确保合并安全:
      D-*
      Q-*
      LL-*
    • 保持技术价值密度:将常规流程/SOP对话合并为一条简短笔记,而非多个独立决策。
    • 若存在规划文件(
      task_plan.md
      findings.md
      progress.md
      ),将中等密度快照(
      结论+证据+源笔记
      )捕获到上下文内容中。
    • 不要复制完整的规划文件。不要创建指向
      docs/notes/
      目录外文件的Obsidian维基链接。
    • 排除Harvest流程相关的 artifacts(命令菜单、文件名建议提示、合并/更新状态行及其他捕获操作记录)。
  2. 生成文件名
    <context_id>-<topic-slug>.md
    并确认:
已提取:[N]项决策,[N]个未解决问题,[N]条经验
建议文件名:contexts/<context_id>-<topic-slug>.md
1. 使用此文件名  2. 修改slug  3. 取消
  1. 基于[references/context-template.md]创建
    docs/notes/contexts/<filename>.md
    文件。
  2. obsidian-markdown
    可用,使用其生成维基链接/前置元数据/锚点。
  3. 根据[references/index-template.md]更新
    docs/notes/00-INDEX.md
    • 最近更新(前5条)、主题、关键决策、未解决问题、近期经验、统计数据。
  4. 管理MOC文件:
    • 经验MOC:对于影响时间超过15分钟的错误相关经验,确保
      docs/notes/mocs/lessons-learned.md
      通过[references/lessons-learned-moc-template.md]存在,然后仅追加链接。
    • 主题MOC:当某个主题出现在3个以上上下文但无对应MOC时,先询问用户;确认后基于[references/moc-template.md]创建。
  5. 确认完成:
✓ 已创建:contexts/<filename>.md
✓ 已更新:00-INDEX.md
✓ 已更新:mocs/lessons-learned.md(若相关)
✓ 已创建:mocs/<topic>.md(若相关)

Phase 4: Smart Merge

阶段4:智能合并

  1. Read the existing context file.
  2. Merge new items from current conversation.
SectionExisting TopicNew Item
Decisions MadeMatch by
D-*
first, update entry and preserve anchor
Append
Still UnsolvedMatch by
Q-*
; move resolved items to Decisions with trace
Append
Lessons LearnedMatch by
LL-*
first; merge same lesson and preserve anchor
Append
What We Worked OnKeep existingAppend
Source NotesMerge by source note signature if duplicatedAppend
  1. Update frontmatter (
    updated
    , tags), keep
    created
    unchanged.
  2. Update
    00-INDEX.md
    stats and recent updates.
  3. Update
    mocs/lessons-learned.md
    with links only when new error-related lessons were added.
  4. Confirm:
✓ Updated: contexts/<filename>.md
Changes: [added/updated/moved items]
  1. 读取现有上下文文件。
  2. 合并当前对话中的新条目。
章节现有主题新条目
已做出的决策优先按
D-*
匹配,更新条目并保留锚点
追加
未解决问题
Q-*
匹配;将已解决的条目移动到决策章节并保留追踪记录
追加
学到的经验优先按
LL-*
匹配;合并相同经验并保留锚点
追加
我们的工作内容保留现有内容追加
源笔记按源笔记签名合并重复内容追加
  1. 更新前置元数据(
    updated
    、标签),保留
    created
    字段不变。
  2. 更新
    00-INDEX.md
    中的统计数据和最近更新。
  3. 若添加了新的错误相关经验,仅更新
    mocs/lessons-learned.md
    中的链接。
  4. 确认完成:
✓ 已更新:contexts/<filename>.md
变更内容:[添加/更新/移动的条目]

Content Quality Rules

内容质量规则

  • Quality over quantity: concise, reusable, high-signal notes.
  • One idea per bullet; include rationale for decisions.
  • Keep content relevant for future reuse (3+ months horizon).
  • Skip raw transcripts, dead ends without insight, and obvious process noise.
  • Exclude harvest operational chatter: confirmation menus,
    created/updated/skipped
    summaries, and "how harvest processed this" narration unless it records a reusable lesson.
  • Use stable IDs (
    D-*
    ,
    Q-*
    ,
    LL-*
    ) with anchored headings for merge-safe entries.
  • Prefer list-first sections for long text. Use tables only when each cell stays short (for example
    ID | Question | Next
    ).
  • Avoid duplicate restatement: decision headings should carry title intent; item body should add why/impact.
  • For lessons, default to compact triad (
    Issue
    ,
    Root Cause
    ,
    Fix
    ); add
    Guardrail
    /
    Apply When
    only when they provide non-obvious value.
  • Avoid repeating
    Related
    links on every item; prefer one section-level related MOC link.
  • Omit low-signal metadata (
    Deadline
    ,
    Carry-Over
    ) unless it materially changes follow-up decisions.
  • For carry-over items from prior sessions, label clearly and avoid presenting them as new outcomes.
  • For planning-derived content, store medium-density snapshots (
    conclusion + evidence + source note
    ) in context files; avoid external-file wikilinks outside
    docs/notes/
    .
Recommended section limits:
SectionRequirementTypical Size
SummaryRequired1-2 sentences
What We Worked OnRequired5-7 bullets
DecisionsOptionalup to 5 items
Still UnsolvedOptionalup to 3-5 items
Lessons LearnedOptionalup to 3 items
Source NotesOptionalup to 3-5 items
NotesOptionalshort snippets only

  • 质量优先:简洁、可复用、高价值的笔记。
  • 每个项目符号对应一个想法;决策需包含理由。
  • 内容需对未来复用有价值(以3个月以上为视角)。
  • 跳过原始转录、无洞见的死胡同和明显的流程噪音。
  • 排除Harvest操作相关的对话:确认菜单、
    已创建/已更新/已跳过
    摘要、以及“Harvest如何处理此内容”的说明,除非这些内容记录了可复用的经验。
  • 使用稳定ID(
    D-*
    Q-*
    LL-*
    )和锚定标题确保条目可安全合并。
  • 长文本章节优先使用列表格式。仅当每个单元格内容简短时使用表格(例如
    ID | 问题 | 下一步
    )。
  • 避免重复表述:决策标题应明确意图;条目正文补充原因/影响。
  • 经验内容默认使用紧凑三元组(
    问题
    根本原因
    解决方案
    );仅当
    防护措施
    /
    适用场景
    提供非显而易见的价值时才添加。
  • 避免在每个条目上重复
    相关
    链接;优先使用章节级别的相关MOC链接。
  • 省略低价值元数据(
    截止日期
    待跟进
    ),除非这些内容会实质性影响后续决策。
  • 对于来自之前会话的待跟进条目,需明确标注,避免呈现为新成果。
  • 对于来自规划文件的内容,在上下文文件中存储中等密度快照(
    结论+证据+源笔记
    );避免创建指向
    docs/notes/
    目录外文件的外部维基链接。
推荐章节限制:
章节要求典型规模
摘要必填1-2句话
我们的工作内容必填5-7个项目符号
决策可选最多5项
未解决问题可选最多3-5项
学到的经验可选最多3项
源笔记可选最多3-5项
备注可选仅简短片段

Integration

集成

Recommended:
obsidian-markdown
skill for enhanced Obsidian compatibility. Without it, AI may write files directly and suggest installation:
For optimal Obsidian compatibility, consider installing obsidian-markdown skill:
npx skills add <obsidian-markdown-repo>
Optional companion:
obsidian-bases
for
.base
file generation.
  • This skill does not own
    .base
    syntax templates.
  • When
    obsidian-bases
    is available, delegate generation of default base files to that skill.
  • Keep desired base content in references/bases-generation-spec.md, not
    .base
    syntax templates.
  • If
    obsidian-bases
    is unavailable, skip
    .base
    creation and continue markdown-only harvest flow.
Optional companion:
planning-with-files
for stronger in-progress capture.
  • This skill remains fully functional without it.
  • When available, this skill may consume planning outputs (
    task_plan.md
    ,
    findings.md
    ,
    progress.md
    ) as snapshot sources, then persist reusable knowledge into
    docs/notes/contexts/
    .
  • Prefer provenance text over external links when planning files are outside Obsidian vault scope.
推荐:使用
obsidian-markdown
技能增强Obsidian兼容性。若未安装,AI可直接写入文件并建议安装:
为获得最佳Obsidian兼容性,建议安装obsidian-markdown技能:
npx skills add <obsidian-markdown-repo>
可选配套工具
obsidian-bases
用于生成
.base
文件。
  • 本技能不负责
    .base
    语法模板。
  • obsidian-bases
    可用,将默认基础文件的生成委托给该技能。
  • 将所需基础内容存储在[references/bases-generation-spec.md]中,而非
    .base
    语法模板。
  • obsidian-bases
    不可用,跳过
    .base
    文件创建,继续仅使用Markdown的Harvest流程。
可选配套工具
planning-with-files
用于增强进行中的内容捕获。
  • 即使没有该工具,本技能仍可完全正常工作。
  • 若可用,本技能可将规划输出(
    task_plan.md
    findings.md
    progress.md
    )作为快照来源,然后将可复用知识持久化到
    docs/notes/contexts/
    目录中。
  • 若规划文件在Obsidian库范围外,优先使用来源说明文本而非外部链接。

See Also

另请参阅

Use these files as references (single source for structure and formats).
  • context-template.md
  • moc-template.md
  • index-template.md
  • lessons-learned-moc-template.md
  • bases-generation-spec.md
  • agents-lessons-section.md
  • initialization-manifest.md
  • context_id.py
以下文件作为参考(结构和格式的唯一来源)。
  • context-template.md
  • moc-template.md
  • index-template.md
  • lessons-learned-moc-template.md
  • bases-generation-spec.md
  • agents-lessons-section.md
  • initialization-manifest.md
  • context_id.py