@wirecat/cli-base 0.105.0 → 0.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,26 @@ Versions before 0.8.0 are in the [git tags](https://github.com/WireCatLabs/cli-b
8
8
  Every entry says what changed as a caller sees it, why, and what to watch for — the rules are
9
9
  [`docs/dev/CONVENTIONS.md`](docs/dev/CONVENTIONS.md#the-changelog).
10
10
 
11
+ ## 0.106.0 — 16.11.2026
12
+
13
+ ### Added
14
+
15
+ - **`skill install` copies the whole skill folder, not only SKILL.md.** A long skill can keep a short core in SKILL.md
16
+ and the rest in files beside it (`references/tasks.md`), so an agent that opens it carries about 2,000 tokens into
17
+ every turn instead of 12,000. `installSkill`, the Hermes copy and the new `writeSkillFolder(app, skillUrl, folder)`
18
+ write every file of the folder except dotfiles and symbolic links; only SKILL.md is stamped with the version. A file
19
+ an older version shipped and this one does not stays in the installed folder. Hermes's own copy is still taken out
20
+ once Hermes reads `~/.agents/skills`, now with its other files, and still only when the folder holds nothing else.
21
+ memo's `topics/` are installed too from its next bump.
22
+ - **`skill show <name>` prints a part of the skill by its file name** (`tg skill show tasks` prints
23
+ `references/tasks.md`), for an agent that read SKILL.md from `skill show` or over MCP and has no folder to follow a
24
+ link into. A skill a library ships under the same name still wins. `skillFiles(skillUrl)` lists the parts.
25
+ - **`skillResources(app, skillUrl)` serves each part over MCP** at the address its relative link resolves to from
26
+ `<command>://skill` (`tg://skill/references/tasks.md`), after the `skillResource` it starts with. A server that
27
+ registers them all lets an MCP-only client follow the guide's links; the first one's `instruction` says so.
28
+ - **A new rule in the handbook's [Documents](docs/standards/docs.md) page**: a skill's SKILL.md stays at about 8 KB or less, with the
29
+ main user job first and one index line per linked file saying when to read it.
30
+
11
31
  ## 0.105.0 — 16.11.2026
12
32
 
13
33
  ### Fixed
@@ -73,7 +73,10 @@ export type SchemaNode = SchemaCommon & ({
73
73
  type: "allOf";
74
74
  of: readonly SchemaNode[];
75
75
  }
76
- /** Only where the source itself says "anything". An adapter never falls back to this. */
76
+ /**
77
+ * Only where the source itself says "anything", or a field that is only ever `null`, which this has no type for.
78
+ * An adapter never falls back to this.
79
+ */
77
80
  | {
78
81
  type: "unknown";
79
82
  });
@@ -28,6 +28,7 @@ const KNOWN = new Set([
28
28
  "additionalProperties",
29
29
  "allOf",
30
30
  "oneOf",
31
+ "anyOf",
31
32
  "$ref",
32
33
  "discriminator",
33
34
  ]);
@@ -50,6 +51,7 @@ const CONTRACT_MARKS = [
50
51
  "maxLength",
51
52
  "allOf",
52
53
  "oneOf",
54
+ "anyOf",
53
55
  ];
54
56
  export class OpenApiError extends Error {
55
57
  problems;
@@ -68,6 +70,10 @@ const EFFECT_BY_METHOD = {
68
70
  PATCH: "write",
69
71
  DELETE: "destructive",
70
72
  };
73
+ /** `{type: "null"}` or `type: ["null"]`: JSON Schema 2020-12's own way to say "only null". */
74
+ const isNullOnly = (source) => isObject(source) &&
75
+ (source.type === "null" ||
76
+ (Array.isArray(source.type) && source.type.length > 0 && source.type.every((t) => t === "null")));
71
77
  const pick = (source, keys) => Object.fromEntries(keys.map((key) => [key, source[key]]));
72
78
  const typeOfConst = (value) => typeof value === "string"
73
79
  ? "string"
@@ -99,6 +105,7 @@ class Adapter {
99
105
  document;
100
106
  #components;
101
107
  #parameters;
108
+ #distributing = new Set();
102
109
  constructor(document) {
103
110
  this.document = document;
104
111
  const components = isObject(document.components) ? document.components : {};
@@ -174,11 +181,21 @@ class Adapter {
174
181
  const common = this.#common(source);
175
182
  if (source.$ref !== undefined)
176
183
  return { ...common, type: "ref", ref: this.refId(source.$ref, where) };
184
+ // The model has no null type; "anything" accepts the one value this allows, as losing `not` does.
185
+ if (isNullOnly(source))
186
+ return { ...common, type: "unknown" };
177
187
  if (Array.isArray(source.allOf))
178
188
  return this.#allOf(source, source.allOf, common, where);
179
- if (Array.isArray(source.oneOf)) {
180
- const of = source.oneOf.map((member, index) => this.schema(member, `${where}.oneOf[${index}]`));
181
- return { ...common, type: "union", of };
189
+ if (Array.isArray(source.oneOf) && Array.isArray(source.anyOf)) {
190
+ this.problems.push(`${where}: both oneOf and anyOf on one schema`);
191
+ return { type: "unknown" };
192
+ }
193
+ // A union passes when any member matches, which is anyOf; oneOf's "exactly one" is never checked.
194
+ const keyword = Array.isArray(source.oneOf) ? "oneOf" : Array.isArray(source.anyOf) ? "anyOf" : undefined;
195
+ if (keyword) {
196
+ if (Array.isArray(source.type) && source.type.includes("null"))
197
+ common.nullable = true;
198
+ return this.#union(source[keyword], keyword, common, where);
182
199
  }
183
200
  const type = this.#type(source, common, where);
184
201
  const values = source.const !== undefined ? [source.const] : Array.isArray(source.enum) ? source.enum : undefined;
@@ -269,7 +286,73 @@ class Adapter {
269
286
  }
270
287
  return node;
271
288
  }
289
+ /** OpenAPI 3.1 writes a nullable reference as `oneOf: [{$ref}, {type: "null"}]`. */
290
+ #union(members, keyword, common, where) {
291
+ const kept = members.flatMap((member, index) => (isNullOnly(member) ? [] : [{ member, index }]));
292
+ const of = kept.map(({ member, index }) => this.schema(member, `${where}.${keyword}[${index}]`));
293
+ if (kept.length === members.length)
294
+ return { ...common, type: "union", of };
295
+ const [only] = of;
296
+ if (!only)
297
+ return { ...common, type: "unknown" };
298
+ if (of.length === 1)
299
+ return { ...only, ...common, nullable: true };
300
+ return { ...common, nullable: true, type: "union", of };
301
+ }
302
+ /** The members of a union an allOf member stands for, inline or behind references; never a discriminated base. */
303
+ #unionMembers(member, seen = new Set()) {
304
+ if (!isObject(member) || Array.isArray(member.allOf))
305
+ return undefined;
306
+ const members = Array.isArray(member.oneOf) ? member.oneOf : Array.isArray(member.anyOf) ? member.anyOf : undefined;
307
+ if (members)
308
+ return isObject(member.discriminator) ? undefined : { members };
309
+ const prefix = "#/components/schemas/";
310
+ if (typeof member.$ref !== "string" || !member.$ref.startsWith(prefix) || seen.has(member.$ref))
311
+ return undefined;
312
+ seen.add(member.$ref);
313
+ const found = this.#unionMembers(this.#components[member.$ref.slice(prefix.length)], seen);
314
+ return found && { ref: found.ref ?? member.$ref.slice(prefix.length), members: found.members };
315
+ }
316
+ /**
317
+ * A and (B or C) is (A and B) or (A and C): the model merges only objects, so the one union member is
318
+ * distributed over the rest, as Notion's property configs extend a common base.
319
+ */
320
+ #distribute(members, common, where) {
321
+ const unions = members.flatMap((member) => {
322
+ const found = this.#unionMembers(member);
323
+ return found ? [{ member, ...found }] : [];
324
+ });
325
+ if (unions.length === 0)
326
+ return undefined;
327
+ const [union] = unions;
328
+ if (unions.length > 1 || !union) {
329
+ this.problems.push(`${where}: an allOf of several unions`);
330
+ return { type: "unknown" };
331
+ }
332
+ if (union.ref && this.#distributing.has(union.ref)) {
333
+ this.problems.push(`${where}: an allOf distributes the union "${union.ref}" inside itself`);
334
+ return { type: "unknown" };
335
+ }
336
+ const rest = members.filter((member) => member !== union.member);
337
+ // Alone, the allOf only describes a reference, which keeps its name.
338
+ if (rest.length === 0)
339
+ return undefined;
340
+ // Null would also have to pass the rest, which the model only merges as objects: that alternative is empty.
341
+ const alternatives = union.members.filter((one) => !isNullOnly(one)).map((one) => ({ allOf: [...rest, one] }));
342
+ if (union.ref)
343
+ this.#distributing.add(union.ref);
344
+ try {
345
+ return this.#union(alternatives, "union", common, where);
346
+ }
347
+ finally {
348
+ if (union.ref)
349
+ this.#distributing.delete(union.ref);
350
+ }
351
+ }
272
352
  #allOf(source, members, common, where) {
353
+ const distributed = this.#distribute(members, common, where);
354
+ if (distributed)
355
+ return distributed;
273
356
  const of = members.map((member, index) => this.schema(member, `${where}.allOf[${index}]`));
274
357
  const [only] = of;
275
358
  // `type: object` beside a one-member allOf is inheritance with no fields of its own; without it,
@@ -47,8 +47,9 @@ class TypeWriter {
47
47
  const names = Object.keys(node.properties);
48
48
  if (literal && !names.includes(literal.property))
49
49
  names.unshift(literal.property);
50
+ // An index signature, not Record: a type alias may name itself inside one, as a JSON value does.
50
51
  const rest = node.additionalProperties
51
- ? `Record<string, ${this.node(node.additionalProperties, where)}>`
52
+ ? `{ [key: string]: ${this.node(node.additionalProperties, where)} }`
52
53
  : undefined;
53
54
  if (names.length === 0)
54
55
  return rest ?? "Record<string, unknown>";
@@ -20,7 +20,18 @@ export declare const skillPath: (target: SkillTarget, appName: string, env: Env)
20
20
  export declare const skillVersion: (content: string) => string | undefined;
21
21
  /** Adds or replaces `metadata.version` as a string; every other byte stays as it was. */
22
22
  export declare const withVersion: (content: string, version: string) => string;
23
- /** Writes the stamped SKILL.md to each target, creating directories; the same run twice gives the same files. */
23
+ /**
24
+ * The files beside SKILL.md that it links to or names (`references/tasks.md`), as `/`-separated paths relative to its
25
+ * folder. A long skill keeps its core in SKILL.md and the rest in these, so an agent loads only what its task needs.
26
+ * Dotfiles and symbolic links are left out: a link could point anywhere on the machine.
27
+ */
28
+ export declare const skillFiles: (skill: URL) => string[];
29
+ /**
30
+ * Writes the stamped SKILL.md and every file of `skillFiles` into `folder`, and answers the SKILL.md written. A file
31
+ * an older version shipped and this one does not stays: the folder may hold the owner's own files too.
32
+ */
33
+ export declare const writeSkillFolder: (app: SkillApp, skill: URL, folder: string) => string;
34
+ /** Writes the skill's folder to each target, creating directories; the same run twice gives the same files. */
24
35
  export declare const installSkill: (app: SkillApp, skill: URL, { targets, env }?: {
25
36
  targets?: readonly SkillTarget[];
26
37
  env?: Env;
@@ -131,4 +142,10 @@ export interface SkillResource {
131
142
  * `server.registerResource(r.name, r.uri, { title, description, mimeType }, r.read)`. The SDK stays the host's.
132
143
  */
133
144
  export declare const skillResource: (app: SkillApp, skill: URL) => SkillResource;
145
+ /**
146
+ * `skillResource` and one resource per Markdown file beside SKILL.md, at the address its relative link resolves to
147
+ * from `<command>://skill` (`references/tasks.md` is `tg://skill/references/tasks.md`), so an MCP client follows a
148
+ * link the guide gives. Register them all; the first one's `instruction` is the line for the server.
149
+ */
150
+ export declare const skillResources: (app: SkillApp, skill: URL) => SkillResource[];
134
151
  export {};
@@ -5,9 +5,10 @@
5
5
  * Nothing here prints by itself. The command writes through the renderer and streams the host hands
6
6
  * it, and the hint is a string the host puts on stderr — never stdout, which an agent parses.
7
7
  */
8
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from "node:fs";
8
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
9
9
  import { homedir } from "node:os";
10
- import { dirname, join, resolve } from "node:path";
10
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
11
+ import { fileURLToPath, pathToFileURL } from "node:url";
11
12
  import { Command, Option } from "commander";
12
13
  import crossSpawn from "cross-spawn";
13
14
  import { annotate } from "../commands/index.js";
@@ -78,22 +79,52 @@ export const withVersion = (content, version) => {
78
79
  }
79
80
  return `---${eol}${lines.join("")}---${close}${content.slice(whole.length)}`;
80
81
  };
81
- /** Writes the stamped SKILL.md to each target, creating directories; the same run twice gives the same files. */
82
- export const installSkill = (app, skill, { targets = SKILL_TARGETS, env = process.env } = {}) => {
82
+ /**
83
+ * The files beside SKILL.md that it links to or names (`references/tasks.md`), as `/`-separated paths relative to its
84
+ * folder. A long skill keeps its core in SKILL.md and the rest in these, so an agent loads only what its task needs.
85
+ * Dotfiles and symbolic links are left out: a link could point anywhere on the machine.
86
+ */
87
+ export const skillFiles = (skill) => {
88
+ const root = dirname(fileURLToPath(skill));
89
+ const found = [];
90
+ const walk = (folder) => {
91
+ for (const entry of readdirSync(folder, { withFileTypes: true })) {
92
+ if (entry.name.startsWith("."))
93
+ continue;
94
+ const path = join(folder, entry.name);
95
+ if (entry.isDirectory())
96
+ walk(path);
97
+ else if (entry.isFile() && path !== join(root, "SKILL.md"))
98
+ found.push(relative(root, path).split(sep).join("/"));
99
+ }
100
+ };
101
+ walk(root);
102
+ return found.sort();
103
+ };
104
+ /**
105
+ * Writes the stamped SKILL.md and every file of `skillFiles` into `folder`, and answers the SKILL.md written. A file
106
+ * an older version shipped and this one does not stays: the folder may hold the owner's own files too.
107
+ */
108
+ export const writeSkillFolder = (app, skill, folder) => {
83
109
  const source = readFileSync(skill, "utf8");
84
110
  // The specification requires it, and an agent that checks skips a skill whose name and directory differ.
85
111
  const name = skillName(source);
86
112
  if (name !== app.appName) {
87
113
  throw new CliError("configuration_error", `SKILL.md is named ${name === undefined ? "nothing" : `"${name}"`}, but installs into a directory "${app.appName}"; the two must match`);
88
114
  }
89
- const content = withVersion(source, app.version);
90
- return targets.map((target) => {
91
- const path = skillPath(target, app.appName, env);
92
- mkdirSync(dirname(path), { recursive: true });
93
- writeFileSync(path, content);
94
- return path;
95
- });
115
+ const root = dirname(fileURLToPath(skill));
116
+ for (const file of skillFiles(skill)) {
117
+ const target = join(folder, file);
118
+ mkdirSync(dirname(target), { recursive: true });
119
+ writeFileSync(target, readFileSync(join(root, file)));
120
+ }
121
+ const path = join(folder, "SKILL.md");
122
+ mkdirSync(folder, { recursive: true });
123
+ writeFileSync(path, withVersion(source, app.version));
124
+ return path;
96
125
  };
126
+ /** Writes the skill's folder to each target, creating directories; the same run twice gives the same files. */
127
+ export const installSkill = (app, skill, { targets = SKILL_TARGETS, env = process.env } = {}) => targets.map((target) => writeSkillFolder(app, skill, dirname(skillPath(target, app.appName, env))));
97
128
  /** Each target's installed copy against this CLI's version; reads only, and an unreadable file is missing. */
98
129
  export const skillStatus = (app, env = process.env) => SKILL_TARGETS.map((target) => {
99
130
  const path = skillPath(target, app.appName, env);
@@ -159,16 +190,19 @@ const expanded = (entry, env) => resolve(entry
159
190
  .replace(/^~(?=$|[\\/])/, homeOf(env))
160
191
  .replace(/\$\{(\w+)\}|\$(\w+)/g, (whole, braced, bare) => env[braced ?? bare ?? ""] ?? whole));
161
192
  const lists = (dirs, folder, env) => dirs.some((entry) => expanded(entry, env) === resolve(folder));
162
- /** Our own earlier copy, alone in its folder: anything else there was put by someone else and stays. */
163
- const removeOwnCopy = (appName, env) => {
164
- const path = hermesCopyPath(appName, env);
193
+ /** Our own earlier copy: its folder holds only SKILL.md and what the skill ships; anything else was put by someone else. */
194
+ const removeOwnCopy = (app, skill, env) => {
195
+ const path = hermesCopyPath(app.appName, env);
196
+ const shipped = new Set(skillFiles(skill));
197
+ const top = new Set(["SKILL.md", ...[...shipped].map((file) => file.split("/")[0])]);
165
198
  try {
166
- if (readdirSync(dirname(path)).join() !== "SKILL.md")
199
+ if (!readdirSync(dirname(path)).every((entry) => top.has(entry)))
167
200
  return undefined;
168
- if (skillName(readFileSync(path, "utf8")) !== appName)
201
+ if (!skillFiles(pathToFileURL(path)).every((file) => shipped.has(file)))
169
202
  return undefined;
170
- rmSync(path);
171
- rmdirSync(dirname(path));
203
+ if (skillName(readFileSync(path, "utf8")) !== app.appName)
204
+ return undefined;
205
+ rmSync(dirname(path), { recursive: true });
172
206
  return path;
173
207
  }
174
208
  catch {
@@ -200,12 +234,10 @@ export const installHermesSkill = (app, skill, { env = process.env, run = runPro
200
234
  const [shared] = installSkill(app, skill, { targets: ["agents"], env });
201
235
  const reason = readFolder(dirname(dirname(shared)), env, run);
202
236
  if (reason === undefined) {
203
- const removed = removeOwnCopy(app.appName, env);
237
+ const removed = removeOwnCopy(app, skill, env);
204
238
  return { written: [shared], hermes: { via: "external_dirs", path: shared, ...(removed ? { removed } : {}) } };
205
239
  }
206
- const copy = hermesCopyPath(app.appName, env);
207
- mkdirSync(dirname(copy), { recursive: true });
208
- writeFileSync(copy, readFileSync(shared));
240
+ const copy = writeSkillFolder(app, skill, dirname(hermesCopyPath(app.appName, env)));
209
241
  return { written: [shared, copy], hermes: { via: "copy", path: copy, reason } };
210
242
  };
211
243
  /**
@@ -225,6 +257,21 @@ export const hermesSkillStatus = (app, { env = process.env, run = runProgram } =
225
257
  return { ...read, via: "external_dirs" };
226
258
  return { path: shared, installed: null, state: "missing", via: null };
227
259
  };
260
+ /**
261
+ * The skill's own Markdown files beside SKILL.md by name (`references/tasks.md` is `tasks`), for `skill show <name>`:
262
+ * an agent that read SKILL.md from `skill show` or over MCP has no folder to follow a relative link into.
263
+ */
264
+ const skillParts = (skill) => {
265
+ try {
266
+ return Object.fromEntries(skillFiles(skill)
267
+ .filter((file) => file.endsWith(".md"))
268
+ .reverse()
269
+ .map((file) => [basename(file, ".md"), new URL(file, skill)]));
270
+ }
271
+ catch {
272
+ return {};
273
+ }
274
+ };
228
275
  /**
229
276
  * `more`: skills a library ships for every CLI built on it, by name — `skill show <name>` prints one with
230
277
  * `{{command}}` turned into this CLI's command. They are printed, not installed: two CLIs would install
@@ -236,12 +283,14 @@ export const skillCommand = (app, skill, environment, more = {}) => {
236
283
  const { json, jsonl } = self.optsWithGlobals();
237
284
  return json === true || jsonl === true;
238
285
  };
239
- const named = Object.keys(more);
286
+ // The skill's own parts first, so a library's skill of the same name still wins.
287
+ const shown = { ...skillParts(skill), ...more };
288
+ const named = Object.keys(shown);
240
289
  const show = annotate(command.command("show"), { effects: { remote: "none", local: "read" } })
241
290
  .summary("print the tool's instructions for AI agents")
242
291
  .description(`print SKILL.md — \`${app.command} skill install\` puts it where Claude Code, Codex, Gemini CLI and OpenClaw look for it, and where Hermes does on request; --for prints the copy already there`);
243
292
  if (named.length > 0)
244
- show.argument("[name]", `one of the skills shipped for a task: ${named.join(", ")}`);
293
+ show.argument("[name]", `a part of this skill, or a skill shipped for a task: ${named.join(", ")}`);
245
294
  show.addOption(new Option("--for <agents>", "print the copy installed for these agents instead of this version's").choices(SKILL_TARGETS));
246
295
  show.action(function (given) {
247
296
  // Without a declared argument Commander passes the options here, not a name.
@@ -265,7 +314,7 @@ export const skillCommand = (app, skill, environment, more = {}) => {
265
314
  streams.data(content);
266
315
  return;
267
316
  }
268
- const source = name === undefined ? skill : more[name];
317
+ const source = name === undefined ? skill : shown[name];
269
318
  if (!source) {
270
319
  throw new CliError("validation_error", `no skill "${name}" — there are: ${named.join(", ")}`);
271
320
  }
@@ -363,3 +412,40 @@ export const skillResource = (app, skill) => {
363
412
  instruction: `- The full guide is the resource ${uri}; \`${app.command} skill install\` installs it as an agent skill.`,
364
413
  };
365
414
  };
415
+ /**
416
+ * `skillResource` and one resource per Markdown file beside SKILL.md, at the address its relative link resolves to
417
+ * from `<command>://skill` (`references/tasks.md` is `tg://skill/references/tasks.md`), so an MCP client follows a
418
+ * link the guide gives. Register them all; the first one's `instruction` is the line for the server.
419
+ */
420
+ export const skillResources = (app, skill) => {
421
+ const main = skillResource(app, skill);
422
+ let parts = [];
423
+ try {
424
+ parts = skillFiles(skill).filter((file) => file.endsWith(".md"));
425
+ }
426
+ catch {
427
+ // A skill read from somewhere without a folder still has its SKILL.md.
428
+ }
429
+ if (parts.length === 0)
430
+ return [main];
431
+ return [
432
+ {
433
+ ...main,
434
+ instruction: `- The guide is the resource ${main.uri}; the parts it links are ${main.uri}/<path>, read only the one a task needs. \`${app.command} skill install\` installs it as an agent skill.`,
435
+ },
436
+ ...parts.map((file) => {
437
+ const uri = `${main.uri}/${file}`;
438
+ return {
439
+ uri,
440
+ name: `skill/${file}`,
441
+ title: `${app.appName} ${file}`,
442
+ description: `A part of the ${app.command} guide that ${main.uri} links to.`,
443
+ mimeType: "text/markdown",
444
+ read: () => ({
445
+ contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL(file, skill), "utf8") }],
446
+ }),
447
+ instruction: "",
448
+ };
449
+ }),
450
+ ];
451
+ };
@@ -372,6 +372,7 @@ const views = [
372
372
  ["transcript", "the text of speech: a voice message or a meeting recording"],
373
373
  ["evidence", "the stored messages or lines a result or a reference rests on"],
374
374
  ["passage", "a cited transcript line with bounded surrounding lines from the same revision"],
375
+ ["invitation", "the text that invites people to a meeting: how to join it and when"],
375
376
  ["agenda", "what needs a look today"],
376
377
  ["busy", "when calendars or people are taken, without what takes them"],
377
378
  ["categories", "the categories a thing takes, with what each means"],
@@ -40,7 +40,7 @@ the four steps that need a person. A new CLI is ready for its first release when
40
40
  | [Data model](data-model.md) | `DATA` | 9 | Core entities, entities and source records, `external_id`, field names, links and duplicates, files, calendar entries |
41
41
  | [Testing](testing.md) | `TEST` | 18 | Sandbox, no network, no real waits, leak tests, coverage, contracts, test matrix, parity, fakes as strict as the service |
42
42
  | [Security](security.md) | `SECR` | 24 | Secrets, logs, keyring, argv, error text, untrusted text, scanners, workflow hardening, reporting, OAuth sign-in and which app it uses, meeting secrets, keyring in moved-folder runs |
43
- | [Documents](docs.md) | `DOC` | 21 | User pages and developer pages, generated pages, current facts, changelog, repository page |
43
+ | [Documents](docs.md) | `DOC` | 22 | User pages and developer pages, generated pages, current facts, changelog, repository page |
44
44
  | [Comparisons](comparisons.md) | `CMP` | 11 | Which tools a comparison page lists, rows as user tasks, agents and safety, where others are better, proof of marks |
45
45
  | [Releases](releases.md) | `REL` | 16 | `bin/release`, the release lock, versions, the owner's yes, trusted publishing |
46
46
  | [CI](ci.md) | `CI` | 13 | Hooks, the pull request budget, full validation, monthly runs, conflict markers |
@@ -244,6 +244,25 @@ Rule ids on this page are `WC-DOC-<n>`. How to read a rule, how ids work and whi
244
244
  `cli-docs`, `cli-testing`).
245
245
  - **Applies to:** every public WireCat repository. **Since:** cli-base 0.75.3. **Rulings:** none.
246
246
 
247
+ ### WC-DOC-22 · The agent skill keeps a short core and puts the rest in files it links
248
+
249
+ An agent that opens the skill carries SKILL.md in every later turn of its session, so its size is paid many times.
250
+
251
+ - **Why:** tg's 50 KB SKILL.md (about 12,000 tokens) raised the median input of every turn of an agent from about 31,000
252
+ to 47,000 tokens, and half the sessions of a timed test ran out of time.
253
+ - **Enforced by:** `<app>: pnpm docs:check`. It runs cli-core's skill validation with a byte limit, which also checks
254
+ the links and command paths in each linked file.
255
+ - **Example:** `skills/tg-cli/SKILL.md` is at most about 8 KB (about 2,000 tokens). It holds the frontmatter, what the
256
+ tool is, the profile rule, the main user job first (for a messenger: answer a question from the chats, then read and
257
+ send), the hard boundaries, the output and exit-code basics, and an index. Everything else, verbatim or tightened
258
+ but with no rule dropped, is in `skills/tg-cli/references/<topic>.md`. Each index line names one file and says when
259
+ to read it, with both routes, for example a link to `references/tasks.md`, then `tg skill show tasks`, then "when
260
+ the owner asks about tasks or promises". An installed copy follows the link; an agent that read the skill from
261
+ `skill show` or over MCP runs the command or reads `tg://skill/references/tasks.md`. Text that `--help`,
262
+ `commands --json` or `guide` already gives stays out of both; a trap that prevents a real mistake stays.
263
+ - **Exceptions:** a SKILL.md under the limit needs no references.
264
+ - **Applies to:** every CLI that ships an agent skill. **Since:** cli-base 0.106.0. **Rulings:** none.
265
+
247
266
  ## Sources
248
267
 
249
268
  These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-base",
3
- "version": "0.105.0",
3
+ "version": "0.106.0",
4
4
  "description": "The parts every command line tool needs: output modes, terminal rendering, error model, exit codes, credentials, clocks",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",