Skip to content

Commit 68e76fa

Browse files
docs(skills): objectstack-ask step 2 answers from the records when no candidate's dataset carries the asked grouping (#39328)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg6QH4oAzb3iViTHPkq3LwzC)_ Fixes #39285 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用 AI 客户端问数的人,问「按某个维度拆分或排名」而候选指标所在的数据集没有这个维度时,以前照着技能会被反问「你指的是哪个指标」,现在直接拿到按记录算出的答案,并被告知哪个指标缺哪个分组。数据读取不完整时仍然照旧先问。 - 为什么做:属于「AI 通过数据集回答业务问题」这条线。平台的行为今天已经改了,对外发布的问数技能还在教「一律反问」,这次补上技能这一半。 - 出错会怎样:最坏是客户端在本该反问时直接去查了记录,答案开头仍会标明「非指标口径」。改的只是技能文字,撤回这个改动即可。 - 要你做什么:审阅并批准这个改动(对外技能包,需人工合入)。 ## What changes `skills/objectstack-ask/SKILL.md`, step 2, gains one table row under the row for a word with a measure among its `candidates`. It teaches the step the ruling on #39152 (option P, step 2; ruling record 7363768737) orders and ADR-0149 D3 records in its grouping note of 2026-12-03, in the words `list_datasets` writes in `nextStep.note` on `main` (`groupingCheck` in `packages/services/service-analytics/src/dataset-next-step.ts`): > Such a word in a breakdown or ranking, when `nextStep.note` lists its readings' groupings and no dataset there carries all it is split or ranked by (a date one keeps its calendar buckets) → Do not ask: step 4, naming each reading as a declared metric and the grouping its dataset lacks. - The grouping is read whole: "all it is split or ranked by". A dataset that carries one of two asked groupings does not carry it. - A date dimension keeps its calendar buckets, so "by month" beside a date is a grouping the dataset can give. - The row waits for the note's list. A `partial: true` answer carries no such list (the executor's `groupingSentences` writes nothing there), so the word is asked about as before. This is finding S1 of the contract review, fixed in the row's condition. - "Readings" is the note's word for the measure candidates, so a dimension candidate is not counted among them. - The row above it still asks in every other case, and the note's own "Otherwise:" hands over to that question. No measure is selected in either case. `packages/mcp/src/ask-skill.generated.ts` is regenerated from the skill (`node scripts/gen-mcp-ask-skill.mjs`), so the page at `GET /mcp/skill` carries the same text. `skills/objectstack-ask/evals/metric-selection-fallback.json` gains two cases, each with the `note` taken from a probe run of `list_datasets` on this branch: - Case 28: the booked amount by order status and by product category, beside a dataset that carries order status and a date. The expected answer asks nothing, reads the records, and says the dataset lacks product category. Its ask-back literals also refuse the single-candidate forms ("Did you mean", "the one you mean?"). - Case 29: the same question on a `partial: true` answer, whose note lists no groupings. The expected reply is the question about the word and nothing else. The reference answers of cases 9, 20, 21, 22, 24 and 26 no longer repeat the reasons cut from the skill. ### The row is paid for inside the file The ratchet row stays `['skills/objectstack-ask/SKILL.md', 2040]`, and `scripts/check-skills-token-ratchet.mjs` is not touched. | Reading | Before (`dc4a2cdb`) | After (`5fbd110b`) | |:--|--:|--:| | `skills/objectstack-ask/SKILL.md`, lines | 132 | 130 | | `skills/objectstack-ask/SKILL.md`, bytes | 8185 | 8187 | | `skills/objectstack-ask/SKILL.md`, priced tokens | 2040 | 2040 | | every `SKILL.md` in `skills/`, lines | 2122 | 2120 | | every `SKILL.md` in `skills/`, bytes | 119434 | 119436 | The new row is 291 bytes. Five cuts, 289 bytes in all, pay for it, and the priced bytes land on 8160, which is the 2040 ceiling exactly. No instruction leaves with the cuts: | Cut | Bytes | Why nothing is lost | |:--|--:|:--| | "You are connected to a live environment through its MCP tools, and the user asked for a figure or a list from its data." | 120 | It restated the skill's description and its title. On the served page it sits under the heading "Answering a business question", in a page about the environment's tools. | | "this environment serves you no governed metrics." | 51 | A reason. The instruction stays: "No `list_datasets` among your tools: go to step 4." | | "A grouping is not a number:" | 28 | A reason that restated the row's own left cell. The instruction stays: "Ask which number is meant." | | ", so the database ranks and cuts the groups" | 45 | A reason. The instruction stays: pass `orderBy` and `limit: N`. | | ", so the user can ask for the governed figure" | 45 | A reason. The instruction stays: add one line naming the dataset and its measures. | ## Tests At head `5fbd110b`, except where a line names `d8005d20`, the head before the review round. - `skill-single-source-34686.test.ts` in `@objectstack/mcp`, which holds the generated module equal to the skill: 1 file, 3 tests passed. - `node scripts/gen-mcp-ask-skill.mjs --check`: the module is current with the skill. - `node scripts/check-skills-token-ratchet.mjs`: `skills/objectstack-ask/SKILL.md is 2040 tokens (ceiling 2040; headroom 0)`. - `skill-evals --skills objectstack-ask --dry-run`: the reader takes the bundle's 29 behaviour cases and 7 trigger cases, and refuses none. - At `d8005d20`: `pnpm --filter @objectstack/mcp test`, 89 files, 1662 tests passed; `pnpm --filter @objectstack/mcp typecheck`, exit 0. Neither was re-run on `5fbd110b`: the round changed skill text, the generated string and an eval fixture. - No ablation: the diff changes skill text and an eval fixture, and no tested behaviour. ### Gates - At `5fbd110b`, each with exit 0: `node scripts/check-skills-token-ratchet.mjs` and its `--self-test`, `node scripts/gen-mcp-ask-skill.mjs --check`, `pnpm --filter @objectstack/spec run check:skill-docs`, `pnpm check:skill-links`, `pnpm check:skill-identifier-liveness`, `pnpm check:skill-compatibility`, `pnpm check:skill-frame-sync`, `pnpm check:nul-bytes`, `pnpm check:doc-authoring`, `pnpm check:issue-citations`, `pnpm check:pm-skill-id-lint`, `pnpm check:role-word`. - At `d8005d20`: `node scripts/pm/dispatch-gates.mjs --ran` read "73 derived famil(ies) accounted for — 71 run, 2 NOT-MEASURED". The 71 exited 0. - NOT MEASURED: `node scripts/check-plugin-teardown-shape.mjs --self-test`, exit 3, reason: its fixture commit is outside the shallow clone. The scan itself exited 0. - NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, reason: it needs a whole-workspace build. CI's `Lint & Repo Gates` runs it. - NOT MEASURED: the rest of the derived list on `5fbd110b`, reason: a declared narrowing to the families that read the changed files. CI runs the farm on this head. ## Live check `pnpm --filter @objectstack/scenarios skill-evals --case 'objectstack-ask/metric-selection-fallback#28,objectstack-ask/metric-selection-fallback#29' --model haiku --effort medium --repeats 1`, on `5fbd110b`, subscription login (`oauth_token`, no API key), served `claude-haiku-5-5`. One repetition, so it shows whether the behaviour appears and claims no rate. | Case | with-skill | no-skill | |:--|:--|:--| | 28, a complete answer | pass | fail (asks nothing and reads the records, but never names `describe_object`) | | 29, a `partial: true` answer | pass | pass | Notional cost the CLI reported: $0.01. Nothing was billed. On the head before the review round (`d8005d20`), case 28 gave the same two results, and it also passed with the skill on the base text (`dc4a2cdb`, case copied in). The prompt of each case quotes the platform's `note`, and the skill says to follow it, so at this model and one repetition the note alone carries both behaviours: case 29 passes without the skill too. What the row changes is that the skill no longer says "ask" where the note says not to, and after the review round it no longer says "do not ask" where the note asks. ## Review records - Contract review record 7378813195 on head `d8005d20`: PASS, with S1 (the row acted on a `partial: true` answer) and nits N1 to N4. - Delta contract review record 7379069601 on head `5fbd110b`: PASS, S1 closed. ## Acceptance notes - The card's re-check, `grep -rn "ask back\|asks back\|candidates_only" skills/objectstack-ask/`, still hits the eval file only. The row uses the words of step 2's other rows ("Do not ask"). - The card asked for one eval case. Case 29 is one more, added in the review round to pin the partial-answer rule. - ADR-0149's note says where the client cannot tell, the question is owed. The row adds no sentence for it: the row above it is still the default, and `nextStep.note` ends its grouping sentence with "Otherwise:" before the question. - The note's four cases under "Not covered" (a measure hit, several hits, a filter or time window, candidates across datasets of which only some carry the grouping) keep their rows. The row's "no dataset there" leaves the fourth to the question, as the note does. ## Verification - Read first, by risk: `skills/objectstack-ask/SKILL.md` (the new row at step 2, then the five cuts), `skills/objectstack-ask/evals/metric-selection-fallback.json` (cases 28 and 29), `.changeset/39285-ask-skill-grouping-lacked.md`. `packages/mcp/src/ask-skill.generated.ts` is generated. - Two-minute check: `node scripts/gen-mcp-ask-skill.mjs --check && node scripts/check-skills-token-ratchet.mjs | grep objectstack-ask/SKILL.md`. Expected: "is current with" and "2040 tokens (ceiling 2040; headroom 0)". --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CZyaZyJWdzKPF2U7EQ)_ <!-- signed: repo:objectstack@os-bill · os-bill · session_01Utp6CZyaZyJWdzKPF2U7EQ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ad4984f commit 68e76fa

4 files changed

Lines changed: 64 additions & 26 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/skills': patch
3+
'@objectstack/mcp': patch
4+
---
5+
6+
docs(skills): objectstack-ask step 2 teaches the breakdown or ranking no candidate's dataset can give
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
The `objectstack-ask` skill, and the page at `GET /mcp/skill` that is generated from it, now teach what `list_datasets` already says in `nextStep.note` (ADR-0149 D3, the grouping note of 2026-12-03). Step 2's table has one more row, under the row for a word with a measure among its `candidates`:
12+
13+
- **Before.** The skill said to ask about such a word in every case, so a client that followed the skill over the note asked which measure was meant even where no answer could lead to the figure.
14+
- **Now.** When the question breaks the number down or ranks it, `nextStep.note` lists what the word's readings can be grouped by, and no dataset in that list carries all the number is split or ranked by, the client does not ask. It answers from the records (step 4), names each reading as a declared metric, and names the grouping its dataset lacks. The grouping is read whole: a dataset with one of two asked groupings does not carry it. A date dimension keeps its calendar buckets, so "by month" beside a date is a grouping the dataset can give. The row waits for the note's list: a `partial: true` answer carries no such list, and the word is asked about as before.
15+
16+
No measure is selected in either case, and nothing in the tools changes.
17+
18+
The row is paid for inside the file, which goes from 8185 to 8187 bytes and stays at its 2040 priced tokens. Five passages are cut, and no instruction leaves with them: the opening sentence that restated the skill's description and title ("You are connected to a live environment through its MCP tools, and the user asked for a figure or a list from its data."), and four reasons attached to instructions that stay ("this environment serves you no governed metrics", "A grouping is not a number:", ", so the database ranks and cuts the groups", ", so the user can ask for the governed figure").
19+
20+
`skills/objectstack-ask/evals/metric-selection-fallback.json` gains two cases. Case 28: a question by order status and by product category beside a dataset that carries order status and a date only. The expected answer asks nothing, reads the records, and says the dataset lacks product category. Case 29: the same question on a `partial: true` answer, whose note lists no groupings. The expected reply is the question about the word and nothing else. The reference answers of cases 9, 20, 21, 22, 24 and 26 no longer repeat the reasons cut from the skill.

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
* register for the grant. One source: the published skill.
1010
*/
1111
export const ASK_SKILL_DATA_LOOP: string = [
12-
'You are connected to a live environment through its MCP tools, and the user',
13-
'asked for a figure or a list from its data. Work these steps in order for every',
14-
'question. Never skip step 1: a governed metric (a dataset measure whose owner',
15-
'wrote its business definition) outranks a number you work out yourself.',
12+
'Work these steps in order for every question. Never skip step 1: a governed',
13+
'metric (a dataset measure whose owner wrote its business definition) outranks a',
14+
'number you work out yourself.',
1615
'',
1716
'## 1. Lift the business words and look for a governed metric',
1817
'',
@@ -36,8 +35,7 @@ export const ASK_SKILL_DATA_LOOP: string = [
3635
' host reads no field labels) is not offered for that word. A measure with no',
3736
' filter or over a relationship path is offered as before, and so is every',
3837
' measure when the word names different fields through different candidates.',
39-
'- No `list_datasets` among your tools: this environment serves you no governed',
40-
' metrics. Go to step 4.',
38+
'- No `list_datasets` among your tools: go to step 4.',
4139
'',
4240
'## 2. Decide by the matches',
4341
'',
@@ -46,9 +44,10 @@ export const ASK_SKILL_DATA_LOOP: string = [
4644
'| 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. |',
4745
'| 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 as written, one bullet each. Do not pick one. |',
4846
'| A word with a measure among its `candidates` | Ask the same way; with one candidate, ask whether it is the one meant. |',
47+
'| Such a word in a breakdown or ranking, when `nextStep.note` lists its readings\' groupings and no dataset there carries all it is split or ranked by (a date one keeps its calendar buckets) | Do not ask: step 4, naming each reading as a declared metric and the grouping its dataset lacks. |',
4948
'| A word that names the field a filtered measure aggregates (`nextStep.note` names the field) | Do not ask about that measure: answer from the field (step 4) and mention the measure as a narrower declared metric. Ask first about another measure candidate left for the word; the field then answers only if the question settles nothing. |',
5049
'| A word whose `candidates` are all dimensions | At most a possible grouping: never ask about it, and it never stops a matched measure. |',
51-
'| No word for a thing measured, only grouping or filter words | A grouping is not a number: ask which number is meant. |',
50+
'| No word for a thing measured, only grouping or filter words | Ask which number is meant. |',
5251
'| No match and no candidates for the word for a thing measured | Step 4, without asking: a grouping word\'s match, or another word\'s, is no reason to ask. |',
5352
'| `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. |',
5453
'',
@@ -88,15 +87,14 @@ export const ASK_SKILL_DATA_LOOP: string = [
8887
' by the option\'s `value`, never its label.',
8988
'- Use `aggregate_records` for a count, sum, average or breakdown. Never page',
9089
' through `query_records` to add numbers up yourself. For a top or bottom N,',
91-
' pass `orderBy` (an aggregation alias or a group key) and `limit: N`, so the',
92-
' database ranks and cuts the groups.',
90+
' pass `orderBy` (an aggregation alias or a group key) and `limit: N`.',
9391
'- `withheldFields` on a `query_records` or `get_record` answer names fields',
9492
' that exist but are hidden from you: say they are not visible to you, never',
9593
' that they are empty.',
9694
'- Open the answer with one line saying it is not from a governed metric',
9795
' (非指标口径), and name the object and fields you computed it from.',
9896
'- When that object is a listed dataset\'s `object`, add one line naming the',
99-
' dataset and its measures, so the user can ask for the governed figure.',
97+
' dataset and its measures.',
10098
'',
10199
'## 5. When the data cannot answer',
102100
'',

‎skills/objectstack-ask/SKILL.md‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ metadata:
2424

2525
# Answering a business question over an ObjectStack environment
2626

27-
You are connected to a live environment through its MCP tools, and the user
28-
asked for a figure or a list from its data. Work these steps in order for every
29-
question. Never skip step 1: a governed metric (a dataset measure whose owner
30-
wrote its business definition) outranks a number you work out yourself.
27+
Work these steps in order for every question. Never skip step 1: a governed
28+
metric (a dataset measure whose owner wrote its business definition) outranks a
29+
number you work out yourself.
3130

3231
## 1. Lift the business words and look for a governed metric
3332

@@ -51,8 +50,7 @@ wrote its business definition) outranks a number you work out yourself.
5150
host reads no field labels) is not offered for that word. A measure with no
5251
filter or over a relationship path is offered as before, and so is every
5352
measure when the word names different fields through different candidates.
54-
- No `list_datasets` among your tools: this environment serves you no governed
55-
metrics. Go to step 4.
53+
- No `list_datasets` among your tools: go to step 4.
5654

5755
## 2. Decide by the matches
5856

@@ -61,9 +59,10 @@ wrote its business definition) outranks a number you work out yourself.
6159
| 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. |
6260
| 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 as written, one bullet each. Do not pick one. |
6361
| A word with a measure among its `candidates` | Ask the same way; with one candidate, ask whether it is the one meant. |
62+
| Such a word in a breakdown or ranking, when `nextStep.note` lists its readings' groupings and no dataset there carries all it is split or ranked by (a date one keeps its calendar buckets) | Do not ask: step 4, naming each reading as a declared metric and the grouping its dataset lacks. |
6463
| A word that names the field a filtered measure aggregates (`nextStep.note` names the field) | Do not ask about that measure: answer from the field (step 4) and mention the measure as a narrower declared metric. Ask first about another measure candidate left for the word; the field then answers only if the question settles nothing. |
6564
| A word whose `candidates` are all dimensions | At most a possible grouping: never ask about it, and it never stops a matched measure. |
66-
| No word for a thing measured, only grouping or filter words | A grouping is not a number: ask which number is meant. |
65+
| No word for a thing measured, only grouping or filter words | Ask which number is meant. |
6766
| No match and no candidates for the word for a thing measured | Step 4, without asking: a grouping word's match, or another word's, is no reason to ask. |
6867
| `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. |
6968

@@ -103,15 +102,14 @@ Use an option only once the user picks it: compute it by its exact name
103102
by the option's `value`, never its label.
104103
- Use `aggregate_records` for a count, sum, average or breakdown. Never page
105104
through `query_records` to add numbers up yourself. For a top or bottom N,
106-
pass `orderBy` (an aggregation alias or a group key) and `limit: N`, so the
107-
database ranks and cuts the groups.
105+
pass `orderBy` (an aggregation alias or a group key) and `limit: N`.
108106
- `withheldFields` on a `query_records` or `get_record` answer names fields
109107
that exist but are hidden from you: say they are not visible to you, never
110108
that they are empty.
111109
- Open the answer with one line saying it is not from a governed metric
112110
(非指标口径), and name the object and fields you computed it from.
113111
- When that object is a listed dataset's `object`, add one line naming the
114-
dataset and its measures, so the user can ask for the governed figure.
112+
dataset and its measures.
115113

116114
## 5. When the data cannot answer
117115

0 commit comments

Comments
 (0)