---
title: Skill packages
lastModified: '2026-12-06T04:27:52.000Z'
description: 'A skill is a folder: a SKILL.md whose YAML frontmatter names and describes it, and text files beside it.'
---

A skill is a folder: a `SKILL.md` whose YAML frontmatter names and describes it, and text files beside it. This page describes the package rules Loom holds such a folder to, the content hash that names a package, the report of the operations a package names, the catalog of built-in skills that `skill.list` and `skill.get` answer, and how a namespace stores skills of its own as numbered revisions. After it you can read every refusal `skill.check` answers, say why the rule has its number, say which files a catalog answer is read from, and say what a `skill.save` reads and writes.

The rules have one implementation. `skill.check` runs them and stores nothing. `skill.save` runs them on the same input and stores a folder that passes ([skills a namespace holds](#skills-a-namespace-holds)). The [operations reference](/docs/reference/operations/skill) lists its fields and the [status page](/docs/reference/status) its maturity.

## What a check answers

The caller sends the folder as `files: [{path, text}]`. The answer is always a report with HTTP 200: a package that breaks a rule answers `ok=false` with its `refusals`, never an error, so a client reads one shape. An empty `files` answers `ok=false` with `no_skill_md`.

- **A package is refused whole and never repaired.** Loom does not drop the file that broke a rule, strip a character or rewrite a key: the text a person approved is the text that is checked.
- **Every refusal of the folder is answered in one call.** A rule that one file breaks on several lines is answered once, at the first line; the finding `literal_namespace` names up to five lines. Text past a size limit is the exception: no content rule reads it (below).
- **A refusal is `{code, path, line, message}`.** The message names the file, the line and the rule. It quotes no value of the package, so a secret in a file does not travel into a log through its own refusal. The one exception is a frontmatter key, which the message names when the key is printable. A file whose path is `path_invalid` is named in every message by its place in the request ("file 2 of the request"), and its path is answered only in `path`.
- **`ok` means the package rules pass.** It does not mean the text is safe to follow. The rules remove forms that hide text from a reviewer or run on load; whether the instructions are ones to trust is a person's decision.
- **`findings` have the same shape and refuse nothing.** They point a reviewer at places worth reading.

The request's own bounds (`files` at most 256 entries, `path` at most 512 characters, `text` at most 400,000) only keep it parseable. A package past a package limit is answered with a code, not rejected.

**No content rule reads text past a size limit.** A request can hold many times a package, and the content rules cost time in proportion to the text, so a check reads at most one package:

- The content rules do not run on a file over the file limit. The other files are checked.
- For a package over its byte limit or its file limit, the content rules run on no file, `operations` is empty and `content_sha256` is empty.

The path and size rules read no text and the frontmatter has its own limit, so those rules answer either way. A package answered `file_too_large`, `skill_too_large` or `too_many_files` can therefore break content rules the report does not name: check it again once it is within the limits.

## The rules

Each rule is one of two kinds. A rule of the open skill format is one any reader of the format applies. A rule of Loom's own is stricter than the format: it refuses what a skills library must not carry.

### Files and paths

| Code              | Refused                                                                                             | Whose rule | Why                                                                                                |
| ----------------- | --------------------------------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------------- |
| `no_skill_md`     | No `SKILL.md` at the root                                                                           | Format     | The file is the package.                                                                           |
| `nested_skill`    | A `SKILL.md` below the root                                                                         | Loom       | One package is one skill; a nested one would be loaded by a host as a second skill nobody checked. |
| `path_invalid`    | An empty path, an absolute path, a `..` segment, a backslash, an empty segment, a control character | Loom       | A path names a file inside the folder on every platform, or it is not a path of the package.       |
| `path_duplicate`  | Two paths equal after NFC normalization and case folding                                            | Loom       | A file system that folds case, or that normalizes names, would keep one of the two.                |
| `path_hidden`     | A segment that starts with `.`                                                                      | Loom       | Dot files are a tool's state or a host's configuration, not skill text.                            |
| `path_host_dir`   | A file under a top-level `agents/` or `hooks/`                                                      | Loom       | Hosts read those folders as their own configuration.                                               |
| `file_type`       | An extension outside `.md .txt .json .yaml .yml .toml .csv .tsv`, except a file named `LICENSE`     | Loom       | A package is text a reviewer reads. It carries no script and no binary.                            |
| `file_too_large`  | A file over 100,000 bytes                                                                           | Loom       | A larger file does not load in a client that reads skills served over MCP.                         |
| `skill_too_large` | A package over 400,000 bytes                                                                        | Loom       | The same client's bound for one skill.                                                             |
| `too_many_files`  | Over 64 files                                                                                       | Loom       | A package stays small enough for one person to review whole.                                       |

The two byte limits are the ones the skills Loom serves over MCP are built under; `scripts/codegen/served_skills.py` imports them from the rules module, so the numbers have one source.

### Content

The text of every file within the size limits is checked.

| Code              | Refused                                                                                                                                                                            | Whose rule | Why                                                                                             |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------- |
| `content_control` | Half of a surrogate pair, or a character of category Cc other than tab, line feed and a carriage return directly before a line feed                                                | Loom       | A terminal acts on control characters, and a renderer drops them.                               |
| `hidden_text`     | U+E0000 to U+E007F (tag characters); U+202A to U+202E and U+2066 to U+2069 (explicit bidirectional controls); U+E0100 to U+E01EF where it does not directly follow a CJK ideograph | Loom       | These carry or reorder text that a reviewer does not see and a model reads.                     |
| `shell_form`      | `!` before a backtick at a line start or after whitespace; a fence opened with three backticks and `!`                                                                             | Loom       | Some hosts run these as shell commands while they load the text, before the agent reads a word. |
| `secret`          | A file that reads as a credential or another secret                                                                                                                                | Loom       | A library entry is copied to every reader.                                                      |

`content_control` and `hidden_text` are also applied to every string the frontmatter yields, because a quoted YAML value can spell a character with an escape that the file's own text does not hold. For a `description` written `"\e[2J"`, the file holds five printable characters and the value a host loads holds a terminal's escape character.

The three implicit directional marks (U+200E, U+200F, U+061C) are not refused: right-to-left prose needs them, and they reorder nothing on their own. A variation selector directly after a CJK ideograph selects a glyph and is not refused either. Both are reported as findings.

`secret` is the detector the memory write path uses (`server.memory.domain.sensitivity.detect_sensitivity`). `line` is the first line that reads as a secret alone, and 0 when only several lines together do. The detector judges the shape of the text, not what it means. After one of its key words (`password`, `secret`, `api_key`, `access_token` and the like) and a `:` or `=`, the detector reads a value up to the first whitespace, quote, comma or semicolon, past one opening quote, and a value of eight or more characters is refused, whatever it spells: `api_key=YOUR_API_KEY` and the placeholder `api_key=<your-api-key>` both are, and so is `api_key=<your-api-key here>`, where thirteen characters precede the space. A key word joined to a prefix by `_` is not read as one (`LOOM_API_KEY=<your-token>`), five characters precede the space in `api_key=<your token>`, and a variable is no assignment (`$LOOM_API_KEY`): none of the three is refused.

### Frontmatter

`SKILL.md` opens with a `---` line, YAML, and a closing `---` line. The frontmatter is the one part of a package a parser reads, so the rules are ordered to bound what the parser is given.

| Code                     | Refused                                                                                                                                                                                             | Whose rule                                       |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `frontmatter_missing`    | `SKILL.md` does not open with `---`, or nothing closes it                                                                                                                                           | Format                                           |
| `frontmatter_too_large`  | A frontmatter over 8,192 bytes, checked before any parse                                                                                                                                            | Loom                                             |
| `frontmatter_shape`      | An anchor, an alias, a merge key, an explicit tag, a second document, or nesting deeper than 8 levels; a root that is not a mapping; a key that is not a string; a key written twice in one mapping | Loom                                             |
| `frontmatter_unloadable` | Anything the load raises                                                                                                                                                                            | Format                                           |
| `frontmatter_key`        | `allowed-tools`, `hooks`, `shell`, `model`, `effort`, `context`, `agent`, or any key outside the allowed list                                                                                       | Loom                                             |
| `frontmatter_value`      | A value of the wrong kind or size (below)                                                                                                                                                           | Format, and Loom for the keys outside the format |
| `name_invalid`           | A `name` that is not 1 to 64 of `a-z`, `0-9` and `-`, or that starts or ends with a hyphen, or holds `--`                                                                                           | Format                                           |

Why the parse rules are what they are:

- **8,192 bytes** is twice what a description of the largest allowed size can take in UTF-8, and bounds the time a load can cost. It is checked on the raw text, so a document the parser would choke on is never parsed.
- **Anchors, aliases and merge keys** are refused on the parser's events, before a node or a value is built. A few hundred bytes of aliases that each repeat the level before expand to millions of values; refusing them removes the expansion instead of bounding it. **Explicit tags** ask the loader to build something other than text.
- **Nesting deeper than 8 levels** is refused on the events too. No allowed key nests deeper than two, so such a frontmatter is refused whatever its content, and the parser's cost grows with the square of the depth.
- **Keys are checked on the composed nodes, never on the built mapping.** `1:` beside `true:` builds one key that is neither a string nor what the author wrote, and a key written twice builds a mapping with the last value and no error.
- **Every exception from the load is a refusal.** A date that names no day and an integer of thousands of digits each raise a plain `ValueError`. A colon inside a value that is not quoted is the usual cause: its refusal carries the file line and says to quote the value.

Allowed keys and their values:

| Key                                          | Value                                                   | Part of the open format |
| -------------------------------------------- | ------------------------------------------------------- | ----------------------- |
| `name`                                       | Required. A string that passes `name_invalid`           | Yes                     |
| `description`                                | Required. A string, not empty, at most 1,024 characters | Yes                     |
| `license`                                    | A string                                                | Yes                     |
| `compatibility`                              | A string of at most 500 characters                      | Yes                     |
| `metadata`                                   | A map of string to a string, a number or a boolean      | Yes                     |
| `when_to_use`, `argument-hint`               | A string                                                | No                      |
| `arguments`, `paths`                         | A string or a list of strings                           | No                      |
| `disable-model-invocation`, `user-invocable` | Written `true` or `false`                               | No                      |

A value is judged as YAML types it: `license: 2` holds a number, and the refusal says to quote it. A `metadata` value is a string, a number or a boolean, accepted as written with no finding. The open format says string to string; the hosts that load a skill read `metadata: {internal: true}` as a boolean and `version: 1.10` as a number, so a rule that took strings only would refuse packages they accept. A null, a list, a map and a date written without quotes are refused under `metadata`. The two flag keys are judged as written, because YAML also reads `yes`, `on` and `True` as a boolean and another reader of the same file does not.

The keys refused by name configure the host that runs the skill: its tools, hooks, shell and model. A package in a shared library carries none of a host's permissions. `allowed-tools` is a key of the open format; refusing it is Loom's rule.

### Findings

| Code                     | Reported                                                                                                                                 |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `html_comment`           | An HTML comment, which a rendered page does not show                                                                                     |
| `encoded_run`            | 200 or more base64 characters in a row                                                                                                   |
| `external_link`          | A link to an `http` or `https` address                                                                                                   |
| `path_reference`         | `@` before a path, which some hosts read as a file to attach                                                                             |
| `format_character`       | Any other character of category Cf, the implicit directional marks among them, and the variation selectors `hidden_text` does not refuse |
| `bom_before_frontmatter` | A byte-order mark before the first `---`: a host that reads `---` only as the file's first bytes loads no name and no description        |
| `key_not_in_format`      | An allowed key outside the open format's own: accepted here, refused by a strict reader of the format                                    |
| `literal_namespace`      | The checked namespace's own name written out as a whole word ([the namespace token](#the-namespace-token))                               |

## The content hash

`content_sha256` names a package by its files:

1. For each file, the SHA-256 of its text as UTF-8 bytes, in hex.
2. One manifest line per file: the digest, two spaces, the path, a line feed.
3. The lines sorted by the path's UTF-8 bytes.
4. The SHA-256 of the manifest, in hex.

The sort is by bytes, not by UTF-16 code units or a locale's collation, so a client in another language computes the same hash: the two orders differ for a path with a character above U+FFFF. The hash does not depend on the order the files were sent in. It is empty when a path rule refused (`path_invalid`, `path_duplicate`, `path_hidden`, `path_host_dir`), because the paths are then not one set of files, and when the package is over its byte or file limit, because its text is not read. `tests/fixtures/skill_manifest.json` holds a package, its manifest and its hash, and the server's rule, the Python SDK's folder reader and the hash `loom skill pull` checks an answer with are tested against it.

## The operations report

A skill's text tells an agent which operations to call. `operations` lists the names the package's Markdown files give in code spans (each line of a fenced block, and each inline span), each at its first mention:

- a dotted name whose first segment is an op group of the serving build (`kind: "op"`);
- a name of the form `loom_` followed by lowercase letters and underscores (`kind: "tool"`).

| Field           | Meaning                                                                                                                                                                                                                                                          |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `known`         | The serving build holds the op. For a tool: it is `loom_op`, `loom_activate`, or the tool name of an op whose `mcp` is not `none`                                                                                                                                |
| `required_role` | The op's minimum role                                                                                                                                                                                                                                            |
| `mcp`           | `tool` when a toolset in `toolsets` lists it, `loom_op` when no toolset does and it is called by name through the `loom_op` tool, `none` when MCP does not serve it. The tools `loom_op` and `loom_activate`, which no op owns, are `tool` with `toolsets` empty |
| `toolsets`      | The toolsets whose listing carries it, as [`ops.capabilities`](/docs/reference/operations/ops#opscapabilities) answers them                                                                                                                                      |
| `path`, `line`  | The first mention: `SKILL.md` first, then the other files by path                                                                                                                                                                                                |

An unknown name has `known=false` and the other fields empty. `mcp` is a fact of the build, not of a session: which tools a connection lists also depends on its toolset. `memory.search` and `knowledge.search` are `tool` with `toolsets: ["assistant"]`: only that toolset lists them, and the other listings carry `loom_search` in their place.

`operations` is empty for a package over its byte or file limit.

The report never refuses and never changes `ok`. It is a match on names, not a reading of the text, and it has known false matches:

- **An example value.** A code span that shows a made-up key or setting shaped like a tool name is reported as an unknown tool.
- **A name written with a wildcard.** `tracker.source.*` is taken as `tracker.source`, which no build holds.
- **A section that names removed things on purpose.** A migration note that lists retired ops reports each as unknown.
- **A file name.** A code span such as `memory.md` is a dotted name whose first segment is an op group.

A tool name qualified by a host (a server prefix before `loom_`) is not matched, and argument names are not checked.

## The command

`loom skill check <dir>` is a command of the Python SDK. `loom.skills.read_folder` reads the folder: regular files only, each opened without following a link. A path with a segment that starts with `.`, and a `__MACOSX` folder, is left out and listed. A link, a file that is not a regular file, a path that resolves outside the folder and a file that is not UTF-8 stop the command and name the path; nothing is sent in the file's place. The reader parses no YAML: the server holds the rules.

The command prints what was left out, every refusal, the findings, the operations report and the hash. After a message that names a file by its place in the request, it prints the file's path. It adds one finding of its own, `folder_name_differs`, when the folder's name is not the frontmatter `name`: the open format requires them equal, and the server never sees the folder's name. An unknown operation is worded "not held by build" with the serving build's commit. `--json` prints the op's answer with the local findings added. A character that is not printable, in a file's name or in a message, is printed as its escape (`\x1b`), so a name cannot send a control sequence to the terminal.

| Exit | Meaning                                                                                 |
| ---- | --------------------------------------------------------------------------------------- |
| 0    | The package rules pass                                                                  |
| 1    | A refusal, or the request failed                                                        |
| 2    | The folder cannot be read (nothing is sent), or the server does not serve `skill.check` |

A job that runs the command needs a token scoped to a namespace at `viewer` or above.

## The catalog of built-in skills

`skill.list` and `skill.get` catalog the skills the server image holds, beside the skills a namespace holds. [Skills](/docs/features/skills) describes them from the caller's side. A built-in row is read from the image's files and never from a table.

- **Three skills, two readers.** The agent guide is the two files of `skills/loom`, read through `AGENT_GUIDE_DIR`. The other two are the skills the MCP transport serves: `server.core.served_skills.shipped` reads their manifest and files, for the transport and for the catalog, so both answer the same entries. Each read happens once per process, and no request changes the files.
- **A file's size and digest.** For a served skill they are the manifest's `size` and `digest`. For the guide they are computed from the file's bytes.
- **The frontmatter has one loader.** `frontmatter` is the mapping the package rules' loader builds for `SKILL.md`, so a check and a read never load one text two ways.
- **One missing body.** A read that finds nothing answers `found=false` with every other field empty and echoes no argument. An unknown name answers it, and so does a team skill the caller may not read.
- **The notice follows the setting.** A built-in's `notice` names the route this server serves it through, read from `mcp_skills_enabled` on every call. It never says what a client loaded.
- **Fail closed.** A manifest or a file that cannot be read fails the op. The catalog is never answered short or empty in its place.
- **Tenant isolation.** Built-in text is the same for every tenant and holds no tenant data. Both ops still need `viewer` on the namespace the call names, and a token bounded below its namespace is refused at admission.
- **Rolling upgrade.** A build without the ops answers an unknown operation. `loom skill list` and `loom skill show` ask `ops.capabilities` first and exit 2.

`query` is a substring match in any case on the name and the description, applied after the rows are assembled, so `total` is exact. The cursor is the key of the last row a page answered (`server/identity/domain/skill_catalog.py`).

## Skills a namespace holds

A memory namespace holds skills of its own beside the built-in ones. `skill.save` stores a folder that passes the package rules as the next numbered revision of the skill its frontmatter names. A saved revision is a draft: no session is served it, and only the writers of its namespace read it. `skill.decide` publishes the latest revision, and every reader of the namespace is served the published one. [Skills](/docs/features/skills#save-a-draft) describes this from the caller's side.

### Storage

`loom.skills` holds one row per act on a skill (`schemas/migrations/128_skills.sql`). It is a MergeTree sorted by `(org, namespace, name, seq)`: a row is never replaced, so no read needs `FINAL`, and the rows of one skill are one range of the key.

| Column                           | Holds                                                                                |
| -------------------------------- | ------------------------------------------------------------------------------------ |
| `seq`                            | The act's place among the acts of its name, from 1                                   |
| `act`                            | `save`, `publish`, `reject`, `archive` or `delete`                                   |
| `revision`, `content_sha256`     | The revision the act names, and the [content hash](#the-content-hash) of its files   |
| `description`, `listed`          | The frontmatter `description`; `listed` is 0 when `disable-model-invocation` is true |
| `content`, `files`               | The text of `SKILL.md`, and the other files by path                                  |
| `op_names`                       | The names of the [operations report](#the-operations-report), in its order           |
| `contributors`                   | The subjects behind the revision's unpublished text, the saver last                  |
| `note`, `origin`                 | The saver's note, and the `source` the save declared, as JSON                        |
| `agent`, `user_id`, `session_id` | `-`: a skill belongs to its namespace                                                |
| `actor`, `source_class`          | Set by the server: from the token, and from the downgrade the request declared       |
| `build_commit`, `at`             | The build that wrote the row, and when                                               |

`skill.save` writes `save` rows. `skill.delete` writes a `delete` row and, when it takes the served revision away or deletes the whole of an archived skill, an `archive` row above it. `skill.decide` writes `publish`, `reject` and `archive` rows. The fold reads all five.

Every statement on the table is in `server/identity/store/skills.py`. None filters, counts or orders by a rule of the fold: the removal of a delete takes the acts it removes from its caller, and the session listing's read takes the acts it returns every row of and the acts it leaves out. Only the read of one revision's text selects `content` or `files`: a listing, a save and a delete read the acts without their text.

### The fold

The rows record acts, never a state. `server.identity.domain.skill_state.fold` is the one reader of an act, and every answer about a skill is one of its results:

- **The served revision.** Among the rows that are not a `save`, a `reject` or a `delete`, the highest `seq` decides. It serves only when every row of that `seq` is a `publish` of one revision and one hash, and that revision is not void.
- **Each revision's state.** `draft` (no decision names it), `published` (it is served), `rejected`, `superseded` (it was published and another revision is served) or `withdrawn` (it was published and nothing is served). A decision names a revision by number and hash, so text never reads as decided under a hash it does not have.
- **The skill's state.** `published` when a revision is served, `archived` when a row that decides serves nothing, and `unpublished` otherwise.
- **The open draft.** The latest revision, when its state is `draft`.
- **The next numbers.** One above the highest `revision` and the highest `seq` of any row, the rows of void revisions included, so a number is never given twice.

The fold fails closed: an `archive`, an act the build does not know, and rows that share the deciding `seq` and disagree all serve nothing. It is pure, and it reads the rows in one order whatever order they came in, so two replicas that read the same rows answer the same state.

### A save

`skill.save` takes the folder as `files`, the `expected_revision` its author built on (0 for a skill the namespace does not hold), and an optional `note`, `source` and `source_class`. Like a check it answers HTTP 200 with a report, and `written` says whether a row was stored. The steps, in order:

1. **Refusals that read no skill row.** A `note` over 500 characters or a `source` value over 512, and either one that holds hidden text or reads as a secret, is a validation error that names the field and never quotes it. The handler checks the two bounds, because a wire model's error echoes the value. A collection, and a namespace of any kind but memory, holds no skill: a validation error. A token bound to one end user is refused at admission, and again by the handler.
2. **The fleet gate.** Until every live replica has applied the table's migration, the op answers 503 `OVERLOADED` with `retry_after_s: 30` (`machines.fleet_at`): a build without the table has no erasure step for it.
3. **The package rules.** A folder that breaks one answers `written=false` with its `refusals`, as `skill.check` answers them, and no row is read.
4. **The claim.** The handler takes the lease named `skills:` followed by the JSON of `[org, namespace]` for 60 seconds, waiting up to 5, and holds it over the reads and the insert: a namespace has one save at a time, on every replica. A save that cannot take it answers 503 `OVERLOADED`. The claim is kept until an insert the server has not answered can no longer land, and the reads under it are sequentially consistent ([what that covers](/docs/architecture/clickhouse#read-your-writes)), so each holder reads every row the one before it wrote.
5. **The same files.** When the latest revision has the folder's `content_sha256`, the answer is `written=false` and `conflict=false` with that revision. A retry of a save that landed therefore writes nothing, whatever `expected_revision` it carries.
6. **Compare-and-set.** `expected_revision` must be the latest revision. When it is not, the answer is `conflict=true` with `current: {revision, content_sha256}`.
7. **The bounds** of the table below, answered as `refusals` with `written=false`.
8. **One `save` row**, inserted synchronously, with the fold's next `revision` and `seq`. The answer is `written=true` and `revision_state: "draft"`.

| Refusal              | The namespace or the skill already holds                                        |
| -------------------- | ------------------------------------------------------------------------------- |
| `skills_max`         | 200 skills, and the save names another                                          |
| `revisions_max`      | 500 revisions under the name, a deleted one not counted                         |
| `person_draft_open`  | An open draft a person saved, while a service account's token saves             |
| `service_drafts_max` | 20 open drafts saved by service accounts, while a service account's token saves |

A service account is a token with the service-account claim, and a row it saved has an `actor` that starts with `process:`. The two service-account rules keep an automated writer from displacing a person's draft nobody reviewed, and from filling the list of drafts.

`contributors` names the subjects a reviewer of the revision may not be: the saver (the token's subject, and the principal that made the token), after the contributors of the revision it replaces when that revision is a draft or was rejected. A published revision was reviewed, so a draft saved over it carries its own saver alone.

**Cost.** A save and a listing read every act of the namespaces they cover, without text: at most 200 skills of 500 saves each in a namespace, their decisions, and the rows of deleted revisions a removal has not taken yet. The text of one revision is read as one row by its key.

**The audit row** holds `name`, `revision`, `content_sha256`, `bytes`, `file_count`, `written` and `conflict`. The audit log outlives an erasure, so no file text and no note reaches it.

### A delete

`skill.delete` takes a `namespace`, a `name` and a `revision`, where 0 names the whole skill. It needs `admin` on the namespace, MCP does not offer it, and it has a rate class of its own. [Skills](/docs/features/skills#delete-a-revision-or-a-skill) describes it from the caller's side. The steps, in order, under the claim a save takes:

1. **The fold.** The handler reads the skill's acts without their text. A name the namespace does not hold, a revision it never held and a revision that is already void change nothing: no row and no audit row is written, and the call goes to step 4.
2. **The record.** One audit row, `skill.delete`, is written strictly and before any other write. When it cannot be written the op answers 503 `BACKEND_UNAVAILABLE` and nothing is deleted. The op is declared without the transport's audit row, which is written after the handler and is fail-open.
3. **The rows.** One insert holds a `delete` row and, when the call takes the served revision away, an `archive` row above it that names that revision. A delete of one revision names its number and hash. A delete of the whole skill names the highest number a row of the skill holds and no hash, which voids every revision up to that number. When the skill is archived and serves nothing, a delete of the whole skill also writes an `archive` row, with the `delete` row's number and no hash: the removal takes the rows that archived the skill, and this row keeps the name archived.
4. **The removal.** One `ALTER TABLE loom.skills DELETE` removes the rows the `delete` row made void: the `save`, `publish` and `reject` rows of the revision below the `delete` row, or every row of the skill below it. It is issued with `mutations_sync = 0` and is not waited on. It is issued only when the read of step 1 holds a row to remove and `system.mutations` holds no unfinished mutation of the same command, so a repeat of the call never queues a second one. A call that names the whole skill and writes no row runs the same step for each revision a `delete` row above the last delete of the whole skill names: the rows of a revision deleted by number are text of the skill.

The answer holds `deleted_revisions`, `archived` and `text_removed`. `text_removed` is true when the read of step 1 held no row that step 4 removes. A repeat of the call is the check: it writes no row, and it issues the removal again when rows are left and the earlier mutation is no longer unfinished.

**When the text is gone.** No read answers a deleted revision from the insert of step 3: the fold reads it as void, and the `archive` row keeps an older published revision from being served in its place. The rows leave the table when the mutation finishes. The parts it replaced stay on disk until ClickHouse removes inactive parts, a few minutes by default. A delete does not reach a backup taken before it, a folder a client already pulled, or a session that already loaded the text.

**What a delete leaves.** The `delete` row, the `archive` row and the audit row. They hold the name, the number, the hash, the actor and the time, and no text. The fold's next numbers are above every row, so the number of a deleted revision is never given to another save. A save of a deleted name starts a draft above the `delete` row. A skill that was served or archived when it was deleted reads `archived` until a revision is published, before the removal finishes and after it.

**Cost.** A mutation rewrites each part that holds a row it removes, and a part holds the skills of every org, so the cost follows the table's size and not the skill's. Mutations queued while one runs are applied together in the next rewrite. Measured on one node with 200,000 revisions in one part of 260 MB (1,000 namespaces of 20 skills with 5 revisions each, and one namespace of 200 skills with 500 each), one delete rewrote the part in 11 seconds, and 50 deletes issued in a row finished in two rewrites and 22 seconds.

**The rate class** `skill.delete` allows a namespace a burst of 10 and one a minute after it, so a loop cannot queue a rewrite of the table per call.

**The audit row** holds `name`, `revision` and `deleted_revisions`, and `published_revision` and `published_content_sha256` when the delete took the served revision away.

### A decision

`skill.decide` takes a `namespace`, a `name` and a `decision`: `publish` or `reject` with a `revision`, or `archive`. It needs `admin` on the namespace, and MCP does not offer it: a session that read a draft must not publish it. [Skills](/docs/features/skills#review-a-draft) describes it from the caller's side. The steps, in order, under the claim a save takes:

1. **The fields.** `publish` takes `revision` and `approved_sha256`, and no `note`. `reject` takes `revision` and a `note`. `archive` takes an optional `note` and no `revision`. A field that is not the decision's is a validation error, and so is a `note` over 500 characters or one that holds hidden text or reads as a secret. No row is read.
2. **The fold.** The handler reads the skill's acts without their text, with sequential consistency. A name the namespace does not hold, and a revision that was never saved or is void, answer 404 with one body.
3. **The transition**, by the table below. A decision the skill is already in writes no row and no audit row and answers the current state, so a retry is safe. A decision the state refuses answers 409 `PRECONDITION_FAILED`.
4. **The publish rule**, below, for a publish.
5. **The record.** One audit row, `skill.decide`, is written strictly and before the row. When it cannot be written the op answers 503 `BACKEND_UNAVAILABLE` and nothing is decided. The op is declared without the transport's audit row, which is written after the handler and is fail-open.
6. **One row**, inserted synchronously with the fold's next `seq`: a `publish` or a `reject` row with the revision's number and hash, or an `archive` row with the served revision's. A `publish` row copies the revision's `description` and `listed`, so a listing reads the served revision from its deciding row.

| Decision  | The state it meets                                      | Result                                                                             |
| --------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `publish` | The latest revision, `draft`, `rejected` or `withdrawn` | A `publish` row: the revision is served, and the one served before is `superseded` |
| `publish` | The served revision                                     | No row                                                                             |
| `publish` | A revision that is not the latest                       | 409                                                                                |
| `reject`  | The open draft                                          | A `reject` row: what is served does not change                                     |
| `reject`  | A `rejected` revision                                   | No row                                                                             |
| `reject`  | Any other revision                                      | 409: `archive` stops a skill being served                                          |
| `archive` | A skill that serves a revision                          | An `archive` row: nothing is served, and that revision is `withdrawn`              |
| `archive` | An `archived` skill                                     | No row                                                                             |
| `archive` | An `unpublished` skill                                  | 409: nothing is served, and `skill.delete` removes a draft                         |

Only the latest revision is published. To serve an earlier text again, a writer saves it as a new revision and an administrator reviews it. A `withdrawn` revision is the latest one after an archive, or after the revision served after it was deleted, and a publish serves it again. A rejected revision stays the latest until the next save, and a later publish of it is allowed: the last decision on the latest revision wins.

**The publish rule.** A publish that writes a row passes four checks, in this order:

1. **A person who administers the namespace.** `server.identity.app.reviewers.reviewer_subjects` refuses with 403 a call with no sign-in, a service account's token, an actor that is not the token's own and a caller below `admin`. A deployment with sign-in off has no person, so it publishes nothing.
2. **Independence.** No entry of the revision's `contributors` is the caller's subject or one of its aliases, compared in any case. A match answers 403 and names the matching entries. A revision with no contributor, which only a deployment with sign-in off saves, is never independent. The aliases are read with sequential consistency, and a failed read refuses.
3. **The approved hash.** `approved_sha256` is the revision's `content_sha256`, so the caller approves the text it read. Another hash answers 409, and the answer never holds the stored hash: the caller reads the revision again.
4. **A known origin.** The revision's stored `origin` holds only the keys this build knows, which is `source`. Another key was stored by a newer build whose check this build does not have: 409, retry.

A repeat of a publish that landed writes nothing and skips the rule when `approved_sha256` is the served revision's hash. With another hash the rule applies and refuses the call.

**What the rule does not cover.** It compares accounts, not people: two accounts of one person that the org's directory does not tie as aliases are independent of each other. A draft that only service accounts saved, with no person behind their tokens, is published by one administrator. A save records the token's subject and the principal that made the token, so an administrator never publishes what a token they minted, or a token minted from that one, saved, also after the token is revoked. The contributors are those of the unpublished text: a draft saved over a published revision carries its own savers alone. The approved hash covers which files were read, not what they do: the reviewer reads the text. Rejecting and archiving need `admin` and no person, because neither serves text.

**The audit row** holds `name`, `revision`, `content_sha256`, `decision`, the revision's `author` and `contributors`, and the note as `note_sha256` and `note_chars`. The note's text stays on the row in `loom.skills`, which an erasure removes.

### Reading team skills

`skill.list` folds the acts of the namespaces `namespace_scope` covers and answers one row for each skill the caller may read: its `state`, `published_revision`, `latest_revision`, the served revision's `content_sha256`, `listed`, `open_draft` and `updated_at`. The `state`, `open_draft_only` and `query` filters apply after the fold, so `total` is exact. `state` defaults to `published`, which no draft is. Team rows come first, the addressed namespace before the others, and built-in rows last. `namespaces_skipped` names the caller's namespaces the fan-out's cap left unread. `namespaces_not_listed` names the namespaces read whose skills no pack lists to the caller ([the session listing](#the-session-listing)).

`skill.get` with a `revision` answers that revision. With 0 it answers the served revision, or for a writer the skill without text when none is served. `history=true` adds the acts on the skill, decisions with their notes included. The served revision is answered with `approved_by` and `published_at`, the actor and the time of its deciding `publish` row.

- **Two audiences.** A caller who holds `writer` on the skill's namespace reads every revision. A reader below it is served only what was published. `skill.get` answers the served revision, and by its number a superseded one as unserved text with a `notice` that names the served revision. Everything else is the one missing body, as for a name that does not exist: a skill that serves nothing, a draft, a rejected, a withdrawn or a void revision, a number never saved, and `history`. The reader's `skill.list` row is built from the deciding `publish` row alone: `latest_revision` equals `published_revision`, `open_draft` is null, `updated_at` is the publish time, and `query` matches the served description, so a string that only an unserved revision holds counts nothing. A caller with no role on the namespace gets nothing. A deployment with sign-in off has no roles and answers every row.
- **Text that is not served is never in `content`.** The text of a draft, a rejected, a superseded or a withdrawn revision is answered in `unserved_content` and `unserved_files`, with a `notice` that says whether it was reviewed, and `frontmatter` stays empty. A client that loads `content` as instructions cannot load a draft by naming the wrong revision.
- **One revision and one hash.** `skill.get` reads the acts and the text with sequential consistency ([what that covers](/docs/architecture/clickhouse#read-your-writes)), so an archive or a newer publish another replica wrote decides what this one serves. The text is read by the `seq`, the number and the hash of the `save` row the fold named, so a fetch during a publish answers one revision whole. A `publish` row whose hash is not its `save` row's serves nothing.
- **A fetch leaves a receipt.** A `skill.get` that answered the served text notes a [read receipt](/docs/architecture/read-receipts) of kind `skill`: the namespace, the name as the item, the revision and the content hash. A read of unserved text leaves none. Neither does an inspector's fetch: the dashboard's, the assistant's, and the `loom skill` commands', which name the consumer `loom-cli-inspect`. A token minted with a `consumer` claim keeps that name, so its fetches count.
- **The operations report is rebuilt.** `operations` is the stored `op_names` judged against the serving build, so `known` follows the build that answers and not the one that saved.

### The namespace token

A team's skill tells an agent where to write, and that place is the team's namespace. Written out, the name is wrong in every copy of the skill another namespace saves. The text names it with one reserved token instead, `{{loom.skill_namespace}}` (`NAMESPACE_TOKEN`), which always means the namespace that holds the skill. There is one token and no other parameter.

- **The server never replaces the token.** A save stores it as written, `content_sha256` covers it as written, and `skill.get` answers it as written. The served bytes are the bytes an administrator approved by hash. A server that filled the token in would serve text nobody reviewed, under a hash that no longer names it.
- **A read says what the token means for the caller.** `skill.get` of a namespace's skill answers `binding: {namespace, writable}`: the namespace that holds the skill, and whether the caller holds `writer` there. `writable` is the role the read already checked to choose the caller's audience, so it costs no statement. A built-in and the missing body answer an empty `binding`, whose `writable` says nothing.
- **The notice says it in words when the text holds the token.** When `SKILL.md` or a file of the answered revision holds the token, `notice` gains one sentence: the token names that namespace. For a caller who may not write there it adds that a step of the skill that writes there is refused, and that a copy saved in a namespace the caller may write to names that namespace. A revision without the token keeps the shorter notice. `notice` and `binding` are declared before `content`, so a reader meets them before the text.
- **A check reports the name written out.** `skill.check` and `skill.save` report the finding `literal_namespace` for each of the first five lines, `SKILL.md` first and then the files by path, that hold the checked namespace's own name as a whole word. A namespace name is letters, digits and hyphens, so the name inside a longer run of those, or beside an underscore, is another word. The token is no occurrence: a line is searched with the token blanked, because the token spells `loom` as a whole word and `loom` is a valid namespace name. A name under four characters is not searched for, because it is too often a word of the text. The message names the file, the line and the token, never the namespace. The finding refuses nothing.
- **Tenant isolation.** `writable` is the caller's own role on a namespace the caller already reads. Nothing about another principal is answered.
- **Rolling upgrade.** The token adds no table, column or stored value. A replica one release behind answers no `binding` and no sentence about the token, and reports no `literal_namespace`. A client reads a missing `binding` as the empty one and takes nothing from its `writable`.

### The session listing

A published skill reaches a session unasked as one line of the `skills` section of `context.pack`: `- <namespace>/<name>: <description>`. The description is its first 96 characters, with its line breaks joined by one space before the cut (`LISTING_DESCRIPTION_CHARS`, a constant, so the line a reviewer read is the line every build serves). The session loads the text with `skill.get`. One function, `listing_line` in `server/identity/domain/skill_format.py`, makes the line for the pack, for `skill.get` and for `skill.check`, which answer it as `listing_line`. An author and a reviewer read the bytes a session is given.

- **Which skills.** The served revisions whose `listed` is true, of the pack's namespace and then of the caller's other memory namespaces in the search fan-out's order, kept to the ones the caller took up ([what a session is given from other namespaces](/docs/features/namespaces-and-sharing#what-a-session-is-given-from-other-namespaces)). A grant alone lists nothing: an administrator of a namespace the caller never opened cannot put a line in the caller's sessions. `skill.list` names those namespaces in `namespaces_not_listed`, and `namespace.mark_seen` takes one up. When the taken-up read fails, the pack's namespace is listed alone and the answer's `degraded` names `skills_home_only`.
- **The order.** One skill of each namespace a round, the namespaces in the order above and each namespace's skills by name, until the section's budget is spent. A line is kept whole or left out. The section's last line counts the skills left out, `(N more: skill.list)`, and `section_meta.skills.left_out` holds the same number. A namespace with many skills cannot push another namespace's first skill out.
- **The budget.** 200 tokens in every mode, served on top of `token_budget` as `other_namespaces` is, so the home sections are the same bytes with and without the listing. The section is first in the pack and in its stable prefix: the prefix moves when a publish, an archive or a namespace taken up changes the listing.
- **When it is absent.** Nothing is published and listed, the token is narrowed to one user or session, the request left the section out with `only_sections`, or the listing's read failed. No text tells a session what an absent section means, because each of those looks the same to it.
- **A line is data.** The line is escaped as every recalled section is, and the description's line breaks are joined before the cut, so a description cannot close the section or start a line that passes for another skill. The line names the namespace, so a session knows whose administrator approved the text.
- **What the session is told.** The MCP primer carries one sentence wherever the connection reaches `skill.get`: load a listed skill whose description fits the task, `skill.list` names the others, and its `content` was approved by an administrator of the namespace its line names and does not override the user. A plugin's connection, whose hooks deliver the pack, carries one clause that names the two `loom_op` calls. A connection that lists the code tools alone carries neither.
- **No receipt.** A listing line is no fetch: the [read receipt](/docs/architecture/read-receipts) is `skill.get`'s.
- **Cost.** Every pack that renders the section pays the taken-up read it shares with `other_namespaces`, and one read of `loom.skills` by the key prefix `(org, namespace)` of at most 33 namespaces. The read returns the rows the fold chooses the served revision from, and no other: each skill's `delete` rows, which void a revision whatever their `seq`, and the rows at the highest `seq` among those that are not a `save`, a `reject` or a `delete`. The fold of them serves what the fold of every row serves, so a deleted revision has no line. It returns `name`, `seq`, `act`, `revision`, `content_sha256`, `description` and `listed`, and never selects `content` or `files`. A namespace holds at most 200 skills, so the answer holds about 200 rows a namespace and one for each `delete` row, however many revisions its skills have. The read holds no `save` row: unlike `skill.list`, the listing does not check that the served revision's `save` row is in the table. A decision written while the statement runs can leave its skill out of that one pack, and never lists an older revision in its place.
- **Tenant isolation.** The read scopes by `org` and by the namespaces the fan-out resolved for the caller's token, so it holds no namespace the caller may not read. `tests/integration/test_cross_principal_leakage.py` holds the case of a namespace granted and never opened.
- **Rolling upgrade.** [Rolling upgrades](/docs/architecture/rolling-upgrades), rule 98.

### Erasure and retention

`loom.skills` holds memory content. A namespace erasure deletes the namespace's rows in the step `skills.delete`, and its census counts what is left (`server/erasure/store/census.py`). A user erasure has no step for the table: every row's `user_id` is `-`, and a skill names no end user. The table has no TTL, so a revision is kept until an administrator deletes it or its namespace is erased.

### Invariants of a decision

- **Identity tuple.** `agent`, `user_id` and `session_id` are `-` on the `publish`, `reject` and `archive` rows. `actor` comes from the token and `source_class` is `asserted`.
- **Tenant isolation.** The transport admits a decision at `admin` on the addressed namespace, and every statement scopes by `org` and `namespace`. A caller below `admin` gets one refusal, for a name the namespace holds and for one it does not. A reader learns no draft, count, number or time of an unpublished revision from any field of `skill.get` or `skill.list`.
- **Belief revision.** A publish is Expand for the first revision a namespace serves under a name and Revise for a later one. A reject is Refuse of a candidate. An archive is Contract.
- **Fail closed.** A decision whose audit row cannot be written decides nothing. A failed read of the caller's aliases or grants refuses a publish. Rows that share the deciding `seq` and disagree serve nothing.
- **Rolling upgrade.** [Rolling upgrades](/docs/architecture/rolling-upgrades), rule 93.

### Invariants of a delete

- **Loom deletes only what its writer asked to delete.** The removal names the org, the namespace and the name, and removes only rows below the `delete` row that the row makes void.
- **Identity tuple.** `agent`, `user_id` and `session_id` are `-` on the `delete` and `archive` rows. `actor` comes from the token and `source_class` is `asserted`.
- **Tenant isolation.** The transport admits a delete at `admin` on the addressed namespace, and every statement scopes by `org` and `namespace`. A caller below `admin` gets one refusal, for a name the namespace holds and for one it does not.
- **Belief revision.** Contract.
- **Fail closed.** A delete whose audit row cannot be written deletes nothing.
- **Rolling upgrade.** The op adds no table and no column, and a build without it reads `delete` and `archive` rows through the same fold. That build answers an unknown operation, and the command asks `ops.capabilities` first.

### Invariants of a save

- **Identity tuple.** `agent`, `user_id` and `session_id` are `-`. `actor` comes from the token, and `source_class` from the op and the downgrade the request declared (`server.knowledge.app.writes.authorship_of`).
- **Tenant isolation.** Every statement scopes by `org` and `namespace`. The transport admits a save at `writer`, and the reads answer a draft only where the caller holds `writer`.
- **Belief revision.** A save of a name the namespace does not hold is Expand. A save over a revision is Revise, guarded by the compare-and-set.
- **Fail closed.** A namespace kind that cannot be read refuses the save, and so does a fleet view that is empty or cannot be read.
- **Rolling upgrade.** [Rolling upgrades](/docs/architecture/rolling-upgrades), rule 84.

## Invariants

These hold for `skill.check`. The ones of a save are [above](#invariants-of-a-save).

- **Tenant isolation.** The op is addressed by namespace and the transport admits it at `viewer`. The handler reads no stored row, so nothing of another tenant can be answered. A token bounded below its namespace (to one user or session) is refused at admission.
- **No row is written.** The request ledger keeps the argument digest, the answered `name` and `content_sha256`; it keeps no file. A `name` the name rule refuses is answered empty, so the ledger keeps a name and never a line of text.
- **Belief revision.** None: the op is a read.
- **Rolling upgrade.** A build without the op answers an unknown operation. The command asks `ops.capabilities` first and says the server does not serve the check.
- **Import contract.** The rules are a `domain` module with no I/O. It takes the set of op groups as an argument; the handler reads the registry.

## Source entry points

- `server/identity/domain/skill_format.py`: `check_package`, `content_sha256`, `operation_mentions`, `package_mentions`, `NAMESPACE_TOKEN`, and every limit as a constant.
- `server/identity/app/skills.py`: `handle_skill_check`, `operations_report`; `handle_skill_list`, `handle_skill_get`.
- `server/identity/app/skill_save.py`: `handle_skill_save`, `lease_name`, `save_audit_subject`. `server/identity/domain/skill_state.py`: `fold`. `server/identity/domain/skill_drafts.py`: `bound_refusal`, `contributors`, and every bound as a constant. `server/identity/store/skills.py`: every statement on `loom.skills`.
- `server/identity/app/skill_delete.py`: `handle_skill_delete`. `server/identity/domain/skill_delete.py`: `planned`, `recorded_seq`, `left`.
- `server/identity/app/skill_decide.py`: `handle_skill_decide`. `server/identity/domain/skill_decide.py`: `target_of`, `planned`, `unknown_origin_keys`, `matching`. `server/identity/app/reviewers.py`: `reviewer_subjects`, `independent`.
- `server/identity/domain/skill_catalog.py`: `matches`, `page`. `server/core/served_skills.py`: `shipped`.
- `server/identity/api/models_skills.py`, `server/identity/api/ops_skills.py`: the wire models and the declarations.
- `sdk/python/loom/skills.py`: `read_folder`, `write_skill`, `read_lock`, `edited`, `served_state`. `sdk/python/loom/cli_skill.py`: the commands; `sdk/python/loom/cli_skill_pull.py`: `pull` and `status`.
- Tests: `tests/unit/test_skill_format_rules.py`, `tests/unit/test_skill_format_frontmatter.py`, `tests/unit/test_skill_format_hash.py`, `tests/unit/test_skill_format_repository_folders.py` (the rules over every skill folder in this repository), `tests/unit/test_skill_check_operations.py`, `tests/unit/test_sdk_skill_folder.py`, `tests/integration/test_skill_check.py`.
- Tests of the catalog: `tests/unit/test_skill_catalog_lists_builtins.py`, `tests/unit/test_skill_catalog_get_builtin.py`, `tests/unit/test_skill_catalog_missing.py`, `tests/unit/test_skill_catalog_notice.py`, `tests/unit/test_skill_catalog_fails_closed.py`, `tests/unit/test_served_skills_reader_moved.py`, `tests/unit/test_sdk_skill_commands.py`, `tests/integration/test_skill_catalog.py`.
- Tests of a save and the draft reads: `tests/unit/test_skill_state_fold.py`, `tests/unit/test_skill_save_compare_and_set.py`, `tests/unit/test_skill_save_contributors.py`, `tests/unit/test_skill_save_bounds_and_service_accounts.py`, `tests/unit/test_skill_save_refusals.py`, `tests/unit/test_skill_reads_hide_drafts.py`, `tests/unit/test_skill_team_reads.py`, `tests/unit/test_sdk_skill_save_command.py`, `tests/integration/test_skill_drafts.py`, and the draft case of `tests/integration/test_cross_principal_leakage.py`.
- Tests of a decision and the published reads: `tests/unit/test_skill_decide.py`, `tests/unit/test_skill_reads_published.py`, `tests/unit/test_inspector_consumers.py`, `tests/unit/test_sdk_skill_review_commands.py`, `tests/integration/test_skill_independent_review.py`, `tests/integration/test_skill_decide.py`, and the published case of `tests/integration/test_cross_principal_leakage.py`.
- Tests of the namespace token: `tests/unit/test_skill_binding.py`, `tests/unit/test_skill_literal_namespace_finding.py`, `tests/integration/test_skill_binding.py`, and the token cases of `tests/unit/test_sdk_skill_commands.py` and `frontend/src/views/Skills.test.tsx`.
- The session listing: `server/identity/domain/skill_format.py` (`listing_line`, `listing`), `server/identity/app/skills.py` (`session_listing`), `server/memory/app/context_pack.py` (`_pack_skills`), `server/transport/mcp_primer.py` (the sentence). Tests: `tests/unit/test_skill_listing.py`, `tests/unit/test_context_pack_skills.py`, `tests/unit/test_mcp_primer_order.py`, and the listing cases of `tests/unit/test_sdk_skill_commands.py`, `tests/integration/test_cross_principal_leakage.py` and `frontend/src/views/Skills.test.tsx`.
- Tests of a delete: `tests/unit/test_skill_delete.py`, `tests/unit/test_skill_delete_statement.py`, `tests/unit/test_hidden_op_says_why.py`, and the delete cases of `tests/unit/test_sdk_skill_save_command.py`, `tests/integration/test_skill_drafts.py` and `tests/integration/test_cross_principal_leakage.py`.

## Related

- [Skills](/docs/features/skills)
- [Operations reference: `skill`](/docs/reference/operations/skill)
- [CLI reference](/docs/reference/cli)
- [Security](/docs/architecture/security)
