Repository navigation
feat(ai): a skill names the context pack it works from, and its MCP prompt takes a record id - #37552
Conversation
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
…sites Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
…nces, not as a second export Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 5 package(s): 56 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 20 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
…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
…roperty Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 72dc23a · 2026-11-26T15:11Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Inputs read: card #37141 (body and all five comments; no earlier contract record on it), PR #37552 (body, file list, net diff against
① Derived judgments
② Semver levelClause-②: yes (widening) — right. The changeset bumps spec, mcp, lint, runtime and platform-objects The generated mirror ③ Boundary flags
④ Design judgment
S1 (should-fix) — the long-lived stdio door offers the record argument where
S2 (should-fix) —
Nits, none affecting the contract:
No must-fix. S1 and S2 are open on this head and each earns a delta review of its fix. Seat questions:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…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>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta review of the record on head
① Derived judgmentsUnchanged. The delta adds no key, no export and no accept-set change. ② Semver levelClause-②: yes (widening) — unchanged and right. ③ Boundary flags
④ Design judgmentS1: closed.
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: Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 维护者速读
席位意见:ACCEPT。所有 should-fix 已关闭,剩 6 个 nit。复核中另发现一项低危信息暴露,来自 ADR 原文本身,不是代码错误,已交安全席位处理,不卡这个 PR。 席位核对 (delta)Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Adding |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对 — landing terms correctedHead-sha: The seat ACCEPT 7197662619 stands, except item 1's "GOVERNED, Tier H" and item 6.
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对 (merge-only delta)Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对 — landing ruling (shared-budget leg)Head-sha: The seat rules A: land at this head. Readings on this head, from the area: the regeneration was a no-op; the PR's own diff is byte-identical to |
|
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
Status: ready + auto-merge (merge queue). On MERGED, #37141 closes by |
Fixes #37141
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #37611
维护者速读
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.
packages/spec—SkillSchema.context?: string, a bare pack name (ROUTER_ADDRESSABLE_NAME_PATTERN; a face likeacme-policy_documentis refused). A skill that declares it and does not bindget_record_contextintools(by name or a matching wildcard) is refused at parse, located ontools(refuseUnboundRecordContext, asuperRefine).skillBindsRecordContextTool(tools)is the one predicate both the refusal and the lint advisory ask. Liveness row inliveness/skill.jsonnaming its reader; acontextcontrol inskill.form.ts.packages/mcp/src/skill-prompts.ts—skillPromptRecordContextresolves a skill'scontextby the one rule (resolvePackageScopedHolders, ADR-0150 D3) over the same pack listingget_record_contextselects 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/listlists one optional argument,recordId; given, the one message isinstructions, a blank line,SKILL_PROMPT_RECORD_CONTEXT_LINE, and the call as one JSON object{objectName, recordId, context}. The id is only ever aJSON.stringifystring value; the pack is never inlined. Without the argument (or with acontextthat resolves to no pack) the result is byte-identical to the same skill without the key. A blank id is refused-32602.McpSkillBridgegains optionallistContextPacksandpackageResolutionClosure.registerSkillPrompts) and the long-lived stdio server (MCPServerRuntime.bridgePrompts, which takes the closure as an optional 4th argument;plugin.tspasses it from the engine registry throughpackageResolutionClosure). 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 registersget_record_context(natively or bridged from the AI registry;servesTool).plugin.tsnow bridges the data tools before the prompts so that registration is visible. Without the tool a skill withcontextis listed there as before: no argument, no platform line, the prompt byte-identical to today.packages/runtime/src/domains/mcp.tshands the/mcpbridge the same pack listing the record-context members read (gated on its record-context seam) and the skill's package closure.packages/lint— insidevalidateAiToolReferences(where skills are validated,os validate):ai-skill-context-unknown(acontextnaming no pack in the stack's ownaiContexts; 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) andai-skill-context-omitted(a skill bindingget_record_contextwithoutcontextwhile an object has more than one pack; one finding per such object). Both warnings.contextrow 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 servedskillschema's top-level properties inmetadata-protocol(17 → 18). The runtime bridge test pays@objectstack/metadataat module top (check:test-source-alias).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.tsnow importsrecord-context-tools.zod.ts), and five new sites indropped-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.md52 → 53 lines; everySKILL.mdsummed 4961 → 4961 lines (none touched).Tests
packages/spec/src/ai/skill.test.ts— parse refusal without the binding (located ontools), wildcard bindings, control withoutcontext, face/non-snake refused, the predicate.packages/mcp/src/skill-prompts.test.ts— the argument list; the stdio server withget_record_contextregistered 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); acontextnaming no pack lists no argument and the prompt is unchanged; a connection that does not serveget_record_contextdoes 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/mcpbridge 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 since72dc23a315and 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):if (skillBindsRecordContextTool(skill.tools)) return;→ always return.skill.test.ts: 1 failed / 25 passed (the refusal case). Restored blobf49db7f7....(this.servesTool(GET_RECORD_CONTEXT_TOOL_NAME)→...(true—skill-prompts.test.ts: 1 failed / 50 passed (the no-get_record_contextstdio case). Restored blob310b8d9c== HEAD.The record is ${recordId}.→skill-prompts.test.ts: 2 failed / 48 passed (message shape, record-id-only-in-JSON). Restored blobbc176cb1.Acceptance notes
ai-skill-tool-unresolvedwarning formcpPrompt: false+contextno longer fires on this tree: Row 9, objectstack half:get_record_contextjoinsPLATFORM_TOOLS_BY_PACKAGEand gets itschatbot.toollabel in every locale #37190 already putget_record_contextintoPLATFORM_TOOLS_BY_PACKAGE['service-ai'], so the name resolves for an in-product skill (validate-ai-tool-references.test.ts"resolves get_record_context on a mcpPrompt: false skill" pins that). Nothing was suppressed here.contextagainst the stack's ownaiContexts(one holder, D3 step 1); a pack only a dependency package ships is reported as unknown byos validate. The runtime prompt resolves it through the closure.objectstack-aiskill docs teachcontextand the record argument), 37141 跟进:技能 context 指向依赖包资料包时误报,stdio MCP 未按工具绑定过滤技能 #37609 (lint reads the closure forai-skill-context-unknown; a general tool-binding filter on the stdio door).packageResolutionClosureresolves a package skill'scontextto its own package's pack only, never environment-wide.packages/mcp/src/mcp-server-runtime.ts,packages/mcp/src/plugin.tsandpackages/runtime/src/domains/mcp.ts(+ its skill-read test): the bridges that feed the prompt surface; without them the key would have no reader at run time.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(bridgePromptsregistration withargsSchema).Generated by Claude Code
https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc