ntn-skills 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,130 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - Add one pinned `apply` for sparse file additions/changes, explicit removals and metadata, reusing the original publication and recovery operation. Reject stale baselines and main-file deletion before effects.
6
+ - Add `sync upstream connect SOURCE` and `sync local connect TARGET --path DIR` for initial registration plus synchronization. Repeated matching connections reuse their existing subscription or binding; recurring work uses `run`.
7
+ - Make upstream `run` continue confirmable original work and restore confirmed owned tracked pages from Notion Trash. Keep missing/inaccessible pages and unresolved outcomes explicit; local runs settle retained receipts only when observations confirm convergence.
8
+ - Read stable manual edits to committed Notion content through ordinary current reads and `--refresh`, preserving immutable pinned snapshots and original publication/write guards.
9
+ - Keep daily help/schema on the public command tree, wrap array results as `{ok:true,items:[...]}`, and expose legal next commands in errors. Move historical upstream adoption/repair/rebuild and operation edit-acceptance tools to the separately distributed `ntn-skills-operator`.
10
+ - Align bundled Skill and host guidance with ordinary `$ntn-skills@builtin`, `$ntn-skills-maintain@builtin` and `$ntn-skills-sync@builtin` selection. Explicit central installation remains optional for independently managed local copies.
11
+ - Add metadata revalidation of locally verified native Skill source bundles for ordinary read/files/export. Bind the checkpoint to authenticated scope, generator/source snapshot, complete page and References observations, and immutable attachment identity; reuse all local files without repeated Markdown/block reads or ZIP downloads when unchanged. Expose `freshness.validation="metadata"` and preserve it through TTL hits/cache status. First alignment, missing/changed evidence, `--refresh`, explicit `--max-age 0`, writes and sync retain complete validation. Keep same-timestamp limitations explicit and exclude mutable external attachments, Router/Prompt and editable-file storage.
12
+ - Preserve exact member Tags when rebuilding or restoring an upstream Skill, with frozen-property checks, conflicting-edit protection and unknown-write readback; invalidate affected View observations.
13
+ - Add ordered Notion `views`, native `list --view` and `list --default-view`, with independent scoped observation caches and complete-query validation. Keep full explicit discovery separate from a host-selected View.
14
+ - Isolate exact tracked-member reads from unrelated sibling failures; actual cross-member reads still validate their target and pinned source-map identity.
15
+ - Retain historical `ntn-skills-operator upstream restore-deleted SUBSCRIPTION_ID MEMBER_KEY --operation p_...` for one mapped member whose original page is already in Notion Trash. Prove page ownership and Trash state before publishing a distinct current-source page and switching only that mapping. Refuse a live page before any publication; preserve missing or inaccessible reads instead of treating them as deletion. Repeat the same operation after interruption. Ordinary `sync upstream run` now owns this confirmed-deletion recovery as part of recurring synchronization.
16
+ - Retain explicit historical `ntn-skills-operator upstream rebuild SUBSCRIPTION_ID MEMBER_KEY --operation p_...` for one current source member. Move its owned old page to Notion Trash, publish a distinct native rendered main page and References child pages, and switch only that member mapping. Resume the same operation's frozen source after interruption without replaying an unknown outcome; use a different operation to fetch again. This is separate from `apply --member` and does not require the old page ID or byte-identical round-trip.
17
+ - Allow an explicit one-member upstream rebuild to create a new native page that shares an invocation name. Ordinary create and upstream apply still return `CREATE_CONFLICT`, and the existing page is never overwritten; selection remains by exact page ID. Preserve the member page `Default Context` separately from the subscription Router checkbox: omission keeps the old member page value, an explicit value writes only that page, and a missing checkbox fails before the write with `PROPERTY_UNAVAILABLE`. Freeze the current revision and complete source manifest for cross-member resource resolution.
18
+ - Compare subscription member maps structurally after schema decoding rather than by JSON key order. Preserve current unselected members and source metadata when a committed one-member rebuild resumes mapping; reconcile an unknown map write without replaying its PATCH. Keep upstream portable identity separate from publication integrity hashes.
19
+
20
+ - Add a native `Source URL` column to upstream subscription tables and derive its clickable destination on add/update. Keep `Source` authoritative, support Git/marketplace/registry display URLs and leave local sources empty; existing-table initialization adds the column without rewriting source configuration.
21
+
22
+ - Add Source Type (`builtin`/`upstream`/`manual`) and exact Builtin ID through explicit additive database initialization, including repeated published attaches, without legacy backfill. Preserve ordinary write provenance and legacy create compatibility; require source schema preflight for builtin/upstream publication. Support journaled metadata-only updates, mutation-free complete reuse and frozen source/property recovery without new public record fields or CLI flags.
23
+ - Recover an acknowledged publication metadata assignment after its readback fails without repeating the PATCH or changing the retained response. Preserve guarded owned-business retries and use the same source-aware ownership representation throughout content-adoption proof. Keep metadata-only editable-file recovery independent of file ordering without appending content.
24
+ - Add explicit `ctl cache gc`, including `--dry-run` and `--online --database`. Offline GC moves only unreachable snapshot manifests and content objects to system Trash; online GC requires one complete refreshed catalog before releasing a missing record's history. Keep `cache clear` limited to SQL observations and generation fences, with no filesystem deletion.
25
+ - Offer automatic subscription Routers only for at least two verified published active Skills. Keep zero/single-member subscriptions out of Router discovery, enforce the same minimum on current exact reads and status/check, and preserve independent member Skills and upstream display namespaces. Invalidate prior catalogs and subscription Router observations while retaining pinned historical snapshots and manually authored Router behavior.
26
+ - Keep successful development builds silent so global shims return clean CLI output; retain failed-build diagnostics on stderr and Node.js execution. Document the public-command consumer boundary and Broker-provided pinned resource identities, using `read SNAPSHOT --path RELATIVE` when local paths are hidden or shell tools interpret URI arguments.
27
+ - Document the OMP/Pi Context Broker's default lightweight CLI XML guidance, including resolved command/scope, effective-context deduplication and restoration after compaction; align the entrypoint reference and host integration contract.
28
+ - Align broker consumption guidance with database-scoped CLI argument examples, top-level read result fields, pinned resource refs, direct relative resource reads and reuse of complete bodies for inspection without running workflow setup.
29
+ - Apply a configurable 30-second timeout to each network attempt via `NTN_SKILLS_REQUEST_TIMEOUT_MS`, including Notion API and file downloads. Keep pagination, admission and retry waits outside individual attempt budgets so complete reads may exceed one minute; preserve unknown write outcomes and cancellation.
30
+ - Publish optional upstream display metadata on validated active-member catalog records, using the Notion subscription Name's callable alias instead of repository URL basenames or registry slugs. Display `pstack/correct` and `matt/retro` from the existing Pstack/Matt subscriptions while retaining exact member selectors and snapshot identities, without additional discovery requests.
31
+ - Invalidate catalogs produced before subscription names controlled upstream display namespaces, so an upgraded CLI does not keep serving cached `plugins/correct` or `skills/retro` labels.
32
+ - Add offline `ctl cache identity [--database SELECTOR]` for shared consumer metadata indexes, binding an opaque digest to selected credentials and the resolved remote catalog scope. Exclude project paths, command spelling, local preferences, cache policy and sync bindings; return the effective TTL separately. Preserve credential isolation, ordinary read authorization and the bounded local official-login lookup.
33
+
34
+ - Record recurring upstream workflow status, last attempt, last successful sync and a summary directly in the subscription table. Refresh successful times on unchanged runs, preserve them on partial/failure, accept native Notion date precision, continue remaining targets and return a nonzero structured batch result when incomplete. Serialize each subscription's full run within one state root; existing-table initialization adds the four workflow fields.
35
+
36
+ - Reuse complete content and subscription query inventories when listing subscription Routers instead of refetching every database, Router and member page. Preserve committed-marker, ownership, key, hash, target and coverage checks; explicit Router activation still revalidates fresh member metadata.
37
+ - Batch online subscription activation through fresh, fully paginated publisher-relation queries rather than individual member-page GETs. Reuse validated rows to materialize Router snapshots, retaining exact parent, ownership, key, hash and committed-state checks; reject missing members and invalid pagination without falling back to cached metadata.
38
+
39
+ - Add explicit `operation resume --retry-metadata` for guarded idempotent ownership/commit assignments in editable-file publications. Preserve original unknown requests with linked separate PATCH outcomes; reject append/create/upload/arbitrary-page replay, scope/guard/source drift and incompatible artifact recovery. Avoid repeating already applied ownership during editable-file commit.
40
+
41
+ - Clarify the storage policy: daily/upstream publication uses rendered main Markdown and References child pages for every supporting Markdown document, preserving original root/nested paths (commonly `references/**`), with scripts/non-Markdown assets in Files/the source bundle. Retain the legacy References page-title fallback when no explicit Markdown path label exists. Permit only whitespace/equivalent local formatting differences; reject content loss and whole-document code-block substitution. Reserve explicit `markdown_files` for a particular source-file maintenance choice, never a failure fallback/default bulk migration; document exact-target `replace --storage notion_blocks` for returning literal pages to rendered storage. This policy entry does not claim a completed live library conversion.
42
+ - Retain complete paginated child inventories after acknowledged native reference creation, including the boundary where ordinary blocks push child pages past 100 raw rows. Recover older synthetic single-page guards through complete public reconciliation without duplicate creates or dropping conflict history. Bind root/nested reference creation discovery to the frozen source path and hash. Keep normalized native read files stable for committed Publication manifests; source ZIP/export bytes remain separately verified. Invalidate the incorrect in-session source-restored read snapshots through a new materialization version.
43
+ - Compare omitted heading-to-paragraph gaps and plain punctuation escapes only with complete ordered physical block evidence, preserving the exact retained target, source text and link/annotation identities. Keep changed prose or marker payloads rejected. Extract private Markdown comparison helpers without changing public exports.
44
+ - Preserve complete quote/paragraph intervals, a terminal list-owned table, literal single-tilde ranges and split bold inline-code links through source-bound physical readback proofs. Escape inline placeholder tags in future native request bodies without changing source files, code, destinations or parser-warning failures. Permit guarded continuation of an original native preserve-replace's initial marker or exact References registration, retaining the original unknown history and checking frozen source hashes before property retries.
45
+ - Reassess an already retained terminal unknown source-upload orphan only after exact artifact identity/bytes and all current publication effects converge. Preserve the unknown request, absent response and conflict history; public reconciliation does not allocate, and a separate upload still requires explicit `--new-artifact`.
46
+ - Preserve editable-file operation/metadata boundaries and guard current targets before replacement. Reconcile upstream literal-file publications against committed live files instead of demoting completed receipts through rendered-Markdown journals. Batch bounded file allocations and resume only missing file suffixes.
47
+ - Batch large editable files as multiple code blocks under bounded 350000-byte JSON budgets and at most 99 code blocks per request, including initial nested allocation. Preserve ordered UTF-8 source bytes and resume only the missing suffix; unknown append outcomes still require exact readback or explicit distinct-page supersession.
48
+ - Keep absent or partial unknown file appends unresolved without replay. Explicit historical `ntn-skills-operator upstream publish-files --supersede` uses a distinct page/operation after checking the original owner, frozen source and writing authority; retain the original unknown receipt and page.
49
+ - Reject CR/CRLF editable-file inputs before mutation because live Notion code blocks normalize carriage returns. Retain concrete old block ancestry so an acknowledged whole-page clear removes obsolete nested inventory guards rather than requesting deleted blocks. Split reconciliation and recovery fixtures into bounded modules without compatibility re-exports.
50
+ - Reconcile a terminal editable-file property response only from exact observed requested fields, unchanged other metadata and complete source files; keep absent results unknown without replay. Public operation reconciliation uses the same literal-file path as upstream recovery.
51
+
52
+ - Recover typed-link readback split at rich-text annotation boundaries after proving exact adjacent destinations, complete visible text and ordered block links. Preserve already matching reads, authored write guards and ambiguous-link failures.
53
+ - Reuse graph-mapped, physically proved quote/list readback for reversible source exports so a verified page cannot fail only because the export used a different comparison target. Preserve exact source bytes and reject changed instructions.
54
+ - Use the native 2000-character rich-text span capacity for subscription JSON, retaining complete large source manifests and member maps that fit the 100-span limit instead of rejecting them at the former 180000-character chunking boundary.
55
+
56
+ - Document the complete portable v2 Prompt/Router producer contract in create help/schema and usage: explicit kind, manifest/body files, metadata precedence, source versus canonical entrypoints, exact same-library Members and online dry-run preflight.
57
+
58
+ - Keep committed source members independently readable while subscription Router publication is pending. Preserve own resource bytes, expose unavailable cross-member targets as typed projection metadata, and recover generated refs when the exact active map appears; retain Router and publication integrity gates.
59
+ - Support explicit `source.member_patches` keyed by exact selected source member, preserving raw upstream hashes while recording adapted portable and patch identities. Reject unknown members, overlapping global/member patch files and replacements that do not match exactly once; retain strict YAML admission.
60
+
61
+ - Admit nonblank descriptions up to 2000 Unicode code points through one Effect Schema across Markdown imports, portable/native archives and property updates. Preserve complete upstream metadata and source bytes; reject invalid updates before remote access and isolate invalid catalog descriptions with explicit coverage failures.
62
+ - Publication mutations recheck their target and ownership graph before writes, with complete fresh graph fences at allocation checkpoints and commit; conflicts and unknown outcomes retain the original operation for recovery.
63
+ - Bind content-root and reference-page creation to an atomic scope, parent, source and intent correlation proof. Retain reference transport markers through writes while excluding them from authored exports; reconcile complete inventories without replay when identity is absent, ambiguous or incomplete.
64
+ - Retain reviewed `ntn-skills-operator operation supersede-plan` and one-attempt `ntn-skills-operator operation supersede-apply` for a new explicit creation intent after complete zero-candidate discovery. Preserve original unknown receipts, recheck frozen source and ownership guards, and move upstream pointers only after committed publication and guarded compare-and-swap.
65
+ - Classify exact official `ntn` rejection envelopes using safe HTTP status and allowlisted Notion codes even when stdout is empty. Keep uncertain writes unknown without automatic mutation retries and exclude raw stderr or service messages from public diagnostics.
66
+ - Recognize the exact official generic public-API failure envelope as `unknown_transport`, without inventing a network or TLS diagnosis. Reuse existing bounded read/query retries; keep writes uncertain with one attempt and no automatic replay.
67
+ - Version References materialization and current observations together so generator upgrades create new snapshot identities even for unchanged remote content. Require online refresh for older current observations, preserve exact pinned snapshots and retain strict publication proof verification.
68
+ - Preserve exact human-readable Unicode titles and authored frontmatter names, including digits, spaces and hyphens. Derive safe callable aliases separately without changing page identities, stable member keys or builtin IDs; require exact selectors for collisions and document `--name` as a human-title override.
69
+ - Persist exact subscription mutation intents after read preflight, atomically claim each create, and include the stable operation marker in its initial POST. Reconcile complete marker evidence without replay; expose source/target/origin evidence through operation inspection. Add explicit evidence-reviewed local adoption and proven GET-only preparation recovery, and resume known-target updates/removals only under their original version guards.
70
+ - Preflight all explicit existing initialization tables before remote mutations, retaining unknown-create reconciliation. Include upstream catalog sources and successful subscription query coverage with explicit roles; keep content configuration separate and validate exact locator provenance through Broker discovery and activation.
71
+ - Respect a caller-supplied process capability for local lock retirement while retaining the default Node host behavior. Isolate builtin crash-rollback fixtures from host Trash startup and preserve original tree, resource and receipt bytes through recovery and explicit retry. Protect the exact compact Router manifest golden input from formatting.
72
+ - Prove create-name uniqueness from the complete selected content database only; unrelated partial upstream Routers retain discovery failures without blocking target writes. Target content failures and existing names still refuse mutation.
73
+ - Reject portable v1 in every normal create/read/export source path with `PORTABLE_UPGRADE_REQUIRED`. Ship historical conversion only as a separate operator artifact with immutable input inventories, explicit kind audit, remote read-only planning and guarded exact-target formal replacement; no production conversion is automatic.
74
+ - Add explicit read-only portable `remote-replan --preserve-output` for reviewed plans with no attempt or retained publication. Bind original plan bytes/hash and attempt path to a current-baseline successor while preserving exact reviewed output; keep existing operations on their original recovery contract.
75
+ - Retain standalone portable-converter operation IDs before publication and add original-plan/ledger remote reconcile and resume. Known-root zero-intent preparation failures revalidate reviewed source bounds; uncertain mutation and allocation intents remain `NO_REPLAY`.
76
+ - Add explicit `remote-recovery-plan` and hash-reviewed resume for an original zero-intent, unbound-integrity replacement after a materialization-only baseline change. Bind original plan and ledger bytes, operation, unchanged remote authority and exact output; retain the normal strict current-version guard and reject any mutation-intent replay.
77
+ - Recover mode-only writes using every retained ownership observation and classified owned intent without requiring child inventories the original mode operation never owned. Keep complete reference-inventory gates for document create/replace recovery.
78
+ - Continue the same publication without repeating acknowledged business PATCHes only when exact retained payloads and current guards prove convergence. Reuse the existing normalization for current body comparisons to avoid repeated whole-graph scans per body; retain fresh checkpoints and final verification, and never reuse uncertain writes, allocations, uploads or publication markers.
79
+ - Compare every explicitly requested select field against Notion's richer readback object during acknowledged recovery. Preserve strict null, ID and unknown-field matching, full current guards and rejection of changed selections.
80
+ - Permit explicit public publication reconcile to release a retained conflict fence only after complete fresh guards and completed intended effects prove convergence; preserve the original failure, stages and typed conflict history before same-operation resume.
81
+ - Reconcile an unbound initial creation only through its unique completed root POST, full original creation proof and matching current marker; retain exact bound replacement marker checks and never rewrite integrity authority.
82
+ - Reuse an acknowledged source-bundle attachment only when its exact completed upload intent, current file guard and downloaded bytes/hash prove the same attachment with no later unresolved write; preserve normal unattached upload handling.
83
+ - Restore Notion quote-to-paragraph boundaries only from complete ordered typed block evidence with unique text anchors and a stable page revision; include compact structural evidence in snapshot versions while preserving source bytes and original recovery guards.
84
+ - Reuse one fresh, fully paginated publisher identity inventory within each upstream plan, preserving member ambiguity, ownership and complete plan hashes/actions while leaving apply-time drift guards unchanged.
85
+ - Extract CLI command families, upstream planning/application/operation responsibilities and Node sync scenario suites without command aliases or legacy reexports.
86
+ - Separate fenced publication continuation and typed-block recovery from new-publication sessions; recovery callers import the owning recovery module directly without legacy module aliases.
87
+ - Preserve Node-native loading of split upstream modules with erased type imports, resolve the real Node executable before CLI consumer tests isolate HOME, and include the linked portable-converter guide in the public package.
88
+ - Require Node.js `^22.22.3 || >=24.20.0` for the CLI and migration artifact; exercise CI on 22.22.3/24.20.0 and publish on 24.20.0. Reject unsupported Node/Bun or SQLite runtimes with `STATE_RUNTIME_UNSUPPORTED` before opening state. Keep the official driver and scope the in-memory SQLite version probe; see the [runtime policy](docs/protocol.md#local-sqlite-authority-and-explicit-upgrade) for fixed WAL branches.
89
+ - Add durable `ctl database init` for native content/subscription tables with exact database, data-source and property receipts, guarded relation repair and independent global upstream configuration.
90
+ - Register source subscription commands only under `sync upstream`, alongside `sync local`; remove the former root `upstream` path while retaining target/all selection constraints.
91
+ - Validate subscription names with the content alias contract before add/update writes; isolate malformed historical subscription metadata in catalog `failed_sources`. Read exact subscription refs directly under the existing observation policy and retire affected scoped catalogs after subscription add/update or upstream apply. Accept literal Git paths containing brackets, Unicode, spaces and pathspec characters while preserving traversal, symlink and submodule rejection.
92
+ - Separate upstream aggregate progress from explicit Router availability and member publication evidence. Make status offline and scope-local; make check observe only current metadata/markers with freshness, exact Router refs, active counts/IDs and failed-source coverage. Preserve unknown states without reading member bodies or treating partial subscriptions as total failure; teach the bundled sync Skill to use those fields.
93
+ - Use one ContentRecord contract for Skill, Router and Prompt across catalogs, snapshots, reads, files and portable exports. Portable v2 carries kind and entrypoint; historical state converts explicitly rather than through runtime aliases.
94
+ - Render authored Router instructions with a deterministic Skill member index in the same snapshot. Members remain metadata and stable refs, with explicit missing-member failures and independent Default Context flags.
95
+ - Author manual Router Members through exact Skill IDs or refs on create, replace and update. Resolve current same-library permission and kind, deduplicate/sort relations, and retain member intents for guarded recovery. Include Members and Default Context in committed managed integrity alongside authored resources and provenance.
96
+ - Version managed remote publication proofs as v2 for provenance, Members and Default Context. Reject old v1 proofs with an explicit conversion requirement instead of reinterpreting their digest. Provide a separate reviewed remote-proof conversion artifact with complete content checks, guarded readback and no automatic replay after an uncertain write; normal CLI and offline state migration do not interpret v1 remote proofs.
97
+ - Keep Router authored source bytes separate from its generated member index. Default source exports preserve reversible authored files; explicit snapshot exports carry the exact read entrypoint and all resources with SHA-256, byte lengths and roles. Compare authored publication content without copying generated indexes back into instructions or masking resource damage.
98
+ - Persist typed page destinations through official owned-block rich-text URL updates after Notion Markdown strips fragments. Journal the original body, concrete block paths, expected URLs and guarded recovery; restore distinct resource paths from real paginated block metadata in fresh reads and exports. Reject ambiguous correspondence, preserve code examples and verify live instructions/resources independently of source-bundle byte restoration. Members remain read-only dependencies.
99
+ - Freeze complete source member/resource manifests and resolve cross-member Markdown destinations to exact published page resource refs on explicit reads. Preserve original source files/ZIPs with hashed derived projection provenance; reject stale maps, removed targets and unsafe paths. Broker reads materialize only the requested member and validate source scope and filesystem containment.
100
+ - Treat every explicit Prompt submission as new user-task requirements using one prepared snapshot per turn. Keep Prompt out of default/native/automatic loading, preserve mixed text/images and prevent cancelled session generations from dispatching.
101
+ - Move mutable local state to one SQLite database using official Effect SQL/SQLite 4.0.5: scoped connection, migrations, short transactions, generation fences, atomic binding/baseline and baseline/receipt commits. Persist publication intent before remote writes and retain unresolved outcomes across crashes and lock release.
102
+ - Add the independent `ntn-skills-migrate` offline importer with validated private backup, source hashes, resumable phases and explicit old-writer stop precondition. Normal commands use SQLite exclusively; corrupt state never falls back to old JSON or an empty database. Preserve immutable content, snapshot files, original IDs and reviewed plan digests.
103
+ - Preserve unresolved migrated operations as public evidence-review records with their original identity, source hash and audit reference. `operation list/show/reconcile` returns their safe review envelope without authentication when no scoped ledger is selected; resume returns `UNRESOLVED_NO_REPLAY`. Only the independent converter maps proved old import destinations to current operations and retains original wire evidence.
104
+ - Durably publish file bytes before snapshot pointers, retire only SQL observations during cache clear, and support standalone SQLite plus referenced-file backup. Return `sqlite:` plan/receipt locators instead of paths to nonexistent JSON files.
105
+ - Execute development and real SQLite/configuration consumers on Node with the official SQLite 4.0.5 driver and Effect Vitest integration; keep pure tests on Bun. Distinguish corrupt bytes, inaccessible state, busy/resource exhaustion, schema/runtime mismatch and state conflicts instead of reporting every initialization failure as corruption.
106
+ - Run the full synchronization consumer contract on Node with its HTTP fixture and official Effect test host, retaining all saved-plan, baseline and recovery assertions. Preserve implementation defects through the CLI runtime instead of flattening Scope or Layer failures into a generic domain error.
107
+ - Cut over the public command tree to content, `sync local`, `operation` and `ctl` commands with official Effect CLI help/schema. Current builtin management accepts receipt v2 only; v1 conversion remains an explicit independent artifact. These implementation notes do not establish installed, service or host acceptance.
108
+ - Retire name-upsert import APIs and commands: create refuses existing names; replace uses exact identity across CLI, builtins and local sync. File writes preserve page properties; update changes explicitly selected Name, Description, Default Context and Router Members. Share domain constraints between handler validation and machine schema, use controlled config set/unset and database register/unregister, and reconcile publication intents through read-only guarded observations including property-only recovery.
109
+ - Unify publication, local/upstream sync, subscription, fork/track, database initialization and review operations under one typed domain envelope with scoped listing, safe result summaries and executable next reasons. Reconcile never commits remote writes or local sync baselines; publication marker completion requires explicit guarded resume and reports `needs_safe_commit` until then.
110
+ - Recover original upstream fork/track parents through their frozen child ownership intents, expose pending safe resume through read-only inspection, and avoid duplicate mode writes after proven convergence.
111
+ - Check retained sync receipt fences before remote saved-plan observations, preserving `SYNC_PENDING` and corrupt-participant guards while a publication is incomplete. Keep originating publication recovery on its original operation. Stable direct Notion edits remain readable; tracked source ownership and local common-baseline conflicts still constrain synchronization.
112
+ - Recover upload interruptions using the exact upload-object endpoint and original upload IDs. Add explicit `operation resume ID --new-artifact` for proven unreferenced unknown allocations or uncertain pending sends; preserve the original unknown audit and remote orphan, verify attachment bytes after lost responses, and retain page/source/conflict guards before publication integrity commit.
113
+ - Add safe verification-helper help and offline default doctor with explicit live probing; retain actual child PID/exit/signal evidence and isolate all CLI/XDG roots for repeatable installed-consumer acceptance.
114
+ - Add optional Notion `Default Context` checkbox metadata as `default_context`; missing values and legacy cached metadata default to false, with unchanged content/snapshot identities and complete catalog listing.
115
+ - Add optional project-maintained Skills with separate discovery/consumption, Notion content-maintenance and ongoing synchronization responsibilities.
116
+ - Add offline exact-ID `builtin list/read/export` with package origin/version/content metadata; keep remote catalog and same-name pages separate.
117
+ - Centralize offline `builtin install/update/status` and installation-aware `builtin list` under the XDG data directory, default to `~/.agents/skills` symlinks, and support repeated `--agent-dir` distribution targets. Retain complete file receipts, content-based equality, local-edit/unmanaged-target protection, system Trash retention and interrupted-write recovery. Migrate explicitly selected clean profile installations without keeping per-host copies; keep installation separate from package upgrades and remote publication.
118
+ - Add explicit `builtin publish`, a separately configurable `builtin_database`, create-only first publication, and exact-page/pinned updates with existing conflict and readback protections. No automatic installation, publication or upgrade.
119
+ - Manage three independent builtins: `notion/ntn-skills` for discovery/consumption/routing, `notion/ntn-skills-maintain` for Notion content maintenance, and new `notion/ntn-skills-sync` for ongoing local synchronization, distribution and recovery. Keep entrypoint metadata discoverable without preloading bodies, retain unmanaged copied bootstraps, and package complete portable references for each Skill.
120
+ - Add opt-in publication stage/timing JSONL on stderr, retained publication receipts with frozen input, and `resume OPERATION_ID` with authentication/source/readback guards and explicit unresolved outcomes. Keep validation observations provisional across process exits, reject external changes at checkpoints and continuation, and replay complete target-file write results.
121
+ - Reuse authenticated publication refresh context and checkpoint Markdown while preserving complete content-version checks; pace actual request starts, including concurrent callers and retries, instead of sleeping before every call.
122
+ - Exclude per-request Notion References response trace IDs from publication guards while retaining property content and pagination checks, so unchanged live pages can validate and resume.
123
+ - Accept automatic `last_edited_time` property updates after a proven body write while continuing to compare editable metadata and ordinary revision guards.
124
+ - Verify live main/reference Markdown against submitted content independently of preserved source ZIPs, including reuse, so altered page instructions cannot pass through intact original bytes. Make a non-dry exit 0 with `ok: true` and `verified: true` the ordinary import completion criterion; reserve repeated read/files/export audits for diagnostics and development regression.
125
+ - Write CommonMark/GFM through Notion's v2 Markdown parser, restore changed table-cell literals and code-block languages with the block API, reject parser warnings, and materialize v1 readback with explicit table/code/list boundaries and joined emphasis around inline code. Verify instructions, code languages and link destinations without discarding fenced-code blank lines or treating changed table text as equivalent.
126
+ - Accept Notion's inline `<br>` readback of paragraph line breaks during saved-content verification, while retaining literal code, link targets, reference inclusion and real instruction-change rejection. Preserve snapshot and source-bundle byte contracts.
127
+
3
128
  ## 0.2.0 — 2026-10-14
4
129
 
5
130
  Current-target reads now reuse complete observations for up to five minutes, and catalogs for up to 60 seconds. Callers that require immediate remote validation must use `--refresh`; pinned snapshot reads remain immutable and offline. Preserve existing configuration/state when upgrading; disposable observations now use the separate cache root.
@@ -22,6 +147,9 @@ Current-target reads now reuse complete observations for up to five minutes, and
22
147
  - Add `import --target` for verified whole-Skill replacement on one existing page, preserving page identity across rename and rejecting stale, missing or non-main targets without creation fallback.
23
148
  - Run CI on Ubuntu/macOS 15 and Node.js 22/24 through the package verification controller, retain consumer evidence/tarballs as artifacts, and exercise explicit Linux retention failure without losing cached bytes.
24
149
  - Fence the entire content/catalog retirement batch before system Trash operations, so unavailable retention preserves bytes without exposing later observations or accepting delayed publishers.
150
+ - Expose the originating authentication `scope` with snapshot read/open/files/export responses, allowing consumers to reject stale discovery records after credential changes while retaining explicitly pinned offline versions.
151
+ - Document one-way broker source consumption through metadata-only list, selected-page read and pinned directory export; the adapter is provided in the separate pi-context-broker repository and is not installed by this package.
152
+ - Add read-only source/installed consumption recipes and helper mode, plus installed-consumer cases for portable entrypoints, directory output protection and credential isolation. These additions require execution evidence before claiming acceptance.
25
153
 
26
154
  ## 0.1.3 — 2026-10-14
27
155
 
package/CONTRIBUTING.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Development setup
4
4
 
5
- Use Bun 1.4.3 for development and the committed lockfile. The published CLI runs on Node.js 22.19.0 or newer; install Node.js and npm as well for the fresh-consumer checks. Clone the repository, then work from the checkout root:
5
+ Use Bun 1.4.3 for dependency installation, building and the pure test suites, with the committed lockfile. Development and the published CLI run on Node.js 22.22.3+ within 22.x, or Node.js 24.20.0+; install Node.js and npm as well for the real SQLite and fresh-consumer checks. Clone the repository, then work from the checkout root:
6
6
 
7
7
  ```bash
8
8
  git clone https://github.com/yoyooyooo/notion-skills-cli.git
@@ -12,9 +12,11 @@ bun run dev --help
12
12
  bun run check && bun run package:check
13
13
  ```
14
14
 
15
- Use `bun run dev <command>` to exercise the TypeScript CLI entrypoint directly during development; it uses the default official `ntn` transport without requiring a distribution build.
15
+ Use `bun run dev <command>` to build the current sources and execute the freshly built CLI with Node.js. Successful builds stay silent; failed builds report diagnostics on stderr and stop the command. Argv and exit status pass through to the same production entrypoint used by the package. It uses the default official `ntn` transport. The official SQLite driver uses `node:sqlite`; running the product through Bun is unsupported.
16
16
 
17
- For repeatable live verification, read `.cursor/skills/verify-ntn-skills/SKILL.md` and its feature map in the source checkout. Its executable `control.ts` isolates config/state/cache and XDG bases, records real CLI actions and readback, and preserves evidence while moving owned scratch to system Trash. The map routes the [implemented sync/cache design](https://github.com/yoyooyooo/notion-skills-cli/blob/main/docs/sync-cache-cli-design.md) to acceptance cases; case definitions are not passing results. Live mutations require current task authorization; the npm package excludes these repository-local maintenance files, so unpublished changes must be read from the checkout.
17
+ A developer-owned global `ntn-skills` shim can use `exec bun run --silent "/absolute/checkout/scripts/dev.ts" "$@"`. Configure consumer hosts with `command: [ntn-skills]` and launch them in a neutral workspace outside the source checkout. The shim owns the implementation path; consumer prompts need only the public command and selected refs. See the [host integration contract](docs/host-integration.md).
18
+
19
+ For repeatable live verification, read `.cursor/skills/verify-ntn-skills/SKILL.md` and its feature map in the source checkout. Its executable `control.ts` isolates credential config/state/cache and XDG bases, records real CLI actions/readback, and preserves evidence while moving owned scratch to system Trash. Builtin verification must also isolate HOME and `NTN_SKILLS_DATA_HOME`/`XDG_DATA_HOME` because installation defaults to shared Agent links. The map routes the [implemented sync/cache design](https://github.com/yoyooyooo/notion-skills-cli/blob/main/docs/sync-cache-cli-design.md) to acceptance cases; definitions are not passing results. Live mutations need current authorization; npm excludes these repository-local files.
18
20
 
19
21
  Build and pack a consumer artifact from the checkout root:
20
22
 
@@ -27,13 +29,23 @@ bun pm pack --cwd packages/cli --destination ../../release
27
29
 
28
30
  The archive filename follows the package version. Consumers install that tarball with npm as described in [the README](README.md#installation). Update source with `git pull --ff-only`, reinstall dependencies and rebuild before producing a new tarball.
29
31
 
30
- `check` runs type checking, formatting checks, tests and the Node.js distribution build. `package:check` validates documentation links, packs the CLI and installs it with npm in a fresh consuming project, then executes the installed binary with Node.js. CI covers Node.js 22 and 24 on Linux and macOS. Run both checks before proposing a pull request or release. Tests must not depend on personal credentials or mutate a live Notion workspace. Keep live verification separate and disclose the environment and authorization used.
32
+ `check` runs type checking, formatting checks, both test hosts and the Node.js distribution build. `bun run test` runs the Bun suites and the real SQLite/configuration and sync-consumer suites on Node through official `@effect/vitest` 4.0.5 and its Vitest 5 runner; `test:unit` and `test:node` select those lanes individually. Existing database assertions, competing processes, crash rollback, backups and fences execute against the same official SQLite driver as production. The sync suite uses a Node HTTP fixture with the production Node platform and resource finalizers. CLI tests launch Node children. `package:check` validates documentation links, packs the CLI and installs it with npm in a fresh consuming project, then executes the installed binary with Node.js. CI covers Node.js 22 and 24 on Linux and macOS. Run both checks before proposing a pull request or release. Tests must not depend on personal credentials or mutate a live Notion workspace. Keep live verification separate and disclose the environment and authorization used. Modeled domain and argument failures produce JSON; implementation defects retain their Effect cause and Node runtime diagnostics.
33
+
34
+ CI uses Ubuntu and macOS 15 with Node.js 22.22.3 and 24.20.0. Every job runs the complete deterministic suite, then drives package verification through `control.ts init/package`; successful runs retain the installed-consumer outputs and exact tarball. Per-matrix evidence is uploaded for seven days, including available failure records. macOS jobs require `/usr/bin/trash`, exercise real cache retirement and recycle owned scratch. Linux consumers verify `RETENTION_UNAVAILABLE` and unchanged cached bytes; Linux scratch remains on the disposable runner because no recycle capability is implemented. These checks require no live Notion credentials. Before integration, inspect all four checks for the PR's current head, not an earlier main run.
35
+
36
+ The compact `packages/core/test/fixtures/router-original/.ntn-skills.json` manifest is a byte-preservation golden input for independent Router round trips. Its original bytes, including whitespace and final newline, are part of the fixture contract. Biome disables formatting for that exact file only; the containing fixture directory, tests and production sources remain in the normal root check.
37
+
38
+ Builtin transaction tests retain both replaced trees and released lock receipts in their own temporary fixture using the public `ChildProcessSpawner` service boundary. Executable access is checked with the host filesystem, and released fences are renamed only after verifying their fixture ownership; they do not launch macOS Trash for each assertion. The default spawner still exercises system Trash in the real process and installed-consumer suites. Keep process teardown attached to the command Scope and keep the 5-second transaction-test deadline unchanged.
39
+
40
+ Keep Effect, platform, SQLite and Effect test integration versions aligned at 4.0.5. New commands use `effect/cli`; external execution uses scoped Effect platform capabilities. Pure path and identity transformations remain ordinary TypeScript. Preserve the [JSON and ref contract](docs/protocol.md), explicit discovery coverage and immutable snapshot semantics.
41
+
42
+ Preserve the [naming contract](docs/protocol.md#identity-and-references): Notion Name and authored frontmatter `name` are exact human-readable values, nonempty and free of control characters. Unicode, digits, spaces and hyphens are allowed. Derive callable aliases separately with NFC normalization, lowercase, surrounding-whitespace trimming, whitespace runs replaced by `-`, and percent-encoding outside Unicode letters, marks, numbers, `_` and `-`. Never rewrite an authored name to its alias or use aliases as stable identity. Alias collisions require exact selectors; title changes preserve page IDs and stable member keys. `--name` is an explicit human-title override. Keep package builtin IDs and slugs unchanged.
31
43
 
32
- CI uses Ubuntu and macOS 15 with Node.js 22.19.0 and 24. Every job runs the complete deterministic suite, then drives package verification through `control.ts init/package`; successful runs retain the installed-consumer outputs and exact tarball. Per-matrix evidence is uploaded for seven days, including available failure records. macOS jobs require `/usr/bin/trash`, exercise real cache retirement and recycle owned scratch. Linux consumers verify `RETENTION_UNAVAILABLE` and unchanged cached bytes; Linux scratch remains on the disposable runner because no recycle capability is implemented. These checks require no live Notion credentials. Before integration, inspect all four checks for the PR's current head, not an earlier main run.
44
+ Official optional Skill sources live under `skills/notion/<frontmatter-name>/` and are registered explicitly in `packages/cli/src/builtins.ts` with a `notion/<name>` ID. Embed each selected UTF-8 file and ship the same source tree; keep the Skill self-contained with relative internal references. Update the package file inventory and installed consumer smoke when adding files. `builtin` metadata identifies package input, never remote ownership; preserve create-on-first-publish and exact-target update semantics. Keep the existing general bootstrap at `skills/ntn-skills`.
33
45
 
34
- Keep Effect and platform versions aligned at 4.0.4. New commands use `effect/cli`; external execution uses scoped Effect platform capabilities. Pure path and identity transformations remain ordinary TypeScript. Preserve the [JSON and ref contract](docs/protocol.md), explicit discovery coverage and immutable snapshot semantics.
46
+ Edit Skill and documentation sources at the repository root. `packages/cli/build.ts` generates `packages/cli/skills`, `docs`, both READMEs, CONTRIBUTING, SECURITY, CHANGELOG, LICENSE and THIRD_PARTY_NOTICES; rebuild these copies rather than editing them directly.
35
47
 
36
- Preserve the Skill naming contract: Notion Name uses ASCII English letters and single spaces (1-64 characters); its lowercase form with spaces replaced by hyphens is the invocation name and must equal the export frontmatter name. Do not introduce independent alias configuration or silently normalize invalid titles. Descriptions and file contents may use any language.
48
+ Builtin installation has one writer under the XDG data root, with default shared links and optional additional Agent destinations. Keep version-2 tree receipts and distribution ownership outside transient host profiles; profile receipt-v1 support is a guarded migration input, not another installation path. Exercise default installation, multiple targets, update through links, foreign-target/local-edit protection, status without writes and interrupted migration. Use isolated data/HOME and preserve all replaced bytes through the existing retention capability.
37
49
 
38
50
  Add behavior tests for plausible consumer-visible failures: ambiguity, pagination, partial discovery, file boundaries, version consistency and permission failure. Avoid asserting implementation text or internal call wiring. A pull request should explain the user-visible problem, resulting behavior and checks actually run. Keep unrelated changes separate.
39
51
 
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  <p align="center">
14
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>
15
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/runtime-Node.js%2022.22.3%2B%20(22.x)%20or%2024.20.0%2B-green" alt="Runtime: Node.js 22.22.3+ (22.x) or 24.20.0+"></a>
16
16
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT"></a>
17
17
  </p>
18
18
 
@@ -21,7 +21,7 @@ ntn-skills list
21
21
  ntn-skills read 'Release Review'
22
22
  ```
23
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`**.
24
+ `Release Review` is an example title; choose a Skill returned by your own `list`. The npm package, executable and entrypoint Skill are all **`ntn-skills`**. The entrypoint, content-maintenance and synchronization Skills are independently managed through the `ctl builtin` catalog; see [Agent integration](#agent-integration).
25
25
 
26
26
  Available on [npm](https://www.npmjs.com/package/ntn-skills). For source builds, see [Contributing](CONTRIBUTING.md#development-setup).
27
27
 
@@ -29,19 +29,22 @@ Available on [npm](https://www.npmjs.com/package/ntn-skills). For source builds,
29
29
 
30
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.
31
31
 
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.
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. Stable manual edits to committed Notion content are readable through that same current-page path; old pinned snapshots stay unchanged, and unfinished publications retain their original recovery guards.
33
+
34
+ After a complete read proves a committed native Skill and its source ZIP aligned, ordinary reads can revalidate root/reference metadata, complete inclusion and immutable attachment identity, then reuse all local files without repeated body reads or bundle downloads. `freshness.validation="metadata"` identifies this check; edits with unchanged reported versions can be missed. `--refresh` or explicit `--max-age 0` always validates complete bodies/resources. New machines and missing checkpoints use the full reader. See [read policy](docs/protocol.md#read-policy-and-cache-management).
33
35
 
34
36
  | When you want to… | Use |
35
37
  | --- | --- |
36
38
  | Find a workflow without loading the whole library | `list` |
37
39
  | 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` |
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` |
41
44
 
42
45
  ## Installation
43
46
 
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.
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.
45
48
 
46
49
  Install the published release from the official npm registry:
47
50
 
@@ -53,7 +56,7 @@ ntn-skills --help
53
56
 
54
57
  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
58
 
56
- To produce a package yourself, follow [the contributor setup and build instructions](CONTRIBUTING.md#development-setup). Bun is the development/build tool.
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.
57
60
 
58
61
  ## Quick start
59
62
 
@@ -61,24 +64,40 @@ To produce a package yourself, follow [the contributor setup and build instructi
61
64
 
62
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.
63
66
 
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).
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.
65
78
 
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).
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).
67
86
 
68
87
  ### 2. Check access and choose a workflow
69
88
 
70
89
  ```bash
71
- ntn-skills doctor
90
+ ntn-skills ctl doctor
72
91
  ntn-skills list
73
92
  ```
74
93
 
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.
94
+ With a valid Skill available, `ctl 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
95
 
77
96
  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
97
 
79
98
  ### 3. Read the selected Skill
80
99
 
81
- Copy an entry's `ref` from `skills` into this command, replacing the placeholder:
100
+ Copy an entry's `ref` from `records` into this command, replacing the placeholder:
82
101
 
83
102
  ```bash
84
103
  ntn-skills read 'REF_FROM_LIST'
@@ -106,7 +125,7 @@ For a binary attachment, add `--output ./attachment.bin` and use an appropriate
106
125
  Register a known database as a domain, then select it explicitly. Replace the database placeholder before running:
107
126
 
108
127
  ```bash
109
- ntn-skills source add ops --database 'DATABASE_ID_OR_URL'
128
+ ntn-skills ctl database register ops --database 'DATABASE_ID_OR_URL'
110
129
  ntn-skills list --database ops
111
130
  ntn-skills read 'Release Review' --database ops
112
131
  ```
@@ -118,53 +137,80 @@ Database aliases are exact and case-sensitive. If two databases have the same Sk
118
137
  A Skill can be a folder, ZIP, or Markdown file. Preview remote changes before applying them:
119
138
 
120
139
  ```bash
121
- ntn-skills import ./my-skill --database ops --dry-run
122
- ntn-skills import ./my-skill --database ops
140
+ ntn-skills create ./my-skill --database ops --dry-run
141
+ ntn-skills create ./my-skill --database ops
123
142
  ntn-skills export 'My Skill' --database ops --output ./my-skill.zip
124
- ntn-skills write 'PINNED_REF_FROM_READ' --input ./SKILL.md --dry-run
143
+ ntn-skills apply 'PINNED_MAIN_REF_FROM_READ' --input ./changed-files --dry-run
125
144
  ```
126
145
 
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).
146
+ `create` requires a new name. For an existing page, `apply` combines sparse changed files, optional repeated `--remove PATH` and explicit metadata flags against one pinned main ref or snapshot. Put only the files being added or changed in `./changed-files`; all other files remain. Remove `--dry-run` to execute the reviewed change. A stale baseline fails before publication. `write` and `update` remain available for individual file/property operations. [Inputs, conflicts and partial outcomes](docs/usage.md#creating-importing-exporting-and-updating-skills).
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.
128
151
 
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.
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).
130
153
 
131
154
  ### Synchronize a local distribution directory
132
155
 
133
- Replace `PAGE_ID` and `PLAN_ID` with actual returned identities. The binding label is local configuration, separate from a Skill's invocation alias.
156
+ Replace `PAGE_ID` with an actual selected page ID. The binding label is local configuration, separate from the Skill's invocation alias.
134
157
 
135
158
  ```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
159
+ ntn-skills sync local connect PAGE_ID --path ~/.agents/skills/release-review --as release-review-global
160
+ ntn-skills sync local run release-review-global
161
+ ntn-skills sync local status release-review-global
144
162
  ```
145
163
 
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).
164
+ A missing directory initializes from Notion. Existing differing contents require an explicit `--from local|notion`; later runs compare both sides with the confirmed common baseline and preserve conflicts. Repeating the same connection reuses its binding. Retained receipts settle only when observations confirm convergence; unresolved outcomes keep their original operation IDs and next action.
165
+
166
+ Advanced `bind`, `plan` and `apply --plan` support separately reviewed plans. Apply rechecks the saved binding, versions, content and logical/resolved path. Status is provisional unless `--refresh` is used; `unbind` retains content, baselines, plans and receipts. Symlink paths retain their links, and removed/replaced bytes go through system Trash retention. See [sync usage](docs/usage.md#synchronizing-local-skills).
147
167
 
148
168
  ### Maintain reference pages in Notion
149
169
 
150
170
  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.
151
171
 
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).
172
+ `create` and `replace` 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).
153
173
 
154
174
 
155
175
  ## Agent integration
156
176
 
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.
177
+ The package provides three Skills with separate responsibilities. Make the entrypoint discoverable by default; load a Skill's body only when its task is relevant. “Official” means maintained by this project.
178
+
179
+ | Builtin ID | Responsibility |
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) |
184
+
185
+ With Context Broker, select `$ntn-skills@builtin`, `$ntn-skills-maintain@builtin` or `$ntn-skills-sync@builtin` through ordinary `$` discovery on Pi/OMP/Tern. Their packaged bodies and references work without a Notion source or separate local installation. `/context-broker` owns session/View/refresh controls; content tasks use the selected Skill and public CLI. [Bundled Skills in hosts](docs/host-integration.md#bundled-skills-in-hosts).
158
186
 
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).
187
+ The CLI can also inspect package instructions offline. To keep independently managed local copies for other consumers, use explicit installation:
188
+
189
+ ```bash
190
+ ntn-skills ctl builtin list
191
+ ntn-skills ctl builtin read notion/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).
160
204
 
161
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.
162
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
+
163
209
  ## Boundaries and local data
164
210
 
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.
211
+ - Historical local verification covered npm installation and seeded offline behavior on macOS arm64 with Node.js 24.20.0 and Linux arm64 with Node.js 22.19.0; the latter is now unsupported. Real Notion reads were verified on macOS with `ntn` 0.22.12. CI is configured for Node.js 22.22.3 and 24.20.0 on Ubuntu and macOS 15; configured jobs do not establish successful runs for a new change. Windows is unverified.
212
+ - Content mutations, `ctl builtin publish` and sync `connect/run/apply` can change content. Publications support `--progress` on stderr and retain frozen input/receipts; use `operation resume OPERATION_ID` for guarded publication continuation. Unresolved writes remain explicit. Local sync checks retained receipts and reports the original operation and next action when convergence remains unresolved. Client version checks are not atomic commits. [Publication recovery](docs/usage.md#creating-importing-exporting-and-updating-skills).
213
+ - 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`. Managed builtins use `~/.local/share/ntn-skills`, overridden by `NTN_SKILLS_DATA_HOME` or the XDG data base. 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
214
  - 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.
169
215
 
170
216
  See [configuration and storage](docs/protocol.md#environment-and-local-storage), [error recovery](docs/protocol.md#errors), and [security and privacy](SECURITY.md).
@@ -173,7 +219,7 @@ See [configuration and storage](docs/protocol.md#environment-and-local-storage),
173
219
 
174
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).
175
221
 
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.
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.
177
223
 
178
224
  ## Documentation and contributing
179
225