Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/34868-ask-skill-reads-candidates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@objectstack/skills': patch
'@objectstack/mcp': patch
---

docs(skills): the `objectstack-ask` skill reads `candidates` for a word that matched nothing

Clause-②: no
Metadata-protocol: none

`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.

What a connected client now reads, where it differs from before:

- 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.
- 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.
- 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.
- 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 (非指标口径).
- 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.

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.
14 changes: 5 additions & 9 deletions packages/mcp/src/ask-skill.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export const ASK_SKILL_DATA_LOOP: string = [
' `term`, the `member` it names (`measures.<name>` or `dimensions.<name>`) and',
' `matchedOn`. A word matches only when it equals a member\'s name, label or',
' synonym (case, spacing, `_` and `-` aside), never by similarity.',
'- A word that matched nothing may have `candidates` on the answer: members',
' offered as possible readings, each a `{ term, dataset, member }` pointer to a',
' member the same answer lists. A candidate is not a match.',
'- No `list_datasets` among your tools: this environment serves you no governed',
' metrics. Go to step 4.',
'',
Expand All @@ -35,17 +38,10 @@ export const ASK_SKILL_DATA_LOOP: string = [
'| 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. |',
'| 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. |',
'| 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. |',
'| 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. |',
'| 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. |',
'| 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. |',
'| 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. |',
'| `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. |',
'',
'The same answer lists every dataset you may query with all its measures,',
'matched or not (a call without `terms` returns that catalogue too), so the',
'loose-form check needs no second read. A loose form is a word a listed',
'measure\'s name, label or description contains, directly or in translation:',
'"revenue" against Won Revenue, Annual Revenue and Planned Revenue; "金额"',
'against several amounts.',
'',
'When you ask, the reply is the question alone: no figure, and no tool call',
'until the user answers. `partial: true` on the answer means the catalogue may',
'be incomplete; `warning` says why, and you repeat it when you fall back.',
Expand Down
12 changes: 11 additions & 1 deletion scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,17 @@ export const CEILINGS = new Map([
// a match either. 5848 -> 6105 bytes (+257), less the 20-byte stamp line:
// 5828 -> 6085 priced bytes, ceil(6085 / 4) = 1522 (+65). Still the new
// file's own measurement, pinned AT it, zero headroom; no other row moves.
['skills/objectstack-ask/SKILL.md', 1522],
// 1522 -> 1491, a LOWERING, re-measured on the PR that makes step 2 read the
// answer's `candidates` (ADR-0149 D3 amendment note): a word with no match
// and a candidate listed is a question for the user, a lone candidate
// included, and no match with no candidate is the labelled fallback. Cut:
// the two loose-form rows and the paragraph that defined a loose form over
// the catalogue, since the server's `candidates` replaces the client's own
// check. Added: one step 1 bullet naming `candidates`, and the two rows that
// read it. 6105 -> 5981 bytes (-124), less the 20-byte stamp line:
// ceil(($(wc -c < skills/objectstack-ask/SKILL.md) - 20) / 4) == ceil(5961 / 4)
// = 1491 (-31). Pinned AT the measurement, zero headroom; no other row moves.
['skills/objectstack-ask/SKILL.md', 1491],
]);

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

Expand All @@ -48,17 +51,10 @@ wrote its business definition) outranks a number you work out yourself.
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| `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. |

The same answer lists every dataset you may query with all its measures,
matched or not (a call without `terms` returns that catalogue too), so the
loose-form check needs no second read. A loose form is a word a listed
measure's name, label or description contains, directly or in translation:
"revenue" against Won Revenue, Annual Revenue and Planned Revenue; "金额"
against several amounts.

When you ask, the reply is the question alone: no figure, and no tool call
until the user answers. `partial: true` on the answer means the catalogue may
be incomplete; `warning` says why, and you repeat it when you fall back.
Expand Down
Loading
Loading