Skip to content

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

Done
2 of 2 issues completed

Description

@objectstack-fleet

repo:cloud#1 · os-warren · session_01JQwxbZSA7o5vcLjQjM1myV

Filing gate: ③ maintainer-directed. Source: topic #36996. Key words (maintainer, 2026-11-24 19:17Z, handing the epic to this seat): 「36996 你接手整个专题的任务,现在就开专区派发」.
Grading: area:ai · Feature · p2 (topic child at the epic's level; it blocks row 9) · reach: n/a (new capability) · evidence: read.

维护者速读

  • 做什么:技能可以声明自己用哪个资料包(新键 context)。外部 AI 经 MCP 调这个技能时可以带一条记录的编号,提示词会让模型先调 get_record_context 读这条记录的资料。
  • 谁受益:写制度问询、客户问询这类技能的作者。外部 AI 用户一步就拿到针对这条记录的技能。
  • 不做会怎样:技能和资料包连不上,应用内助手(第 9 行)也没有可读的键。
  • 需要你做的:无。

What

Implements ADR-0160 D8:

  1. packages/spec/src/ai/skill.zod.ts#SkillSchema gains context?: string.
    • A skill that declares it must bind get_record_context in tools, by name or by a matching wildcard. Otherwise it is refused at parse.
    • The key gets its row in packages/spec/liveness/skill.json, with its reader.
  2. packages/mcp/src/skill-prompts.ts: a skill with context lists one optional prompt argument, the record id.
    • When the argument is given, the message carries three things:
      • the skill's instructions;
      • one fixed platform line telling the model to call get_record_context with the arguments that follow;
      • those arguments as one JSON object (objectName, recordId, context).
    • The record id is never joined into the line, and the pack is never inlined.
    • Without the argument, the prompt is unchanged.
  3. A context that names no pack is reported where skills are validated.
  4. packages/spec/src/ai/skill.form.ts gains a control for context. Precedent: #19188 split: 47 top-level zod-only keys are scalar controls needing one form row each #19331, where surface was declared but had no control.
  5. When context names no existing pack, the prompt lists no record argument and is exactly today's prompt. Reading the pack is what fills objectName.
  6. Advisory validation (ADR-0160 point 1, as accepted with conditions on 2026-11-25): warn when an object has more than one pack and a skill binds get_record_context without context.

Expected after this lands: until row 9, packages/lint/src/validate-ai-tool-references.ts warns on get_record_context for a skill with mcpPrompt: false that declares context. ADR-0160's split note says the warning is expected and true. Do not suppress it. #37190 ends it.

Acceptance

  • Metadata-protocol: added, with its Skills-docs: line.
  • Tests:
    • the parse refusal without the binding;
    • the argument list;
    • the message shape with and without the argument;
    • the record id appears only as a JSON string value;
    • context naming no pack: no record argument, and the prompt is unchanged;
    • a connection that does not serve get_record_context does not serve the skill (skillBindingServed, as D8 says);
    • the advisory warning of item 6.

Changes (added 2026-11-25)

Added by the maintainer's session (maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby) after an independent Fable review of rows 5–10, which the maintainer accepted: 「同意你的建议」.

Blocked-by: #37140
Blocked-by: #37180

Parent: #36996 (row 8). Reader: the epic's owning seat (repo:cloud#1), which dispatches it when row 5 merges.
Dedupe (objectstack, is:issue, open and closed): "skill prompt" in:title 7 (all closed; #32767 binding served, #34237 docs, #36650 knowledge tool; none adds an argument) · "mcpPrompt" context record 1 (#35068 closed, unrelated).

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    priority:p2
    pm:blocked
    area:ai
    on Nov 24, 2026
  2. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Blocker added 2026-11-25T04:12Z at repo:objectstack#3's request (7152609034; L1-w nit N3, 7152486548)

    Blocked-by: #37216

  3. added
    pm:queue
    and removed
    pm:blocked
    on Nov 25, 2026
  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim: PM loop round 9 · area ai-36996 (topic #36996 non-cloud rows; the maintainer, verbatim, 2026-11-25T12:57Z project thread: 「开一个 36996 专题,接手剩余任务」; concurrency per area 3, 2026-11-25T23:33Z) · 2026-11-26T11:31Z
    Session: session_01Utp6CbeF2saT6wUBV4E9uc
    Account: os-bill
    Area: ai-36996
    Branch: claude/issue-37141-skill-context-key
    Worktree: objectstack-issue-37141
    Domain: domain:spec
    Seat: repo:objectstack#5
    File surface: packages/spec/src/ai/skill.zod.ts, skill.form.ts, skill.test.ts, packages/spec/liveness/skill.json and the generated spec artifacts they move (regenerated, not hand-edited); packages/mcp/src/skill-prompts.ts and its test; the skill validation site that reports an unknown pack and the advisory of item 6 (packages/lint/src/**, the existing skill/ai-context validators and their tests); the Skills-docs: mirror the protocol line requires; root .changeset/. ⛔ No packages/services/service-record-context/**, no docs/adr/**. Stop on breach and report.
    Container & model: M, mode:subagent, model: default — dispatch-gates --tier: "no path-derived mandate", effort: high
    Clause-②: yes (widening) — SkillSchema gains optional context; the L2 at contract-review tier is owed before the queue
    Metadata-protocol: added
    Responsibility: packages/spec (SkillSchema has no context key) and packages/mcp (skill-prompts.ts lists no record argument) produce the missing link | no platform path covers it | authors of record-inquiry skills and every external AI calling them over MCP
    Premise: holds — on origin/main 276174ab0: skill.zod.ts has no context key; skill-prompts.ts exports skillBindingServed (line 270); skill.form.ts exists. Blockers #37140, #37180, #37216 closed.
    Serial constraints cleared: #37233 (PR #37484, generated spec ai baselines) merged. Sibling #37463 (dispatched now) is fenced out of packages/spec/**: disjoint. #37190 closed.
    Pre-claim deps: #37140 closed, #37180 closed, #37216 closed
    Prior rulings read: ADR-0160 D8 and point 1 (accepted with conditions 2026-11-25); the maintainer's changes of 2026-11-25 on the card; triage unblock 7172444415; ADR-0150 (app plus name)

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 26, 2026
  6. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
      "issue": 37141,
      "status": "done",
      "branch": "claude/issue-37141-skill-context-key",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37552",
      "head": "72dc23a3156359a969a4603da794cc0510a8a498",
      "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
      "premise_still_valid": true,
      "summary": "ADR-0160 D8 row 8. SkillSchema.context?: string (bare pack name, refused at parse on `tools` unless get_record_context is bound by name or a matching wildcard; skillBindsRecordContextTool is the one predicate). The MCP prompt surface resolves the pack by ADR-0150 D3 through resolvePackageScopedHolders over the same merged ai_context listing get_record_context selects from: own package, then its closure; an environment skill resolves as a caller with no package. The pack is handed on by its face. When it resolves, prompts/list lists an optional `recordId`. Given one, the single message is the instructions, a fixed line, and JSON {objectName, recordId, context}. Without it the result is byte-identical. A blank id is answered -32602. Both doors are wired: the per-request HTTP registerSkillPrompts and the long-lived bridgePrompts (closure via plugin.ts); runtime /mcp hands over the pack listing and the closure. Lint adds ai-skill-context-unknown and ai-skill-context-omitted, both warnings, inside validateAiToolReferences. CI turned up three follow-ups, fixed in this PR: the form translation bundles were regenerated and the new row was authored in 10 locales; a module-top metadata import was added to the runtime bridge test (test-source-alias); and two count pins moved (the echo-decision positive control, and served skill properties 17 → 18).",
      "tests": "Full suites at merged head 18429defaf (diff vs 72dc23a315 = one metadata-protocol test pin): spec 899 files / 28504 passed + 1 todo; lint 236 / 9668; mcp 86 / 1554 (pre-merge 8a1a3e1776; post-merge run exit 0); platform-objects 128 / 2179; runtime 650 / 12067 + 25 skipped; all under os-verify-lock, VERDICT command-exit 0. metadata-protocol full suite at 72dc23a315: 370 passed + 9 skipped files / 23440 passed + 45 skipped, VERDICT command-exit 0. Typecheck spec, mcp, lint, runtime, platform-objects, metadata-protocol: all six 'typecheck: Done', VERDICT command-exit 0. Ablation 1 (parse refusal, anchor 'if (skillBindsRecordContextTool(skill.tools)) return;' replaced by an always-return; committed first; ablation-replace.mjs verified on disk): skill.test.ts 1 failed / 25 passed; restored, blob f49db7f7 == HEAD, git diff HEAD empty. Ablation 2 (record id only as JSON, line rewritten to inline 'The record is ${recordId}.'): skill-prompts.test.ts 2 failed / 48 passed; restored, blob bc176cb1 == HEAD. Neither subject resolves through dist (vitest in-package src), so no dist preflight applied.",
      "gates": "Local: dispatch-gates --commands --repo objectstack-ai/objectstack at 18429defaf derived 126 commands (plus check:durability-log-level at 72dc23a315): 123 exit 0; 3 exit 3 PREREQUISITE NOT MET, i.e. NOT MEASURED locally, CI-owned (spec check:skill-examples, check:dual-build-cjs-loads, check:type-check-debt). check:durability-log-level exit 0. --ran reconciliation: 127 derived, 123 run, 4 UNRUN, being those three exit-3 families plus durability-log-level, which ran afterwards with exit 0. Spot reruns post-merge: spec check:generated, api-surface, export-origins, liveness, skill-refs, docs, authorable-surface all 0; check:i18n 0; check:i18n-stale-fill 0; check:test-source-alias 0; check:nul-bytes 0; check-changeset-no-major with the PR body as the event: 0 (LEVEL AXIS discharged, widening + added). CI on 72dc23a315: 70 check-runs, 60 success, 10 skipped, 0 failure. These include Lint & Repo Gates, all Lint lanes, Type Check (workspace, source gates, consumer gates, debt ledger), Check Changeset, PR-body guards, Spec property liveness, Governed Surface Queue Guard, Dogfood Regression Gate, Build Core/UI/Docs, Test Core x11 and Test UI x17. On first push (8a1a3e1776) CI was red on check:i18n and check:test-source-alias; at 18429defaf, Test Core 9/10 was red on metadata-protocol's skill count pin. All three were fixed.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm (Clause-② yes (widening)); CI Dogfood Regression Gate = success",
      "mcp_calls": "0",
      "api_writes": "2 — relay pr_create (objectstack-ai/objectstack#37552, POST pulls via fleet-write run 45822768810; read-back 7618/7618 bytes identical, assignee os-bill, no labels) and this os-dev-report comment (POST issues/37141/comments via post-stamped). 5 git pushes (not REST).",
      "line_budget": "34 files, +1023 / -78 vs origin/main (spec 9, platform-objects 12 generated bundles + 1 pin, mcp 4, lint 3, runtime 2, metadata-protocol 1, content 1, skills mirror 1, changeset 1)",
      "files_changed": ".changeset/37141-skill-context-key.md; content/docs/references/ai/skill.mdx; packages/spec/{src/ai/skill.zod.ts, src/ai/skill.form.ts, src/ai/skill.test.ts, liveness/skill.json, liveness/state-counts/skill.md, authorable-surface/ai.json, api-surface/ai.json, export-origins/ai.json, dropped-refinements.baseline.json}; packages/mcp/src/{skill-prompts.ts, skill-prompts.test.ts, mcp-server-runtime.ts, plugin.ts}; packages/lint/src/{validate-ai-tool-references.ts, validate-ai-tool-references.test.ts, index.ts}; packages/runtime/src/domains/{mcp.ts, mcp-merged-skill-read.test.ts}; packages/platform-objects/src/apps/translations/{10 locales + en}.metadata-forms.generated.ts, object-lifecycle-panel-echo-decisions.test.ts; packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts; skills/objectstack-ai/references/_index.md (generated mirror)",
      "readings": "skills/** (generated mirror only): skills/objectstack-ai/references/_index.md 52 → 53 lines; every skills/**/SKILL.md summed 4961 → 4961 lines (none touched). dropped-refinements header 1210 → 1215 (5 build-printed sites). Served skill top-level properties 17 → 18. Metadata-form translated .label positive control 839 → 840 after merging main.",
      "acceptance": [
        "context key + parse refusal located on tools: PASS (skill.test.ts; ablation 1 turns it red)",
        "recordId argument listed only when context resolves: PASS (skill-prompts.test.ts list/no-pack/no-host-packs cases)",
        "message = instructions + fixed line + JSON {objectName, recordId, context}; id only as JSON value: PASS (hostile-id case; ablation 2 turns it red)",
        "without argument byte-identical: PASS",
        "one resolver (ADR-0150 D3 via resolvePackageScopedHolders, closure via packageResolutionClosure), refusal resolves to no pack: PASS (resolution unit cases)",
        "connection not serving get_record_context withholds the skill: PASS (skillBindingServed case)",
        "both doors (HTTP + long-lived stdio bridgePrompts): PASS (parity case)",
        "lint unknown-context + D1 point-1 omitted advisory: PASS (7 cases)",
        "spec bump minor: PASS (changeset minor; Check Changeset success)",
        "mcpPrompt:false + context warning not suppressed: NOT APPLICABLE on this tree — #37190 already put get_record_context in PLATFORM_TOOLS_BY_PACKAGE['service-ai'], so no warning fires; nothing suppressed (Acceptance notes)"
      ],
      "deviations": [
        "overlap-check gating: from 3e57c77966 on, every pre-push run reported conflicts with sibling PRs, never with main. With #37422, on the hand-edited packages/spec/dropped-refinements.baseline.json, on the generated export-origins/ai.json and (after the merge) on the echo-decision count pin. With #37366, on the generated export-origins/ai.json. I pushed anyway, not stopping as the dispatch's hand-written rule says: the ledger entries are the build's printed output and the pin is an append-only counter. Whoever lands second re-applies them.",
        "main-only conflict at 36ee5c8797 (count pin) resolved by merging origin/main (18429defaf) as the dispatch says; artifacts rebuilt and re-gated after the merge commit",
        "surface beyond the claim's file list: mcp-server-runtime.ts, plugin.ts, runtime domains/mcp.ts (+ test) to wire the reader; platform-objects bundles + pin and the metadata-protocol pin as CI-found consequences of the new form row / schema key; none fenced",
        "PR body (written once at pr_create, not PATCHed per os-dev) does not mention the platform-objects translations, the metadata-protocol pin or the final head; the changeset does. Seat may refresh it",
        "first WIP commit lacked the Co-authored-by half of the trailer pair; push hook passed"
      ],
      "open_questions": [
        { "question": "Ledger/pin conflicts with #37422 (dropped-refinements.baseline.json, echo-decision count pin) — who re-applies?", "options": ["A second lander rebuilds spec and re-applies the printed ledger entries and the counter sum", "B serialize: hold #37552 until #37422 lands, then merge main here"], "recommendation": "A, because both files are counters/ledgers whose correct value is printed by the build or the failing assertion; no hand judgment is lost" }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the long-lived stdio bridgePrompts applies no tool-binding filter (pre-existing, documented in its own describe); a skill with context is listed there whether or not the host serves get_record_context",
        "carrier: none · noted, not filed — lint judges context against the stack's own aiContexts only; a pack shipped by a dependency package reads as ai-skill-context-unknown in os validate while the runtime resolves it via the closure"
      ]
    }

    Generated by Claude Code

  7. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim amendment · 2026-11-26T15:09Z · claim 7190853834 · records the surface PR #37552 needed (os-dev report 7195831625, deviation 3).

    • File surface, added: packages/mcp/src/mcp-server-runtime.ts and packages/mcp/src/plugin.ts (the long-lived bridgePrompts door gets the pack listing and the package closure), packages/runtime/src/domains/mcp.ts and packages/runtime/src/domains/mcp-merged-skill-read.test.ts (the /mcp route hands the listing and closure over), content/docs/references/ai/skill.mdx (the Skills-docs: line), skills/objectstack-ai/references/_index.md (the generated mirror, which makes the PR governed under the skills/** register), packages/platform-objects/src/apps/translations/**/metadata-forms.generated.ts (regenerated for the new form row, authored in 10 locales) with the echo-decision count pin, packages/metadata-protocol/src/protocol.meta-types-degenerate-derivation.test.ts (the served-skill property count pin, 17 → 18), and the generated spec artifacts api-surface/ai.json, export-origins/ai.json, dropped-refinements.baseline.json, liveness/state-counts/skill.md. Clause-②: yes (widening) and Metadata-protocol: added stand; the L2 is owed, and the PR is Tier H.
  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
      "issue": 37141,
      "status": "done",
      "round": "rework (REWORK 7196154770 on contract record 7196143365)",
      "branch": "claude/issue-37141-skill-context-key",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37552",
      "head": "5a8a19361a",
      "previous_head": "72dc23a3156359a969a4603da794cc0510a8a498",
      "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
      "premise_still_valid": true,
      "summary": "S1: MCPServerRuntime.bridgePrompts gives its skill bridge the pack listing only when this server registers get_record_context (new private servesTool: a native data tool or an AI-registry bridged tool). plugin.ts now bridges data tools before prompts so the registration is visible. Without the tool, a skill with context is listed as before: no recordId argument, no platform line, prompt byte-identical. The three sentences (skill.zod.ts refuseUnboundRecordContext doc, skill-prompts.ts module doc, liveness/skill.json note) now name the stdio gate. S2: the ai-skill-context-unknown message now says the pack is not in this stack's aiContexts, and states the run-time cost only unless a dependency ships it; lint does not read the closure (#37609). Skills-docs line is now 'Skills-docs: follow-up #37611'. PR body refreshed via relay issue_patch (bundles, both count pins, stdio gate, #37609, #37611, suites at the new head); signed last line kept. Changeset mcp and lint bullets updated to match.",
      "tests": "At 5a8a19361a, under os-verify-lock, VERDICT command-exit 0 each: spec 900 files / 28509 passed + 1 todo; lint 236 / 9687; mcp 86 / 1575; typecheck spec, mcp, lint all 'typecheck: Done'. The stdio parity test is split in two. (a) A runtime with get_record_context registered (bridgeDataTools first) lists recordId and answers the HTTP door's message. (b) A runtime with no tools: argument absent, the get with recordId equals the bare get byte for byte, and SKILL_PROMPT_RECORD_CONTEXT_LINE is absent. Ablation (fix committed first): anchor '...(this.servesTool(GET_RECORD_CONTEXT_TOOL_NAME)' replaced by '...(true' via ablation-replace.mjs (anchor 1 to 0, blob 310b8d9c to c8850e6b) gave skill-prompts.test.ts 1 failed / 50 passed, the no-tool stdio case. Restored: blob 310b8d9c == HEAD, git diff HEAD empty. Not dist-resolved (in-package src), so no dist preflight.",
      "gates": "Spec build, then check:generated, api-surface, export-origins, liveness, skill-refs, docs and authorable-surface: all exit 0. check:nul-bytes exit 0. Derived list at 5a8a19361a: 127 families, 124 exit 0. 3 exit 3 PREREQUISITE NOT MET (NOT MEASURED locally, fresh worktree without the build closure): check:skill-examples, check:dual-build-cjs-loads, check:i18n. --ran: 127 derived, 124 run, those 3 UNRUN. CI on 5a8a19361a: 62 success, 14 skipped, 2 cancelled, 0 failure. Both cancelled runs (Check Changeset, PR-body guards) were superseded by success reruns after the body edit.",
      "dogfood_battery": "n/a — no `!` in the title, widening arm; CI Dogfood Regression Gate success",
      "mcp_calls": "0",
      "api_writes": "3 this round: relay issue_patch on #37552 twice (runs 45852221317 and the follow-up, which fixed the two-minute-check case count 14 to 15; each read back identical, 9649 bytes) and this comment via post-stamped. 1 git push.",
      "files_changed_this_round": "packages/mcp/src/{mcp-server-runtime.ts, plugin.ts, skill-prompts.ts, skill-prompts.test.ts}; packages/lint/src/validate-ai-tool-references.ts; packages/spec/src/ai/skill.zod.ts (doc only); packages/spec/liveness/skill.json (note); .changeset/37141-skill-context-key.md",
      "overlap": "origin/main merges cleanly, so no merge this round. #37422 and #37366 conflict as before (option A accepted in 7196143365).",
      "deviations": ["Two issue_patch writes instead of one: the first body carried a wrong case count (14, now 15)."],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }

    Generated by Claude Code

  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    ACCEPT → PR #37552 comment 7199375459 (re-ACCEPT at 105cf48; landing on bcac516 per seat ruling 7200431886)

  10. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Merged: PR #37552 at ddd5941898 closed this card by Fixes. Delivered (ADR-0160 D8, row 8): SkillSchema.context (a pack's bare name, refused at tools unless get_record_context is bound); the pack resolves by ADR-0150 D3 (own package, then closure); MCP prompts list one optional recordId only when the pack resolves and the server serves get_record_context (both doors, stdio included); the message is instructions + one fixed line + one JSON object, byte-identical without the argument; lint ai-skill-context-unknown and ai-skill-context-omitted; a form control in 10 locales. Left: #37611 (skills docs, unblocked now), #37609 (lint reads the closure; its stdio item shipped here). pm:dispatched removed.

  11. removed
    pm:dispatched
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aipriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions