harvest-sessions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Harvest sessions (one tick)

会话收割(单次执行)

One pass over every session newer than the watermark, then stop. acron owns recurrence; never schedule yourself.
This is the unattended backstop for the capture rule in the global
AGENTS.md
: that rule fires in the moment and depends on an agent noticing, so it misses whatever nobody noticed. This pass reads the transcripts those sessions left behind and files what they should have filed.
State lives in a watermark file, so a tick is idempotent: a quiet day costs one scan and exits.
遍历所有晚于水印时间的会话,然后停止。由acron负责重复执行;请勿自行设置定时任务。
这是全局
AGENTS.md
中捕获规则的无人值守后备机制:该规则会实时触发,但依赖于Agent的识别,因此会遗漏所有未被注意到的内容。本次执行会读取会话留下的记录,并归档那些本应被归档的内容。
状态存储在水印文件中,因此单次执行具有幂等性:无新内容的情况下仅执行一次扫描后即退出。

Rails

操作准则

  • An empty pass is a success. Most days produce nothing durable. Report "nothing to capture", stamp the watermark, and exit. Manufacturing a page to justify the run poisons the second brain with material the user will learn to scroll past — one real capture a week beats seven padded ones.
  • Open a pull request; never commit to
    main
    .
    Every capture is a judgement call made without the user in the room, so the user gets the veto.
  • Redact before writing. The digest script strips known secret shapes, but it cannot recognise a novel one. Re-read every line you are about to commit for credentials, tokens, customer names, and third-party personal data.
  • Cite the transcript, do not copy it. Reference the session path; the raw transcript already lives under
    ~/.claude
    or
    ~/.codex
    and does not belong in the repository.
  • Touch only
    wkentaro/secondbrain
    .
    Never edit, commit to, or open issues against a source repository this pass merely read about.
  • 无内容捕获也是成功。 大多数时候不会产生有长期价值的内容。报告"无内容可捕获",更新水印后退出。为了凑数生成页面会给secondbrain注入用户会直接跳过的无效内容——每周一次真实捕获远胜于七次凑数内容。
  • 发起Pull Request;切勿直接提交到
    main
    分支。
    所有捕获操作都是在用户不在场时做出的判断,因此用户拥有否决权。
  • 写入前先脱敏。 摘要脚本会移除已知格式的机密信息,但无法识别新型机密。请重新检查即将提交的每一行内容,确保没有凭证、令牌、客户姓名及第三方个人数据。
  • 引用会话记录,而非复制。 只需引用会话路径;原始记录已存储在
    ~/.claude
    ~/.codex
    下,无需存入仓库。
  • 仅操作
    wkentaro/secondbrain
    切勿对本次执行仅读取过的源仓库进行编辑、提交或提交Issue。

The capture test

捕获判定标准

A candidate earns a page when it is durable and unrecoverable.
Durable — it will still be true and still be wanted in six months:
  • A root cause that took real work to find, and the symptom that pointed to it.
  • A decision, what it beat, and the constraint that settled it.
  • A measured number: a benchmark, a cost, a limit, a timing.
  • Third-party behaviour that contradicts its own documentation.
  • A workaround, plus the constraint forcing it.
  • A policy or preference the user stated that applies beyond the session.
Unrecoverable — reading the repository at
HEAD
would not tell you. Skip anything a diff, a commit message, a changelog, or
--help
already carries.
Judge the two independently and reject on either. When a candidate is borderline, reject it; the watermark moves on and a genuinely durable fact resurfaces in a later session.
只有同时满足长期价值不可恢复两个条件的内容,才值得生成页面。
长期价值——六个月后依然有效且有参考价值:
  • 经过大量工作才找到的根本原因,以及指向该原因的症状。
  • 一项决策、被否决的方案以及促成该决策的约束条件。
  • 量化数据:基准测试结果、成本、限制条件、时间节点。
  • 与自身文档不符的第三方行为。
  • 一种临时解决方案,以及迫使采用该方案的约束条件。
  • 用户提出的、适用于本次会话之外的政策或偏好。
不可恢复——查看仓库
HEAD
版本无法获取该内容。跳过任何已在差异对比、提交信息、变更日志或
--help
中存在的内容。
分别独立判断这两个条件,只要有一个不满足就拒绝。对于边缘内容,同样予以拒绝;水印会更新,真正有长期价值的内容会在后续会话中再次出现。

0. Preflight

0. 准备阶段

  • Set
    SKILL_DIR
    to this skill's own directory, so the commands below run wherever the skill is installed:
sh
SKILL_DIR=<the base directory named when this skill was invoked>
  • cd
    to the secondbrain checkout. Abort if the working tree is dirty.
  • Read
    CLAUDE.md
    and the target domain's
    CLAUDE.md
    . They own frontmatter, page types, wikilinks, and the
    _log.md
    convention; this skill does not restate them.
  • Snapshot the tick start so sessions that begin mid-run are not skipped:
sh
mkdir -p ~/.local/state/secondbrain-harvest
touch ~/.local/state/secondbrain-harvest/.tick
  • SKILL_DIR
    设置为该skill的目录,以便以下命令可在skill安装的任意位置运行:
sh
SKILL_DIR=<the base directory named when this skill was invoked>
  • 进入secondbrain的本地仓库目录。如果工作区存在未提交的修改,则终止操作。
  • 阅读
    CLAUDE.md
    及目标领域的
    CLAUDE.md
    。这些文档定义了前置内容、页面类型、维基链接及
    _log.md
    约定;本skill不会重复说明这些规则。
  • 记录本次执行的开始时间,避免跳过执行过程中启动的会话:
sh
mkdir -p ~/.local/state/secondbrain-harvest
touch ~/.local/state/secondbrain-harvest/.tick

1. List candidates

1. 列出候选内容

sh
python3 "$SKILL_DIR"/scripts/digest_sessions.py --list
With no watermark yet it falls back to a 24-hour window. Zero sessions listed ends the tick — jump to step 5.
sh
python3 "$SKILL_DIR"/scripts/digest_sessions.py --list
如果尚未设置水印,则默认检查过去24小时内的会话。如果没有列出任何会话,则终止本次执行——跳至步骤5。

2. Judge

2. 内容判定

sh
python3 "$SKILL_DIR"/scripts/digest_sessions.py
Each digest holds the human turns and the agent's prose replies, with reasoning and tool traffic dropped. Apply the capture test to every digest and write down a verdict for each, so the count of judged sessions matches the count listed in step 1. Re-read the full transcript with
--only <path>
when a digest is suggestive but too thin to decide.
sh
python3 "$SKILL_DIR"/scripts/digest_sessions.py
每个摘要包含人类对话内容和Agent的文本回复,已剔除推理过程及工具交互信息。对每个摘要应用捕获判定标准,并记录判定结果,确保判定的会话数量与步骤1中列出的数量一致。如果摘要内容提示有价值但不够充分,可使用
--only <path>
命令重新阅读完整会话记录。

3. Route

3. 内容归类

Route each survivor by the global
AGENTS.md
work-artifact rules. Most land as a curated page or an edit to an existing one inside a
secondbrain
topic folder. Prefer editing an existing page over adding one: grep the domain for the concept first, and only create a page when nothing covers it. A survivor that is really an open task belongs in an issue, not a page.
根据全局
AGENTS.md
中的工作产物规则,对通过判定的内容进行归类。大多数内容会作为精选页面或对现有页面的编辑,存入
secondbrain
的主题文件夹中。优先编辑现有页面而非创建新页面:先在领域内搜索相关概念,仅当没有相关内容时才创建新页面。如果通过判定的内容是一项未完成任务,则应创建Issue,而非页面。

4. Write

4. 内容撰写

Follow the repository's
ingest
procedure. Every capture cites its session path inline. Cross-link both directions, update the topic
index.md
when a page is new, and append one line per capture to the domain's
_log.md
.
遵循仓库的
ingest
流程。每处捕获内容都需在文中引用会话路径。添加双向交叉链接,若创建了新页面则更新主题的
index.md
,并在领域的
_log.md
中为每处捕获内容追加一行记录。

5. Commit and open the pull request

5. 提交并发起Pull Request

Nothing captured: stamp the watermark and report the count of sessions judged. Otherwise:
  • Branch:
    harvest/YYYY-MM-DD
    .
  • Commit per the global git rules, splitting by capture when there are several.
  • Open the PR with
    gh
    . The body lists each capture as one unwrapped line — what it claims, and the session it came from — plus the number of sessions judged and rejected, so the user can audit the filter rather than trust it.
  • Stop at the open PR. The user merges.
Stamp the watermark last, once the PR is open:
sh
mv ~/.local/state/secondbrain-harvest/.tick ~/.local/state/secondbrain-harvest/watermark
Leaving the watermark unstamped after a failed tick is correct — the next run re-judges the same window rather than losing it.
未捕获到内容:更新水印并报告判定的会话数量。若捕获到内容:
  • 创建分支:
    harvest/YYYY-MM-DD
  • 遵循全局Git规则提交,若有多条捕获内容则分开提交。
  • 使用
    gh
    工具发起PR。PR正文每行列出一条捕获内容——内容说明及来源会话——同时列出判定的会话总数和被拒绝的数量,以便用户审核筛选逻辑而非直接信任。
  • 完成PR发起后停止操作。由用户负责合并。
PR发起后,最后更新水印:
sh
mv ~/.local/state/secondbrain-harvest/.tick ~/.local/state/secondbrain-harvest/watermark
如果本次执行失败,不更新水印是正确的——下次执行会重新判定同一时间窗口内的内容,避免遗漏。

Report

报告内容

text
Judged: <count>; rejected: <count and session paths>
Captured: <claim> — <literal source transcript path>
Changed: <secondbrain paths>
Redaction before commit: checked credentials, secrets, customer names, and third-party personal data
PR: <branch and URL>; body includes captures and judged/rejected counts
Watermark: <advanced from .tick after an empty pass or successful PR; otherwise unchanged, and why>
Source repositories: untouched
Failure: <failed action>; recovery: <branch or commit>  # only on failure
text
Judged: <count>; rejected: <count and session paths>
Captured: <claim> — <literal source transcript path>
Changed: <secondbrain paths>
Redaction before commit: checked credentials, secrets, customer names, and third-party personal data
PR: <branch and URL>; body includes captures and judged/rejected counts
Watermark: <advanced from .tick after an empty pass or successful PR; otherwise unchanged, and why>
Source repositories: untouched
Failure: <failed action>; recovery: <branch or commit>  # only on failure