@yandy-r/ycc-opencode 6.3.0 → 6.4.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.
@@ -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.
@@ -0,0 +1,91 @@
1
+ # Milestones, priority, and labels
2
+
3
+ ## Contents
4
+
5
+ - Milestones
6
+ - Milestone assignment
7
+ - Priority
8
+ - Labels
9
+ - Foundation issues
10
+
11
+ ## Milestones
12
+
13
+ Every parity Project has the same five milestones, created once and reused by name.
14
+ Never rename or delete them; on sync, create only the missing ones.
15
+
16
+ | Milestone | Holds |
17
+ | ------------------------ | ------------------------------------------------------------------------ |
18
+ | `M1 Foundation` | Server scaffold, transport, auth, error/pagination mapping, test harness |
19
+ | `M2 Read parity` | Non-mutating tools and all resources |
20
+ | `M3 Write parity` | Mutating, non-destructive tools |
21
+ | `M4 Destructive & admin` | Destructive tools, `admin`/`service` auth tools, prompts |
22
+ | `M5 Parity guardrails` | CI parity check, docs, release and distribution |
23
+
24
+ Milestone descriptions: one sentence from the table plus "Managed by mcp-parity."
25
+ Do not set target dates; people own scheduling.
26
+
27
+ ## Milestone assignment
28
+
29
+ Apply the first matching rule:
30
+
31
+ 1. Foundation work → `M1 Foundation`; guardrails, docs, release → `M5 Parity guardrails`.
32
+ 2. `destructive: true`, or `auth` is `admin` or `service`, or `kind: prompt` →
33
+ `M4 Destructive & admin`.
34
+ 3. `mutating: true` → `M3 Write parity`.
35
+ 4. Everything else → `M2 Read parity`.
36
+
37
+ A capability found on a sync run uses the same rules, even when its milestone's
38
+ other issues are done. Parity is the goal, not the milestone date.
39
+
40
+ ## Priority
41
+
42
+ Linear priority values: 1 Urgent, 2 High, 3 Medium, 4 Low.
43
+
44
+ | Work | Priority |
45
+ | -------------------------------------------------------------------------- | -------- |
46
+ | Server scaffold, transport, auth | 1 Urgent |
47
+ | Error/pagination mapping, test harness, parity guardrail | 2 High |
48
+ | Read tools/resources on the app's core entities | 2 High |
49
+ | Write tools on core entities; changed-contract updates for done issues | 3 Medium |
50
+ | Other read and write tools | 3 Medium |
51
+ | Destructive and admin tools, prompts, docs, release | 4 Low |
52
+ | Removal of an MCP tool whose capability is gone (live tool lies to agents) | 2 High |
53
+
54
+ **Core entities** are the 3-5 areas with the most capabilities, or the ones the
55
+ README and API docs lead with. Name them in the plan output so the user can disagree.
56
+ Set priority only on create. On sync, never change the priority of an existing issue.
57
+
58
+ ## Labels
59
+
60
+ Ensure these team issue labels exist (create missing ones; never rename or delete):
61
+
62
+ - `mcp-parity`: on every issue this skill creates. Lookup uses it.
63
+ - `mcp:tool`, `mcp:resource`, `mcp:prompt`: the capability kind.
64
+ - `mcp:foundation`: foundation and guardrail issues.
65
+ - `ARTIFACT_LINEAR_LABEL` (for example `repo:acme-api`) when set; also apply it to
66
+ the Project.
67
+
68
+ Pass labels by name. Use `addLabels` when editing an existing issue so labels people
69
+ added survive.
70
+
71
+ ## Foundation issues
72
+
73
+ Create the ones that apply, skipping anything the existing MCP server already
74
+ provides. Body template: `templates/foundation-issue.md`.
75
+
76
+ | Key | Title | Milestone | Priority |
77
+ | ------------------- | -------------------------------------------------------------- | --------- | -------- |
78
+ | `scaffold` | Scaffold the MCP server package with the official SDK | M1 | 1 |
79
+ | `transport` | Support the chosen transport(s) (stdio and/or Streamable HTTP) | M1 | 1 |
80
+ | `auth` | Authenticate MCP clients and reuse the app's authorization | M1 | 1 |
81
+ | `errors-pagination` | Map app errors and pagination to MCP results | M1 | 2 |
82
+ | `test-harness` | Add an MCP contract test harness | M1 | 2 |
83
+ | `parity-guardrail` | Fail CI when an API capability has no MCP counterpart | M5 | 2 |
84
+ | `docs-release` | Document and ship the MCP server | M5 | 4 |
85
+
86
+ `scaffold` blocks `transport`, `auth`, and `test-harness`. To keep the graph
87
+ readable, `auth` and `errors-pagination` each block only the highest-priority issue
88
+ of M2, M3, and M4 (one relation per milestone), not every capability issue. The
89
+ `parity-guardrail` issue body must describe the check concretely for this repo: the
90
+ source of truth for capabilities (spec file or route registry), the MCP tool list,
91
+ and the id mapping in the manifest.
@@ -0,0 +1,122 @@
1
+ # Research agents
2
+
3
+ ## Contents
4
+
5
+ - Shared rules
6
+ - 1. Surface inventory
7
+ - 2. Architecture and existing MCP
8
+ - 3. MCP practice
9
+ - Large repositories
10
+
11
+ Dispatch these with the `subagent` tool in one message so they run in parallel. Use the
12
+ Claude agent types shown; on runtimes without them, use the closest read-only
13
+ researcher. Each prompt below is a template: fill the `{…}` values.
14
+
15
+ ## Shared rules
16
+
17
+ Put these lines in every prompt:
18
+
19
+ ```text
20
+ You are read-only. Do not edit files, run builds, or call any tracker or Linear tool.
21
+ Inventory root: {ROOT}. Ignore generated bundles, vendored code, build output, and
22
+ test fixtures unless they are the only definition of a capability.
23
+ Return your result in the exact format requested; the parent parses it.
24
+ If something is ambiguous, return the options and your recommendation; do not ask.
25
+ ```
26
+
27
+ ## 1. Surface inventory
28
+
29
+ Agent type: `codebase-research-analyst`.
30
+
31
+ ```text
32
+ Goal: list every capability a client can invoke in this app, so an MCP server can
33
+ mirror it one-to-one.
34
+
35
+ Surface hints from a scanner (verify, do not trust):
36
+ {surface.tsv}
37
+
38
+ {On sync runs:} Existing capability ids and stored contracts from the last run.
39
+ Reuse an id when it is the same capability, even if it moved or was renamed, and
40
+ copy the stored spelling of unchanged inputs/outputs so fingerprints stay stable:
41
+ {id → contract list}
42
+
43
+ {When a spec-first inventory exists:} A deterministic inventory was generated from
44
+ {spec path}: {N} operations, ids {id list}. Do not re-list them. Verify a sample
45
+ against the code, then return only capabilities the spec misses (CLI commands,
46
+ GraphQL/RPC surfaces, undocumented routes) and spec ids that are not real client
47
+ capabilities (internal, dead, or feature-flagged off), with reasons.
48
+
49
+ Steps:
50
+ 1. Prefer contracts: OpenAPI, GraphQL schema, proto files, tRPC routers. Read code
51
+ only where no contract exists or the contract is stale versus the code.
52
+ 2. Read route registration, controllers, resolvers, RPC services, and CLI command
53
+ definitions. Follow mounted routers and prefixes to full paths.
54
+ 3. For each capability, record the fields in the inventory schema below, including
55
+ normalized inputs (sorted keys, `?` for optional), outputs, mutating,
56
+ destructive, and auth.
57
+ 4. Apply the exclusion list. Report what you excluded and why.
58
+
59
+ Inventory schema and id rules: {paste inventory-format.md > Inventory and Capability ids}
60
+
61
+ Return:
62
+ - A JSON block: {"schema": 1, "capabilities": [...]}
63
+ - A short list of exclusions.
64
+ - Open questions (ambiguous ownership, dead routes, feature-flagged routes).
65
+ ```
66
+
67
+ ## 2. Architecture and existing MCP
68
+
69
+ Agent type: `code-explorer`.
70
+
71
+ ```text
72
+ Goal: tell the planner how an MCP server fits this repository.
73
+
74
+ Answer with evidence (file:line):
75
+ 1. Language, framework, runtime, package manager, and test framework.
76
+ 2. Is there an MCP server already (SDK imports, .mcp.json, server.json)? If yes:
77
+ which tools/resources/prompts it exposes, each mapped to the app operation it
78
+ calls, and whether its inputs match that operation.
79
+ 3. How the app authenticates callers (sessions, API keys, OAuth, service tokens)
80
+ and how authorization is checked. Which layer should an MCP server call: the HTTP
81
+ API, an internal service layer, or an SDK/client package?
82
+ 4. Error model (error types, status codes) and pagination model.
83
+ 5. Where a server should live: new package, existing service, or separate repo
84
+ folder, following repo conventions.
85
+ 6. How CI runs tests, for the parity guardrail.
86
+
87
+ Return:
88
+ - A JSON block: {"covered": [{"operation": "...", "mcpName": "...", "inputsMatch": true}]}
89
+ where `operation` uses the same handle format as the inventory (`GET /v1/users`).
90
+ - A short architecture brief covering 1-6.
91
+ ```
92
+
93
+ ## 3. MCP practice
94
+
95
+ Agent type: `research-specialist` (web access), or `library-docs-writer`
96
+ when context7 is available.
97
+
98
+ ```text
99
+ Goal: current, sourced guidance for building an MCP server in {LANGUAGE}/{FRAMEWORK}.
100
+
101
+ Find, with links and dates:
102
+ 1. The latest MCP specification revision and any changes that matter for servers.
103
+ 2. The official SDK for {LANGUAGE} and its current stable version.
104
+ 3. Transport choice: stdio for local use versus Streamable HTTP for remote use, and
105
+ when each fits {deployment from agent 2 if known}.
106
+ 4. Authorization for remote servers (the spec's OAuth-based flow) and how to reuse
107
+ the app's existing auth.
108
+ 5. Tool design: naming, input schemas, tool annotations (read-only, destructive,
109
+ idempotent, open-world hints), output and structured content, pagination, and
110
+ error reporting.
111
+ 6. Testing tools (MCP Inspector or SDK test clients).
112
+
113
+ Return a brief of at most 40 lines, every claim with a source link. Mark anything
114
+ you could not verify.
115
+ ```
116
+
117
+ ## Large repositories
118
+
119
+ When `surface.tsv` lists more than about 40 route files or several services, split
120
+ researcher 1 by area or service: one agent per group, each with the same prompt and
121
+ only its files. Merge their JSON, then de-duplicate ids. Keep the total at 6 agents
122
+ or fewer.