Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/34686-initialize-selection-rule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
'@objectstack/mcp': patch
---
Expand All @@ -12,6 +12,6 @@
When neither the host's per-request text nor the plugin's `instructions` option answers, `result.instructions` now carries, after that sentence:

- **The selection rule**, only where the request registers both `list_datasets` and `query_dataset` (a bridge with the dataset members and a grant that admits `data:read`; an API key or session counts): look for a governed metric first with `list_datasets` and the question's business words; a word matches only an equal name, label or synonym; one measure match answers through `query_dataset`; several matches are a question for the user; no match falls back to `query_records` / `aggregate_records` and says the answer is not from a governed metric. A grant without `data:read` gets no dataset sentence.
- **The skills install line**: `Published skills: @objectstack/skills <version>` with its `pnpm add -D` command, at this package's own version (released together with `@objectstack/skills`), not the `version` option.
- **The skills install line**: `Published skills: @objectstack/skills <version>` with the command that installs it into the agent's skills directory, with or without a project, `os skills install --version <version>`, at this package's own version (released together with `@objectstack/skills`), not the `version` option.

Host-injected instructions and the `instructions` option are served exactly as before, with nothing appended. The stdio server's instructions are unchanged.
17 changes: 17 additions & 0 deletions .changeset/34773-os-skills-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@objectstack/cli': patch
'@objectstack/mcp': patch
---

feat(cli): `os skills install | update | status` install, update and check the published skills catalog at the server's version, with or without a project

Clause-②: yes (widening: a new published CLI command group, `os skills install | update | status`)
Metadata-protocol: none

Nothing installed the published skills catalog except `create-objectstack`'s scaffold-time sync, so a user who only connected an MCP client had no way to install it, and a project had no command to refresh it after an upgrade.

- **`os skills install`** copies `@objectstack/skills` at one version into the agent's skills directory (`.claude/skills/` under the current directory, or `--dir`), in an empty directory or in a project; no `package.json` is read or written. The version is `--version` (exact), else the target environment's (`--target`, a URL or a restriction profile file, read exactly as `os validate --target` reads it), else the CLI's own version (the two are released together); the output names which. The tarball is read with `npm pack` from the registry the environment configures, and only `dist/skills/<name>/` is copied. A version the registry does not publish is refused, naming it. What was written is recorded in `.objectstack-skills.json` beside the skills.
- **`os skills update`** moves the recorded catalog to another version: it replaces the catalog's skills, removes those the new version dropped, and never writes, replaces or removes a skill directory it did not install. A catalog skill changed locally is refused unless `--force`.
- **`os skills status`** reports the installed version against the expected one, plus missing, modified and extra skills; it exits `0`, or `1` on a mismatch with `--check`. All three take `--json`.

`@objectstack/mcp`: the open server's `initialize` skills install line now names `os skills install --version <version>` (and its `npx -p @objectstack/cli@<version>` form for a machine without the CLI) instead of `pnpm add -D @objectstack/skills@<version>`, which needed a project.
11 changes: 8 additions & 3 deletions content/docs/ai/connect-mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,14 @@ such sentence.

The instructions also name the published skills package and the version to
install, which is the server's own version
(`Published skills: @objectstack/skills <version>`, with
`pnpm add -D @objectstack/skills@<version>`); see
[Skills](/docs/ai/skills) for syncing it into your agent. A deployment that sets
(`Published skills: @objectstack/skills <version>`), with the command that
installs it into your agent's skills directory, with or without a project:
`os skills install --version <version>`, or
`npx -p @objectstack/cli@<version> os skills install --version <version>` where
the CLI is not installed. If you only connected an MCP client and have no
project, run it in the directory your agent works in; it writes
`.claude/skills/` there (`--dir` names another). See
[Skills](/docs/ai/skills#installing-skills) for updating and checking it. A deployment that sets
the MCP plugin's `instructions` option serves that text as written instead, and
the local stdio server's instructions carry neither part.

Expand Down
20 changes: 16 additions & 4 deletions content/docs/ai/skills.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,29 @@ See [Agents](/docs/ai/agents#you-extend-the-platform-with-skills-not-agents) for

## Installing skills

Skills ship as the npm package `@objectstack/skills`, released with the other `@objectstack/*` packages at one shared version. Install it at your installed `@objectstack/spec`'s version — the catalog's version is then your spec's — and copy it from `node_modules` into your agent's directory, the two steps `create-objectstack` runs when it scaffolds a project:
Skills ship as the npm package `@objectstack/skills`, released with the other `@objectstack/*` packages at one shared version. The CLI installs the catalog at the version your server runs into your agent's skills directory, with or without a project — no `package.json` is read or written:

```bash
os skills install # this CLI's version: the catalog written for it
os skills install --target https://acme.example.com # the version a target environment runs
os skills install --version 18.5.0 # the version an MCP server's instructions name
```

The skills land as real files in `.claude/skills/` under the current directory (`--dir` names another agent's directory), beside a record of what was installed, `.objectstack-skills.json`. The catalog is read from the npm registry your environment configures; a version it does not publish is refused, naming it.

**With no project.** If you only connected an MCP client, the server's `initialize` instructions name its version and the command, `os skills install --version <version>`. Run it in the directory your agent works in; without the CLI installed, `npx -p @objectstack/cli@<version> os skills install --version <version>` does the same.

**After an upgrade.** The catalog is versioned and updated as **one unit**, with ObjectStack itself. `os skills status` reports the installed version against the expected one (the same `--version` / `--target` / CLI order), plus catalog skills that are missing or modified and skill directories of your own (`--check` exits `1` on a mismatch, for CI). `os skills update` moves the catalog to the expected version: it replaces the catalog's skills, removes those the new version dropped, and never touches a skill it did not install. Commit `.claude/skills/` with the project. See the [CLI reference](/docs/deployment/cli#skills) for every flag.

A project can also depend on the package and sync it from `node_modules` with the third-party skills CLI, the two steps `create-objectstack` runs when it scaffolds a project:

```bash
pnpm add -D "@objectstack/skills@$(node -p "require('@objectstack/spec/package.json').version")"
# npm: npm install --save-dev "@objectstack/skills@…" · yarn: yarn add -D "@objectstack/skills@…"
npx skills@1.7.2 experimental_sync --agent claude-code --copy -y
```

Add the package with the manager that installed the project: in a pnpm project, `npm install --save-dev` exits `1` with `npm error Cannot read properties of null (reading 'edgesOut')`.

The skills land as real files in `.claude/skills/`; commit them with the project, and keep `--copy` — without it they are links into `node_modules`, which a clone does not have. Name your own runtime after `--agent` (`codex`, `cursor`, …). The catalog is versioned and updated as **one unit**, with ObjectStack itself: bump `@objectstack/skills` with the other `@objectstack/*` packages, then re-run the sync. The package is published from `18.0.0-next.0` on (there is no 17.x release); for what the sync writes, the versions, the one scaffolder that is an exception and the `next` channel, see the [AI Skills Reference](/docs/ai/skills-reference#installing-skills).
Add the package with the manager that installed the project: in a pnpm project, `npm install --save-dev` exits `1` with `npm error Cannot read properties of null (reading 'edgesOut')`. Keep `--copy` — without it the skills are links into `node_modules`, which a clone does not have — and name your own runtime after `--agent` (`codex`, `cursor`, …). To move such a project to `os skills`, run `os skills install --force`: it replaces the synced directories of the same names with the catalog's and records them. The package is published from `18.0.0-next.0` on (there is no 17.x release); for what the sync writes, the versions, the one scaffolder that is an exception and the `next` channel, see the [AI Skills Reference](/docs/ai/skills-reference#installing-skills).

---

Expand Down
83 changes: 83 additions & 0 deletions content/docs/deployment/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3672,6 +3672,89 @@ the grant, use the environment's console: **Account → Connect an AI Assistant*
| `-s, --server <url>` | `OS_CLOUD_URL` | Control-plane URL. Default `https://cloud.objectos.ai`, or the URL recorded by `os cloud login` |
| `-t, --token <key>` | `OS_CLOUD_API_KEY` | Bearer token, used only to find the environment; `$OS_TOKEN` and `~/.objectstack/cloud.json` are the fallbacks |

### Skills

The published skills catalog (`@objectstack/skills`, see [AI Skills](/docs/ai/skills))
installed into, updated in and checked against your coding agent's skills
directory. All three work in an empty directory as well as in a project: no
`package.json` is read or written.

| Command | Description |
|---------|-------------|
| `os skills install` | Copy the catalog at one version into the skills directory, and record what was written |
| `os skills update` | Move the recorded catalog to another version; skills it did not install are never touched |
| `os skills status` | Report the installed catalog against the expected version: missing, modified and extra skills |

**Which version.** `--version <v>` (an exact version), else `--target <t>` —
the version the target environment runs, read from its restriction profile
exactly as [`os validate --target`](#os-validate) reads it (an environment's
`http(s)` URL, or a profile JSON file) — else this CLI's own version, which is
the catalog's: the two are released together. The output names which one was
used. A range or a tag is refused, and so is a version the registry does not
publish, naming it.

**Where from.** The `@objectstack/skills` tarball at exactly that version, read
with `npm pack` from the npm registry your environment configures (your
`.npmrc` files and `npm_config_*` variables apply). Only its
`dist/skills/<name>/` directories are copied.

**What is recorded.** `install` writes `.objectstack-skills.json` beside the
skills: the version and every file of every catalog skill with its hash. That
record is how `update` and `status` tell the catalog's skills from your own.

#### `os skills install`

```bash
os skills install # this CLI's version, into .claude/skills/
os skills install --version 18.5.0 # the version an MCP server names
os skills install --target https://acme.example.com # the version a target environment runs
os skills install --dir .agents/skills # another agent's skills directory
```

A directory that already holds a recorded catalog is refused, naming
`os skills update`. A skill directory the record does not name but which shares
a catalog skill's name (for example one an earlier `skills experimental_sync`
copied) is refused, naming it; `--force` replaces it with the catalog's.

#### `os skills update`

```bash
os skills update # this CLI's version
os skills update --target https://acme.example.com # the version a target environment runs
os skills update --version 18.6.0
```

Replaces each recorded skill at the new version and removes each one the new
version no longer ships. A skill directory the record does not name is never
written, replaced or removed: a new catalog skill whose name one of yours
already uses is refused, naming it. A recorded skill you changed is refused,
naming the files; `--force` discards the change. With no recorded catalog the
command refuses, naming `os skills install`.

#### `os skills status`

```bash
os skills status
os skills status --target https://acme.example.com --check # exit 1 when the catalog is not the target's
os skills status --json
```

Reports the installed and the expected version (resolved in the order above),
`missing` (recorded skills whose directory is gone), `modified` (recorded skills
with a file changed, removed or added) and `extra` (skill directories the record
does not name — yours, listed and never judged). The registry is not read. A
mismatch is no recorded catalog, another version, or any missing or modified
skill: the command exits `0` regardless, and `1` on a mismatch with `--check`.

| Flag | Commands | Purpose |
|---|---|---|
| `--version <v>` | all three | Exact catalog version (not with `--target`) |
| `--target <t>` | all three | Target environment URL or restriction profile file whose skills version to use |
| `--dir <path>` | all three | The skills directory (default `.claude/skills/` under the current directory) |
| `--json` | all three | One JSON document on stdout |
| `--force` | `install`, `update` | `install`: replace same-named directories it did not install. `update`: discard local changes to catalog skills |
| `--check` | `status` | Exit `1` on a mismatch |

### Packages

The two commands that move a compiled app onto a platform. They target
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"secret": {
"description": "Maintain stored secrets: report orphaned rows, re-wrap old ciphertext"
},
"skills": {
"description": "Install, update and check the published ObjectStack skills catalog in your agent's skills directory"
},
"storage": {
"description": "Inspect stored files: report orphaned attachments"
}
Expand Down
67 changes: 67 additions & 0 deletions packages/cli/src/commands/skills/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

/**
* `os skills install` — copy the published skills catalog
* (`@objectstack/skills`) at one version into an agent's skills directory, in
* a project or in an empty directory: no `package.json` is read or written.
*
* The version is `--version`, else the target environment's (`--target`, read
* as `os validate --target` reads it), else this CLI's own; the output names
* which. The catalog is the package tarball at exactly that version from the
* npm registry this environment configures (`utils/skills-catalog.ts`). What
* was written is recorded beside it (`utils/skills-install-state.ts`), so
* `os skills update` and `os skills status` can tell the catalog's skills from
* the user's own. A directory that already holds a recorded catalog is
* refused, naming `os skills update`; same-named skill directories the record
* does not name are refused unless `--force` replaces them.
*/

import { Command, Flags } from '@oclif/core';
import { isExitSignal, printError, printHeader, printSuccess } from '../../utils/format.js';
import { runSkillsWrite, skillsCommonFlags, skillsWriteLines } from '../../utils/skills-command.js';

export default class SkillsInstall extends Command {
static override description =
'Install the published ObjectStack skills catalog at the server\'s version into your agent\'s skills directory, with or without a project';

static override examples = [
'$ os skills install # this CLI\'s version, into .claude/skills/',
'$ os skills install --version 18.5.0 # the version an MCP server names',
'$ os skills install --target https://acme.example.com # the version a target environment runs',
'$ os skills install --dir .agents/skills # another agent\'s skills directory',
];

static override flags = {
...skillsCommonFlags,
force: Flags.boolean({
description: 'Replace skill directories this command did not install that share a catalog skill\'s name',
default: false,
}),
};

async run(): Promise<void> {
const { flags } = await this.parse(SkillsInstall);
if (!flags.json) printHeader('Skills install');
try {
const result = await runSkillsWrite({
command: 'install',
version: flags.version,
target: flags.target,
dir: flags.dir,
force: flags.force,
cliVersion: this.config.version,
});
if (flags.json) {
console.log(JSON.stringify(result, null, 2));
return;
}
for (const line of skillsWriteLines(result)) console.log(` ${line}`);
printSuccess(`Installed ${result.added.length + result.adopted.length} skills of @objectstack/skills ${result.version}.`);
} catch (error) {
if (isExitSignal(error)) throw error;
if (flags.json) console.log(JSON.stringify({ ok: false, command: 'install', error: (error as Error).message }, null, 2));
else printError((error as Error).message);
this.exit(1);
}
}
}
Loading
Loading