skillfit 0.15.3 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,150 @@
1
+ import { lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
2
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
3
+ import { prepareCommitBench } from "../../bench/authoring.js";
4
+ import { runOfflineBenchCheck } from "../../bench/gates/check.js";
5
+ import { collectInstalledSkillTarget } from "../../resources/installed-skill.js";
6
+ import { assertSkillRevisionTargets } from "../targets/skill.js";
7
+ import { parseEvalRequest } from "./request.js";
8
+ import { assertTokenBudgetSupport } from "../execution/budget.js";
9
+ /** One fresh development comparison. No executor or user configuration writer is reachable. */
10
+ export async function prepareSkillRevision(options, dependencies = {}) {
11
+ const requested = resolve(options.workspace);
12
+ // Resolve existing ancestors (including macOS /var and /tmp aliases), then pin that parent.
13
+ let ancestor = dirname(requested);
14
+ while (true) {
15
+ try {
16
+ realpathSync(ancestor);
17
+ break;
18
+ }
19
+ catch (error) {
20
+ if (error.code !== "ENOENT")
21
+ throw error;
22
+ ancestor = dirname(ancestor);
23
+ }
24
+ }
25
+ const physicalParent = realpathSync(ancestor);
26
+ const workspace = resolve(physicalParent, relative(ancestor, requested));
27
+ const assertFresh = () => {
28
+ try {
29
+ lstatSync(workspace);
30
+ throw new Error(`Workspace already exists: ${workspace}`);
31
+ }
32
+ catch (error) {
33
+ if (error.code !== "ENOENT")
34
+ throw error;
35
+ }
36
+ for (let parent = dirname(workspace); parent !== physicalParent; parent = dirname(parent)) {
37
+ try {
38
+ if (lstatSync(parent).isSymbolicLink())
39
+ throw new Error(`Workspace parent is a symlink: ${parent}`);
40
+ }
41
+ catch (error) {
42
+ if (error.code !== "ENOENT")
43
+ throw error;
44
+ }
45
+ }
46
+ };
47
+ assertFresh();
48
+ const candidate = collectInstalledSkillTarget(options.candidateSkill);
49
+ const baseline = collectInstalledSkillTarget(options.baselineSkill);
50
+ assertSkillRevisionTargets(candidate, baseline);
51
+ for (const target of [baseline, candidate]) {
52
+ const rel = relative(target.sourceDir, workspace);
53
+ if (rel === "" || (!rel.startsWith("..") && !isAbsolute(rel)))
54
+ throw new Error("Preparation workspace must not be inside an input Skill.");
55
+ }
56
+ const bench = prepareCommitBench({
57
+ dir: join(workspace, "bench"),
58
+ sourceDir: options.sourceDir,
59
+ fromCommit: options.fromCommit,
60
+ promptFile: options.promptFile,
61
+ verifierCmd: options.verifierCmd,
62
+ include: options.include,
63
+ });
64
+ const requestPath = join(workspace, "request.json");
65
+ const body = {
66
+ schemaVersion: 1,
67
+ baselineSkill: "skills/old",
68
+ candidateSkill: "skills/new",
69
+ bench: "bench",
70
+ agent: options.agent,
71
+ purpose: "development",
72
+ pairOrder: "balanced",
73
+ trials: 1,
74
+ maxCalls: 2,
75
+ runsRoot: "runs",
76
+ runGroup: "revision-001",
77
+ ...(options.spendingBudget ? { spendingBudget: options.spendingBudget } : {}),
78
+ ...(options.executorTimeoutSeconds !== undefined
79
+ ? { executorTimeoutSeconds: options.executorTimeoutSeconds }
80
+ : {}),
81
+ };
82
+ const request = parseEvalRequest(body, workspace);
83
+ assertTokenBudgetSupport([], request.executorTimeoutSeconds, request.spendingBudget);
84
+ const writes = bench.writes.map((write) => ({ target: write.target, content: write.content }));
85
+ for (const [target, folder] of [
86
+ [baseline, "old"],
87
+ [candidate, "new"],
88
+ ])
89
+ for (const file of target.files)
90
+ writes.push({
91
+ target: join(workspace, "skills", folder, file),
92
+ content: readFileSync(join(target.sourceDir, file)),
93
+ });
94
+ writes.push({ target: requestPath, content: JSON.stringify(body, null, 2) + "\n" });
95
+ // POSIX shells and PowerShell both support single-quoted literal paths (including spaces).
96
+ const quote = (value) => "'" + value.replaceAll("'", process.platform === "win32" ? "''" : "'\\''") + "'";
97
+ const nextCommands = [
98
+ `skillfit bench check ${quote(join(workspace, "bench"))}`,
99
+ `skillfit eval --request ${quote(requestPath)} --dry-run`,
100
+ `skillfit eval --request ${quote(requestPath)} --plan-sha <sha256-from-preview>`,
101
+ ];
102
+ const view = {
103
+ schemaVersion: 1,
104
+ kind: "skillfit.revision-preparation",
105
+ workspace,
106
+ requestPath,
107
+ modelCalls: 0,
108
+ maxCalls: 2,
109
+ spendingBudget: request.spendingBudget ?? null,
110
+ executorTimeoutSeconds: request.executorTimeoutSeconds,
111
+ files: writes.map((w) => relative(workspace, w.target)),
112
+ nextCommands,
113
+ };
114
+ options.log?.(`Prepare one development pair (2 task calls when separately executed); token limits: ${JSON.stringify(view.spendingBudget)}; executor deadline: ${request.executorTimeoutSeconds === null ? "disabled" : request.executorTimeoutSeconds + "s"}.`);
115
+ options.log?.(`Verifier command ${JSON.stringify(options.verifierCmd ?? "node --test")} is retained and executed with a shell by bench check and evaluation. Creation runs offline gates; preview does not execute it.`);
116
+ options.log?.("A single development pair cannot authorize adoption. Authentication and ambient agent configuration are checked by the separate evaluation preview.");
117
+ options.log?.(`Workspace plan: ${workspace}`);
118
+ for (const file of view.files)
119
+ options.log?.(` + ${file}`);
120
+ if (options.dryRun)
121
+ return { ...view, status: "preview" };
122
+ if (!options.yes &&
123
+ !(await options.confirm?.(`Create ${writes.length} files in ${workspace} and run local verifier/oracle commands? [y/N] `)))
124
+ return { ...view, status: "cancelled" };
125
+ assertFresh();
126
+ bench.assertCurrent();
127
+ for (const target of [baseline, candidate]) {
128
+ const current = collectInstalledSkillTarget(target.sourceDir);
129
+ if (current.sha256 !== target.sha256)
130
+ throw new Error("Skill inputs changed after preparation; review a fresh plan.");
131
+ }
132
+ mkdirSync(dirname(workspace), { recursive: true });
133
+ mkdirSync(workspace); // Exclusive ownership: do not remove anything unless this succeeded.
134
+ try {
135
+ for (const write of writes) {
136
+ mkdirSync(dirname(write.target), { recursive: true });
137
+ (dependencies.writeFile ?? writeFileSync)(write.target, write.content, { flag: "wx" });
138
+ }
139
+ const checks = await runOfflineBenchCheck({ dir: request.bench, log: options.log });
140
+ return {
141
+ ...view,
142
+ status: checks.failures === 0 ? "ready" : "blocked",
143
+ checks,
144
+ };
145
+ }
146
+ catch (error) {
147
+ rmSync(workspace, { recursive: true, force: true });
148
+ throw error;
149
+ }
150
+ }
@@ -297,11 +297,12 @@ export async function auditEvaluation(value, runDir, options = {}) {
297
297
  assert.ok(definition);
298
298
  const scratch = mkdtempSync(join(tmpdir(), "skillfit-eval-replay-"));
299
299
  try {
300
- cpSync(join(root, task.id, arm, `trial-${trial}`), scratch, {
300
+ const replayDir = join(scratch, arm, `trial-${trial}`);
301
+ cpSync(join(root, task.id, arm, `trial-${trial}`), replayDir, {
301
302
  recursive: true,
302
303
  filter: (path) => basename(path) !== ".git",
303
304
  });
304
- const grade = await runVerifier(bench.dir, definition.verifier, scratch, definition.verifierTimeoutSeconds), summary = verdictFromOutput(grade.output);
305
+ const grade = await runVerifier(bench.dir, definition.verifier, replayDir, definition.verifierTimeoutSeconds), summary = verdictFromOutput(grade.output);
305
306
  assert.equal(grade.error, null, `Replay verifier failed: ${grade.error}`);
306
307
  assert.notEqual(grade.exitCode, null);
307
308
  assert.equal(grade.exitCode, r.verifierExitCode);
@@ -4,7 +4,7 @@ export { probeVersion, validateCallBudget } from "../../agents/call-limits.js";
4
4
  import { measurementScope, requestedClaimFor, assertScopeMatches, assertBenchClaimSupported, } from "../measurement/scope.js";
5
5
  import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, readdirSync, realpathSync, rmSync, writeFileSync, } from "node:fs";
6
6
  import { homedir } from "node:os";
7
- import { readAgentEnvironment, normalizeProjectTrust, } from "../../agents/environment.js";
7
+ import { readAgentEnvironment, resolveAgentPath, normalizeProjectTrust, } from "../../agents/environment.js";
8
8
  export { normalizeProjectTrust } from "../../agents/environment.js";
9
9
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
10
10
  import { getAgent } from "../../agents/matrix.js";
@@ -20,14 +20,13 @@ import { loadBench } from "../../bench/read.js";
20
20
  import { spendingStopFrom } from "../execution/budget.js";
21
21
  import { assertEvaluationOutputLayout, physicalPath } from "../targets/output-layout.js";
22
22
  import { assertSessionDetails } from "./contracts.js";
23
- function skillInventory(root) {
24
- if (!existsSync(root))
25
- return { root, entries: ["missing"] };
23
+ function skillInventory(root, managedSystem = false) {
26
24
  return {
27
25
  root,
28
26
  entries: [
29
- realpathSync(root),
30
- ...readdirSync(root)
27
+ physicalPath(root),
28
+ ...(existsSync(root) ? readdirSync(root) : [])
29
+ .filter((entry) => !managedSystem || entry !== ".system")
31
30
  .sort()
32
31
  .map((entry) => {
33
32
  const path = join(root, entry);
@@ -97,6 +96,7 @@ export class ExperimentSession {
97
96
  workspaceAliases;
98
97
  trustWorkspaces;
99
98
  inventories = [];
99
+ managedSkillRoot = null;
100
100
  callsStarted = 0;
101
101
  callsFinished = 0;
102
102
  stopReason = null;
@@ -172,11 +172,19 @@ export class ExperimentSession {
172
172
  const agent = getAgent(options.agent);
173
173
  const home = options.homeDir ?? homedir();
174
174
  const environment = readAgentEnvironment(agent, { homeDir: home, cwd: process.cwd(), env });
175
+ const override = agent.skills.userHomeOverride;
176
+ if (agent.id === "codex" && override) {
177
+ const spec = env[override.env]
178
+ ? join(env[override.env], override.relativePath)
179
+ : override.fallback;
180
+ this.managedSkillRoot = resolveAgentPath(spec, { homeDir: home, cwd: process.cwd(), env });
181
+ }
175
182
  configured = environment.settings.fields;
176
183
  for (const file of environment.configFiles)
177
184
  this.configs.push(configState(file.path, file.trust, this.trustWorkspaces));
178
185
  for (const root of environment.skillRoots) {
179
- this.inventories.push(skillInventory(root));
186
+ // Codex synchronizes .system itself, including on first use of a fresh profile.
187
+ this.inventories.push(skillInventory(root, root === this.managedSkillRoot));
180
188
  if (!existsSync(root))
181
189
  continue;
182
190
  for (const entry of readdirSync(root)) {
@@ -304,7 +312,7 @@ export class ExperimentSession {
304
312
  throw new Error(`Agent configuration changed: ${config.path}; no further calls.`);
305
313
  }
306
314
  for (const inventory of this.inventories)
307
- if (JSON.stringify(skillInventory(inventory.root)) !== JSON.stringify(inventory)) {
315
+ if (JSON.stringify(skillInventory(inventory.root, inventory.root === this.managedSkillRoot)) !== JSON.stringify(inventory)) {
308
316
  throw new Error(`Global Skill inventory changed: ${inventory.root}; no further calls.`);
309
317
  }
310
318
  }
package/docs/README.md CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  ## Choose your build
4
4
 
5
- These pages describe the **0.15.3 package and current source**; source guides use
5
+ These pages describe the **0.16.1 package and current source**; source guides use
6
6
  Node >=22, `npm run build` and `node dist/cli.js`. The pinned
7
- `npx skillfit@0.15.3` commands name the version these pages describe; the registry
7
+ `npx skillfit@0.16.1` commands name the version these pages describe; the registry
8
8
  is the source of truth for what is currently published. Superseded releases keep
9
9
  their own documentation: see the
10
10
  [0.13.1 documentation](https://github.com/remote-controlled-man/skillfit/tree/4eaefde80f7e8a6b1e01939d3bd8a8b6418b75d6/docs)
11
11
  and its [publication record](https://github.com/remote-controlled-man/skillfit/blob/3a3ff415ccef1a3a45d1e2d2cc00d903ab7db850/docs/releases/0.13.1.md).
12
12
  Standalone driver links and unshipped source references use the
13
- [reviewed source snapshot](https://github.com/remote-controlled-man/skillfit/tree/f506681edd0490a7690f2a96bd5b7e589f0bd5d0),
14
- the commit tag v0.15.0 names. Building that commit prints 0.15.0.
13
+ [reviewed source snapshot](https://github.com/remote-controlled-man/skillfit/tree/17772db9b2f112a1e25d0284a76cf38860f7790b),
14
+ which contains revision preparation and the startup fix before this release bump. Building that commit prints 0.16.0.
15
15
 
16
16
  ## Find your task
17
17
 
@@ -20,7 +20,7 @@ the commit tag v0.15.0 names. Building that commit prints 0.15.0.
20
20
  | Learn the complete workflow without model spending | [First evaluation](guides/first-real-eval.md) |
21
21
  | Prepare and validate your own cases | [Bench authoring](guides/bench-authoring.md) |
22
22
  | Plan/run an experiment, handle stops and retain/clean outputs | [Evaluation workflow](guides/experiment-workflow.md) |
23
- | Select Skills or move a Codex configuration | [Codex configuration](guides/selectable-codex.md) |
23
+ | Select Skills or move a Codex/Kimi configuration | [Agent configuration](guides/selectable-codex.md) |
24
24
  | Integrate JSON requests/results | [Component contract](reference/eval-component.md) |
25
25
  | Look up result fields, costs or replay formats | [Report reference](reference/evaluation-reports.md) |
26
26
  | Understand statistical verdicts and adoption limits | [Metrics protocol](reference/metrics.md) |
@@ -29,8 +29,8 @@ the commit tag v0.15.0 names. Building that commit prints 0.15.0.
29
29
 
30
30
  CLI `--help` owns flags; [Bench format](../benches/README.md) owns task files and
31
31
  claims. JSON schemas, executable examples and SVG assets remain under `schemas/`,
32
- `examples/` and `assets/`. Planned work is tracked in
33
- [GitHub milestones](https://github.com/remote-controlled-man/skillfit/milestones).
32
+ `examples/` and `assets/`. See [GitHub Issues](https://github.com/remote-controlled-man/skillfit/issues)
33
+ for public work.
34
34
 
35
35
  Retired pages, research files and earlier layouts stay in Git history:
36
36
  [documentation snapshot](https://github.com/remote-controlled-man/skillfit/tree/5696bfa32cf28a5fc11d8d5da237f5d070a3cf17/docs),
@@ -307,10 +307,35 @@ different negotiated protocol version, a missing tools capability, malformed res
307
307
  pagination cursors. It never calls a tool. This separates protocol or catalog defects from model
308
308
  behavior.
309
309
 
310
+ Current source can also select an existing JSON `mcpServers` entry in memory, without creating a secret-bearing probe file:
311
+
312
+ ```bash
313
+ node dist/cli.js mcp check --agent kimi-code --server my-server --dry-run
314
+ node dist/cli.js mcp check --agent kimi-code --server my-server --project --dry-run
315
+ ```
316
+
317
+ Selection uses the matrix-declared user configuration by default; `--project` selects the current project. Do not combine a probe-spec path with `--server`. Stdio `command`/`args`/`env`/`cwd` and HTTP `url`/`headers` are validated without writing the selected values to another file. Unknown fields, disabled entries, missing selections, incompatible transports and multiple matching source definitions fail before process or network effects. Native Codex TOML is not converted by a partial parser; use the explicit probe-spec route above. Doctor's existing TOML text scan still does not prove loading or connectivity.
318
+
319
+ Dry-run plans withhold argument values and HTTP query values. Live checks redact exact configured env/header values and URL credential/query values from retained stderr and thrown errors. This is not general secret recognition, and arbitrary server-generated or inherited secret text remains a residual risk. No selection, dry-run or live check edits the Agent configuration.
320
+
310
321
  The probe supports newline-delimited stdio and Streamable HTTP. Inspect the
311
322
  transport-specific plan before execution; discovery performs network I/O for an
312
323
  HTTP server. It never establishes tool effectiveness.
313
324
 
325
+ ### Apply a scoped JSON MCP entry
326
+
327
+ Current source supports transactional writes for JSON `mcpServers`, separately from connectivity checks. Use a validated probe spec to create/update one named entry, or remove a managed entry without a spec:
328
+
329
+ ```bash
330
+ node dist/cli.js mcp apply --agent kimi-code --server my-server --from ./my-server.probe.json --dry-run
331
+ node dist/cli.js mcp apply --agent kimi-code --server my-server --from ./my-server.probe.json --yes
332
+ node dist/cli.js mcp apply --agent kimi-code --server my-server --remove --dry-run
333
+ ```
334
+
335
+ `--from` and `--remove` are mutually exclusive; `--project` selects the current project instead of user scope. Plans show the action, target and scope without printing argument, env/header or URL query values. Application requires confirmation or `--yes`, preserves existing backups, verifies target bytes and updates the version-1 lock after content changes. Existing unmanaged or locally changed entries conflict; updates/removals require the current entry to match the managed fingerprint. Other configuration keys and unrelated servers remain intact.
336
+
337
+ JSON writes preserve unrelated semantic content, not necessarily original JSON whitespace. Native Codex TOML is refused rather than edited with a partial parser; no runtime dependency or general TOML editor is introduced. Applying a change performs no server startup, network connection, tool invocation or model call. Use the separate `mcp check` operation when connectivity is actually intended.
338
+
314
339
  ### Prepare the overlay
315
340
 
316
341
  Create a directory with this shape:
@@ -24,6 +24,24 @@ The 27 Lark Skills come from the official `larksuite/cli` repository. Selecting
24
24
 
25
25
  Each file is fetched by commit URL and checked against its SHA-256. A missing file, unexpected content, or invocation-policy mismatch aborts before any Codex configuration is written. The setup command does not call a model. Unmanaged or locally modified same-name Skills produce conflicts rather than silent replacement; previously managed, unchanged Skills can update with a backup. Review the listed paths and decide whether to keep your local edits; the installer never deletes those directories for you. Re-running with the same selection is idempotent.
26
26
 
27
+ ## Uninstall managed Skills and rules
28
+
29
+ Current source adds an explicit managed-uninstall operation for Skills and AGENTS.md rules. It uses the existing lockfile and matrix targets rather than arbitrary paths:
30
+
31
+ ```bash
32
+ node dist/cli.js uninstall --agent kimi-code --skill commit-message --dry-run
33
+ node dist/cli.js uninstall --agent codex --skill commit-message --yes
34
+ node dist/cli.js uninstall --agent kimi-code --rules --project --dry-run
35
+ ```
36
+
37
+ Select at least one `--skill` or `--rules`; user scope remains the default and `--project` selects the current project. Dry-run writes nothing. Application requires confirmation or `--yes`, verifies the result and updates the lockfile after the content changes.
38
+
39
+ A selected Skill must have a matching managed lock entry and unchanged content. Local edits, unexpected files, symlinks, missing records or a changed matrix target produce a conflict rather than deletion. Rules removal checks the managed block fingerprint and preserves all content outside the markers. A missing target only reconciles its lock entry and is not reported as a new deletion.
40
+
41
+ Managed Skills move to fresh hidden sibling recovery directories instead of being recursively deleted. Managed-only rules files have an equivalent recovery file. Recovery paths are reported and retained after success; they are never overwritten by a later operation. Restoring one is a separate manual decision and must not overwrite a new active target. Hidden recovery directories are not active Skill registrations.
42
+
43
+ No observed usage, a missing local history or an old last-seen date does not authorize automatic uninstall. This command does not remove MCP entries, plugins, credentials or arbitrary unmanaged files, and it makes no model call. Crash-atomic removal is not claimed; failure tests cover restoration after lock-write failure.
44
+
27
45
  ## What the evidence supports
28
46
 
29
47
  The 67 entries are a **source and installation catalog**, not a usefulness ranking. Pinning commits, checking hashes, and successfully installing a Skill establish provenance and integrity; they do not establish that the Skill improves an agent's work. Neither the legacy 13-Skill set nor the two skillfit-authored Skills has a paired efficacy result as a set or on the current Codex model.
@@ -43,7 +61,7 @@ The older [`bundle export`](selectable-codex.md) command remains available for s
43
61
 
44
62
  ## Portable bundles
45
63
 
46
- `skillfit bundle export` captures user-level Skills that Codex has used in at least two distinct local sessions and the active global guidance. It writes a self-contained profile directory with a Node.js installer. The export is a local copy of the files currently installed, so their contents stay fixed when upstream repositories change.
64
+ `skillfit bundle export` defaults to user-level Skills that Codex has used in at least two distinct local sessions and the active global guidance. Pass `--agent kimi-code` to use Kimi Code's user configuration instead. It writes a self-contained profile directory with a Node.js installer for that same Agent; it does not convert between Agent formats. The exported files stay fixed when upstream repositories change.
47
65
 
48
66
  ```bash
49
67
  skillfit bundle export ./personal-codex --dry-run
@@ -51,13 +69,26 @@ skillfit bundle export ./personal-codex --yes
51
69
  # transfer the personal-codex directory to the new machine
52
70
  node ./personal-codex/setup.mjs --dry-run
53
71
  node ./personal-codex/setup.mjs --yes
72
+ skillfit bundle export ./personal-kimi --agent kimi-code --skill example --mcp docs --dry-run
54
73
  ```
55
74
 
56
75
  The export includes `profile.json`, `rules/global.md`, each selected Skill directory with its scripts, references, licenses, and other regular files, plus `setup.mjs` and the dependency-free installer runtime. Installer backup and recovery files are omitted. The destination needs Node.js 22 or newer; skillfit does not need to be installed there. Running `node setup.mjs` without flags prints a plan and asks before writing. To choose a specific set instead of usage-based selection, repeat `--skill <name>`. To change the usage threshold, pass `--min-sessions <n>`. A dry run writes nothing. Export refuses an existing destination directory; choose a new name to keep previous snapshots intact. Skills with `agents/openai.yaml` policy `allow_implicit_invocation: false` stay in the bundle and are identified as user-invoked-only in the generated guidance.
57
76
 
77
+ Repeat `--mcp <name>` to include selected user-level JSON `mcpServers` declarations. Portable stdio entries cannot have arguments, environment values, an explicit working directory or timeout; HTTP entries cannot have headers, URL userinfo, query, fragment or explicit timeout. Unsupported fields and native Codex TOML are refused before the output is created. These structural limits avoid transferring declared credential fields; they are not general secret detection. Review commands, URLs, rules and Skill bodies before sharing. Installation plans all selected MCP entries together, preserves unrelated configuration, writes one merged JSON document and records each managed entry. Export and installation never start or contact the server.
78
+
79
+ ### Export shared symlinked Skills
80
+
81
+ Skill symlinks and nested links remain refused by default. If you deliberately share one canonical Skill library between Agents, repeat `--allow-symlink-root <dir>` for each precise source root you approve:
82
+
83
+ ```bash
84
+ skillfit bundle export ./personal-kimi-linked --agent kimi-code --skill example --allow-symlink-root "$HOME/.local/share/my-skills" --dry-run
85
+ ```
86
+
87
+ The approved root must be an existing directory, not your home or a filesystem root. A root Skill link must resolve inside an approved root. Every nested file or directory link must resolve inside both the selected canonical Skill and an approved root. Escapes, cycles, broken links and non-regular files fail before output creation. Planning records canonical regular-file paths; the exported bundle contains ordinary files, not symlinks or absolute links back to the source. Existing license, provenance and hash checks still apply. Omitting the flag preserves the original refusal behavior.
88
+
58
89
  ### Fetch reviewed upstream Skills on the new machine
59
90
 
60
- Pass `--upstream-lock` to select all GitHub Skills in that lock as commit-pinned source references, plus the lock's `localSkills`. The GitHub Skills need not already be installed on the exporting machine; local Skills are copied from it. Repeated `--skill <name>` flags add further local Skills. The lock lists every upstream file and its SHA-256; setup downloads directly from `raw.githubusercontent.com`, verifies each file and its invocation policy, prepares an isolated local profile, then runs the normal install planner. A missing file, policy conflict, or hash mismatch stops setup before any target file is changed. Setup supports `--dry-run`, `--strict`, and `--yes`. The dry run fetches and verifies upstream files but does not write to the Codex configuration.
91
+ Pass `--upstream-lock` to select all GitHub Skills in that lock as commit-pinned source references, plus the lock's `localSkills`. The GitHub Skills need not already be installed on the exporting machine; local Skills are copied from it. Repeated `--skill <name>` flags add further local Skills. The lock lists every upstream file and its SHA-256; setup downloads directly from `raw.githubusercontent.com`, verifies each file and its invocation policy, prepares an isolated local profile, then runs the normal install planner. A missing file, policy conflict, or hash mismatch stops setup before any target file is changed. Setup supports `--dry-run`, `--strict`, and `--yes`. The dry run fetches and verifies upstream files but does not write to the selected Agent configuration. Portable MCP files are retained during upstream preparation.
61
92
 
62
93
  ```bash
63
94
  skillfit bundle export ./personal-codex --upstream-lock ./profiles/codex-upstream-sources.json --dry-run
@@ -69,6 +100,6 @@ node ./personal-codex/setup.mjs --yes
69
100
 
70
101
  The included [Codex source lock](../../profiles/codex-upstream-sources.json) identifies 65 public Skills from their authors' GitHub repositories and two locally authored Skills. `edit-article` is pinned to its last available revision because it is absent from the current `mattpocock/skills` tree. The source lock is a reviewed version selection, not a request to follow a moving branch. Refreshing it requires checking the new files and hashes and evaluating affected Skills against suitable benches. For a smaller selection, use [selectable setup](selectable-codex.md). The portable profile still contains personal global guidance and locally authored Skills; review it before sharing.
71
102
 
72
- On installation, skillfit copies Skills to the Codex user skills directory from the [capability matrix](https://github.com/remote-controlled-man/skillfit/blob/ed5eaff7d222de1c73874ce022785fbe89291017/src/matrix/agents.json) and writes a managed block to the global `AGENTS.md`. It honors `CODEX_HOME` for global guidance and session history. An active `AGENTS.override.md` would shadow the result, so installation reports a conflict before writing. Existing content outside the managed block is preserved, and modified or extra Skill files cause a conflict instead of being overwritten or silently retained. Re-running the same install skips unchanged content.
103
+ On installation, skillfit copies Skills and writes a managed block to the global `AGENTS.md` at the selected Agent's [capability-matrix](https://github.com/remote-controlled-man/skillfit/blob/ed5eaff7d222de1c73874ce022785fbe89291017/src/matrix/agents.json) targets. Codex honors `CODEX_HOME` for global guidance and session history. An active Codex `AGENTS.override.md` would shadow the result, so installation reports a conflict before writing. Existing content outside the managed block is preserved, and modified or extra Skill files cause a conflict instead of being overwritten or silently retained. Unmanaged or changed MCP entries also block every profile write. Re-running the same install skips unchanged content.
73
104
 
74
- The bundle contains a copy of personal global instructions. Review `rules/global.md` and the Skill files before sharing or storing it in a public repository. The command exports regular user-level Skill directories from `~/.agents/skills` and from `$CODEX_HOME/skills` (default `~/.codex/skills`); it refuses symlinked Skills and files so the bundle cannot follow links outside the selected directory. It does not transfer plugin installations, plugin authentication, MCP connections, or system-bundled Skills. Install those through their own supported setup paths on the destination machine. A new Codex session is needed to check that the installed configuration is loaded.
105
+ The bundle contains a copy of personal global instructions. Review `rules/global.md` and the Skill files before sharing or storing it in a public repository. The command exports user-level Skill directories declared by the matrix; unapproved links cannot make the bundle read outside the selected Skill, while approved links are copied as ordinary files. It does not transfer plugin installations, authentication, session history, recovery copies, system-bundled Skills or live MCP connections. Install other requirements through their own supported setup paths on the destination machine. Start a new session to check that the installed configuration is loaded.
@@ -5,7 +5,7 @@ This page explains the current system, the boundaries between its modules and th
5
5
  contracts a change must preserve. It is not a runbook: commands and contributor
6
6
  setup live in [AGENTS.md](https://github.com/remote-controlled-man/skillfit/blob/main/AGENTS.md)
7
7
  and [CONTRIBUTING.md](https://github.com/remote-controlled-man/skillfit/blob/main/CONTRIBUTING.md),
8
- planned work lives in [GitHub milestones](https://github.com/remote-controlled-man/skillfit/milestones),
8
+ public work lives in [GitHub Issues](https://github.com/remote-controlled-man/skillfit/issues),
9
9
  statistical meaning lives in [metrics](../reference/metrics.md), and publication
10
10
  gates live in [the release procedure](releases.md).
11
11
  [Build/version availability](../README.md#choose-your-build) is separate.
@@ -7,6 +7,45 @@ formats and costs, and [metrics](metrics.md) owns statistical meaning.
7
7
  Use the [build/version entry](../README.md#choose-your-build) for availability.
8
8
  The component never installs or adopts a Skill automatically.
9
9
 
10
+ ## Prepare a first revision comparison
11
+
12
+ With npm 0.16.1 or a built checkout that lists `--prepare` in `eval --help`, start
13
+ from two complete versions of one Skill and a real fix commit, including its regression tests:
14
+
15
+ ```bash
16
+ skillfit eval ./skill-new --baseline-skill ./skill-old --prepare ./comparison --from-commit <fix-sha> --source-dir ./project --prompt-file ./issue.md --agent codex --dry-run
17
+ ```
18
+
19
+ Use the original issue-style request in `issue.md`; the fix commit's message is
20
+ kept out of the task prompt. Preview validates inputs and lists destination files
21
+ without writing or executing verifier/oracle/model commands. Remove `--dry-run`
22
+ and use `--yes` (or confirm interactively) to create the workspace and run its
23
+ trusted local checks. `--verifier-cmd` defaults to `node --test`; it is retained
24
+ and run with a shell on future checks/evaluations. `--include` narrows the fixture
25
+ to repository directories using the existing commit import limits.
26
+
27
+ The fresh workspace contains complete `skills/old` and `skills/new` snapshots, a
28
+ commit-derived `bench` and `request.json`. Existing destinations, even empty ones,
29
+ are refused. A write failure removes only the newly created workspace. A failed
30
+ integrity gate instead returns `blocked` and retains inputs for inspection.
31
+ Preparation requires no model call and does not change agent configuration.
32
+
33
+ The request defaults to one balanced development pair (two task invocations),
34
+ the existing 600-second executor deadline and unchanged adoption policy. Optional
35
+ `--spending-budget <file>` and `--executor-timeout-seconds <n|none>` are copied into
36
+ the request after validation. No token cap is implied when the budget is omitted.
37
+ This small run cannot authorize adoption. Inspect the returned next commands:
38
+
39
+ ```bash
40
+ skillfit eval --request ./comparison/request.json --dry-run
41
+ skillfit eval --request ./comparison/request.json --plan-sha <sha256-from-preview>
42
+ ```
43
+
44
+ Run only within authorized spending. The separate evaluation preview checks the
45
+ agent environment; a ready workspace does not establish authentication or isolate
46
+ inherited global Skills/rules/MCP. For an already authored bench or larger
47
+ independent validation, use the request contract below. This preparation entry is included in npm 0.16.1; earlier packages do not provide it.
48
+
10
49
  ## Input and execution
11
50
 
12
51
  Save `request.json` outside the evaluated Skill directories. All paths resolve
@@ -262,12 +301,12 @@ After editing CLI definitions, build and regenerate with
262
301
  <!-- cli-reference:start -->
263
302
  | CLI option | Help description |
264
303
  | --- | --- |
265
- | `--agent <id>` | Target agent: claude-code \| codex \| kimi-code (default: all detected) |
304
+ | `--agent <id>` | Target/source agent: claude-code \| codex \| kimi-code (default: detected; bundle: codex) |
266
305
  | `--mode <mode>` | Eval mode: inject (default) \| installed (paired complete Skill) \| trigger (single arm) |
267
306
  | `--baseline-skill <path>` | With --mode installed, compare a previous Skill version against the target |
268
307
  | `--request <path>` | Version 1 Skill revision request (JSON output; excludes positional eval options) |
269
308
  | `--plan-sha <hash>` | Confirm an eval/calibration/self-test dry-run plan (also needs --run-group) |
270
- | `--json` | Machine output for bench check/self-test/list/show/edit/remove, report, eval and calibration |
309
+ | `--json` | Machine output for doctor, bench check/self-test/list/show/edit/remove, report, eval and calibration |
271
310
  | `--bench <path>` | Bench directory for eval (default: bundled benches) |
272
311
  | `--task <id>` | With eval/calibration, select cases (repeatable, manifest order); requests use taskIds |
273
312
  | `--trials <n>` | Repetitions per condition for eval (integer 1–20; default: 5) |
@@ -426,7 +426,9 @@ bench, selected task order and native/reviewed plans, and scope without its
426
426
  required sealed declarations fails rather than taking the historical recovery
427
427
  route. Legacy missing metadata stays unrecorded. Current-reader audit and the
428
428
  package's pinned `reproduce.mjs` each interpret saved evidence with their own
429
- runtime.
429
+ runtime. Paired replay preserves each trial's `condition/trial-N` parent layout in
430
+ its disposable copy, so a verifier that derives the arm from the run directory
431
+ observes the same condition as during native execution.
430
432
 
431
433
  For [self-test controls](../guides/bench-authoring.md#test-known-controls), export a native
432
434
  suite directory, not its wrapper. It retains a null requested claim, mock identity,
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/remote-controlled-man/skillfit/blob/main/docs/schemas/doctor-report.schema.json",
4
+ "title": "skillfit read-only doctor report v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "homeDir", "cwd", "detection", "health", "summary"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "skillfit.doctor-report" },
11
+ "homeDir": { "type": "string" },
12
+ "cwd": { "type": "string" },
13
+ "detection": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["id", "displayName", "detected", "evidence"],
19
+ "properties": {
20
+ "id": { "type": "string" },
21
+ "displayName": { "type": "string" },
22
+ "detected": { "type": "boolean" },
23
+ "evidence": { "type": "array", "items": { "type": "string" } }
24
+ }
25
+ }
26
+ },
27
+ "health": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": ["id", "displayName", "detected", "sections"],
33
+ "properties": {
34
+ "id": { "type": "string" },
35
+ "displayName": { "type": "string" },
36
+ "detected": { "type": "boolean" },
37
+ "sections": {
38
+ "type": "array",
39
+ "items": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["title", "checks"],
43
+ "properties": {
44
+ "title": { "enum": ["Rules", "Skills", "MCP"] },
45
+ "checks": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": ["status", "message"],
51
+ "properties": {
52
+ "status": { "enum": ["PASS", "WARN", "FAIL", "INFO"] },
53
+ "message": { "type": "string" }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ },
63
+ "summary": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["agents", "checks"],
67
+ "properties": {
68
+ "agents": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["detected", "total"],
72
+ "properties": {
73
+ "detected": { "type": "integer", "minimum": 0 },
74
+ "total": { "type": "integer", "minimum": 1 }
75
+ }
76
+ },
77
+ "checks": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["total", "PASS", "WARN", "FAIL", "INFO"],
81
+ "properties": {
82
+ "total": { "type": "integer", "minimum": 0 },
83
+ "PASS": { "type": "integer", "minimum": 0 },
84
+ "WARN": { "type": "integer", "minimum": 0 },
85
+ "FAIL": { "type": "integer", "minimum": 0 },
86
+ "INFO": { "type": "integer", "minimum": 0 }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillfit",
3
- "version": "0.15.3",
3
+ "version": "0.16.1",
4
4
  "description": "A/B testing for agent configuration: paired evaluation of Skills, rules and MCP setups, with deterministic verifiers and replayable evidence.",
5
5
  "type": "module",
6
6
  "bin": {