技能包检查

其他 社区 v1.0.0

技能解读

当前原文的自动摘译,尚未人工审校。

合同

运行 gbrain skillpack-check 返回一个 JSON 报告,其中包含: healthy (bool):如果不需要任何操作,则为 true。 summary(字符串):一行摘要,可以在简报中安全引用。 actions (string[]):每个修复命令。如果非空,则运行它们。 doctor:完整的gbrain doctor --fast --json输出(文件系统检查)。

何时跑步

每日 cron(例如 OpenClaw 的 morning-briefing):gbrain skillpack-check --quiet。退出代码会告诉您是否有任何问题;仅当 exit != 0 时,才会在简报中显示一句俏皮话。快乐路径简报中没有 JSON 噪音。按需:调试时使用gbrain skillpack-check获取完整的 JSON。在 CI 管道中:相同的模式 — 退出代码门,JSON 就是证据。

快乐之路(健康:正确)

仅在询问时才在代理的输出中显示摘要。没有别的了。

需要采取行动(健康:错误)

actions[] 数组包含按顺序运行的命令。执行它们:常见的 actions[] 条目及其含义: gbrain apply-migrations --yes — 迁移处于待处理或半完成状态。运行这个(它是幂等的)。如果它退出status: "partial",则主机具有需要插件注册的非内置 cron 处理程序 - 按照

确定失败(出口 2)

视为紧急。可能意味着 $PATH 中缺少 gbrain 二进制文件,或者所需的子命令崩溃了。检查:which gbrain返回路径gbrain --version退出0~/.gbrain/可访问

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
通用
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
92 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@garrytan · v1.0.0 · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Skillpack Check

## Contract

Running `gbrain skillpack-check` returns a JSON report with:

- **`healthy`** (bool): true if no action needed.
- **`summary`** (string): one-line summary safe to quote in a briefing.
- **`actions`** (string[]): every remediation command. If non-empty, run them.
- **`doctor`**: full `gbrain doctor --fast --json` output (filesystem checks).
- **`migrations`**: applied/pending/partial counts from `apply-migrations --list`.

Exit code:
- `0` — healthy, nothing to do.
- `1` — action needed. Read `actions[]` and execute.
- `2` — could not determine (binary crash or missing subcommand). Investigate.

## When to run

- **Daily cron** (e.g. your OpenClaw's `morning-briefing`): `gbrain skillpack-check --quiet`.
  Exit code alone tells you if anything is wrong; surface a one-liner in the
  briefing only when exit != 0. No JSON noise in happy-path briefings.
- **On demand**: `gbrain skillpack-check` for the full JSON when debugging.
- **In a CI pipeline**: same pattern — exit code gates, JSON is the evidence.

## What to do with the output

### Happy path (`healthy: true`)

Surface the summary in the agent's output only if asked. Nothing else.

### Action needed (`healthy: false`)

The `actions[]` array contains the commands to run, in order. Execute them:

```bash
for cmd in $(echo "$REPORT" | jq -r '.actions[]'); do
  eval "$cmd"
done
```

Common `actions[]` entries and what they mean:

- `gbrain apply-migrations --yes` — A migration is pending or half-finished.
  Run this (it's idempotent). If it exits `status: "partial"`, the host has
  non-builtin cron handlers that need plugin registration — follow
  `skills/migrations/v0.11.0.md`.
- `gbrain embed --stale` — Embeddings are stale.
- `gbrain check-backlinks --fix` — Dead links or missing back-links.
- Free-text action (no `Run:` prefix in the source message) — agent judgment
  needed. Quote it in the report for the user.

### Determine failure (`exit 2`)

Treat as urgent. Probably means the gbrain binary is missing from `$PATH` or
a required subcommand crashed. Check:

1. `which gbrain` returns a path
2. `gbrain --version` exits 0
3. `~/.gbrain/` is accessible

## Output format

```json
{
  "version": "0.11.1",
  "ts": "2026-04-18T12:34:56.789Z",
  "healthy": false,
  "summary": "gbrain skillpack needs attention: 1 action(s) — gbrain apply-migrations --yes",
  "actions": ["gbrain apply-migrations --yes"],
  "doctor": {
    "exit_code": 1,
    "checks": [
      { "name": "minions_migration", "status": "fail", "message": "MINIONS HALF-INSTALLED (partial migration: 0.11.0). Run: gbrain apply-migrations --yes" }
    ]
  },
  "migrations": {
    "applied_count": 0,
    "pending_count": 0,
    "partial_count": 1,
    "stdout": "..."
  }
}
```

## Anti-Patterns

- ❌ Running without `--quiet` in a cron that emails its output — you'll get
  the full JSON blob in every daily email. Use `--quiet` in crons.
- ❌ Ignoring exit code 2. A crashed doctor is worse than a failing check
  because you don't even know what's wrong.
- ❌ Running on every chat turn. Once per hour (or on user request) is plenty.
- ❌ Treating warnings as failures. Only `fail` status needs action;
  `warn` is informational.

## Output Format

The skill itself doesn't write files; it reports the CLI output verbatim to
the user (or to the agent's briefing pipeline). One-line summary first,
then the action list, then (only if relevant) the full JSON for debugging.

## Related

- `gbrain doctor` — the underlying filesystem + DB check. skillpack-check
  composes this.
- `gbrain apply-migrations --list` — the migration status view.
- `skills/migrations/v0.11.0.md` — the host-agent instruction manual for
  resolving `pending-host-work.jsonl` items.
- `docs/guides/minions-fix.md` — troubleshooting a half-migrated install.

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。