Repository navigation
Commit e556e3a
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
- .changeset
- packages/mcp/src
- scripts
- skills/objectstack-ask
- evals
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | | - | |
39 | | - | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1695 | 1695 | | |
1696 | 1696 | | |
1697 | 1697 | | |
1698 | | - | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
1699 | 1709 | | |
1700 | 1710 | | |
1701 | 1711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | | - | |
52 | | - | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 58 | | |
63 | 59 | | |
64 | 60 | | |
| |||
0 commit comments