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
13 changes: 13 additions & 0 deletions .changeset/35004-ask-skill-after-answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@objectstack/skills': patch
'@objectstack/mcp': patch
---

docs(skills): the `objectstack-ask` skill says what the client does after the user answers an ask-back

Clause-②: no
Metadata-protocol: none

Step 2 of the `objectstack-ask` skill, and the page at `GET /mcp/skill` that is generated from it, told a connected client to ask which reading the user meant and stopped there. It now carries the turn after the answer: an option is used only once the user picks it, and is then computed by its exact name as step 3 says (`query_dataset`, with the source cited from the tool's answer); a reply that names another word ("no, I mean ARR") starts at step 1, a new `list_datasets` lookup with that word, before anything else; a user who only picks none of the options gets step 4, the object-query fallback with its label. This is ADR-0149 D3 rule 1, rule 2 and rule 4 applied to the user's reply; no rule is added. The another-word case is also part of the ask-skill iteration loop (Part of #34996, item a of its third round).

Four restatements are cut from the same file, each keeping its other home, so the skill does not grow: "and in the user's language" in step 1 (beside "Do not translate or reword a term"), "a fragment's matches are not the user's" in the same bullet (beside "a match on a word you supplied is your reading, not the user's"), the "by stage" example and "You still need a measure match" in the grouping row of step 2, and "use none of that word's candidates until the user answers" under the step 2 table, which the new sentence now states for every option. `packages/mcp/src/ask-skill.generated.ts` is regenerated from the skill; no code path changes.
16 changes: 9 additions & 7 deletions packages/mcp/src/ask-skill.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const ASK_SKILL_DATA_LOOP: string = [
'',
'- Lift the question\'s business words: the thing measured ("win rate", "营收",',
' "商机数") and what it is grouped or filtered by ("by stage", "按行业").',
'- Call `list_datasets({ terms })` with those words, as the user wrote them and',
' in the user\'s language. Do not translate or reword a term: a match on a word',
'- Call `list_datasets({ terms })` with those words, as the user wrote them.',
' Do not translate or reword a term: a match on a word',
' you supplied is your reading, not the user\'s. A term is the noun phrase for',
' the thing, kept whole ("travel budget", not "travel" and "budget": a',
' fragment\'s matches are not the user\'s) and without the verbs, time words',
' the thing, kept whole ("travel budget", not "travel" and "budget")',
' and without the verbs, time words',
' and question words around it ("trip days", not "trip days requested";',
' "报销金额", not "报销金额合计是多少").',
'- Each dataset in the answer carries `matches`: one entry per hit, with the',
Expand All @@ -43,13 +43,12 @@ export const ASK_SKILL_DATA_LOOP: string = [
'| 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. |',
'| A word with a measure among its `candidates` | Ask the same way; with one candidate, ask whether it is the one meant. |',
'| A word whose `candidates` are all dimensions | At most a possible grouping: never ask about it, and it never stops a matched measure. |',
'| 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. |',
'| Only a dimension matches | That is a grouping, not a number. Without a measure match, ask which number is meant. |',
'| No match and no candidates for the word for a thing measured | Step 4. |',
'| `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. |',
'',
'When the answer has `nextStep`, follow its `decision` and `note`. If `note`',
'says to answer one measure and ask about a word, do both; use none of that',
'word\'s candidates until the user answers.',
'says to answer one measure and ask about a word, do both.',
'',
'When you only ask, the reply is the question alone: no tool call until the user',
'answers. State no figure of your own in it (no count, total',
Expand All @@ -59,6 +58,9 @@ export const ASK_SKILL_DATA_LOOP: string = [
'instead of asking about some other word\'s matches. `partial: true` on the answer means the catalogue may',
'be incomplete; `warning` says why, and you repeat it when you fall back.',
'',
'Use an option only once the user picks it: compute it by its exact name',
'(step 3). Another word starts at step 1; if they only pick none, go to step 4.',
'',
'## 3. Compute a governed metric',
'',
'- `query_dataset({ datasetName, selection })`. `selection.measures` and',
Expand Down
16 changes: 9 additions & 7 deletions skills/objectstack-ask/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ wrote its business definition) outranks a number you work out yourself.

- Lift the question's business words: the thing measured ("win rate", "营收",
"商机数") and what it is grouped or filtered by ("by stage", "按行业").
- Call `list_datasets({ terms })` with those words, as the user wrote them and
in the user's language. Do not translate or reword a term: a match on a word
- Call `list_datasets({ terms })` with those words, as the user wrote them.
Do not translate or reword a term: a match on a word
you supplied is your reading, not the user's. A term is the noun phrase for
the thing, kept whole ("travel budget", not "travel" and "budget": a
fragment's matches are not the user's) and without the verbs, time words
the thing, kept whole ("travel budget", not "travel" and "budget")
and without the verbs, time words
and question words around it ("trip days", not "trip days requested";
"报销金额", not "报销金额合计是多少").
- Each dataset in the answer carries `matches`: one entry per hit, with the
Expand All @@ -58,13 +58,12 @@ wrote its business definition) outranks a number you work out yourself.
| 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. |
| A word with a measure among its `candidates` | Ask the same way; with one candidate, ask whether it is the one meant. |
| A word whose `candidates` are all dimensions | At most a possible grouping: never ask about it, and it never stops a matched measure. |
| 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. |
| Only a dimension matches | That is a grouping, not a number. Without a measure match, ask which number is meant. |
| No match and no candidates for the word for a thing measured | Step 4. |
| `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. |

When the answer has `nextStep`, follow its `decision` and `note`. If `note`
says to answer one measure and ask about a word, do both; use none of that
word's candidates until the user answers.
says to answer one measure and ask about a word, do both.

When you only ask, the reply is the question alone: no tool call until the user
answers. State no figure of your own in it (no count, total
Expand All @@ -74,6 +73,9 @@ wrote; when their word matched nothing and has no candidates, go to step 4
instead of asking about some other word's matches. `partial: true` on the answer means the catalogue may
be incomplete; `warning` says why, and you repeat it when you fall back.

Use an option only once the user picks it: compute it by its exact name
(step 3). Another word starts at step 1; if they only pick none, go to step 4.

## 3. Compute a governed metric

- `query_dataset({ datasetName, selection })`. `selection.measures` and
Expand Down
20 changes: 20 additions & 0 deletions skills/objectstack-ask/evals/metric-selection-fallback.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@
"must_contain": ["Sales Amount", "Sales Analysis", "?"],
"must_not_contain": ["query_dataset", "aggregate_records", "sales_amount"]
}
},
{
"id": 18,
"prompt": "The user asked: \"What is our retention?\" `list_datasets({ terms: ['retention'] })` answered one dataset, `subscriptions` (label Subscriptions), with `matches: []`; its measures are `logo_retention`, labelled Logo Retention and described as \"Share of customers at the start of the period still subscribed at its end\", and `net_revenue_retention`, labelled Net Revenue Retention and described as \"Recurring revenue kept from existing customers, expansion included\". The answer also carried `candidates: [{ term: 'retention', dataset: 'subscriptions', member: 'measures.logo_retention' }, { term: 'retention', dataset: 'subscriptions', member: 'measures.net_revenue_retention' }]`. You asked which one they meant, listing both, and computed nothing. The user now replies: \"Net Revenue Retention.\" What do you do next, and how do you write the answer?",
"expected_output": "The user picked one of the two options by its label, so that measure is now used, by its exact name as `list_datasets` listed it: the next step is `query_dataset` with `datasetName: 'subscriptions'` and a `selection` whose `measures` is `['net_revenue_retention']`. Calling `list_datasets` again with the label as the term before that is also right: the label equals that one measure. It does not ask again, does not compute Logo Retention as well, and does not fall back to the object tools: the fallback is for a user who picks none of the options. Writes the answer in the user's language, cites the source from the tool's answer (its `sourceLine`, or built from `provenance`, as in \"Metric: Net Revenue Retention (dataset: Subscriptions)\") rather than from memory, uses the measure's `description` to say what the number includes.",
"files": [],
"assertions": {
"must_contain": ["query_dataset", "Net Revenue Retention", "Subscriptions"],
"must_not_contain": ["aggregate_records", "非指标口径", "do you mean", "Do you mean"]
}
},
{
"id": 19,
"prompt": "The user asked: \"What is our retention?\" `list_datasets({ terms: ['retention'] })` answered one dataset, `subscriptions` (label Subscriptions), with `matches: []`; its only measures are `logo_retention`, labelled Logo Retention, and `net_revenue_retention`, labelled Net Revenue Retention. The answer also carried `candidates: [{ term: 'retention', dataset: 'subscriptions', member: 'measures.logo_retention' }, { term: 'retention', dataset: 'subscriptions', member: 'measures.net_revenue_retention' }]`. You asked which one they meant, listing both, and computed nothing. The user now replies: \"No, I mean ARR.\" What is your next tool call, and with what arguments?",
"expected_output": "The reply picks neither option and names another word, so neither option is used and the question starts again at step 1 with that word: the next tool call is `list_datasets` with `terms: ['ARR']`, the word as the user wrote it (not spelled out as annual recurring revenue, and not sent together with `retention`). It is a new lookup because the first answer was matched against `retention` only and lists no measure by that name. Nothing else is called before it: no object tool, and no `query_dataset` on either retention measure. Declining the options leads to the object-query fallback only when the reply brings no other word; here that fallback can follow only from this lookup, if `ARR` has no match and no candidates. It does not ask about retention again.",
"files": [],
"assertions": {
"must_contain": ["list_datasets", "ARR"],
"must_not_contain": ["describe_object(", "aggregate_records(", "非指标口径"]
}
}
]
}
Loading