@yandy-r/ycc-opencode 6.3.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/registration.json +11 -0
  4. package/shared/references/branching-model.md +2 -1
  5. package/shared/references/worktree-strategy.md +4 -12
  6. package/shared/scripts/lib/ci-classify.sh +2 -2
  7. package/shared/scripts/release-feature-sets.sh +18 -0
  8. package/shared/scripts/release_feature_sets.py +232 -0
  9. package/shared/scripts/setup-worktree.sh +2 -69
  10. package/skills/bundle-author/references/surface-map.md +1 -1
  11. package/skills/bundle-author/references/when-not-to-scaffold.md +1 -1
  12. package/skills/bundle-release/SKILL.md +22 -5
  13. package/skills/bundle-release/references/release-checklist.md +9 -1
  14. package/skills/bundle-release/references/version-policy.md +11 -4
  15. package/skills/formatters/SKILL.md +2 -1
  16. package/skills/formatters/references/flag-reference.md +8 -4
  17. package/skills/formatters/references/templates/lint-autofix.yml.tmpl +184 -18
  18. package/skills/formatters/references/templates/readme-section.md.tmpl +1 -1
  19. package/skills/formatters/scripts/bundle/style.sh +2 -2
  20. package/skills/git-cleanup/SKILL.md +4 -5
  21. package/skills/init/references/conventional-commits.md +8 -1
  22. package/skills/init/references/template-library.md +1 -1
  23. package/skills/init/templates/git/gitmessage.tmpl +2 -1
  24. package/skills/mcp-parity/SKILL.md +303 -0
  25. package/skills/mcp-parity/references/inventory-format.md +171 -0
  26. package/skills/mcp-parity/references/linear-sync.md +194 -0
  27. package/skills/mcp-parity/references/milestones-priority.md +91 -0
  28. package/skills/mcp-parity/references/research-agents.md +122 -0
  29. package/skills/mcp-parity/scripts/capability_diff.py +525 -0
  30. package/skills/mcp-parity/scripts/detect-api-surface.sh +109 -0
  31. package/skills/mcp-parity/scripts/openapi_inventory.py +253 -0
  32. package/skills/mcp-parity/templates/capability-issue.md +38 -0
  33. package/skills/mcp-parity/templates/foundation-issue.md +35 -0
  34. package/skills/release-model/templates/RELEASING.md.tmpl +2 -1
  35. package/skills/releaser/SKILL.md +5 -1
  36. package/skills/releaser/references/release-preparation.md +34 -15
  37. package/shared/scripts/merge-children.sh +0 -82
  38. package/skills/write-docs/templates/docs-readme.md +0 -34
@@ -0,0 +1,303 @@
1
+ ---
2
+ name: mcp-parity
3
+ description: Researches a repo and creates or syncs a Linear project, milestones,
4
+ and prioritized issues for one-to-one MCP parity with the app. Use when planning
5
+ an MCP server for an API or app, or when re-syncing MCP issues after new features.
6
+ ---
7
+
8
+ # MCP Parity Planner
9
+
10
+ Research what an API, app, or CLI can do and plan an MCP (Model Context Protocol)
11
+ capability that mirrors it one-to-one. The output is Linear only: one Project, a
12
+ fixed set of milestones, and one prioritized issue per capability, plus a
13
+ foundation track for the server itself. This skill plans. It writes no code and no
14
+ files in the target repository.
15
+
16
+ The first run creates the Project. Each later run finds it, re-inventories the
17
+ repository, diffs against the stored manifest, and changes only the delta: new
18
+ capabilities get issues, changed contracts get issue updates, and removed
19
+ capabilities get cancel or removal work. Unchanged capabilities are not touched.
20
+
21
+ ## Current Task
22
+
23
+ **Arguments**: `$ARGUMENTS`
24
+
25
+ - `--dry-run`: research and diff, print the plan, make no Linear writes.
26
+ - `--publish`: skip the Phase 3 confirmation (needed for headless or scheduled runs).
27
+ It never skips the mass-removal guard.
28
+ - `--project REF`: an existing Linear Project (URL, id, or name) to sync. Skips lookup.
29
+ - `--owner-team TEAM`: Linear team key or name for a new Project.
30
+ - `--path DIR`: sub-directory to inventory (monorepo package). Default: the git toplevel.
31
+ - `--refresh-foundation`: on a sync run, re-research foundation and create only
32
+ foundation keys the manifest does not have yet.
33
+ - `--keep-workdir`: keep the scratch directory and print its path at the end.
34
+
35
+ **Questions:** class `clarify` (team or Project ambiguous, manifest repo mismatch):
36
+ headless, print the candidates and stop. Class `confirm-publish` (Phase 3): headless
37
+ without `--publish`, behave as `--dry-run` and print `Stopped before Linear writes:
38
+ headless run. Rerun with --publish.` Class `confirm-destructive` (mass-removal guard):
39
+ headless, stop with `Stopped: {n} of {m} capabilities would be removed. Check --path
40
+ and the branch, then rerun interactively.` See
41
+ `{{package-root}}/shared/references/question-policy.md`.
42
+
43
+ ## Reference map
44
+
45
+ Read each reference when its phase starts, not up front:
46
+
47
+ | Phase | Reference |
48
+ | ----------- | --------------------------------------------------------------------------- |
49
+ | 1 Research | `{{package-root}}/skills/mcp-parity/references/research-agents.md` |
50
+ | 1 Inventory | `{{package-root}}/skills/mcp-parity/references/inventory-format.md` |
51
+ | 2 Plan | `{{package-root}}/skills/mcp-parity/references/milestones-priority.md` |
52
+ | 1-4 Linear | `{{package-root}}/skills/mcp-parity/references/linear-sync.md` |
53
+ | 4 Bodies | `{{package-root}}/skills/mcp-parity/templates/capability-issue.md` |
54
+ | 4 Bodies | `{{package-root}}/skills/mcp-parity/templates/foundation-issue.md` |
55
+
56
+ Scripts:
57
+
58
+ - `{{package-root}}/skills/mcp-parity/scripts/openapi_inventory.py` turns an OpenAPI
59
+ 3.x spec into a deterministic inventory (stable ids and fingerprints).
60
+ - `{{package-root}}/skills/mcp-parity/scripts/detect-api-surface.sh` lists surface
61
+ hints (languages, specs, route files, CLI files, existing MCP code).
62
+ - `{{package-root}}/skills/mcp-parity/scripts/capability_diff.py` validates the
63
+ inventory, diffs it against the manifest, and renders the next manifest.
64
+
65
+ **Shell state does not persist between commands.** Wherever this skill writes
66
+ `$WORKDIR`, `$REPO_SLUG`, or `$COMMIT`, substitute the literal value you recorded.
67
+ Never run a command with one of them empty.
68
+
69
+ ---
70
+
71
+ ## Phase 0: Preflight
72
+
73
+ 1. Resolve the repository root: `git rev-parse --show-toplevel`. With `--path`, the
74
+ inventory root is that directory; it must exist inside the toplevel.
75
+ 2. Derive `REPO_SLUG` as `owner/repo` from the `origin` URL (strip `.git`), else the
76
+ toplevel directory name. `REPO_NAME` is the part after the last `/`. With `--path`,
77
+ append `/<path>` to `REPO_SLUG` and `-<path-basename>` to `REPO_NAME`.
78
+ 3. Read Linear hints from the artifact store resolver (read-only; nothing is created):
79
+
80
+ ```bash
81
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" --shell
82
+ ```
83
+
84
+ Use `ARTIFACT_LINEAR_WORKSPACE`, `ARTIFACT_LINEAR_TEAM`, and `ARTIFACT_LINEAR_LABEL`
85
+ when set. This skill is Linear-only and ignores `ARTIFACT_STORE=local`.
86
+
87
+ 4. **Linear gate.** A Linear MCP must be installed and authorized. If not, stop:
88
+ `mcp-parity needs an authorized Linear MCP. Connect Linear, then rerun.` When
89
+ `ARTIFACT_LINEAR_WORKSPACE` is set, confirm the connected workspace matches; on a
90
+ mismatch, ask (class `clarify`).
91
+ 5. Create a scratch directory outside the repository and record its literal path:
92
+
93
+ ```bash
94
+ mktemp -d "${TMPDIR:-/tmp}/ycc-mcp-parity.XXXXXX"
95
+ ```
96
+
97
+ Write `{}` to `$WORKDIR/issues.json`. Write `$WORKDIR/meta.json` with `project`,
98
+ `repo` (`REPO_SLUG`), `commit`, and `generatedAt` (UTC ISO-8601); fill `project`
99
+ once it is known. Other files (`surface.tsv`, `inventory.json`, `manifest.md` or
100
+ `manifest.json`, `diff.json`) also live there.
101
+
102
+ 6. Record `COMMIT` (`git rev-parse --short HEAD`) and whether the tree is dirty. A
103
+ dirty tree is fine; say so in the summary.
104
+
105
+ ## Phase 1: Detect mode and research
106
+
107
+ ### Step 1: Find a previous run
108
+
109
+ Follow `references/linear-sync.md` > Lookup and Rebuild. The outcome is one of:
110
+
111
+ - **sync**: a Project exists, and its manifest is at `$WORKDIR/manifest.md` (the
112
+ Document body) or `$WORKDIR/manifest.json` (rebuilt). That file is `MANIFEST_FILE`.
113
+ - **create**: no Project. Write an empty manifest and use it as `MANIFEST_FILE`:
114
+
115
+ ```bash
116
+ python3 "{{package-root}}/skills/mcp-parity/scripts/capability_diff.py" init \
117
+ --repo "$REPO_SLUG" > "$WORKDIR/manifest.json"
118
+ ```
119
+
120
+ Print the mode, the Project, and the manifest commit, for example
121
+ `Mode: sync (Project "acme-api · MCP parity", manifest at 1a2b3c4)`.
122
+
123
+ ### Step 2: Refresh issue states (sync only)
124
+
125
+ Follow `references/linear-sync.md` > State refresh. It records `done`, `declined`,
126
+ reopened, and `unlinked` statuses in `issues.json`, and `diff --issues` applies
127
+ them, so people's decisions shape this run.
128
+
129
+ ### Step 3: Surface scan
130
+
131
+ ```bash
132
+ "{{package-root}}/skills/mcp-parity/scripts/detect-api-surface.sh" "<inventory-root>" > "$WORKDIR/surface.tsv"
133
+ ```
134
+
135
+ The output is hints, not truth. Notices about truncated lists go to stderr.
136
+
137
+ **Spec-first inventory.** When `surface.tsv` lists an OpenAPI 3.x `SPEC` that the app
138
+ serves or generates (not a vendored third-party spec), build the base inventory from it
139
+ deterministically. Large APIs (hundreds of operations) are only reliable this way:
140
+
141
+ ```bash
142
+ python3 "{{package-root}}/skills/mcp-parity/scripts/openapi_inventory.py" \
143
+ "<inventory-root>/<spec path>" > "$WORKDIR/inventory.spec.json"
144
+ ```
145
+
146
+ Use `--exclude REGEX` for app-specific non-capabilities. With several specs, prefer
147
+ the one the server generates or serves; ask when unsure. A YAML spec needs PyYAML;
148
+ install it per the dependency policy, or convert the spec to JSON.
149
+
150
+ ### Step 4: Dispatch research agents
151
+
152
+ Read `references/research-agents.md` and dispatch the researchers in parallel in one
153
+ message. Each gets the inventory root and
154
+ `surface.tsv`; on sync runs, researcher 1 also gets each manifest capability's id and
155
+ stored `contract`, so ids and field spellings stay stable:
156
+
157
+ 1. **Surface inventory**: every capability, as inventory JSON. With a spec-first
158
+ inventory, it only verifies it and returns capabilities the spec misses (CLI
159
+ commands, GraphQL/RPC surfaces, undocumented routes) and ids to exclude.
160
+ 2. **Architecture and existing MCP**: existing MCP server, auth model, runtime, and
161
+ where a server should live, plus which operations an existing MCP server covers.
162
+ 3. **MCP practice**: current spec revision, the official SDK for the language,
163
+ transports, auth, and tool annotations. Sync runs skip it unless
164
+ `--refresh-foundation` is set or the manifest has no `foundation` entries.
165
+
166
+ ### Step 5: Assemble, validate, and diff
167
+
168
+ Write researcher 1's JSON (merged into the spec inventory, when there is one, with
169
+ its exclusions removed) to `$WORKDIR/inventory.raw.json`, then produce
170
+ `$WORKDIR/inventory.json` with `references/inventory-format.md` > Coverage merge.
171
+ Validate and diff:
172
+
173
+ ```bash
174
+ python3 "{{package-root}}/skills/mcp-parity/scripts/capability_diff.py" diff \
175
+ --manifest "<MANIFEST_FILE>" --inventory "$WORKDIR/inventory.json" \
176
+ --issues "$WORKDIR/issues.json" --repo "$REPO_SLUG" > "$WORKDIR/diff.json"
177
+ ```
178
+
179
+ A non-zero exit names the problem: fix the inventory field, or, for a repo mismatch,
180
+ stop and ask (class `clarify`; see `references/linear-sync.md` > Lookup for
181
+ `--adopt-repo`). Never hand-edit `diff.json`.
182
+
183
+ **Renames.** For each `possibleRenames` pair, read both operations. When it is the same
184
+ capability, rename the inventory id back to the manifest id and rerun the diff, so it
185
+ reports `changed` instead of a cancel plus a duplicate. Ask when unsure.
186
+
187
+ **Mass-removal guard.** When every tracked capability would be removed, or
188
+ `removedRatio` exceeds `0.25` with more than 3 removed, ask before planning (class `confirm-destructive`), naming the count and the
189
+ inventory root. Wrong `--path`, a stale branch, or a failed researcher usually causes
190
+ it.
191
+
192
+ ## Phase 2: Plan
193
+
194
+ Read `references/milestones-priority.md`.
195
+
196
+ 1. **Foundation track.** Create mode, or `--refresh-foundation` for keys missing from
197
+ `manifest.foundation`: plan the foundation issues from researchers 2 and 3. Skip
198
+ any item the existing MCP server already provides.
199
+ 2. **Added and revived.** One issue each: title, milestone, priority, labels, and body
200
+ from `templates/capability-issue.md`. One capability is one issue, which keeps the
201
+ manifest one-to-one.
202
+ 3. **Changed.** Plan per `references/linear-sync.md` > Changed. The action depends on
203
+ the issue's state and the manifest status.
204
+ 4. **Removed.** Plan per `references/linear-sync.md` > Removed.
205
+ 5. **Covered.** Record in the manifest with no issue.
206
+
207
+ A no-op diff (`"noop": true`) without a foundation refresh plans no issue writes:
208
+ only the manifest refresh and one status update.
209
+
210
+ ### Display the plan
211
+
212
+ Print one table per action, then totals:
213
+
214
+ ```markdown
215
+ ## MCP parity plan: {REPO_SLUG} @ {COMMIT}
216
+
217
+ Mode: {create|sync} · Project: {name or "(new)"}
218
+
219
+ ### New issues ({n})
220
+
221
+ | Capability | Operation | Milestone | Priority | Labels |
222
+ | ---------- | ---------- | -------------- | -------- | -------------------- |
223
+ | users.list | GET /users | M2 Read parity | High | mcp-parity, mcp:tool |
224
+
225
+ ### Updated ({n}) · Cancelled ({n}) · Removal issues ({n}) · Covered ({n}) · Declined ({n}) · Unchanged ({n})
226
+ ```
227
+
228
+ With `--dry-run`, stop here: `Dry run complete. Rerun without --dry-run to publish.`
229
+
230
+ ## Phase 3: Confirm
231
+
232
+ Unless `--publish` is set, ask once (class `confirm-publish`) with the counts:
233
+ `Publish to Linear: create {a} issues, update {c}, cancel {r}, add {m} milestones?`
234
+ Options: publish, or stop as a dry run.
235
+
236
+ ## Phase 4: Write to Linear
237
+
238
+ Follow `references/linear-sync.md` > Write order. Record every successful action in
239
+ `$WORKDIR/issues.json` immediately, before the next call
240
+ (`references/inventory-format.md` > Issue map): a new `issue` key for creates, and
241
+ `"applied": true` for patches, cancels, and covered re-checks. Unrecorded work is
242
+ not committed to the manifest, so the next run retries it.
243
+
244
+ Then render and save the manifest:
245
+
246
+ ```bash
247
+ python3 "{{package-root}}/skills/mcp-parity/scripts/capability_diff.py" apply \
248
+ --manifest "<MANIFEST_FILE>" --inventory "$WORKDIR/inventory.json" --repo "$REPO_SLUG" \
249
+ --issues "$WORKDIR/issues.json" --meta "$WORKDIR/meta.json" --format markdown \
250
+ > "$WORKDIR/manifest.next.md"
251
+ ```
252
+
253
+ Save `manifest.next.md` as the manifest Document (update in place when it exists).
254
+ Then post the Project status update (`references/linear-sync.md` > Status update).
255
+
256
+ ### Failure handling
257
+
258
+ Class `failure-recovery`: when a Linear write fails, stop new writes. Still render the
259
+ manifest with `--partial` added to the command above and save it, so recorded work is
260
+ kept and the rest re-diffs next run. Post the status update with health `atRisk`.
261
+ Report the failed call and the rerun command.
262
+
263
+ ## Phase 5: Summary
264
+
265
+ ```markdown
266
+ # MCP parity {created|synced}: {Project name}
267
+
268
+ Project: {url} · Commit: {COMMIT}{ (dirty tree)}
269
+ Milestones: {list with issue counts}
270
+
271
+ | Action | Count | Issues |
272
+ | --------- | ----- | ------------------- |
273
+ | Created | n | ABC-12, ABC-13, ... |
274
+ | Updated | n | ... |
275
+ | Cancelled | n | ... |
276
+ | Removal | n | ... |
277
+ | Declined | n | ... (not recreated) |
278
+ | Covered | n | - |
279
+ | Unchanged | n | - |
280
+
281
+ Parity: {done + covered}/{tracked} capabilities exposed over MCP.
282
+ Next: rerun /ycc:mcp-parity after API changes; implement issues with /ycc:prp-plan
283
+ or /orchestrate.
284
+ ```
285
+
286
+ Remove `$WORKDIR` unless `--keep-workdir`.
287
+
288
+ ## Important rules
289
+
290
+ - **Plan only.** Never write code, scaffold a server, or commit files in the target
291
+ repository.
292
+ - **Delta only on sync.** Never recreate, retitle, re-prioritize, reassign, or move
293
+ issues that the diff reports as unchanged. People own those fields after creation.
294
+ - **Respect people.** A capability issue a person canceled is `declined`: never
295
+ recreate it; list it in the summary so the gap stays visible.
296
+ - **Never move an issue backwards or delete one.** Cancel only unstarted open issues,
297
+ and only when their capability is gone.
298
+ - **One-to-one.** Every live capability has exactly one tracking issue, or is
299
+ `covered` or `declined`. The parity guardrail issue keeps that true in CI.
300
+ - **Ids are durable.** Capability ids key the manifest and appear in each issue's
301
+ Agent notes. Do not rename ids for style.
302
+ - **Subagents never touch Linear.** Researchers are read-only and return data; this
303
+ skill alone calls the Linear MCP.
@@ -0,0 +1,171 @@
1
+ # Inventory, manifest, and issue map formats
2
+
3
+ ## Contents
4
+
5
+ - Inventory
6
+ - Capability ids
7
+ - Coverage merge
8
+ - Fingerprint
9
+ - Manifest
10
+ - Issue map
11
+ - Meta
12
+
13
+ `capability_diff.py` reads and writes these files. All are JSON in `$WORKDIR`.
14
+
15
+ ## Inventory
16
+
17
+ `inventory.json` is what the app can do now:
18
+
19
+ ```json
20
+ {
21
+ "schema": 1,
22
+ "capabilities": [
23
+ {
24
+ "id": "users.list",
25
+ "kind": "tool",
26
+ "operation": "GET /v1/users",
27
+ "summary": "List users with filters and pagination.",
28
+ "area": "users",
29
+ "inputs": { "query": { "role": "string?", "cursor": "string?", "limit": "integer?" } },
30
+ "outputs": "Page<User>",
31
+ "mutating": false,
32
+ "destructive": false,
33
+ "auth": "user",
34
+ "surface": "rest",
35
+ "source": "src/routes/users.ts:42",
36
+ "mcpCovered": false
37
+ }
38
+ ]
39
+ }
40
+ ```
41
+
42
+ Required: `id`, `kind` (`tool`, `resource`, or `prompt`), a non-empty `operation`, and
43
+ boolean `mutating` and `destructive`. Everything else is strongly recommended because it drives milestone, priority, and
44
+ the issue body.
45
+
46
+ | Field | Meaning |
47
+ | ------------- | --------------------------------------------------------------------------------------------- |
48
+ | `operation` | The app's own handle: `METHOD /path`, `Query.users`, `rpc UserService.List`, `cli users list` |
49
+ | `inputs` | Normalized parameter shape: names, types, optional marker `?`. Sort keys. |
50
+ | `outputs` | Return type name or shape. |
51
+ | `mutating` | Changes state. |
52
+ | `destructive` | Deletes data, irreversible, or affects billing/security. |
53
+ | `auth` | `public`, `user`, `admin`, `service`, or the app's own scope name. |
54
+ | `surface` | `rest`, `graphql`, `grpc`, `trpc`, `cli`, `sdk`, `webhook`, `job`. |
55
+ | `area` | Resource or domain group, used for labels and grouping. |
56
+ | `mcpCovered` | An MCP tool/resource already exposes it with matching inputs. |
57
+
58
+ **Kind choice.** Read-only lookups of a stable, addressable entity (a document, a
59
+ config, a file) may be a `resource`. Anything with filters, side effects, or
60
+ computation is a `tool`. Reusable user-facing workflows the app documents may be a
61
+ `prompt`. When unsure, use `tool`.
62
+
63
+ **Exclude:** health checks, metrics endpoints, auth handshake routes (login, token
64
+ refresh, OAuth callbacks), static asset routes, internal admin debug routes, and
65
+ webhooks the app receives (they are inputs, not capabilities). List exclusions in the
66
+ researcher report so the user can see them.
67
+
68
+ ## Capability ids
69
+
70
+ Pattern `^[a-z0-9][a-z0-9._-]{0,127}$`, unique. Use `<area>.<verb>` with these verbs:
71
+ `list`, `get`, `search`, `create`, `update`, `delete`, or the domain verb (`invoice.send`,
72
+ `order.refund`). Nested resources use dots: `projects.members.add`. Ids must not encode
73
+ the HTTP method or version so a route move keeps the id.
74
+
75
+ ## Coverage merge
76
+
77
+ Save researcher 2's `covered` array as `$WORKDIR/covered.json`, then let the script
78
+ match operations (method case, `{id}`/`:id`/`<id>` path parameters, and trailing
79
+ slashes are normalized):
80
+
81
+ ```bash
82
+ python3 "{{package-root}}/skills/mcp-parity/scripts/capability_diff.py" cover \
83
+ --inventory "$WORKDIR/inventory.raw.json" --covered "$WORKDIR/covered.json" \
84
+ > "$WORKDIR/inventory.json"
85
+ ```
86
+
87
+ A match sets `mcpCovered` to `inputsMatch`; everything else gets `false`. The output's
88
+ `mcpOnly` list holds MCP tools with no app capability: list them in the summary as
89
+ "MCP-only, review".
90
+
91
+ ## Fingerprint
92
+
93
+ The 16-hex SHA-256 over the normalized contract: `kind`, `operation`, `inputs`,
94
+ `outputs`, `mutating`, `destructive`, and `auth`. Normalization collapses
95
+ whitespace, sorts keys, and defaults missing `inputs` to `{}`, `outputs` to `""`,
96
+ and `auth` to `unspecified`. A fingerprint change means the MCP contract
97
+ must change. `summary`, `area`, `source`, `surface`, and `mcpCovered` never change a
98
+ fingerprint, so line moves and doc edits do not create churn. Normalize `inputs` the
99
+ same way every run (same type spelling) or the diff reports noise; on sync runs,
100
+ researcher 1 receives each stored `contract` to copy its spellings.
101
+
102
+ ## Manifest
103
+
104
+ Stored in the Project's manifest Document as the first fenced `json` block after the
105
+ `## Manifest data` heading (a visible heading, because tracker markdown may drop HTML
106
+ comments). `capability_diff.py apply --format markdown` renders the whole
107
+ Document body.
108
+
109
+ ```json
110
+ {
111
+ "schema": 1,
112
+ "project": "acme-api · MCP parity",
113
+ "repo": "acme/acme-api",
114
+ "commit": "1a2b3c4",
115
+ "generatedAt": "2026-11-09T12:00:00Z",
116
+ "foundation": { "scaffold": "ABC-10", "transport": "ABC-11" },
117
+ "capabilities": {
118
+ "users.list": {
119
+ "area": "users",
120
+ "contract": {
121
+ "kind": "tool",
122
+ "operation": "GET /v1/users",
123
+ "inputs": {},
124
+ "outputs": "Page<User>",
125
+ "mutating": false,
126
+ "destructive": false,
127
+ "auth": "user"
128
+ },
129
+ "fingerprint": "3f1c0d9a7b2e4c11",
130
+ "history": ["ABC-3"],
131
+ "issue": "ABC-12",
132
+ "milestone": "M2 Read parity",
133
+ "operation": "GET /v1/users",
134
+ "priority": 2,
135
+ "status": "planned"
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ `status`: `planned` (issue open), `done` (issue completed), `covered` (exposed before
142
+ this skill tracked it, no issue), `removed` (capability gone from the app), `declined` (a person canceled the issue;
143
+ the skill does not recreate it).
144
+
145
+ ## Issue map
146
+
147
+ `issues.json` records this run's results, keyed by capability id. Allowed fields:
148
+ `issue`, `milestone`, `priority`, `status`, `applied`. Unknown ids or fields fail.
149
+ `status` may also be `unlinked` (the issue was deleted or archived).
150
+
151
+ ```json
152
+ {
153
+ "users.list": { "issue": "ABC-12", "milestone": "M2 Read parity", "priority": 2 },
154
+ "users.update": { "applied": true },
155
+ "users.get": { "status": "done" },
156
+ "legacy.export": { "issue": "ABC-30" },
157
+ "_foundation": { "scaffold": "ABC-10", "parity-guardrail": "ABC-15" }
158
+ }
159
+ ```
160
+
161
+ - `issue`: a create succeeded. A replaced key moves to the entry's `history`.
162
+ - `"applied": true`: a non-create action succeeded (patch, cancel, covered re-check,
163
+ declined acknowledgement). Changed contracts and removals commit to the manifest
164
+ only with `issue` or `applied`; anything else is retried on the next run.
165
+ - `status`: a State refresh result. It never commits a contract change.
166
+
167
+ Write each entry immediately after its Linear call succeeds.
168
+
169
+ ## Meta
170
+
171
+ `meta.json`: `{"project": "...", "repo": "...", "commit": "...", "generatedAt": "<ISO-8601 UTC>"}`.
@@ -0,0 +1,194 @@
1
+ # Linear lookup and sync
2
+
3
+ ## Contents
4
+
5
+ - Tools
6
+ - Names and markers
7
+ - Lookup
8
+ - Rebuild
9
+ - State refresh
10
+ - Write order
11
+ - Added and revived
12
+ - Changed
13
+ - Removed
14
+ - Status update
15
+ - Idempotency checks
16
+
17
+ ## Tools
18
+
19
+ Linear MCP tool names differ by runtime (`mcp__linear__…`, `mcp__claude_ai_Linear__…`).
20
+ Use whichever is connected. Typical tools: `list_projects`, `get_project`,
21
+ `save_project`, `list_milestones`, `save_milestone`, `list_issues`, `get_issue`,
22
+ `save_issue`, `save_comment`, `list_documents`, `get_document`, `save_document`,
23
+ `list_issue_labels`, `create_issue_label`, `list_issue_statuses`,
24
+ `save_status_update`. Read each tool's schema before the first call. Paginate every
25
+ list call until `hasNextPage` is false. When a needed operation has no tool (for
26
+ example relations), report it in the summary instead of guessing.
27
+
28
+ ## Names and markers
29
+
30
+ - Project: `{REPO_NAME} · MCP parity`. Its description's first line is
31
+ `Repository: {REPO_SLUG}`, which Lookup checks.
32
+ - Manifest Document, attached to the Project: `{REPO_NAME} · mcp-parity-manifest`.
33
+ - Issue titles: `MCP {kind}: {id}` (capability), `Update MCP {kind}: {id}` (contract
34
+ change after completion), `Remove MCP {kind}: {id}` (removal), and the foundation
35
+ titles in `milestones-priority.md`.
36
+ - Every issue's Agent notes block has these lines, each on its own line:
37
+ `Issue-Kind: capability|update|removal|foundation`, then `Capability-ID: {id}` and
38
+ `Fingerprint: {fingerprint}`, or `Foundation-Key: {key}` for foundation issues.
39
+
40
+ Match marker lines exactly: the whole line, after trimming, equals
41
+ `Capability-ID: {id}`. A substring match confuses `users.get` with
42
+ `users.get.by-email`.
43
+
44
+ Linear rewrites some markdown on save, so never compare stored bodies byte for
45
+ byte:
46
+
47
+ - A `+++ Agent notes` collapsible comes back as `>>> Agent notes`; marker lines stay
48
+ intact on their own lines.
49
+ - Issue keys in Document tables come back as `<issue … label="KEY" />` mentions. Only
50
+ the fenced `json` block under `## Manifest data` is authoritative, and it
51
+ round-trips unchanged.
52
+ - `list_issues` `query` search is fuzzy: it returns near matches (`note.create` for
53
+ `note.update`). Always read each hit's description and apply the exact-line rule.
54
+
55
+ ## Lookup
56
+
57
+ Stop at the first hit:
58
+
59
+ 1. `--project REF`: fetch it. Missing → stop with the error.
60
+ 2. Projects named exactly `{REPO_NAME} · MCP parity` or `{REPO_SLUG} · MCP parity`;
61
+ in `ARTIFACT_LINEAR_TEAM` when set, otherwise in all teams. Keep only Projects
62
+ whose description's `Repository:` line equals `REPO_SLUG` (case-insensitive).
63
+ 3. List the team's Projects (all pages) and read each description's `Repository:`
64
+ line; also Projects carrying `ARTIFACT_LINEAR_LABEL` that hold issues labeled
65
+ `mcp-parity`. This finds renamed Projects.
66
+
67
+ Several hits → ask (class `clarify`). No hit → create mode. Name a new Project
68
+ `{REPO_NAME} · MCP parity`, or `{REPO_SLUG} · MCP parity` when a Project for another
69
+ repo already has the short name.
70
+
71
+ A manifest `repo` that differs from `REPO_SLUG` makes `diff` fail. When the user
72
+ confirms the repo was renamed or transferred, rerun `diff` and `apply` with
73
+ `--adopt-repo` and update the Project's `Repository:` line.
74
+
75
+ In sync mode, find the manifest Document by exact title in the Project. Save its
76
+ body as `$WORKDIR/manifest.md` and run
77
+ `capability_diff.py extract --doc "$WORKDIR/manifest.md"`. On success that file is
78
+ `MANIFEST_FILE`. A missing Document or a failed extract → Rebuild, and report why.
79
+
80
+ Linear team for create mode: `--owner-team`, else `ARTIFACT_LINEAR_TEAM`, else the sole team from
81
+ `list_teams`; several teams → ask.
82
+
83
+ ## Rebuild
84
+
85
+ When the Project exists but the manifest is missing or unreadable:
86
+
87
+ 1. List all of the Project's issues labeled `mcp-parity`, in every state.
88
+ 2. For `Issue-Kind: capability` and `update`, take `Capability-ID` and `Fingerprint`.
89
+ Map state type: completed → `done`; canceled → `declined`; otherwise `planned`.
90
+ When an id has several issues, prefer the open one, then the newest.
91
+ 3. A `removal` issue marks its id `removed`.
92
+ 4. Collect `Foundation-Key` lines into `foundation`.
93
+ 5. Write `$WORKDIR/manifest.json` (schema in `inventory-format.md`, with `repo` set to
94
+ `REPO_SLUG`). Fingerprints without a stored `contract` are fine: a different
95
+ fingerprint reports `changed`, which only patches open issues. That file is
96
+ `MANIFEST_FILE`. Report "manifest rebuilt from N issues".
97
+
98
+ ## State refresh
99
+
100
+ Sync runs only, before the diff. For each manifest capability with an `issue` and
101
+ status `planned`, `done`, or `declined`, read the issue (`get_issue`):
102
+
103
+ - not found, deleted, or archived → record `{"status": "unlinked"}`. The key is
104
+ forgotten (kept in `history`) and the capability is planned as new.
105
+ - completed → record `{"status": "done"}` unless already `done`.
106
+ - canceled, and its Agent notes say `Issue-Kind: capability` or `update` → record
107
+ `{"status": "declined"}`. A person canceled it; this skill never recreates it.
108
+ - any open state → record `{"status": "planned"}` when the manifest says `done` or
109
+ `declined` (someone reopened it).
110
+
111
+ Pass `--issues "$WORKDIR/issues.json"` to `diff` so these statuses shape the
112
+ classification: each diff item's `status` is the effective one. Status entries never
113
+ commit contract changes; only `issue` and `"applied": true` do.
114
+
115
+ ## Write order
116
+
117
+ 1. Labels (`milestones-priority.md` > Labels).
118
+ 2. Project (create mode): `save_project` with name, team, description (first line
119
+ `Repository: {REPO_SLUG}`, then purpose and "Managed by the mcp-parity skill. Edit
120
+ issues freely; keep the Agent notes marker lines."), and labels. Set
121
+ `meta.json` `project`.
122
+ 3. Milestones: `list_milestones`, then `save_milestone` for missing names only.
123
+ 4. Foundation issues, then Added and revived, Changed, Removed.
124
+ 5. Relations (`milestones-priority.md` > Foundation issues). Before adding one,
125
+ check that it does not already exist.
126
+ 6. Manifest Document, then the Project status update.
127
+
128
+ Run the matching Idempotency check before every create.
129
+
130
+ ## Added and revived
131
+
132
+ `save_issue` with team, project, milestone, title, priority, labels, and the body
133
+ from `templates/capability-issue.md`. Revived issues add a `relatedTo` link to the
134
+ previous issue. Record `{"issue": KEY, "milestone": …, "priority": …}`.
135
+
136
+ ## Changed
137
+
138
+ The diff item gives `issue`, `oldContract`, and `newContract`; branch on the
139
+ effective status. Summarize the field-level differences between the two contracts (when
140
+ `oldContract` is missing after a rebuild, read the issue's Contract section). Then:
141
+
142
+ - **status `covered`** (no issue): the existing MCP tool still matches (a mismatch
143
+ would have cleared `mcpCovered` and made it `added`). Record `{"applied": true}`.
144
+ - **status `declined`**: record `{"applied": true}`; nothing in Linear.
145
+ - **status `done`** (issue completed): the shipped MCP tool has the old contract.
146
+ Create `Update MCP {kind}: {id}` in the original milestone, priority 3, labels
147
+ `mcp-parity` and the kind label, `relatedTo` the original. Record the new `issue`
148
+ and `"status": "planned"`. The old key moves to `history` automatically.
149
+ - **status `planned`** (issue open): update only the description's `## Contract`
150
+ section and the `Fingerprint:` line (`patch` when the tool supports it; otherwise
151
+ fetch, edit those parts, and send the whole body). Add one comment:
152
+ `API contract changed at {COMMIT}: {summary}`. Keep title, priority, assignee,
153
+ state, and labels. Record `{"applied": true}`.
154
+
155
+ ## Removed
156
+
157
+ The diff item gives `issue`; branch on the effective status:
158
+
159
+ - **planned, issue unstarted** (backlog, unstarted, triage): comment
160
+ `Capability no longer exists in the app at {COMMIT}`, then move it to the team's
161
+ canceled state (the state type `canceled` named "Canceled", else the first
162
+ `canceled` type that is not "Duplicate"). Record `{"applied": true}`.
163
+ - **planned, issue started**: someone is working on it. Leave the state and list it
164
+ in the summary for a person to decide. Post the same comment only when
165
+ `list_comments` shows none with that text yet. Record nothing, so the next run
166
+ re-checks it without commenting again.
167
+ - **done**: the MCP server still exposes a dead capability. Create
168
+ `Remove MCP {kind}: {id}`, priority 2, in `M5 Parity guardrails`, `relatedTo` the
169
+ original. Record the new `issue`.
170
+ - **covered**: when researcher 2 shows the existing MCP server exposes it, create the
171
+ removal issue as above. Otherwise record `{"applied": true}`.
172
+ - **declined**: record `{"applied": true}`.
173
+
174
+ ## Status update
175
+
176
+ One `save_status_update` on the Project per non-dry run, health `onTrack`, or
177
+ `atRisk` when any write failed:
178
+
179
+ ```text
180
+ Parity sync at {COMMIT}: +{added} new, {changed} changed, {removed} removed,
181
+ {covered} covered, {declined} declined, {unchanged} unchanged. Parity {exposed}/{tracked}.
182
+ ```
183
+
184
+ ## Idempotency checks
185
+
186
+ - Before creating an issue, search the Project's `mcp-parity` issues in every state
187
+ for one with the same `Issue-Kind` and an exact `Capability-ID` (or
188
+ `Foundation-Key`) line, and a matching title prefix. An open hit → reuse it, record
189
+ its key, and skip the create. This covers a crashed run whose manifest was never
190
+ saved. Completed or canceled hits do not count; they are history.
191
+ - Milestones and labels are created only when no item with that exact name exists.
192
+ - The manifest Document is updated in place; create it only when Lookup found none.
193
+ - A second run with no repository changes makes zero issue creates and zero issue
194
+ edits: only the manifest Document refresh and one status update.