ntn-skills 0.3.0 → 2.0.1
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/CHANGELOG.md +22 -211
- package/CONTRIBUTING.md +19 -55
- package/INSTALL.md +132 -0
- package/LICENSE +1 -1
- package/README.md +215 -181
- package/README.zh-CN.md +216 -181
- package/SECURITY.md +13 -40
- package/assets/ntn-skills/SKILL.md +187 -0
- package/dist/bin.js +9324 -0
- package/package.json +27 -49
- package/THIRD_PARTY_NOTICES.md +0 -62
- package/dist/ntn-skills.js +0 -48588
- package/docs/README.md +0 -18
- package/docs/historical-operations.md +0 -60
- package/docs/host-integration.md +0 -135
- package/docs/portable-converter.md +0 -45
- package/docs/protocol.md +0 -531
- package/docs/releasing.md +0 -96
- package/docs/remote-proof-converter.md +0 -127
- package/docs/usage.md +0 -524
- package/skills/notion/ntn-skills-maintain/SKILL.md +0 -64
- package/skills/notion/ntn-skills-maintain/references/operations.md +0 -76
- package/skills/notion/ntn-skills-sync/SKILL.md +0 -54
- package/skills/notion/ntn-skills-sync/references/synchronization.md +0 -84
- package/skills/ntn-skills/SKILL.md +0 -64
- package/skills/ntn-skills/references/commands.md +0 -102
- package/skills/ntn-skills/references/integration.md +0 -65
package/README.md
CHANGED
|
@@ -1,236 +1,270 @@
|
|
|
1
1
|
<h1 align="center">ntn-skills</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">Bring your Notion workflow library into an Agent or terminal.<br>Discover the right Skill, read its instructions, and keep one version for the whole task.</p>
|
|
4
|
-
|
|
2
|
+
<p align="center">Notion 3-table control plane and zero-latency local skill runtime for AI coding agents.</p>
|
|
5
3
|
<p align="center">
|
|
6
4
|
<a href="./README.md">English</a> · <a href="./README.zh-CN.md">简体中文</a>
|
|
7
5
|
</p>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="#installation">Install</a> · <a href="#quick-start">Quick start</a> · <a href="#common-workflows">Workflows</a> · <a href="#agent-integration">Agent integration</a> · <a href="./docs/README.md">Docs</a>
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
6
|
<p align="center">
|
|
14
|
-
<a href="
|
|
15
|
-
<a href="
|
|
16
|
-
<a href="
|
|
7
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
8
|
+
<a href="#how-it-works">How It Works</a> ·
|
|
9
|
+
<a href="#cli-reference">CLI Reference</a> ·
|
|
10
|
+
<a href="#security-privacy--data-boundaries">Security</a> ·
|
|
11
|
+
<a href="./INSTALL.md">Agent Setup (<code>INSTALL.md</code>)</a> ·
|
|
12
|
+
<a href="./assets/ntn-skills/SKILL.md">Built-in Guide (<code>SKILL.md</code>)</a>
|
|
17
13
|
</p>
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
ntn-skills list
|
|
21
|
-
ntn-skills read 'Release Review'
|
|
22
|
-
```
|
|
15
|
+
---
|
|
23
16
|
|
|
24
|
-
`
|
|
17
|
+
`ntn-skills` turns a **3-table Notion database** (`Sources`, `Skills`, `Files`) into a visual, cross-machine control plane for your AI Agent skills — while keeping **everyday skill consumption 100% local, immutable, and zero-latency** via standard symlinks (`~/.agents/skills`), managed directory copies (e.g. cloud sandboxes), and an auto-synthesized local directory skill (`skill-catalog`).
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
No MCP tool overhead on every prompt. No bloated git-submodule choreography across machines. Just clean local files for every agent host, and a clean Notion cockpit for you.
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
---
|
|
29
22
|
|
|
30
|
-
|
|
23
|
+
## Quick Start
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
Paste this single sentence into **Claude Code, Cursor, Pi, Codex, Grok Bot, Antigravity**, or any coding agent with shell access:
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| When you want to… | Use |
|
|
37
|
-
| --- | --- |
|
|
38
|
-
| Find a workflow without loading the whole library | `list` |
|
|
39
|
-
| Read instructions and supporting files from one version | `read`, then `files` |
|
|
40
|
-
| Move a complete Skill between local files and Notion | `create`, `replace`, `export` |
|
|
41
|
-
| Apply file and metadata changes to one pinned page | `apply` |
|
|
42
|
-
| Subscribe Git Skills into Notion and keep them current | `sync upstream connect`, `sync upstream run` |
|
|
43
|
-
| Keep an existing page and local Skill directory in sync | `sync local connect`, `sync local run` |
|
|
44
|
-
|
|
45
|
-
## Installation
|
|
46
|
-
|
|
47
|
-
Install [Node.js](https://nodejs.org) **22.22.3+ within 22.x, or 24.20.0+**, which includes npm. Online operations also need the [official Notion CLI](https://developers.notion.com/cli) **`ntn`** with `api --notion-version` support; `ntn` 0.22.12 has been exercised with this project.
|
|
48
|
-
|
|
49
|
-
Install the published release from the official npm registry:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npm install --global ntn-skills --registry https://registry.npmjs.org
|
|
53
|
-
ntn-skills --version
|
|
54
|
-
ntn-skills --help
|
|
27
|
+
```text
|
|
28
|
+
Read https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/INSTALL.md and set up ntn-skills for me.
|
|
55
29
|
```
|
|
56
30
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
To produce a package yourself, follow [the contributor setup and build instructions](CONTRIBUTING.md#development-setup). Bun installs dependencies and builds the package; development and real SQLite consumers execute on Node.js.
|
|
31
|
+
Your agent will inspect your machine, install the CLI (linking the built-in `ntn-skills` guide), help you store your Notion token in a `0600` local file (never pasted into chat), automatically create the 3 Notion tables on a blank page, enable background sync, and verify everything with `ntn-skills doctor` (`6/6 pass`).
|
|
60
32
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### 1. Connect Notion
|
|
64
|
-
|
|
65
|
-
Configure `ntn` through [its authentication guide](https://developers.notion.com/cli/get-started/authentication). Your connection needs Read content access to a database with rich-text `Description` and `References` properties. `References` lists Notion page mentions or page links; each linked page becomes a Markdown file under `references/`. The native Skills database/export mode is also supported for existing libraries.
|
|
66
|
-
|
|
67
|
-
That database needs at least one valid Skill. Notion Name and authored frontmatter `name` are human-readable names preserved exactly: Unicode, digits, spaces and hyphens are allowed; names must be nonempty and contain no control characters. For example, `Tty7` stays `Tty7`, while its callable alias is `tty7`. Aliases normalize to NFC and lowercase, trim surrounding whitespace, replace whitespace runs with `-`, and percent-encode characters outside Unicode letters, marks, numbers, `_` and `-`. Aliases are selection values, never identity; collisions require an exact page ID or ref. `--name` explicitly overrides the human title without changing page identity. [Naming and database requirements](docs/protocol.md#identity-and-references).
|
|
68
|
-
|
|
69
|
-
`ctl database init --parent PAGE_ID` creates a content table and a separate upstream subscription table under an owned page; attach exact existing tables with `--content-database ID --upstream-database ID`. It validates field types and native relation targets before publishing configuration. Repeat the same target to resume safely. The default write database stays independent unless `--set-default` is supplied.
|
|
70
|
-
|
|
71
|
-
Content origin uses `Source Type` (`builtin`, `upstream`, `manual`) and exact rich-text `Builtin ID`, independently of Kind and Sync Mode. Explicit init upgrades existing tables, including repeated published attaches, without backfilling legacy rows. Ordinary create supports tables missing these fields; replace/write preserve provenance. Deliberate builtin/upstream publication requires the upgraded schema. Equal content with changed provenance is a metadata-only update; complete equality is mutation-free reuse. [Origin and frozen recovery](docs/protocol.md).
|
|
72
|
-
|
|
73
|
-
Use `ntn-skills sync upstream connect SOURCE --database DATABASE` to register a Git source and synchronize its Skills. Repeating the same connection reuses its subscription. Later, `sync upstream run` takes either repeatable `--target SUBSCRIPTION_ID` or `--all`. Each run records status, attempt/success times and a summary; failed or partial batches continue other targets and exit nonzero. Advanced registration and plan/apply remain available under `sync upstream`. [Recurring synchronization and table setup](docs/usage.md#recurring-upstream-synchronization).
|
|
74
|
-
|
|
75
|
-
Ordinary `run` checks retained work before planning new changes and restores an owned tracked member whose original page is confirmed readable in Notion Trash. The old page stays in Trash; a verified replacement updates that member's mapping. Missing or inaccessible pages are explicit failures. Historical rebuild, adoption and targeted repair commands belong to the separate [operator artifact](docs/historical-operations.md).
|
|
76
|
-
|
|
77
|
-
The content table supports `Kind=skill|router|prompt`. Skill uses `SKILL.md`; Router uses `ROUTER.md` with member metadata and stable refs, and loads members only when the Agent selects them; Prompt uses `PROMPT.md` as an explicit user requirement on each submission. `list` returns `records` with kind, stable identity, locator and entrypoint. Reads and exports return the same `record` and fixed snapshot. Missing historical Kind means Skill.
|
|
78
|
-
|
|
79
|
-
To create a Prompt or Router, stage a portable v2 manifest and body file, then use `create` with the existing flags: [complete Prompt/Router staging and commands](docs/usage.md#creating-a-prompt-or-router-from-portable-v2). Filename/frontmatter alone does not select kind; [portable input contract](docs/protocol.md#portable-input-contract).
|
|
80
|
-
|
|
81
|
-
Automatic upstream subscription Routers require at least two verified published active Skills. Zero or one member produces no Router catalog entry; use the individual Skill ref for a single member. Current exact Router reads reject insufficient membership. Manually authored content-table Routers keep their explicit Members behavior. See [subscription and Router usage](docs/usage.md#initialize-content-and-subscription-tables).
|
|
82
|
-
|
|
83
|
-
`Default Context` is an independent checkbox for each Skill or Router. Missing or unchecked means false. Prompt is always excluded from default discovery, background prefetch and native Skill installation; explicitly selecting it again adds its requirements to the new turn. Initialization creates the checkbox but never checks it automatically.
|
|
84
|
-
|
|
85
|
-
Authentication priority is saved `config.token` → non-empty `NOTION_API_TOKEN` → existing `ntn login`. A saved token is plaintext in the private config file; `ctl config show` reports only whether it is configured. [Token setup and removal](docs/usage.md#authentication).
|
|
86
|
-
|
|
87
|
-
### 2. Check access and choose a workflow
|
|
33
|
+
<details>
|
|
34
|
+
<summary>Prefer manual installation?</summary>
|
|
88
35
|
|
|
89
36
|
```bash
|
|
90
|
-
|
|
91
|
-
ntn-skills
|
|
37
|
+
# 1. Install CLI via npm / Bun (Node >= 20 or Bun >= 1.2), or use install.sh --with-pi for Pi extension
|
|
38
|
+
npm install -g ntn-skills && ntn-skills skill --install
|
|
39
|
+
# Alternative (with Pi extension): curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- --with-pi
|
|
40
|
+
|
|
41
|
+
# 2. Save your Notion Integration token (0600 permissions; respects XDG_CONFIG_HOME)
|
|
42
|
+
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/ntn-skills"
|
|
43
|
+
cat > "${XDG_CONFIG_HOME:-$HOME/.config}/ntn-skills/credentials.env" <<'EOF'
|
|
44
|
+
NOTION_TOKEN=ntn_your_token_here
|
|
45
|
+
# Optional: GITHUB_TOKEN=ghp_...
|
|
46
|
+
EOF
|
|
47
|
+
chmod 600 "${XDG_CONFIG_HOME:-$HOME/.config}/ntn-skills/credentials.env"
|
|
48
|
+
|
|
49
|
+
# 3. Bootstrap a blank Notion page (defaults to prefetch=discoverable) + initial sync
|
|
50
|
+
ntn-skills init --root "https://www.notion.so/your-page-url"
|
|
51
|
+
|
|
52
|
+
# 4. Enable native background sync (launchd on macOS / systemd on Linux)
|
|
53
|
+
ntn-skills schedule install
|
|
54
|
+
|
|
55
|
+
# 5. Verify health (expect 0 fail)
|
|
56
|
+
ntn-skills doctor
|
|
57
|
+
ntn-skills skill # Print built-in agent guide shipped with this binary
|
|
92
58
|
```
|
|
93
59
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Prerequisites & Supported Platforms
|
|
65
|
+
|
|
66
|
+
- **OS**: macOS (launchd background timer, Finder Trash) and Linux (systemd user timer, XDG Trash). Windows is supported via WSL2.
|
|
67
|
+
- **Runtime**: `git` plus **Node.js `>= 20`** (via `npm install -g ntn-skills`) or **[Bun](https://bun.sh) `>= 1.2.0`**.
|
|
68
|
+
- **Notion**: A [Notion Internal Integration](https://www.notion.so/profile/integrations) token granted access to one blank Notion page (or an existing `ntn-skills` root page).
|
|
69
|
+
- **Host Compatibility**: Works out of the box with Claude Code, Codex, Cursor, Pi, Antigravity, Grok Bot (`${HOME}/agent-data/workflows:copy`), and any agent reading Markdown skills from disk.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## How It Works
|
|
74
|
+
|
|
75
|
+
You do **not** need to memorize CLI flags for daily use. `ntn-skills` separates **what you do as a human** from **how your agents consume or maintain skills**.
|
|
76
|
+
|
|
77
|
+
### 1. The Human Perspective (What You Care About)
|
|
78
|
+
|
|
79
|
+
1. **Tweaking Properties Directly in Notion (Desktop or Mobile)**
|
|
80
|
+
- **What you do**: Change `Visibility` (`always` for top-level daily skills, `discoverable` for curated on-demand skills indexed into `skill-catalog`, `manual` for silent external reserves), edit `Description` triggers, organize `Scenes` / `Profiles`, or uncheck `Enabled`.
|
|
81
|
+
- **How it takes effect**: Just close the tab. Each machine's 12-minute background sync updates local symlinks and rebuilds `skill-catalog` automatically — or tell your agent *"sync my skills"* (`ntn-skills sync`) to apply immediately.
|
|
82
|
+
|
|
83
|
+
2. **Editing `SKILL.md` Body Text in Notion (One Important Distinction)**
|
|
84
|
+
- **Notion-native draft skills (`Origin` is empty)**: The Notion page body *is* the single source of truth. Any edit you make in Notion flows straight to your machines on sync (`ntn-skills sync --full` forces an immediate body refresh if Notion omits page-body timestamps).
|
|
85
|
+
- **Upstream Git skills (`Origin` is set)**: By default (`Custom Main` unchecked), the Notion page body is a **read-only preview mirror** of the upstream Git file, and local consumption follows Git. If you intentionally edit an upstream skill's body in Notion and want machines to consume your version, **check `Custom Main`** (otherwise `sync` surfaces a drift warning so you never wonder why a web edit didn't go live).
|
|
86
|
+
|
|
87
|
+
3. **Live-Patching an Upstream Skill Without Forking Its Repo**
|
|
88
|
+
- **What you do**: Tell your agent in plain language: *"Add our local directory conventions and a helper script to the `dagu` skill and push the patch to Notion so I can test it this week."*
|
|
89
|
+
- **What happens**: Your agent runs an isolated `edit -> diff --remote -> push` cycle, setting `Custom Main = true` and recording `override / delete` entries in `Files`. Every machine immediately consumes the merged UnionFS snapshot (Upstream Git + Notion overlay).
|
|
90
|
+
- **Two clean exits**:
|
|
91
|
+
- Discard the experiment: say *"Revert local overlays on `dagu`"* (`reset-overlay`) to snap back to clean upstream in one second.
|
|
92
|
+
- Graduate into your personal Git repo: say *"Export `dagu` cleanly into my personal skills repo"* (`pull --clean` + `attach` / `upstream apply`). Once upstream Git catches up, redundant Notion overlays auto-archive back to zero.
|
|
93
|
+
|
|
94
|
+
4. **Incubating a Temporary Local Skill First, Then Saving It to Notion**
|
|
95
|
+
- **Incubate locally**: Have your agent create a plain local skill folder right inside `~/.agents/skills/<temp-skill>/` and iterate across local sessions without touching Notion (background sync never touches unmanaged local folders, and `sync` reports unmanaged local candidates under `Local Pending`).
|
|
96
|
+
- **Save & adopt in place**: Once happy, tell your agent *"Save `<temp-skill>` to Notion"* (`ntn-skills new ~/.agents/skills/<temp-skill> [--always | --discoverable]`). After Notion upload succeeds, `ntn-skills` automatically moves the temporary folder to OS Trash and seamlessly replaces it with an immutable managed symlink (`always`) or indexes it into `skill-catalog` (`discoverable`).
|
|
97
|
+
|
|
98
|
+
5. **Collecting Huge External Repos + Checking Governance Health**
|
|
99
|
+
- Import 200-skill community repos safely as `manual` (zero context cost); import your own primary repo with `--discoverable`.
|
|
100
|
+
- Run `ntn-skills status` anytime to see 30-day on-demand `Hot Loads` (promote frequent winners to `always`), active `Overlays`, and `Draft Buffer` candidates ready to graduate to Git.
|
|
101
|
+
|
|
102
|
+
### 2. The Agent Perspective (99% Consumer Mode vs. 1% Maintainer Mode)
|
|
103
|
+
|
|
104
|
+
| Mode | When Active | What the Agent Sees & Does |
|
|
105
|
+
| :--- | :--- | :--- |
|
|
106
|
+
| **Consumer Mode (99% of sessions)** | Normal coding, research, design, and ops tasks | **Zero Notion awareness, zero network calls**:<br>1. **`always` skills**: Linked directly at `~/.agents/skills/<name>` (or copied for `:copy` targets) for `0 ms` reads.<br>2. **`discoverable` skills**: Every host sees one auto-synthesized read-only skill **`skill-catalog`**. When a specialized task arises, the agent reads `skill-catalog/SKILL.md` -> `references/<scene>.md` -> directly `Read`s the pre-materialized local `store/.../SKILL.md` (two pure file reads, no plugins required).<br>3. **`manual` skills**: Hidden from default context and `skill-catalog`; woken on demand via `$skill` / `skill_find` / `skill_load` in Pi, strategy routers, or `ntn-skills load`.<br>4. **Read-only rule**: `store/` snapshots are `0444/0555` immutable; agents never edit them in place. |
|
|
107
|
+
| **Maintainer Mode (1% of sessions)** | Only when you ask to set up, import, create, patch, or diagnose skills | Reads the built-in **`ntn-skills`** guide shipped with the CLI (or runs `ntn-skills skill`), executes isolated `new / set / edit / diff --remote / push` workflows, and moves temporary workdirs to OS Trash on completion. |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Architecture
|
|
112
|
+
|
|
113
|
+
```mermaid
|
|
114
|
+
flowchart LR
|
|
115
|
+
subgraph Control["Notion Control Plane (Human Visual Cockpit)"]
|
|
116
|
+
SRC["Sources
|
|
117
|
+
(Upstream & Private Git Repos)"]
|
|
118
|
+
SKL["Skills
|
|
119
|
+
(Visibility / Scenes / SKILL.md)"]
|
|
120
|
+
FIL["Files
|
|
121
|
+
(Draft Assets & Overlay Diffs)"]
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
subgraph Local["Local Runtime ($XDG_DATA_HOME/ntn-skills)"]
|
|
125
|
+
CAT["catalog.json & manifest.json
|
|
126
|
+
(Delta Watermark + Static Lockfile)"]
|
|
127
|
+
STO["Immutable Store
|
|
128
|
+
(0444/0555 · always + discoverable prefetched)"]
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
subgraph Hosts["Host-Agnostic Zero-Latency Consumption"]
|
|
132
|
+
EXP["~/.agents/skills/ or :copy target
|
|
133
|
+
(always skills + auto skill-catalog)"]
|
|
134
|
+
ANY["Any Agent Host (Claude Code / Codex / Grok Bot / Cursor / Antigravity)
|
|
135
|
+
2-hop pure file Read"]
|
|
136
|
+
PI["Pi Extension
|
|
137
|
+
($skill inline injection + skill_find / skill_load)"]
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
SRC --> SKL
|
|
141
|
+
FIL --> SKL
|
|
142
|
+
Control -- "12m delta sync
|
|
143
|
+
(launchd / systemd)" --> CAT
|
|
144
|
+
CAT --> STO
|
|
145
|
+
STO -- "Atomic Symlink / Copy" --> EXP
|
|
146
|
+
EXP --> ANY
|
|
147
|
+
CAT --> PI
|
|
148
|
+
STO --> PI
|
|
104
149
|
```
|
|
105
150
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### 4. Read supporting files from the same version
|
|
151
|
+
---
|
|
109
152
|
|
|
110
|
-
|
|
153
|
+
## Minimal 3-Table Notion Schema
|
|
111
154
|
|
|
112
|
-
|
|
113
|
-
ntn-skills files 'SNAPSHOT_ID_FROM_READ'
|
|
114
|
-
ntn-skills read 'ATTACHMENT_REF_FROM_FILES'
|
|
115
|
-
```
|
|
155
|
+
Created automatically by `ntn-skills init --root <blank-page-url>`:
|
|
116
156
|
|
|
117
|
-
|
|
157
|
+
| Table | Purpose | Key Properties |
|
|
158
|
+
| :--- | :--- | :--- |
|
|
159
|
+
| **`Sources`** | Upstream & private Git skill repositories | `Name`, `Repo URL`, `Ref`, `Pinned Commit`, `Policy` (`track \| pinned \| manual`), `Enabled`, `Last Checked`, `Skills` |
|
|
160
|
+
| **`Skills`** | Master catalog, 3-tier routing & `SKILL.md` body | `Name`, `Description`, `Enabled`, `Visibility` (`always \| discoverable \| manual`), `Kind` (`skill \| router \| prompt`), `Profiles`, `Scenes`, `Requires`, `Origin`, `Source Path`, `Custom Main`, `Revision`, `Preview Hash`, `Status`, `Supporting Files` |
|
|
161
|
+
| **`Files`** | Draft supporting files & upstream diff overlays | `Name`, `Skill`, `Path`, `Status` (`override \| delete`), `Executable`, `SHA256`, `External URL`, `Attachment` |
|
|
118
162
|
|
|
119
|
-
|
|
163
|
+
> **Subtree-Hash Pruning & Zero Redundancy**: Unmodified upstream skills store **0 rows** in `Files` (an auto-maintained read-only `Upstream Files` child page at row 1 of each Skill page shows the upstream file tree). When a multi-skill upstream repo gets a new commit, untouched sibling skills incur **0 Notion writes** and keep a stable `effectiveRev`.
|
|
120
164
|
|
|
121
|
-
|
|
165
|
+
---
|
|
122
166
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Register a known database as a domain, then select it explicitly. Replace the database placeholder before running:
|
|
167
|
+
## CLI Reference
|
|
126
168
|
|
|
169
|
+
### Setup, Built-in Guide & Diagnostics
|
|
127
170
|
```bash
|
|
128
|
-
|
|
129
|
-
ntn-skills
|
|
130
|
-
ntn-skills
|
|
171
|
+
# Omit --root when re-initializing if default_library is already set in XDG config
|
|
172
|
+
ntn-skills init [--root <notion-page-url>] [--export ~/.agents/skills] [--export '${HOME}/agent-data/workflows:copy'] [--profile default] [--prefetch discoverable]
|
|
173
|
+
ntn-skills skill [--path] [--install [--dest ~/.agents/skills] [--force]] [--uninstall]
|
|
174
|
+
ntn-skills doctor [--json]
|
|
175
|
+
ntn-skills status [--days 30] [--json]
|
|
176
|
+
ntn-skills sync [--full] [--coalesce] [--json]
|
|
177
|
+
ntn-skills find [query] [--scene <scene>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--json]
|
|
178
|
+
ntn-skills info <name> [--json]
|
|
179
|
+
ntn-skills load <name> [--refresh] [--path-only]
|
|
131
180
|
```
|
|
132
181
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
### Import, export or update a Skill
|
|
136
|
-
|
|
137
|
-
A Skill can be a folder, ZIP, or Markdown file. Preview remote changes before applying them:
|
|
138
|
-
|
|
182
|
+
### Editing, Batch Metadata, Drafts & Overlay Tuning
|
|
139
183
|
```bash
|
|
140
|
-
|
|
141
|
-
ntn-skills
|
|
142
|
-
ntn-skills
|
|
143
|
-
ntn-skills
|
|
184
|
+
# Safe isolated edit workflow (never mutates read-only store/)
|
|
185
|
+
WORKDIR=$(ntn-skills edit "<name>")
|
|
186
|
+
ntn-skills diff "$WORKDIR" --remote
|
|
187
|
+
ntn-skills push "$WORKDIR" [--dry-run]
|
|
188
|
+
ntn-skills abort "$WORKDIR"
|
|
189
|
+
|
|
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]
|
|
192
|
+
ntn-skills set [<name...>] [--source <source-name>] \
|
|
193
|
+
[--visibility always|discoverable|manual | --always | --discoverable | --manual] \
|
|
194
|
+
[--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
|
|
195
|
+
|
|
196
|
+
# Graduate draft or overlay back to Git, or revert overlays
|
|
197
|
+
ntn-skills pull <name> <git-repo-skill-dir> --clean
|
|
198
|
+
ntn-skills attach <name> --source <source-name> [--path <repo-relative-dir>]
|
|
199
|
+
ntn-skills detach <name>
|
|
200
|
+
ntn-skills reset-overlay <name> [<file-path>]
|
|
201
|
+
ntn-skills rm <name> # Soft retire (never hard-deletes)
|
|
144
202
|
```
|
|
145
203
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Use `replace ./my-skill --target 'CURRENT_PAGE_ID_OR_PINNED_MAIN_REF' --database ops --dry-run` to replace a selected existing page deliberately. `--target` preserves that page identity even when imported name/description changes; a missing, inaccessible or stale target fails without creating a page or falling back to its imported name.
|
|
149
|
-
|
|
150
|
-
For an authorized ordinary import, the command's exit 0, `ok: true` and `verified: true` (without `dry_run: true`) are the completion check. The CLI reads back main/reference content and the complete file identity; Files mode also preserves and verifies exact source bytes. No routine read/files/export audit is needed. This checks storage, not execution of the imported workflow.
|
|
151
|
-
|
|
152
|
-
The goal is complete instructions, code, links and resources across upstream → Notion and current Notion → Markdown/cache → Agent, not arbitrary byte-identical bidirectional round trips. Native Markdown permits documented formatting normalization and rejects changed instructions. For text-only Skills, explicit `--storage markdown_files` stores editable literal files in Notion and consumes those live code bytes without a source-ZIP fallback. [Storage, normalization and recovery](docs/protocol.md#mutation-contract).
|
|
153
|
-
|
|
154
|
-
### Synchronize a local distribution directory
|
|
155
|
-
|
|
156
|
-
Replace `PAGE_ID` with an actual selected page ID. The binding label is local configuration, separate from the Skill's invocation alias.
|
|
157
|
-
|
|
204
|
+
### Upstream Git Sources & Scheduling
|
|
158
205
|
```bash
|
|
159
|
-
|
|
160
|
-
ntn-skills
|
|
161
|
-
ntn-skills
|
|
206
|
+
# Onboard Git repos (community repos default to manual; pass --discoverable for personal primary repos)
|
|
207
|
+
ntn-skills source add <repo-url> [--name <name>] [--ref main] [--root skills] [--policy track|pinned|manual] [--discoverable] [--scenes ops,coding]
|
|
208
|
+
ntn-skills source list
|
|
209
|
+
ntn-skills source sync <name> [--update-pinned]
|
|
210
|
+
ntn-skills upstream check [<source>]
|
|
211
|
+
ntn-skills upstream apply [<source>] [--dry-run] [--max-sources 10] [--timeout-sec 180]
|
|
212
|
+
|
|
213
|
+
# Native OS background timers (macOS launchd / Linux systemd) & CI/CD exports
|
|
214
|
+
ntn-skills schedule install [--sync-every 12m] [--full-at 04:12] [--upstream-every 6h]
|
|
215
|
+
ntn-skills schedule status
|
|
216
|
+
ntn-skills schedule uninstall
|
|
217
|
+
ntn-skills schedule export --target dagu|github-actions|crontab
|
|
162
218
|
```
|
|
163
219
|
|
|
164
|
-
|
|
220
|
+
---
|
|
165
221
|
|
|
166
|
-
|
|
222
|
+
## Pi Extension
|
|
167
223
|
|
|
168
|
-
|
|
224
|
+
Install with `--with-pi` (or link `packages/pi-extension` into `~/.pi/agent/extensions/ntn-skills`) to unlock:
|
|
225
|
+
- **Inline `$skill-name` triggers**: Type `$my-long-tail-skill` in any prompt — even if its `Visibility` is `discoverable` or `manual` — and Pi automatically materializes it into the immutable local store and injects its path into the turn;
|
|
226
|
+
- **`skill_find` & `skill_load` tools**: Search the local catalog by keyword, `scene`, `visibility`, or `kind` (0 network requests), load long-tail skills on demand, and record `Hot Loads` usage counts.
|
|
169
227
|
|
|
170
|
-
|
|
228
|
+
---
|
|
171
229
|
|
|
172
|
-
|
|
230
|
+
## Security, Privacy & Data Boundaries
|
|
173
231
|
|
|
232
|
+
- **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.
|
|
234
|
+
- **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
|
+
- **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).
|
|
174
236
|
|
|
175
|
-
|
|
237
|
+
---
|
|
176
238
|
|
|
177
|
-
|
|
239
|
+
## Scope & Non-Goals
|
|
178
240
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
| `notion/ntn-skills` | [Discover/read workflows and route tasks](skills/ntn-skills/SKILL.md) |
|
|
182
|
-
| `notion/ntn-skills-maintain` | [Maintain Notion content, References and portable copies](skills/notion/ntn-skills-maintain/SKILL.md) |
|
|
183
|
-
| `notion/ntn-skills-sync` | [Connect sources and local directories, run synchronization and recover original operations](skills/notion/ntn-skills-sync/SKILL.md) |
|
|
241
|
+
- **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`.
|
|
184
243
|
|
|
185
|
-
|
|
244
|
+
---
|
|
186
245
|
|
|
187
|
-
|
|
246
|
+
## Upgrade & Uninstall
|
|
188
247
|
|
|
189
248
|
```bash
|
|
190
|
-
|
|
191
|
-
ntn-skills
|
|
192
|
-
ntn-skills ctl builtin install notion/ntn-skills
|
|
193
|
-
ntn-skills ctl builtin install notion/ntn-skills-maintain
|
|
194
|
-
ntn-skills ctl builtin install notion/ntn-skills-sync
|
|
195
|
-
ntn-skills ctl builtin status
|
|
196
|
-
ntn-skills ctl builtin update notion/ntn-skills
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
`install`, `status` and `update` work offline without credentials. Managed files live in `${XDG_DATA_HOME:-~/.local/share}/ntn-skills/skills/<name>`, with a default symlink at `~/.agents/skills/<name>`. Repeat `--agent-dir DIR` to add other Agent roots; each receives `DIR/skills/<name>` pointing to the same installation. Targets persist for later updates. Complete file receipts protect local edits and unowned directories; replaced bytes go to system Trash. Receipt-v1 profiles require the independent migration artifact; normal commands preserve them and report a conflict. Reload/restart native discovery after installation; upgrading the npm package does not update installed Skills. Broker selections use their bundled package copies; these explicit local installations have their own update lifecycle. [Host entrypoints](docs/host-integration.md#bundled-skills-in-hosts).
|
|
200
|
-
|
|
201
|
-
`ctl builtin export` remains portable output. Publishing to Notion is a separate online operation: optionally configure `ctl config set builtin_database ops`, then preview `ctl builtin publish notion/ntn-skills-maintain --dry-run`. First publication rejects any same-name page; deliberate updates require `--target` with an exact page identity or pinned baseline. Remote pages never become official by name or publisher text. [Commands, receipts and collision rules](docs/usage.md#optional-official-skills).
|
|
202
|
-
|
|
203
|
-
With the OMP/Pi Context Broker enabled, a short `<ntn-skills-guidance>` block explains the actual CLI and source scope. The selected Notion View supplies Skill/Router names and descriptions, not bodies. A source's `default_view_id` wins; when absent, the first View in API order is used. `Default Context` is an ordinary checkbox used only when the View filters on it. Startup may prepare metadata and snapshots without a model request. The first user submission receives the selected directory before the provider call; changing the View replaces this directory on the next submission without withdrawing loaded bodies. Full `$` selection and unfiltered CLI discovery remain available. Installing the bootstrap Skill alone does not install the Broker. [Host integration contract](docs/host-integration.md).
|
|
204
|
-
|
|
205
|
-
Inspecting or maintaining a Skill does not activate its instructions. Hosts activate only a workflow selected for the current task and retain its freshness metadata; no downloaded content or script executes automatically.
|
|
206
|
-
|
|
207
|
-
`pi-context-broker` provides a one-way Notion source adapter in its own repository using metadata-only `list`, page-ID `read` and pinned directory `export`. It prepares selected-View records after discovery and other records on selection, without activating instructions until consumed. Consumers retain scope, coverage and snapshot identities, match export `main_path` to manifest `main`, and load that entry with its supporting files. The broker owns host integration; this repository does not install it or register host hooks. See [the broker consumption contract](docs/host-integration.md#broker-source-consumption). Source acceptance recipes live in this checkout's verification Skill; package consumers use the public contract and installed CLI.
|
|
208
|
-
|
|
209
|
-
## Boundaries and local data
|
|
249
|
+
# Upgrade to the latest release (preserves config, credentials, and local store)
|
|
250
|
+
npm install -g ntn-skills@latest # or re-run scripts/install.sh if installed from source
|
|
210
251
|
|
|
211
|
-
|
|
212
|
-
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
See [configuration and storage](docs/protocol.md#environment-and-local-storage), [error recovery](docs/protocol.md#errors), and [security and privacy](SECURITY.md).
|
|
217
|
-
|
|
218
|
-
## Upgrade and uninstall
|
|
219
|
-
|
|
220
|
-
For a tarball installation, obtain the newer built package and repeat the npm installation command. Read [the changelog](CHANGELOG.md) before a 0.x minor upgrade. Source builds follow [the contributor instructions](CONTRIBUTING.md#development-setup).
|
|
221
|
-
|
|
222
|
-
Remove a global installation with `npm uninstall --global ntn-skills`. Configuration, cache, retained state, installed builtin data and its distribution links remain afterward. Preserve pinned versions, sync baselines/plans and unfinished receipts. To remove a saved token, run `ntn-skills ctl config clear-token` before uninstalling. Upgrade retains state/config and rebuilds disposable observations in the cache root; use `--refresh` in callers that previously assumed every unpinned read was fresh. [Removal and optional retention](docs/usage.md#upgrade-and-uninstall) explain what to preserve.
|
|
252
|
+
# Uninstall cleanly (never deletes your Notion database)
|
|
253
|
+
ntn-skills schedule uninstall
|
|
254
|
+
ntn-skills skill --uninstall
|
|
255
|
+
# Then move ~/.local/share/ntn-skills, ~/.config/ntn-skills, and ~/.local/bin/ntn-skills to Trash
|
|
256
|
+
```
|
|
223
257
|
|
|
224
|
-
|
|
258
|
+
---
|
|
225
259
|
|
|
226
|
-
|
|
227
|
-
| --- | --- |
|
|
228
|
-
| Installation variants and everyday CLI usage | [Usage guide](docs/usage.md) |
|
|
229
|
-
| Selectors, JSON output, storage and errors | [CLI and ref contract](docs/protocol.md) |
|
|
230
|
-
| Startup metadata and Read/Write adapters | [Host integration](docs/host-integration.md) |
|
|
231
|
-
| Development setup and compatibility policy | [Contributing](CONTRIBUTING.md) |
|
|
232
|
-
| Publishing and release verification | [Releasing](docs/releasing.md) |
|
|
260
|
+
## Development, Contributing & License
|
|
233
261
|
|
|
234
|
-
|
|
262
|
+
```bash
|
|
263
|
+
bun install
|
|
264
|
+
bun run check # Runs biome lint + tsc typecheck + 28 invariant & unit tests
|
|
265
|
+
```
|
|
235
266
|
|
|
236
|
-
[
|
|
267
|
+
- [Contributing Guide (`CONTRIBUTING.md`)](./CONTRIBUTING.md)
|
|
268
|
+
- [Security Policy (`SECURITY.md`)](./SECURITY.md)
|
|
269
|
+
- [Changelog (`CHANGELOG.md`)](./CHANGELOG.md)
|
|
270
|
+
- [MIT License (`LICENSE`)](./LICENSE)
|