From e16ec49dab9170e5a89262a26c9f22eb37231628 Mon Sep 17 00:00:00 2001 From: os-bill Date: Wed, 25 Nov 2026 23:53:09 +0000 Subject: [PATCH 1/2] docs(skills): objectstack-ai teaches the ask_ai action, the Ask AI button on a record The AI skill now has a subsection under Actions as AI Tools for `type: 'ask_ai'`: what the action does (pins the assistant's conversation to the record it runs on and opens it, sending no message), where it is declared (`locations: ['record_header']` or `['record_more']`, with a `defineAction` example that type-checks against the spec), what the parse refuses beside it (`target`, `ai.exposed: true`, a dashboard header `actionType: 'ask_ai'`), that nothing serves it headless (`list_actions` skips it, `run_action` refuses it, no `action_` tool), and that the console draws it only where the assistant surface is on and the AI service honours a conversation focus. Paid for by deleting restatement in the same file; the token ceiling is unchanged (6801; the file measures 6786). A new eval case asks for an Ask AI button on the contract record page. Claude-Session: https://claude.ai/code/session_01Utp6CZfqUFGzpwvVwRfzYS Co-authored-by: Claude --- .changeset/37217-skill-ask-ai-action.md | 26 +++++++++ skills/objectstack-ai/SKILL.md | 57 +++++++++++-------- .../evals/skills-tools-knowledge.json | 10 ++++ 3 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 .changeset/37217-skill-ask-ai-action.md diff --git a/.changeset/37217-skill-ask-ai-action.md b/.changeset/37217-skill-ask-ai-action.md new file mode 100644 index 00000000000..dad3a314e78 --- /dev/null +++ b/.changeset/37217-skill-ask-ai-action.md @@ -0,0 +1,26 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): `objectstack-ai` teaches the `ask_ai` action — the **Ask AI** button on a record + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-ai/SKILL.md`, a new subsection *The Ask AI button — `type: 'ask_ai'`* under *Actions as AI Tools*: + +- What the action does: it pins the assistant's conversation to the record it runs on and opens the assistant, sending no message; it is declared on the object in `locations: ['record_header']` or `['record_more']`, with a `defineAction` example that type-checks against the spec. +- What the parse refuses beside it: a `target`, `ai.exposed: true`, and `actionType: 'ask_ai'` on a dashboard header (a header runs on no record). +- That nothing serves it headless: `list_actions` skips it, `run_action` refuses it, and no `action_` tool exists for it. +- Where it is absent rather than disabled: the console draws it only where the assistant surface is on and the AI service honours a conversation focus. + +Paid for by deleting restatement in the same file, with the token ceiling unchanged (6801; the file now measures 6786): + +- the *App AI Blueprint* table (its three rows restate *Skill Configuration*, *Knowledge Sources* and the `defineStack` note); +- the alias sentence under *Platform agents* (`data_chat` / `metadata_assistant` for old bookmarks: the agent type is closed to third parties, so no author writes either); +- the pointer to `references/_index.md` for `AgentSchema` (the *References* section already points there); +- the rung-2 sentence "Read that file for the exact set" (the sentence before it names the file); +- the two product-analogy parentheticals beside `ask` and `build`; +- the memory clause of pitfall 1, kept to its two facts (the required keys and that there is no storage backend to choose). + +`evals/skills-tools-knowledge.json`: a new case 10 asks for an Ask AI button on the contract record page; the expected answer is a `type: 'ask_ai'` action in `record_header` with no `target` and no `ai.exposed: true`. diff --git a/skills/objectstack-ai/SKILL.md b/skills/objectstack-ai/SKILL.md index d0cb8bebd3b..e28810338ac 100644 --- a/skills/objectstack-ai/SKILL.md +++ b/skills/objectstack-ai/SKILL.md @@ -69,8 +69,7 @@ A `skill.tools[]` entry resolves against the union of four sources tools, flattened from `PLATFORM_TOOLS_BY_PACKAGE` in `packages/spec/src/system/constants/platform-tool-names.ts`: data / knowledge tools from `service-ai`, schema / metadata / package tools from - `service-ai-studio`. Read that file for the exact set: it is the registry - the lint rule checks against. + `service-ai-studio`. 3. **`action_`** — one tool per AI-exposed Action of your own stack (`PLATFORM_TOOL_FAMILY_PREFIXES`). **The default path** for anything your app does. @@ -179,6 +178,32 @@ decided entirely by the skip rule above — `actionSkipReason(action, ctx)` and `actionRequiresApproval(action)` (from `@objectstack/service-ai`) answer both questions, and Studio's "AI exposure" diagnostics use the same predicates. +### The **Ask AI** button — `type: 'ask_ai'` ☁️ + +Pins the assistant's conversation to the record the action runs on and opens +it, sending no message. Declare it on the object, in +`locations: ['record_header']` or `['record_more']`: + + +```typescript +import { defineAction } from '@objectstack/spec'; + +export default defineAction({ + name: 'ask_about_contract', + label: 'Ask AI', + objectName: 'contract', + type: 'ask_ai', + locations: ['record_header'], +}); +``` + +It names nothing and is never a tool: the parse refuses a `target`, +`ai.exposed: true`, and `actionType: 'ask_ai'` on a dashboard header (a header +runs on no record). Nothing serves it headless: `list_actions` skips it, +`run_action` refuses it, and no `action_` tool exists for it. The console draws +it only where the assistant surface is on **and** the AI service honours a +conversation focus; elsewhere it is absent, not disabled. + --- ## MCP — the open-edition AI path @@ -350,9 +375,9 @@ there is **no top-level `temperature` / `maxTokens`** on an agent 1. **Mistaking `guardrails` for a gate.** `guardrails` is enforced per user turn by the AI runtime ☁️ — token and time limits, blocked tool names and categories refused — but it is a limit, not an approval; `memory` is enforced by the AI - runtime ☁️ too — long-term notes are recalled and reflected on, `maxEntries` - and `reflectionInterval` are required once `longTerm.enabled` is true, and - there is no storage backend to choose — and neither is a gate. For a gate + runtime ☁️ too (`maxEntries` and `reflectionInterval` are required once + `longTerm.enabled` is true; there is no storage backend to choose), and is + no gate either. For a gate that is **enforced**, use `enableActionApproval: true` (approval queue ☁️), `ai.requiresConfirmation` on the **action** (its door only, pitfall 2), or `approval: 'always'` on an MCP @@ -378,37 +403,23 @@ there is **no top-level `temperature` / `maxTokens`** on an agent --- -## App AI Blueprint - -| Layer | File | Pattern | -|:--|:--|:--| -| Reusable skill | `src/skills/lead-qualification.skill.ts` | `defineSkill` — `instructions` + trigger conditions + a toolset where every name resolves; pick a `surface` | -| Knowledge source | `src/knowledge/sales-kb.ts` | `KnowledgeSourceSchema` metadata, registered at boot via `KnowledgeServicePlugin({ sources })` | -| Central registration | `defineStack({ skills: [...] })` | `agents` / `tools` / `skills` are the only AI stack collections | - ---- - ## Platform agents — reference only ☁️ The `agent` type is **closed** to third parties (`allowRuntimeCreate:false`, `allowEnvironmentOverlay:false`; ADR-0063 §2) and `os g agent` is retired: a stack-authored agent is filtered out of `listAgents()`, refused outright by -`loadAgent()`, and 404s on chat. `AgentSchema`'s full field list is in -[references/_index.md](./references/_index.md). +`loadAgent()`, and 404s on chat. The runtime ships **exactly two** agents, bound by *surface*. **`ask`** is the -data product (≈ Claude Chat): conversational read / query / explore over records +data product: conversational read / query / explore over records plus running the business actions the app exposes, end-user audience, RLS-bounded, canonical id `ask` (`ASK_AGENT_NAME`), and the implicit copilot for any app that does not pin `app.defaultAgent`. **`build`** is the authoring -product (≈ Claude Code): agentic authoring of *metadata* through plan → draft → +product: agentic authoring of *metadata* through plan → draft → verify → publish, builder audience, governance-gated, pinned by Studio via `app.defaultAgent`. There is **no per-turn intent classifier** — a `build`-shaped request arriving at `ask` is declined and redirected, never silently re-routed -into authoring (ADR-0063 §1/§5). `data_chat`→`ask` and -`metadata_assistant`→`build` resolve through the alias table for old bookmarks -and persisted `agent_id`s; they are **not** vocabulary — always write `ask` / -`build`. +into authoring (ADR-0063 §1/§5). An agent's tool set is the **union of its surface-compatible skills' tools** — there is no global fall-through (ADR-0064), so `ask` cannot author by diff --git a/skills/objectstack-ai/evals/skills-tools-knowledge.json b/skills/objectstack-ai/evals/skills-tools-knowledge.json index 7d5d2048d5f..4c5cdcd0d4c 100644 --- a/skills/objectstack-ai/evals/skills-tools-knowledge.json +++ b/skills/objectstack-ai/evals/skills-tools-knowledge.json @@ -90,6 +90,16 @@ "must_contain": ["split", "strategy", "markdown", "maxChars"], "must_not_contain": ["chunkSize", "chunkOverlap", "overlap: 100"] } + }, + { + "id": 10, + "prompt": "Add an Ask AI button to the contract record page, so a user can ask the assistant about the contract they are looking at. Write the action.", + "expected_output": "Emits a `defineAction` with `type: 'ask_ai'`, `objectName: 'contract'` and `locations: ['record_header']` (or `['record_more']`), with no `target` and no `ai.exposed: true`: the action pins the assistant's conversation to the record and opens it, sending no message. States that it is never a tool (`list_actions` skips it, `run_action` refuses it, no `action_` tool exists for it) and that the console draws it only where the in-app assistant is on and honours a conversation focus; elsewhere it is absent, not disabled.", + "files": [], + "assertions": { + "must_contain": ["ask_ai", "record_header", "locations"], + "must_not_contain": ["target:", "exposed: true", "actionType"] + } } ] } From 05555e04f3298c989234451bc030e19ab3361236 Mon Sep 17 00:00:00 2001 From: os-bill Date: Thu, 26 Nov 2026 00:29:41 +0000 Subject: [PATCH 2/2] docs(skills): contract-review fixes for the ask_ai skill PR The changeset states the measured token count (6787) and says why the Blueprint row was stale rather than restated. Eval case 10's must_not_contain keeps only `target:`, a token a correct answer never carries, and case 9's reference answer no longer spells the `chunkSize` token it forbids, so both references pass the grader they declare. Claude-Session: https://claude.ai/code/session_01Utp6CZfqUFGzpwvVwRfzYS Co-authored-by: Claude --- .changeset/37217-skill-ask-ai-action.md | 6 +++--- skills/objectstack-ai/evals/skills-tools-knowledge.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.changeset/37217-skill-ask-ai-action.md b/.changeset/37217-skill-ask-ai-action.md index dad3a314e78..14ca26288f0 100644 --- a/.changeset/37217-skill-ask-ai-action.md +++ b/.changeset/37217-skill-ask-ai-action.md @@ -14,13 +14,13 @@ Metadata-protocol: none - That nothing serves it headless: `list_actions` skips it, `run_action` refuses it, and no `action_` tool exists for it. - Where it is absent rather than disabled: the console draws it only where the assistant surface is on and the AI service honours a conversation focus. -Paid for by deleting restatement in the same file, with the token ceiling unchanged (6801; the file now measures 6786): +Paid for by deleting restatement in the same file, with the token ceiling unchanged (6801; the file now measures 6787): -- the *App AI Blueprint* table (its three rows restate *Skill Configuration*, *Knowledge Sources* and the `defineStack` note); +- the *App AI Blueprint* table (its first two rows restate *Skill Configuration* and the `KnowledgeServicePlugin` wiring; its third row's claim that `agents` / `tools` / `skills` are the only AI stack collections was stale, since `aiContexts` is a `defineStack` key too); - the alias sentence under *Platform agents* (`data_chat` / `metadata_assistant` for old bookmarks: the agent type is closed to third parties, so no author writes either); - the pointer to `references/_index.md` for `AgentSchema` (the *References* section already points there); - the rung-2 sentence "Read that file for the exact set" (the sentence before it names the file); - the two product-analogy parentheticals beside `ask` and `build`; - the memory clause of pitfall 1, kept to its two facts (the required keys and that there is no storage backend to choose). -`evals/skills-tools-knowledge.json`: a new case 10 asks for an Ask AI button on the contract record page; the expected answer is a `type: 'ask_ai'` action in `record_header` with no `target` and no `ai.exposed: true`. +`evals/skills-tools-knowledge.json`: a new case 10 asks for an Ask AI button on the contract record page; the expected answer is a `type: 'ask_ai'` action in `record_header` with no `target` and no `ai.exposed: true`; its `must_not_contain` holds only `target:`, a token a correct answer never carries. Case 9's reference answer no longer spells the `chunkSize` token it forbids (it says "no chunk-size key"), so the reference passes its own grader; the assertions are unchanged. diff --git a/skills/objectstack-ai/evals/skills-tools-knowledge.json b/skills/objectstack-ai/evals/skills-tools-knowledge.json index 4c5cdcd0d4c..1559a2efba3 100644 --- a/skills/objectstack-ai/evals/skills-tools-knowledge.json +++ b/skills/objectstack-ai/evals/skills-tools-knowledge.json @@ -84,7 +84,7 @@ { "id": 9, "prompt": "Index our `policy_doc` records (`title`, `body`) for the assistant with the in-memory adapter. Each body is a long Markdown handbook with headings; answers should cite one section, at most 600 characters, and neighbouring passages should overlap by 100 characters.", - "expected_output": "Emits a `KnowledgeSourceSchema.parse({...})` record with `adapter: 'memory'` (the adapter that takes the service's passages) and `source: { kind: 'object', object: 'policy_doc', contentFields: ['title', 'body'], split: { strategy: 'markdown', maxChars: 600 } }`: one section per heading, each passage embedded with its heading path, 600 characters at most unless the embedder's input limit is lower. Declines the overlap: passages never overlap, and the `knowledge.chunk_overlap` setting is retired (a write naming it is refused `400 UNKNOWN_KEY`), so it writes no overlap key and no `chunkSize`.", + "expected_output": "Emits a `KnowledgeSourceSchema.parse({...})` record with `adapter: 'memory'` (the adapter that takes the service's passages) and `source: { kind: 'object', object: 'policy_doc', contentFields: ['title', 'body'], split: { strategy: 'markdown', maxChars: 600 } }`: one section per heading, each passage embedded with its heading path, 600 characters at most unless the embedder's input limit is lower. Declines the overlap: passages never overlap, and the `knowledge.chunk_overlap` setting is retired (a write naming it is refused `400 UNKNOWN_KEY`), so it writes no overlap key and no chunk-size key.", "files": [], "assertions": { "must_contain": ["split", "strategy", "markdown", "maxChars"], @@ -98,7 +98,7 @@ "files": [], "assertions": { "must_contain": ["ask_ai", "record_header", "locations"], - "must_not_contain": ["target:", "exposed: true", "actionType"] + "must_not_contain": ["target:"] } } ]