@hasna/skills 0.6.3 → 0.7.2

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
@@ -15,37 +15,189 @@ Requires [Bun](https://bun.sh/) 1.3+.
15
15
 
16
16
  ## Quick Start
17
17
 
18
- Configure a Skills API credential using `skills auth login`. The default authority
19
- is `https://api.hasna.com/skills`; versioned requests use `/skills/v1`.
20
- Use `skills setup --api-url https://skills.example.com` for your own server.
18
+ The fleet authority is `https://api.hasna.com/skills`; versioned requests use
19
+ `/skills/v1`. Obtain a workspace API key through your administrator's
20
+ provisioning process and configure it using the [credential resolution](#credentials)
21
+ below. Check the selected identity and
22
+ available capabilities before syncing:
23
+
24
+ ```bash
25
+ skills auth whoami --json
26
+ skills capabilities --json
27
+ ```
28
+
29
+ The default authority is `https://api.hasna.com/skills`; a full `/skills/v1`
30
+ base is also accepted. For your own compatible server, select it with
31
+ `skills setup --api-url https://skills.example.com`, then use `skills auth login`.
32
+ Browser/device-code and email-code login are for compatible deployments; the
33
+ fleet gateway has no interactive login service and does not issue keys that way.
21
34
 
22
35
  A workspace administrator creates a shared profile selecting published skills by
23
36
  exact version and SHA-256 digest. Consumers sync that profile into a verified
24
- Skills cache, then load instructions through the CLI:
37
+ Skills cache, then load instructions through the CLI. Replace `default` with
38
+ your assigned profile; these examples assume it selects `pdf-generate@0.5.2`:
25
39
 
26
40
  ```bash
27
41
  skills list --json
28
42
  skills profiles show default --json
29
43
  skills sync --selection-profile default --json
30
- skills load release-notes
31
- skills context 'Prepare release notes' --json
44
+ skills install pdf-generate@0.5.2 --selection-profile default --json
45
+ skills load pdf-generate@0.5.2 --selection-profile default
46
+ skills context 'Use $pdf-generate to create a PDF' --selection-profile default --json
32
47
 
33
- # Preview agent configuration, then install hooks with recoverable backups.
48
+ # Preview retirement, then archive ordinary copies and vendor discovery files.
49
+ skills migrate native --include-unmanaged --include-vendor --json
50
+ skills migrate native --include-unmanaged --include-vendor --apply --json
51
+
52
+ # Preview the available adapters, then install one bridge plus hooks per agent.
53
+ skills hook agents --json
34
54
  skills hook install --agent all --selection-profile default --json
35
55
  skills hook install --agent all --selection-profile default --apply --json
36
-
37
- # Inventory native copies, then archive managed copies outside agent discovery.
38
- skills migrate native --json
39
- skills migrate native --apply --json
40
56
  ```
41
57
 
42
- Hook installation enables CLI loading on the station, denies Claude's native
43
- Skill tool, and disables discovered Codex native skills. It preserves unrelated
44
- hooks and configuration. Use `--include-vendor` to include Codex system and
45
- cached plugin skills. Project-local skills require a project discovery audit. Native
46
- exports are refused while this policy is active. Archives preserve full skill
47
- directories; `--include-unmanaged` explicitly includes user-authored copies.
48
- Archive receipts and configuration backups live under the Skills data directory.
58
+ Native hook invocations must use their installed adapter's selection profile.
59
+ An old client command or environment override naming another profile refuses
60
+ before synchronization or context loading. Review the hook installation and
61
+ restart the native client to load its current commands. Explicit `skills load`,
62
+ `skills context`, and `skills sync` commands can still select other profiles.
63
+
64
+ The hook install `--include-vendor` option is retained for compatibility with
65
+ older scripts. Hook planning always inventories and disables discovered vendor
66
+ system skills; use `migrate native --include-vendor` when retiring their
67
+ discovery files.
68
+
69
+ Restart the agent after applying the hooks. In Codex, review and grant normal
70
+ trust to the installed hook definitions before starting a new session. Then
71
+ request a selected skill in a prompt, for example `Use $pdf-generate to create
72
+ a PDF`. The hooks supply instructions; executing the skill remains a separate
73
+ explicit action.
74
+
75
+ Each supported agent gets one small `skills-cli` native skill containing CLI
76
+ instructions, without a copied catalogue. Claude's native Skill tool admits
77
+ that bridge after other copies are retired. Prompt guards verify the owned
78
+ bridge bytes, required native configuration, and discovered home/project skill
79
+ paths before loading context. A missing or changed bridge, newly discovered
80
+ copy, stale plugin registration, or incomplete scan reports repair guidance and
81
+ refuses loading. Most adapters also block the prompt; Hermes has the native
82
+ non-blocking prompt-hook limitation described below. These are checks on configured native discovery, not
83
+ an operating-system restriction on arbitrary file reads.
84
+
85
+ Agent policies support up to 1 MiB of serialized UTF-8 JSON, with bounded agent
86
+ and discovery collections (2,048 sources and 512 roots per agent). Installation
87
+ validates the complete resulting policy before writing configuration or backups;
88
+ the same limits apply when reading and guarding native context. A rejected plan
89
+ leaves the previous policy intact.
90
+
91
+ Hermes 0.20.5 uses `pre_llm_call` to add selected context and `pre_tool_call`
92
+ with `fail_closed: true` and a small owned supervisor to guard tool calls. The
93
+ supervisor maps Skills child failures, timeouts and missing/invalid directives
94
+ to the native explicit block response and exit code 2. Installation edits `config.yaml`
95
+ while preserving unrelated values/comments and creates the native
96
+ `.no-bundled-skills` opt-out marker to prevent bundled payloads from reappearing.
97
+ The supervisor stays in the Skills data directory and its bytes/command are
98
+ checked before native loading. Installation leaves the native shell-hook
99
+ allowlist unchanged: approve the two exact
100
+ managed event/command pairs through Hermes normal hook trust and restart.
101
+ The adapter refuses unreviewed installed plugin sources and custom Hermes
102
+ homes/profiles, user-specific tilde expansion, and `TERMINAL_CWD` overrides.
103
+ Nonempty `HERMES_BUNDLED_PLUGINS` and `HERMES_BUNDLED_SKILLS` overrides are
104
+ also refused during discovery and hook checks; unset them to use the reviewed
105
+ default source paths. Custom bundle locations need a dedicated discovery adapter.
106
+ Retire native payloads before use. Legacy `skills-cli.md` files can shadow the
107
+ bridge and must also be preserved and retired before proceeding. Only `skill_view(name:
108
+ "skills-cli")` is allowed natively; author payloads with Skills CLI commands.
109
+ Hermes itself fails open on `pre_llm_call` errors. A returned refusal is visible
110
+ context, and the trusted pre-tool guard blocks drift and native skill fallback;
111
+ this is not a claim that Hermes can prevent every model call after a failed
112
+ prompt hook or guarantee refusal if the native host/supervisor itself dies. Arbitrary project/plugin paths still require a discovery audit.
113
+
114
+ Reviewed discovery can also bind `directories: [{ path, sha256 }]` alongside
115
+ its full source-file hashes. The public SDK's `captureDiscoveryDirectories(paths)`
116
+ captures recursive, sorted path/type membership without reading plugin payloads.
117
+ Include every directory the reviewed loader scans, including plugin version
118
+ selection parents and Python entrypoint discovery directories. Membership hashes
119
+ detect added, removed or changed file types; keep source hashes for reviewed bytes.
120
+ Missing directories bind as `sha256: null`. Symlinks and special nodes refuse.
121
+ The bounds are 64 roots, 20,000 total entries, 8 MiB of path/type metadata and
122
+ 64 levels of recursion. Capture and checks require stable directory identities;
123
+ quiesce source writers for installation because these checks are not atomic with
124
+ a later native import.
125
+
126
+ For full binary or source-byte coverage, use the public SDK's
127
+ `captureDiscoveryByteSources(paths)` and retain its explicit `hashMode: "bytes"`
128
+ on each source witness. It hashes the exact file bytes, including invalid UTF-8,
129
+ with limits of 64 MiB per file and 256 MiB across one capture or verification.
130
+ Missing files bind as `sha256: null`; symlinks, special files and changing file
131
+ identities refuse. Raw witnesses cannot use configuration field projections.
132
+ Existing witnesses without `hashMode` retain their original UTF-8 decoding
133
+ contract and 16 MiB file limit; they are not silently converted into byte hashes.
134
+ Directory membership and file bytes are separate witnesses. Neither substitutes
135
+ for reviewing the actual executable, import paths or loader behavior.
136
+
137
+ Hermes requires directory witnesses, including when upgrading an older policy.
138
+ For an automatic bridge with no runtime installed, rerun normal `skills hook install`
139
+ to review and apply the new bindings. Existing native trust is preserved.
140
+ Reviewed Hermes installations need fresh source and directory coverage in their
141
+ `--discovery-inputs` file. Other agents may add directory witnesses to their
142
+ reviewed bindings without changing existing source-only reviews.
143
+
144
+ Hook installation preserves unrelated configuration, hooks, and plugin assets.
145
+ It disables discovered Codex native skills; exact system-skill trees can remain
146
+ only with their hash-bound disabled paths; migration preserves these package files. A client that restores or changes
147
+ packaged skills requires a fresh inventory and disable plan. Native exports are
148
+ refused while managed CLI loading is active. Migration preserves ordinary skill
149
+ directories in private archives; `--include-unmanaged` includes user-authored
150
+ copies, and `--include-vendor` retires vendor `SKILL.md` discovery files while
151
+ preserving shared scripts and assets. Archive receipts and configuration backups
152
+ live under the Skills data directory.
153
+
154
+ After vendor documents are archived, inventory still scans their retained asset
155
+ directories for newly introduced skills. Vendor container traversal allows 32
156
+ directory levels; the ordinary native-root limit remains unchanged. Each inventory
157
+ is bounded to 20,000 discovery entries and 4 MiB of UTF-8 path metadata before
158
+ directory entries are retained or sorted. Unsupported special files and unsafe
159
+ directory links are refused.
160
+
161
+ Native archives persist a version 2 recovery journal before moving payloads;
162
+ `migrate native --json --apply` returns its `receiptPath`. The journal records
163
+ every source, archive path, expected hash, and move status, then marks successful
164
+ completion. Interrupted operations can be inspected against that durable intent.
165
+ On failure, recovery restores verified archives only when the original path is
166
+ still absent. It preserves occupied paths or unverified archives, records that
167
+ they require recovery, and continues compensating other unchanged entries.
168
+ Keep native agents and other skill writers stopped throughout migration and
169
+ recovery: portable directory rename cannot atomically reserve an absent target.
170
+ Vendor file restoration uses an exclusive hard link to preserve concurrent files.
171
+ Do not retry an interrupted operation until its journal and both paths have been
172
+ reconciled; a failed final journal write may leave the earlier durable intent.
173
+
174
+ `skills hook agents --json` reports the supported adapters and coverage limits.
175
+ Claude and Codex have lifecycle context hooks; Gemini uses `BeforeAgent`, and
176
+ OpenCode uses its awaited message plugin. Cursor receives selected context at
177
+ session start and gates later prompt submission; its prompt hook does not
178
+ inject context on the supported installed path. Other inventoried clients do
179
+ not automatically gain a working prompt adapter.
180
+
181
+ Gemini's `BeforeAgent` prompt can include the Skills policy emitted at session
182
+ start. The hook excludes that exact leading policy from skill selection, so it
183
+ does not displace the user's requested skill. Other hook context and user text
184
+ remain part of the selection input.
185
+
186
+ Known local plugin registrations are resolved automatically. Plugins with
187
+ instruction-injecting hooks, unresolved runtime registrations, unsupported
188
+ legacy command formats, and higher-precedence project discovery settings need
189
+ separate review; a cache-only scan does not establish complete coverage. The
190
+ advanced `--discovery-inputs <file>` option on hook installation and migration
191
+ accepts reviewed active roots and full source-file SHA-256 witnesses. Its
192
+ version-1 document has an `agents` array; each entry names `agent`, absolute
193
+ `roots`, `sources` (`path` and `sha256`, or `null` for an absent file), and
194
+ `pluginHooks: "reviewed-no-skill-injection"`. Include the agent configuration
195
+ and every input establishing the active roots and plugin-hook behavior. A
196
+ changed witness requires a new review. This option does not add support for an
197
+ unknown native file format or make unreviewed plugin behavior safe. Managed
198
+ system configuration, process-specific overrides, and alternate agent home
199
+ directories are outside automatic coverage and require their own integration
200
+ review before declaring a station migrated.
49
201
 
50
202
  If your home `.claude` or `.codex` directory intentionally links to another
51
203
  directory within your home, add `--allow-root-aliases` to hook installation and
@@ -80,9 +232,49 @@ skills sync --selection-profile default --check --json
80
232
  skills station-state station-example --json
81
233
  ```
82
234
 
235
+ With `--selection-profile`, `sync --check` checks the selected profile and cache
236
+ without writing, and exits nonzero on drift. `sync --station` records a receipt
237
+ for the named station; it is not a native-folder snapshot in this mode.
238
+ `skills install --selection-profile default` without skill names also syncs the
239
+ whole selection.
240
+
241
+ After hook installation has enabled CLI loading, pull operations obey the same
242
+ profile. `--all` refreshes its selected versions rather than the full catalog,
243
+ and a named pull must belong to that profile:
244
+
245
+ ```bash
246
+ skills pull --all --selection-profile default --json
247
+ skills pull pdf-generate@0.5.2 --selection-profile default --json
248
+ ```
249
+
250
+ Use `sync --selection-profile default --station station-example` when you also
251
+ need a station receipt. Native-folder migration options belong to the older
252
+ sync mode and cannot be mixed with profile sync.
253
+
83
254
  Selection documents contain a `selections` array. Each entry has `slug`,
84
255
  `version`, `bundleDigest` (`sha256:` followed by 64 lowercase hex characters),
85
- and optional `triggers` containing `keywords`, `paths`, or `always`. Profile
256
+ and optional `triggers` containing `keywords`, `paths`, or `always`. An optional
257
+ `aliases` array gives a selection up to 32 reviewed kebab-case alternate names.
258
+ Aliases cannot duplicate another alias or any canonical name in the profile.
259
+ They resolve directly to that selection's exact version and digest in `load`,
260
+ managed `run`/`pull`, and explicit prompt references such as `$old-name`.
261
+ Receipts and bundle requests retain the canonical name. Aliases are scoped to
262
+ the authority, workspace and profile revision; project/session locks preserve
263
+ their pinned aliases. They do not create global registry entries or native
264
+ redirect skills. Saving aliases requires an API advertising `selectionAliases`.
265
+ Profiles support up to 4,096 exact selections. API responses and local profile,
266
+ project and session documents share an 8 MiB UTF-8 JSON limit. Resolved profiles
267
+ reserve space within that limit for all session-loaded keys; the API refuses an
268
+ oversized candidate before replacing the existing profile. Saved snapshots and
269
+ owned cache receipts use compact JSON; existing formatted receipts remain readable.
270
+ The authenticated capabilities response advertises `profileLimits`, including
271
+ `maxSelections`, `maxDocumentBytes`, `maxResolvedProfileBytes` and the effective
272
+ `requestBodyLimitBytes`. Larger writes require these advertised limits. Operators
273
+ can set `HASNA_SKILLS_REQUEST_BODY_LIMIT_BYTES=8388608` to admit larger requests;
274
+ the default remains 1,000,000 bytes and a lower configured limit still applies.
275
+ These limits apply to configured memory, SQLite and PostgreSQL stores;
276
+ profile sync does not require S3 or native skill copies.
277
+ Profile
86
278
  writes use compare-and-swap revisions. Station receipts belong to the workspace,
87
279
  user and stable station ID, so rotating a key does not create a new station.
88
280
  Consumers need `skills:read` and `stations:write`; profile publishers need
@@ -97,11 +289,21 @@ are explicitly changed or a new session starts.
97
289
  ## Executable skills
98
290
 
99
291
  ```bash
100
- skills run --target cloud --input '{"title":"Example","content":"Hello"}' pdf-generate@0.5.2
101
- skills executions status RUN_ID --json
292
+ skills capabilities --json
293
+ skills run --target cloud --selection-profile default \
294
+ --input '{"title":"Example","content":"Hello"}' \
295
+ --idempotency-key YOUR_UNIQUE_JOB_KEY --wait --json pdf-generate@0.5.2
296
+ skills executions show RUN_ID --json
297
+ skills executions logs RUN_ID --json
298
+ skills executions artifacts RUN_ID --json
102
299
  skills executions download RUN_ID document.pdf --output ./document.pdf
103
300
  ```
104
301
 
302
+ Use a new idempotency key for each new job and retain it with the exact input.
303
+ If a response is lost or polling times out, reconcile the existing execution
304
+ before submitting again. The selected profile must include this exact version,
305
+ and the consumer needs `runs:write` as well as `skills:read`.
306
+
105
307
  Cloud execution is enabled only when the deployment configures a reviewed image
106
308
  and exact bundle allowlist. The first supported lane is `pdf-generate`; arbitrary
107
309
  uploaded code is not admitted. Runs capture version, bundle digest, input digest,
@@ -240,7 +442,20 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
240
442
  | `skills show <name>` | | Show bundled or portable skill details |
241
443
  | `skills docs <name>` | | Show documentation (SKILL.md > README.md > CLAUDE.md) |
242
444
  | `skills requires <name>` | | Show env vars, system deps, and npm dependencies |
445
+ | `skills profiles show <id>` / `skills profiles set <id> --file <json>` | | Read an exact shared selection or update it with writer authorization |
446
+ | `skills install [name@version] --selection-profile <id>` | | Cache selected immutable bundles; without names, sync the profile |
447
+ | `skills load <name> --selection-profile <id>` | | Load complete instructions from the verified selection |
448
+ | `skills context <prompt> --selection-profile <id>` | | Resolve instructions matching the prompt and profile triggers |
449
+ | `skills hook install --agent all --selection-profile <id>` | | Plan one CLI bridge plus supported native hooks; `--apply` installs it, then restart and trust the hooks |
450
+ | `skills hook agents --json` | | Report maintained adapters and explicit coverage limits |
451
+ | `skills migrate native` | | Inventory native copies; `--apply` archives managed copies, with explicit `--include-unmanaged` and `--include-vendor` retirement options |
452
+ | `skills pull --all --selection-profile <id>` | | With CLI loading active, refresh the selected profile into the verified cache |
453
+ | `skills sync --selection-profile <id> [--check] [--station <id>]` | | Sync or check the selected profile/cache; optionally record station state |
454
+ | `skills station-state <id>` | | Read a station's sync receipt in the authenticated workspace |
243
455
  | `skills run <name> [args]` | | Execute a skill directly |
456
+ | `skills run --target cloud --selection-profile <id> <name@version>` | | Submit an explicitly selected cloud execution |
457
+ | `skills executions show <id>` / `logs <id>` / `artifacts <id>` | | Inspect a cloud execution and its output |
458
+ | `skills executions download <id> <artifact> --output <path>` | | Download and verify one cloud execution artifact |
244
459
  | `skills runs status <run-id>` | | Poll a remote skill run |
245
460
  | `skills exports download <run-id>` | | Download completed remote artifacts |
246
461
  | `skills update` | | Refresh project pin metadata |
@@ -266,10 +481,11 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
266
481
  | `skills new <name>` | `scaffold` | Scaffold a portable skill under `~/.hasna/skills/installed/<name>` |
267
482
  | `skills port <path>` | `add` | Import an existing skill folder into the portable standard |
268
483
  | `skills create <name>` | | Scaffold a new custom skill directory |
484
+ | `skills prepare <name> --version <semver>` | | Validate an edited draft and update only its manifest version/hash; `--dry-run` previews, `--kind` resolves legacy manifests without an explicit kind |
269
485
  | `skills sync --to claude` | | Disabled by design; use `skills mcp --register <agent|all>` |
270
486
  | `skills sync --from claude` | | Disabled by design; agent skill folders are not used |
271
- | `skills sync [names...] --check --for <agent> --source <path>` | `render` | Read-only drift census for the selected corpus, skills and agent; explicit source overrides `SKILLS_SOURCE`, then the installed cache. Unknown selections or drift exit nonzero. Without selectors, check all existing agent homes. |
272
- | `skills sync --station <id>` | | Per-station snapshot mode: snapshot the installed skill homes into `resources/<station>/skills` with a v3 sync-manifest (dry-run by default; `--populate` writes) |
487
+ | `skills sync [names...] --check --for <agent> --source <path>` | `render` | Legacy native-folder mode only, without CLI loading or a selection profile: check the selected corpus and agent homes without writing. Unknown selections or drift exit nonzero. |
488
+ | `skills sync --station <id>` | | Without CLI loading or a selection profile, legacy snapshot mode writes a v3 sync-manifest under `resources/<station>/skills` only with `--populate`; use explicit `--selection-profile` for API station receipts |
273
489
  | `skills hydrate --station <id>` | | Restore the canonical corpus cache from a reviewed per-station snapshot (dry-run by default; `--apply` writes) |
274
490
  | `skills validate <name>` | | Check a skill's directory structure |
275
491
  | `skills schedule add <skill> <cron>` | | Set up recurring skill execution |