Skip to content

Commit e556e3a

Browse files
docs(skills): the ask-data skill's zero-match rows read list_datasets candidates (#34977)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34868 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:问数技能 `objectstack-ask` 第 1 步点名 `list_datasets` 回答里的 `candidates`;第 2 步的两行"零命中"改读它:某个词没命中但服务器列了候选(一个或多个)就反问用户,不替用户选、不把候选当命中、先不算数;没命中也没候选才回退到对象查询并注明非指标口径。原先让客户端自己从目录里判断"宽泛说法"的两行和一段说明删掉。`/mcp/skill` 页面由技能生成,同步更新;评测用例补了"多个候选""一个候选""无候选"。 - **为什么改**:服务器已经会在零命中时返回候选(#34691 裁定 F1 B),而技能还在教客户端自己读整份目录去猜,又慢又不可靠,而且和工具说明、`initialize` 规则讲的不是一回事。席位裁定:只有一个候选也要问。 - **风险与回滚**:只改文字和评测,没有代码路径变化。技能正文变短(105 行变 101 行,1522 变 1491 token,上限同步下调)。连到不返回 `candidates` 的旧服务器时,零命中一律走带标注的回退,不再反问。回滚就是 revert 本 PR。 - **先看**:`skills/objectstack-ask/SKILL.md`(第 2 步表格的第 4、5 行,以及表格下方被删的那一段);`skills/objectstack-ask/evals/metric-selection-fallback.json`(用例 3、8、9);`scripts/check-skills-token-ratchet.mjs`(`objectstack-ask` 那一行由 1522 下调到 1491)。 - **两分钟验证**:在已构建的检出里跑 `node scripts/gen-mcp-ask-skill.mjs --check`,预期输出 `is current with skills/objectstack-ask/SKILL.md`、退出码 0。 - **需要你做的**:审阅并批准本 PR(`skills/**` 是受管面,按分支读数为 Tier H)。 ## What changes - **`skills/objectstack-ask/SKILL.md`, step 1.** One new bullet says what `candidates` is: a word that matched nothing may have them on the answer, each a `{ term, dataset, member }` pointer to a member the same answer lists, and a candidate is not a match. The `matches` / `matchedOn` bullet is unchanged. - **Step 2, rows 4 and 5.** The two rows that had the client judge a "loose form" are replaced: - "A word matches nothing, and `candidates` lists members for it, one or several": ask the user which one they mean, listing each candidate's label, its dataset's label and its description; with one candidate, ask whether it is the one meant. Do not pick one, never treat a candidate as a match, compute nothing yet. - "No match and no candidates for the word for a thing measured": step 4, and say in the answer that no governed metric was used. - **Step 2, the paragraph under the table** (the client's own loose-form check over the catalogue) is deleted. Rows 1, 2, 3 and 6 and the "When you ask" paragraph are byte-identical to `main`. - **`packages/mcp/src/ask-skill.generated.ts`** is regenerated by `node scripts/gen-mcp-ask-skill.mjs`, so `GET /mcp/skill` serves the same text. - **`skills/objectstack-ask/evals/metric-selection-fallback.json`.** Case 3 now gives an answer with three `candidates` and expects the question. New case 8: exactly one candidate, expects a question about that one and no computation. New case 9 (Chinese): no match and no `candidates` while a listed measure looks close, expects the fallback, opened with the 非指标口径 line and naming the dataset on the same object. Cases 4, 5 and 6 say in their prompts that the answer has no `candidates`, and cases 4 and 6 state the reason in the new rule's words. Cases 1, 2 and 7 are unchanged. - **`scripts/check-skills-token-ratchet.mjs`.** The `skills/objectstack-ask/SKILL.md` row is lowered from 1522 to 1491, pinned at the measurement, with the measurement in its comment. A lowering, so no ruling is needed for it; no other row moves. - **Changeset** `.changeset/34868-ask-skill-reads-candidates.md`: `@objectstack/skills` patch and `@objectstack/mcp` patch. ### Rows: skill vs tool texts The two reference strings are read on `main` at `44c7a4a415` and are not edited here. | Case | Skill, step 2 (also served at `/mcp/skill`) | `LIST_DATASETS_DESCRIPTION` | `DATASET_SELECTION_RULE` | |:--|:--|:--|:--| | A word matches exactly one measure | "Each word for a thing measured matches exactly one measure": compute; two words with one measure each "are two metrics, not a choice: compute both" (unchanged) | "a word for a thing measured that matches exactly one measure wins ... two such words are two metrics, so compute both" | "Each word that matches exactly one measure: answer with query_dataset; two such words are two metrics, so compute both." | | One word matches several measures | "Ask the user which one they mean. List each candidate's label, its dataset's label and its description. Do not pick one." (unchanged) | "ask the user which one is meant, listing each candidate's label, dataset label and description; never pick one" | "ask the user which one they mean; do not pick" | | No match, `candidates` listed | "A word matches nothing, and `candidates` lists members for it, one or several": "Ask the user which one they mean, listing each candidate's label, its dataset's label and its description; with one candidate, ask whether it is the one meant. Do not pick one, and never treat a candidate as a match. Compute nothing yet." (new) | "A word that matched nothing may have `candidates`, members offered as possible readings: ask the same way, listing each one's label, dataset label and description; never pick one, and never treat a candidate as a match." | "A word with no match but with candidates in the answer: ask the same way, listing each candidate's label, dataset label and description; do not pick one or treat it as a match." | | No match, no candidates | "No match and no candidates for the word for a thing measured": "Step 4, and say in the answer that no governed metric was used." Step 4 opens the answer with the 非指标口径 line. (new) | "No match and no candidates: fall back to the object query tools and say in the answer that no governed metric was used (非指标口径)" | "No match and no candidates: fall back to query_records / aggregate_records and say the answer is not from a governed metric." | | Only a dimension matches | "That is a grouping ... You still need a measure match" (unchanged) | "A dimension match alone picks a grouping, not a number: a measure must still match." | not carried by this text | Two places where the skill says more than the two strings, both on purpose: - The no-candidates row is scoped to "the word for a thing measured". A question such as 「本季度的营收是多少?」 sends 本季度 as a term too; it has no match and no candidates, and the question is still computed from the measure 营收 matched (eval case 1). The two strings leave that scope to the reader. - The skill spells out the one-candidate case ("with one candidate, ask whether it is the one meant"). The strings cover it with "never pick one", and the docblock above `DATASET_SELECTION_RULE` says "even for a single candidate". I found no contradiction between the two strings and the ADR-0149 D3 amendment note. ## Why The server now offers `candidates` for a word with no match (ruling on #34691, fork F1, option B; the shape came with #34761 and the executor with #34763, merged as `44c7a4a415`). The skill still told a client to read the whole catalogue and judge near readings itself, which is slower, differs from client to client, and stated a different rule from the tool description and the `initialize` text. The seat's ruling on pull request #34904 (Q1 A) is that one candidate is a question too; the ADR note ("With candidates, the AI asks in rule 3's form and acts on none") outranks the earlier wording "One near form is not a match either: it selects nothing". **The client's own loose-form judgment goes; it does not stay as a secondary check.** Reasons: - The ADR note says "With no candidate, rule 4 is unchanged. No hit and nothing offered is the labelled fallback to the object query", and "Which members are near enough to offer is the executor's rule". A client-side row "no candidates, but the word looks like a loose form of several measures: ask" would state a second nearness rule beside the executor's. - Both tool strings say "No match and no candidates: fall back". A secondary check in the skill would contradict them, and this card is done when the three texts state one rule. - `@objectstack/skills` and `@objectstack/mcp` are published at one version (one `fixed` group), and the server's `initialize` text tells a client to install the skills at the server's own version. So the skill that reads `candidates` ships with the server that fills them. - What is lost: against a server that returns no `candidates` (an older 18.x), and for a word that is near a measure only in translation (the deleted paragraph said "directly or in translation"; the executor compares by containment), the client no longer asks and takes the labelled fallback. That fallback is the ADR's rule 4, and step 4 still adds a line naming the listed dataset on the same object and its measures, so the user learns the governed figure exists. ## Tests All at head `bd92fff5b9`, after `pnpm --workspace-concurrency=2 --filter '@objectstack/mcp^...' build` (lock `VERDICT command-exit 0`). - `pnpm --filter @objectstack/mcp test`: Test Files 71 passed (71), Tests 1252 passed (1252); lock `VERDICT command-exit 0`. - `pnpm --filter @objectstack/mcp typecheck`: lock `VERDICT command-exit 0`; `check:test-typecheck: OK`. - `node scripts/gen-mcp-ask-skill.mjs --check`: exit 0, "is current with skills/objectstack-ask/SKILL.md". - Eval cases: the runner's own loader accepts the file (`skill-evals --dry-run --skills objectstack-ask`: "objectstack-ask: 9 case(s)", exit 0; no model call). A one-off consistency script (not committed) checks, for each case, that every `must_contain` token is in `expected_output`, that it is in the prompt or in `SKILL.md`, that no `must_not_contain` token is in `expected_output`, and that no token is on both lists: 9 cases, 55 tokens, 0 findings (control on `main`: 7 cases, 39 tokens, 0 findings). No eval round against a model was run. <details><summary>Ablation: the pin test goes red when the skill edit is reverted</summary> One behaviour, one ablation, with the change committed first. Mutation: `git restore --source=44c7a4a415 -- skills/objectstack-ask/SKILL.md` (working tree only), proved on disk by counting both the new and the old row text. ``` pre: new-row count=1 old-row count=0 mutated: new-row count=0 old-row count=1 RED-LEG vitest src/skill-single-source-34686.test.ts exit=1 Tests 2 failed | 1 passed (3) × the generated module equals the skill's data loop × the served section equals the skill's data loop, for every grant that is taught the dataset pair RED-LEG gen-mcp-ask-skill.mjs --check exit=1 "is stale against skills/objectstack-ask/SKILL.md" restored: git checkout HEAD -- (path); blob cd76aad == HEAD blob; git diff HEAD empty; status clean GREEN-LEG vitest exit=0 Tests 3 passed (3) GREEN-LEG gen-mcp-ask-skill.mjs --check exit=0 ``` The test reads the skill and the generated module from source, so no rebuild is part of either leg. </details> ## Acceptance notes - **Sizes, published skills.** `skills/objectstack-ask/SKILL.md`: 105 lines, 6105 bytes, 1522 tokens on `main`; 101 lines, 5981 bytes, 1491 tokens here (the gate's convention, stamp line excluded). All twelve `SKILL.md` files together: 4728 lines on `main`, 4724 here. Ratcheted authored total: 191126 tokens on `main`, 191095 here. The new text is paid for by deletion in the same file, with 31 tokens to spare. - **Sizes, evals (measured, not ratcheted).** The eval file: 75 lines, 2236 tokens on `main`; 95 lines, 3071 tokens here (+835). The growth is the three `candidates` lists the prompts now have to state and the two new cases. Whole shipped tree: 256680 tokens on `main`, 257484 here (+804). - **What was cut, and where it lives now.** (1) The row "the word is a loose form of several listed measures": replaced by the `candidates` row. (2) "One near form is not a match either: it selects nothing": replaced; one candidate is a question, and step 1 says a candidate is not a match. (3) "The same answer lists every dataset you may query with all its measures, matched or not (a call without `terms` returns that catalogue too)": this was there so the loose-form check needed no second read, and has no reader once the check is gone; step 1 still says each dataset in the answer carries `matches`, and the new bullet says a candidate points to a member the same answer lists. (4) The definition of a loose form and its two examples: removed with the check. - **Two pending changesets describe the wording this replaces** (`.changeset/34685-ask-data-skill.md`, `.changeset/34686-skill-single-source.md`: "a loose form of several listed measures", "One near form selects nothing"). I did not edit them: each records what its own pull request did. The new changeset says that it supersedes those sentences, so the compiled CHANGELOG reads in order. Carrier: the seat, if it prefers the older entries corrected. - **A comment this makes out of date, outside my file surface.** The docblock above `DATASET_SELECTION_RULE` (`packages/mcp/src/mcp-server-runtime.ts`) ends "The skill's own loose-form rows predate `candidates` and are amended in its lane." After this pull request those rows no longer exist. That file is the reference here and is not in the claim's file surface, so it is reported, not edited. Carrier: the seat. - **Not decided here.** The skill does not say what the client does after the user answers the question (pick a candidate and compute it, or fall back when the answer settles nothing). The ADR note states it ("rule 4 still governs it when the question settles nothing"); the skill did not say it for the several-matches row either, and the card does not ask for it. - `check:skill-docs` needed no regeneration ("Skill docs in sync"): the frontmatter is unchanged. ## Verification - **Derived gates at `bd92fff5b9`:** `node scripts/pm/dispatch-gates.mjs --commands` (no paths) gave 88 commands; each was run with its exit code recorded before any pipe, then `--ran`: "88 derived famil(ies) accounted for — 87 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)", exit 0. 87 exited 0. - **NOT MEASURED: `pnpm check:dual-build-cjs-loads`**, reason: exit 3, prerequisite not met (it needs a whole-workspace `pnpm build`; only the `@objectstack/mcp` dependency closure was built). CI's run is the reading. - Named in the order: `node scripts/check-skills-token-ratchet.mjs` exit 0 ("skills/objectstack-ask/SKILL.md is 1491 tokens (ceiling 1491; headroom 0)"); its `--self-test` exit 0 ("104 cases pass"); `pnpm check:skill-compatibility` exit 0; `pnpm --filter @objectstack/spec run check:skill-docs` exit 0 ("Skill docs in sync"). - `node scripts/pm/overlap-check.mjs` before the push: "VERDICT clean exit 0" (against `origin/main` and the two open pull requests that share a file, #34793 and #33849). - `node scripts/pm/check-governed-merges.mjs --branch claude/issue-34868-ask-skill-reads-candidates`: GOVERNED, landing tier H, `skills/**` ×2; low-risk skills arm NOT MEASURED without the pull request; 97 changed lines (+70 / -27), under the 3000 threshold; exit 3. - `dispatch-gates --tier`: MANDATORY contract-review tier for `skills/**`, no one-line exit. - Not run locally, left to CI: `pnpm lint`, the `test:repo` project, and the full gate farm outside the derived list. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No schema touched.) - [x] 2. Every name I added uses the casing for its kind. (No name added.) - [ ] 3. No formatter ran; `pnpm lint` passes. (No formatter ran; `pnpm lint` is left to CI.) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (Not touched.) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (The 维护者速读 block is in Chinese by the repository's convention.) --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzfR33NbV51QQU6R6bm --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent db1a05c commit e556e3a

5 files changed

Lines changed: 70 additions & 27 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/skills': patch
3+
'@objectstack/mcp': patch
4+
---
5+
6+
docs(skills): the `objectstack-ask` skill reads `candidates` for a word that matched nothing
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
`list_datasets` now answers a business word that matched nothing with `candidates`, the members the server offers as possible readings. The `objectstack-ask` skill, and the page at `GET /mcp/skill` that is generated from it, still told a client to judge near readings itself from the catalogue. They now read the server's list, in the same rule the `list_datasets` tool description and the `initialize` selection rule state.
12+
13+
What a connected client now reads, where it differs from before:
14+
15+
- Step 1 names `candidates`: a word that matched nothing may have them, each a `{ term, dataset, member }` pointer to a member the same answer lists. A candidate is not a match.
16+
- A word with no match and one or more candidates is a question for the user. The client lists each candidate's label, its dataset's label and its description, picks none, treats none as a match and computes nothing until the user answers.
17+
- One candidate is a question too: the client asks whether it is the one meant. This replaces the earlier wording, in which one near form selected nothing and went to the fallback.
18+
- No match and no candidates for the word for a thing measured is the fallback to the object tools, with the answer saying no governed metric was used (非指标口径).
19+
- The client's own loose-form check is removed: the two rows that had the client judge whether a word was a loose form of several listed measures, and the paragraph that defined a loose form. This supersedes the loose-form sentences in this release's earlier `objectstack-ask` and `GET /mcp/skill` entries. Against a server that returns no `candidates`, a word with no match goes to the labelled fallback, which still names a listed dataset on the same object.
20+
21+
The skill's eval cases cover several candidates, one candidate, and no candidates. `packages/mcp/src/ask-skill.generated.ts` is regenerated from the skill; no code path changes.

‎packages/mcp/src/ask-skill.generated.ts‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export const ASK_SKILL_DATA_LOOP: string = [
2525
' `term`, the `member` it names (`measures.<name>` or `dimensions.<name>`) and',
2626
' `matchedOn`. A word matches only when it equals a member\'s name, label or',
2727
' synonym (case, spacing, `_` and `-` aside), never by similarity.',
28+
'- A word that matched nothing may have `candidates` on the answer: members',
29+
' offered as possible readings, each a `{ term, dataset, member }` pointer to a',
30+
' member the same answer lists. A candidate is not a match.',
2831
'- No `list_datasets` among your tools: this environment serves you no governed',
2932
' metrics. Go to step 4.',
3033
'',
@@ -35,17 +38,10 @@ export const ASK_SKILL_DATA_LOOP: string = [
3538
'| Each word for a thing measured matches exactly one measure | Compute: step 3. Two words with one measure each ("营收和赢单率") are two metrics, not a choice: compute both, with one `query_dataset` per dataset. |',
3639
'| One word matches several measures, in one dataset or in two | Ask the user which one they mean. List each candidate\'s label, its dataset\'s label and its description. Do not pick one. |',
3740
'| Only a dimension matches | That is a grouping ("by stage"), not a number. You still need a measure match; without one, ask which number is meant. |',
38-
'| Nothing matches, and the word is a loose form of several listed measures | Ask the user which one they mean, listing the same three things. Do not pick one, and compute nothing yet. |',
39-
'| Nothing matches, and the listed measures do not offer several readings of the word | Step 4, and say in the answer that no governed metric was used. One near form is not a match either: it selects nothing. |',
41+
'| A word matches nothing, and `candidates` lists members for it, one or several | Ask the user which one they mean, listing each candidate\'s label, its dataset\'s label and its description; with one candidate, ask whether it is the one meant. Do not pick one, and never treat a candidate as a match. Compute nothing yet. |',
42+
'| No match and no candidates for the word for a thing measured | Step 4, and say in the answer that no governed metric was used. |',
4043
'| `membersWithheld: true` on a dataset | Say that it has members (measures or groupings) you may not read; the metric asked for may be among them. Do not say the metric does not exist. |',
4144
'',
42-
'The same answer lists every dataset you may query with all its measures,',
43-
'matched or not (a call without `terms` returns that catalogue too), so the',
44-
'loose-form check needs no second read. A loose form is a word a listed',
45-
'measure\'s name, label or description contains, directly or in translation:',
46-
'"revenue" against Won Revenue, Annual Revenue and Planned Revenue; "金额"',
47-
'against several amounts.',
48-
'',
4945
'When you ask, the reply is the question alone: no figure, and no tool call',
5046
'until the user answers. `partial: true` on the answer means the catalogue may',
5147
'be incomplete; `warning` says why, and you repeat it when you fall back.',

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,17 @@ export const CEILINGS = new Map([
16951695
// a match either. 5848 -> 6105 bytes (+257), less the 20-byte stamp line:
16961696
// 5828 -> 6085 priced bytes, ceil(6085 / 4) = 1522 (+65). Still the new
16971697
// file's own measurement, pinned AT it, zero headroom; no other row moves.
1698-
['skills/objectstack-ask/SKILL.md', 1522],
1698+
// 1522 -> 1491, a LOWERING, re-measured on the PR that makes step 2 read the
1699+
// answer's `candidates` (ADR-0149 D3 amendment note): a word with no match
1700+
// and a candidate listed is a question for the user, a lone candidate
1701+
// included, and no match with no candidate is the labelled fallback. Cut:
1702+
// the two loose-form rows and the paragraph that defined a loose form over
1703+
// the catalogue, since the server's `candidates` replaces the client's own
1704+
// check. Added: one step 1 bullet naming `candidates`, and the two rows that
1705+
// read it. 6105 -> 5981 bytes (-124), less the 20-byte stamp line:
1706+
// ceil(($(wc -c < skills/objectstack-ask/SKILL.md) - 20) / 4) == ceil(5961 / 4)
1707+
// = 1491 (-31). Pinned AT the measurement, zero headroom; no other row moves.
1708+
['skills/objectstack-ask/SKILL.md', 1491],
16991709
]);
17001710

17011711
/**

‎skills/objectstack-ask/SKILL.md‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ wrote its business definition) outranks a number you work out yourself.
3838
`term`, the `member` it names (`measures.<name>` or `dimensions.<name>`) and
3939
`matchedOn`. A word matches only when it equals a member's name, label or
4040
synonym (case, spacing, `_` and `-` aside), never by similarity.
41+
- A word that matched nothing may have `candidates` on the answer: members
42+
offered as possible readings, each a `{ term, dataset, member }` pointer to a
43+
member the same answer lists. A candidate is not a match.
4144
- No `list_datasets` among your tools: this environment serves you no governed
4245
metrics. Go to step 4.
4346

@@ -48,17 +51,10 @@ wrote its business definition) outranks a number you work out yourself.
4851
| Each word for a thing measured matches exactly one measure | Compute: step 3. Two words with one measure each ("营收和赢单率") are two metrics, not a choice: compute both, with one `query_dataset` per dataset. |
4952
| One word matches several measures, in one dataset or in two | Ask the user which one they mean. List each candidate's label, its dataset's label and its description. Do not pick one. |
5053
| Only a dimension matches | That is a grouping ("by stage"), not a number. You still need a measure match; without one, ask which number is meant. |
51-
| Nothing matches, and the word is a loose form of several listed measures | Ask the user which one they mean, listing the same three things. Do not pick one, and compute nothing yet. |
52-
| Nothing matches, and the listed measures do not offer several readings of the word | Step 4, and say in the answer that no governed metric was used. One near form is not a match either: it selects nothing. |
54+
| A word matches nothing, and `candidates` lists members for it, one or several | Ask the user which one they mean, listing each candidate's label, its dataset's label and its description; with one candidate, ask whether it is the one meant. Do not pick one, and never treat a candidate as a match. Compute nothing yet. |
55+
| No match and no candidates for the word for a thing measured | Step 4, and say in the answer that no governed metric was used. |
5356
| `membersWithheld: true` on a dataset | Say that it has members (measures or groupings) you may not read; the metric asked for may be among them. Do not say the metric does not exist. |
5457

55-
The same answer lists every dataset you may query with all its measures,
56-
matched or not (a call without `terms` returns that catalogue too), so the
57-
loose-form check needs no second read. A loose form is a word a listed
58-
measure's name, label or description contains, directly or in translation:
59-
"revenue" against Won Revenue, Annual Revenue and Planned Revenue; "金额"
60-
against several amounts.
61-
6258
When you ask, the reply is the question alone: no figure, and no tool call
6359
until the user answers. `partial: true` on the answer means the catalogue may
6460
be incomplete; `warning` says why, and you repeat it when you fall back.

0 commit comments

Comments
 (0)