@uniqbit/mate-core 1.0.1-canary.0 → 1.0.1-canary.2

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.
Files changed (45) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/cli/commands/artifact/finish/command.ts +18 -6
  4. package/src/cli/commands/artifact/finish/engine.ts +3 -1
  5. package/src/cli/commands/artifact/finish/git.ts +4 -2
  6. package/src/cli/commands/artifact/pending/discovery.ts +2 -2
  7. package/src/cli/commands/companion/link-refresh-report.ts +19 -0
  8. package/src/cli/commands/companion/link.ts +3 -2
  9. package/src/cli/commands/companion/sync.ts +25 -1
  10. package/src/cli/commands/companion/update.ts +1 -17
  11. package/src/cli/commands/plugin/plugin.ts +6 -1
  12. package/src/cli/commands/vscode/release-vsix.json +2 -2
  13. package/src/cli/main.ts +12 -2
  14. package/src/hooks/validate-artifact-path.ts +140 -22
  15. package/src/lib/delivery/record-delivery.ts +14 -0
  16. package/src/lib/delivery/staging/apply-chain.ts +61 -31
  17. package/src/lib/delivery/staging/pending.ts +13 -0
  18. package/src/lib/delivery/staging/project.ts +22 -6
  19. package/src/lib/delivery/staging/publish.ts +10 -11
  20. package/src/lib/delivery/staging/submit.ts +2 -8
  21. package/src/lib/orchestrator/companion-git-sync.ts +53 -24
  22. package/src/lib/orchestrator/projection-claude-skills.ts +13 -2
  23. package/src/lib/orchestrator/refresh-working-claude-links.ts +48 -30
  24. package/src/lib/workset/worktree.ts +1 -0
  25. package/src/opencode/companion-hooks.ts +3 -1
  26. package/src/runtime/artifact-refusal.ts +17 -7
  27. package/src/runtime/companion-guidance.ts +2 -2
  28. package/src/runtime/companion-sync.ts +24 -3
  29. package/src/runtime/shell-heredoc.ts +70 -28
  30. package/src/runtime/shell-variables.ts +257 -0
  31. package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +5 -0
  32. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +7 -0
  33. package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +20 -2
  34. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -2
  35. package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +6 -6
  36. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +4 -4
  37. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -2
  38. package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +6 -6
  39. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +4 -4
  40. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +30 -30
  41. package/src/tools/setup/capabilities/openspec.ts +3 -1
  42. package/src/tools/setup/capabilities/tokensave.ts +8 -1
  43. package/src/tools/setup/dynamic-plugins/verify.ts +1 -2
  44. package/src/tools/setup/mate.ts +2 -1
  45. package/src/tools/setup.ts +22 -1
@@ -164,7 +164,7 @@ A drifted spec is published in its own right. It is never shipped by republishin
164
164
  - `branch-deleted` → the branch is gone on the remote and no default-branch commit contains its head, so it was most likely closed without merging. Ask once per branch whether to drop its changes. Only after the user agrees, drop each submitted change with `mate artifact submit --drop "<name>" --json` (a legacy archive: `--confirm-dropped`, then offer the Git restore below). When the user says it was merged after all, record `--confirm-merged`.
165
165
  - `likely-merged` → local Git found the branch's changes on the default branch only by patch identity (a `squash` or `rebase` merge, on Git before 2.38), or found its head on the default branch's own line (`fast-forward`). That is evidence, not proof. Name `suggestion.style` and the short `suggestion.commit`, then ask the **merge question** with **merged** preselected; record it only after the user confirms.
166
166
  - `empty-branch` → the branch has no commits of its own. Say so; ask the **merge question** with **not yet merged** preselected; never preselect merged.
167
- - `not-on-default` → the branch head is not on the default branch as of the last fetch. With `fetch.branchUnpushed`, say it was never pushed. When the outcome's `fetch.branchDeleted` is true, the branch is deleted on the remote and this machine holds no copy to check (typical after a squash merge someone else delivered): say so and ask the **merge question** directly. When the outcome has no `fetch` field (Mate did not fetch), show `fetchedAt` (or "never fetched") and offer one fetch first; only after the user agrees, re-run `mate artifact link "<anchor>" "<anchor>" --refresh --fetch --json` and use its outcomes. Otherwise, or when the user declines, ask the **merge question**.
167
+ - `not-on-default` → the branch head is not on the default branch as of the last fetch. With `fetch.branchUnpushed`, say it was never pushed. When the outcome's `fetch.branchDeleted` is true, the branch is deleted on the remote and this machine holds no copy to check (typical after a squash merge someone else delivered): say so and ask the **merge question** directly. When the outcome has no `fetch` field (Mate did not fetch), show `fetchedAt` (or "never fetched") and offer one fetch first; only after the user agrees, run `link "<change>" --refresh --fetch --json` for one change of the group, then `publish '<group>' --refresh --json` (a legacy archive: only `link "<anchor>" "<anchor>" --refresh --fetch --json`), and use the new outcomes; never `publish --fetch`. Otherwise, or when the user declines, ask the **merge question**.
168
168
  - `direct` → a direct delivery is never settled automatically: Git cannot tell this change's commits from the user's other pushes. Ask the **direct-delivery question** below.
169
169
 
170
170
  **The merge question** offers exactly three answers, asked once per branch and applied to every change on it (with `mate artifact publish '<group>' …` for a submitted group):
@@ -189,7 +189,7 @@ A drifted spec is published in its own right. It is never shipped by republishin
189
189
 
190
190
  3. **Present both sections as Markdown tables, each under its own headline.** **Scope to the user's own work by default:** list only Delivery Groups holding at least one change whose `origin` is `yours`, every legacy archive (they are this checkout's), and every drifted spec (this checkout's edits). A shown group keeps every change it holds, since a group publishes together. Leave out every other group, and say in one line above the tables how many groups of others are not shown and that asking for all shows them. Show every group only when the user explicitly asks for all, for everyone's, or names a group, change, or person that is not theirs; that scope then holds for the rest of the run. Open with a one-line **To push** summary naming how many pending changes and how many drifted specs are outstanding, then head the tables **Pending changes** and **Drifted specs** so the two publication units are never read as one list. Number both sections in **one continuous sequence**, so every number in the turn is unique and any number is a valid selection.
191
191
 
192
- The pending table has **one row per Delivery Group**, then one row per legacy archive. A row carries a leading `#`, then `Group` (the Delivery Group, or `legacy (this checkout only)` for a legacy archive), `Changes` (every change the group holds, joined with `+`, each marked `(yours)` when `origin` is `yours`, else `(<author>)` with its `author`, or `(others)` without one; the anchor for a legacy archive), a `Ships` column, and a `Delivery` column. `Ships` is the exact payload known: for a submitted change its folder `openspec/changes/<name>/`, archived at publication with the canonical specs its delta specs name; for a legacy archive its `uncommittedPaths` folders first, then every `uncommittedSpecChanges` item rendered as `[kind] path` with `kind` the exact `new` or `modified` value from the JSON. Join several values in one cell with `+` — a Markdown cell is one line, so `+` is the multi-value separator, never a line break.
192
+ The pending table has **one row per Delivery Group**, then one row per legacy archive. A row carries a leading `#`, then `Group` (the Delivery Group, or `legacy (this checkout only)` for a legacy archive), `Changes` (every change the group holds, joined with `+`, each marked `(yours)` when `origin` is `yours`, else `(<author>)` with its `author`, or `(others)` without one; the anchor for a legacy archive), a `Ships` column, and a `Delivery` column. `Ships` is the exact payload known: for a submitted change its folder `openspec/changes/<name>/`, archived at publication with the canonical specs its delta specs name; for a legacy archive its `uncommittedPaths` folders first, then every `uncommittedSpecChanges` item rendered as `[kind] path` with `kind` the exact `new`, `modified` or `deleted` value from the JSON. Join several values in one cell with `+` — a Markdown cell is one line, so `+` is the multi-value separator, never a line break.
193
193
 
194
194
  `Delivery` shows `merged`, `not applicable`, or `legacy — merge not checked` for a selectable row; a group is selectable only when `publishable` is true. A held-back row stays in **Pending changes** — never under a third headline — with `—` instead of a number and `waiting for merge` in `Delivery`, followed by each unsettled branch and its PR link when known (`dropped` instead when the branch was closed without merging), or `held: depends on <heldBy>` for a group held by an unpublished dependency. It is never part of the numbered sequence. For a selectable group whose `merges` hold an entry with `yours: false`, add whose claim the merge is: `merged — answered by <recordedBy>, not checked by Git` for `source: "user"`, `merged — found by Git on <recordedBy>'s machine` for `source: "git"` (`someone else` without `recordedBy`). The inbox takes any teammate's push, so this names the claim the publication rests on; the user decides whether to take it by selecting the group. Number a `needsRefresh` group, `Delivery` reading `merged — found by Git on this machine` if a change has `found`, else `dependency's merge found by Git`. Under the table, say that naming a waiting group checks its merge and publishes it if merged, name `mergeCheck.unchecked` changes as unchecked, and relay its `warning`. When `submitted.stale` is true, say above the table that the submitted groups are as last fetched at `submitted.fetchedAt`. A group with `blocked` true keeps its number and shows `blocked: <change>: <reason>` in `Delivery`; under the table, say that publishing it again shows the conflict to resolve, from any machine.
195
195
 
@@ -21,11 +21,11 @@ A legacy archive owns two paths outright:
21
21
 
22
22
  An archive is pending while either is uncommitted (an active directory that exists again is a new change of that name and does not count), and `uncommittedPaths` names the owned archive or active-change folders that contain the uncommitted content. Canonical specs under `openspec/specs/<capability>/...` are deliberately **not** part of that test: a canonical spec is shared by every change that ever amended it, so treating a dirty spec as a trigger would resurrect long-published changes whose own files are committed. A pending entry still reports the uncommitted canonical specs its deltas applied to, in `uncommittedSpecs`, because they are the rest of its publication scope. A legacy archive is publishable from this checkout only.
23
23
 
24
- `uncommittedSpecChanges` parallels `uncommittedSpecs` with `{ path, kind }` objects. `kind` is `new` for an untracked or newly added spec and `modified` for a tracked spec with working-tree changes. Use this metadata for display; do not infer it from the path.
24
+ `uncommittedSpecChanges` parallels `uncommittedSpecs` with `{ path, kind }` objects. `kind` is `new` for an untracked or newly added spec, `deleted` for a spec deleted in the working tree or index, and `modified` for any other tracked spec with changes. Use this metadata for display; do not infer it from the path.
25
25
 
26
26
  ### Drifted specs
27
27
 
28
- `unattributedSpecs` collects uncommitted canonical specs that no pending change accounts for — the **drifted** specs. Each entry carries its `path`, its own working-tree `kind` (`new` or `modified`), and a `touchedByArchives` list naming every archive whose delta specs include that canonical spec, with that archive's `anchor` and commit `state`, ordered oldest anchor first. `kind` describes the spec and `state` describes the archive; an entry is uncommitted regardless of what `state` says.
28
+ `unattributedSpecs` collects uncommitted canonical specs that no pending change accounts for — the **drifted** specs. Each entry carries its `path`, its own working-tree `kind` (`new`, `modified` or `deleted`), and a `touchedByArchives` list naming every archive whose delta specs include that canonical spec, with that archive's `anchor` and commit `state`, ordered oldest anchor first. `kind` describes the spec and `state` describes the archive; an entry is uncommitted regardless of what `state` says.
29
29
 
30
30
  Every drifted spec is publishable on its own, through `--specs` — see [Spec Publications](#spec-publications). `touchedByArchives` does not gate that: it is provenance, reported so a reader can see which change once touched the spec. An empty list means no archive ever mentioned it, which changes nothing about whether it can ship.
31
31
 
@@ -134,7 +134,7 @@ Always invoke with `--json` and parse the single JSON line the command prints:
134
134
  - `commit` is the published commit: the group's, or the local publication commit.
135
135
  - `group`, `changes` and `anchors` name the Delivery Group a change publication published or held, its submitted changes in publication order, and the archives they became.
136
136
  - `dependencies` lists results of other groups published first in the same run.
137
- - `conflict` (`change`, `capability`, `requirement`, `base`, `ours`, `theirs`) and `blocked` describe a stale requirement; see below.
137
+ - `conflicts` lists every stale requirement of the failing change, each with `change`, `capability`, `requirement`, `base`, `ours` and `theirs`; `conflict` is its first entry. `blocked` says the conflict is recorded; see below.
138
138
  - `resumed` is true when this same publication was already committed or pushed and is being retried.
139
139
 
140
140
  Under `--all` the output is a JSON array of these objects rather than one object. Every other invocation emits a single object.
@@ -190,9 +190,9 @@ If `status` is `conflict`, do **not** rerun `mate artifact publish` for that tar
190
190
 
191
191
  ### A group conflict (`step: "publish"`)
192
192
 
193
- Publication applies each change's delta specs on the current default branch, so requirements other changes added beside it never conflict. When a requirement a change modifies, removes or renames changed on the default branch since its delta was written, publication stops with a conflict instead of merging the two edits: a clean text merge is no proof they agree, and nobody reviews a publication. `message` names the change, the capability and the requirement, and `conflictedPaths` the canonical spec. Nothing was pushed, the submitted folders are unchanged, and this checkout was not touched. The block is recorded in the change's `delivery.yaml` on the pending branch (`blocked: true`), so pending shows it to everyone until it is submitted again, resolved, or published.
193
+ Publication applies each change's delta specs on the current default branch, so requirements other changes added beside it never conflict. When a requirement a change modifies, removes or renames changed on the default branch since its delta was written, publication stops with a conflict instead of merging the two edits: a clean text merge is no proof they agree, and nobody reviews a publication. `message` names the change and every stale requirement with its capability, then the remedy; `conflictedPaths` names the canonical specs. Nothing was pushed, the submitted folders are unchanged, and this checkout was not touched. The block is recorded in the change's `delivery.yaml` on the pending branch (`blocked: true`), so pending shows it to everyone until it is submitted again, resolved, or published.
194
194
 
195
- When the result carries `conflict` (`change`, `capability`, `requirement`, and the texts `base`, `ours`, `theirs`), resolve it from this machine, whichever machine submitted it:
195
+ Follow the remedy `message` gives. Offer submitting the change again unchanged only when the message offers it. When it gives a `mate artifact resolve` command, resolve every requirement it names there, in one call, from this machine, whichever machine submitted it, taking each one's texts from `conflicts`:
196
196
 
197
197
  1. Show the three versions: the requirement as the delta was written against it (`base`), the change's (`ours`) and the default branch's (`theirs`).
198
198
  2. Propose one text that keeps both changes, or say plainly that they contradict and ask which wins. Never drop a sentence or scenario either side added without saying so.
@@ -200,7 +200,7 @@ When the result carries `conflict` (`change`, `capability`, `requirement`, and t
200
200
  4. When `resolve` answers `refused` with `unresolved`, other requirements the change would overwrite changed on the default branch too; the new delta base would hide them, so it resolves all of them in one call or none. Publish the group again to get each one's versions only when the result lacks them, resolve each with the user as above, then pass one `--capability --requirement --file` triple per requirement, in one call, quoted the same way: `mate artifact resolve '<change>' --capability '<c1>' --requirement '<r1>' --file '<f1>' --capability '<c2>' --requirement '<r2>' --file '<f2>' --json`.
201
201
  5. Publish the group again.
202
202
 
203
- When `ours` or `theirs` is null (a removed or renamed requirement), or a delta no longer applies, `resolve` refuses: the fix belongs in that change's delta spec. Update it in the change folder (on the machine that holds it, or after pulling the submitted folder), run `mate-submit-change` for it again, then publish again. Ask the user before editing a delta. To keep a removal or rename as it is, the user confirms it and the change is submitted again unchanged, by name: that accepts the conflict, takes the default tip as delta base and clears the block, unless the change would overwrite another requirement that changed, which `resolve` handles. Never edit a submitted folder on the pending branch by hand; `resolve` and submit are its only writers.
203
+ A requirement the change removes or only renames needs no triple: the `resolve` call accepts it with the rest, as the message says. When the message asks to fix the delta instead, the fix belongs in that change's delta spec. Update it in the change folder (on the machine that holds it, or after pulling the submitted folder), run `mate-submit-change` for it again, then publish again. Ask the user before editing a delta. When the message offers submitting the change again unchanged, the user may confirm that instead: submitted again by name, it accepts the conflict, takes the default tip as delta base and clears the block. Never edit a submitted folder on the pending branch by hand; `resolve` and submit are its only writers.
204
204
 
205
205
  After applying every change, publication validates each canonical spec that changed (`openspec validate <capability> --type spec`, errors only; warnings never block). A failure is also a `conflict`: `message` names the spec and the validation error, and `conflictedPaths` the spec. Nothing was pushed. Fix it the same way, in the delta spec of the change that produced it, then submit again and publish again.
206
206
 
@@ -75,10 +75,10 @@ it with `mate workflow done <skill> "<change-name>"`; otherwise name it above th
75
75
  explicitly confirms a direct delivery;
76
76
  - `--not-applicable "<reason>"` — for a specification-only change;
77
77
  - `--skip-branch` — when the user skips the question; publication will ask again.
78
- - `failed` → no state changed. Report the `message`: a failed check
79
- (`reason` `check-failed`, typically a validation error) or a failed push. For
80
- `secret`, report each finding's path, line and rule, never a value. Re-running
81
- submit retries; an unchanged resubmit adds no commit.
78
+ - `failed` → no state changed. Report the `message` with its remedy as given: a
79
+ failed check (`reason` `check-failed`, typically a validation error) or a failed
80
+ push. For `secret`, report each finding's path, line and rule, never a value.
81
+ Re-running submit retries; an unchanged resubmit adds no commit.
82
82
 
83
83
  A non-zero exit without a result is a refusal; report its message. When it names
84
84
  uncommitted changes, the branch counts or is suggested as merged while its work tree
@@ -4902,7 +4902,7 @@ exports[`runtime surface golden fixtures setup react-doctor × claude 1`] = `
4902
4902
  },
4903
4903
  },
4904
4904
  "claudeSkills": {
4905
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
4905
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
4906
4906
  "mate-react-doctor/references/explain.md": "86754a7e5436",
4907
4907
  },
4908
4908
  "opencodeConfig": null,
@@ -5277,7 +5277,7 @@ exports[`runtime surface golden fixtures setup react-doctor × opencode 1`] = `
5277
5277
  "opencodeSkills": {},
5278
5278
  "opencodeTui": null,
5279
5279
  "sharedSkills": {
5280
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
5280
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
5281
5281
  "mate-react-doctor/references/explain.md": "86754a7e5436",
5282
5282
  },
5283
5283
  }
@@ -5651,7 +5651,7 @@ exports[`runtime surface golden fixtures setup react-doctor × claude+opencode 1
5651
5651
  },
5652
5652
  },
5653
5653
  "claudeSkills": {
5654
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
5654
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
5655
5655
  "mate-react-doctor/references/explain.md": "86754a7e5436",
5656
5656
  },
5657
5657
  "opencodeConfig": {
@@ -5675,7 +5675,7 @@ exports[`runtime surface golden fixtures setup react-doctor × claude+opencode 1
5675
5675
  "opencodeSkills": {},
5676
5676
  "opencodeTui": null,
5677
5677
  "sharedSkills": {
5678
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
5678
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
5679
5679
  "mate-react-doctor/references/explain.md": "86754a7e5436",
5680
5680
  },
5681
5681
  }
@@ -6399,11 +6399,11 @@ exports[`runtime surface golden fixtures setup openspec × claude 1`] = `
6399
6399
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
6400
6400
  "mate-propose-change/references/openspec-propose.md": "dbd00207ffa4",
6401
6401
  "mate-propose-change/references/openspec-update-change.md": "0b0f6dee9f1e",
6402
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
6403
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
6402
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
6403
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
6404
6404
  "mate-show-me/SKILL.md": "263dceace1b6",
6405
6405
  "mate-simplify-code/SKILL.md": "ede560857729",
6406
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
6406
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
6407
6407
  },
6408
6408
  "opencodeConfig": null,
6409
6409
  "opencodePlugins": {},
@@ -6445,7 +6445,7 @@ exports[`runtime surface golden fixtures setup openspec × claude 2`] = `
6445
6445
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: <wrapper-bin>/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
6446
6446
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
6447
6447
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
6448
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
6448
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
6449
6449
  </mandatory-rules>
6450
6450
  </companion-policy>"
6451
6451
  ,
@@ -6815,11 +6815,11 @@ exports[`runtime surface golden fixtures setup openspec × opencode 1`] = `
6815
6815
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
6816
6816
  "mate-propose-change/references/openspec-propose.md": "c1f1d1291283",
6817
6817
  "mate-propose-change/references/openspec-update-change.md": "098ef729c37f",
6818
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
6819
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
6818
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
6819
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
6820
6820
  "mate-show-me/SKILL.md": "263dceace1b6",
6821
6821
  "mate-simplify-code/SKILL.md": "ede560857729",
6822
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
6822
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
6823
6823
  },
6824
6824
  }
6825
6825
  `;
@@ -6861,7 +6861,7 @@ exports[`runtime surface golden fixtures setup openspec × opencode 2`] = `
6861
6861
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: $MATE_WRAPPER_BIN_PATH/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
6862
6862
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
6863
6863
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
6864
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
6864
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
6865
6865
  </mandatory-rules>
6866
6866
  </companion-policy>"
6867
6867
  ,
@@ -7230,11 +7230,11 @@ exports[`runtime surface golden fixtures setup openspec × claude+opencode 1`] =
7230
7230
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
7231
7231
  "mate-propose-change/references/openspec-propose.md": "dbd00207ffa4",
7232
7232
  "mate-propose-change/references/openspec-update-change.md": "0b0f6dee9f1e",
7233
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
7234
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
7233
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
7234
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
7235
7235
  "mate-show-me/SKILL.md": "263dceace1b6",
7236
7236
  "mate-simplify-code/SKILL.md": "ede560857729",
7237
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
7237
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
7238
7238
  },
7239
7239
  "opencodeConfig": {
7240
7240
  "$schema": "https://opencode.ai/config.json",
@@ -7277,11 +7277,11 @@ exports[`runtime surface golden fixtures setup openspec × claude+opencode 1`] =
7277
7277
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
7278
7278
  "mate-propose-change/references/openspec-propose.md": "c1f1d1291283",
7279
7279
  "mate-propose-change/references/openspec-update-change.md": "098ef729c37f",
7280
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
7281
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
7280
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
7281
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
7282
7282
  "mate-show-me/SKILL.md": "263dceace1b6",
7283
7283
  "mate-simplify-code/SKILL.md": "ede560857729",
7284
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
7284
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
7285
7285
  },
7286
7286
  }
7287
7287
  `;
@@ -7318,7 +7318,7 @@ exports[`runtime surface golden fixtures setup openspec × claude+opencode 2`] =
7318
7318
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: <wrapper-bin>/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
7319
7319
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
7320
7320
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
7321
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
7321
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
7322
7322
  </mandatory-rules>
7323
7323
  </companion-policy>"
7324
7324
  ,
@@ -7365,7 +7365,7 @@ exports[`runtime surface golden fixtures setup openspec × claude+opencode 2`] =
7365
7365
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: $MATE_WRAPPER_BIN_PATH/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
7366
7366
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
7367
7367
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
7368
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
7368
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
7369
7369
  </mandatory-rules>
7370
7370
  </companion-policy>"
7371
7371
  ,
@@ -8114,13 +8114,13 @@ Write chunks to $GRAPHIFY_OUT and read $GRAPHIFY_OUT later.
8114
8114
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
8115
8115
  "mate-propose-change/references/openspec-propose.md": "dbd00207ffa4",
8116
8116
  "mate-propose-change/references/openspec-update-change.md": "0b0f6dee9f1e",
8117
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
8118
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
8119
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
8117
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
8118
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
8119
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
8120
8120
  "mate-react-doctor/references/explain.md": "86754a7e5436",
8121
8121
  "mate-show-me/SKILL.md": "263dceace1b6",
8122
8122
  "mate-simplify-code/SKILL.md": "ede560857729",
8123
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
8123
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
8124
8124
  },
8125
8125
  "opencodeConfig": {
8126
8126
  "$schema": "https://opencode.ai/config.json",
@@ -8199,13 +8199,13 @@ Write chunks to $GRAPHIFY_OUT and read $GRAPHIFY_OUT later.
8199
8199
  "mate-propose-change/references/mate-revise.md": "1f90002ee95d",
8200
8200
  "mate-propose-change/references/openspec-propose.md": "c1f1d1291283",
8201
8201
  "mate-propose-change/references/openspec-update-change.md": "098ef729c37f",
8202
- "mate-publish-artifact/SKILL.md": "2cf1844c8b5e",
8203
- "mate-publish-artifact/references/openspec.md": "83196c70960c",
8204
- "mate-react-doctor/SKILL.md": "ec2ac7fb877c",
8202
+ "mate-publish-artifact/SKILL.md": "5396b54264fe",
8203
+ "mate-publish-artifact/references/openspec.md": "cae3bd6eb49f",
8204
+ "mate-react-doctor/SKILL.md": "ffdd51d7ec87",
8205
8205
  "mate-react-doctor/references/explain.md": "86754a7e5436",
8206
8206
  "mate-show-me/SKILL.md": "263dceace1b6",
8207
8207
  "mate-simplify-code/SKILL.md": "ede560857729",
8208
- "mate-submit-change/SKILL.md": "97ce8f1dc43d",
8208
+ "mate-submit-change/SKILL.md": "b4bf3b8f4673",
8209
8209
  },
8210
8210
  }
8211
8211
  `;
@@ -8242,7 +8242,7 @@ exports[`runtime surface golden fixtures setup all capabilities × claude+openco
8242
8242
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: <wrapper-bin>/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
8243
8243
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
8244
8244
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
8245
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
8245
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
8246
8246
  </mandatory-rules>
8247
8247
  </companion-policy>
8248
8248
 
@@ -8313,7 +8313,7 @@ exports[`runtime surface golden fixtures setup all capabilities × claude+openco
8313
8313
  <rule id="wrapper-only-cli-execution" severity="critical">For every CLI declared in cli-tools, invoke the exact path in its invokeAs attribute. Correct: $MATE_WRAPPER_BIN_PATH/openspec status ... . Incorrect: openspec status ... . Do not run bare openspec or graphify commands and do not rely on PATH, aliases, or shell functions. If the exact wrapper path is unavailable, stop and report it.</rule>
8314
8314
  <rule id="secret-handling" severity="critical">Never read, print, copy, or write secret files (.env, .env.*, keys, certificates, credential files such as .npmrc or .netrc) or secret values. To learn which variables exist, read only the example files (.env.example, .env.sample, .env.template, .env.dist). Refer to a secret by its variable name only. Do not print environment variables that may hold secrets. When a secret must be set or rotated, ask the user to do it instead of writing it yourself. Guarded calls are blocked; the companion's framework.yaml secrets block is the user's switch, not yours.</rule>
8315
8315
  <rule id="openspec-scope" severity="critical">In OpenSpec, the frontmatter repository identifies the Working Repository; areas are repository-relative paths within that repository. Canonical specs use repository plus flat areas; change artifacts use paired scopes entries. In a monorepo, an Area normally stops at the package root. A cross-repository change may declare multiple scopes, but each resulting spec remains owned by one repository, and each requirement must bind its Area explicitly.</rule>
8316
- <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
8316
+ <rule id="openspec-publish" severity="critical">Submit publishes nothing: it pushes an OpenSpec change folder (state: submitted) to the inbox mate/inbox to await its merge. A submitted change is not the truth: only publication lands it on the companion's default branch. An active change folder under openspec/changes/ stays uncommitted until publication; never commit one by hand. openspec/specs/ is current; mate artifact project "<name>" shows the unpublished outcome. mate artifact pending --json --no-merge-check lists them with author, touched requirements, ref and path; read one (git show <ref>:<path>/<file>) only where it touches your work or the user names it; implement or revise one only when the user names it: mate artifact take "<name>" brings it into the checkout when it is missing there, then resubmit it with mate-submit-change. Publish only through mate-publish-artifact (mate artifact publish "<name>" --json), after the user selects and confirms the commit and push, for a Delivery Group whose delivery branch is merged. It creates no tag. Never hand-commit or hand-tag one. Publish archives submitted changes and never submits: submitting is a precondition (mate-submit-change, before the merge).</rule>
8317
8317
  </mandatory-rules>
8318
8318
  </companion-policy>"
8319
8319
  ,
@@ -47,6 +47,8 @@ const UNPERMITTED_MATE_SKILLS: ReadonlySet<string> = new Set(["mate-create-repor
47
47
  /** Written by the OpenSpec `agents` tool beside its skills in the shared root. */
48
48
  const OPENSPEC_AGENTS_MARKER = ".openspec-target";
49
49
 
50
+ export const OPENSPEC_OWNED_ENTRIES = [...OPENSPEC_SKILLS, OPENSPEC_AGENTS_MARKER];
51
+
50
52
  /** Command ids the OpenSpec CLI writes as `.claude/commands/opsx/<id>.md` and `.opencode/commands/opsx-<id>.md`. */
51
53
  const OPENSPEC_COMMAND_IDS = [
52
54
  "explore",
@@ -156,7 +158,7 @@ async function teardownSharedSkillRoot(
156
158
  ): Promise<void> {
157
159
  const skillsDir = getSharedSkillsDir(companionPath);
158
160
  await teardownMateSkills(skillsDir, companionPath, recorder);
159
- for (const name of [...OPENSPEC_SKILLS, OPENSPEC_AGENTS_MARKER]) {
161
+ for (const name of OPENSPEC_OWNED_ENTRIES) {
160
162
  await removeRecorded(path.join(skillsDir, name), "openspec", recorder);
161
163
  }
162
164
  await pruneEmptyAncestors(skillsDir, companionPath);
@@ -230,12 +230,19 @@ export async function isTokensaveAgentIntegrated(agent: string): Promise<boolean
230
230
  | undefined;
231
231
  return (
232
232
  (mcp?.tokensave !== undefined || mcp?.servers?.tokensave !== undefined) &&
233
- (await fileExists(path.join(configDir, "tokensave.md")))
233
+ ((await fileExists(path.join(configDir, "tokensave.md"))) ||
234
+ (await hasOpencodeRulesBlock(path.join(configDir, "AGENTS.md"))))
234
235
  );
235
236
  }
236
237
  return true;
237
238
  }
238
239
 
240
+ /** TokenSave 7.17 writes its OpenCode rules into `AGENTS.md` instead of `tokensave.md`. */
241
+ async function hasOpencodeRulesBlock(agentsFile: string): Promise<boolean> {
242
+ const text = await fs.readFile(agentsFile, "utf8").catch(() => "");
243
+ return text.includes("tokensave rules begin (agent: opencode");
244
+ }
245
+
239
246
  /** `rust_version` of the pinned TokenSave entry in the tool manifest. */
240
247
  function tokensaveMinRustVersion(): string {
241
248
  const value = readToolManifest().tools.tokensave?.rust_version;
@@ -1,6 +1,5 @@
1
1
  import fs from "node:fs/promises";
2
2
 
3
- import { FRAMEWORK_NAME } from "../../../framework";
4
3
  import type { PluginDeclaration } from "../../../lib/orchestrator/types";
5
4
  import {
6
5
  pluginInstallCommand,
@@ -75,7 +74,7 @@ export async function inspectDeclaredPlugins(
75
74
  const install =
76
75
  origin.kind === "local"
77
76
  ? pluginInstallCommand(origin)
78
- : `${FRAMEWORK_NAME} install --yes --frozen-plugins`;
77
+ : `${pluginInstallCommand(origin)} --yes --frozen-plugins`;
79
78
  failures.push({
80
79
  package: name,
81
80
  reason: `not installed; run setup (\`${install}\`) to install it`,
@@ -26,6 +26,7 @@ export const MATE_SKILLS = [
26
26
  "mate-simplify-code",
27
27
  ] as const;
28
28
  const LEGACY_MATE_SKILLS = ["mate-artifact-finish", "mate-openspec-artifact-finish"] as const;
29
+ export const MATE_OWNED_SKILL_NAMES = [...MATE_SKILLS, ...LEGACY_MATE_SKILLS];
29
30
  /**
30
31
  * Renamed without aliases: removed only when Mate wrote them (`metadata.author: mate`),
31
32
  * so a user-authored skill that happens to share a retired name is left alone.
@@ -251,7 +252,7 @@ export async function teardownMateSkills(
251
252
  recorder?: ManagedOutputRecorder,
252
253
  ): Promise<void> {
253
254
  await removeRetiredMateSkills(skillsDir, recorder);
254
- for (const skill of [...MATE_SKILLS, ...LEGACY_MATE_SKILLS]) {
255
+ for (const skill of MATE_OWNED_SKILL_NAMES) {
255
256
  try {
256
257
  await removeRecorded(path.join(skillsDir, skill), "mate", recorder);
257
258
  } catch {
@@ -2,7 +2,7 @@
2
2
  import path from "node:path";
3
3
 
4
4
  import { FRAMEWORK_NAME } from "../framework";
5
- import { ConfigStore, mergeWithDefaults } from "../lib/orchestrator/config-store";
5
+ import { ConfigStore, defaultConfig, mergeWithDefaults } from "../lib/orchestrator/config-store";
6
6
  import { GlobalConfigStore } from "../lib/orchestrator/global-config-store";
7
7
  import {
8
8
  dedupeCapabilities,
@@ -25,6 +25,8 @@ import {
25
25
  writeManagedGitignoreBlock,
26
26
  } from "./setup/plugins/gitignore";
27
27
  import { untrackSkillCopies } from "./setup/mate-skill-copies";
28
+ import { MATE_OWNED_SKILL_NAMES } from "./setup/mate";
29
+ import { OPENSPEC_OWNED_ENTRIES } from "./setup/capabilities/openspec";
28
30
  import { createManagedOutputCollector } from "./setup/managed-output";
29
31
  import type {
30
32
  ManagedOutputReport,
@@ -226,6 +228,25 @@ export async function inspectClaudePluginDirectories(
226
228
  };
227
229
  }
228
230
 
231
+ /**
232
+ * Skill-root entry names Mate writes or removes by name; any other entry is the companion's own
233
+ * skill. Takes every Capability, enabled or not. One whose contributions throw adds no name.
234
+ */
235
+ export async function mateManagedSkillNames(
236
+ companionPath: string,
237
+ plugins: PluginRegistration[] = getActiveDistribution().registry.getEntries(),
238
+ ): Promise<Set<string>> {
239
+ const names = new Set<string>([...MATE_OWNED_SKILL_NAMES, ...OPENSPEC_OWNED_ENTRIES]);
240
+ try {
241
+ const { plan, ctx } = planSyncPass(companionPath, defaultConfig(), plugins);
242
+ const inputs = await collectRuntimeContributionInputs(ctx, plugins, plan, () => {});
243
+ for (const input of [...inputs.values()].flat()) {
244
+ for (const tree of input.contributions.skillTrees ?? []) names.add(tree.name);
245
+ }
246
+ } catch {}
247
+ return names;
248
+ }
249
+
229
250
  function managedGitignoreEntries(companionPath: string, config: FrameworkConfig): string[] {
230
251
  const ctx: SetupContext = { companionPath, config, mode: "sync", activeProviders: [] };
231
252
  return collectManagedGitignoreEntries(ctx, getActiveDistribution().registry.getAll());