技能包收获
- 作者仓库星标 18,413
- 作者仓库 gbrain
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 92 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @garrytan · v0.33.0 · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
询问用户:收获的技能应该有什么蛞蝓? (Slugs 必须是短横线大小写,在 gbrain 包中全局唯一。)哪个主机存储库是源? (存储库根目录的路径,而不是技能目录的路径 - 例如`~/git/wintermute`,而不是`~/git/wintermute/skills/foo`。)
使用 `--dry-run` 运行 CLI: 输出显示: 哪些文件会落在 gbrain 的树中 是否包含配对源(隐式) 技能的 frontmatter 触发器 - 读取它们并检查
在运行真正的收获之前,请浏览主机的`skills/<slug>/`文件并应用此清单。如果有任何匹配,请首先编辑主机文件,然后运行harves。分叉特定名称 → 通用短语 `Wintermute` → `your OpenClaw`(或 `OpenClaw deployment`)
第 3 阶段完成后,运行真正的收获: 默认行为:文件复制时的路径限制 + 符号链接拒绝 隐私 linter 针对 `~/.gbrain/harvest-private-patterns.txt` 运行(加上内置默认值:`\bWintermute\b`、电子邮件、Slack 通道)
成功收获后:`bun test test/skills-conformance.test.ts` — 确认新的 SKILL.md 符合 frontmatter 合约。 `gbrain skillpack check --strict` — 确认捆绑包和 gbrain 自己的结账之间没有偏差。
如果其他 gbrain 客户端应该采用新技能:请在下一个版本的“添加的技能”下的`CHANGELOG.md`中注明如果该技能来自核心团队之外的人员,请在 PR 中标记用户/贡献者
# skillpack-harvest — Editorial workflow for lifting host skills into gbrain
> **Convention:** see [_brain-filing-rules.md](../_brain-filing-rules.md) for
> file placement rules. This skill writes into gbrain's own tree, not the
> brain repo's notes.
This skill is the inverse of `gbrain skillpack scaffold`. Scaffold ships
skills downstream (gbrain → host). Harvest lifts proven patterns
upstream (host → gbrain) so they become references every other client
can scaffold.
## Contract
A harvest is "properly done" when:
1. The host skill is mature (used in production, recent routing-eval
cases pass).
2. The editorial genericization in Phase 3 has scrubbed every
fork-specific reference (names, real entities, internal channels).
3. `gbrain skillpack harvest --dry-run` previewed the file set.
4. The real `gbrain skillpack harvest <slug> --from <host>` succeeded
with `status: harvested` (no privacy-lint hits).
5. `bun test test/skills-conformance.test.ts` passes on the new
`skills/<slug>/SKILL.md`.
6. The user has reviewed the diff in gbrain and explicitly approved
the commit.
If any of these is incomplete, the skill is NOT yet harvested — the
files may sit in gbrain's working tree, but they're not landed.
## Output Format
This skill produces three artifacts in gbrain's working tree:
1. `skills/<harvested-slug>/SKILL.md` (and any sibling files like
`routing-eval.jsonl`)
2. Paired source files at their mirror paths (e.g.
`src/commands/<slug>.ts`) when the host SKILL.md declared them
in frontmatter `sources:`
3. An updated `openclaw.plugin.json` with the new slug added to
`skills:` (sorted)
The session output to the user is a one-line success summary plus
a list of files written. JSON mode (`--json`) returns the full
`HarvestResult` shape for machine consumption.
## Anti-Patterns
- **Skipping the dry-run.** Always preview first. Files land in
gbrain's working tree; cleanup is a `git checkout` away, but you
shouldn't need to.
- **Trusting the linter alone.** The default regex set catches the
common cases. It doesn't catch every proper noun. Phase 3 (the
editorial pass) is the primary defense.
- **Harvesting `--no-lint` without justification.** The lint exists
for a reason. If you bypass it, document why in the commit.
- **Harvesting a skill that's still in flux.** Wait until the host
version stabilizes. Otherwise you'll harvest, then re-harvest,
then re-harvest, and that churns gbrain's bundle for no benefit.
- **Moving files instead of copying.** Harvest is a copy. The host
retains its skill. Don't `rm -rf` the source after harvesting.
- **Harvesting batch (multiple skills at once).** Not supported, and
for good reason — the editorial review per skill is real work.
## When to invoke
- The user developed a skill in their host fork (Wintermute, Neuromancer,
Zion, etc.) and wants other gbrain clients to be able to use it
- A skill has proven itself in production and is ready to generalize
- The user explicitly asks to "harvest" or "publish" a skill upstream
Do NOT invoke when:
- The skill is still in flux locally — let it stabilize first
- The skill references private content that can't be generalized
- The user just wants to share a one-off draft (use a gist instead)
## Preconditions
Before running this skill, confirm:
1. **The skill is mature.** Recent `routing-eval.jsonl` cases pass; the
skill has been used in production at least a few times.
2. **The skill is generalizable.** Strip-test in your head: replace
every fork-specific name. Does it still make sense as a skill?
3. **The user owns the gbrain checkout.** The harvest writes into
gbrain's working tree. They'll review and commit. Don't harvest
into a checkout the user doesn't intend to commit from.
## Workflow
### Phase 1 — Plan
Ask the user:
- What slug should the harvested skill have? (Slugs must be kebab-case,
globally unique in the gbrain bundle.)
- Which host repo is the source? (Path to repo root, not to the skill
directory — e.g. `~/git/wintermute`, not `~/git/wintermute/skills/foo`.)
- Should paired source files come along? (Check the host SKILL.md's
frontmatter `sources:` array.)
### Phase 2 — Dry-run + privacy-lint preview
Run the CLI with `--dry-run`:
```bash
gbrain skillpack harvest <slug> --from <host-repo-root> --dry-run
```
The output shows:
- Which files would land in gbrain's tree
- Whether paired sources are included
- (Implicit) The skill's frontmatter triggers — read them and check
they generalize
Do **not** skip the dry-run. The privacy linter only runs on a real
harvest, but the dry-run preview lets you see the files before they
land. Spot-check the SKILL.md and any paired source for things the
linter might miss (proper nouns, internal project names, etc.).
### Phase 3 — Genericization checklist (the editorial pass)
Before running the real harvest, walk the host's `skills/<slug>/`
files and apply this checklist. If anything matches, edit the host
file FIRST, then run harvest.
1. **Fork-specific names → generic phrasing**
- `Wintermute` → `your OpenClaw` (or `OpenClaw deployment`)
- `Neuromancer`, `Zion`, `<personal-fork-name>` → same treatment
- Personal first names (`garry`, `jane`, etc.) → `the user` /
`you` / a generic placeholder
2. **Real entities → placeholders**
- Real people, companies, deals, funds → placeholder slugs
(`alice-example`, `acme-example`, `fund-a`, etc.)
- Email addresses → strip entirely OR use `example@example.com`
- Internal Slack channels → `#some-channel` or strip
- Specific tracker IDs / Linear ticket numbers → strip
3. **Fork-specific conventions → references**
- Mentions of `<host-repo>/docs/...` files → either lift the doc
into gbrain OR replace with a generic placeholder explanation
- Mentions of `<host-repo>/skills/<other-fork-only-skill>` → either
decide to harvest that one too, or replace with a generic
pattern reference
4. **Triggers array generalizes**
- Read every entry in frontmatter `triggers:`. None should
reference the user's name, fork name, or internal tools.
- "Have garry sign off on it" → "have the user sign off on it"
5. **routing-eval.jsonl examples are scrubbed**
- Open `skills/<slug>/routing-eval.jsonl`. Every `intent` field
gets the same scrub as `triggers:`.
6. **Code comments + log strings**
- If a paired source is going to be harvested, walk it for the
same private-pattern leaks. Comments are the most common
hiding spot.
### Phase 4 — Real harvest
Once Phase 3 is complete, run the real harvest:
```bash
gbrain skillpack harvest <slug> --from <host-repo-root>
```
Default behavior:
- Path-confinement + symlink rejection at file copy
- Privacy linter runs against `~/.gbrain/harvest-private-patterns.txt`
(plus built-in defaults: `\bWintermute\b`, email, Slack channels)
- On any match → rollback (delete the harvested files) + exit non-zero
- `openclaw.plugin.json` updated to add the slug, sorted
Outcomes:
- `harvested` — success, manifest updated, files in gbrain's tree
- `lint_failed` — privacy linter caught something. Go back to Phase 3,
scrub the host file, retry.
- `slug_collision` — gbrain already has a skill at that slug. Either
use a different slug, or pass `--overwrite-local` if you really
mean to replace.
### Phase 5 — Verify in gbrain
After a successful harvest:
1. `bun test test/skills-conformance.test.ts` — confirms the new
SKILL.md meets the frontmatter contract.
2. `gbrain skillpack check --strict` — confirms no drift between
bundle and gbrain's own checkout.
3. `gbrain skillpack list` — confirms the slug shows up in the bundle.
4. Review the diff: `cd <gbrainRoot> && git diff -- skills/<slug>/`
5. Commit the additions in gbrain (do NOT commit any leftover files
in the host repo — harvest is a copy, not a move).
### Phase 6 — Downstream announcement (optional)
If other gbrain clients should pick up the new skill:
- Note it in `CHANGELOG.md` under "Skills added" for the next release
- Tag the user / contributor in the PR if the skill came from
someone outside the core team
## Bypass: `--no-lint`
The privacy linter is the safety net. The editorial pass is the
primary defense. If you've completed Phase 3 thoroughly and the
linter is still firing on a false positive, use `--no-lint`:
```bash
gbrain skillpack harvest <slug> --from <host-repo-root> --no-lint
```
**Document the bypass in the commit message.** Future maintainers
should be able to see WHY the lint was bypassed (e.g. "Wintermute
appears in a citation, not a real reference — verified manually").
Never bypass the linter on a casual basis. The whole point of the
default-on lint is that real names occasionally slip through the
editorial pass.
## What harvest does NOT do
- It does NOT move files (it copies). The host's `skills/<slug>/`
stays in place.
- It does NOT auto-scrub names. The editorial pass is human-driven.
- It does NOT publish to npm or a remote bundle. It writes to
gbrain's working tree; the user commits + ships via the normal
gbrain release process.
- It does NOT support `--all` (no batch harvest). One skill at a
time keeps the editorial review tractable.
## Files this skill touches
- gbrain's `skills/<slug>/` — every file in the host skill dir
(copy)
- gbrain's mirror path for declared paired sources
(e.g. `src/commands/<slug>.ts` if the host SKILL.md declares it
in frontmatter)
- gbrain's `openclaw.plugin.json` — adds the slug to `skills:`
array, sorted alphabetically
按说明文件中的顺序排列。
合同
输出格式
反模式
何时调用
前提条件
文件/命令 -> gbrain skillpack scaffold · gbrain skillpack harvest --dry-run · gbrain skillpack harvest <slug> --from <host> · status: harvested · bun test test/skills-conformance.test.ts · skills/<slug>/SKILL.md · skills/<harvested-slug>/SKILL.md · routing-eval.jsonl
内容校验值 -> 83f9b71efbcd
当前原文的自动摘译,尚未人工审校。
合同
在以下情况下,收获是“正确完成”的: 主机技能成熟(在生产中使用,最近的路由评估案例通过)。第三阶段的编辑通用化已经清除了每个特定于分叉的参考(名称、真实实体、内部渠道)。
输出格式
该技能在 gbrain 的工作树中生成三个工件:
skills/<harvested-slug>/SKILL.md(以及任何同级文件,如routing-eval.jsonl) 当主机 SKILL.md 声明它们时,在其镜像路径(例如src/commands/<slug>.ts)配对源文件反模式
跳过试运行。始终先预览。文件落在 gbrain 的工作树中;清理工作需要
git checkout,但你不需要这样做。仅信任 linter。默认正则表达式集捕获常见情况。它并没有捕获每个专有名词。第三阶段(何时调用
用户在其主机分支(Wintermute、Neuromancer、Zion 等)中开发了一项技能,并希望其他 gbrain 客户端能够使用该技能 一项技能已在生产中证明了自己,并准备好推广 用户明确要求在上游“收获”或“发布”一项技能 不要在以下情况下调用:
前提条件
在运行该技能之前,请确认:该技能已经成熟。近期
routing-eval.jsonl案件通过;该技能已在生产中至少使用过几次。该技能具有普遍性。在你的头脑中进行条带测试:替换每个叉子特定的名称。作为一项技能,它仍然有意义吗?