Repository navigation
Commit 38ab473
docs(skills): objectstack-ask answers a word that names the field a filtered measure aggregates from that field (ADR-0149 D3 note of 2026-12-01) (#38915)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBG4YD4RMAt72Ga5PdYYZDAQ)_
Fixes #38870
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 通过 MCP 连到环境来问数的 AI
客户端会读我们对外发布的「问数」技能:用户说的词正好是某个带筛选条件的指标所汇总的字段时(例如「工时」对「计费工时」),技能原先教它反问,现在教它直接按该字段回答、注明非指标口径、顺带提一句那个更窄的指标,和服务端已上线的行为一致。
- 属于「AI 通过数据集语义层回答业务问题」这条线:服务端规则已随上一个改动合并,这次让发给客户的技能文本跟上,避免技能和工具说明各说一套。
- 若措辞有误,最坏是某个 AI
在本该反问时直接按字段回答(或反过来);不带筛选的指标、跨关联路径的字段、一个词同时指向不同字段,这三种情况技能里仍写明照旧反问;只改文字和由它生成的技能页,不涉及数据和元数据格式,可整体撤回。
- 这是对外发布的技能文本,需要你批准后才能合并;其中技能长度上限按实测上调了 167 个计数单位(先删掉了一处重复说法)。
## What changes
PR #38869 made `list_datasets` stop offering, for a word, a measure that
carries a `filter` and aggregates a field the word names (ADR-0149 D3,
the amendment note of 2026-12-01; ruling record 7301332152). The two
tool texts say so; the published `objectstack-ask` skill still said
every measure candidate is asked about. This PR brings the skill to the
tool texts, in their words. No code path changes.
- **`skills/objectstack-ask/SKILL.md`, step 1.** One new bullet under
the `candidates` bullet: a measure that carries a filter and aggregates
a field the word names (the word equals or is inside the field's label
or name; the name only where the host reads no field labels) is not
offered for that word. A measure with no filter or over a relationship
path is offered as before, and so is every measure when the word names
different fields through different candidates.
- **Step 2 table.** One new row after the `candidates` row: for a word
that names the field a filtered measure aggregates, `nextStep.note`
names the field; the client does not ask about that measure, answers
from the field (step 4, the labelled fallback) and mentions the measure
as a narrower declared metric. Another measure candidate left for the
word is asked about first, and the field then answers only if the
question settles nothing.
- **Paid down first.** The listing instruction was written twice: in the
several-measures row ("List each candidate's label, its dataset's label
and its description.") and in the paragraph under the table (": name
each option by its label in a bullet, and quote its description as
written"). It keeps one home, the row, which now reads "List each
candidate's label, its dataset's label and its description as written,
one bullet each." The paragraph's half is deleted. The `candidates`
row's "Ask the same way" still points at that row.
- **Step 4 is unchanged.** The card also names the last two step 4
bullets. They were read and left: "Open the answer with one line saying
it is not from a governed metric" is the label the new row sends the
reader to, and the line about a dataset on the fallback object is the
recommended line the ADR note says "is unchanged and stays recommended
practice".
- **`skills/objectstack-ask/evals/metric-selection-fallback.json`.** Two
cases added (ids 26 and 27), both with the `nextStep.note` in the
executor's own zh-Hans sentences. 26: 「工时」 beside the filtered measure
计费工时 over the field 工时, `no_measure`, no `candidates`: the field answers
through `describe_object` and `aggregate_records`, labelled 非指标口径, the
measure mentioned, no question and no dataset query. 27: 「销售」 beside 销售额
over the field 金额, `candidates_only`: still a question, nothing
computed. Case 17 (the English "sales" near-miss) is untouched.
- **`packages/mcp/src/ask-skill.generated.ts`.** Regenerated by `node
scripts/gen-mcp-ask-skill.mjs`; not hand-edited.
- **`scripts/check-skills-token-ratchet.mjs`.** The `objectstack-ask`
row moves 1873 to 2040, with the comment pattern of the rows above it.
No other row moves.
- **Changeset.** `.changeset/38870-ask-skill-field-term.md`, `patch` on
`@objectstack/skills` and `@objectstack/mcp` (the served `GET
/mcp/skill` page ships in the mcp `dist`).
### The skill's rule against the tool texts, clause by clause
Sources at this head: `LIST_DATASETS_DESCRIPTION` is in
`packages/services/service-analytics/src/dataset-tools.ts` (its field
sentence is `DATASET_FIELD_TERM_SENTENCE`, lines 115-118, joined at line
135); the `candidates` description is
`packages/spec/src/ai/dataset-tools.zod.ts` lines 325-341;
`DATASET_SELECTION_RULE` is `packages/mcp/src/mcp-server-runtime.ts`
lines 1908-1925.
| Clause | Skill (`SKILL.md` line) | Source |
|:--|:--|:--|
| A measure that carries a filter and aggregates a field the word names
is not offered for that word | 49-51 | spec `candidates` 329-330: "A
measure that carries a filter and whose aggregated field the term names
... is not offered for that term" |
| "Names" means the word equals or is inside the field's label or name |
49-50 | `dataset-tools.ts` 116-117 and `mcp-server-runtime.ts`
1919-1920: "it equals or is inside that field's label or name"; spec
329-330 |
| A host that reads no field labels tests the name only | 50-51 |
`dataset-tools.ts` 135: "A host that reads no field labels tests the
field name only." |
| A measure with no filter is offered as before | 51-52 | spec 333: "a
measure with no filter is offered as before" |
| A measure over a relationship path is offered as before | 52 | not in
either tool text; ADR-0149 D3 note of 2026-12-01, second point
(`docs/adr/0149-...md` line 206): "A measure whose `field` is a
relationship path is not tested: it stays offered and asked about, as
before." |
| Every measure is offered when the word names different fields through
different candidates | 52-53 | spec 332-333: "Such a measure is still
offered when the term names different fields through different
candidates" |
| `nextStep.note` names the field | 64, left cell | spec 331:
"`nextStep.note` names the field and mentions the measure as a narrower
declared metric" |
| The word is not asked about for that measure | 64 | `dataset-tools.ts`
117 and `mcp-server-runtime.ts` 1920: "is not asked about for that
measure" |
| The field answers it under the labelled fallback | 64 ("answer from
the field (step 4)"; step 4 opens the answer with the 非指标口径 line) |
`dataset-tools.ts` 117-118 and `mcp-server-runtime.ts` 1920-1921: "the
field answers it through the object query tools, labelled as not from a
governed metric" |
| The measure is mentioned as a narrower declared metric | 64 |
`dataset-tools.ts` 118 and `mcp-server-runtime.ts` 1921: "the measure is
mentioned as a narrower declared metric" |
| Another measure candidate left for the word is asked about first; the
field answers only if the question settles nothing | 64 | spec 333-335:
"with another measure candidate left for the term, that one is asked
about first and the field answers only if the question settles nothing"
|
Not restated, on purpose: "its dataset's entry still lists it" (spec
332), which changes nothing a client does. The tool texts say "the
field"; the dispatch text said "base field". The skill uses the tool
texts' word and states the relationship-path case once, so the two do
not say one thing twice.
### Skill size (ruling record 6513306068)
Raise path the standing ruling 「A:先削重复,余额按实测提高」 (ruling record
6513306068, letter B): the deletion of restatement in the same file is
the listing instruction above.
| Reading | Before (`origin/main` ac97540) | After (fcdacb2) |
|:--|--:|--:|
| `skills/objectstack-ask/SKILL.md`, lines | 127 | 132 |
| `skills/objectstack-ask/SKILL.md`, bytes | 7516 | 8185 |
| same file, ratchet tokens (27-byte stamp line unpriced) | 1873 | 2040
|
| all 14 `skills/*/SKILL.md`, lines | 2475 | 2480 |
| ratcheted bundle total, tokens | 186955 | 187122 |
Bytes by part: step 1 bullet +385, step 2 row +337, the row that keeps
the listing +28, the paragraph's half -81; net +669. `ceil((8185 - 27) /
4) = ceil(8158 / 4) = 2040` (+167), pinned at the measurement, zero
headroom. Eval fixtures are measured and not ratcheted: the eval file
goes 39453 to 43750 bytes.
## Tests
All at fcdacb2, heavy runs under `os-verify-lock.sh`.
- `pnpm --filter @objectstack/mcp test`: 89 files, 1669 tests passed (it
holds the generated module and the served `GET /mcp/skill` section
byte-equal to the skill, `skill-single-source-34686.test.ts`).
- `pnpm --filter @objectstack/mcp typecheck`: exit 0.
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
scripts/platform-catalog.test.ts
src/shared/retired-key-migrate-sentence.test.ts
scripts/export-list.test.ts` (the spec tests that read `skills/**` or
name the ratchet script): 3 files, 44 tests passed.
- `skill-evals --dry-run --skills objectstack-ask` parses the catalog:
27 behaviour cases and 7 trigger cases; no model was called.
- No pin test reads the changed sentences' content, so none was updated.
The one test that reads the skill text is the byte-equality pin above.
<details><summary>Ablation: the new step 2 row deleted on disk, then
restored</summary>
`node scripts/ablation-replace.mjs --file
skills/objectstack-ask/SKILL.md --anchor (the new row) --delete`,
mutation proven on disk (anchor 1 to 0, blob cd96e31 to
68662b5d305c), three checks read on the mutated tree:
- `node scripts/gen-mcp-ask-skill.mjs --check`: exit 1,
"ask-skill.generated.ts is stale against
skills/objectstack-ask/SKILL.md".
- `node scripts/check-skills-token-ratchet.mjs`: exit 1, "is 1956
tokens; its ratchet ceiling is 2040, above the measurement by 84".
- `vitest run src/skill-single-source-34686.test.ts` (mcp): 2 failed, 1
passed ("the generated module equals the skill's data loop", "the served
section equals the skill's data loop").
Restored: blob equals HEAD (cd96e31), `git diff HEAD` empty, `git
status --porcelain` empty; the three checks re-run green (exit 0, exit
0, 3 passed).
What this shows and what it does not: the three checks hold the
generated page and the row's price to the skill. None of them reads what
the sentence says. The check that would is the model eval (cases 26 and
27), and it was not run: NOT MEASURED: skill evals, reason: a model
round is the eval seat's, not a local gate.
</details>
## Acceptance notes
- `LIST_DATASETS_DESCRIPTION` lives in
`packages/services/service-analytics/src/dataset-tools.ts`, not in the
spec file; the spec file holds the `candidates` description. Both were
read as sources.
- The eval file had no 销售 / 销售额 case before this PR; the near-miss that
asks was case 17, in English ("sales" near Sales Amount). Case 17 is
kept as it was and case 27 adds the Chinese pair from the ADR note.
- The catalogue lists no `field` and no `filter` for a measure, so a
client cannot test the rule itself: what it sees is the measure missing
from `candidates` and the field named in `nextStep.note`. The step 2 row
is keyed on that.
- Local gates: `dispatch-gates.mjs --commands` derived 91 families at
fcdacb2; `--ran`: 91 accounted for, 88 run and exit 0, 3
NOT-MEASURED, 0 unrun. The three: `node
scripts/check-plugin-teardown-shape.mjs --self-test` (exit 3, its pinned
fixture commit is outside this shallow clone), `pnpm
check:dual-build-cjs-loads` (exit 3, needs a whole-repo build), `pnpm
check:pm-dispatch-gates` (my own `timeout` fired, exit 124, at 560 s
alone in the foreground; no verdict). All three are left to CI; this
diff touches none of their inputs.
- Run beyond the derived set, each exit 0: `node
scripts/gen-mcp-ask-skill.mjs --check`, `pnpm check:pm-skill-ratchet`,
`pnpm --filter @objectstack/spec run check:skill-examples` (341
examples), `check:skill-refs`, `check:skill-served-sections`, `pnpm
--filter @objectstack/skills build`, `node
scripts/check-platform-checklist.mjs --changed-from origin/main` (0
anchored files in the change set).
## Verification
Read first, by risk:
1. `skills/objectstack-ask/SKILL.md`: the new step 2 row (line 64) and
the new step 1 bullet (lines 49-53), against the table above; then the
listing instruction's move (line 62 and the paragraph at lines 75-78),
which is the deletion the ratchet raise rests on.
2. `scripts/check-skills-token-ratchet.mjs`: the `objectstack-ask` row
and its comment, the only row touched.
3. `skills/objectstack-ask/evals/metric-selection-fallback.json`: cases
26 and 27, their `must_contain` and `must_not_contain` tokens.
Two-minute check: `node scripts/gen-mcp-ask-skill.mjs --check && node
scripts/check-skills-token-ratchet.mjs` prints "is current with
skills/objectstack-ask/SKILL.md" and "skills/objectstack-ask/SKILL.md is
2040 tokens (ceiling 2040; headroom 0)".
Signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzeatqKfTRUzTJVa9jQ
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1e1cacb commit 38ab473
5 files changed
Lines changed: 77 additions & 11 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
43 | 48 | | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2931 | 2931 | | |
2932 | 2932 | | |
2933 | 2933 | | |
2934 | | - | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
2935 | 2957 | | |
2936 | 2958 | | |
2937 | 2959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | | - | |
| 62 | + | |
58 | 63 | | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
253 | 274 | | |
254 | 275 | | |
255 | 276 | | |
0 commit comments