ntn-skills 0.2.0 → 2.0.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/README.md CHANGED
@@ -1,190 +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="./CHANGELOG.md"><img src="https://img.shields.io/badge/status-experimental-orange" alt="Status: experimental"></a>
15
- <a href="https://nodejs.org"><img src="https://img.shields.io/badge/runtime-Node.js%20%3E%3D%2022.19.0-green" alt="Runtime: Node.js >= 22.19.0"></a>
16
- <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT"></a>
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
- ```bash
20
- ntn-skills list
21
- ntn-skills read 'Release Review'
22
- ```
23
-
24
- `Release Review` is an example title; choose a Skill returned by your own `list`. The npm package, executable and bootstrap Skill are all **`ntn-skills`**.
25
-
26
- Available on [npm](https://www.npmjs.com/package/ntn-skills). For source builds, see [Contributing](CONTRIBUTING.md#development-setup).
15
+ ---
27
16
 
28
- ## Why use it?
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`).
29
18
 
30
- You maintain reusable instructions in Notion, but an Agent only needs a few of them for its current task. `ntn-skills list` exposes names and descriptions so the Agent can choose a relevant workflow before loading its instructions. `read` loads the selected file and saves the complete Skill export locally.
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.
31
20
 
32
- A task can outlive an edit in Notion. The first successful read returns a **snapshot**: a local, fixed version of the workflow and its files. Keep the returned refs for the task. Ordinary current-target reads may reuse content validated within five minutes; use `--refresh` to adopt a freshly validated remote version for a new task.
21
+ ---
33
22
 
34
- | When you want to… | Use |
35
- | --- | --- |
36
- | Find a workflow without loading the whole library | `list` |
37
- | Read instructions and supporting files from one version | `read`, then `files` |
38
- | Move a complete Skill between local files and Notion | `import`, `export` |
39
- | Add a new Skill or replace one file deliberately | `create`, `write` |
40
- | Keep an existing page and local Skill directory in sync | `sync bind`, `sync plan`, `sync apply` |
23
+ ## Quick Start
41
24
 
42
- ## Installation
25
+ Paste this single sentence into **Claude Code, Cursor, Pi, Codex, Grok Bot, Antigravity**, or any coding agent with shell access:
43
26
 
44
- Install [Node.js](https://nodejs.org) **22.19.0 or newer**, 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.
45
-
46
- Install the published release from the official npm registry:
47
-
48
- ```bash
49
- npm install --global ntn-skills --registry https://registry.npmjs.org
50
- ntn-skills --version
51
- ntn-skills --help
27
+ ```text
28
+ Read https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/INSTALL.md and set up ntn-skills for me.
52
29
  ```
53
30
 
54
- The version command prints the installed version; help lists the available commands. A consumer needs Node.js and npm. [Project-local installation](docs/usage.md#install-in-a-consuming-project), [PATH setup](docs/usage.md#install-from-npm-globally) and [local tarball installation](docs/usage.md#install-a-local-tarball-globally) are covered in the usage guide.
55
-
56
- To produce a package yourself, follow [the contributor setup and build instructions](CONTRIBUTING.md#development-setup). Bun is the development/build tool.
57
-
58
- ## Quick start
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`).
59
32
 
60
- ### 1. Connect Notion
33
+ <details>
34
+ <summary>Prefer manual installation?</summary>
61
35
 
62
- 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.
36
+ ```bash
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
63
40
 
64
- That database needs at least one valid Skill. For example, the Notion Name `Release Review` maps to `name: release-review` in its exported `SKILL.md`. Names use English letters separated by single spaces, up to 64 characters; descriptions and instructions can use any language. [Naming and database requirements](docs/protocol.md#identity-and-references).
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"
65
48
 
66
- Authentication priority is saved `config.token` → non-empty `NOTION_API_TOKEN` → existing `ntn login`. A saved token is plaintext in the private config file; `config show` reports only whether it is configured. [Token setup and removal](docs/usage.md#authentication).
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"
67
51
 
68
- ### 2. Check access and choose a workflow
52
+ # 4. Enable native background sync (launchd on macOS / systemd on Linux)
53
+ ntn-skills schedule install
69
54
 
70
- ```bash
55
+ # 5. Verify health (expect 0 fail)
71
56
  ntn-skills doctor
72
- ntn-skills list
57
+ ntn-skills skill # Print built-in agent guide shipped with this binary
73
58
  ```
74
59
 
75
- With a valid Skill available, `doctor` should report `ok: true`, `authentication: "available"`, a positive `skill_count`, and `skill_read.available: true`. It reads and caches one Skill to verify the selected storage mode. `list` returns metadata and coverage without loading workflow bodies.
76
-
77
- Notion Search may miss databases. Read `coverage`; if you know the database, use `ntn-skills list --database 'DATABASE_ID_OR_URL'`, replacing that value with your database ID or URL.
78
-
79
- ### 3. Read the selected Skill
80
-
81
- Copy an entry's `ref` from `skills` into this command, replacing the placeholder:
82
-
83
- ```bash
84
- ntn-skills read 'REF_FROM_LIST'
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
85
149
  ```
86
150
 
87
- A successful response contains `ok: true`, instructions in `content`, a `snapshot_id` starting with `s_`, and a pinned `ref` containing `?snapshot=...`. `source: "notion"` means online validation; `source: "local_cache"` means a bounded cached observation. Retain `freshness`, the ref and snapshot ID with your task. Add `--refresh` to the current ref when current remote access/content must be checked. [Response fields](docs/protocol.md#success).
88
-
89
- ### 4. Read supporting files from the same version
151
+ ---
90
152
 
91
- Replace each placeholder with the value returned by the preceding command:
92
-
93
- ```bash
94
- ntn-skills files 'SNAPSHOT_ID_FROM_READ'
95
- ntn-skills read 'ATTACHMENT_REF_FROM_FILES'
96
- ```
153
+ ## Minimal 3-Table Notion Schema
97
154
 
98
- Use the snapshot ID to list **all** files; passing a file ref lists only that file. Read an attachment actually returned by `files`. Its pinned ref uses the same snapshot and returns `source: "local_snapshot"`, even without authentication or network access. Historical versions are available only if already saved on this machine.
155
+ Created automatically by `ntn-skills init --root <blank-page-url>`:
99
156
 
100
- For a binary attachment, add `--output ./attachment.bin` and use an appropriate viewer. For text, use `--lines 10-30` for an inclusive line range or `--raw` for plain UTF-8 output. Scripts are never executed automatically.
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` |
101
162
 
102
- ## Common workflows
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`.
103
164
 
104
- ### Keep workflow libraries separate
165
+ ---
105
166
 
106
- Register a known database as a domain, then select it explicitly. Replace the database placeholder before running:
167
+ ## CLI Reference
107
168
 
169
+ ### Setup, Built-in Guide & Diagnostics
108
170
  ```bash
109
- ntn-skills source add ops --database 'DATABASE_ID_OR_URL'
110
- ntn-skills list --database ops
111
- ntn-skills read 'Release Review' --database ops
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]
112
180
  ```
113
181
 
114
- Database aliases are exact and case-sensitive. If two databases have the same Skill name, select a database or use a page-ID ref from `list`. Registered sources supplement automatic discovery. [Discovery, aliases and coverage](docs/usage.md#discovery-and-identity).
115
-
116
- ### Import, export or update a Skill
117
-
118
- A Skill can be a folder, ZIP, or Markdown file. Preview remote changes before applying them:
119
-
182
+ ### Editing, Batch Metadata, Drafts & Overlay Tuning
120
183
  ```bash
121
- ntn-skills import ./my-skill --database ops --dry-run
122
- ntn-skills import ./my-skill --database ops
123
- ntn-skills export 'My Skill' --database ops --output ./my-skill.zip
124
- ntn-skills write 'PINNED_REF_FROM_READ' --input ./SKILL.md --dry-run
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)
125
202
  ```
126
203
 
127
- `create` requires a new name. `import` creates an absent name, reuses identical content, or replaces the existing same-name Skill's body, metadata and complete file set. `write` replaces one file while retaining the others; run it without `--dry-run` to apply the reviewed change. Pinned writes check the current online version and fail if it changed. [Inputs, conflicts and partial outcomes](docs/usage.md#creating-importing-exporting-and-updating-skills).
128
-
129
- Use `import ./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.
130
-
131
- ### Synchronize a local distribution directory
132
-
133
- Replace `PAGE_ID` and `PLAN_ID` with actual returned identities. The binding label is local configuration, separate from a Skill's invocation alias.
134
-
204
+ ### Upstream Git Sources & Scheduling
135
205
  ```bash
136
- ntn-skills sync bind PAGE_ID --path ~/.agents/skills/release-review --as release-review-global
137
- ntn-skills sync plan release-review-global --from notion
138
- ntn-skills sync apply --plan PLAN_ID
139
- ntn-skills sync status release-review-global
140
- ntn-skills sync plan --all --output ./skills-plan.json
141
- ntn-skills sync apply --plan ./skills-plan.json
142
- ntn-skills sync reconcile release-review-global
143
- ntn-skills sync unbind release-review-global --dry-run
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
144
218
  ```
145
219
 
146
- Equal initial contents can initialize a common baseline at bind; differing or absent local contents require an explicit `--from local|notion` initialization plan. Later plans use each binding's confirmed baseline to select direction or report a conflict. Apply rechecks the saved binding, versions, content and logical/resolved path before effects; a copied plan cannot authorize a different machine or binding. Status is local/provisional unless `--refresh` is used. Reconcile inspects unfinished receipts without replaying writes. Unbind deactivates configuration and retains content, baselines, plans and receipts. Symlink paths retain their logical links; removed/replaced bytes go through system Trash retention. See [sync usage](docs/usage.md#synchronizing-local-skills).
147
-
148
- ### Maintain reference pages in Notion
149
-
150
- Add page mentions or links to the rich-text `References` property. A link labeled `references/guide.md` fixes the local path; otherwise the page title determines its filename. Write normal Notion page links in the instructions: reads and exports turn links to included pages into relative paths such as `./references/guide.md`. Links between reference files resolve from the containing file, and CLI writes restore the Notion URLs. Other websites and code examples remain unchanged.
220
+ ---
151
221
 
152
- `create` and `import` turn `references/**/*.md` into editable child pages. `write` updates the page behind a reference path. Removing a reference from an imported file set excludes it from new snapshots but retains the Notion page. `Files` is optional for page-only libraries; keep it when preserving original source bytes, extra frontmatter or non-Markdown assets. See [the References contract](docs/protocol.md#references-pages).
222
+ ## Pi Extension
153
223
 
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.
154
227
 
155
- ## Agent integration
228
+ ---
156
229
 
157
- Copy the [bootstrap Skill](skills/ntn-skills/SKILL.md) directory into your Agent host's supported local skill directory. It teaches the Agent to discover metadata, read a selected workflow, and follow pinned attachment refs through shell commands.
230
+ ## Security, Privacy & Data Boundaries
158
231
 
159
- For startup awareness of every available workflow, the host needs a startup hook that runs `ntn-skills list` and injects the returned metadata. A bootstrap Skill by itself does not expose the remote catalog at startup. Direct use of `Read skill://...` requires a host adapter; shell integration works wherever shell tools are available. [Host integration contract](docs/host-integration.md).
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).
160
236
 
161
- 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.
237
+ ---
162
238
 
163
- ## Boundaries and local data
239
+ ## Scope & Non-Goals
164
240
 
165
- - Local verification covers npm installation and seeded offline behavior on macOS arm64 with Node.js 24.20.0 and Linux arm64 with the minimum Node.js 22.19.0. Real Notion reads were verified on macOS with `ntn` 0.22.12. CI is configured for Node.js 22.19.0 and 24 on Ubuntu and macOS 15; configured jobs do not establish successful runs for a new change. Windows is unverified.
166
- - Explicit `create`, `import`, `write` and `sync apply` commands change content. Version checks are client preflight checks; body, properties, and files are separate requests. On partial/unknown outcomes, inspect the target; use `sync reconcile` for an unfinished sync receipt before another apply.
167
- - Configuration defaults to `~/.config/ntn-skills/config.json`; retained snapshots, uploads and sync recovery state to `~/.local/state/ntn-skills`; disposable observations to `~/.cache/ntn-skills`. Freshness defaults are five minutes for content and 60 seconds for catalogs. [Cache policy and cleanup](docs/usage.md#cache-policy-and-cleanup) explain overrides and system Trash retention.
168
- - Online operations use `ntn` and Notion's signed download URLs. Safe local identity is required for unpinned offline lookup; official-login identity may still require online checks. A cached observation does not prove present access. The CLI sends no telemetry requests of its own; `ntn` has its own policies. Imported scripts are never executed automatically.
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`.
169
243
 
170
- See [configuration and storage](docs/protocol.md#environment-and-local-storage), [error recovery](docs/protocol.md#errors), and [security and privacy](SECURITY.md).
244
+ ---
171
245
 
172
- ## Upgrade and uninstall
246
+ ## Upgrade & Uninstall
173
247
 
174
- 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).
248
+ ```bash
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
175
251
 
176
- Remove a global installation with `npm uninstall --global ntn-skills`. Configuration, cache and retained state remain afterward, including pinned versions, sync baselines/plans and unfinished receipts. To remove a saved token, run `ntn-skills 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
+ ```
177
257
 
178
- ## Documentation and contributing
258
+ ---
179
259
 
180
- | Next step | Guide |
181
- | --- | --- |
182
- | Installation variants and everyday CLI usage | [Usage guide](docs/usage.md) |
183
- | Selectors, JSON output, storage and errors | [CLI and ref contract](docs/protocol.md) |
184
- | Startup metadata and Read/Write adapters | [Host integration](docs/host-integration.md) |
185
- | Development setup and compatibility policy | [Contributing](CONTRIBUTING.md) |
186
- | Publishing and release verification | [Releasing](docs/releasing.md) |
260
+ ## Development, Contributing & License
187
261
 
188
- Use [GitHub issues](https://github.com/yoyooyooo/notion-skills-cli/issues) for sanitized bug reports and usage questions; vulnerabilities use [private reporting](SECURITY.md#reporting-a-vulnerability). To develop or build the CLI, start with [Contributing](CONTRIBUTING.md).
262
+ ```bash
263
+ bun install
264
+ bun run check # Runs biome lint + tsc typecheck + 28 invariant & unit tests
265
+ ```
189
266
 
190
- [Documentation index](docs/README.md) · [Changelog](CHANGELOG.md) · [MIT license](LICENSE)
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)