Skip to content

feat(ai): a skill names the context pack it works from, and its MCP prompt takes a record id - #37552

Merged
objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/issue-37141-skill-context-key
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/issue-37141-skill-context-key

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37141

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #37611

维护者速读

  • 用户能看到什么变化:写技能的作者可以给技能指定一个资料包;外部 AI 经 MCP 调这个技能时可以带一条记录的编号,提示词会让模型先读这条记录的资料。不带编号时提示词和以前完全一样。
  • 为什么做:这是「记录 AI 问询」专题的第 8 行,把技能和资料包连起来,应用内助手(第 9 行,云端)也要读这个键。
  • 出错会怎样:只影响声明了这个新键的技能;没有技能用到它时一切照旧。可以直接撤回这个合并。
  • 要你做的:无。

What changes

ADR-0160 D8, with point 1's advisory (D1, amended 2026-11-25) and ADR-0150's addendum of 2026-11-25, reader 2.

  1. packages/spec — SkillSchema.context?: string, a bare pack name (ROUTER_ADDRESSABLE_NAME_PATTERN; a face like acme-policy_document is refused). A skill that declares it and does not bind get_record_context in tools (by name or a matching wildcard) is refused at parse, located on tools (refuseUnboundRecordContext, a superRefine). skillBindsRecordContextTool(tools) is the one predicate both the refusal and the lint advisory ask. Liveness row in liveness/skill.json naming its reader; a context control in skill.form.ts.
  2. packages/mcp/src/skill-prompts.ts — skillPromptRecordContext resolves a skill's context by the one rule (resolvePackageScopedHolders, ADR-0150 D3) over the same pack listing get_record_context selects from: from the skill's own package (own pack, else the one holder in its closure), or as a caller with no package for an environment skill; a refusal resolves to no pack, never one picked by order. The pack is handed on by its face (deriveAiFaceName), so the tool's selection reads back exactly that pack. When it resolves, prompts/list lists one optional argument, recordId; given, the one message is instructions, a blank line, SKILL_PROMPT_RECORD_CONTEXT_LINE, and the call as one JSON object {objectName, recordId, context}. The id is only ever a JSON.stringify string value; the pack is never inlined. Without the argument (or with a context that resolves to no pack) the result is byte-identical to the same skill without the key. A blank id is refused -32602. McpSkillBridge gains optional listContextPacks and packageResolutionClosure.
  3. Both MCP doors — the per-request HTTP surface (registerSkillPrompts) and the long-lived stdio server (MCPServerRuntime.bridgePrompts, which takes the closure as an optional 4th argument; plugin.ts passes it from the engine registry through packageResolutionClosure). The stdio door applies no general binding filter (that stays on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609), so its skill bridge gets the pack listing only when that server registers get_record_context (natively or bridged from the AI registry; servesTool). plugin.ts now bridges the data tools before the prompts so that registration is visible. Without the tool a skill with context is listed there as before: no argument, no platform line, the prompt byte-identical to today. packages/runtime/src/domains/mcp.ts hands the /mcp bridge the same pack listing the record-context members read (gated on its record-context seam) and the skill's package closure.
  4. packages/lint — inside validateAiToolReferences (where skills are validated, os validate): ai-skill-context-unknown (a context naming no pack in the stack's own aiContexts; it judges ADR-0150 D3 step 1 only, so its message states the run-time cost only unless a dependency package ships the pack — reading the closure in lint is 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609) and ai-skill-context-omitted (a skill binding get_record_context without context while an object has more than one pack; one finding per such object). Both warnings.
  5. Consequences CI found — the skill form's new context row moves the platform-objects metadata-form translation bundles (check:i18n): regenerated, and the row's label and help text authored in all 10 translated locales (the echo-decision pins forbid source-text fills). Two count pins move: the metadata-form translated-label positive control (837 → 838; 840 after merging main's 839) and the served skill schema's top-level properties in metadata-protocol (17 → 18). The runtime bridge test pays @objectstack/metadata at module top (check:test-source-alias).
  6. Generated — authorable-surface/ai.json, api-surface/ai.json, export-origins/ai.json, liveness/state-counts/skill.md, content/docs/references/ai/skill.mdx, skills/objectstack-ai/references/_index.md (the skill-refs mirror: skill.zod.ts now imports record-context-tools.zod.ts), and five new sites in dropped-refinements.baseline.json (the new refinement does not project into JSON Schema; the build printed the corrected entries, copied verbatim, header total 1210 → 1215).

skills/** readings (generated mirror only): skills/objectstack-ai/references/_index.md 52 → 53 lines; every SKILL.md summed 4961 → 4961 lines (none touched).

Tests

  • packages/spec/src/ai/skill.test.ts — parse refusal without the binding (located on tools), wildcard bindings, control without context, face/non-snake refused, the predicate.
  • packages/mcp/src/skill-prompts.test.ts — the argument list; the stdio server with get_record_context registered lists the argument and answers the HTTP door's message, and with no tools offers no argument and answers today's prompt byte for byte; the message shape with and without the argument; the record id only as a JSON string value (a hostile id with quotes and newlines); a context naming no pack lists no argument and the prompt is unchanged; a connection that does not serve get_record_context does not serve the skill (skillBindingServed); a blank id refused; D3 resolution (own package, closure, environment, refusal → no pack); the long-lived stdio server answering the same messages as the HTTP door.
  • packages/lint/src/validate-ai-tool-references.test.ts — unknown pack (with near-miss), the item-6 advisory incl. a wildcard binding, and controls.
  • packages/runtime/src/domains/mcp-merged-skill-read.test.ts — the /mcp bridge lists packs (read decorations stripped) only where the record-context seam is served, and the closure is the one walk over the engine registry.

Suites at head 5a8a19361a (under the verify lock, each VERDICT command-exit 0): spec 900 files / 28509 passed + 1 todo; lint 236 / 9687; mcp 86 / 1575; typecheck spec, mcp, lint green. Unchanged since 72dc23a315 and green there: runtime 650 / 12067, platform-objects 128 / 2179, metadata-protocol 370 / 23440.

Ablations (each committed first, each restored with blob == HEAD proven by scripts/ablation-replace.mjs):

  • Parse refusal: anchor if (skillBindsRecordContextTool(skill.tools)) return; → always return. skill.test.ts: 1 failed / 25 passed (the refusal case). Restored blob f49db7f7.
  • Stdio gate (rework): ...(this.servesTool(GET_RECORD_CONTEXT_TOOL_NAME) → ...(true — skill-prompts.test.ts: 1 failed / 50 passed (the no-get_record_context stdio case). Restored blob 310b8d9c == HEAD.
  • Record id as JSON only: the line joined with The record is ${recordId}. → skill-prompts.test.ts: 2 failed / 48 passed (message shape, record-id-only-in-JSON). Restored blob bc176cb1.

Acceptance notes

Verification

Two-minute check

pnpm --filter @objectstack/mcp exec vitest run src/skill-prompts.test.ts -t "a skill with context takes a record" — 15 cases green (incl. the nested resolution block); the "given the record id" case prints the message as instructions, the fixed line, then {"objectName":"policy","recordId":"pol_1","context":"policy_document"}.

Read first: packages/mcp/src/skill-prompts.ts (skillPromptRecordContext, skillPromptResult), packages/spec/src/ai/skill.zod.ts (refuseUnboundRecordContext), packages/mcp/src/mcp-server-runtime.ts (bridgePrompts registration with argsSchema).


Generated by Claude Code

https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:ai tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/lint, @objectstack/mcp, @objectstack/platform-objects, @objectstack/runtime, @objectstack/spec, touching 45 documentable anchor(s). ⚠️ 7 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/spec/api-surface/ai.json, packages/spec/authorable-surface/ai.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

56 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 90f7555e426b29c871643fe58423869352cc0879.

⛔ 20 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 7 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/spec/api-surface/ai.json, packages/spec/authorable-surface/ai.json, …) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 60 pages)
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 90f7555e426b29c871643fe58423869352cc0879 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 38999e421cc278e623ff9d247cc201b48b2b74ff — the merge of head bcac5161a9cb05f64b0392be2d3e0fa02ed76dc4 into base 90f7555e426b29c871643fe58423869352cc0879, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 38999e421cc278e623ff9d247cc201b48b2b74ff && git checkout 38999e421cc278e623ff9d247cc201b48b2b74ff
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 90f7555e426b29c871643fe58423869352cc0879 bcac5161a9cb05f64b0392be2d3e0fa02ed76dc4 && git checkout -B drift-repro 90f7555e426b29c871643fe58423869352cc0879 && git merge --no-ff bcac5161a9cb05f64b0392be2d3e0fa02ed76dc4

node scripts/docs-audit/affected-docs.mjs --json 90f7555e426b29c871643fe58423869352cc0879

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 90f7555e426b29c871643fe58423869352cc0879 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ntrol; pay the metadata load at collection

The skill form's new `context` control moves the platform-objects metadata-form
bundles (check:i18n), and the runtime bridge test reaches a lazy
`@objectstack/metadata` import (check:test-source-alias).

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
…shipped locale

The extractor fills a new leaf with the source text; the echo-decision pins
require the metadata-form catalog to carry no fills, so the label and help
text are authored per locale and the positive-control count moves 837 → 838.

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
…ill-context-key

# Conflicts:
#	packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 72dc23a · 2026-11-26T15:11Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 72dc23a3156359a969a4603da794cc0510a8a498
Local-runs: none
Scope: packages/spec/src/ai/skill.form.ts, packages/spec/src/ai/skill.zod.ts, skills/objectstack-ai/references/_index.md + packages/mcp/src/skill-prompts.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/plugin.ts, packages/runtime/src/domains/mcp.ts, packages/lint/src/validate-ai-tool-references.ts, packages/spec/liveness/skill.json
Security-touching: yes

Inputs read: card #37141 (body and all five comments; no earlier contract record on it), PR #37552 (body, file list, net diff against main), and the 70 check-runs on this head (60 success, 10 skipped, 0 failed). Contract read on main: ADR-0160 D1 ("Advisory reports"), D4, D8 and point 7; ADR-0150's addendum of 2026-11-25 (ai_context joins bucket 3), reader 2. The rest of the diff (tests, translation bundles, count pins, generated spec ledgers, changeset, content/docs) is the lane seat's.

Security-touching: yes is meant. The changed hunks of skill.zod.ts teach which package's pack a skill may reach (the ADR-0150 D3 closure, an isolation rule) and on which connections a record-reading prompt is offered.

① Derived judgments

  • Accept set of SkillSchema: widened, right. context was an unknown key of a strict object and refused; it is now accepted as a bare name (ROUTER_ADDRESSABLE_NAME_PATTERN, the pattern AiContextSchema.name uses). refuseUnboundRecordContext returns at once when context is undefined, so no skill that parsed on main is refused here. Nothing narrows.
  • A face is refused at context: right. ADR-0150 addendum, reader 2: "The key gains no qualified spelling". A face holds -, the pattern does not.
  • Public surface, @objectstack/spec/ai: skillBindsRecordContextTool added, right. It is in api-surface/ai.json and export-origins/ai.json; one predicate, read by the refusal and by lint.
  • Public surface, @objectstack/mcp: additive, right. McpSkillBridge gains two optional members; SkillPrompt gains optional recordContext; skillPromptResult gains an optional second parameter; MCPServerRuntime.bridgePrompts gains an optional fourth. A host written against main compiles and behaves as before.
  • Public surface, @objectstack/lint: two rule ids added, both warnings, right.
  • Wire: prompts/list gains arguments for a skill whose context resolves; prompts/get reads recordId for such a skill only. Additive. A get with no argument builds the same result object as on main (skillPromptResult: recordId undefined, text is instructions).
  • Refinement not projected to JSON Schema: recorded, right. The five new sites in dropped-refinements.baseline.json are the ledger of that; a JSON-Schema-only validator does not refuse the unbound skill, the server parse does.

② Semver level

Clause-②: yes (widening) — right. Metadata-protocol: added — right: one authorable key with a reader, no key removed or re-read.

The changeset bumps spec, mcp, lint, runtime and platform-objects minor. Spec minor matches a new authorable key and a new export. mcp and lint minor match their additions. runtime and platform-objects carry no new export (a bridge member and generated translation rows); minor is not below what they publish. Check Changeset is success on this head. No major is implied by the diff.

The generated mirror skills/objectstack-ai/references/_index.md gains one line, the transitive dependency ai/record-context-tools.zod.ts, which skill.zod.ts now imports. Its text has the form the generator prints for a file whose leading comment is not at the top (the Exports: form, as field.zod.ts and agent.zod.ts have on main). The generated-output gates on this head are success, and that is the verdict on whether it matches the build.

③ Boundary flags

  • SQL push-down: no finding. The diff adds no id materialisation and no in-app join over record data. The one new read is the ai_context metadata listing, the listing get_record_context already selects from, read only when an offered skill names a context.
  • Dev open question (ledger and pin overlap with feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422 and refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366): option A is sound, on two conditions. The second lander regenerates the spec artifacts on the merged tree and takes the printed entries, never a hand sum; and the gates run again on that head. The header total of dropped-refinements.baseline.json and the echo-decision count pin are single lines both PRs change, so git cannot merge them silently. export-origins/ai.json can merge cleanly, and the sorted union is what the build prints. A re-merge moves this head, so this record does not cover it: the new head owes a delta.
  • Deviation, pushed past the overlap check: accepted for the reason above; the conflicts were with sibling PRs, never with main.
  • Deviation, surface beyond the claim: answered by the claim amendment 7195875211. The three bridge files are the reader's wiring; without them the key has no reader at run time (ADR-0049).
  • Deviation, PR body not refreshed: the body does not name the translation bundles, the two count pins or the final head. For the adopting seat; it does not change this verdict.
  • Skills-docs: follow-up owed: flag for the adopting seat. No card number is on the line. The card's acceptance asks for the line; the owed card (skills/objectstack-ai/SKILL.md, references/context-packs.md) is filed and the line rewritten to its number before ACCEPT.
  • Card's "expected" warning for mcpPrompt: false with context: does not fire, and nothing is suppressed. get_record_context is in PLATFORM_TOOLS_BY_PACKAGE on main (Row 9, objectstack half: get_record_context joins PLATFORM_TOOLS_BY_PACKAGE and gets its chatbot.tool label in every locale #37190 landed first), so the name resolves for an in-product skill. The card's expectation was written before that.
  • Dev's two noted, unfiled findings (stdio has no binding filter; lint reads the stack's own packs only): judged in ④ as S1 and S2. The general halves stay on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609; a narrow part of each belongs to this PR.
  • Escalated: one security-relevant reading of ADR-0160 D8 against D4 was sent to the dispatching seat out of band. It concerns the ADR's own text, not a disagreement between this code and the ADR, and is not graded here.

④ Design judgment

packages/spec/src/ai/skill.zod.ts against ADR-0160 D8 and its first consumer.

  • The key, the refusal and its location hold. SkillSchema is the one schema behind defineSkill, stack.skills and the /meta save (metadata-type-schemas.ts), so the refusal is on every write path. The message names the tool, the key and both fixes, and is located on tools. In zod 4 the refinement runs after the object's own issues clear, so an author with another error sees this one second; acceptable.
  • skillBindsRecordContextTool matches the trailing-wildcard rule bindingEntryServed applies (@objectstack/mcp), so a binding the refusal accepts is one the binding filter reads the same way.

S1 (should-fix) — the long-lived stdio door offers the record argument where get_record_context is not served, and three sentences of this PR say it cannot happen.

  • skill.zod.ts, on refuseUnboundRecordContext: "a prompt that tells the model to call a tool the connection lacks is never offered". liveness/skill.json and the module doc of skill-prompts.ts say the same.
  • MCPServerRuntime.bridgePrompts applies no binding filter (known, on main), and this PR gives its skill bridge listContextPacks unconditionally. So on a stdio host with no record-context service, a skill with context lists recordId and its get carries the platform-written line telling the model to call a tool the server does not register.
  • The HTTP bridge does not do this: packages/runtime/src/domains/mcp.ts assigns listContextPacks only inside if (seams.recordContextTools), and its test has the control. The PR's own stdio parity case builds a runtime with no tools at all and gets the fixed line.
  • Before this PR the stdio door relayed only the author's text. The line is the platform's, and D8 gives the binding as the thing that keeps it off such a connection; the card's acceptance has the same bullet.
  • Fix, either one: offer recordContext on bridgePrompts only when that server registers get_record_context (this needs no general binding filter, which stays on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609); or narrow the three sentences to the registerSkillPrompts surface and name the stdio gap with its card.

packages/lint/src/validate-ai-tool-references.ts against D8, D1's advisory and ADR-0150 addendum reader 2.

  • ai-skill-context-omitted: the condition is D1's, sentence for sentence (a skill that binds the tool, no context, an object with more than one pack). It reads the stack's own packs, so a dependency's packs can only make it under-report. No false positive found. A broad wildcard (get_*) is advised too, which is true of the call it describes.

S2 (should-fix) — ai-skill-context-unknown judges ADR-0150 D3 step 1 only, and its message states a run-time consequence that is false for a dependency's pack.

  • The addendum, reader 2: "The author surfaces that validate a skill judge it by the same rule." The rule's step 2 resolves a pack held in the skill's dependency closure, and skillPromptRecordContext does resolve it.
  • For that legal configuration os validate reports: "so the skill's MCP prompt takes no record and its get_record_context call is refused". Neither half is true there.
  • Reading the closure in lint may stay on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609. What this PR owes is a message that does not assert the consequence when the stack cannot see the pack's holder: say that this stack does not define the pack and that the consequence holds unless a package it depends on ships it. The function's own doc already says this; the author-facing text does not.

packages/mcp/src/skill-prompts.ts, mcp-server-runtime.ts, plugin.ts, packages/runtime/src/domains/mcp.ts against D8, sentence by sentence.

  • "lists one optional prompt argument, the record id; the object is the pack's root": holds, and only when the name resolves (card item 5).
  • "the skill's instructions; one fixed platform-written line; those arguments as one JSON object": holds. The line is a constant with no interpolated client value. The object is JSON.stringify of three members, on one line.
  • "appears only there, as a JSON string value ... never joined into the line": holds. The id follows the instructions and the line, inside a quoted, escaped value; it cannot reach the instructions part. A hostile id with quotes and newlines is pinned by test and by the dev's ablation.
  • "The pack itself is not placed in the prompt": holds.
  • "Without the argument the prompt is what it is today": holds on both doors. The SDK passes an empty object when arguments is absent, so the stdio get with no arguments is served.
  • Resolution: resolvePackageScopedHolders with the skill's package as caller. Own pack, else the one holder in the closure, else no pack. With no closure function the default is the empty set, so a package skill never resolves environment-wide. An environment skill resolves as a caller with no package. A refusal resolves to no pack. Two rows of one holder are answered as no pack before the holder source can throw.
  • The pack is handed on by its face, as reader 2 says. selectContextPack narrows to the root first and then matches the face, so the tool reads back the pack resolved here, or refuses; I found no input that makes it read a different pack.
  • "A context that names no pack ... no other pack is substituted": holds; no argument is offered.

packages/spec/src/ai/skill.form.ts: one plain control, with the #19331 precedent cited. The help text agrees with the schema. The form does not carry the refinement; the save refuses, located on tools, which the form shows on that control.

skills/objectstack-ai/references/_index.md: generated, one line, judged in ②. It teaches no security behaviour.

packages/spec/liveness/skill.json: the row names a real reader and a real validator. Its note carries the S1 sentence.

Nits, none affecting the contract:

  • N1 (nit) — the prompt surface reads raw rows and does not ask skillBindsRecordContextTool again, so a row that reached the store unparsed with context and no binding would be offered the argument. It relies on the parse.
  • N2 (nit) — a pack listing that throws fails prompts/list and every prompts/get, including a get with no argument and skills with no context, once any offered skill names one. The skill read usually fails with it.
  • N3 (nit) — the two new rule ids have no os explain entry; ai-skill-tool-unresolved has one.
  • N4 (nit) — packHolderOf and contextPackHoldings restate holderOf and contextPackCandidates of @objectstack/service-record-context. Two copies of one reading can drift.
  • N5 (nit) — the record id has no length bound, and JSON.stringify leaves U+2028 and U+2029 unescaped. Both stay inside the string value.

No must-fix. S1 and S2 are open on this head and each earns a delta review of its fix.

Seat questions:

  1. Yes at parse, which every write path goes through (defineSkill, stack.skills, the /meta save behind the form). The form itself does not check; the save does. The MCP doors do not re-check a raw row (N1). The error is a clear author error, located on tools.
  2. No. A package skill reaches its own pack, then the one holder in its closure; anything else resolves to no pack, and no closure function means own package only. The prompt reads no record: the read is the tool call, as the caller. recordId is listed only when the pack resolves. On stdio it is listed even where the tool is not served (S1).
  3. Holds on both doors. A record value cannot reach the instructions part.
  4. Agrees, except the binding sentence on the stdio door (S1). The lint side departs from ADR-0150 addendum reader 2 at step 2 (S2).
  5. ai-skill-context-omitted: right condition, no false positive. ai-skill-context-unknown: false positive on a dependency's pack. Neither general item needs to move off 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609; a narrow part of each is owed here (S1, S2).
  6. All three right. The mirror line has the generator's form and the generated-output gates are success.
  7. Sound, on the two conditions in ③; the re-merged head owes a delta.

Implemented-by: claude/issue-37141-skill-context-key
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 72dc23a3156359a969a4603da794cc0510a8a498
REWORK — L1, seat repo:objectstack#5

  1. Shape: draft against main. 34 files, +1023/−78. GOVERNED (skills/** mirror, published schema), Tier H, security-touching. Clause-②: yes (widening), Metadata-protocol: added and spec minor are right.
  2. Premise: SkillSchema.context, refused at tools unless get_record_context is bound, with the pack resolved by ADR-0150 D3 through the closure, holds on every write path. The message shape holds on both doors, and a record value cannot reach the instructions.
  3. Gates: contract record 7196143365 (CONTRACT_REVIEW_TIER, verified on the transcript) reads PASS, with two should-fix findings owed before the handoff. CI on this head: 0 failed.
  4. Owed before the handoff (ids from the record):
    • S1: the stdio door offers recordId and the platform line where get_record_context is not served. MCPServerRuntime.bridgePrompts has no binding filter, and its skill bridge gets listContextPacks unconditionally, while the HTTP bridge gates it on seams.recordContextTools. Offer the argument on stdio only when that server registers the tool. Pin it with the existing stdio parity test, which builds a runtime with no tools.
    • S2: ai-skill-context-unknown judges only D3 step 1, so for a pack a dependency ships, its message says the prompt "takes no record and its get_record_context call is refused", and both halves are false. Narrow the message to what lint knows (the stack's own packs). Reading the closure in lint stays on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609.
    • Skills-docs: file the owed skills-docs card (skills/objectstack-ai/SKILL.md, references/context-packs.md) under 记录 AI 问询 8:技能键 context,MCP 技能提示词可带记录参数 #37141, and rewrite the Skills-docs: follow-up owed line to its number.
    • PR body: refresh it to the final head, with the translation bundles and the two count pins.
  5. Accepted deviations and dev points: N1 to N5 are accepted. Point 1 (mcpPrompt: false warning, n/a after Row 9, objectstack half: get_record_context joins PLATFORM_TOOLS_BY_PACKAGE and gets its chatbot.tool label in every locale #37190) is accepted. Point 2: the second lander of feat(ai): a skill names the context pack it works from, and its MCP prompt takes a record id #37552, feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422 and refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366 regenerates on the merged tree and re-runs the gates, and that head owes a delta.
  6. Landing terms: after the delta the same reviewer re-checks it. Then the seat adds security and hands it to the maintainer (Tier H).

…rs get_record_context; the unknown-context warning says what it judges

The long-lived server has no binding filter, so its skill bridge now gets the
pack listing only when get_record_context is registered there (data tools
are bridged before prompts). ai-skill-context-unknown judges the stack's own
packs only, so its message states the run-time cost on that condition.

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5a8a19361abd5c6042f9d902d88b8d62f6782c96
Local-runs: none
Scope: packages/spec/src/ai/skill.form.ts, packages/spec/src/ai/skill.zod.ts, skills/objectstack-ai/references/_index.md + packages/mcp/src/skill-prompts.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/plugin.ts, packages/runtime/src/domains/mcp.ts, packages/lint/src/validate-ai-tool-references.ts, packages/spec/liveness/skill.json
Security-touching: yes

Delta review of the record on head 72dc23a3. Read: the one commit between the two heads (8 files, +82 / -24), the net diff against main (34 files), the PR body as it stands, and the check-runs on this head: 62 success, 14 skipped, 2 cancelled. The two cancelled runs (Check Changeset, PR-body guards) were superseded by later runs of the same names on this head, both success. Nothing in sections ①, ② and ③ of the earlier record is changed by the delta except as said below.

Security-touching: yes is meant, for the reason the earlier record gives: skill.zod.ts teaches which package's pack a skill may reach and where a record-reading prompt is offered. The delta changes a sentence of that teaching.

① Derived judgments

Unchanged. The delta adds no key, no export and no accept-set change. servesTool is private. The stdio door now offers the record argument on fewer servers than at 72dc23a3 (only where the tool is registered); against main that is still an addition.

② Semver level

Clause-②: yes (widening) — unchanged and right. Metadata-protocol: added — unchanged and right. The changeset keeps its five minor bumps; its mcp and lint paragraphs now state the stdio condition and what the unknown-context warning judges, and both agree with the code. Check Changeset is success on this head.

③ Boundary flags

  • SQL push-down: no finding; the delta adds no read.
  • Skills-docs: now reads follow-up #37611. The earlier flag is answered. Whether 37141 跟进:AI 技能文档教会技能的 context 键与 MCP 记录参数 #37611 says what the line claims is the adopting seat's to read; it is outside this brief's inputs.
  • PR body: refreshed. It names the translation bundles, both count pins, the stdio condition and the follow-up cards. The earlier flag is answered.
  • Reordering in plugin.ts (data tools before resources and prompts): changes nothing else.
  • Whether servesTool sees AI-registry tools registered later: it does not, and that is consistent. bridgeTools takes one snapshot of the registry, so a tool that joins the registry afterwards is never served by this server either. servesTool is read once, when the skill bridge is built. A host that bridged more tools after its prompts would under-offer the argument, never over-offer it; the method's doc says to bridge tools first.
  • Escalated item of the earlier record: unchanged by the delta, still with the dispatching seat.

④ Design judgment

S1: closed.

  • bridgePrompts gives its skill bridge listContextPacks only when servesTool('get_record_context') holds. Without the listing no skill resolves a pack, so prompts/list carries no argument and skillPromptResult ignores a sent recordId: the prompt is the one on main.
  • The native tool reaches nativeToolNames through the names wireBridgeTools returns, and the new with-tool case asserts it through tools/list. The no-tool case pins the absence of the argument and of the line, and the dev's ablation of the gate turns it red.
  • The three sentences (skill.zod.ts, liveness/skill.json, the module doc of skill-prompts.ts) now state the stdio condition and agree with the code. The general binding filter stays on 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609, as agreed.

S2: closed.

Nits of the earlier record: N1, N2, N3, N4 and N5 are untouched by the delta and stay nits, left as accepted deviations.

One new nit:

No must-fix, no should-fix.

Seat questions, as changed by the delta:
2. recordId is now listed on the stdio door only where the tool is registered; the earlier exception is gone.
4. The code agrees with ADR-0160 D8 on both doors.
5. ai-skill-context-unknown still reports a dependency's pack, with a message that is true for it. The closure reading stays on #37609 and does not block.
Answers 1, 3, 6 and 7 stand as given.

Implemented-by: claude/issue-37141-skill-context-key
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

维护者速读

  • 改了什么:AI 技能新增 context 键,用来指定一个记录资料包。外部 AI 通过 MCP 调用这个技能时,可以带一个可选的 recordId,拿到该记录的上下文。前提是技能绑定了 get_record_context 工具,否则保存时直接拒绝。不带参数时,提示词和原来逐字一致。另外新增两条 lint 警告。共 34 个文件,+1090/−87,spec 升 minor。
  • 为什么:记录 AI 问询 8:技能键 context,MCP 技能提示词可带记录参数 #37141,落实 ADR-0160 D8 第 8 行。
  • 风险:资料包按 ADR-0150 D3 的包闭包解析,技能拿不到闭包外的包。记录值只出现在 JSON 字符串里,进不了指令部分。HTTP 和 stdio 两个入口都只在服务了该工具时才提供参数。PR 讲的是谁能拿到哪个包,所以加了 security 标签。
  • 要你做什么:批准合并。契约复核两轮,最终 PASS 在评论 7197650830,Head-sha 5a8a19361abd5c6042f9d902d88b8d62f6782c96。

席位意见:ACCEPT。所有 should-fix 已关闭,剩 6 个 nit。复核中另发现一项低危信息暴露,来自 ADR 原文本身,不是代码错误,已交安全席位处理,不卡这个 PR。

席位核对 (delta)

Head-sha: 5a8a19361abd5c6042f9d902d88b8d62f6782c96
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: draft against main. 34 files, +1090/−87. GOVERNED (skills/** mirror, published spec schema), Tier H, security-touching. Clause-②: yes (widening), Metadata-protocol: added, spec minor.
  2. Closed: S1 (stdio bridgePrompts offers recordId only when the server serves get_record_context; the three sentences now match), S2 (the lint message states only what lint knows). The Skills-docs line is now follow-up #37611, which is filed and covers the skill docs. The PR body is refreshed.
  3. Gates: delta record 7197650830 (CONTRACT_REVIEW_TIER, verified on the transcript) reads PASS, with no open must-fix or should-fix. CI on this head: 0 failed (the two cancelled runs were replaced by green runs on the same head).
  4. Accepted deviations: N1 to N5, and N6 (a misplaced doc block in mcp-server-runtime.ts).
  5. Out of scope and where it went: 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609 (lint reads a dependency's pack; closure in lint), 37141 跟进:AI 技能文档教会技能的 context 键与 MCP 记录参数 #37611 (skills docs). One security item is with the owner seat. Overlap with feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422 and refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366: whoever lands second regenerates on the merged tree, and that head owes a delta.
  6. Landing terms: Tier H. The seat adds security and pm:awaiting-merge, and requests os-zhuang. The maintainer's approval decides; after approval the seat or the area lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Adding security: the schema teaches which package's context pack a skill may reach and where a record-reading prompt is offered (seat ACCEPT 7197662619, item 1).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对 — landing terms corrected

Head-sha: 5a8a19361abd5c6042f9d902d88b8d62f6782c96

The seat ACCEPT 7197662619 stands, except item 1's "GOVERNED, Tier H" and item 6. check-governed-merges --pr 37552 reads this PR as NOT governed: skills/objectstack-ai/references/_index.md is a pure regeneration (byte-equal to gen:skill-refs on this tree, the #11705 exception), no other path hits the register, and 1177 changed lines is under 3000. No maintainer hand-off is owed and none was written.

  1. Landing terms (corrected): not governed, under 3000 lines, no decision owed. The area lands it. The security label stays. If feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422 or refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366 lands first, the regenerated head owes a delta before landing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对 (merge-only delta)

Head-sha: 105cf4815b6189a6ad8f0253742bc40b4cb2ff5a
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: one merge of origin/main at 33a31dc7b0 into 5a8a1936, with no conflicts. A full regeneration changed nothing. check-governed-merges --pr 37552 on this head still reads NOT governed, because _index.md is a pure regeneration.
  2. Delta: the PR's own +/- lines against each head's merge base are identical at 5a8a1936 and at this head. No new contract review is owed: delta record 7197650830 and ACCEPT 7197662619 stand.
  3. Gates: CI on this head: 60 success, 10 skipped, 0 failed (Test Core 11/11).
  4. Accepted deviations: unchanged (N1 to N6).
  5. Out of scope and where it went: unchanged (37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609, 37141 跟进:AI 技能文档教会技能的 context 键与 MCP 记录参数 #37611).
  6. Landing terms: not governed, under 3000 lines. The area lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对 — landing ruling (shared-budget leg)

Head-sha: bcac5161 (merge head)

The seat rules A: land at this head. landing-k asks for another merge because main touched the skills token ratchet after PRBASE (#37645, skills/objectstack-ui/**). This PR's only skills/** path is the generated skills/objectstack-ai/references/_index.md, a different bundle with its own ceiling row, so the two ratchet inputs do not share a budget. The merge group runs check-skills-token-ratchet on the merged tree; a red there dequeues this ungoverned PR and nothing lands wrong.

Readings on this head, from the area: the regeneration was a no-op; the PR's own diff is byte-identical to 105cf481 (34 files, +1090/−87); check-governed-merges reads NOT governed; CI 60 success, 10 skipped, 0 failed. Seat ACCEPT 7197662619 and re-ACCEPT 7199375459 stand. If the merge group goes red on the ratchet, merge main once and come back to the seat.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Landing: ACCEPT 7197662619 at 5a8a193 (delta contract record 7197650830, PASS), re-ACCEPT 7199375459 at merge head 105cf48, and seat ruling 7200431886 to land at merge head bcac5161a9cb05f64b0392be2d3e0fa02ed76dc4.

Probe Reading
Check-runs on head 60 success, 10 skipped, 0 failed, 0 in progress
Governed / size check-governed-merges --pr 37552 on this head, run with node_modules: NOT governed (0 of 34 paths after 1 generated-artifact lift: skills/objectstack-ai/references/_index.md is a pure gen:skill-refs regeneration, #11705); 1177 changed lines ≤ 3000; mergeable_state clean
PR's own lines byte-identical to 105cf48: git diff 6cb7440707 bcac5161a9 and git diff 33a31dc7b0 105cf4815b both sha256 8c4be7e03f315c296d0f676af8f0220628c821170919557bec621da965f0725e (34 files, +1090/-87)
Regeneration os-regen-merge of origin/main 6cb7440, full spec regeneration a no-op
landing-k PRBASE 90f7555, K = 3; shared-budget leg names the skills token ratchet (main #37645, skills/objectstack-ui/**); ruled disjoint from this PR's only skills path (the generated skills/objectstack-ai/references/_index.md) by 7200431886 — the merge group runs the ratchet on the merged tree

Status: ready + auto-merge (merge queue). On MERGED, #37141 closes by Fixes; #37611 (skills docs) unblocks; #37609 carries the lint closure read (item 2 of it, the stdio binding gate, shipped here). If the merge group goes red on the ratchet: merge main once and return to the seat.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 18:27
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit ddd5941 Nov 26, 2026
71 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37141-skill-context-key branch November 26, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:ai security size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

记录 AI 问询 8:技能键 context,MCP 技能提示词可带记录参数

2 participants