ntn-skills 2.0.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/INSTALL.md CHANGED
@@ -33,9 +33,9 @@ ls -la ~/.config/ntn-skills/credentials.env ~/.config/ntn-skills/config.json 2>/
33
33
  Run the idempotent installer (add `--with-pi` if the user uses Pi; add `--install-bun` if Bun is missing and the user agrees):
34
34
 
35
35
  ```bash
36
- curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- </dev/null
36
+ curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash
37
37
  # For Pi users (enables $skill inline loading + skill_find / skill_load tools):
38
- # curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- --with-pi </dev/null
38
+ # curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- --with-pi
39
39
  ```
40
40
 
41
41
  Ensure `~/.local/bin` is on `PATH` (or invoke `~/.local/bin/ntn-skills` explicitly) and confirm:
@@ -80,7 +80,7 @@ Once `credentials.env` is in place and the user provides `<NOTION_PAGE_URL>`, ru
80
80
 
81
81
  # Existing large library (100+ skills or external Git sources):
82
82
  # Bind config immediately (<2s), then run initial cold-start sync with a generous timeout (>=600s or background job):
83
- # ntn-skills init --root "<NOTION_PAGE_URL>" --no-sync --json </dev/null
83
+ # ntn-skills init --root "<NOTION_PAGE_URL>" --no-create --no-sync --json </dev/null
84
84
  # ntn-skills sync --json </dev/null
85
85
  ```
86
86
  - **Custom or multi-surface export directories** (e.g., Grok Box `${HOME}/agent-data/workflows` using `copy` mode alongside `~/.agents/skills` using `symlink`, or `~/.claude/skills`):
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  <p align="center">
7
7
  <a href="#quick-start">Quick Start</a> ·
8
8
  <a href="#how-it-works">How It Works</a> ·
9
+ <a href="#how-it-compares">How It Compares</a> ·
9
10
  <a href="#cli-reference">CLI Reference</a> ·
10
11
  <a href="#security-privacy--data-boundaries">Security</a> ·
11
12
  <a href="./INSTALL.md">Agent Setup (<code>INSTALL.md</code>)</a> ·
@@ -173,22 +174,39 @@ ntn-skills init [--root <notion-page-url>] [--export ~/.agents/skills] [--export
173
174
  ntn-skills skill [--path] [--install [--dest ~/.agents/skills] [--force]] [--uninstall]
174
175
  ntn-skills doctor [--json]
175
176
  ntn-skills status [--days 30] [--json]
176
- ntn-skills sync [--full] [--coalesce] [--json]
177
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json]
177
178
  ntn-skills find [query] [--scene <scene>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--json]
178
179
  ntn-skills info <name> [--json]
179
180
  ntn-skills load <name> [--refresh] [--path-only]
180
181
  ```
181
182
 
183
+ ### Targeted & Declarative Exports
184
+ ```bash
185
+ # Reconcile all configured exports (including config.json `include_exports`)
186
+ ntn-skills export [--dry-run] [--json]
187
+
188
+ # Project an exact allowlist (name or slug; includes manual skills, auto-closes Requires, omits skill-catalog by default)
189
+ ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json]
190
+
191
+ # Batch-project from a standalone JSON spec (`{ bundles?, exports }`, `ExportTarget[]`, or single `ExportTarget`)
192
+ # Relative target `dir` paths resolve against the spec file's directory; `copy` mode safely coexists with unmanaged folders
193
+ ntn-skills export --spec ./exports.spec.json [--dry-run] [--json]
194
+ ```
195
+
196
+ In `~/.config/ntn-skills/config.json`, you can also declare reusable top-level `bundles` (`Record<string, string[]>`) and external manifest files via `include_exports` (`string[]`, supporting `~` and `${HOME}`). Each export target supports `skills`, `bundles`, `exclude`, and `include_requires` alongside `profiles`, `scenes`, `router`, and `mode`.
197
+
182
198
  ### Editing, Batch Metadata, Drafts & Overlay Tuning
183
199
  ```bash
184
200
  # Safe isolated edit workflow (never mutates read-only store/)
185
201
  WORKDIR=$(ntn-skills edit "<name>")
186
202
  ntn-skills diff "$WORKDIR" --remote
187
203
  ntn-skills push "$WORKDIR" [--dry-run]
204
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--json]
205
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--json] # Direct overwrite (preserves source dir)
188
206
  ntn-skills abort "$WORKDIR"
189
207
 
190
- # Create/adopt a Notion-native draft skill & single/batch update metadata
191
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual] [--profiles default] [--scenes ops] [--no-adopt]
208
+ # Create/adopt single or batch Notion-native skills (--pending requires explicit visibility; --dry-run previews conflicts & sensitive files)
209
+ ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual] [--profiles default] [--scenes ops] [--adopt | --no-adopt] [--dry-run] [--json]
192
210
  ntn-skills set [<name...>] [--source <source-name>] \
193
211
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
194
212
  [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
@@ -219,6 +237,36 @@ ntn-skills schedule export --target dagu|github-actions|crontab
219
237
 
220
238
  ---
221
239
 
240
+ ## Built-in Read-Only MCP Server (`ntn-skills mcp`)
241
+
242
+ Any MCP-compatible agent host (such as Antigravity `agy`, Claude Code, Cursor, or Windsurf) can discover and load skills on demand over standard `stdio` JSON-RPC 2.0 without duplicating `skill-catalog` prompts:
243
+
244
+ ```bash
245
+ ntn-skills mcp [--library <uuid>] [--scenes ops,coding] [--instructions "<text>"]
246
+ ```
247
+
248
+ Exposes two read-only tools (`readOnlyHint: true`):
249
+ - **`skill_find`**: Empty call returns a compact per-scene discoverable count overview; keyword/scene queries return ranked, truncated matches.
250
+ - **`skill_load`**: Materializes and returns a matched skill (by canonical name or slug) along with its local directory and `Requires` paths.
251
+
252
+ Example `mcp_config.json` (with `eager: true` for hosts such as `agy` that support eager tool loading):
253
+
254
+ ```json
255
+ {
256
+ "mcpServers": {
257
+ "ntn-skills": {
258
+ "command": "ntn-skills",
259
+ "args": ["mcp"],
260
+ "eager": true
261
+ }
262
+ }
263
+ }
264
+ ```
265
+
266
+ Use `"args": ["mcp", "--scenes", "ops,coding"]` to scope a host or profile to specific scenes.
267
+
268
+ ---
269
+
222
270
  ## Pi Extension
223
271
 
224
272
  Install with `--with-pi` (or link `packages/pi-extension` into `~/.pi/agent/extensions/ntn-skills`) to unlock:
@@ -227,10 +275,52 @@ Install with `--with-pi` (or link `packages/pi-extension` into `~/.pi/agent/exte
227
275
 
228
276
  ---
229
277
 
278
+ ## How It Compares
279
+
280
+ Different setups manage Agent Skills at different scales and along different layers of the stack. Rather than competing with local dotfiles or multi-agent control planes, `ntn-skills` focuses specifically on the **large-scale skill knowledge, upstream tracking, and tiered local distribution layer**.
281
+
282
+ Three common paradigms:
283
+
284
+ 1. **Plain local / Git symlinks** (e.g. dotfiles, `skills.sh`, manual symlinks): Fastest to start, zero external dependencies, and full Git/editor transparency.
285
+ 2. **Multi-agent control planes / gateways** (e.g. [Magpie](https://usemagpie.ai)): All-in-one control planes for model routing/fallbacks, local gateways and budgets, shared MCP servers (including an MCP router), global instructions, and local skill distribution/routing (`magpie-skills`) — offline-first, zero external SaaS required, out-of-the-box setup (with optional end-to-end encrypted WebDAV, S3, or GitHub sync).
286
+ 3. **`ntn-skills`**: A Notion 3-table skill control plane (`Sources`, `Skills`, `Files`) paired with upstream Git tracking and non-destructive overlay hot-patching, 3-tier visibility (`always` / `discoverable` / `manual`) over zero-hash `by-name/` links, exact allowlist / `Requires` dependency-closed multi-target exports, and on-demand local materialization via the Pi extension or `ntn-skills mcp`.
287
+
288
+ | Dimension | Plain local / Git symlinks | Multi-agent control planes (e.g. [Magpie](https://usemagpie.ai)) | `ntn-skills` |
289
+ | :--- | :--- | :--- | :--- |
290
+ | **Source of truth & authoring UX** | Local folders and Git commits; full editor/PR control, manual cross-machine sync | Local library folder + config (`library.json`), desktop/TUI/web UI and CLI; optional encrypted WebDAV/S3/GitHub sync | Notion 3-table database + Git upstreams; visual web/mobile metadata & draft editing, pulled one-way into immutable local snapshots (`0444/0555`) |
291
+ | **Scale & multi-view governance** | Transparent for a flat list; lacks structured filtering, usage visibility, or lifecycle states at scale | Per-agent toggles, per-machine `off-here`, per-project assignment, and optional single-skill router (`routed` / `direct`); filesystem-centric rather than relational views | Built for 50–1,000+ skills; filter and group in Notion by `Scenes`, `Profiles`, `Visibility`, `Kind`, `Origin`, and `Status`, backed by local 30-day `Hot Loads`, `Overlays`, and `Draft Buffer` reports |
292
+ | **Upstream tracking & hot-patching** | Git submodules, forks, or re-running installers; customizing upstream skills usually requires maintaining forks | Built-in GitHub/git skill updates and optional `auto-update`; locally edited skills are preserved (skipped unless overwritten with `--replace-edits`) rather than overlay-merged | Multi-skill repo tracking (`track` / `pinned` / `manual`) with subtree-hash pruning; non-destructive Notion overlays (`Custom Main` + `Files` diffs) merged over upstream Git, one-command `reset-overlay`, and clean graduation back to Git |
293
+ | **Context budget & multi-target slicing** | Linked skills sit at the top level unless split manually; dependency closure and per-runtime slicing are DIY | Per-agent & per-project assignment (`link` / `copy`) plus `magpie-skills` router (`routed` / `direct`) to keep prompts compact | 3-tier visibility, zero-hash `by-name/` symlinks with compact `skill-catalog`, declarative multi-directory slicing (`--skills`, `bundles`, `--spec`, `symlink` / `copy`) with automatic `Requires` closure, plus `ntn-skills mcp` and Pi `$skill` on-demand loading |
294
+ | **External dependencies & best fit** | Filesystem + Git only; ideal for `< 20` stable skills or single-repo teams | Offline-first, zero SaaS dependency, out-of-the-box; ideal when you want one tool for models, routing, MCPs, global instructions, and a lightweight-to-moderate skill library | **Trade-off**: requires a Notion account/token and periodic sync; heavier than needed for `< 20` skills. Best for curating 50–1,000+ skills across multiple upstreams, machines, and hosts with zero consumer-time network calls |
295
+
296
+ ### Honest Trade-Offs
297
+
298
+ - **Requires Notion & periodic sync**: `ntn-skills` relies on a Notion Integration token for its control plane, and web edits propagate on the next background sync (or manual `ntn-skills sync`) rather than instantaneously offline.
299
+ - **Heavier than needed below ~20 skills**: If you only maintain a small set of stable skills, plain local/Git symlinks or a control plane like Magpie is lighter and simpler to operate.
300
+ - **Single-responsibility by design**: `ntn-skills` intentionally leaves model routing, API gateways, shared global instructions, and general MCP proxying to dedicated control planes.
301
+
302
+ ### Recommended Combination
303
+
304
+ `ntn-skills` and multi-agent control planes such as [Magpie](https://usemagpie.ai) complement each other cleanly at different layers:
305
+
306
+ - **Use Magpie for the runtime & gateway layer**: model subscriptions and API keys, routing groups and fallbacks, local gateway budgets, shared global instructions, and distributing MCP servers to every local agent.
307
+ - **Use `ntn-skills` for the large-scale skill knowledge layer**: visual Notion evolution across hundreds to thousands of skills, upstream Git tracking with reversible overlays, and tiered local materialization (`~/.agents/skills`, `:copy` sandboxes, and allowlist/`Requires` slices).
308
+ - **Wiring them together**: register `ntn-skills mcp` in Magpie with `--local` (kept to this machine so cross-machine sync never overwrites machine-local paths) and, if Magpie's MCP Router is enabled, mark it `direct` so each agent connects directly to the local stdio server — while `ntn-skills export` remains the single writer for skill directories:
309
+
310
+ ```bash
311
+ # Distribute `ntn-skills mcp` locally via Magpie (never synced to other machines)
312
+ magpie library mcp add ntn-skills ntn-skills mcp agents=claude,codex --local
313
+
314
+ # If Magpie MCP Router is enabled, keep `ntn-skills` as a direct per-agent stdio entry
315
+ magpie library mcp router ntn-skills direct
316
+ ```
317
+
318
+ ---
319
+
230
320
  ## Security, Privacy & Data Boundaries
231
321
 
232
322
  - **Zero Consumer-Time Network Access**: Everyday skill consumption reads immutable local files (`0444/0555`) under `$XDG_DATA_HOME/ntn-skills/store/` (default `~/.local/share/ntn-skills/store/`). Network requests to `api.notion.com` and your configured Git remotes happen only during explicit CLI invocations or scheduled sync jobs.
233
- - **Local-Only Credentials & Telemetry**: `credentials.env` lives under `$XDG_CONFIG_HOME/ntn-skills/` (default `~/.config/ntn-skills/credentials.env`) with enforced `0600` permissions. Usage counters (`telemetry/usage.jsonl`) and bounded sync logs (`2 MiB` rotation) never leave your machine.
323
+ - **Local-Only Credentials, Fail-Closed Secret Scan & Telemetry**: `credentials.env` lives under `$XDG_CONFIG_HOME/ntn-skills/` (default `~/.config/ntn-skills/credentials.env`) with enforced `0600` permissions. Before uploading to Notion, `new` and `push` run a fail-closed scan blocking out-of-root symlinks and sensitive files (`.env`/`.env.*` except `.env.example`/`.sample`/`.template`/`.dist`, `*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`, `*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`, and `.npmrc` containing `_authToken`) without ever printing file contents. Usage counters (`telemetry/usage.jsonl`) and bounded sync logs (`2 MiB` rotation) never leave your machine.
234
324
  - **Foreign Directory Guard & Trash-Only Cleanup**: `export` never overwrites unmanaged files or symlinks inside host skill directories. Workdir and expired cache cleanups move files to the OS Trash rather than permanently unlinking them; retiring skills in Notion marks `Status = retired`.
235
325
  - **Formal Verification**: Core concurrency locks, overlap-window delta sync, and atomic snapshot switching are verified with TLA+ specifications under [`verification/`](https://github.com/yoyooyooo/ntn-skills/tree/main/verification).
236
326
 
@@ -239,7 +329,7 @@ Install with `--with-pi` (or link `packages/pi-extension` into `~/.pi/agent/exte
239
329
  ## Scope & Non-Goals
240
330
 
241
331
  - **Focused on Agent Skills**: `ntn-skills` governs Markdown/script-based Agent Skills (`SKILL.md` + supporting references/scripts). It is **not** an MCP server proxy, secret manager, or general machine provisioning tool.
242
- - **One-Way Sync by Design**: `ntn-skills sync` strictly pulls from Notion/Git to local snapshots and reports `Local Pending` items without silently pushing local scratch edits to Notion. Publishing always requires explicit `new` or `edit -> diff --remote -> push`.
332
+ - **One-Way Three-Channel Architecture by Design**: `ntn-skills sync` strictly pulls from Notion/Git to local snapshots (with `--dry-run` zero-write previews) and reports `Local Pending` items without silently pushing local scratch edits to Notion. Creating/adopting goes through `new` (including `--pending` & `--dry-run`), and updating existing skills goes through `edit -> diff --remote -> push` (including batch `push --pending`) or explicit single-directory `push <dir> --overwrite | --to <name>`.
243
333
 
244
334
  ---
245
335
 
package/README.zh-CN.md CHANGED
@@ -6,6 +6,7 @@
6
6
  <p align="center">
7
7
  <a href="#快速开始">快速开始</a> ·
8
8
  <a href="#双视角工作流">双视角工作流</a> ·
9
+ <a href="#生态位与方案对比">生态位与方案对比</a> ·
9
10
  <a href="#命令速查">命令速查</a> ·
10
11
  <a href="#安全与数据边界">安全与数据边界</a> ·
11
12
  <a href="./INSTALL.md">Agent 安装协议 (<code>INSTALL.md</code>)</a> ·
@@ -174,22 +175,39 @@ ntn-skills init [--root <notion-page-url>] [--export ~/.agents/skills] [--export
174
175
  ntn-skills skill [--path] [--install [--dest ~/.agents/skills] [--force]] [--uninstall]
175
176
  ntn-skills doctor [--json]
176
177
  ntn-skills status [--days 30] [--json]
177
- ntn-skills sync [--full] [--coalesce] [--json]
178
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json]
178
179
  ntn-skills find [关键词] [--scene <场景>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--json]
179
180
  ntn-skills info <name> [--json]
180
181
  ntn-skills load <name> [--refresh] [--path-only]
181
182
  ```
182
183
 
184
+ ### 精确白名单与声明式投影导出
185
+ ```bash
186
+ # 对账同步配置中的全部导出目标(包含 config.json 的 `include_exports`)
187
+ ntn-skills export [--dry-run] [--json]
188
+
189
+ # 按精确技能白名单投影(支持正本名或 slug,可选中 manual 技能并自动按需物化,默认展开 Requires 闭包且不生成 skill-catalog)
190
+ ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json]
191
+
192
+ # 按独立 JSON 声明文件批量投影(支持 `{ bundles?, exports }`、`ExportTarget[]` 或单个 `ExportTarget`)
193
+ # spec 文件中的相对 `dir` 相对该 spec 文件所在目录解析;`copy` 模式仅接管含 `.ntn-managed-copy.json` 的目录,与原有非受管目录安全共存
194
+ ntn-skills export --spec ./exports.spec.json [--dry-run] [--json]
195
+ ```
196
+
197
+ 在 `~/.config/ntn-skills/config.json` 中还可声明顶层复用的 `bundles`(`Record<string, string[]>`)以及外部清单文件 `include_exports`(`string[]`,支持 `~` 与 `${HOME}` 展开)。每个导出目标均可配置 `skills`、`bundles`、`exclude` 与 `include_requires`,与既有 `profiles`、`scenes`、`router`、`mode` 完全兼容。
198
+
183
199
  ### 草稿创建、批量元数据、Overlay 调优与入仓毕业
184
200
  ```bash
185
201
  # 隔离工作区编辑闭环(严禁直接修改只读 store/)
186
202
  WORKDIR=$(ntn-skills edit "<name>")
187
203
  ntn-skills diff "$WORKDIR" --remote
188
204
  ntn-skills push "$WORKDIR" [--dry-run]
205
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--json]
206
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--json] # 普通本地目录直推覆盖(保留源目录)
189
207
  ntn-skills abort "$WORKDIR"
190
208
 
191
- # 新建/原地收编纯 Notion 草稿技能 & 单个/按源批量修改元数据
192
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual] [--profiles default] [--scenes ops] [--no-adopt]
209
+ # 单个或批量新建/原地收编纯 Notion 技能(--pending 须显式指定可见性;--dry-run 零写入预览冲突与敏感文件拦截)
210
+ ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual] [--profiles default] [--scenes ops] [--adopt | --no-adopt] [--dry-run] [--json]
193
211
  ntn-skills set [<name...>] [--source <source-name>] \
194
212
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
195
213
  [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
@@ -220,6 +238,36 @@ ntn-skills schedule export --target dagu|github-actions|crontab
220
238
 
221
239
  ---
222
240
 
241
+ ## 内置只读 MCP Server(`ntn-skills mcp`)
242
+
243
+ 任意支持标准 `stdio` JSON-RPC 2.0 MCP 的 Agent 宿主(如 Antigravity `agy`、Claude Code、Cursor、Windsurf 等)均可直接按需检索与加载本地技能库:
244
+
245
+ ```bash
246
+ ntn-skills mcp [--library <uuid>] [--scenes ops,coding] [--instructions "<text>"]
247
+ ```
248
+
249
+ 仅暴露 2 个只读工具(`readOnlyHint: true`):
250
+ - **`skill_find`**:空调用返回各场景 `discoverable` 数量概览防止刷屏;关键词/场景查询返回按相关性打分且截断的紧凑列表。
251
+ - **`skill_load`**:按技能正本名或连字符 slug 按需物化并返回完整 `SKILL.md` 正文、本地目录及 `Requires` 依赖路径。
252
+
253
+ 通用 `mcp_config.json` 配置示例(`agy` 等支持即时加载的宿主可加 `"eager": true`):
254
+
255
+ ```json
256
+ {
257
+ "mcpServers": {
258
+ "ntn-skills": {
259
+ "command": "ntn-skills",
260
+ "args": ["mcp"],
261
+ "eager": true
262
+ }
263
+ }
264
+ }
265
+ ```
266
+
267
+ 如需限定某宿主仅可见特定场景,可将 `args` 设为 `["mcp", "--scenes", "ops,coding"]`。
268
+
269
+ ---
270
+
223
271
  ## Pi 扩展
224
272
 
225
273
  安装时追加 `--with-pi`(或将 `packages/pi-extension` 软链至 `~/.pi/agent/extensions/ntn-skills`),即可在 Pi 中获得:
@@ -228,10 +276,52 @@ ntn-skills schedule export --target dagu|github-actions|crontab
228
276
 
229
277
  ---
230
278
 
279
+ ## 生态位与方案对比
280
+
281
+ 不同规模的技能库与不同层级的 Agent 基础设施,适合不同的管理范式。`ntn-skills` 并不试图取代本地软链或多 Agent 控制面,而是专注解决**大规模 Skill 资产的可视化治理、上游演进与分层物化**。
282
+
283
+ 常见的三类方案各有清晰定位:
284
+
285
+ 1. **纯本地 / Git 软链**(dotfiles、`skills.sh`、手工软链):启动最快、零外部依赖,所有变更完全透明地留在本地文件与 Git 历史中。
286
+ 2. **多 Agent 控制面 / 网关**(如 [Magpie](https://usemagpie.ai)):一体化管理多 Agent 模型路由与回退、本地 Gateway 与配额预算、共享 MCP 服务器(含 MCP Router)、全局指令以及本地 Skill 分发与路由(`magpie-skills`);离线优先、零外部知识库服务依赖、开箱即用,并支持可选的端到端加密 WebDAV / S3 / GitHub 跨机同步。
287
+ 3. **`ntn-skills`**:以 Notion 3 表(`Sources`、`Skills`、`Files`)作为可视化知识中台,结合上游 Git 追踪与非破坏性 Overlay 热补丁、三层可见性(`always` / `discoverable` / `manual`)与零哈希 `by-name/` 稳定目录、精确白名单与 `Requires` 依赖自动闭合的多目录切片导出,以及 Pi 扩展与内置 `ntn-skills mcp` 按需物化。
288
+
289
+ | 对比维度 | 纯本地 / Git 软链 | 多 Agent 控制面(如 [Magpie](https://usemagpie.ai)) | `ntn-skills` |
290
+ | :--- | :--- | :--- | :--- |
291
+ | **真相源与编辑体验** | 本地目录与 Git 提交;完全受控于编辑器与 PR,但跨机同步需自行维护 | 本地 Library 目录与配置(`library.json`),支持桌面 / TUI / Web 与 CLI 管理,以及可选的加密 WebDAV / S3 / GitHub 同步 | Notion 3 表数据库 + Git 上游源;支持网页与手机端随时编辑元数据与草稿,单向同步至本机不可变快照(`0444/0555`) |
292
+ | **规模与多视图治理** | 扁平清单直观透明;规模扩大后缺少结构化筛选、使用热度与生命周期视图 | 支持按 Agent 勾选、单机禁用(`off-here`)、按项目挂载与单一 Skill 路由(`routed` / `direct`);偏文件系统清单视角,无关系型多视图 | 面向 50–1,000+ 技能;可在 Notion 按 `Scenes`、`Profiles`、`Visibility`、`Kind`、`Origin`、`Status` 多维筛选分组,配合本机 30 天 `Hot Loads`、`Overlays` 与 `Draft Buffer` 治理报表 |
293
+ | **上游追踪与热补丁** | 依赖 Git submodule、Fork 或重跑安装脚本;微调上游技能通常需要维护 Fork | 内置从 GitHub / Git 更新技能与可选 `auto-update`;检测到本地改动时会保留本地版本并跳过更新(除非显式 `--replace-edits` 覆盖),不提供结构化补丁层 | 支持 `track` / `pinned` / `manual` 策略与子树哈希剪枝;可在不 Fork 的前提下用 Notion Overlay(`Custom Main` + `Files` 差异层)叠加上游实测,一键 `reset-overlay` 或干净导出回仓 |
294
+ | **上下文与多目录切片** | 链接的技能默认全部落在顶层;按目录切片与依赖闭合需手工维护 | 支持按 Agent / 项目以软链或副本分发,并可用 `magpie-skills` 路由(`routed` / `direct`)收口提示词开销 | 三层可见性、零哈希 `by-name/` 软链与极简 `skill-catalog`、声明式多目录切片(`--skills`、`bundles`、`--spec`、`symlink` / `copy`)且自动展开 `Requires` 闭包,外加 `ntn-skills mcp` 与 Pi `$skill` 按需加载 |
295
+ | **外部依赖与适用场景** | 仅依赖本地文件系统与 Git;适合 `< 20` 个稳定技能或单仓小团队 | 离线优先、零外部 SaaS 依赖、开箱即用;适合希望用一个工具同时管模型、路由、MCP、全局指令与中小规模技能库 | **代价**:需要 Notion 账号/令牌与后台同步;技能 `< 20` 个时纯本地或 Magpie 更轻量。适合跨多上游源、多机器与多宿主沉淀 50–1,000+ 技能且追求日常消费零网络请求 |
296
+
297
+ ### 坦诚的边界与取舍
298
+
299
+ - **引入 Notion 与同步链路**:`ntn-skills` 需要 Notion 账号和 Integration Token 作为控制面,网页端修改需等待后台定时同步(或手动执行 `ntn-skills sync`)才在本机生效,并非纯离线零外部账户方案。
300
+ - **小规模场景不必过重**:如果你的活跃技能不到 20 个且很少跨多个上游大仓做二次定制,纯本地 / Git 软链或 Magpie 内置的 Library 往往更轻便、维护面更小。
301
+ - **刻意保持单一职责**:`ntn-skills` 不负责模型路由、API Gateway、全局共享指令或通用 MCP 代理,这些能力交给专业控制面更合适。
302
+
303
+ ### 推荐互补组合
304
+
305
+ `ntn-skills` 与 [Magpie](https://usemagpie.ai) 这类多 Agent 控制面天然处于不同层级,搭配使用可以各取所长:
306
+
307
+ - **Magpie 负责运行底座与统一分发**:集中管理模型订阅与 API 密钥、路由组与回退策略、本地 Gateway 与预算、全局共享指令,以及向本机各 Agent 统一分发 MCP 服务器。
308
+ - **`ntn-skills` 负责百级至千级 Skill 知识中台**:在 Notion 中可视化整理、演进与追踪多上游技能并打可回退热补丁,再按三层可见性与精确白名单 / `Requires` 闭包物化到 `~/.agents/skills`、`:copy` 沙盒或项目专属目录。
309
+ - **推荐衔接方式**:用 Magpie 以 `local` 模式将 `ntn-skills mcp` 注册并分发给本机各 Agent(仅留在本机,不随跨机同步覆盖其他机器路径);若已开启 Magpie 的 MCP Router,将其设为 `direct` 模式保持各 Agent 直连本地 stdio;同时让 `ntn-skills export` 单独接管本地 Skill 目录,避免两端重复管理同一目录:
310
+
311
+ ```bash
312
+ # 通过 Magpie 向本机指定 Agent 分发 `ntn-skills mcp`(`--local` 使其仅留在本机,不参与跨机同步)
313
+ magpie library mcp add ntn-skills ntn-skills mcp agents=claude,codex --local
314
+
315
+ # 若已开启 Magpie MCP Router,将 `ntn-skills` 设为直连模式,由各 Agent 直接拉起本地 stdio
316
+ magpie library mcp router ntn-skills direct
317
+ ```
318
+
319
+ ---
320
+
231
321
  ## 安全与数据边界
232
322
 
233
323
  - **日常消费零网络请求**:日常会话仅读取 `$XDG_DATA_HOME/ntn-skills/store/`(默认 `~/.local/share/ntn-skills/store/`)下的只读不可变快照(`0444/0555`);仅在显式运行同步/维护 CLI 或系统定时任务时访问 `api.notion.com` 与用户配置的 Git 远端。
234
- - **本地凭据保护与零第三方遥测**:`credentials.env` 存放在 `$XDG_CONFIG_HOME/ntn-skills/`(默认 `~/.config/ntn-skills/credentials.env`),`doctor` 强制校验 `0600` 权限;工作区自动剥离 `.env` 等敏感文件;调用统计(`telemetry/usage.jsonl`)与同步日志(`2 MiB` 上限轮转)100% 留在本机,绝不外发。
324
+ - **本地凭据保护、上传前置敏感文件拦截与零第三方遥测**:`credentials.env` 存放在 `$XDG_CONFIG_HOME/ntn-skills/`(默认 `~/.config/ntn-skills/credentials.env`),`doctor` 强制校验 `0600` 权限;`new` 与 `push` 上传前执行 Fail-Closed 安全扫描,自动阻断越界符号链接及高危敏感文件(`.env`/`.env.*`(豁免 `.env.example`/`.sample`/`.template`/`.dist`)、私钥证书、`*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc` 及含 `_authToken` 的 `.npmrc`)且绝不打印文件内容;调用统计(`telemetry/usage.jsonl`)与同步日志(`2 MiB` 上限轮转)100% 留在本机,绝不外发。
235
325
  - **非受管目录保护与零永久删除**:`export` 绝不覆盖宿主目录中已有的非受管文件或软链;工作区和过期缓存回收统一移入系统废纸篓;Notion 技能下线走软标记 `Status = retired`。
236
326
  - **形式化验证**:核心并发锁、重叠窗口增量同步与原子快照切换不变量配有 TLA+ 规约(见 [`verification/`](https://github.com/yoyooyooo/ntn-skills/tree/main/verification))。
237
327
 
@@ -240,7 +330,7 @@ ntn-skills schedule export --target dagu|github-actions|crontab
240
330
  ## 适用范围与非目标
241
331
 
242
332
  - **聚焦 Agent Skills 生命周期**:`ntn-skills` 专注管理基于 `SKILL.md` 与附属脚本/参考文档的技能资产;不承担 MCP Server 托管代理、通用密钥管理或宿主系统初始化编排。
243
- - **刻意保持单向同步边界**:`ntn-skills sync` 仅从 Notion/Git 向本机单向拉取并在 `Local Pending` 提示本地未入库增量,绝不静默将本地临时试验推上云端;所有写回均须显式经过 `new` 或 `edit -> diff --remote -> push`。
333
+ - **刻意保持单向三通道边界**:`ntn-skills sync` 仅从 Notion/Git 向本机单向拉取(支持 `--dry-run` 零磁盘写入预演)并在 `Local Pending` 提示本地未入库增量,绝不静默将本地临时试验推上云端;新建与批量收编走 `new`(含 `--pending` 与 `--dry-run`),修改已有技能走 `edit -> diff --remote -> push`(含批量 `push --pending`)或显式单目录 `push <dir> --overwrite | --to <name>`。
244
334
 
245
335
  ---
246
336
 
package/SECURITY.md CHANGED
@@ -12,7 +12,7 @@
12
12
  - **Local Secret Storage**: `ntn-skills` reads `NOTION_TOKEN` and optional `GITHUB_TOKEN` from `$XDG_CONFIG_HOME/ntn-skills/credentials.env` (default `~/.config/ntn-skills/credentials.env`) and verifies `0600` file permissions via `ntn-skills doctor`.
13
13
  - **Zero Consumer-Time Network Access**: Everyday skill consumption reads immutable local files (`0444/0555`) under `$XDG_DATA_HOME/ntn-skills/store/`. Network calls to `api.notion.com` and configured Git remotes occur only during explicit CLI commands or user-installed background sync jobs.
14
14
  - **Local-Only Telemetry**: Usage counters (`telemetry/usage.jsonl`) and API latency logs are bounded (`2 MiB` rotation) and stored strictly on the local machine. Nothing is transmitted to third-party analytics endpoints.
15
- - **Workdir Secret Scrubbing**: Isolated edit workdirs ignore `.env`, `.env.*`, and credential files during `diff` and `push`.
15
+ - **Fail-Closed Sensitive File Pre-Scan**: Before uploading to Notion, `new` and `push` scan local skill directories to block out-of-root symlinks and sensitive files (`.env`, `.env.*` except `.env.example`/`.sample`/`.template`/`.dist`, private keys/certs `*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`, `*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`, and `.npmrc` containing `_authToken`) without printing file contents.
16
16
 
17
17
  ## Reporting a Vulnerability
18
18
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "ntn-skills"
3
- description: "Manage, maintain, synchronize, and schedule Notion 3-table Skills (v2). Use ONLY when the user asks to create, edit, diff, push, configure metadata, detach, reset overlays, or retire Skills in Notion, onboard/update upstream Git Sources, or inspect/install/export background sync timers, Dagu DAGs, GitHub Actions, and request telemetry. Do NOT load for ordinary Skill consumption."
3
+ description: "Maintain Notion 3-table Skills library, upstream Git sources, and sync schedules via ntn-skills CLI. Use ONLY to manage skills/sources/timers; NEVER load for consuming skills."
4
4
  ---
5
5
 
6
6
  # ntn-skills (v2) — 控制面维护与调度运维手册
@@ -38,11 +38,14 @@ ntn-skills info <name> [--json] </dev/null
38
38
  # 按需物化单个 Skill 到只读 store(仅拿目录路径可加 --path-only)
39
39
  ntn-skills load <name> [--refresh] [--path-only] [--json] </dev/null
40
40
 
41
- # 增量同步(默认 2 分钟重叠窗口)或全量对账(--full)
42
- ntn-skills sync [--full] [--coalesce] [--json] </dev/null
41
+ # 增量同步(默认 2 分钟重叠窗口)、全量对账(--full)或零磁盘写入预演(--dry-run)
42
+ # 注:sync 严格单向只读 Notion,绝不静默向 Notion 回推本地改动;--dry-run 严格零磁盘变更并预览 pulled、plannedMaterializations、plannedExports、plannedPrunes 与 localPending
43
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json] </dev/null
43
44
 
44
- # 幂等导出到指定宿主目录(symlink 或 copy)
45
- ntn-skills export [--to <dir>] [--profile <p>] [--scene <s>] [--mode symlink|copy] [--include-non-default] </dev/null
45
+ # 幂等导出到指定宿主目录(支持 --dry-run 零写入预览、属性过滤、精确 --skills 白名单、--exclude 排除、Requires 依赖闭合与 --spec 声明文件批量投影)
46
+ # 注:精确白名单模式忽略全局 visibility/profiles/scenes,默认闭合 Requires(--no-requires 可关)且默认不生成 skill-catalog;对未预物化的 manual 技能会自动按需物化;copy 模式与目标目录中的非受管子目录安全共存
47
+ ntn-skills export [--to <dir>] [--skills <a,b>] [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--profile <p>] [--scene <s>] [--mode symlink|copy] [--include-non-default] [--dry-run] [--json] </dev/null
48
+ ntn-skills export --spec <export-spec.json> [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json] </dev/null
46
49
 
47
50
  # 初始化新库(空白 Notion 页自动创建纯净 3 表及双向关系;已有 3 表则直接绑定)或扩展新机器
48
51
  # 支持任意宿主目录(如 Grok Box 的 ${HOME}/agent-data/workflows:copy 实体拷贝模式 + ~/.agents/skills 软链双面同时导出)
@@ -54,6 +57,9 @@ ntn-skills doctor [--json] </dev/null
54
57
  # 演进池治理总览(Visibility 分布、草稿缓冲池、活跃 Overlay 热补丁、近 30 天按需加载热度榜)
55
58
  ntn-skills status [--days 30] [--json] </dev/null
56
59
 
60
+ # 启动内置只读 stdio MCP Server(向 Claude Desktop / Cursor / agy 等任意 MCP 宿主暴露 skill_find 与 skill_load)
61
+ ntn-skills mcp [--library <uuid>] [--scenes <a,b>] [--instructions "<text>"]
62
+
57
63
  # 查看上游源列表 / 孤儿编辑工作区 / 请求遥测统计
58
64
  ntn-skills source list [--json] </dev/null
59
65
  ntn-skills work list [--json] </dev/null
@@ -82,8 +88,16 @@ ntn-skills push "$WORKDIR" --dry-run </dev/null
82
88
 
83
89
  # 5) 正式有序推送(先 Files -> 后 SKILL.md -> 再属性 -> 本地同步 -> 自动将 workdir 移入废纸篓)
84
90
  ntn-skills push "$WORKDIR" </dev/null
91
+
92
+ # 6) 批量推送多个工作区或全部未推送工作区(--pending 扫描 work/;单条基线漂移失败隔离,末尾合并执行 1 次本地同步)
93
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--library <uuid>] [--json] </dev/null
94
+
95
+ # 7) 普通本地目录直推覆盖已有 Notion 技能(无 .ntn-skill.json 时必须显式传 --overwrite 或 --to <name>,强烈建议先 --dry-run 预览逐文件 diff;绝不删除源本地目录)
96
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--library <uuid>] [--json] </dev/null
85
97
  ```
86
98
 
99
+ - **单向三通道边界**:`sync` 永远只读单向拉取 Notion;新建与批量收编走 `new`;修改已有技能走 `edit -> diff --remote -> push`(或显式单目录 `push <dir> --overwrite | --to <name>`)。
100
+ - **敏感文件 Fail-Closed 拦截**:`new` 与 `push` 在上传前自动扫描目录,阻断越界符号链接及高危敏感文件(`.env` / `.env.*`(豁免 `.env.example`/`.env.sample`/`.env.template`/`.env.dist`)、`*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`、`*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`、含 `_authToken` 的 `.npmrc`),仅报相对路径且绝不打印文件内容。
87
101
  - **冲突处置**:若 `diff --remote` 显示 `Remote drift detected` 或 `push` 报 `baseline_drift` 冲突,**严禁未经用户明确授权盲目加 `--force`**!应先核对远端变更,或用 `ntn-skills abort "$WORKDIR" </dev/null` 安全放弃旧工作区后重新 `edit`。
88
102
  - **清理陈旧工作区**:`ntn-skills work clean --days 7 </dev/null`。
89
103
 
@@ -96,8 +110,11 @@ ntn-skills push "$WORKDIR" </dev/null
96
110
  # 从含合法 SKILL.md(带 name/description frontmatter)的本地目录创建纯 Notion 草稿/自有 Skill
97
111
  # 注:--profiles / --scenes / --add-profile / --add-scene / --require 既支持逗号分隔(ops,ci)也支持重复传参(--add-scene ops --add-scene ci)
98
112
  # 注:new / set / push / attach / detach / reset-overlay / rm / source add / upstream apply 成功后均会自动同步本地 catalog.json 并刷新已配置的 exports 软链,无需额外手动跑 sync 或 export!
113
+ # 注:未显式指定单技能可见性时默认 discoverable,含 disable-model-invocation: true 的技能会自动归入 manual
99
114
  # 若 <dir> 直接位于导出目录内(如先在 ~/.agents/skills/<name> 本地孵化试跑),上传成功后会自动将该本地目录移入废纸篓并原地接管为受管软链或编入 skill-catalog;其他临时目录可加 --adopt 自动回收
100
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--profiles default,mini] [--scenes ops,ci] [--adopt] </dev/null
115
+ # 支持多目录 <dir...>、--pending(扫描配置 exports 中所有非受管本地目录,强制要求显式指定可见性;默认跳过外部软链,--include-symlinks 可纳入)、--exclude 与 --dry-run 零写入预演
116
+ # 批量模式下单条失败(重名/敏感文件/解析异常)隔离记入 failed[] 不连坐健康项,成功项先移入废纸篓,末尾合并执行 1 次本地 sync 重建受管软链
117
+ ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual | --default] [--kind skill|router|prompt] [--profiles default,mini] [--scenes ops,ci] [--adopt | --no-adopt] [--dry-run] [--library <uuid>] [--json] </dev/null
101
118
 
102
119
  # 声明式修改单个或批量技能元数据(支持多个 <name...> 或 --source <源名> 批量修改,无需 edit/push)
103
120
  ntn-skills set [<name...>] [--source <source-name-or-id>] \
@@ -142,6 +159,7 @@ ntn-skills rm <name> </dev/null
142
159
  ### 5.1 接入与更新上游 Git 源
143
160
  ```bash
144
161
  # 注册新 Git 仓库源并自动扫描导入其中所有 SKILL.md(可用 --root 仅扫指定子目录,自动跳过 dist/skill-snapshots 等历史产物目录)
162
+ # 注:即使传入 --discoverable(或 --visibility always)整仓导入,含 disable-model-invocation: true 的子技能也会自动归入 manual
145
163
  ntn-skills source add <repo-url> [--name <source-name>] [--ref main] [--policy track|pinned|manual] [--root skills] [--visibility manual|discoverable|always | --discoverable] [--scenes ops,coding] </dev/null
146
164
 
147
165
  # 调整已有上游源的策略、分支或启停状态