@hasna/skills 0.6.3 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,37 +15,138 @@ 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
+ The hook install `--include-vendor` option is retained for compatibility with
59
+ older scripts. Hook planning always inventories and disables discovered vendor
60
+ system skills; use `migrate native --include-vendor` when retiring their
61
+ discovery files.
62
+
63
+ Restart the agent after applying the hooks. In Codex, review and grant normal
64
+ trust to the installed hook definitions before starting a new session. Then
65
+ request a selected skill in a prompt, for example `Use $pdf-generate to create
66
+ a PDF`. The hooks supply instructions; executing the skill remains a separate
67
+ explicit action.
68
+
69
+ Each supported agent gets one small `skills-cli` native skill containing CLI
70
+ instructions, without a copied catalogue. Claude's native Skill tool admits
71
+ that bridge after other copies are retired. Prompt guards verify the owned
72
+ bridge bytes, required native configuration, and discovered home/project skill
73
+ paths before loading context. A missing or changed bridge, newly discovered
74
+ copy, stale plugin registration, or incomplete scan reports repair guidance and
75
+ refuses loading. Most adapters also block the prompt; Hermes has the native
76
+ non-blocking prompt-hook limitation described below. These are checks on configured native discovery, not
77
+ an operating-system restriction on arbitrary file reads.
78
+
79
+ Agent policies support up to 1 MiB of serialized UTF-8 JSON, with bounded agent
80
+ and discovery collections (2,048 sources and 512 roots per agent). Installation
81
+ validates the complete resulting policy before writing configuration or backups;
82
+ the same limits apply when reading and guarding native context. A rejected plan
83
+ leaves the previous policy intact.
84
+
85
+ Hermes 0.20.5 uses `pre_llm_call` to add selected context and `pre_tool_call`
86
+ with `fail_closed: true` and a small owned supervisor to guard tool calls. The
87
+ supervisor maps Skills child failures, timeouts and missing/invalid directives
88
+ to the native explicit block response and exit code 2. Installation edits `config.yaml`
89
+ while preserving unrelated values/comments and creates the native
90
+ `.no-bundled-skills` opt-out marker to prevent bundled payloads from reappearing.
91
+ The supervisor stays in the Skills data directory and its bytes/command are
92
+ checked before native loading. Installation leaves the native shell-hook
93
+ allowlist unchanged: approve the two exact
94
+ managed event/command pairs through Hermes normal hook trust and restart.
95
+ The adapter refuses unreviewed installed plugin sources and custom Hermes
96
+ homes/profiles, user-specific tilde expansion, and `TERMINAL_CWD` overrides.
97
+ Retire native payloads before use. Legacy `skills-cli.md` files can shadow the
98
+ bridge and must also be preserved and retired before proceeding. Only `skill_view(name:
99
+ "skills-cli")` is allowed natively; author payloads with Skills CLI commands.
100
+ Hermes itself fails open on `pre_llm_call` errors. A returned refusal is visible
101
+ context, and the trusted pre-tool guard blocks drift and native skill fallback;
102
+ this is not a claim that Hermes can prevent every model call after a failed
103
+ prompt hook or guarantee refusal if the native host/supervisor itself dies. Arbitrary project/plugin paths still require a discovery audit.
104
+
105
+ Hook installation preserves unrelated configuration, hooks, and plugin assets.
106
+ It disables discovered Codex native skills; exact system-skill trees can remain
107
+ only with their hash-bound disabled paths; migration preserves these package files. A client that restores or changes
108
+ packaged skills requires a fresh inventory and disable plan. Native exports are
109
+ refused while managed CLI loading is active. Migration preserves ordinary skill
110
+ directories in private archives; `--include-unmanaged` includes user-authored
111
+ copies, and `--include-vendor` retires vendor `SKILL.md` discovery files while
112
+ preserving shared scripts and assets. Archive receipts and configuration backups
113
+ live under the Skills data directory.
114
+
115
+ Native archives persist a version 2 recovery journal before moving payloads;
116
+ `migrate native --json --apply` returns its `receiptPath`. The journal records
117
+ every source, archive path, expected hash, and move status, then marks successful
118
+ completion. Interrupted operations can be inspected against that durable intent.
119
+ On failure, recovery restores verified archives only when the original path is
120
+ still absent. It preserves occupied paths or unverified archives, records that
121
+ they require recovery, and continues compensating other unchanged entries.
122
+ Keep native agents and other skill writers stopped throughout migration and
123
+ recovery: portable directory rename cannot atomically reserve an absent target.
124
+ Vendor file restoration uses an exclusive hard link to preserve concurrent files.
125
+ Do not retry an interrupted operation until its journal and both paths have been
126
+ reconciled; a failed final journal write may leave the earlier durable intent.
127
+
128
+ `skills hook agents --json` reports the supported adapters and coverage limits.
129
+ Claude and Codex have lifecycle context hooks; Gemini uses `BeforeAgent`, and
130
+ OpenCode uses its awaited message plugin. Cursor receives selected context at
131
+ session start and gates later prompt submission; its prompt hook does not
132
+ inject context on the supported installed path. Other inventoried clients do
133
+ not automatically gain a working prompt adapter.
134
+
135
+ Known local plugin registrations are resolved automatically. Plugins with
136
+ instruction-injecting hooks, unresolved runtime registrations, unsupported
137
+ legacy command formats, and higher-precedence project discovery settings need
138
+ separate review; a cache-only scan does not establish complete coverage. The
139
+ advanced `--discovery-inputs <file>` option on hook installation and migration
140
+ accepts reviewed active roots and full source-file SHA-256 witnesses. Its
141
+ version-1 document has an `agents` array; each entry names `agent`, absolute
142
+ `roots`, `sources` (`path` and `sha256`, or `null` for an absent file), and
143
+ `pluginHooks: "reviewed-no-skill-injection"`. Include the agent configuration
144
+ and every input establishing the active roots and plugin-hook behavior. A
145
+ changed witness requires a new review. This option does not add support for an
146
+ unknown native file format or make unreviewed plugin behavior safe. Managed
147
+ system configuration, process-specific overrides, and alternate agent home
148
+ directories are outside automatic coverage and require their own integration
149
+ review before declaring a station migrated.
49
150
 
50
151
  If your home `.claude` or `.codex` directory intentionally links to another
51
152
  directory within your home, add `--allow-root-aliases` to hook installation and
@@ -80,9 +181,49 @@ skills sync --selection-profile default --check --json
80
181
  skills station-state station-example --json
81
182
  ```
82
183
 
184
+ With `--selection-profile`, `sync --check` checks the selected profile and cache
185
+ without writing, and exits nonzero on drift. `sync --station` records a receipt
186
+ for the named station; it is not a native-folder snapshot in this mode.
187
+ `skills install --selection-profile default` without skill names also syncs the
188
+ whole selection.
189
+
190
+ After hook installation has enabled CLI loading, pull operations obey the same
191
+ profile. `--all` refreshes its selected versions rather than the full catalog,
192
+ and a named pull must belong to that profile:
193
+
194
+ ```bash
195
+ skills pull --all --selection-profile default --json
196
+ skills pull pdf-generate@0.5.2 --selection-profile default --json
197
+ ```
198
+
199
+ Use `sync --selection-profile default --station station-example` when you also
200
+ need a station receipt. Native-folder migration options belong to the older
201
+ sync mode and cannot be mixed with profile sync.
202
+
83
203
  Selection documents contain a `selections` array. Each entry has `slug`,
84
204
  `version`, `bundleDigest` (`sha256:` followed by 64 lowercase hex characters),
85
- and optional `triggers` containing `keywords`, `paths`, or `always`. Profile
205
+ and optional `triggers` containing `keywords`, `paths`, or `always`. An optional
206
+ `aliases` array gives a selection up to 32 reviewed kebab-case alternate names.
207
+ Aliases cannot duplicate another alias or any canonical name in the profile.
208
+ They resolve directly to that selection's exact version and digest in `load`,
209
+ managed `run`/`pull`, and explicit prompt references such as `$old-name`.
210
+ Receipts and bundle requests retain the canonical name. Aliases are scoped to
211
+ the authority, workspace and profile revision; project/session locks preserve
212
+ their pinned aliases. They do not create global registry entries or native
213
+ redirect skills. Saving aliases requires an API advertising `selectionAliases`.
214
+ Profiles support up to 4,096 exact selections. API responses and local profile,
215
+ project and session documents share an 8 MiB UTF-8 JSON limit. Resolved profiles
216
+ reserve space within that limit for all session-loaded keys; the API refuses an
217
+ oversized candidate before replacing the existing profile. Saved snapshots and
218
+ owned cache receipts use compact JSON; existing formatted receipts remain readable.
219
+ The authenticated capabilities response advertises `profileLimits`, including
220
+ `maxSelections`, `maxDocumentBytes`, `maxResolvedProfileBytes` and the effective
221
+ `requestBodyLimitBytes`. Larger writes require these advertised limits. Operators
222
+ can set `HASNA_SKILLS_REQUEST_BODY_LIMIT_BYTES=8388608` to admit larger requests;
223
+ the default remains 1,000,000 bytes and a lower configured limit still applies.
224
+ These limits apply to configured memory, SQLite and PostgreSQL stores;
225
+ profile sync does not require S3 or native skill copies.
226
+ Profile
86
227
  writes use compare-and-swap revisions. Station receipts belong to the workspace,
87
228
  user and stable station ID, so rotating a key does not create a new station.
88
229
  Consumers need `skills:read` and `stations:write`; profile publishers need
@@ -97,11 +238,21 @@ are explicitly changed or a new session starts.
97
238
  ## Executable skills
98
239
 
99
240
  ```bash
100
- skills run --target cloud --input '{"title":"Example","content":"Hello"}' pdf-generate@0.5.2
101
- skills executions status RUN_ID --json
241
+ skills capabilities --json
242
+ skills run --target cloud --selection-profile default \
243
+ --input '{"title":"Example","content":"Hello"}' \
244
+ --idempotency-key YOUR_UNIQUE_JOB_KEY --wait --json pdf-generate@0.5.2
245
+ skills executions show RUN_ID --json
246
+ skills executions logs RUN_ID --json
247
+ skills executions artifacts RUN_ID --json
102
248
  skills executions download RUN_ID document.pdf --output ./document.pdf
103
249
  ```
104
250
 
251
+ Use a new idempotency key for each new job and retain it with the exact input.
252
+ If a response is lost or polling times out, reconcile the existing execution
253
+ before submitting again. The selected profile must include this exact version,
254
+ and the consumer needs `runs:write` as well as `skills:read`.
255
+
105
256
  Cloud execution is enabled only when the deployment configures a reviewed image
106
257
  and exact bundle allowlist. The first supported lane is `pdf-generate`; arbitrary
107
258
  uploaded code is not admitted. Runs capture version, bundle digest, input digest,
@@ -240,7 +391,20 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
240
391
  | `skills show <name>` | | Show bundled or portable skill details |
241
392
  | `skills docs <name>` | | Show documentation (SKILL.md > README.md > CLAUDE.md) |
242
393
  | `skills requires <name>` | | Show env vars, system deps, and npm dependencies |
394
+ | `skills profiles show <id>` / `skills profiles set <id> --file <json>` | | Read an exact shared selection or update it with writer authorization |
395
+ | `skills install [name@version] --selection-profile <id>` | | Cache selected immutable bundles; without names, sync the profile |
396
+ | `skills load <name> --selection-profile <id>` | | Load complete instructions from the verified selection |
397
+ | `skills context <prompt> --selection-profile <id>` | | Resolve instructions matching the prompt and profile triggers |
398
+ | `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 |
399
+ | `skills hook agents --json` | | Report maintained adapters and explicit coverage limits |
400
+ | `skills migrate native` | | Inventory native copies; `--apply` archives managed copies, with explicit `--include-unmanaged` and `--include-vendor` retirement options |
401
+ | `skills pull --all --selection-profile <id>` | | With CLI loading active, refresh the selected profile into the verified cache |
402
+ | `skills sync --selection-profile <id> [--check] [--station <id>]` | | Sync or check the selected profile/cache; optionally record station state |
403
+ | `skills station-state <id>` | | Read a station's sync receipt in the authenticated workspace |
243
404
  | `skills run <name> [args]` | | Execute a skill directly |
405
+ | `skills run --target cloud --selection-profile <id> <name@version>` | | Submit an explicitly selected cloud execution |
406
+ | `skills executions show <id>` / `logs <id>` / `artifacts <id>` | | Inspect a cloud execution and its output |
407
+ | `skills executions download <id> <artifact> --output <path>` | | Download and verify one cloud execution artifact |
244
408
  | `skills runs status <run-id>` | | Poll a remote skill run |
245
409
  | `skills exports download <run-id>` | | Download completed remote artifacts |
246
410
  | `skills update` | | Refresh project pin metadata |
@@ -266,10 +430,11 @@ of app folders, and `XDG_CONFIG_HOME` is not consulted at all.
266
430
  | `skills new <name>` | `scaffold` | Scaffold a portable skill under `~/.hasna/skills/installed/<name>` |
267
431
  | `skills port <path>` | `add` | Import an existing skill folder into the portable standard |
268
432
  | `skills create <name>` | | Scaffold a new custom skill directory |
433
+ | `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
434
  | `skills sync --to claude` | | Disabled by design; use `skills mcp --register <agent|all>` |
270
435
  | `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) |
436
+ | `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. |
437
+ | `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
438
  | `skills hydrate --station <id>` | | Restore the canonical corpus cache from a reviewed per-station snapshot (dry-run by default; `--apply` writes) |
274
439
  | `skills validate <name>` | | Check a skill's directory structure |
275
440
  | `skills schedule add <skill> <cron>` | | Set up recurring skill execution |